Public Member Functions | Data Fields
sleftv Class Reference

Class used for (list of) interpreter objects. More...

#include <subexpr.h>

Public Member Functions

void Init ()
 
void CleanUp (ring r=currRing)
 
void Print (leftv store=NULL, int spaces=0)
 Called by type_cmd (e.g. "r;") or as default in jPRINT. More...
 
char * String (void *d=NULL, BOOLEAN typed=FALSE, int dim=1)
 Called for conversion to string (used by string(..), write(..),..) More...
 
void Copy (leftv e)
 
attr CopyA ()
 
void * CopyD (int t)
 
void * CopyD ()
 
const char * Name ()
 
const char * Fullname ()
 
int Typ ()
 
int LTyp ()
 
void * Data ()
 
leftv LData ()
 
attrAttribute ()
 
leftv Next ()
 
int listLength ()
 
int Eval ()
 
BOOLEAN RingDependend ()
 

Data Fields

leftv next
 
const char * name
 
void * data
 
attr attribute
 
BITSET flag
 
int rtyp
 
Subexpr e
 
package req_packhdl
 

Detailed Description

Class used for (list of) interpreter objects.

Definition at line 83 of file subexpr.h.

Member Function Documentation

attr * sleftv::Attribute ( )

Definition at line 1366 of file subexpr.cc.

