Changeset 58bbda in git


Ignore:
Timestamp:
Jun 17, 1997, 11:44:32 AM (27 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
623e7ca4e8b2344c62d7c256c94ecdb52b6d1cdb
Parents:
388fe1e36784de6985ec8bb9daeb7bd4f2c0c751
Message:
* hannes/siebert: bugfixes for qring, assignment for proc
  (grammar.y ideals.cc ipassign.cc ipid.cc polys.cc)


git-svn-id: file:///usr/local/Singular/svn/trunk@389 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • Singular/grammar.y

    r388fe1e r58bbda  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: grammar.y,v 1.11 1997-06-11 13:26:10 Singular Exp $ */
     4/* $Id: grammar.y,v 1.12 1997-06-17 09:44:20 Singular Exp $ */
    55/*
    66* ABSTRACT: SINGULAR shell grammatik
     
    307307            prompt_char = '>';
    308308            currid = NULL;
     309            if(siCntrlc)
     310            {
     311              siCntrlc=FALSE;
     312              MYYERROR("abort...");
     313            } 
    309314            if (errorreported)
    310315            {
     
    316321            expected_parms=FALSE;
    317322            noringvars = FALSE;
     323            siCntrlc = FALSE;
    318324          }
    319325        ;
    320326
    321327pprompt:
    322         flowctrl                       /* if, while, for etc */
     328        flowctrl                       /* if, while, for, proc */
    323329        | command ';'                  /* commands returning no value */
    324330          {ifswitch[voice]=0;}
     
    329335        | declare_ip_variable ';'      /* default initialization */
    330336          { $1.CleanUp(); ifswitch[voice]=0;}
    331         | filecmd
     337        | filecmd ';'
    332338          {ifswitch[voice]=0;}
    333339        | returncmd
     
    918924            memcpy(v->next,&r,sizeof(sleftv));
    919925            $$=$1;
     926          }
     927        | PROC_CMD elemexpr
     928          {
     929            #ifdef SIC
     930            if (sic)
     931            {
     932              FreeL((ADDRESS)$2);
     933              MYYERROR("not implemented");
     934            }
     935            #endif
     936            if (iiDeclCommand(&$$,&$2,myynest,PROC_CMD,&idroot,TRUE)) YYERROR;
    920937          }
    921938        ;
     
    10591076
    10601077filecmd:
    1061         '<' stringexpr ';'
     1078        '<' stringexpr
    10621079          { if (iiPStart(NULL,$2,NULL)) YYERROR; }
    10631080        ;
     
    15271544            FreeL((ADDRESS)$3);
    15281545          }
    1529         | PROC_CMD elemexpr '=' expr ';'
    1530           {
    1531             #ifdef SIC
    1532             if (sic)
    1533             {
    1534               $4.CleanUp();
    1535               FreeL((ADDRESS)$2);
    1536               MYYERROR("not implemented");
    1537             }
    1538             #endif
    1539             sleftv v;
    1540             if ((iiDeclCommand(&v,&$2,myynest,PROC_CMD,&idroot,FALSE))
    1541             || (iiAssign(&v,&($4)))) YYERROR;
    1542           }
    15431546        | PROC_DEF STRINGTOK BLOCKTOK
    15441547          {
  • Singular/ideals.cc

    r388fe1e r58bbda  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
     4/* $Id: ideals.cc,v 1.9 1997-06-17 09:44:22 Singular Exp $ */
    45/*
    56* ABSTRACT - all basic methods to manipulate ideals
     
    581582  pEnlargeSet(&(e->m),IDELEMS(e),15);
    582583  IDELEMS(e) = 16;
    583   h2 = std(h1,NULL,isNotHomog,NULL);
     584  h2 = std(h1,currQuotient,isNotHomog,NULL);
    584585  h3 = idMaxIdeal();
    585586  h4=idMult(h2,h3);
    586587  idDelete(&h3);
    587   h3=std(h4,NULL,isNotHomog,NULL);
     588  h3=std(h4,currQuotient,isNotHomog,NULL);
    588589  k = IDELEMS(h3);
    589590  while ((k > 0) && (h3->m[k-1] == NULL)) k--;
     
    614615  idDelete(&h3);
    615616  idDelete(&h4);
    616   if (currQuotient)
    617   {
    618     h2=kNF(e,NULL,currQuotient);
     617  if (currQuotient!=NULL)
     618  {
     619    h3=idInit(1,e->rank);
     620    h2=kNF(h3,currQuotient,e);
     621    idDelete(&h3);
    619622    idDelete(&e);
    620623    e=h2;
     
    14211424  if (idIs0(h1))
    14221425    return idInit(1,h1->rank);
    1423   idSkipZeroes(h1);
    14241426  h3=idPrepare(h1,quot,h,&k,&quotgen,&i,&w);
    14251427  if (w!=NULL) delete w;
     
    14311433  }
    14321434  j = IDELEMS(h1);
    1433   while ((j>0) && (h1->m[j-1] == NULL))
    1434     j--;
    14351435  idDelete((ideal*)ma);
    14361436  *ma = mpNew(j,i);
  • Singular/ipassign.cc

    r388fe1e r58bbda  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
     4/* $Id: ipassign.cc,v 1.13 1997-06-17 09:44:25 Singular Exp $ */
     5
    46/*
    57* ABSTRACT: interpreter:
     
    107109{
    108110#ifdef HAVE_TCL
    109   if (!tclmode) 
     111  if (!tclmode)
    110112#endif
    111113    pShortOut=(int)a->Data();
     
    271273          return TRUE;
    272274        }
    273       } 
     275      }
    274276    }
    275277    else
     
    467469,{jiA_STRING,   STRING_CMD,     STRING_CMD }
    468470,{jiA_STRING,   PROC_CMD,       STRING_CMD }
     471,{jiA_STRING,   PROC_CMD,       PROC_CMD }
    469472,{jiA_POLY,     VECTOR_CMD,     VECTOR_CMD }
    470473,{jiA_INTVEC,   INTVEC_CMD,     INTVEC_CMD }
     
    490493#ifdef HAVE_RTIMER
    491494,{jjRTIMER,     VRTIMER,        INT_CMD }
    492 #endif 
     495#endif
    493496,{jjMAXDEG,     VMAXDEG,        INT_CMD }
    494497,{jjMAXMULT,    VMAXMULT,       INT_CMD }
     
    501504/*=================== operations ============================*/
    502505/*2
    503 * assign a = b 
     506* assign a = b
    504507*/
    505508static BOOLEAN jiAssign_1(leftv l, leftv r)
     
    511514    return TRUE;
    512515  }
    513  
     516
    514517  int lt=l->Typ();
    515518  if((lt==0)&&(l->name!=NULL))
     
    523526    return TRUE;
    524527  }
    525  
     528
    526529  int i=0;
    527530  BOOLEAN nok=FALSE;
     
    549552    if ((l->data==r->data)&&(l->e==NULL)&&(r->e==NULL))
    550553      return FALSE;
    551   }   
     554  }
     555  leftv ld=l;
     556  if ((l->rtyp==IDHDL)&&(lt!=QRING_CMD)&&(lt!=RING_CMD))
     557    ld=(leftv)l->data;
    552558  while (((dAssign[i].res!=lt)
    553559      || (dAssign[i].arg!=rt))
     
    556562  {
    557563    BOOLEAN b;
    558     leftv ld=l;
    559     if ((l->rtyp==IDHDL)&&(lt!=QRING_CMD)&&(lt!=RING_CMD))
    560       ld=(leftv)l->data;
    561564    b=dAssign[i].p(ld,r,l->e);
     565    if(l!=ld) /* i.e. l is IDHDL, l->data is ld */
     566    {
     567      l->flag=ld->flag;
     568      l->attribute=ld->attribute;
     569    }
    562570    return b;
    563571  }
     
    578586        if(!failed)
    579587        {
    580           if((l->rtyp==IDHDL)&&(lt!=QRING_CMD)&&(lt!=RING_CMD))
    581             failed=dAssign[i].p((leftv)l->data,rn,l->e);
    582           else
    583             failed= dAssign[i].p(l,rn,l->e);
    584         }   
     588          failed= dAssign[i].p(ld,rn,l->e);
     589        }
    585590        // everything done, clean up temp. variables
    586591        rn->CleanUp();
     
    593598        else
    594599        {
     600          if(l!=ld) /* i.e. l is IDHDL, l->data is ld */
     601          {
     602            l->flag=ld->flag;
     603            l->attribute=ld->attribute;
     604          }
    595605          // everything ok, return
    596606          return FALSE;
     
    922932      nok=jiAssign_1(l,&t);
    923933      l->next=h;
    924       if (nok) 
     934      if (nok)
    925935      {
    926936        idDelete((ideal *)&m);
     
    959969      nok=TRUE;
    960970      break;
    961     } 
    962   }
    963 ende: 
     971    }
     972  }
     973ende:
    964974  or->CleanUp();
    965975  ol->CleanUp();
     
    9931003    l->next=NULL;
    9941004    nok=jiAssign_1(l,&t);
    995     if (nok) 
     1005    if (nok)
    9961006    {
    9971007      break;
     
    10161026    atKillAll((idhdl)l);
    10171027    l->attribute=NULL;
    1018   } 
     1028  }
    10191029  l->flag=0;
    10201030  lists li;
    1021   if (l->rtyp==IDHDL) 
     1031  if (l->rtyp==IDHDL)
    10221032  {
    10231033    li=IDLIST((idhdl)l->data);
    1024   } 
     1034  }
    10251035  else
    10261036  {
     
    10541064    b=iiAssign(ld,r);
    10551065    l->e->next=ld->e;
    1056   } 
     1066  }
    10571067  return b;
    10581068}
     
    11011111  {
    11021112    IDFLAG((idhdl)l->data)=0;
    1103   } 
     1113  }
    11041114  l->flag=0;
    11051115  if (ll==1)
     
    11081118    if((l->e!=NULL)
    11091119    && (((l->rtyp==IDHDL) && (IDTYP((idhdl)l->data)==LIST_CMD))
    1110       || (l->rtyp==LIST_CMD)))   
     1120      || (l->rtyp==LIST_CMD)))
    11111121    {
    11121122       if(r->next!=NULL)
    11131123         b=jiA_L_LIST(l,r);
    1114        else 
     1124       else
    11151125         b=jiAssign_list(l,r);
    11161126       if((l->rtyp==IDHDL) && (l->data!=NULL))
     
    11191129         l->attribute=IDATTR((idhdl)l->data);
    11201130         l->flag=IDFLAG((idhdl)l->data);
    1121        } 
     1131       }
    11221132       r->CleanUp();
    11231133       Subexpr h;
     
    11551165           l->flag=IDFLAG((idhdl)l->data);
    11561166           l->CleanUp();
    1157          } 
     1167         }
    11581168         r->CleanUp();
    11591169         return b;
    1160       } 
     1170      }
    11611171      if ((lt!=LIST_CMD)
    11621172      &&((rt==MATRIX_CMD)
     
    11641174        ||(rt==INTVEC_CMD)
    11651175        ||(rt==MODUL_CMD)))
    1166       {   
     1176      {
    11671177         b=jiAssign_1(l,r);
    11681178         if((l->rtyp==IDHDL)&&(l->data!=NULL))
     
    11711181           l->attribute=IDATTR((idhdl)l->data);
    11721182           l->flag=IDFLAG((idhdl)l->data);
    1173          } 
     1183         }
    11741184         r->CleanUp();
    11751185         Subexpr h;
  • Singular/ipid.cc

    r388fe1e r58bbda  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ipid.cc,v 1.4 1997-04-02 15:07:10 Singular Exp $ */
     4/* $Id: ipid.cc,v 1.5 1997-06-17 09:44:26 Singular Exp $ */
    55
    66/*
     
    9494        IDMAP(h)->preimage = mstrdup(IDID(currRingHdl));
    9595        break;
     96      case PROC_CMD:
     97        IDSTRING(h) = mstrdup("parameter list #;\nreturn();\n\n");
     98        break;
    9699      case STRING_CMD:
    97100      #ifdef HAVE_DLD
     
    115118        len = sizeof(ip_package);
    116119        break;
    117     //other types: without init (int,proc,script,poly,def,package)
     120    //other types: without init (int,script,poly,def,package)
    118121    }
    119122    if (len!=0)
  • Singular/longalg.cc

    r388fe1e r58bbda  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: longalg.cc,v 1.5 1997-05-06 18:21:22 Singular Exp $ */
     4/* $Id: longalg.cc,v 1.6 1997-06-17 09:44:27 Singular Exp $ */
    55/*
    66* ABSTRACT:   algebraic numbers
     
    231231static alg napCopy(alg p)
    232232{
     233  if (p==NULL) return NULL;
     234
    233235  alg w, a;
    234 
    235   if (p==NULL) return NULL;
     236  int s=RECA_SIZE + naNumbOfPar * sizeof(int);
     237
    236238  mmTestP(p,RECA_SIZE+naNumbOfPar*sizeof(int));
    237   a = w = (alg)Alloc(RECA_SIZE + naNumbOfPar * sizeof(int));
     239  a = w = (alg)Alloc(s);
    238240  memcpy(w->e, p->e, naNumbOfPar * sizeof(int));
    239241  w->ko = nacCopy(p->ko);
     
    242244    p=p->ne;
    243245    if (p==NULL) break;
    244     mmTestP(p,RECA_SIZE+naNumbOfPar*sizeof(int));
    245     a->ne = (alg)Alloc(RECA_SIZE + naNumbOfPar * sizeof(int));
     246    mmTestP(p,s);
     247    a->ne = (alg)Alloc(s);
    246248    a = a->ne;
    247249    memcpy(a->e, p->e, naNumbOfPar * sizeof(int));
     
    466468* multiplication of alg. polys
    467469* multiply p1 with p2, p1 and p2 are destroyed
    468 * do not put attention on speed: the procedure is only used in the interpreter
    469470*/
    470471static alg napMult(alg p1, alg p2)
     
    13171318  alg x;
    13181319
     1320  naTest(la);
     1321  naTest(lb);
    13191322  mmTestP(a,sizeof(rnumber));
    13201323  mmTestP(b,sizeof(rnumber));
     1324  naTest(la);
     1325  naTest(lb);
     1326  alg tp=napCopy(a->z);
     1327  naTest(la);
     1328  naTest(lb);
     1329  napDelete(&tp);
     1330  naTest(la);
     1331  naTest(lb);
     1332  tp=napCopy(b->z);
     1333  naTest(la);
     1334  naTest(lb);
     1335  napDelete(&tp);
     1336  tp=napCopy(a->z);
     1337  naTest(la);
     1338  naTest(lb);
     1339  napDelete(&tp);
     1340  naTest(la);
     1341  naTest(lb);
     1342  tp=napCopy(b->z);
     1343  naTest(la);
     1344  naTest(lb);
     1345  napDelete(&tp);
     1346  naTest(la);
     1347  naTest(lb);
    13211348  lo = (lnumber)Alloc(sizeof(rnumber));
    13221349  lo->z = napMult(napCopy(a->z), napCopy(b->z));
     1350  naTest(la);
     1351  naTest(lb);
    13231352  if (a->n==NULL)
    13241353  {
     
    13311360  {
    13321361    if (b->n==NULL)
     1362    {
    13331363      x = napCopy(a->n);
     1364    }
    13341365    else
     1366    {
    13351367      x = napMult(napCopy(b->n), napCopy(a->n));
     1368    }
    13361369  }
    13371370  if (naMinimalPoly!=NULL)
     
    13651398    lo=NULL;
    13661399  }
     1400  naTest(la);
     1401  naTest(lb);
    13671402  naTest((number)lo);
    13681403  return (number)lo;
  • Singular/polys.cc

    r388fe1e r58bbda  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys.cc,v 1.4 1997-06-04 19:45:23 obachman Exp $ */
     4/* $Id: polys.cc,v 1.5 1997-06-17 09:44:32 Singular Exp $ */
    55
    66/*
     
    27142714  while (p!=NULL)
    27152715  {
     2716    nTest(pGetCoeff(p));
    27162717    nNormalize(pGetCoeff(p));
    27172718    pIter(p);
Note: See TracChangeset for help on using the changeset viewer.