My Project  UNKNOWN_GIT_VERSION
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 82 of file subexpr.h.

Member Function Documentation

◆ Attribute()

attr * sleftv::Attribute ( )

Definition at line 1476 of file subexpr.cc.

1477 {
1478  if (e==NULL) return &attribute;
1479  if ((rtyp==LIST_CMD)
1480  ||((rtyp==IDHDL)&&(IDTYP((idhdl)data)==LIST_CMD))
1481  || (rtyp>MAX_TOK)
1482  || ((rtyp==IDHDL)&&(IDTYP((idhdl)data)>MAX_TOK)))
1483  {
1484  leftv v=LData();
1485  return &(v->attribute);
1486  }
1487  return NULL;
1488 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
Subexpr e
Definition: subexpr.h:105
Definition: tok.h:216
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:88
#define IDTYP(a)
Definition: ipid.h:114
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
Definition: tok.h:118
attr attribute
Definition: subexpr.h:89
leftv LData()
Definition: subexpr.cc:1490

◆ CleanUp()

void sleftv::CleanUp ( ring  r = currRing)

Definition at line 354 of file subexpr.cc.

355 {
356  if (rtyp!=IDHDL)
357  {
358  if ((name!=NULL) && (name!=sNoName_fe) && (rtyp!=ALIAS_CMD))
359  {
360  //::Print("free %x (%s)\n",name,name);
361  omFree((ADDRESS)name); // may be larger >1000 char (large int)
362  }
363  //name=NULL;
364  //flag=0;
365  if (data!=NULL)
366  {
367  //if (rtyp==IDHDL) attribute=NULL; // is only a pointer to attribute of id
369  //data=NULL; // will be done by Init() at the end
370  }
371  if (attribute!=NULL)
372  {
373  switch (rtyp)
374  {
375  case PACKAGE_CMD:
376  //case IDHDL:
377  case ANY_TYPE:
378  case VECHO:
379  case VPRINTLEVEL:
380  case VCOLMAX:
381  case VTIMER:
382  case VRTIMER:
383  case VOICE:
384  case VMAXDEG:
385  case VMAXMULT:
386  case TRACE:
387  case VSHORTOUT:
388  case VNOETHER:
389  case VMINPOLY:
390  case 0:
391  //attribute=NULL; // will be done by Init() at the end
392  break;
393  default:
394  {
395  attribute->killAll(r);
396  }
397  }
398  }
399  }
400  Subexpr h;
401  while (e!=NULL)
402  {
403  h=e->next;
405  e=h;
406  }
407  //rtyp=NONE; // will be done by Init() at the end
408  if (next!=NULL)
409  {
410  leftv tmp_n;
411  do
412  {
413  tmp_n=next->next;
414  //next->name=NULL;
415  next->next=NULL;
416  next->CleanUp(r);
418  next=tmp_n;
419  } while (next!=NULL);
420  }
421  Init();
422 }
Definition: tok.h:210
Definition: tok.h:206
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
#define ANY_TYPE
Definition: tok.h:30
Definition: tok.h:207
void killAll(const ring r)
Definition: attrib.cc:188
Subexpr e
Definition: subexpr.h:105
const char sNoName_fe[]
Definition: fevoices.cc:56
omBin sleftv_bin
Definition: subexpr.cc:47
void Init()
Definition: subexpr.h:107
void * ADDRESS
Definition: auxiliary.h:133
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:88
Definition: tok.h:211
const char * name
Definition: subexpr.h:87
#define omFree(addr)
Definition: omAllocDecl.h:261
omBin sSubexpr_bin
Definition: subexpr.cc:46
void s_internalDelete(const int t, void *d, const ring r)
Definition: subexpr.cc:520
Definition: tok.h:209
leftv next
Definition: subexpr.h:86
Definition: tok.h:34
Definition: tok.h:212
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void CleanUp(ring r=currRing)
Definition: subexpr.cc:354
attr attribute
Definition: subexpr.h:89
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
Definition: tok.h:208
static Poly * h
Definition: janet.cc:972

◆ Copy()

void sleftv::Copy ( leftv  e)

Definition at line 720 of file subexpr.cc.

721 {
722  Init();
723  rtyp=source->Typ();
724  void *d=source->Data();
725  if(!errorreported)
726  {
727  if (rtyp==BUCKET_CMD)
728  {
729  rtyp=POLY_CMD;
730  data=(void*)pCopy(sBucketPeek((sBucket_pt)d));
731  }
732  else
734  if ((source->attribute!=NULL)||(source->e!=NULL))
735  attribute=source->CopyA();
736  flag=source->flag;
737  if (source->next!=NULL)
738  {
740  next->Copy(source->next);
741  }
742  }
743 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
BITSET flag
Definition: subexpr.h:90
omBin sleftv_bin
Definition: subexpr.cc:47
void Init()
Definition: subexpr.h:107
sleftv * leftv
Definition: structs.h:60
void * data
Definition: subexpr.h:88
void * CopyA()
Definition: subexpr.cc:2031
void Copy(leftv e)
Definition: subexpr.cc:720
static void * s_internalCopy(const int t, void *d)
Definition: subexpr.cc:436
short errorreported
Definition: feFopen.cc:23
leftv next
Definition: subexpr.h:86
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
poly sBucketPeek(sBucket_pt b)
Definition: sbuckets.cc:455
attr attribute
Definition: subexpr.h:89
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ CopyA()

attr sleftv::CopyA ( )

Definition at line 781 of file subexpr.cc.

782 {
783  attr *a=Attribute();
784  if ((a!=NULL) && (*a!=NULL))
785  return (*a)->Copy();
786  return NULL;
787 }
Definition: attrib.h:17
attr * Attribute()
Definition: subexpr.cc:1476
#define NULL
Definition: omList.c:10

◆ CopyD() [1/2]

void * sleftv::CopyD ( int  t)

Definition at line 745 of file subexpr.cc.

746 {
747  if ((rtyp!=IDHDL)&&(rtyp!=ALIAS_CMD)&&(e==NULL))
748  {
749  if (iiCheckRing(t)) return NULL;
750  void *x = data;
751  if (rtyp==VNOETHER) x = (void *)pCopy((currRing->ppNoether));
752  else if ((rtyp==VMINPOLY) && nCoeff_is_algExt(currRing->cf) && (!nCoeff_is_GF(currRing->cf)))
753  {
754  const ring A = currRing->cf->extRing;
755 
756  assume( A != NULL );
757  assume( A->qideal != NULL );
758 
759  x=(void *)p_Copy(A->qideal->m[0], A);
760  }
761  data=NULL;
762  return x;
763  }
764  void *d=Data(); // will also do a iiCheckRing
765  if ((!errorreported) && (d!=NULL)) return slInternalCopy(this,t,d,e);
766  return NULL;
767 }
void * slInternalCopy(leftv source, const int t, void *d, Subexpr e)
Definition: subexpr.cc:691
Subexpr e
Definition: subexpr.h:105
#define IDHDL
Definition: tok.h:31
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:813
void * data
Definition: subexpr.h:88
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:932
#define assume(x)
Definition: mod2.h:390
#define A
Definition: sirandom.c:23
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:861
short errorreported
Definition: feFopen.cc:23
Definition: tok.h:34
BOOLEAN iiCheckRing(int i)
Definition: ipshell.cc:1497
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
int rtyp
Definition: subexpr.h:91
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void * Data()
Definition: subexpr.cc:1182
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ CopyD() [2/2]

void* sleftv::CopyD ( )
inline

Definition at line 119 of file subexpr.h.

119 { return CopyD(Typ()); }
void * CopyD()
Definition: subexpr.h:119
int Typ()
Definition: subexpr.cc:1039

◆ Data()

void * sleftv::Data ( )

Definition at line 1182 of file subexpr.cc.

1183 {
1184  if ((rtyp!=IDHDL) && iiCheckRing(rtyp))
1185  return NULL;
1186  if (e==NULL)
1187  {
1188  switch (rtyp)
1189  {
1190  case ALIAS_CMD:
1191  {
1192  idhdl h=(idhdl)data;
1193  return ((idhdl)h->data.ustring)->data.ustring;
1194  }
1195  case VECHO: return (void *)(long)si_echo;
1196  case VPRINTLEVEL:return (void *)(long)printlevel;
1197  case VCOLMAX: return (void *)(long)colmax;
1198  case VTIMER: return (void *)(long)getTimer();
1199  case VRTIMER: return (void *)(long)getRTimer();
1200  case VOICE: return (void *)(long)(myynest+1);
1201  case VMAXDEG: return (void *)(long)Kstd1_deg;
1202  case VMAXMULT: return (void *)(long)Kstd1_mu;
1203  case TRACE: return (void *)(long)traceit;
1204  case VSHORTOUT: return (void *)(long)(currRing != NULL ? currRing->ShortOut : 0);
1205  case VMINPOLY:
1206  if ( (currRing != NULL) && nCoeff_is_algExt(currRing->cf) && !nCoeff_is_GF(currRing->cf))
1207  {
1208  /* Q(a), Fp(a), but not GF(q) */
1209  const ring A = currRing->cf->extRing;
1210 
1211  assume( A != NULL );
1212  assume( A->qideal != NULL );
1213 
1214  return (void *)A->qideal->m[0];
1215  }
1216  else
1217  return (void *)nInit(0);
1218 
1219  case VNOETHER: return (void *) (currRing->ppNoether);
1220  case IDHDL:
1221  return IDDATA((idhdl)data);
1222  case COMMAND:
1223  //return NULL;
1224  default:
1225  return data;
1226  }
1227  }
1228  /* e != NULL : */
1229  int t=rtyp;
1230  void *d=data;
1231  if (t==IDHDL)
1232  {
1233  t=((idhdl)data)->typ;
1234  d=IDDATA((idhdl)data);
1235  }
1236  else if (t==ALIAS_CMD)
1237  {
1239  t=IDTYP(h);
1240  d=IDDATA(h);
1241  }
1242  if (iiCheckRing(t))
1243  return NULL;
1244  char *r=NULL;
1245  int index=e->start;
1246  switch (t)
1247  {
1248  case INTVEC_CMD:
1249  {
1250  intvec *iv=(intvec *)d;
1251  if ((index<1)||(index>iv->length()))
1252  {
1253  if (!errorreported)
1254  Werror("wrong range[%d] in intvec %s(%d)",index,this->Name(),iv->length());
1255  }
1256  else
1257  r=(char *)(long)((*iv)[index-1]);
1258  break;
1259  }
1260  case INTMAT_CMD:
1261  {
1262  intvec *iv=(intvec *)d;
1263  if ((index<1)
1264  ||(index>iv->rows())
1265  ||(e->next->start<1)
1266  ||(e->next->start>iv->cols()))
1267  {
1268  if (!errorreported)
1269  Werror("wrong range[%d,%d] in intmat %s(%dx%d)",index,e->next->start,
1270  this->Name(),iv->rows(),iv->cols());
1271  }
1272  else
1273  r=(char *)(long)(IMATELEM((*iv),index,e->next->start));
1274  break;
1275  }
1276  case BIGINTMAT_CMD:
1277  {
1278  bigintmat *m=(bigintmat *)d;
1279  if ((index<1)
1280  ||(index>m->rows())
1281  ||(e->next->start<1)
1282  ||(e->next->start>m->cols()))
1283  {
1284  if (!errorreported)
1285  Werror("wrong range[%d,%d] in bigintmat %s(%dx%d)",index,e->next->start,
1286  this->Name(),m->rows(),m->cols());
1287  }
1288  else
1289  r=(char *)(BIMATELEM((*m),index,e->next->start));
1290  break;
1291  }
1292 #ifdef SINGULAR_4_2
1293  case CMATRIX_CMD:
1294  {
1295  bigintmat *m=(bigintmat *)d;
1296  if ((index<1)
1297  ||(index>m->rows())
1298  ||(e->next->start<1)
1299  ||(e->next->start>m->cols()))
1300  {
1301  if (!errorreported)
1302  Werror("wrong range[%d,%d] in matrix %s(%dx%d)",index,e->next->start,
1303  this->Name(),m->rows(),m->cols());
1304  }
1305  else
1306  {
1307  iiNumber2Data[iiCmatrix_index].cf=m->basecoeffs();
1308  iiNumber2Data[iiCmatrix_index].n=BIMATELEM((*m),index,e->next->start);
1309  r=(char*)&iiNumber2Data[iiCmatrix_index];
1310  iiCmatrix_index=(iiCmatrix_index+1) % 4;
1311  }
1312  break;
1313  }
1314 #endif
1315  case IDEAL_CMD:
1316  case MODUL_CMD:
1317  case MAP_CMD:
1318  {
1319  ideal I=(ideal)d;
1320  if ((index<1)||(index>IDELEMS(I)))
1321  {
1322  if (!errorreported)
1323  Werror("wrong range[%d] in ideal/module %s(%d)",index,this->Name(),IDELEMS(I));
1324  }
1325  else
1326  r=(char *)I->m[index-1];
1327  break;
1328  }
1329  case SMATRIX_CMD:
1330  {
1331  ideal I=(ideal)d;
1332  int c;
1333  sleftv tmp;
1334  tmp.Init();
1335  tmp.rtyp=POLY_CMD;
1336  if ((index>0)&& (index<=I->rank)
1337  && (e->next!=NULL)
1338  && ((c=e->next->start)>0) &&(c<=IDELEMS(I)))
1339  {
1340  r=(char*)SMATELEM(I,index-1,c-1,currRing);
1341  }
1342  else
1343  {
1344  r=NULL;
1345  }
1346  tmp.data=r;
1347  if ((rtyp==IDHDL)||(rtyp==SMATRIX_CMD))
1348  {
1349  tmp.next=next; next=NULL;
1350  d=NULL;
1351  CleanUp();
1352  memcpy(this,&tmp,sizeof(tmp));
1353  }
1354  // and, remember, r is also the result...
1355  else
1356  {
1357  // ???
1358  // here we still have a memory leak...
1359  // example: list L="123","456";
1360  // L[1][2];
1361  // therefore, it should never happen:
1362  assume(0);
1363  // but if it happens: here is the temporary fix:
1364  // omMarkAsStaticAddr(r);
1365  }
1366  break;
1367  }
1368  case STRING_CMD:
1369  {
1370  // this was a memory leak
1371  // we evalute it, cleanup and replace this leftv by it's evalutated form
1372  // the evalutated form will be build in tmp
1373  sleftv tmp;
1374  tmp.Init();
1375  tmp.rtyp=STRING_CMD;
1376  r=(char *)omAllocBin(size_two_bin);
1377  if ((index>0)&& (index<=(int)strlen((char *)d)))
1378  {
1379  r[0]=*(((char *)d)+index-1);
1380  r[1]='\0';
1381  }
1382  else
1383  {
1384  r[0]='\0';
1385  }
1386  tmp.data=r;
1387  if ((rtyp==IDHDL)||(rtyp==STRING_CMD))
1388  {
1389  tmp.next=next; next=NULL;
1390  //if (rtyp==STRING_CMD) { omFree((ADDRESS)data); }
1391  //data=NULL;
1392  d=NULL;
1393  CleanUp();
1394  memcpy(this,&tmp,sizeof(tmp));
1395  }
1396  // and, remember, r is also the result...
1397  else
1398  {
1399  // ???
1400  // here we still have a memory leak...
1401  // example: list L="123","456";
1402  // L[1][2];
1403  // therefore, it should never happen:
1404  assume(0);
1405  // but if it happens: here is the temporary fix:
1406  // omMarkAsStaticAddr(r);
1407  }
1408  break;
1409  }
1410  case MATRIX_CMD:
1411  {
1412  if ((index<1)
1413  ||(index>MATROWS((matrix)d))
1414  ||(e->next->start<1)
1415  ||(e->next->start>MATCOLS((matrix)d)))
1416  {
1417  if (!errorreported)
1418  Werror("wrong range[%d,%d] in matrix %s(%dx%d)",
1419  index,e->next->start,
1420  this->Name(),
1421  MATROWS((matrix)d),MATCOLS((matrix)d));
1422  }
1423  else
1424  r=(char *)MATELEM((matrix)d,index,e->next->start);
1425  break;
1426  }
1427  default:
1428  {
1429  blackbox *b=NULL;
1430  if (t>MAX_TOK)
1431  {
1432  b=getBlackboxStuff(t);
1433  }
1434  if ((t==LIST_CMD)||((b!=NULL)&&(BB_LIKE_LIST(b))))
1435  {
1436  lists l=(lists)d;
1437  if ((0<index)&&(index<=l->nr+1))
1438  {
1439  if ((e->next!=NULL)
1440  && (l->m[index-1].rtyp==STRING_CMD))
1441  // string[..].Data() modifies sleftv, so let's do it ourself
1442  {
1443  char *dd=(char *)l->m[index-1].data;
1444  int j=e->next->start-1;
1445  r=(char *)omAllocBin(size_two_bin);
1446  if ((j>=0) && (j<(int)strlen(dd)))
1447  {
1448  r[0]=*(dd+j);
1449  r[1]='\0';
1450  }
1451  else
1452  {
1453  r[0]='\0';
1454  }
1455  }
1456  else
1457  {
1458  Subexpr tmp=l->m[index-1].e;
1459  l->m[index-1].e=e->next;
1460  r=(char *)l->m[index-1].Data();
1461  e->next=l->m[index-1].e;
1462  l->m[index-1].e=tmp;
1463  }
1464  }
1465  else //if (!errorreported)
1466  Werror("wrong range[%d] in list %s(%d)",index,this->Name(),l->nr+1);
1467  }
1468  else
1469  Werror("cannot index %s of type %s(%d)",this->Name(),Tok2Cmdname(t),t);
1470  break;
1471  }
1472  }
1473  return r;
1474 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
Definition: tok.h:210
Definition: tok.h:206
int j
Definition: facHensel.cc:105
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
Definition: tok.h:207
Subexpr e
Definition: subexpr.h:105
Definition: lists.h:22
int getRTimer()
Definition: timer.cc:172
Matrices of numbers.
Definition: bigintmat.h:51
Definition: tok.h:216
int rows() const
Definition: intvec.h:94
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
void Init()
Definition: subexpr.h:107
int traceit
Definition: febase.cc:42
const char * Name()
Definition: subexpr.h:120
#define SMATELEM(A, i, j, R)
Definition: matpol.h:108
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
int Kstd1_mu
Definition: kutil.cc:237
void * data
Definition: subexpr.h:88
int myynest
Definition: febase.cc:41
#define IDTYP(a)
Definition: ipid.h:114
Definition: tok.h:211
CanonicalForm b
Definition: cfModGcd.cc:4044
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:932
Definition: intvec.h:17
#define assume(x)
Definition: mod2.h:390
#define A
Definition: sirandom.c:23
int m
Definition: cfEzgcd.cc:121
idrec * idhdl
Definition: ring.h:22
Definition: tok.h:209
#define IDELEMS(i)
Definition: simpleideals.h:24
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:861
short errorreported
Definition: feFopen.cc:23
leftv next
Definition: subexpr.h:86
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
#define BIMATELEM(M, I, J)
Definition: bigintmat.h:134
Definition: tok.h:34
BOOLEAN iiCheckRing(int i)
Definition: ipshell.cc:1497
Definition: tok.h:212
int nr
Definition: lists.h:43
#define MATCOLS(i)
Definition: matpol.h:27
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int length() const
Definition: intvec.h:92
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:140
int cols() const
Definition: intvec.h:93
int rtyp
Definition: subexpr.h:91
void CleanUp(ring r=currRing)
Definition: subexpr.cc:354
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
Definition: tok.h:118
int printlevel
Definition: febase.cc:36
#define MATROWS(i)
Definition: matpol.h:26
#define IDDATA(a)
Definition: ipid.h:121
int Kstd1_deg
Definition: kutil.cc:236
int colmax
Definition: febase.cc:37
Definition: tok.h:208
int getTimer()
Definition: timer.cc:97
#define nInit(i)
Definition: numbers.h:25
static Poly * h
Definition: janet.cc:972
#define IMATELEM(M, I, J)
Definition: intvec.h:83
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int l
Definition: cfEzgcd.cc:93
static omBin size_two_bin
Definition: subexpr.cc:50
int si_echo
Definition: febase.cc:35
#define MATELEM(mat, i, j)
Definition: matpol.h:28
#define COMMAND
Definition: tok.h:29
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:16

◆ Eval()

int sleftv::Eval ( )

Definition at line 1839 of file subexpr.cc.

1840 {
1841  BOOLEAN nok=FALSE;
1842  leftv nn=next;
1843  next=NULL;
1844  if(rtyp==IDHDL)
1845  {
1846  int t=Typ();
1847  if (t!=PROC_CMD)
1848  {
1849  void *d=CopyD(t);
1850  data=d;
1851  rtyp=t;
1852  name=NULL;
1853  e=NULL;
1854  }
1855  }
1856  else if (rtyp==COMMAND)
1857  {
1858  command d=(command)data;
1859  if(d->op==PROC_CMD) //assume d->argc==2
1860  {
1861  char *what=(char *)(d->arg1.Data());
1862  idhdl h=ggetid(what);
1863  if((h!=NULL)&&(IDTYP(h)==PROC_CMD))
1864  {
1865  nok=d->arg2.Eval();
1866  if(!nok)
1867  {
1868  nok=iiMake_proc(h,req_packhdl,&d->arg2);
1869  this->CleanUp(currRing);
1870  if (!nok)
1871  {
1872  memcpy(this,&iiRETURNEXPR,sizeof(sleftv));
1873  memset(&iiRETURNEXPR,0,sizeof(sleftv));
1874  }
1875  }
1876  }
1877  else nok=TRUE;
1878  }
1879  else if (d->op=='=') //assume d->argc==2
1880  {
1881  if ((d->arg1.rtyp!=IDHDL)&&(d->arg1.rtyp!=DEF_CMD))
1882  {
1883  nok=d->arg1.Eval();
1884  }
1885  if (!nok)
1886  {
1887  const char *n=d->arg1.name;
1888  nok=(n == NULL) || d->arg2.Eval();
1889  if (!nok)
1890  {
1891  int save_typ=d->arg1.rtyp;
1892  omCheckAddr((ADDRESS)n);
1893  if (d->arg1.rtyp!=IDHDL)
1894  syMake(&d->arg1,n);
1895  omCheckAddr((ADDRESS)d->arg1.name);
1896  if (d->arg1.rtyp==IDHDL)
1897  {
1898  n=omStrDup(IDID((idhdl)d->arg1.data));
1899  killhdl((idhdl)d->arg1.data);
1900  d->arg1.Init();
1901  //d->arg1.data=NULL;
1902  d->arg1.name=n;
1903  }
1904  d->arg1.rtyp=DEF_CMD;
1905  sleftv t;
1906  if(save_typ!=PROC_CMD) save_typ=d->arg2.rtyp;
1907  if (::RingDependend(d->arg2.rtyp))
1908  nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&currRing->idroot);
1909  else
1910  nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&IDROOT);
1911  memcpy(&d->arg1,&t,sizeof(sleftv));
1912  omCheckAddr((ADDRESS)d->arg1.name);
1913  nok=nok||iiAssign(&d->arg1,&d->arg2);
1914  omCheckIf(d->arg1.name != NULL, // OB: ????
1915  omCheckAddr((ADDRESS)d->arg1.name));
1916  if (!nok)
1917  {
1918  memset(&d->arg1,0,sizeof(sleftv));
1919  this->CleanUp();
1920  rtyp=NONE;
1921  }
1922  }
1923  }
1924  else nok=TRUE;
1925  }
1926  else
1927  {
1928  sleftv tmp; tmp.Init();
1929  int toktype=iiTokType(d->op);
1930  if ((toktype==CMD_M)
1931  ||( toktype==ROOT_DECL_LIST)
1932  ||( toktype==RING_DECL_LIST))
1933  {
1934  if (d->argc <=3)
1935  {
1936  if (d->argc>=1) nok=d->arg1.Eval();
1937  if ((!nok) && (d->argc>=2))
1938  {
1939  nok=d->arg2.Eval();
1940  d->arg1.next=(leftv)omAllocBin(sleftv_bin);
1941  memcpy(d->arg1.next,&d->arg2,sizeof(sleftv));
1942  d->arg2.Init();
1943  }
1944  if ((!nok) && (d->argc==3))
1945  {
1946  nok=d->arg3.Eval();
1947  d->arg1.next->next=(leftv)omAllocBin(sleftv_bin);
1948  memcpy(d->arg1.next->next,&d->arg3,sizeof(sleftv));
1949  d->arg3.Init();
1950  }
1951  if (d->argc==0)
1952  nok=nok||iiExprArithM(&tmp,NULL,d->op);
1953  else
1954  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1955  }
1956  else
1957  {
1958  nok=d->arg1.Eval();
1959  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1960  }
1961  }
1962  else if (d->argc==1)
1963  {
1964  nok=d->arg1.Eval();
1965  nok=nok||iiExprArith1(&tmp,&d->arg1,d->op);
1966  }
1967  else if(d->argc==2)
1968  {
1969  nok=d->arg1.Eval();
1970  nok=nok||d->arg2.Eval();
1971  nok=nok||iiExprArith2(&tmp,&d->arg1,d->op,&d->arg2);
1972  }
1973  else if(d->argc==3)
1974  {
1975  nok=d->arg1.Eval();
1976  nok=nok||d->arg2.Eval();
1977  nok=nok||d->arg3.Eval();
1978  nok=nok||iiExprArith3(&tmp,d->op,&d->arg1,&d->arg2,&d->arg3);
1979  }
1980  else if(d->argc!=0)
1981  {
1982  nok=d->arg1.Eval();
1983  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1984  }
1985  else // d->argc == 0
1986  {
1987  nok = iiExprArithM(&tmp, NULL, d->op);
1988  }
1989  this->CleanUp();
1990  memcpy(this,&tmp,sizeof(tmp));
1991  }
1992  }
1993  else if (((rtyp==0)||(rtyp==DEF_CMD))
1994  &&(name!=NULL))
1995  {
1996  syMake(this,name);
1997  }
1998 #ifdef MDEBUG
1999  switch(Typ())
2000  {
2001  case NUMBER_CMD:
2002 #ifdef LDEBUG
2003  nTest((number)Data());
2004 #endif
2005  break;
2006  case BIGINT_CMD:
2007 #ifdef LDEBUG
2008  n_Test((number)Data(),coeffs_BIGINT);
2009 #endif
2010  break;
2011  case POLY_CMD:
2012  pTest((poly)Data());
2013  break;
2014  case IDEAL_CMD:
2015  case MODUL_CMD:
2016  case MATRIX_CMD:
2017  {
2018  ideal id=(ideal)Data();
2019  omCheckAddrSize(id,sizeof(*id));
2020  int i=id->ncols*id->nrows-1;
2021  for(;i>=0;i--) pTest(id->m[i]);
2022  }
2023  break;
2024  }
2025 #endif
2026  if (nn!=NULL) nok=nok||nn->Eval();
2027  next=nn;
2028  return nok;
2029 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
idhdl ggetid(const char *n)
Definition: ipid.cc:523
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
int Eval()
Definition: subexpr.cc:1839
ip_command * command
Definition: ipid.h:22
Subexpr e
Definition: subexpr.h:105
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:8448
#define IDID(a)
Definition: ipid.h:117
#define FALSE
Definition: auxiliary.h:94
Definition: tok.h:38
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition: iparith.cc:8661
omBin sleftv_bin
Definition: subexpr.cc:47
#define pTest(p)
Definition: polys.h:409
sleftv iiRETURNEXPR
Definition: iplib.cc:455
#define omCheckIf(cond, test)
Definition: omAllocDecl.h:323
#define IDROOT
Definition: ipid.h:18
#define TRUE
Definition: auxiliary.h:98
void Init()
Definition: subexpr.h:107
void * ADDRESS
Definition: auxiliary.h:133
void * CopyD()
Definition: subexpr.h:119
sleftv * leftv
Definition: structs.h:60
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition: iparith.cc:8751
coeffs coeffs_BIGINT
Definition: ipid.cc:52
int Typ()
Definition: subexpr.cc:1039
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:88
#define IDTYP(a)
Definition: ipid.h:114
BOOLEAN RingDependend()
Definition: subexpr.cc:424
#define nTest(a)
Definition: numbers.h:36
Definition: tok.h:58
const char * name
Definition: subexpr.h:87
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:738
int i
Definition: cfEzgcd.cc:125
leftv next
Definition: subexpr.h:86
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1127
BOOLEAN iiMake_proc(idhdl pn, package pack, leftv sl)
Definition: iplib.cc:485
#define NULL
Definition: omList.c:10
package req_packhdl
Definition: subexpr.h:106
void killhdl(idhdl h, package proot)
Definition: ipid.cc:386
int rtyp
Definition: subexpr.h:91
void CleanUp(ring r=currRing)
Definition: subexpr.cc:354
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void * Data()
Definition: subexpr.cc:1182
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
int iiTokType(int op)
Definition: iparith.cc:233
static Poly * h
Definition: janet.cc:972
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
Definition: iparith.cc:8259
#define NONE
Definition: tok.h:219
void syMake(leftv v, const char *id, package pa)
Definition: subexpr.cc:1584
#define COMMAND
Definition: tok.h:29
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1819
#define omStrDup(s)
Definition: omAllocDecl.h:263

◆ Fullname()

const char* sleftv::Fullname ( )
inline

Definition at line 125 of file subexpr.h.

126  {
127  if ((name!=NULL) && (e==NULL)) return(this->name);
128  else return sNoName_fe;
129  }
Subexpr e
Definition: subexpr.h:105
const char sNoName_fe[]
Definition: fevoices.cc:56
const char * name
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10

◆ Init()

void sleftv::Init ( )
inline

Definition at line 107 of file subexpr.h.

107 { memset(this,0,sizeof(*this)); }

◆ LData()

leftv sleftv::LData ( )

Definition at line 1490 of file subexpr.cc.

1491 {
1492  if (e!=NULL)
1493  {
1494  lists l=NULL;
1495  blackbox *b=getBlackboxStuff(rtyp);
1496 
1497  if ((rtyp==LIST_CMD)
1498  || ((b!=NULL)&&(BB_LIKE_LIST(b))))
1499  l=(lists)data;
1500  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1501  l=IDLIST((idhdl)data);
1502  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)>MAX_TOK))
1503  {
1505  if (BB_LIKE_LIST(b)) l=IDLIST((idhdl)data);
1506  }
1507  else if (rtyp==ALIAS_CMD)
1508  {
1509  idhdl h=(idhdl)data;
1510  l= (lists)(((idhdl)h->data.ustring)->data.ustring);
1511  }
1512  if (l!=NULL)
1513  {
1514  if ((0>=e->start)||(e->start>l->nr+1))
1515  return NULL;
1516  if (e->next!=NULL)
1517  {
1518  l->m[e->start-1].e=e->next;
1519  leftv r=l->m[e->start-1].LData();
1520  l->m[e->start-1].e=NULL;
1521  return r;
1522  }
1523  return &(l->m[e->start-1]);
1524  }
1525  }
1526  return this;
1527 }
#define IDLIST(a)
Definition: ipid.h:132
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
Subexpr e
Definition: subexpr.h:105
Definition: lists.h:22
Definition: tok.h:216
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:88
#define IDTYP(a)
Definition: ipid.h:114
CanonicalForm b
Definition: cfModGcd.cc:4044
idrec * idhdl
Definition: ring.h:22
Definition: tok.h:34
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:91
Definition: tok.h:118
static Poly * h
Definition: janet.cc:972
int l
Definition: cfEzgcd.cc:93
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:16

◆ listLength()

int sleftv::listLength ( )

Definition at line 57 of file subexpr.cc.

58 {
59  int n = 1;
60  leftv sl = next;
61  while (sl!=NULL)
62  {
63  n++;
64  sl=sl->next;
65  }
66  return n;
67 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
leftv next
Definition: subexpr.h:86
#define NULL
Definition: omList.c:10

◆ LTyp()

int sleftv::LTyp ( )

Definition at line 1146 of file subexpr.cc.

1147 {
1148  lists l=NULL;
1149  int r;
1150  if (rtyp==LIST_CMD)
1151  l=(lists)data;
1152  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1153  l=IDLIST((idhdl)data);
1154  else
1155  return Typ();
1156  //if (l!=NULL)
1157  {
1158  if ((e!=NULL) && (e->next!=NULL))
1159  {
1160  if ((0<e->start)&&(e->start<=l->nr+1))
1161  {
1162  l->m[e->start-1].e=e->next;
1163  r=l->m[e->start-1].LTyp();
1164  l->m[e->start-1].e=NULL;
1165  }
1166  else
1167  {
1168  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1169  r=NONE;
1170  }
1171  return r;
1172  }
1173  return LIST_CMD;
1174  }
1175  return Typ();
1176 }
#define IDLIST(a)
Definition: ipid.h:132
Subexpr e
Definition: subexpr.h:105
Definition: lists.h:22
int Typ()
Definition: subexpr.cc:1039
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:88
#define IDTYP(a)
Definition: ipid.h:114
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:91
Definition: tok.h:118
#define NONE
Definition: tok.h:219
int l
Definition: cfEzgcd.cc:93

◆ Name()

const char* sleftv::Name ( )
inline

Definition at line 120 of file subexpr.h.

121  {
122  if ((name!=NULL) && (e==NULL)) return name;
123  else return sNoName_fe;
124  }
Subexpr e
Definition: subexpr.h:105
const char sNoName_fe[]
Definition: fevoices.cc:56
const char * name
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10

◆ Next()

leftv sleftv::Next ( )
inline

Definition at line 136 of file subexpr.h.

136 { return next; }
leftv next
Definition: subexpr.h:86

◆ Print()

void sleftv::Print ( leftv  store = NULL,
int  spaces = 0 
)

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

Definition at line 69 of file subexpr.cc.

70 {
71  int t=Typ();
72  if (errorreported) return;
73 #ifdef SIQ
74  if (rtyp==COMMAND)
75  {
76  command c=(command)data;
77  char ch[2];
78  ch[0]=c->op;ch[1]='\0';
79  const char *s=ch;
80  if (c->op>127) s=iiTwoOps(c->op);
81  ::Print("##command %d(%s), %d args\n",
82  c->op, s, c->argc);
83  if (c->argc>0)
84  c->arg1.Print(NULL,spaces+2);
85  if(c->argc<4)
86  {
87  if (c->argc>1)
88  c->arg2.Print(NULL,spaces+2);
89  if (c->argc>2)
90  c->arg3.Print(NULL,spaces+2);
91  }
92  PrintS("##end");
93  }
94  else
95 #endif
96  {
97  const char *n=Name();
98  char *s;
99  void *d=Data();
100  if (errorreported) return;
101 
102  switch (t /*=Typ()*/)
103  {
104  case CRING_CMD:
105  crPrint((coeffs)d);
106  break;
107 #ifdef SINGULAR_4_2
108  case CNUMBER_CMD:
109  n2Print((number2)d);
110  break;
111  case CPOLY_CMD:
112  p2Print((poly2)d);
113  break;
114  case CMATRIX_CMD: // like BIGINTMAT
115 #endif
116  case BIGINTMAT_CMD:
117  ((bigintmat *)d)->pprint(colmax);
118  break;
119  case BUCKET_CMD:
120  {
122  if ((e==NULL)
123  && (TEST_V_QRING)
124  &&(currRing->qideal!=NULL))
125  {
126  poly p=pCopy(sBucketPeek(b));
128  PrintNSpaces(spaces);
129  pWrite0(p);
130  pDelete(&p);
131  break;
132  }
133  else
134  sBucketPrint(b);
135  }
136  break;
137  case UNKNOWN:
138  case DEF_CMD:
139  PrintNSpaces(spaces);
140  PrintS("`");PrintS(n);PrintS("`");
141  break;
142  case PACKAGE_CMD:
143  PrintNSpaces(spaces);
144  paPrint(n,(package)d);
145  break;
146  case LIB_CMD:
147  case NONE:
148  return;
149  case INTVEC_CMD:
150  case INTMAT_CMD:
151  ((intvec *)d)->show(t,spaces);
152  break;
153  case RING_CMD:
154  {
155  PrintNSpaces(spaces);
156  const ring r = (const ring)d;
157  rWrite(r, currRing == r);
158  break;
159  }
160  case MATRIX_CMD:
161  iiWriteMatrix((matrix)d,n,2, currRing, spaces);
162  break;
163  case SMATRIX_CMD:
164  {
166  ipPrint_MA0(m, n);
167  id_Delete((ideal *) &m,currRing);
168  break;
169  }
170  case MODUL_CMD:
171  case IDEAL_CMD:
172  if ((TEST_V_QRING) &&(currRing->qideal!=NULL)
173  &&(!hasFlag(this,FLAG_QRING)))
174  {
175  jjNormalizeQRingId(this);
176  d=Data();
177  }
178  // no break:
179  case MAP_CMD:
180  iiWriteMatrix((matrix)d,n,1, currRing, spaces);
181  break;
182  case POLY_CMD:
183  case VECTOR_CMD:
184  if ((e==NULL)
185  && (TEST_V_QRING)
186  &&(currRing->qideal!=NULL)
187  &&(!hasFlag(this,FLAG_QRING)))
188  {
189  setFlag(this,FLAG_QRING);
190  poly p=(poly)d;
192  if (p!=(poly)d)
193  {
194  d=(void*)p;
195  if ((rtyp==POLY_CMD)||(rtyp==VECTOR_CMD)) data=d;
196  else if (rtyp==IDHDL)
197  {
198  idhdl h=(idhdl)data;
199  IDPOLY(h)=p;
201  }
202  }
203  }
204  PrintNSpaces(spaces);
205  pWrite0((poly)d);
206  break;
207  case RESOLUTION_CMD:
208  {
209  syStrategy tmp=(syStrategy)d;
210  syPrint(tmp,IDID(currRingHdl));
211  break;
212  }
213  case STRING_CMD:
214  PrintNSpaces(spaces);
215  PrintS((char *)d);
216  break;
217  case INT_CMD:
218  PrintNSpaces(spaces);
219  ::Print("%d",(int)(long)d);
220  break;
221  case PROC_CMD:
222  {
224 
225  PrintNSpaces(spaces);
226  PrintS("// libname : ");
227  PrintS(piProcinfo(pi, "libname"));
228  PrintLn();
229 
230  PrintNSpaces(spaces);
231  PrintS("// procname : ");
232  PrintS(piProcinfo(pi, "procname"));
233  PrintLn();
234 
235  PrintNSpaces(spaces);
236  PrintS("// type : ");
237  PrintS(piProcinfo(pi, "type"));
238  // ::Print("%-*.*s// ref : %s",spaces,spaces," ",
239  // piProcinfo(pi, "ref"));
240  break;
241  }
242  case LINK_CMD:
243  {
244  si_link l=(si_link)d;
245  PrintNSpaces(spaces);
246  ::Print("// type : %s\n", slStatus(l, "type"));
247  PrintNSpaces(spaces);
248  ::Print("// mode : %s\n", slStatus(l, "mode"));
249  PrintNSpaces(spaces);
250  ::Print("// name : %s\n", slStatus(l, "name"));
251  PrintNSpaces(spaces);
252  ::Print("// open : %s\n", slStatus(l, "open"));
253  PrintNSpaces(spaces);
254  ::Print("// read : %s\n", slStatus(l, "read"));
255  PrintNSpaces(spaces);
256  ::Print("// write: %s", slStatus(l, "write"));
257  break;
258  }
259  case BIGINT_CMD:
260  s=String(d);
261  if (s==NULL) return;
262  PrintNSpaces(spaces);
263  PrintS(s);
264  omFree((ADDRESS)s);
265  break;
266  case NUMBER_CMD:
267  {
268  number n=(number)d;
269  nNormalize(n);
270  if ((number)d !=n)
271  {
272  d=n;
273  if (rtyp==IDHDL) IDNUMBER(((idhdl)data))=n;
274  else if(rtyp==NUMBER_CMD) data=(void*)n;
275  }
276  s=String(d);
277  if (s==NULL) return;
278  PrintS(s);
279  omFree((ADDRESS)s);
280  break;
281  }
282  case LIST_CMD:
283  {
284  lists l=(lists)d;
285  if (lSize(l)<0)
286  {
287  PrintNSpaces(spaces);
288  PrintS("empty list\n");
289  }
290  else
291  {
292  int i=0;
293  for (;i<=l->nr;i++)
294  {
295  if (l->m[i].rtyp!=DEF_CMD)
296  {
297  PrintNSpaces(spaces);
298  ::Print("[%d]:\n",i+1);
299  l->m[i].Print(NULL,spaces+3);
300  }
301  }
302  }
303  break;
304  }
305 
306  default:
307  if (t>MAX_TOK)
308  {
309  blackbox * bb=getBlackboxStuff(t);
310  PrintNSpaces(spaces);
311  if (bb!=NULL) { bb->blackbox_Print(bb,d); }
312  else { ::Print("Print: blackbox %d(bb=NULL)",t); }
313  }
314  else
315  ::Print("Print:unknown type %s(%d)", Tok2Cmdname(t),t);
316  } /* end switch: (Typ()) */
317  if ((store!=NULL)&&(store!=this))
318  store->CleanUp();
319  }
320  if (next!=NULL)
321  {
322  if (t==COMMAND) PrintLn();
323  else if (t!=LIST_CMD) PrintS(" ");
324  next->Print(NULL,spaces);
325  }
326  else if ((t!=LIST_CMD)&&(t!=SMATRIX_CMD))
327  {
328  PrintLn();
329  }
330 #ifdef SIQ
331  if (rtyp!=COMMAND)
332 #endif
333  {
334  if ((store!=NULL)
335  && (store!=this))
336  {
337  if((t/*Typ()*/!=LINK_CMD)
338  && (t/*Typ()*/!=PACKAGE_CMD)
339  && (t/*Typ()*/!=DEF_CMD)
340  )
341  {
342  store->rtyp=t/*Typ()*/;
343  store->data=CopyD();
344  if(attribute!=NULL)
345  {
346  store->attribute=CopyA();
347  }
348  store->flag=flag;
349  }
350  }
351  }
352 }
ip_package * package
Definition: structs.h:46
const CanonicalForm int s
Definition: facAbsFact.cc:55
void jjNormalizeQRingP(poly &p)
Definition: ipassign.cc:2202
ip_command * command
Definition: ipid.h:22
Definition: tok.h:48
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
Definition: tok.h:96
Subexpr e
Definition: subexpr.h:105
BITSET flag
Definition: subexpr.h:90
Definition: lists.h:22
#define nNormalize(n)
Definition: numbers.h:31
#define IDID(a)
Definition: ipid.h:117
Definition: tok.h:38
ideal id_Copy(ideal h1, const ring r)
copy an ideal
Matrices of numbers.
Definition: bigintmat.h:51
Definition: tok.h:216
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
void sBucketPrint(sBucket_pt bucket)
Definition: sbuckets.cc:466
#define UNKNOWN
Definition: tok.h:220
void * ADDRESS
Definition: auxiliary.h:133
void * CopyD()
Definition: subexpr.h:119
void syPrint(syStrategy syzstr, const char *currRingName)
Definition: syz1.cc:1935
int Typ()
Definition: subexpr.cc:1039
void pWrite0(poly p)
Definition: polys.h:303
const char * Name()
Definition: subexpr.h:120
void Print(leftv store=NULL, int spaces=0)
Called by type_cmd (e.g. "r;") or as default in jPRINT.
Definition: subexpr.cc:69
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
Definition: matpol.cc:837
char * String(void *d=NULL, BOOLEAN typed=FALSE, int dim=1)
Called for conversion to string (used by string(..), write(..),..)
Definition: subexpr.cc:789
void * data
Definition: subexpr.h:88
CanonicalForm b
Definition: cfModGcd.cc:4044
Definition: tok.h:56
Definition: intvec.h:17
const char * iiTwoOps(int t)
Definition: gentable.cc:261
const char * piProcinfo(procinfov pi, const char *request)
Definition: ipid.cc:642
Definition: tok.h:58
#define omFree(addr)
Definition: omAllocDecl.h:261
The main handler for Singular numbers which are suitable for Singular polynomials.
sBucket * sBucket_pt
Definition: sbuckets.h:16
attr CopyA()
Definition: subexpr.cc:781
void ipPrint_MA0(matrix m, const char *name)
Definition: ipprint.cc:58
idhdl currRingHdl
Definition: ipid.cc:61
#define setFlag(A, F)
Definition: ipid.h:108
int m
Definition: cfEzgcd.cc:121
idrec * idhdl
Definition: ring.h:22
#define FLAG_QRING
Definition: ipid.h:106
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
#define TEST_V_QRING
Definition: options.h:129
matrix id_Module2Matrix(ideal mod, const ring R)
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:227
int lSize(lists L)
Definition: lists.cc:25
short errorreported
Definition: feFopen.cc:23
leftv next
Definition: subexpr.h:86
#define IDNUMBER(a)
Definition: ipid.h:127
void paPrint(const char *n, package p)
Definition: ipshell.cc:6316
#define pi
Definition: libparse.cc:1143
void jjNormalizeQRingId(leftv I)
Definition: ipassign.cc:2167
Definition: tok.h:117
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:140
#define IDPOLY(a)
Definition: ipid.h:125
#define hasFlag(A, F)
Definition: ipid.h:107
#define pDelete(p_ptr)
Definition: polys.h:181
int rtyp
Definition: subexpr.h:91
void CleanUp(ring r=currRing)
Definition: subexpr.cc:354
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void * Data()
Definition: subexpr.cc:1182
poly sBucketPeek(sBucket_pt b)
Definition: sbuckets.cc:455
Definition: tok.h:118
attr attribute
Definition: subexpr.h:89
int p
Definition: cfModGcd.cc:4019
int colmax
Definition: febase.cc:37
static Poly * h
Definition: janet.cc:972
#define NONE
Definition: tok.h:219
void PrintNSpaces(const int n)
Definition: reporter.cc:364
int l
Definition: cfEzgcd.cc:93
procinfo * procinfov
Definition: structs.h:63
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180
#define COMMAND
Definition: tok.h:29
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:16
ssyStrategy * syStrategy
Definition: syz.h:35

◆ RingDependend()

BOOLEAN sleftv::RingDependend ( )

Definition at line 424 of file subexpr.cc.

425 {
426  int rt=Typ();
427  if(::RingDependend(rt))
428  return TRUE;
429  if (rt==LIST_CMD)
430  return lRingDependend((lists)Data());
431  if (this->next!=NULL)
432  return this->next->RingDependend();
433  return FALSE;
434 }
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int Typ()
Definition: subexpr.cc:1039
BOOLEAN RingDependend()
Definition: subexpr.cc:424
leftv next
Definition: subexpr.h:86
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1182
Definition: tok.h:118
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199

◆ String()

char * sleftv::String ( void *  d = NULL,
BOOLEAN  typed = FALSE,
int  dim = 1 
)

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

Definition at line 789 of file subexpr.cc.

790 {
791 #ifdef SIQ
792  if (rtyp==COMMAND)
793  {
794  ::Print("##command %d\n",((command)data)->op);
795  if (((command)data)->arg1.rtyp!=0)
796  ((command)data)->arg1.Print(NULL,2);
797  if (((command)data)->arg2.rtyp!=0)
798  ((command)data)->arg2.Print(NULL,2);
799  if (((command)data)->arg3.rtyp==0)
800  ((command)data)->arg3.Print(NULL,2);
801  PrintS("##end\n");
802  return omStrDup("");
803  }
804 #endif
805  if (d==NULL) d=Data();
806  if (!errorreported)
807  {
808  char *s;
809  int t=Typ();
810  switch (t /*Typ()*/)
811  {
812  case INT_CMD:
813  if (typed)
814  {
815  s=(char *)omAlloc(MAX_INT_LEN+7);
816  sprintf(s,"int(%d)",(int)(long)d);
817  }
818  else
819  {
820  s=(char *)omAlloc(MAX_INT_LEN+2);
821  sprintf(s,"%d",(int)(long)d);
822  }
823  return s;
824 
825  case STRING_CMD:
826  if (d == NULL)
827  {
828  if (typed) return omStrDup("\"\"");
829  return omStrDup("");
830  }
831  if (typed)
832  {
833  s = (char*) omAlloc(strlen((char*) d) + 3);
834  sprintf(s,"\"%s\"", (char*) d);
835  return s;
836  }
837  else
838  {
839  return omStrDup((char*)d);
840  }
841 
842  case POLY_CMD:
843  case VECTOR_CMD:
844  if (typed)
845  {
846  char* ps = pString((poly) d);
847  s = (char*) omAlloc(strlen(ps) + 10);
848  sprintf(s,"%s(%s)", (t /*Typ()*/ == POLY_CMD ? "poly" : "vector"), ps);
849  omFree(ps);
850  return s;
851  }
852  else
853  return pString((poly)d);
854 
855  case CRING_CMD:
856  return nCoeffString((coeffs)d);
857  #ifdef SINGULAR_4_2
858  case CNUMBER_CMD:
859  return n2String((number2)d,typed);
860  case CMATRIX_CMD:
861  {
862  bigintmat *b=(bigintmat*)d;
863  return b->String();
864  }
865  #endif
866 
867  case NUMBER_CMD:
868  StringSetS((char*) (typed ? "number(" : ""));
870  {
871  nfShowMipo(currRing->cf);
872  }
873  else
874  {
875  nWrite((number)d);
876  }
877  StringAppendS((char*) (typed ? ")" : ""));
878  return StringEndS();
879 
880  case BIGINT_CMD:
881  {
882  StringSetS((char*) (typed ? "bigint(" : ""));
883  number nl=(number)d;
885  StringAppendS((char*) (typed ? ")" : ""));
886  return StringEndS();
887  }
888  case BUCKET_CMD:
889  return sBucketString((sBucket_pt)d);
890  case MATRIX_CMD:
892  if (typed)
893  {
894  char* ns = (char*) omAlloc(strlen(s) + 40);
895  sprintf(ns, "matrix(ideal(%s),%d,%d)", s,
896  ((ideal) d)->nrows, ((ideal) d)->ncols);
897  omCheckAddr(ns);
898  return ns;
899  }
900  else
901  {
902  return omStrDup(s);
903  }
904 
905  case IDEAL_CMD:
906  case MAP_CMD:
907  case MODUL_CMD:
908  case SMATRIX_CMD:
910  if (typed)
911  {
912  char* ns = (char*) omAlloc(strlen(s) + 10);
913  if ((t/*Typ()*/==IDEAL_CMD)||(t==MAP_CMD))
914  sprintf(ns, "ideal(%s)", s);
915  else /*MODUL_CMD, SMATRIX_CMD */
916  sprintf(ns, "module(%s)", s);
917  omFree(s);
918  omCheckAddr(ns);
919  return ns;
920  }
921  return s;
922 
923  case INTVEC_CMD:
924  case INTMAT_CMD:
925  {
926  intvec *v=(intvec *)d;
927  s = v->String(dim);
928  if (typed)
929  {
930  char* ns;
931  if (t/*Typ()*/ == INTMAT_CMD)
932  {
933  ns = (char*) omAlloc(strlen(s) + 40);
934  sprintf(ns, "intmat(intvec(%s),%d,%d)", s, v->rows(), v->cols());
935  }
936  else
937  {
938  ns = (char*) omAlloc(strlen(s) + 10);
939  sprintf(ns, "intvec(%s)", s);
940  }
941  omCheckAddr(ns);
942  omFree(s);
943  return ns;
944  }
945  else
946  return s;
947  }
948  case BIGINTMAT_CMD:
949  {
950  bigintmat *bim=(bigintmat*)d;
951  s = bim->String();
952  if (typed)
953  {
954  char* ns = (char*) omAlloc0(strlen(s) + 40);
955  sprintf(ns, "bigintmat(bigintvec(%s),%d,%d)", s, bim->rows(), bim->cols());
956  omCheckAddr(ns);
957  return ns;
958  }
959  else
960  return omStrDup(s);
961  }
962 
963  case RING_CMD:
964  s = rString((ring)d);
965 
966  if (typed)
967  {
968  char* ns;
969  ring r=(ring)d;
970  if (r->qideal!=NULL)
971  {
972  char* id = iiStringMatrix((matrix) ((ring) d)->qideal, dim,
973  currRing);
974  ns = (char*) omAlloc(strlen(s) + strlen(id) + 20);
975  sprintf(ns, "\"%s\";%sideal(%s)", s,(dim == 2 ? "\n" : " "), id);
976  }
977  else
978  {
979  ns = (char*) omAlloc(strlen(s) + 4);
980  sprintf(ns, "\"%s\"", s);
981  }
982  omFree(s);
983  omCheckAddr(ns);
984  return ns;
985  }
986  return s;
987  case RESOLUTION_CMD:
988  {
989  lists l = syConvRes((syStrategy)d);
990  s = lString(l, typed, dim);
991  l->Clean();
992  return s;
993  }
994 
995  case PROC_CMD:
996  {
997  procinfo* pi = (procinfo*) d;
998  if((pi->language == LANG_SINGULAR) && (pi->data.s.body!=NULL))
999  s = (pi->data.s.body);
1000  else
1001  s = (char *)"";
1002  if (typed)
1003  {
1004  char* ns = (char*) omAlloc(strlen(s) + 4);
1005  sprintf(ns, "\"%s\"", s);
1006  omCheckAddr(ns);
1007  return ns;
1008  }
1009  return omStrDup(s);
1010  }
1011 
1012  case LINK_CMD:
1013  s = slString((si_link) d);
1014  if (typed)
1015  {
1016  char* ns = (char*) omAlloc(strlen(s) + 10);
1017  sprintf(ns, "link(\"%s\")", s);
1018  omFreeBinAddr(s);
1019  omCheckAddr(ns);
1020  return ns;
1021  }
1022  return s;
1023 
1024  case LIST_CMD:
1025  return lString((lists) d, typed, dim);
1026 
1027  default:
1028  if(t> MAX_TOK)
1029  {
1030  blackbox *bb=getBlackboxStuff(t);
1031  if (bb!=NULL) return bb->blackbox_String(bb,d);
1032  }
1033  } /* end switch: (Typ()) */
1034  }
1035  return omStrDup("");
1036 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
char * pString(poly p)
Definition: polys.h:300
#define nWrite(n)
Definition: numbers.h:30
ip_command * command
Definition: ipid.h:22
Definition: tok.h:96
Definition: lists.h:22
Definition: tok.h:38
Matrices of numbers.
Definition: bigintmat.h:51
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:3153
char * rString(ring r)
Definition: ring.cc:646
int rows() const
Definition: bigintmat.h:146
Definition: tok.h:216
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:512
char * StringEndS()
Definition: reporter.cc:151
char * lString(lists l, BOOLEAN typed, int dim)
Definition: lists.cc:380
const int MAX_INT_LEN
Definition: mylimits.h:13
coeffs coeffs_BIGINT
Definition: ipid.cc:52
int Typ()
Definition: subexpr.cc:1039
#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:69
void * data
Definition: subexpr.h:88
void nfShowMipo(const coeffs r)
Show the mininimal polynom.... NOTE: this is used by char * sleftv::String(void *d,...
Definition: ffields.cc:551
CanonicalForm b
Definition: cfModGcd.cc:4044
Definition: tok.h:56
Definition: intvec.h:17
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
#define omFree(addr)
Definition: omAllocDecl.h:261
The main handler for Singular numbers which are suitable for Singular polynomials.
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
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition: coeffs.h:591
int cols() const
Definition: bigintmat.h:145
int dim(ideal I, ring r)
void PrintS(const char *s)
Definition: reporter.cc:284
short errorreported
Definition: feFopen.cc:23
#define pi
Definition: libparse.cc:1143
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
Definition: tok.h:117
#define NULL
Definition: omList.c:10
char * String()
IO: String returns a singular string containing the matrix, needs freeing afterwards.
Definition: bigintmat.cc:436
int int ncols
Definition: cf_linsys.cc:32
char * sBucketString(sBucket_pt bucket)
Definition: sbuckets.cc:461
int rtyp
Definition: subexpr.h:91
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void * Data()
Definition: subexpr.cc:1182
Definition: tok.h:118
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
static FORCE_INLINE char * nCoeffString(const coeffs cf)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
Definition: coeffs.h:981
char * iiStringMatrix(matrix im, int dim, const ring r, char ch)
Definition: matpol.cc:858
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:93
#define COMMAND
Definition: tok.h:29
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:16
#define omStrDup(s)
Definition: omAllocDecl.h:263

◆ Typ()

int sleftv::Typ ( )

Definition at line 1039 of file subexpr.cc.

1040 {
1041  if (e==NULL)
1042  {
1043  switch (rtyp)
1044  {
1045  case IDHDL:
1046  return IDTYP((idhdl)data);
1047  case ALIAS_CMD:
1048  {
1049  idhdl h=(idhdl)data;
1050  return ((idhdl)h->data.ustring)->typ;
1051  }
1052  case VECHO:
1053  case VPRINTLEVEL:
1054  case VCOLMAX:
1055  case VTIMER:
1056  case VRTIMER:
1057  case VOICE:
1058  case VMAXDEG:
1059  case VMAXMULT:
1060  case TRACE:
1061  case VSHORTOUT:
1062  return INT_CMD;
1063  case VMINPOLY:
1064  data=NULL;
1065  return NUMBER_CMD;
1066  case VNOETHER:
1067  data=NULL;
1068  return POLY_CMD;
1069  //case COMMAND:
1070  // return COMMAND;
1071  default:
1072  return rtyp;
1073  }
1074  }
1075  int r=0;
1076  int t=rtyp;
1077  void *d=data;
1078  if (t==IDHDL) t=IDTYP((idhdl)d);
1079  else if (t==ALIAS_CMD)
1080  { idhdl h=(idhdl)IDDATA((idhdl)data); t=IDTYP(h);d=IDDATA(h); }
1081  switch (t)
1082  {
1083 #ifdef SINGULAR_4_2
1084  case CMATRIX_CMD:
1085  {
1086  bigintmat *b=(bigintmat*)d;
1087  if ((currRing!=NULL)&&(currRing->cf==b->basecoeffs()))
1088  return NUMBER_CMD;
1089  else
1090  return CNUMBER_CMD;
1091  }
1092 #endif
1093  case INTVEC_CMD:
1094  case INTMAT_CMD:
1095  r=INT_CMD;
1096  break;
1097  case BIGINTMAT_CMD:
1098  r=BIGINT_CMD;
1099  break;
1100  case IDEAL_CMD:
1101  case MATRIX_CMD:
1102  case MAP_CMD:
1103  case SMATRIX_CMD:
1104  r=POLY_CMD;
1105  break;
1106  case MODUL_CMD:
1107  r=VECTOR_CMD;
1108  break;
1109  case STRING_CMD:
1110  r=STRING_CMD;
1111  break;
1112  default:
1113  {
1114  blackbox *b=NULL;
1115  if (t>MAX_TOK)
1116  {
1117  b=getBlackboxStuff(t);
1118  }
1119  if ((t==LIST_CMD)||((b!=NULL)&&BB_LIKE_LIST(b)))
1120  {
1121  lists l;
1122  if (rtyp==IDHDL) l=IDLIST((idhdl)d);
1123  else l=(lists)d;
1124  if ((0<e->start)&&(e->start<=l->nr+1))
1125  {
1126  Subexpr tmp=l->m[e->start-1].e;
1127  l->m[e->start-1].e=e->next;
1128  r=l->m[e->start-1].Typ();
1129  e->next=l->m[e->start-1].e;
1130  l->m[e->start-1].e=tmp;
1131  }
1132  else
1133  {
1134  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1135  r=DEF_CMD;
1136  }
1137  }
1138  else
1139  Werror("cannot index type %s(%d)",Tok2Cmdname(t),t);
1140  break;
1141  }
1142  }
1143  return r;
1144 }
#define IDLIST(a)
Definition: ipid.h:132
Definition: tok.h:210
Definition: tok.h:206
Definition: tok.h:96
Definition: tok.h:207
Subexpr e
Definition: subexpr.h:105
Definition: lists.h:22
Definition: tok.h:38
Matrices of numbers.
Definition: bigintmat.h:51
Definition: tok.h:216
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:88
#define IDTYP(a)
Definition: ipid.h:114
Definition: tok.h:211
CanonicalForm b
Definition: cfModGcd.cc:4044
Definition: tok.h:58
idrec * idhdl
Definition: ring.h:22
Definition: tok.h:209
Definition: tok.h:34
Definition: tok.h:212
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:140
int rtyp
Definition: subexpr.h:91
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
Definition: tok.h:118
#define IDDATA(a)
Definition: ipid.h:121
Definition: tok.h:208
static Poly * h
Definition: janet.cc:972
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int l
Definition: cfEzgcd.cc:93
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:16

Field Documentation

◆ attribute

attr sleftv::attribute

Definition at line 89 of file subexpr.h.

◆ data

void* sleftv::data

Definition at line 88 of file subexpr.h.

◆ e

Subexpr sleftv::e

Definition at line 105 of file subexpr.h.

◆ flag

BITSET sleftv::flag

Definition at line 90 of file subexpr.h.

◆ name

const char* sleftv::name

Definition at line 87 of file subexpr.h.

◆ next

leftv sleftv::next

Definition at line 86 of file subexpr.h.

◆ req_packhdl

package sleftv::req_packhdl

Definition at line 106 of file subexpr.h.

◆ rtyp

int sleftv::rtyp

Definition at line 91 of file subexpr.h.


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