1367 {
1368  if (e==NULL) return &attribute;
1369  if ((rtyp==LIST_CMD)
1370  ||((rtyp==IDHDL)&&(IDTYP((idhdl)data)==LIST_CMD))
1371  || (rtyp>MAX_TOK)
1372  || ((rtyp==IDHDL)&&(IDTYP((idhdl)data)>MAX_TOK)))
1373  {
1374  leftv v=LData();
1375  return &(v->attribute);
1376  }
1377  return NULL;
1378 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Subexpr e
Definition: subexpr.h:106
Definition: tok.h:170
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
#define IDTYP(a)
Definition: ipid.h:118
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
Definition: tok.h:96
attr attribute
Definition: subexpr.h:90
leftv LData()
Definition: subexpr.cc:1380
void sleftv::CleanUp ( ring  r = currRing)

Definition at line 321 of file subexpr.cc.

322 {
323  if ((name!=NULL) && (name!=sNoName) && (rtyp!=IDHDL) && (rtyp!=ALIAS_CMD))
324  {
325  //::Print("free %x (%s)\n",name,name);
326  omFree((ADDRESS)name);
327  }
328  //name=NULL;
329  //flag=0;
330  if (data!=NULL)
331  {
332  if (rtyp==IDHDL) attribute=NULL; // is only a pointer to attribute of id
333  else s_internalDelete(rtyp,data,r);
334  //data=NULL; // will be done by Init() at the end
335  }
336  if (attribute!=NULL)
337  {
338  switch (rtyp)
339  {
340  case PACKAGE_CMD:
341  case IDHDL:
342  case ANY_TYPE:
343  case VECHO:
344  case VPRINTLEVEL:
345  case VCOLMAX:
346  case VTIMER:
347  case VRTIMER:
348  case VOICE:
349  case VMAXDEG:
350  case VMAXMULT:
351  case TRACE:
352  case VSHORTOUT:
353  case VNOETHER:
354  case VMINPOLY:
355  case LIB_CMD:
356  case 0:
357  //attribute=NULL; // will be done by Init() at the end
358  break;
359  default:
360  {
361  attribute->killAll(r);
362  }
363  }
364  }
365  Subexpr h;
366  while (e!=NULL)
367  {
368  h=e->next;
370  e=h;
371  }
372  //rtyp=NONE; // will be done by Init() at the end
373  if (next!=NULL)
374  {
375  leftv tmp_n;
376  do
377  {
378  tmp_n=next->next;
379  //next->name=NULL;
380  next->next=NULL;
381  next->CleanUp(r);
383  next=tmp_n;
384  } while (next!=NULL);
385  }
386  Init();
387 }
Definition: tok.h:164
Definition: tok.h:160
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define ANY_TYPE
Definition: tok.h:34
Definition: tok.h:161
void killAll(const ring r)
Definition: attrib.cc:196
Subexpr e
Definition: subexpr.h:106
omBin sleftv_bin
Definition: subexpr.cc:50
const char sNoName[]
Definition: subexpr.cc:56
void Init()
Definition: subexpr.h:108
void * ADDRESS
Definition: auxiliary.h:161
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
Definition: tok.h:165
const ring r
Definition: syzextra.cc:208
const char * name
Definition: subexpr.h:88
#define omFree(addr)
Definition: omAllocDecl.h:261
omBin sSubexpr_bin
Definition: subexpr.cc:49
void s_internalDelete(const int t, void *d, const ring r)
Definition: subexpr.cc:478
Definition: tok.h:163
leftv next
Definition: subexpr.h:87
Definition: tok.h:38
Definition: tok.h:166
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:321
attr attribute
Definition: subexpr.h:90
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
Definition: tok.h:162
static Poly * h
Definition: janet.cc:978
void sleftv::Copy ( leftv  e)

Definition at line 657 of file subexpr.cc.

658 {
659  Init();
660  rtyp=source->Typ();
661  void *d=source->Data();
662  if(!errorreported)
663  {
665  if ((source->attribute!=NULL)||(source->e!=NULL))
666  attribute=source->CopyA();
667  flag=source->flag;
668  if (source->next!=NULL)
669  {
671  next->Copy(source->next);
672  }
673  }
674 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
BITSET flag
Definition: subexpr.h:91
omBin sleftv_bin
Definition: subexpr.cc:50
void Init()
Definition: subexpr.h:108
sleftv * leftv
Definition: structs.h:60
void * data
Definition: subexpr.h:89
void * CopyA()
Definition: subexpr.cc:1932
void Copy(leftv e)
Definition: subexpr.cc:657
static void * s_internalCopy(const int t, void *d)
Definition: subexpr.cc:401
short errorreported
Definition: feFopen.cc:23
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
attr attribute
Definition: subexpr.h:90
attr sleftv::CopyA ( )

Definition at line 712 of file subexpr.cc.

713 {
714  attr *a=Attribute();
715  if ((a!=NULL) && (*a!=NULL))
716  return (*a)->Copy();
717  return NULL;
718 }
const poly a
Definition: syzextra.cc:212
Definition: attrib.h:15
attr * Attribute()
Definition: subexpr.cc:1366
#define NULL
Definition: omList.c:10
void * sleftv::CopyD ( int  t)

Definition at line 676 of file subexpr.cc.

677 {
678  if ((rtyp!=IDHDL)&&(rtyp!=ALIAS_CMD)&&(e==NULL))
679  {
680  if (iiCheckRing(t)) return NULL;
681  void *x = data;
682  if (rtyp==VNOETHER) x = (void *)pCopy((currRing->ppNoether));
683  else if ((rtyp==VMINPOLY) && nCoeff_is_algExt(currRing->cf) && (!nCoeff_is_GF(currRing->cf)))
684  {
685  const ring A = currRing->cf->extRing;
686 
687  assume( A != NULL );
688  assume( A->qideal != NULL );
689 
690  x=(void *)p_Copy(A->qideal->m[0], A);
691  }
692  data=NULL;
693  return x;
694  }
695  void *d=Data(); // will also do a iiCheckRing
696  if ((!errorreported) && (d!=NULL)) return slInternalCopy(this,t,d,e);
697  return NULL;
698 }
void * slInternalCopy(leftv source, const int t, void *d, Subexpr e)
Definition: subexpr.cc:628
Subexpr e
Definition: subexpr.h:106
#define IDHDL
Definition: tok.h:35
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:911
#define assume(x)
Definition: mod2.h:405
#define A
Definition: sirandom.c:23
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:837
short errorreported
Definition: feFopen.cc:23
Definition: tok.h:38
BOOLEAN iiCheckRing(int i)
Definition: ipshell.cc:1468
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1111
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
void* sleftv::CopyD ( )
inline

Definition at line 120 of file subexpr.h.

120 { return CopyD(Typ()); }
void * CopyD()
Definition: subexpr.h:120
int Typ()
Definition: subexpr.cc:969
void * sleftv::Data ( )

Definition at line 1111 of file subexpr.cc.

1112 {
1113  if ((rtyp!=IDHDL) && iiCheckRing(rtyp))
1114  return NULL;
1115  if (e==NULL)
1116  {
1117  switch (rtyp)
1118  {
1119  case ALIAS_CMD:
1120  {
1121  idhdl h=(idhdl)data;
1122  return ((idhdl)h->data.ustring)->data.ustring;
1123  }
1124  case VECHO: return (void *)(long)si_echo;
1125  case VPRINTLEVEL:return (void *)(long)printlevel;
1126  case VCOLMAX: return (void *)(long)colmax;
1127  case VTIMER: return (void *)(long)getTimer();
1128  case VRTIMER: return (void *)(long)getRTimer();
1129  case VOICE: return (void *)(long)(myynest+1);
1130  case VMAXDEG: return (void *)(long)Kstd1_deg;
1131  case VMAXMULT: return (void *)(long)Kstd1_mu;
1132  case TRACE: return (void *)(long)traceit;
1133  case VSHORTOUT: return (void *)(long)(currRing != NULL ? currRing->ShortOut : 0);
1134  case VMINPOLY:
1135  if ( (currRing != NULL) && nCoeff_is_algExt(currRing->cf) && !nCoeff_is_GF(currRing->cf))
1136  {
1137  /* Q(a), Fp(a), but not GF(q) */
1138  const ring A = currRing->cf->extRing;
1139 
1140  assume( A != NULL );
1141  assume( A->qideal != NULL );
1142 
1143  return (void *)A->qideal->m[0];
1144  }
1145  else
1146  return (void *)currRing->cf->nNULL;
1147 
1148  case VNOETHER: return (void *) (currRing->ppNoether);
1149  case IDHDL:
1150  return IDDATA((idhdl)data);
1151  case COMMAND:
1152  //return NULL;
1153  default:
1154  return data;
1155  }
1156  }
1157  /* e != NULL : */
1158  int t=rtyp;
1159  void *d=data;
1160  if (t==IDHDL)
1161  {
1162  t=((idhdl)data)->typ;
1163  d=IDDATA((idhdl)data);
1164  }
1165  else if (t==ALIAS_CMD)
1166  {
1167  idhdl h=(idhdl)IDDATA((idhdl)data);
1168  t=IDTYP(h);
1169  d=IDDATA(h);
1170  }
1171  if (iiCheckRing(t))
1172  return NULL;
1173  char *r=NULL;
1174  int index=e->start;
1175  switch (t)
1176  {
1177  case INTVEC_CMD:
1178  {
1179  intvec *iv=(intvec *)d;
1180  if ((index<1)||(index>iv->length()))
1181  {
1182  if (!errorreported)
1183  Werror("wrong range[%d] in intvec %s(%d)",index,this->Name(),iv->length());
1184  }
1185  else
1186  r=(char *)(long)((*iv)[index-1]);
1187  break;
1188  }
1189  case INTMAT_CMD:
1190  {
1191  intvec *iv=(intvec *)d;
1192  if ((index<1)
1193  ||(index>iv->rows())
1194  ||(e->next->start<1)
1195  ||(e->next->start>iv->cols()))
1196  {
1197  if (!errorreported)
1198  Werror("wrong range[%d,%d] in intmat %s(%dx%d)",index,e->next->start,
1199  this->Name(),iv->rows(),iv->cols());
1200  }
1201  else
1202  r=(char *)(long)(IMATELEM((*iv),index,e->next->start));
1203  break;
1204  }
1205  case BIGINTMAT_CMD:
1206  {
1207  bigintmat *m=(bigintmat *)d;
1208  if ((index<1)
1209  ||(index>m->rows())
1210  ||(e->next->start<1)
1211  ||(e->next->start>m->cols()))
1212  {
1213  if (!errorreported)
1214  Werror("wrong range[%d,%d] in bigintmat %s(%dx%d)",index,e->next->start,
1215  this->Name(),m->rows(),m->cols());
1216  }
1217  else
1218  r=(char *)(BIMATELEM((*m),index,e->next->start));
1219  break;
1220  }
1221 #ifdef SINGULAR_4_1
1222  case CMATRIX_CMD:
1223  {
1224  bigintmat *m=(bigintmat *)d;
1225  if ((index<1)
1226  ||(index>m->rows())
1227  ||(e->next->start<1)
1228  ||(e->next->start>m->cols()))
1229  {
1230  if (!errorreported)
1231  Werror("wrong range[%d,%d] in matrix %s(%dx%d)",index,e->next->start,
1232  this->Name(),m->rows(),m->cols());
1233  }
1234  else
1235  {
1237  iiNumber2Data[iiCmatrix_index].n=BIMATELEM((*m),index,e->next->start);
1238  r=(char*)&iiNumber2Data[iiCmatrix_index];
1240  }
1241  break;
1242  }
1243 #endif
1244  case IDEAL_CMD:
1245  case MODUL_CMD:
1246  case MAP_CMD:
1247  {
1248  ideal I=(ideal)d;
1249  if ((index<1)||(index>IDELEMS(I)))
1250  {
1251  if (!errorreported)
1252  Werror("wrong range[%d] in ideal/module %s(%d)",index,this->Name(),IDELEMS(I));
1253  }
1254  else
1255  r=(char *)I->m[index-1];
1256  break;
1257  }
1258  case STRING_CMD:
1259  {
1260  // this was a memory leak
1261  // we evalute it, cleanup and replace this leftv by it's evalutated form
1262  // the evalutated form will be build in tmp
1263  sleftv tmp;
1264  tmp.Init();
1265  tmp.rtyp=STRING_CMD;
1266  r=(char *)omAllocBin(size_two_bin);
1267  if ((index>0)&& (index<=(int)strlen((char *)d)))
1268  {
1269  r[0]=*(((char *)d)+index-1);
1270  r[1]='\0';
1271  }
1272  else
1273  {
1274  r[0]='\0';
1275  }
1276  tmp.data=r;
1277  if ((rtyp==IDHDL)||(rtyp==STRING_CMD))
1278  {
1279  tmp.next=next; next=NULL;
1280  //if (rtyp==STRING_CMD) { omFree((ADDRESS)data); }
1281  //data=NULL;
1282  d=NULL;
1283  CleanUp();
1284  memcpy(this,&tmp,sizeof(tmp));
1285  }
1286  // and, remember, r is also the result...
1287  else
1288  {
1289  // ???
1290  // here we still have a memory leak...
1291  // example: list L="123","456";
1292  // L[1][2];
1293  // therefore, it should never happen:
1294  assume(0);
1295  // but if it happens: here is the temporary fix:
1296  // omMarkAsStaticAddr(r);
1297  }
1298  break;
1299  }
1300  case MATRIX_CMD:
1301  {
1302  if ((index<1)
1303  ||(index>MATROWS((matrix)d))
1304  ||(e->next->start<1)
1305  ||(e->next->start>MATCOLS((matrix)d)))
1306  {
1307  if (!errorreported)
1308  Werror("wrong range[%d,%d] in matrix %s(%dx%d)",
1309  index,e->next->start,
1310  this->Name(),
1311  MATROWS((matrix)d),MATCOLS((matrix)d));
1312  }
1313  else
1314  r=(char *)MATELEM((matrix)d,index,e->next->start);
1315  break;
1316  }
1317  default:
1318  {
1319  blackbox *b=NULL;
1320  if (t>MAX_TOK)
1321  {
1322  b=getBlackboxStuff(t);
1323  }
1324  if ((t==LIST_CMD)||((b!=NULL)&&(BB_LIKE_LIST(b))))
1325  {
1326  lists l=(lists)d;
1327  if ((0<index)&&(index<=l->nr+1))
1328  {
1329  if ((e->next!=NULL)
1330  && (l->m[index-1].rtyp==STRING_CMD))
1331  // string[..].Data() modifies sleftv, so let's do it ourself
1332  {
1333  char *dd=(char *)l->m[index-1].data;
1334  int j=e->next->start-1;
1335  r=(char *)omAllocBin(size_two_bin);
1336  if ((j>=0) && (j<(int)strlen(dd)))
1337  {
1338  r[0]=*(dd+j);
1339  r[1]='\0';
1340  }
1341  else
1342  {
1343  r[0]='\0';
1344  }
1345  }
1346  else
1347  {
1348  Subexpr tmp=l->m[index-1].e;
1349  l->m[index-1].e=e->next;
1350  r=(char *)l->m[index-1].Data();
1351  e->next=l->m[index-1].e;
1352  l->m[index-1].e=tmp;
1353  }
1354  }
1355  else //if (!errorreported)
1356  Werror("wrong range[%d] in list %s(%d)",index,this->Name(),l->nr+1);
1357  }
1358  else
1359  Werror("cannot index %s of type %s(%d)",this->Name(),Tok2Cmdname(t),t);
1360  break;
1361  }
1362  }
1363  return r;
1364 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
Definition: tok.h:164
Definition: tok.h:160
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:161
Subexpr e
Definition: subexpr.h:106
Definition: lists.h:22
int getRTimer()
Definition: timer.cc:172
coeffs cf
Definition: number2.h:13
Matrices of numbers.
Definition: bigintmat.h:51
Definition: tok.h:170
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
int length() const
Definition: intvec.h:86
void Init()
Definition: subexpr.h:108
int traceit
Definition: febase.cc:47
const char * Name()
Definition: subexpr.h:121
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
int Kstd1_mu
Definition: kutil.cc:229
void * data
Definition: subexpr.h:89
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define IDTYP(a)
Definition: ipid.h:118
Definition: tok.h:165
const ring r
Definition: syzextra.cc:208
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:911
Definition: intvec.h:16
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
number n
Definition: number2.h:14
#define A
Definition: sirandom.c:23
int m
Definition: cfEzgcd.cc:119
idrec * idhdl
Definition: ring.h:18
Definition: tok.h:163
Definition: tok.h:88
static int iiCmatrix_index
Definition: subexpr.cc:1109
#define IDELEMS(i)
Definition: simpleideals.h:24
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:837
int cols() const
Definition: bigintmat.h:147
short errorreported
Definition: feFopen.cc:23
leftv next
Definition: subexpr.h:87
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:597
#define BIMATELEM(M, I, J)
Definition: bigintmat.h:136
Definition: tok.h:38
BOOLEAN iiCheckRing(int i)
Definition: ipshell.cc:1468
Definition: tok.h:166
int nr
Definition: lists.h:43
int rows() const
Definition: bigintmat.h:148
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
int cols() const
Definition: intvec.h:87
slists * lists
Definition: mpr_numeric.h:146
static snumber2 iiNumber2Data[4]
Definition: subexpr.cc:1108
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
int rows() const
Definition: intvec.h:88
coeffs basecoeffs() const
Definition: bigintmat.h:149
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:321
void * Data()
Definition: subexpr.cc:1111
Definition: tok.h:96
int printlevel
Definition: febase.cc:42
#define MATROWS(i)
Definition: matpol.h:27
#define IDDATA(a)
Definition: ipid.h:125
int Kstd1_deg
Definition: kutil.cc:228
int colmax
Definition: febase.cc:43
Definition: tok.h:162
int getTimer()
Definition: timer.cc:97
static Poly * h
Definition: janet.cc:978
#define IMATELEM(M, I, J)
Definition: intvec.h:77
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int l
Definition: cfEzgcd.cc:94
static omBin size_two_bin
Definition: subexpr.cc:53
int si_echo
Definition: febase.cc:41
#define MATELEM(mat, i, j)
Definition: matpol.h:29
#define COMMAND
Definition: tok.h:33
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
utypes data
Definition: idrec.h:40
int sleftv::Eval ( )

Definition at line 1735 of file subexpr.cc.

1736 {
1737  BOOLEAN nok=FALSE;
1738  leftv nn=next;
1739  next=NULL;
1740  if(rtyp==IDHDL)
1741  {
1742  int t=Typ();
1743  if (t!=PROC_CMD)
1744  {
1745  void *d=CopyD(t);
1746  data=d;
1747  rtyp=t;
1748  name=NULL;
1749  e=NULL;
1750  }
1751  }
1752  else if (rtyp==COMMAND)
1753  {
1754  command d=(command)data;
1755  if(d->op==PROC_CMD) //assume d->argc==2
1756  {
1757  char *what=(char *)(d->arg1.Data());
1758  idhdl h=ggetid(what);
1759  if((h!=NULL)&&(IDTYP(h)==PROC_CMD))
1760  {
1761  nok=d->arg2.Eval();
1762  if(!nok)
1763  {
1764  nok=iiMake_proc(h,req_packhdl,&d->arg2);
1765  this->CleanUp(currRing);
1766  if (!nok)
1767  {
1768  memcpy(this,&iiRETURNEXPR,sizeof(sleftv));
1769  memset(&iiRETURNEXPR,0,sizeof(sleftv));
1770  }
1771  }
1772  }
1773  else nok=TRUE;
1774  }
1775  else if (d->op=='=') //assume d->argc==2
1776  {
1777  if ((d->arg1.rtyp!=IDHDL)&&(d->arg1.rtyp!=DEF_CMD))
1778  {
1779  nok=d->arg1.Eval();
1780  }
1781  if (!nok)
1782  {
1783  const char *n=d->arg1.name;
1784  nok=(n == NULL) || d->arg2.Eval();
1785  if (!nok)
1786  {
1787  int save_typ=d->arg1.rtyp;
1788  omCheckAddr((ADDRESS)n);
1789  if (d->arg1.rtyp!=IDHDL)
1790  syMake(&d->arg1,n);
1791  omCheckAddr((ADDRESS)d->arg1.name);
1792  if (d->arg1.rtyp==IDHDL)
1793  {
1794  n=omStrDup(IDID((idhdl)d->arg1.data));
1795  killhdl((idhdl)d->arg1.data);
1796  d->arg1.Init();
1797  //d->arg1.data=NULL;
1798  d->arg1.name=n;
1799  }
1800  d->arg1.rtyp=DEF_CMD;
1801  sleftv t;
1802  if(save_typ!=PROC_CMD) save_typ=d->arg2.rtyp;
1803  if (::RingDependend(d->arg2.rtyp))
1804  nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&currRing->idroot);
1805  else
1806  nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&IDROOT);
1807  memcpy(&d->arg1,&t,sizeof(sleftv));
1808  omCheckAddr((ADDRESS)d->arg1.name);
1809  nok=nok||iiAssign(&d->arg1,&d->arg2);
1810  omCheckIf(d->arg1.name != NULL, // OB: ????
1811  omCheckAddr((ADDRESS)d->arg1.name));
1812  if (!nok)
1813  {
1814  memset(&d->arg1,0,sizeof(sleftv));
1815  this->CleanUp();
1816  rtyp=NONE;
1817  }
1818  }
1819  }
1820  else nok=TRUE;
1821  }
1822  else
1823  {
1824  sleftv tmp; tmp.Init();
1825  int toktype=iiTokType(d->op);
1826  if ((toktype==CMD_M)
1827  ||( toktype==ROOT_DECL_LIST)
1828  ||( toktype==RING_DECL_LIST))
1829  {
1830  if (d->argc <=3)
1831  {
1832  if (d->argc>=1) nok=d->arg1.Eval();
1833  if ((!nok) && (d->argc>=2))
1834  {
1835  nok=d->arg2.Eval();
1836  d->arg1.next=(leftv)omAllocBin(sleftv_bin);
1837  memcpy(d->arg1.next,&d->arg2,sizeof(sleftv));
1838  d->arg2.Init();
1839  }
1840  if ((!nok) && (d->argc==3))
1841  {
1842  nok=d->arg3.Eval();
1843  d->arg1.next->next=(leftv)omAllocBin(sleftv_bin);
1844  memcpy(d->arg1.next->next,&d->arg3,sizeof(sleftv));
1845  d->arg3.Init();
1846  }
1847  if (d->argc==0)
1848  nok=nok||iiExprArithM(&tmp,NULL,d->op);
1849  else
1850  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1851  }
1852  else
1853  {
1854  nok=d->arg1.Eval();
1855  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1856  }
1857  }
1858  else if (d->argc==1)
1859  {
1860  nok=d->arg1.Eval();
1861  nok=nok||iiExprArith1(&tmp,&d->arg1,d->op);
1862  }
1863  else if(d->argc==2)
1864  {
1865  nok=d->arg1.Eval();
1866  nok=nok||d->arg2.Eval();
1867  nok=nok||iiExprArith2(&tmp,&d->arg1,d->op,&d->arg2);
1868  }
1869  else if(d->argc==3)
1870  {
1871  nok=d->arg1.Eval();
1872  nok=nok||d->arg2.Eval();
1873  nok=nok||d->arg3.Eval();
1874  nok=nok||iiExprArith3(&tmp,d->op,&d->arg1,&d->arg2,&d->arg3);
1875  }
1876  else if(d->argc!=0)
1877  {
1878  nok=d->arg1.Eval();
1879  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1880  }
1881  else // d->argc == 0
1882  {
1883  nok = iiExprArithM(&tmp, NULL, d->op);
1884  }
1885  this->CleanUp();
1886  memcpy(this,&tmp,sizeof(tmp));
1887  }
1888  }
1889  else if (((rtyp==0)||(rtyp==DEF_CMD))
1890  &&(name!=NULL))
1891  {
1892  syMake(this,name);
1893  }
1894 #ifdef MDEBUG
1895  switch(Typ())
1896  {
1897  case NUMBER_CMD:
1898 #ifdef LDEBUG
1899  nTest((number)Data());
1900 #endif
1901  break;
1902  case BIGINT_CMD:
1903 #ifdef LDEBUG
1904  n_Test((number)Data(),coeffs_BIGINT);
1905 #endif
1906  break;
1907  case POLY_CMD:
1908  pTest((poly)Data());
1909  break;
1910  case IDEAL_CMD:
1911  case MODUL_CMD:
1912  case MATRIX_CMD:
1913  {
1914  ideal id=(ideal)Data();
1915  omCheckAddrSize(id,sizeof(*id));
1916  int i=id->ncols*id->nrows-1;
1917  for(;i>=0;i--) pTest(id->m[i]);
1918  }
1919  break;
1920  }
1921 #endif
1922  if (nn!=NULL) nok=nok||nn->Eval();
1923  next=nn;
1924  return nok;
1925 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int Eval()
Definition: subexpr.cc:1735
ip_command * command
Definition: ipid.h:24
void syMake(leftv v, const char *id, idhdl packhdl)
Definition: subexpr.cc:1474
Subexpr e
Definition: subexpr.h:106
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:8330
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
Definition: tok.h:42
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition: iparith.cc:8542
omBin sleftv_bin
Definition: subexpr.cc:50
#define pTest(p)
Definition: polys.h:387
sleftv iiRETURNEXPR
Definition: iplib.cc:527
#define omCheckIf(cond, test)
Definition: omAllocDecl.h:323
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:144
void Init()
Definition: subexpr.h:108
void * ADDRESS
Definition: auxiliary.h:161
void * CopyD()
Definition: subexpr.h:120
sleftv * leftv
Definition: structs.h:60
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition: iparith.cc:8630
coeffs coeffs_BIGINT
Definition: ipid.cc:54
int Typ()
Definition: subexpr.cc:969
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define IDTYP(a)
Definition: ipid.h:118
BOOLEAN iiMake_proc(idhdl pn, package pack, sleftv *sl)
Definition: iplib.cc:573
BOOLEAN RingDependend()
Definition: subexpr.cc:389
#define nTest(a)
Definition: numbers.h:35
Definition: tok.h:58
const char * name
Definition: subexpr.h:88
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:923
int i
Definition: cfEzgcd.cc:123
leftv next
Definition: subexpr.h:87
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1119
#define NULL
Definition: omList.c:10
package req_packhdl
Definition: subexpr.h:107
void killhdl(idhdl h, package proot)
Definition: ipid.cc:372
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:321
void * Data()
Definition: subexpr.cc:1111
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
int iiTokType(int op)
Definition: iparith.cc:255
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
Definition: iparith.cc:8143
#define NONE
Definition: tok.h:173
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
Definition: ipid.cc:490
#define COMMAND
Definition: tok.h:33
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1782
#define omStrDup(s)
Definition: omAllocDecl.h:263
const char* sleftv::Fullname ( )
inline

Definition at line 126 of file subexpr.h.

127  {
128  if ((name!=NULL) && (e==NULL)) return(iiSleftv2name(this));
129  else return sNoName;
130  }
Subexpr e
Definition: subexpr.h:106
const char * iiSleftv2name(leftv v)
Definition: subexpr.cc:1927
const char sNoName[]
Definition: subexpr.cc:56
const char * name
Definition: subexpr.h:88
#define NULL
Definition: omList.c:10
void sleftv::Init ( )
inline

Definition at line 108 of file subexpr.h.

108 { memset(this,0,sizeof(*this)); }
leftv sleftv::LData ( )

Definition at line 1380 of file subexpr.cc.

1381 {
1382  if (e!=NULL)
1383  {
1384  lists l=NULL;
1385  blackbox *b=getBlackboxStuff(rtyp);
1386 
1387  if ((rtyp==LIST_CMD)
1388  || ((b!=NULL)&&(BB_LIKE_LIST(b))))
1389  l=(lists)data;
1390  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1391  l=IDLIST((idhdl)data);
1392  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)>MAX_TOK))
1393  {
1394  b=getBlackboxStuff(IDTYP((idhdl)data));
1395  if (BB_LIKE_LIST(b)) l=IDLIST((idhdl)data);
1396  }
1397  else if (rtyp==ALIAS_CMD)
1398  {
1399  idhdl h=(idhdl)data;
1400  l= (lists)(((idhdl)h->data.ustring)->data.ustring);
1401  }
1402  if (l!=NULL)
1403  {
1404  if ((0>=e->start)||(e->start>l->nr+1))
1405  return NULL;
1406  if (e->next!=NULL)
1407  {
1408  l->m[e->start-1].e=e->next;
1409  leftv r=l->m[e->start-1].LData();
1410  l->m[e->start-1].e=NULL;
1411  return r;
1412  }
1413  return &(l->m[e->start-1]);
1414  }
1415  }
1416  return this;
1417 }
#define IDLIST(a)
Definition: ipid.h:136
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Subexpr e
Definition: subexpr.h:106
Definition: lists.h:22
Definition: tok.h:170
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
#define IDTYP(a)
Definition: ipid.h:118
const ring r
Definition: syzextra.cc:208
idrec * idhdl
Definition: ring.h:18
Definition: tok.h:38
int nr
Definition: lists.h:43
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
Definition: tok.h:96
static Poly * h
Definition: janet.cc:978
const poly b
Definition: syzextra.cc:213
leftv LData()
Definition: subexpr.cc:1380
int l
Definition: cfEzgcd.cc:94
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
utypes data
Definition: idrec.h:40
int sleftv::listLength ( )

Definition at line 61 of file subexpr.cc.

62 {
63  int n = 1;
64  leftv sl = next;
65  while (sl!=NULL)
66  {
67  n++;
68  sl=sl->next;
69  }
70  return n;
71 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
int sleftv::LTyp ( )

Definition at line 1075 of file subexpr.cc.

1076 {
1077  lists l=NULL;
1078  int r;
1079  if (rtyp==LIST_CMD)
1080  l=(lists)data;
1081  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1082  l=IDLIST((idhdl)data);
1083  else
1084  return Typ();
1085  //if (l!=NULL)
1086  {
1087  if ((e!=NULL) && (e->next!=NULL))
1088  {
1089  if ((0<e->start)&&(e->start<=l->nr+1))
1090  {
1091  l->m[e->start-1].e=e->next;
1092  r=l->m[e->start-1].LTyp();
1093  l->m[e->start-1].e=NULL;
1094  }
1095  else
1096  {
1097  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1098  r=NONE;
1099  }
1100  return r;
1101  }
1102  return LIST_CMD;
1103  }
1104  return Typ();
1105 }
#define IDLIST(a)
Definition: ipid.h:136
sleftv * m
Definition: lists.h:45
Subexpr e
Definition: subexpr.h:106
Definition: lists.h:22
int Typ()
Definition: subexpr.cc:969
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
#define IDTYP(a)
Definition: ipid.h:118
const ring r
Definition: syzextra.cc:208
int LTyp()
Definition: subexpr.cc:1075
int nr
Definition: lists.h:43
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
Definition: tok.h:96
#define NONE
Definition: tok.h:173
int l
Definition: cfEzgcd.cc:94
const char* sleftv::Name ( )
inline

Definition at line 121 of file subexpr.h.

122  {
123  if ((name!=NULL) && (e==NULL)) return name;
124  else return sNoName;
125  }
Subexpr e
Definition: subexpr.h:106
const char sNoName[]
Definition: subexpr.cc:56
const char * name
Definition: subexpr.h:88
#define NULL
Definition: omList.c:10
leftv sleftv::Next ( )
inline

Definition at line 137 of file subexpr.h.

137 { return next; }
leftv next
Definition: subexpr.h:87
void sleftv::Print ( leftv  store = NULL,
int  spaces = 0 
)

Called by type_cmd (e.g. "r;") or as default in jPRINT.

Definition at line 73 of file subexpr.cc.

74 {
75  int t=Typ();
76  if (errorreported) return;
77 #ifdef SIQ
78  if (rtyp==COMMAND)
79  {
80  command c=(command)data;
81  char ch[2];
82  ch[0]=c->op;ch[1]='\0';
83  const char *s=ch;
84  if (c->op>127) s=iiTwoOps(c->op);
85  ::Print("##command %d(%s), %d args\n",
86  c->op, s, c->argc);
87  if (c->argc>0)
88  c->arg1.Print(NULL,spaces+2);
89  if(c->argc<4)
90  {
91  if (c->argc>1)
92  c->arg2.Print(NULL,spaces+2);
93  if (c->argc>2)
94  c->arg3.Print(NULL,spaces+2);
95  }
96  PrintS("##end");
97  }
98  else
99 #endif
100  {
101  const char *n=Name();
102  char *s;
103  void *d=Data();
104  if (errorreported) return;
105  if ((store!=NULL)&&(store!=this))
106  store->CleanUp();
107 
108  switch (t /*=Typ()*/)
109  {
110 #ifdef SINGULAR_4_1
111  case CRING_CMD:
112  crPrint((coeffs)d);
113  break;
114  case CNUMBER_CMD:
115  n2Print((number2)d);
116  break;
117  case CMATRIX_CMD: // like BIGINTMAT
118 #endif
119  case BIGINTMAT_CMD:
120  ((bigintmat *)d)->pprint(80);
121  break;
122  case UNKNOWN:
123  case DEF_CMD:
124  PrintNSpaces(spaces);
125  PrintS("`");PrintS(n);PrintS("`");
126  break;
127  case PACKAGE_CMD:
128  PrintNSpaces(spaces);
129  paPrint(n,(package)d);
130  break;
131  case NONE:
132  return;
133  case INTVEC_CMD:
134  case INTMAT_CMD:
135  ((intvec *)d)->show(t,spaces);
136  break;
137  case RING_CMD:
138  case QRING_CMD:
139  {
140  PrintNSpaces(spaces);
141  const ring r = (const ring)d;
142  rWrite(r, currRing == r);
143  break;
144  }
145  case MATRIX_CMD:
146  iiWriteMatrix((matrix)d,n,2, currRing, spaces);
147  break;
148  case MODUL_CMD:
149  case IDEAL_CMD:
150  if ((TEST_V_QRING) &&(currRing->qideal!=NULL)
151  &&(!hasFlag(this,FLAG_QRING)))
152  {
153  jjNormalizeQRingId(this);
154  d=Data();
155  }
156  // no break:
157  case MAP_CMD:
158  iiWriteMatrix((matrix)d,n,1, currRing, spaces);
159  break;
160  case POLY_CMD:
161  case VECTOR_CMD:
162  if ((e==NULL)
163  && (TEST_V_QRING)
164  &&(currRing->qideal!=NULL)
165  &&(!hasFlag(this,FLAG_QRING)))
166  {
167  setFlag(this,FLAG_QRING);
168  poly p=(poly)d;
170  if (p!=(poly)d)
171  {
172  d=(void*)p;
173  if ((rtyp==POLY_CMD)||(rtyp==VECTOR_CMD)) data=d;
174  else if (rtyp==IDHDL)
175  {
176  idhdl h=(idhdl)data;
177  IDPOLY(h)=p;
178  setFlag(h,FLAG_QRING);
179  }
180  }
181  }
182  PrintNSpaces(spaces);
183  pWrite0((poly)d);
184  break;
185  case RESOLUTION_CMD:
186  {
187  syStrategy tmp=(syStrategy)d;
188  syPrint(tmp,IDID(currRingHdl));
189  break;
190  }
191  case STRING_CMD:
192  PrintNSpaces(spaces);
193  PrintS((char *)d);
194  break;
195  case INT_CMD:
196  PrintNSpaces(spaces);
197  ::Print("%d",(int)(long)d);
198  break;
199  case PROC_CMD:
200  {
202 
203  PrintNSpaces(spaces);
204  PrintS("// libname : ");
205  PrintS(piProcinfo(pi, "libname"));
206  PrintLn();
207 
208  PrintNSpaces(spaces);
209  PrintS("// procname : ");
210  PrintS(piProcinfo(pi, "procname"));
211  PrintLn();
212 
213  PrintNSpaces(spaces);
214  PrintS("// type : ");
215  PrintS(piProcinfo(pi, "type"));
216  // ::Print("%-*.*s// ref : %s",spaces,spaces," ",
217  // piProcinfo(pi, "ref"));
218  break;
219  }
220  case LINK_CMD:
221  {
222  si_link l=(si_link)d;
223  PrintNSpaces(spaces);
224  ::Print("// type : %s\n", slStatus(l, "type"));
225  PrintNSpaces(spaces);
226  ::Print("// mode : %s\n", slStatus(l, "mode"));
227  PrintNSpaces(spaces);
228  ::Print("// name : %s\n", slStatus(l, "name"));
229  PrintNSpaces(spaces);
230  ::Print("// open : %s\n", slStatus(l, "open"));
231  PrintNSpaces(spaces);
232  ::Print("// read : %s\n", slStatus(l, "read"));
233  PrintNSpaces(spaces);
234  ::Print("// write: %s", slStatus(l, "write"));
235  break;
236  }
237  case NUMBER_CMD:
238  case BIGINT_CMD:
239  if (t==NUMBER_CMD)
240  {
241  number n=(number)d;
242  nNormalize(n);
243  d=n;
244  }
245  s=String(d);
246  if (s==NULL) return;
247  PrintNSpaces(spaces);
248  PrintS(s);
249  omFree((ADDRESS)s);
250  break;
251  case LIST_CMD:
252  {
253  lists l=(lists)d;
254  if (lSize(l)<0)
255  {
256  PrintNSpaces(spaces);
257  PrintS("empty list\n");
258  }
259  else
260  {
261  int i=0;
262  for (;i<=l->nr;i++)
263  {
264  if (l->m[i].rtyp!=DEF_CMD)
265  {
266  PrintNSpaces(spaces);
267  ::Print("[%d]:\n",i+1);
268  l->m[i].Print(NULL,spaces+3);
269  }
270  }
271  }
272  break;
273  }
274 
275  default:
276  if (t>MAX_TOK)
277  {
278  blackbox * bb=getBlackboxStuff(t);
279  PrintNSpaces(spaces);
280  if (bb!=NULL) { bb->blackbox_Print(bb,d); }
281  else { ::Print("Print: blackbox %d(bb=NULL)",t); }
282  }
283  else
284  ::Print("Print:unknown type %s(%d)", Tok2Cmdname(t),t);
285  } /* end switch: (Typ()) */
286  }
287  if (next!=NULL)
288  {
289  if (t==COMMAND) PrintLn();
290  else if (t!=LIST_CMD) PrintS(" ");
291  next->Print(NULL,spaces);
292  }
293  else if (t!=LIST_CMD)
294  {
295  PrintLn();
296  }
297 #ifdef SIQ
298  if (rtyp!=COMMAND)
299 #endif
300  {
301  if ((store!=NULL)
302  && (store!=this))
303  {
304  if((t/*Typ()*/!=LINK_CMD)
305  && (t/*Typ()*/!=PACKAGE_CMD)
306  && (t/*Typ()*/!=DEF_CMD)
307  )
308  {
309  store->rtyp=t/*Typ()*/;
310  store->data=CopyD();
311  if(attribute!=NULL)
312  {
313  store->attribute=CopyA();
314  }
315  store->flag=flag;
316  }
317  }
318  }
319 }
void n2Print(number2 d)
Definition: number2.cc:311
ip_package * package
Definition: structs.h:46
const CanonicalForm int s
Definition: facAbsFact.cc:55
void jjNormalizeQRingP(poly &p)
Definition: ipassign.cc:2162
sleftv * m
Definition: lists.h:45
ip_command * command
Definition: ipid.h:24
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
Definition: tok.h:85
Subexpr e
Definition: subexpr.h:106
BITSET flag
Definition: subexpr.h:91
Definition: lists.h:22
#define nNormalize(n)
Definition: numbers.h:30
#define IDID(a)
Definition: ipid.h:121
Definition: tok.h:42
return P p
Definition: myNF.cc:203
Matrices of numbers.
Definition: bigintmat.h:51
Definition: tok.h:170
#define UNKNOWN
Definition: tok.h:174
void * ADDRESS
Definition: auxiliary.h:161
void * CopyD()
Definition: subexpr.h:120
void syPrint(syStrategy syzstr, const char *currRingName)
Definition: syz1.cc:1945
int Typ()
Definition: subexpr.cc:969
void pWrite0(poly p)
Definition: polys.h:280
const char * Name()
Definition: subexpr.h:121
void Print(leftv store=NULL, int spaces=0)
Called by type_cmd (e.g. "r;") or as default in jPRINT.
Definition: subexpr.cc:73
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
Definition: matpol.cc:739
char * String(void *d=NULL, BOOLEAN typed=FALSE, int dim=1)
Called for conversion to string (used by string(..), write(..),..)
Definition: subexpr.cc:720
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: tok.h:56
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
const char * iiTwoOps(int t)
Definition: gentable.cc:252
const char * piProcinfo(procinfov pi, const char *request)
Definition: ipid.cc:623
Definition: tok.h:58
#define omFree(addr)
Definition: omAllocDecl.h:261
The main handler for Singular numbers which are suitable for Singular polynomials.
attr CopyA()
Definition: subexpr.cc:712
idhdl currRingHdl
Definition: ipid.cc:65
#define setFlag(A, F)
Definition: ipid.h:112
idrec * idhdl
Definition: ring.h:18
#define FLAG_QRING
Definition: ipid.h:110
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define TEST_V_QRING
Definition: options.h:125
Definition: tok.h:88
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
int lSize(lists L)
Definition: lists.cc:25
short errorreported
Definition: feFopen.cc:23
leftv next
Definition: subexpr.h:87
void paPrint(const char *n, package p)
Definition: ipshell.cc:6203
#define pi
Definition: libparse.cc:1143
void jjNormalizeQRingId(leftv I)
Definition: ipassign.cc:2127
int nr
Definition: lists.h:43
Definition: tok.h:95
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
#define IDPOLY(a)
Definition: ipid.h:129
#define hasFlag(A, F)
Definition: ipid.h:111
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:321
void * Data()
Definition: subexpr.cc:1111
Definition: tok.h:96
attr attribute
Definition: subexpr.h:90
Definition: tok.h:126
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
#define NONE
Definition: tok.h:173
void PrintNSpaces(const int n)
Definition: reporter.cc:381
int l
Definition: cfEzgcd.cc:94
procinfo * procinfov
Definition: structs.h:63
#define COMMAND
Definition: tok.h:33
void crPrint(coeffs c)
Definition: number2.cc:25
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
ssyStrategy * syStrategy
Definition: syz.h:35
BOOLEAN sleftv::RingDependend ( )

Definition at line 389 of file subexpr.cc.

390 {
391  int rt=Typ();
392  if(::RingDependend(rt) && (rt!=QRING_CMD))
393  return TRUE;
394  if (rt==LIST_CMD)
395  return lRingDependend((lists)Data());
396  if (this->next!=NULL)
397  return this->next->RingDependend();
398  return FALSE;
399 }
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int Typ()
Definition: subexpr.cc:969
BOOLEAN RingDependend()
Definition: subexpr.cc:389
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1111
Definition: tok.h:96
Definition: tok.h:126
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
char * sleftv::String ( void *  d = NULL,
BOOLEAN  typed = FALSE,
int  dim = 1 
)

Called for conversion to string (used by string(..), write(..),..)

Definition at line 720 of file subexpr.cc.

721 {
722 #ifdef SIQ
723  if (rtyp==COMMAND)
724  {
725  ::Print("##command %d\n",((command)data)->op);
726  if (((command)data)->arg1.rtyp!=0)
727  ((command)data)->arg1.Print(NULL,2);
728  if (((command)data)->arg2.rtyp!=0)
729  ((command)data)->arg2.Print(NULL,2);
730  if (((command)data)->arg3.rtyp==0)
731  ((command)data)->arg3.Print(NULL,2);
732  PrintS("##end\n");
733  return omStrDup("");
734  }
735 #endif
736  if (d==NULL) d=Data();
737  if (!errorreported)
738  {
739  char *s;
740  int t=Typ();
741  switch (t /*Typ()*/)
742  {
743  case INT_CMD:
744  if (typed)
745  {
746  s=(char *)omAlloc(MAX_INT_LEN+7);
747  sprintf(s,"int(%d)",(int)(long)d);
748  }
749  else
750  {
751  s=(char *)omAlloc(MAX_INT_LEN+2);
752  sprintf(s,"%d",(int)(long)d);
753  }
754  return s;
755 
756  case STRING_CMD:
757  if (d == NULL)
758  {
759  if (typed) return omStrDup("\"\"");
760  return omStrDup("");
761  }
762  if (typed)
763  {
764  s = (char*) omAlloc(strlen((char*) d) + 3);
765  sprintf(s,"\"%s\"", (char*) d);
766  return s;
767  }
768  else
769  {
770  return omStrDup((char*)d);
771  }
772 
773  case POLY_CMD:
774  case VECTOR_CMD:
775  if (typed)
776  {
777  char* ps = pString((poly) d);
778  s = (char*) omAlloc(strlen(ps) + 10);
779  sprintf(s,"%s(%s)", (t /*Typ()*/ == POLY_CMD ? "poly" : "vector"), ps);
780  omFree(ps);
781  return s;
782  }
783  else
784  return pString((poly)d);
785 
786  #ifdef SINGULAR_4_1
787  case CNUMBER_CMD:
788  return n2String((number2)d,typed);
789  #endif
790 
791  case NUMBER_CMD:
792  StringSetS((char*) (typed ? "number(" : ""));
793  if ((rtyp==IDHDL)&&(IDTYP((idhdl)data)==NUMBER_CMD))
794  {
795  nWrite(IDNUMBER((idhdl)data));
796  }
797  else if (rtyp==NUMBER_CMD)
798  {
799  number n=(number)data;
800  nWrite(n);
801  data=(char *)n;
802  }
803  else if((rtyp==VMINPOLY)&&(rField_is_GF(currRing)))
804  {
805  nfShowMipo(currRing->cf);
806  }
807  else
808  {
809  number n=nCopy((number)d);
810  nWrite(n);
811  nDelete(&n);
812  }
813  StringAppendS((char*) (typed ? ")" : ""));
814  return StringEndS();
815 
816  case BIGINT_CMD:
817  {
818  StringSetS((char*) (typed ? "bigint(" : ""));
819  number nl=(number)d;
821  StringAppendS((char*) (typed ? ")" : ""));
822  return StringEndS();
823  }
824 
825  case MATRIX_CMD:
827  if (typed)
828  {
829  char* ns = (char*) omAlloc(strlen(s) + 40);
830  sprintf(ns, "matrix(ideal(%s),%d,%d)", s,
831  ((ideal) d)->nrows, ((ideal) d)->ncols);
832  omCheckAddr(ns);
833  return ns;
834  }
835  else
836  {
837  return omStrDup(s);
838  }
839 
840  case MODUL_CMD:
841  case IDEAL_CMD:
842  case MAP_CMD:
844  if (typed)
845  {
846  char* ns = (char*) omAlloc(strlen(s) + 10);
847  sprintf(ns, "%s(%s)", (t/*Typ()*/==MODUL_CMD ? "module" : "ideal"), s);
848  omCheckAddr(ns);
849  return ns;
850  }
851  return omStrDup(s);
852 
853  case INTVEC_CMD:
854  case INTMAT_CMD:
855  {
856  intvec *v=(intvec *)d;
857  s = v->String(dim);
858  if (typed)
859  {
860  char* ns;
861  if (t/*Typ()*/ == INTMAT_CMD)
862  {
863  ns = (char*) omAlloc(strlen(s) + 40);
864  sprintf(ns, "intmat(intvec(%s),%d,%d)", s, v->rows(), v->cols());
865  }
866  else
867  {
868  ns = (char*) omAlloc(strlen(s) + 10);
869  sprintf(ns, "intvec(%s)", s);
870  }
871  omCheckAddr(ns);
872  omFree(s);
873  return ns;
874  }
875  else
876  return s;
877  }
878  case BIGINTMAT_CMD:
879  {
880  bigintmat *bim=(bigintmat*)d;
881  s = bim->String();
882  if (typed)
883  {
884  char* ns = (char*) omAlloc0(strlen(s) + 40);
885  sprintf(ns, "bigintmat(bigintvec(%s),%d,%d)", s, bim->rows(), bim->cols());
886  omCheckAddr(ns);
887  return ns;
888  }
889  else
890  return omStrDup(s);
891  }
892 
893  case RING_CMD:
894  case QRING_CMD:
895  s = rString((ring)d);
896 
897  if (typed)
898  {
899  char* ns;
900  if (t/*Typ()*/ == QRING_CMD)
901  {
902  char* id = iiStringMatrix((matrix) ((ring) d)->qideal, dim,
903  currRing);
904  ns = (char*) omAlloc(strlen(s) + strlen(id) + 20);
905  sprintf(ns, "\"%s\";%sideal(%s)", s,(dim == 2 ? "\n" : " "), id);
906  }
907  else
908  {
909  ns = (char*) omAlloc(strlen(s) + 4);
910  sprintf(ns, "\"%s\"", s);
911  }
912  omFree(s);
913  omCheckAddr(ns);
914  return ns;
915  }
916  return s;
917  case RESOLUTION_CMD:
918  {
919  lists l = syConvRes((syStrategy)d);
920  s = lString(l, typed, dim);
921  l->Clean();
922  return s;
923  }
924 
925  case PROC_CMD:
926  {
927  procinfo* pi = (procinfo*) d;
928  if((pi->language == LANG_SINGULAR) && (pi->data.s.body!=NULL))
929  s = (pi->data.s.body);
930  else
931  s = (char *)"";
932  if (typed)
933  {
934  char* ns = (char*) omAlloc(strlen(s) + 4);
935  sprintf(ns, "\"%s\"", s);
936  omCheckAddr(ns);
937  return ns;
938  }
939  return omStrDup(s);
940  }
941 
942  case LINK_CMD:
943  s = slString((si_link) d);
944  if (typed)
945  {
946  char* ns = (char*) omAlloc(strlen(s) + 10);
947  sprintf(ns, "link(\"%s\")", s);
948  omFreeBinAddr(s);
949  omCheckAddr(ns);
950  return ns;
951  }
952  return s;
953 
954  case LIST_CMD:
955  return lString((lists) d, typed, dim);
956 
957  default:
958  if(t> MAX_TOK)
959  {
960  blackbox *bb=getBlackboxStuff(t);
961  if (bb!=NULL) return bb->blackbox_String(bb,d);
962  }
963  } /* end switch: (Typ()) */
964  }
965  return omStrDup("");
966 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
char * pString(poly p)
Definition: polys.h:277
#define nWrite(n)
Definition: numbers.h:29
ip_command * command
Definition: ipid.h:24
Definition: tok.h:85
Definition: lists.h:22
const int MAX_INT_LEN
Definition: mylimits.h:13
Definition: tok.h:42
Matrices of numbers.
Definition: bigintmat.h:51
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:3046
char * rString(ring r)
Definition: ring.cc:644
Definition: tok.h:170
language_defs language
Definition: subexpr.h:58
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:470
char * StringEndS()
Definition: reporter.cc:151
char * lString(lists l, BOOLEAN typed, int dim)
Definition: lists.cc:377
coeffs coeffs_BIGINT
Definition: ipid.cc:54
int Typ()
Definition: subexpr.cc:969
#define omAlloc(size)
Definition: omAllocDecl.h:210
void Print(leftv store=NULL, int spaces=0)
Called by type_cmd (e.g. "r;") or as default in jPRINT.
Definition: subexpr.cc:73
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
char * String(int dim=2) const
Definition: intvec.cc:146
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define IDTYP(a)
Definition: ipid.h:118
void nfShowMipo(const coeffs r)
Show the mininimal polynom.... NOTE: this is used by char * sleftv::String(void *d, BOOLEAN typed, int dim) (from Singular/subexpr.cc) for printing minpoly.
Definition: ffields.cc:582
Definition: intvec.h:16
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
#define omFree(addr)
Definition: omAllocDecl.h:261
void StringSetS(const char *st)
Definition: reporter.cc:128
void StringAppendS(const char *st)
Definition: reporter.cc:107
int nrows
Definition: cf_linsys.cc:32
procinfodata data
Definition: subexpr.h:62
static FORCE_INLINE void n_Write(number &n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition: coeffs.h:592
int dim(ideal I, ring r)
void PrintS(const char *s)
Definition: reporter.cc:294
Definition: tok.h:88
#define nDelete(n)
Definition: numbers.h:16
int cols() const
Definition: bigintmat.h:147
short errorreported
Definition: feFopen.cc:23
#define IDNUMBER(a)
Definition: ipid.h:131
#define pi
Definition: libparse.cc:1143
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
int rows() const
Definition: bigintmat.h:148
Definition: tok.h:95
#define NULL
Definition: omList.c:10
int cols() const
Definition: intvec.h:87
int rows() const
Definition: intvec.h:88
char * String()
IO: String returns a singular string containing the matrix, needs freeing afterwards.
Definition: bigintmat.cc:433
int int ncols
Definition: cf_linsys.cc:32
int rtyp
Definition: subexpr.h:92
#define nCopy(n)
Definition: numbers.h:15
void Clean(ring r=currRing)
Definition: lists.h:25
void * Data()
Definition: subexpr.cc:1111
Definition: tok.h:96
Definition: tok.h:126
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
polyrec * poly
Definition: hilb.h:10
char * iiStringMatrix(matrix im, int dim, const ring r, char ch)
Definition: matpol.cc:760
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
char * n2String(number2 d, BOOLEAN typed)
Definition: number2.cc:298
#define COMMAND
Definition: tok.h:33
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
#define omStrDup(s)
Definition: omAllocDecl.h:263
int sleftv::Typ ( )

Definition at line 969 of file subexpr.cc.

970 {
971  if (e==NULL)
972  {
973  switch (rtyp)
974  {
975  case IDHDL:
976  return IDTYP((idhdl)data);
977  case ALIAS_CMD:
978  {
979  idhdl h=(idhdl)data;
980  return ((idhdl)h->data.ustring)->typ;
981  }
982  case VECHO:
983  case VPRINTLEVEL:
984  case VCOLMAX:
985  case VTIMER:
986  case VRTIMER:
987  case VOICE:
988  case VMAXDEG:
989  case VMAXMULT:
990  case TRACE:
991  case VSHORTOUT:
992  return INT_CMD;
993  case VMINPOLY:
994  data=NULL;
995  return NUMBER_CMD;
996  case VNOETHER:
997  data=NULL;
998  return POLY_CMD;
999  //case COMMAND:
1000  // return COMMAND;
1001  default:
1002  return rtyp;
1003  }
1004  }
1005  int r=0;
1006  int t=rtyp;
1007  void *d=data;
1008  if (t==IDHDL) t=IDTYP((idhdl)d);
1009  else if (t==ALIAS_CMD)
1010  { idhdl h=(idhdl)IDDATA((idhdl)data); t=IDTYP(h);d=IDDATA(h); }
1011  switch (t)
1012  {
1013 #ifdef SINGULAR_4_1
1014  case CMATRIX_CMD:
1015  {
1016  bigintmat *b=(bigintmat*)d;
1017  if ((currRing!=NULL)&&(currRing->cf==b->basecoeffs()))
1018  return NUMBER_CMD;
1019  else
1020  return CNUMBER_CMD;
1021  }
1022 #endif
1023  case INTVEC_CMD:
1024  case INTMAT_CMD:
1025  r=INT_CMD;
1026  break;
1027  case BIGINTMAT_CMD:
1028  r=BIGINT_CMD;
1029  break;
1030  case IDEAL_CMD:
1031  case MATRIX_CMD:
1032  case MAP_CMD:
1033  r=POLY_CMD;
1034  break;
1035  case MODUL_CMD:
1036  r=VECTOR_CMD;
1037  break;
1038  case STRING_CMD:
1039  r=STRING_CMD;
1040  break;
1041  default:
1042  {
1043  blackbox *b=NULL;
1044  if (t>MAX_TOK)
1045  {
1046  b=getBlackboxStuff(t);
1047  }
1048  if ((t==LIST_CMD)||((b!=NULL)&&BB_LIKE_LIST(b)))
1049  {
1050  lists l;
1051  if (rtyp==IDHDL) l=IDLIST((idhdl)d);
1052  else l=(lists)d;
1053  if ((0<e->start)&&(e->start<=l->nr+1))
1054  {
1055  Subexpr tmp=l->m[e->start-1].e;
1056  l->m[e->start-1].e=e->next;
1057  r=l->m[e->start-1].Typ();
1058  e->next=l->m[e->start-1].e;
1059  l->m[e->start-1].e=tmp;
1060  }
1061  else
1062  {
1063  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1064  r=DEF_CMD;
1065  }
1066  }
1067  else
1068  Werror("cannot index type %s(%d)",Tok2Cmdname(t),t);
1069  break;
1070  }
1071  }
1072  return r;
1073 }
#define IDLIST(a)
Definition: ipid.h:136
Definition: tok.h:164
Definition: tok.h:160
sleftv * m
Definition: lists.h:45
Definition: tok.h:85
Definition: tok.h:161
Subexpr e
Definition: subexpr.h:106
Definition: lists.h:22
Definition: tok.h:42
Matrices of numbers.
Definition: bigintmat.h:51
Definition: tok.h:170
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
int Typ()
Definition: subexpr.cc:969
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define IDTYP(a)
Definition: ipid.h:118
Definition: tok.h:165
const ring r
Definition: syzextra.cc:208
Definition: tok.h:58
idrec * idhdl
Definition: ring.h:18
Definition: tok.h:163
Definition: tok.h:88
Definition: tok.h:38
Definition: tok.h:166
int nr
Definition: lists.h:43
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
coeffs basecoeffs() const
Definition: bigintmat.h:149
int rtyp
Definition: subexpr.h:92
Definition: tok.h:96
#define IDDATA(a)
Definition: ipid.h:125
Definition: tok.h:162
static Poly * h
Definition: janet.cc:978
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int l
Definition: cfEzgcd.cc:94
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
utypes data
Definition: idrec.h:40

Field Documentation

attr sleftv::attribute

Definition at line 90 of file subexpr.h.

void* sleftv::data

Definition at line 89 of file subexpr.h.

Subexpr sleftv::e

Definition at line 106 of file subexpr.h.

BITSET sleftv::flag

Definition at line 91 of file subexpr.h.

const char* sleftv::name

Definition at line 88 of file subexpr.h.

leftv sleftv::next

Definition at line 87 of file subexpr.h.

package sleftv::req_packhdl

Definition at line 107 of file subexpr.h.

int sleftv::rtyp

Definition at line 92 of file subexpr.h.


The documentation for this class was generated from the following files: