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 1389 of file subexpr.cc.

1390 {
1391  if (e==NULL) return &attribute;
1392  if ((rtyp==LIST_CMD)
1393  ||((rtyp==IDHDL)&&(IDTYP((idhdl)data)==LIST_CMD))
1394  || (rtyp>MAX_TOK)
1395  || ((rtyp==IDHDL)&&(IDTYP((idhdl)data)>MAX_TOK)))
1396  {
1397  leftv v=LData();
1398  return &(v->attribute);
1399  }
1400  return NULL;
1401 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
Subexpr e
Definition: subexpr.h:105
Definition: tok.h:215
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:1403

◆ CleanUp()

void sleftv::CleanUp ( ring  r = currRing)

Definition at line 328 of file subexpr.cc.

329 {
330  if (rtyp!=IDHDL)
331  {
332  if ((name!=NULL) && (name!=sNoName_fe) && (rtyp!=ALIAS_CMD))
333  {
334  //::Print("free %x (%s)\n",name,name);
335  omFree((ADDRESS)name); // may be larger >1000 char (large int)
336  }
337  //name=NULL;
338  //flag=0;
339  if (data!=NULL)
340  {
341  //if (rtyp==IDHDL) attribute=NULL; // is only a pointer to attribute of id
343  //data=NULL; // will be done by Init() at the end
344  }
345  if (attribute!=NULL)
346  {
347  switch (rtyp)
348  {
349  case PACKAGE_CMD:
350  //case IDHDL:
351  case ANY_TYPE:
352  case VECHO:
353  case VPRINTLEVEL:
354  case VCOLMAX:
355  case VTIMER:
356  case VRTIMER:
357  case VOICE:
358  case VMAXDEG:
359  case VMAXMULT:
360  case TRACE:
361  case VSHORTOUT:
362  case VNOETHER:
363  case VMINPOLY:
364  case 0:
365  //attribute=NULL; // will be done by Init() at the end
366  break;
367  default:
368  {
369  attribute->killAll(r);
370  }
371  }
372  }
373  }
374  Subexpr h;
375  while (e!=NULL)
376  {
377  h=e->next;
379  e=h;
380  }
381  //rtyp=NONE; // will be done by Init() at the end
382  if (next!=NULL)
383  {
384  leftv tmp_n;
385  do
386  {
387  tmp_n=next->next;
388  //next->name=NULL;
389  next->next=NULL;
390  next->CleanUp(r);
392  next=tmp_n;
393  } while (next!=NULL);
394  }
395  Init();
396 }
Definition: tok.h:209
Definition: tok.h:205
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
#define ANY_TYPE
Definition: tok.h:30
Definition: tok.h:206
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:46
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:210
const char * name
Definition: subexpr.h:87
#define omFree(addr)
Definition: omAllocDecl.h:261
omBin sSubexpr_bin
Definition: subexpr.cc:45
void s_internalDelete(const int t, void *d, const ring r)
Definition: subexpr.cc:491
Definition: tok.h:208
leftv next
Definition: subexpr.h:86
Definition: tok.h:34
Definition: tok.h:211
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void CleanUp(ring r=currRing)
Definition: subexpr.cc:328
attr attribute
Definition: subexpr.h:89
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
Definition: tok.h:207
static Poly * h
Definition: janet.cc:972

◆ Copy()

void sleftv::Copy ( leftv  e)

Definition at line 684 of file subexpr.cc.

685 {
686  Init();
687  rtyp=source->Typ();
688  void *d=source->Data();
689  if(!errorreported)
690  {
692  if ((source->attribute!=NULL)||(source->e!=NULL))
693  attribute=source->CopyA();
694  flag=source->flag;
695  if (source->next!=NULL)
696  {
698  next->Copy(source->next);
699  }
700  }
701 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
BITSET flag
Definition: subexpr.h:90
omBin sleftv_bin
Definition: subexpr.cc:46
void Init()
Definition: subexpr.h:107
sleftv * leftv
Definition: structs.h:60
void * data
Definition: subexpr.h:88
void * CopyA()
Definition: subexpr.cc:1944
void Copy(leftv e)
Definition: subexpr.cc:684
static void * s_internalCopy(const int t, void *d)
Definition: subexpr.cc:410
short errorreported
Definition: feFopen.cc:23
leftv next
Definition: subexpr.h:86
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
attr attribute
Definition: subexpr.h:89

◆ CopyA()

attr sleftv::CopyA ( )

Definition at line 739 of file subexpr.cc.

740 {
741  attr *a=Attribute();
742  if ((a!=NULL) && (*a!=NULL))
743  return (*a)->Copy();
744  return NULL;
745 }
Definition: attrib.h:17
attr * Attribute()
Definition: subexpr.cc:1389
#define NULL
Definition: omList.c:10

◆ CopyD() [1/2]

void * sleftv::CopyD ( int  t)

Definition at line 703 of file subexpr.cc.

704 {
705  if ((rtyp!=IDHDL)&&(rtyp!=ALIAS_CMD)&&(e==NULL))
706  {
707  if (iiCheckRing(t)) return NULL;
708  void *x = data;
709  if (rtyp==VNOETHER) x = (void *)pCopy((currRing->ppNoether));
710  else if ((rtyp==VMINPOLY) && nCoeff_is_algExt(currRing->cf) && (!nCoeff_is_GF(currRing->cf)))
711  {
712  const ring A = currRing->cf->extRing;
713 
714  assume( A != NULL );
715  assume( A->qideal != NULL );
716 
717  x=(void *)p_Copy(A->qideal->m[0], A);
718  }
719  data=NULL;
720  return x;
721  }
722  void *d=Data(); // will also do a iiCheckRing
723  if ((!errorreported) && (d!=NULL)) return slInternalCopy(this,t,d,e);
724  return NULL;
725 }
void * slInternalCopy(leftv source, const int t, void *d, Subexpr e)
Definition: subexpr.cc:655
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:812
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:924
#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:853
short errorreported
Definition: feFopen.cc:23
Definition: tok.h:34
BOOLEAN iiCheckRing(int i)
Definition: ipshell.cc:1492
#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:1134
#define pCopy(p)
return a copy of the poly
Definition: polys.h:172

◆ 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:992

◆ Data()

void * sleftv::Data ( )

Definition at line 1134 of file subexpr.cc.

1135 {
1136  if ((rtyp!=IDHDL) && iiCheckRing(rtyp))
1137  return NULL;
1138  if (e==NULL)
1139  {
1140  switch (rtyp)
1141  {
1142  case ALIAS_CMD:
1143  {
1144  idhdl h=(idhdl)data;
1145  return ((idhdl)h->data.ustring)->data.ustring;
1146  }
1147  case VECHO: return (void *)(long)si_echo;
1148  case VPRINTLEVEL:return (void *)(long)printlevel;
1149  case VCOLMAX: return (void *)(long)colmax;
1150  case VTIMER: return (void *)(long)getTimer();
1151  case VRTIMER: return (void *)(long)getRTimer();
1152  case VOICE: return (void *)(long)(myynest+1);
1153  case VMAXDEG: return (void *)(long)Kstd1_deg;
1154  case VMAXMULT: return (void *)(long)Kstd1_mu;
1155  case TRACE: return (void *)(long)traceit;
1156  case VSHORTOUT: return (void *)(long)(currRing != NULL ? currRing->ShortOut : 0);
1157  case VMINPOLY:
1158  if ( (currRing != NULL) && nCoeff_is_algExt(currRing->cf) && !nCoeff_is_GF(currRing->cf))
1159  {
1160  /* Q(a), Fp(a), but not GF(q) */
1161  const ring A = currRing->cf->extRing;
1162 
1163  assume( A != NULL );
1164  assume( A->qideal != NULL );
1165 
1166  return (void *)A->qideal->m[0];
1167  }
1168  else
1169  return (void *)nInit(0);
1170 
1171  case VNOETHER: return (void *) (currRing->ppNoether);
1172  case IDHDL:
1173  return IDDATA((idhdl)data);
1174  case COMMAND:
1175  //return NULL;
1176  default:
1177  return data;
1178  }
1179  }
1180  /* e != NULL : */
1181  int t=rtyp;
1182  void *d=data;
1183  if (t==IDHDL)
1184  {
1185  t=((idhdl)data)->typ;
1186  d=IDDATA((idhdl)data);
1187  }
1188  else if (t==ALIAS_CMD)
1189  {
1190  idhdl h=(idhdl)IDDATA((idhdl)data);
1191  t=IDTYP(h);
1192  d=IDDATA(h);
1193  }
1194  if (iiCheckRing(t))
1195  return NULL;
1196  char *r=NULL;
1197  int index=e->start;
1198  switch (t)
1199  {
1200  case INTVEC_CMD:
1201  {
1202  intvec *iv=(intvec *)d;
1203  if ((index<1)||(index>iv->length()))
1204  {
1205  if (!errorreported)
1206  Werror("wrong range[%d] in intvec %s(%d)",index,this->Name(),iv->length());
1207  }
1208  else
1209  r=(char *)(long)((*iv)[index-1]);
1210  break;
1211  }
1212  case INTMAT_CMD:
1213  {
1214  intvec *iv=(intvec *)d;
1215  if ((index<1)
1216  ||(index>iv->rows())
1217  ||(e->next->start<1)
1218  ||(e->next->start>iv->cols()))
1219  {
1220  if (!errorreported)
1221  Werror("wrong range[%d,%d] in intmat %s(%dx%d)",index,e->next->start,
1222  this->Name(),iv->rows(),iv->cols());
1223  }
1224  else
1225  r=(char *)(long)(IMATELEM((*iv),index,e->next->start));
1226  break;
1227  }
1228  case BIGINTMAT_CMD:
1229  {
1230  bigintmat *m=(bigintmat *)d;
1231  if ((index<1)
1232  ||(index>m->rows())
1233  ||(e->next->start<1)
1234  ||(e->next->start>m->cols()))
1235  {
1236  if (!errorreported)
1237  Werror("wrong range[%d,%d] in bigintmat %s(%dx%d)",index,e->next->start,
1238  this->Name(),m->rows(),m->cols());
1239  }
1240  else
1241  r=(char *)(BIMATELEM((*m),index,e->next->start));
1242  break;
1243  }
1244 #ifdef SINGULAR_4_2
1245  case CMATRIX_CMD:
1246  {
1247  bigintmat *m=(bigintmat *)d;
1248  if ((index<1)
1249  ||(index>m->rows())
1250  ||(e->next->start<1)
1251  ||(e->next->start>m->cols()))
1252  {
1253  if (!errorreported)
1254  Werror("wrong range[%d,%d] in matrix %s(%dx%d)",index,e->next->start,
1255  this->Name(),m->rows(),m->cols());
1256  }
1257  else
1258  {
1259  iiNumber2Data[iiCmatrix_index].cf=m->basecoeffs();
1260  iiNumber2Data[iiCmatrix_index].n=BIMATELEM((*m),index,e->next->start);
1261  r=(char*)&iiNumber2Data[iiCmatrix_index];
1262  iiCmatrix_index=(iiCmatrix_index+1) % 4;
1263  }
1264  break;
1265  }
1266 #endif
1267  case IDEAL_CMD:
1268  case MODUL_CMD:
1269  case MAP_CMD:
1270  {
1271  ideal I=(ideal)d;
1272  if ((index<1)||(index>IDELEMS(I)))
1273  {
1274  if (!errorreported)
1275  Werror("wrong range[%d] in ideal/module %s(%d)",index,this->Name(),IDELEMS(I));
1276  }
1277  else
1278  r=(char *)I->m[index-1];
1279  break;
1280  }
1281  case STRING_CMD:
1282  {
1283  // this was a memory leak
1284  // we evalute it, cleanup and replace this leftv by it's evalutated form
1285  // the evalutated form will be build in tmp
1286  sleftv tmp;
1287  tmp.Init();
1288  tmp.rtyp=STRING_CMD;
1289  r=(char *)omAllocBin(size_two_bin);
1290  if ((index>0)&& (index<=(int)strlen((char *)d)))
1291  {
1292  r[0]=*(((char *)d)+index-1);
1293  r[1]='\0';
1294  }
1295  else
1296  {
1297  r[0]='\0';
1298  }
1299  tmp.data=r;
1300  if ((rtyp==IDHDL)||(rtyp==STRING_CMD))
1301  {
1302  tmp.next=next; next=NULL;
1303  //if (rtyp==STRING_CMD) { omFree((ADDRESS)data); }
1304  //data=NULL;
1305  d=NULL;
1306  CleanUp();
1307  memcpy(this,&tmp,sizeof(tmp));
1308  }
1309  // and, remember, r is also the result...
1310  else
1311  {
1312  // ???
1313  // here we still have a memory leak...
1314  // example: list L="123","456";
1315  // L[1][2];
1316  // therefore, it should never happen:
1317  assume(0);
1318  // but if it happens: here is the temporary fix:
1319  // omMarkAsStaticAddr(r);
1320  }
1321  break;
1322  }
1323  case MATRIX_CMD:
1324  {
1325  if ((index<1)
1326  ||(index>MATROWS((matrix)d))
1327  ||(e->next->start<1)
1328  ||(e->next->start>MATCOLS((matrix)d)))
1329  {
1330  if (!errorreported)
1331  Werror("wrong range[%d,%d] in matrix %s(%dx%d)",
1332  index,e->next->start,
1333  this->Name(),
1334  MATROWS((matrix)d),MATCOLS((matrix)d));
1335  }
1336  else
1337  r=(char *)MATELEM((matrix)d,index,e->next->start);
1338  break;
1339  }
1340  default:
1341  {
1342  blackbox *b=NULL;
1343  if (t>MAX_TOK)
1344  {
1345  b=getBlackboxStuff(t);
1346  }
1347  if ((t==LIST_CMD)||((b!=NULL)&&(BB_LIKE_LIST(b))))
1348  {
1349  lists l=(lists)d;
1350  if ((0<index)&&(index<=l->nr+1))
1351  {
1352  if ((e->next!=NULL)
1353  && (l->m[index-1].rtyp==STRING_CMD))
1354  // string[..].Data() modifies sleftv, so let's do it ourself
1355  {
1356  char *dd=(char *)l->m[index-1].data;
1357  int j=e->next->start-1;
1358  r=(char *)omAllocBin(size_two_bin);
1359  if ((j>=0) && (j<(int)strlen(dd)))
1360  {
1361  r[0]=*(dd+j);
1362  r[1]='\0';
1363  }
1364  else
1365  {
1366  r[0]='\0';
1367  }
1368  }
1369  else
1370  {
1371  Subexpr tmp=l->m[index-1].e;
1372  l->m[index-1].e=e->next;
1373  r=(char *)l->m[index-1].Data();
1374  e->next=l->m[index-1].e;
1375  l->m[index-1].e=tmp;
1376  }
1377  }
1378  else //if (!errorreported)
1379  Werror("wrong range[%d] in list %s(%d)",index,this->Name(),l->nr+1);
1380  }
1381  else
1382  Werror("cannot index %s of type %s(%d)",this->Name(),Tok2Cmdname(t),t);
1383  break;
1384  }
1385  }
1386  return r;
1387 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
Definition: tok.h:209
Definition: tok.h:205
sleftv * m
Definition: lists.h:45
int j
Definition: facHensel.cc:105
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
Definition: tok.h:206
Subexpr e
Definition: subexpr.h:105
Definition: lists.h:22
int getRTimer()
Definition: timer.cc:172
Matrices of numbers.
Definition: bigintmat.h:51
int rows() const
Definition: bigintmat.h:146
Definition: tok.h:215
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
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:210
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:924
Definition: intvec.h:17
#define assume(x)
Definition: mod2.h:390
#define A
Definition: sirandom.c:23
int cols() const
Definition: bigintmat.h:145
int m
Definition: cfEzgcd.cc:121
idrec * idhdl
Definition: ring.h:21
Definition: tok.h:208
#define IDELEMS(i)
Definition: simpleideals.h:24
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:853
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:1492
Definition: tok.h:211
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:138
coeffs basecoeffs() const
Definition: bigintmat.h:147
int cols() const
Definition: intvec.h:93
int rtyp
Definition: subexpr.h:91
void CleanUp(ring r=currRing)
Definition: subexpr.cc:328
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:1134
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:207
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:49
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
utypes data
Definition: idrec.h:40

◆ Eval()

int sleftv::Eval ( )

Definition at line 1752 of file subexpr.cc.

1753 {
1754  BOOLEAN nok=FALSE;
1755  leftv nn=next;
1756  next=NULL;
1757  if(rtyp==IDHDL)
1758  {
1759  int t=Typ();
1760  if (t!=PROC_CMD)
1761  {
1762  void *d=CopyD(t);
1763  data=d;
1764  rtyp=t;
1765  name=NULL;
1766  e=NULL;
1767  }
1768  }
1769  else if (rtyp==COMMAND)
1770  {
1771  command d=(command)data;
1772  if(d->op==PROC_CMD) //assume d->argc==2
1773  {
1774  char *what=(char *)(d->arg1.Data());
1775  idhdl h=ggetid(what);
1776  if((h!=NULL)&&(IDTYP(h)==PROC_CMD))
1777  {
1778  nok=d->arg2.Eval();
1779  if(!nok)
1780  {
1781  nok=iiMake_proc(h,req_packhdl,&d->arg2);
1782  this->CleanUp(currRing);
1783  if (!nok)
1784  {
1785  memcpy(this,&iiRETURNEXPR,sizeof(sleftv));
1786  memset(&iiRETURNEXPR,0,sizeof(sleftv));
1787  }
1788  }
1789  }
1790  else nok=TRUE;
1791  }
1792  else if (d->op=='=') //assume d->argc==2
1793  {
1794  if ((d->arg1.rtyp!=IDHDL)&&(d->arg1.rtyp!=DEF_CMD))
1795  {
1796  nok=d->arg1.Eval();
1797  }
1798  if (!nok)
1799  {
1800  const char *n=d->arg1.name;
1801  nok=(n == NULL) || d->arg2.Eval();
1802  if (!nok)
1803  {
1804  int save_typ=d->arg1.rtyp;
1805  omCheckAddr((ADDRESS)n);
1806  if (d->arg1.rtyp!=IDHDL)
1807  syMake(&d->arg1,n);
1808  omCheckAddr((ADDRESS)d->arg1.name);
1809  if (d->arg1.rtyp==IDHDL)
1810  {
1811  n=omStrDup(IDID((idhdl)d->arg1.data));
1812  killhdl((idhdl)d->arg1.data);
1813  d->arg1.Init();
1814  //d->arg1.data=NULL;
1815  d->arg1.name=n;
1816  }
1817  d->arg1.rtyp=DEF_CMD;
1818  sleftv t;
1819  if(save_typ!=PROC_CMD) save_typ=d->arg2.rtyp;
1820  if (::RingDependend(d->arg2.rtyp))
1821  nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&currRing->idroot);
1822  else
1823  nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&IDROOT);
1824  memcpy(&d->arg1,&t,sizeof(sleftv));
1825  omCheckAddr((ADDRESS)d->arg1.name);
1826  nok=nok||iiAssign(&d->arg1,&d->arg2);
1827  omCheckIf(d->arg1.name != NULL, // OB: ????
1828  omCheckAddr((ADDRESS)d->arg1.name));
1829  if (!nok)
1830  {
1831  memset(&d->arg1,0,sizeof(sleftv));
1832  this->CleanUp();
1833  rtyp=NONE;
1834  }
1835  }
1836  }
1837  else nok=TRUE;
1838  }
1839  else
1840  {
1841  sleftv tmp; tmp.Init();
1842  int toktype=iiTokType(d->op);
1843  if ((toktype==CMD_M)
1844  ||( toktype==ROOT_DECL_LIST)
1845  ||( toktype==RING_DECL_LIST))
1846  {
1847  if (d->argc <=3)
1848  {
1849  if (d->argc>=1) nok=d->arg1.Eval();
1850  if ((!nok) && (d->argc>=2))
1851  {
1852  nok=d->arg2.Eval();
1853  d->arg1.next=(leftv)omAllocBin(sleftv_bin);
1854  memcpy(d->arg1.next,&d->arg2,sizeof(sleftv));
1855  d->arg2.Init();
1856  }
1857  if ((!nok) && (d->argc==3))
1858  {
1859  nok=d->arg3.Eval();
1860  d->arg1.next->next=(leftv)omAllocBin(sleftv_bin);
1861  memcpy(d->arg1.next->next,&d->arg3,sizeof(sleftv));
1862  d->arg3.Init();
1863  }
1864  if (d->argc==0)
1865  nok=nok||iiExprArithM(&tmp,NULL,d->op);
1866  else
1867  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1868  }
1869  else
1870  {
1871  nok=d->arg1.Eval();
1872  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1873  }
1874  }
1875  else if (d->argc==1)
1876  {
1877  nok=d->arg1.Eval();
1878  nok=nok||iiExprArith1(&tmp,&d->arg1,d->op);
1879  }
1880  else if(d->argc==2)
1881  {
1882  nok=d->arg1.Eval();
1883  nok=nok||d->arg2.Eval();
1884  nok=nok||iiExprArith2(&tmp,&d->arg1,d->op,&d->arg2);
1885  }
1886  else if(d->argc==3)
1887  {
1888  nok=d->arg1.Eval();
1889  nok=nok||d->arg2.Eval();
1890  nok=nok||d->arg3.Eval();
1891  nok=nok||iiExprArith3(&tmp,d->op,&d->arg1,&d->arg2,&d->arg3);
1892  }
1893  else if(d->argc!=0)
1894  {
1895  nok=d->arg1.Eval();
1896  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1897  }
1898  else // d->argc == 0
1899  {
1900  nok = iiExprArithM(&tmp, NULL, d->op);
1901  }
1902  this->CleanUp();
1903  memcpy(this,&tmp,sizeof(tmp));
1904  }
1905  }
1906  else if (((rtyp==0)||(rtyp==DEF_CMD))
1907  &&(name!=NULL))
1908  {
1909  syMake(this,name);
1910  }
1911 #ifdef MDEBUG
1912  switch(Typ())
1913  {
1914  case NUMBER_CMD:
1915 #ifdef LDEBUG
1916  nTest((number)Data());
1917 #endif
1918  break;
1919  case BIGINT_CMD:
1920 #ifdef LDEBUG
1921  n_Test((number)Data(),coeffs_BIGINT);
1922 #endif
1923  break;
1924  case POLY_CMD:
1925  pTest((poly)Data());
1926  break;
1927  case IDEAL_CMD:
1928  case MODUL_CMD:
1929  case MATRIX_CMD:
1930  {
1931  ideal id=(ideal)Data();
1932  omCheckAddrSize(id,sizeof(*id));
1933  int i=id->ncols*id->nrows-1;
1934  for(;i>=0;i--) pTest(id->m[i]);
1935  }
1936  break;
1937  }
1938 #endif
1939  if (nn!=NULL) nok=nok||nn->Eval();
1940  next=nn;
1941  return nok;
1942 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
idhdl ggetid(const char *n)
Definition: ipid.cc:513
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
int Eval()
Definition: subexpr.cc:1752
ip_command * command
Definition: ipid.h:22
Subexpr e
Definition: subexpr.h:105
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:8267
#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:8480
omBin sleftv_bin
Definition: subexpr.cc:46
#define pTest(p)
Definition: polys.h:401
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:8570
coeffs coeffs_BIGINT
Definition: ipid.cc:52
int Typ()
Definition: subexpr.cc:992
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:398
#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:739
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:1122
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:376
int rtyp
Definition: subexpr.h:91
void CleanUp(ring r=currRing)
Definition: subexpr.cc:328
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:1134
#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:8078
#define NONE
Definition: tok.h:218
void syMake(leftv v, const char *id, package pa)
Definition: subexpr.cc:1497
#define COMMAND
Definition: tok.h:29
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1792
#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 1403 of file subexpr.cc.

1404 {
1405  if (e!=NULL)
1406  {
1407  lists l=NULL;
1408  blackbox *b=getBlackboxStuff(rtyp);
1409 
1410  if ((rtyp==LIST_CMD)
1411  || ((b!=NULL)&&(BB_LIKE_LIST(b))))
1412  l=(lists)data;
1413  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1414  l=IDLIST((idhdl)data);
1415  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)>MAX_TOK))
1416  {
1417  b=getBlackboxStuff(IDTYP((idhdl)data));
1418  if (BB_LIKE_LIST(b)) l=IDLIST((idhdl)data);
1419  }
1420  else if (rtyp==ALIAS_CMD)
1421  {
1422  idhdl h=(idhdl)data;
1423  l= (lists)(((idhdl)h->data.ustring)->data.ustring);
1424  }
1425  if (l!=NULL)
1426  {
1427  if ((0>=e->start)||(e->start>l->nr+1))
1428  return NULL;
1429  if (e->next!=NULL)
1430  {
1431  l->m[e->start-1].e=e->next;
1432  leftv r=l->m[e->start-1].LData();
1433  l->m[e->start-1].e=NULL;
1434  return r;
1435  }
1436  return &(l->m[e->start-1]);
1437  }
1438  }
1439  return this;
1440 }
#define IDLIST(a)
Definition: ipid.h:132
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
Subexpr e
Definition: subexpr.h:105
Definition: lists.h:22
Definition: tok.h:215
#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:21
Definition: tok.h:34
int nr
Definition: lists.h:43
#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
leftv LData()
Definition: subexpr.cc:1403
int l
Definition: cfEzgcd.cc:93
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:16
utypes data
Definition: idrec.h:40

◆ listLength()

int sleftv::listLength ( )

Definition at line 56 of file subexpr.cc.

57 {
58  int n = 1;
59  leftv sl = next;
60  while (sl!=NULL)
61  {
62  n++;
63  sl=sl->next;
64  }
65  return n;
66 }
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 1098 of file subexpr.cc.

1099 {
1100  lists l=NULL;
1101  int r;
1102  if (rtyp==LIST_CMD)
1103  l=(lists)data;
1104  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1105  l=IDLIST((idhdl)data);
1106  else
1107  return Typ();
1108  //if (l!=NULL)
1109  {
1110  if ((e!=NULL) && (e->next!=NULL))
1111  {
1112  if ((0<e->start)&&(e->start<=l->nr+1))
1113  {
1114  l->m[e->start-1].e=e->next;
1115  r=l->m[e->start-1].LTyp();
1116  l->m[e->start-1].e=NULL;
1117  }
1118  else
1119  {
1120  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1121  r=NONE;
1122  }
1123  return r;
1124  }
1125  return LIST_CMD;
1126  }
1127  return Typ();
1128 }
#define IDLIST(a)
Definition: ipid.h:132
sleftv * m
Definition: lists.h:45
Subexpr e
Definition: subexpr.h:105
Definition: lists.h:22
int Typ()
Definition: subexpr.cc:992
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:88
#define IDTYP(a)
Definition: ipid.h:114
int LTyp()
Definition: subexpr.cc:1098
int nr
Definition: lists.h:43
#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:218
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 68 of file subexpr.cc.

69 {
70  int t=Typ();
71  if (errorreported) return;
72 #ifdef SIQ
73  if (rtyp==COMMAND)
74  {
75  command c=(command)data;
76  char ch[2];
77  ch[0]=c->op;ch[1]='\0';
78  const char *s=ch;
79  if (c->op>127) s=iiTwoOps(c->op);
80  ::Print("##command %d(%s), %d args\n",
81  c->op, s, c->argc);
82  if (c->argc>0)
83  c->arg1.Print(NULL,spaces+2);
84  if(c->argc<4)
85  {
86  if (c->argc>1)
87  c->arg2.Print(NULL,spaces+2);
88  if (c->argc>2)
89  c->arg3.Print(NULL,spaces+2);
90  }
91  PrintS("##end");
92  }
93  else
94 #endif
95  {
96  const char *n=Name();
97  char *s;
98  void *d=Data();
99  if (errorreported) return;
100 
101  switch (t /*=Typ()*/)
102  {
103  case CRING_CMD:
104  crPrint((coeffs)d);
105  break;
106 #ifdef SINGULAR_4_2
107  case CNUMBER_CMD:
108  n2Print((number2)d);
109  break;
110  case CPOLY_CMD:
111  p2Print((poly2)d);
112  break;
113  case CMATRIX_CMD: // like BIGINTMAT
114 #endif
115  case BIGINTMAT_CMD:
116  ((bigintmat *)d)->pprint(colmax);
117  break;
118  case UNKNOWN:
119  case DEF_CMD:
120  PrintNSpaces(spaces);
121  PrintS("`");PrintS(n);PrintS("`");
122  break;
123  case PACKAGE_CMD:
124  PrintNSpaces(spaces);
125  paPrint(n,(package)d);
126  break;
127  case LIB_CMD:
128  case NONE:
129  return;
130  case INTVEC_CMD:
131  case INTMAT_CMD:
132  ((intvec *)d)->show(t,spaces);
133  break;
134  case RING_CMD:
135  {
136  PrintNSpaces(spaces);
137  const ring r = (const ring)d;
138  rWrite(r, currRing == r);
139  break;
140  }
141  case MATRIX_CMD:
142  iiWriteMatrix((matrix)d,n,2, currRing, spaces);
143  break;
144  case MODUL_CMD:
145  case IDEAL_CMD:
146  if ((TEST_V_QRING) &&(currRing->qideal!=NULL)
147  &&(!hasFlag(this,FLAG_QRING)))
148  {
149  jjNormalizeQRingId(this);
150  d=Data();
151  }
152  // no break:
153  case MAP_CMD:
154  iiWriteMatrix((matrix)d,n,1, currRing, spaces);
155  break;
156  case POLY_CMD:
157  case VECTOR_CMD:
158  if ((e==NULL)
159  && (TEST_V_QRING)
160  &&(currRing->qideal!=NULL)
161  &&(!hasFlag(this,FLAG_QRING)))
162  {
163  setFlag(this,FLAG_QRING);
164  poly p=(poly)d;
166  if (p!=(poly)d)
167  {
168  d=(void*)p;
169  if ((rtyp==POLY_CMD)||(rtyp==VECTOR_CMD)) data=d;
170  else if (rtyp==IDHDL)
171  {
172  idhdl h=(idhdl)data;
173  IDPOLY(h)=p;
174  setFlag(h,FLAG_QRING);
175  }
176  }
177  }
178  PrintNSpaces(spaces);
179  pWrite0((poly)d);
180  break;
181  case RESOLUTION_CMD:
182  {
183  syStrategy tmp=(syStrategy)d;
184  syPrint(tmp,IDID(currRingHdl));
185  break;
186  }
187  case STRING_CMD:
188  PrintNSpaces(spaces);
189  PrintS((char *)d);
190  break;
191  case INT_CMD:
192  PrintNSpaces(spaces);
193  ::Print("%d",(int)(long)d);
194  break;
195  case PROC_CMD:
196  {
198 
199  PrintNSpaces(spaces);
200  PrintS("// libname : ");
201  PrintS(piProcinfo(pi, "libname"));
202  PrintLn();
203 
204  PrintNSpaces(spaces);
205  PrintS("// procname : ");
206  PrintS(piProcinfo(pi, "procname"));
207  PrintLn();
208 
209  PrintNSpaces(spaces);
210  PrintS("// type : ");
211  PrintS(piProcinfo(pi, "type"));
212  // ::Print("%-*.*s// ref : %s",spaces,spaces," ",
213  // piProcinfo(pi, "ref"));
214  break;
215  }
216  case LINK_CMD:
217  {
218  si_link l=(si_link)d;
219  PrintNSpaces(spaces);
220  ::Print("// type : %s\n", slStatus(l, "type"));
221  PrintNSpaces(spaces);
222  ::Print("// mode : %s\n", slStatus(l, "mode"));
223  PrintNSpaces(spaces);
224  ::Print("// name : %s\n", slStatus(l, "name"));
225  PrintNSpaces(spaces);
226  ::Print("// open : %s\n", slStatus(l, "open"));
227  PrintNSpaces(spaces);
228  ::Print("// read : %s\n", slStatus(l, "read"));
229  PrintNSpaces(spaces);
230  ::Print("// write: %s", slStatus(l, "write"));
231  break;
232  }
233  case BIGINT_CMD:
234  s=String(d);
235  if (s==NULL) return;
236  PrintNSpaces(spaces);
237  PrintS(s);
238  omFree((ADDRESS)s);
239  break;
240  case NUMBER_CMD:
241  {
242  number n=(number)d;
243  nNormalize(n);
244  if ((number)d !=n)
245  {
246  d=n;
247  if (rtyp==IDHDL) IDNUMBER(((idhdl)data))=n;
248  else if(rtyp==NUMBER_CMD) data=(void*)n;
249  }
250  s=String(d);
251  if (s==NULL) return;
252  PrintS(s);
253  omFree((ADDRESS)s);
254  break;
255  }
256  case LIST_CMD:
257  {
258  lists l=(lists)d;
259  if (lSize(l)<0)
260  {
261  PrintNSpaces(spaces);
262  PrintS("empty list\n");
263  }
264  else
265  {
266  int i=0;
267  for (;i<=l->nr;i++)
268  {
269  if (l->m[i].rtyp!=DEF_CMD)
270  {
271  PrintNSpaces(spaces);
272  ::Print("[%d]:\n",i+1);
273  l->m[i].Print(NULL,spaces+3);
274  }
275  }
276  }
277  break;
278  }
279 
280  default:
281  if (t>MAX_TOK)
282  {
283  blackbox * bb=getBlackboxStuff(t);
284  PrintNSpaces(spaces);
285  if (bb!=NULL) { bb->blackbox_Print(bb,d); }
286  else { ::Print("Print: blackbox %d(bb=NULL)",t); }
287  }
288  else
289  ::Print("Print:unknown type %s(%d)", Tok2Cmdname(t),t);
290  } /* end switch: (Typ()) */
291  if ((store!=NULL)&&(store!=this))
292  store->CleanUp();
293  }
294  if (next!=NULL)
295  {
296  if (t==COMMAND) PrintLn();
297  else if (t!=LIST_CMD) PrintS(" ");
298  next->Print(NULL,spaces);
299  }
300  else if (t!=LIST_CMD)
301  {
302  PrintLn();
303  }
304 #ifdef SIQ
305  if (rtyp!=COMMAND)
306 #endif
307  {
308  if ((store!=NULL)
309  && (store!=this))
310  {
311  if((t/*Typ()*/!=LINK_CMD)
312  && (t/*Typ()*/!=PACKAGE_CMD)
313  && (t/*Typ()*/!=DEF_CMD)
314  )
315  {
316  store->rtyp=t/*Typ()*/;
317  store->data=CopyD();
318  if(attribute!=NULL)
319  {
320  store->attribute=CopyA();
321  }
322  store->flag=flag;
323  }
324  }
325  }
326 }
ip_package * package
Definition: structs.h:46
const CanonicalForm int s
Definition: facAbsFact.cc:55
void jjNormalizeQRingP(poly &p)
Definition: ipassign.cc:2175
sleftv * m
Definition: lists.h:45
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
Matrices of numbers.
Definition: bigintmat.h:51
Definition: tok.h:215
#define UNKNOWN
Definition: tok.h:219
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:992
void pWrite0(poly p)
Definition: polys.h:295
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:68
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:734
char * String(void *d=NULL, BOOLEAN typed=FALSE, int dim=1)
Called for conversion to string (used by string(..), write(..),..)
Definition: subexpr.cc:747
void * data
Definition: subexpr.h:88
Definition: tok.h:56
Definition: intvec.h:17
const char * iiTwoOps(int t)
Definition: gentable.cc:259
const char * piProcinfo(procinfov pi, const char *request)
Definition: ipid.cc:632
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:739
idhdl currRingHdl
Definition: ipid.cc:61
#define setFlag(A, F)
Definition: ipid.h:108
idrec * idhdl
Definition: ring.h:21
#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
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:6273
#define pi
Definition: libparse.cc:1143
void jjNormalizeQRingId(leftv I)
Definition: ipassign.cc:2140
int nr
Definition: lists.h:43
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:138
#define IDPOLY(a)
Definition: ipid.h:125
#define hasFlag(A, F)
Definition: ipid.h:107
int rtyp
Definition: subexpr.h:91
void CleanUp(ring r=currRing)
Definition: subexpr.cc:328
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:1134
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:218
void PrintNSpaces(const int n)
Definition: reporter.cc:364
int l
Definition: cfEzgcd.cc:93
procinfo * procinfov
Definition: structs.h:63
#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 398 of file subexpr.cc.

399 {
400  int rt=Typ();
401  if(::RingDependend(rt))
402  return TRUE;
403  if (rt==LIST_CMD)
404  return lRingDependend((lists)Data());
405  if (this->next!=NULL)
406  return this->next->RingDependend();
407  return FALSE;
408 }
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int Typ()
Definition: subexpr.cc:992
BOOLEAN RingDependend()
Definition: subexpr.cc:398
leftv next
Definition: subexpr.h:86
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1134
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 747 of file subexpr.cc.

748 {
749 #ifdef SIQ
750  if (rtyp==COMMAND)
751  {
752  ::Print("##command %d\n",((command)data)->op);
753  if (((command)data)->arg1.rtyp!=0)
754  ((command)data)->arg1.Print(NULL,2);
755  if (((command)data)->arg2.rtyp!=0)
756  ((command)data)->arg2.Print(NULL,2);
757  if (((command)data)->arg3.rtyp==0)
758  ((command)data)->arg3.Print(NULL,2);
759  PrintS("##end\n");
760  return omStrDup("");
761  }
762 #endif
763  if (d==NULL) d=Data();
764  if (!errorreported)
765  {
766  char *s;
767  int t=Typ();
768  switch (t /*Typ()*/)
769  {
770  case INT_CMD:
771  if (typed)
772  {
773  s=(char *)omAlloc(MAX_INT_LEN+7);
774  sprintf(s,"int(%d)",(int)(long)d);
775  }
776  else
777  {
778  s=(char *)omAlloc(MAX_INT_LEN+2);
779  sprintf(s,"%d",(int)(long)d);
780  }
781  return s;
782 
783  case STRING_CMD:
784  if (d == NULL)
785  {
786  if (typed) return omStrDup("\"\"");
787  return omStrDup("");
788  }
789  if (typed)
790  {
791  s = (char*) omAlloc(strlen((char*) d) + 3);
792  sprintf(s,"\"%s\"", (char*) d);
793  return s;
794  }
795  else
796  {
797  return omStrDup((char*)d);
798  }
799 
800  case POLY_CMD:
801  case VECTOR_CMD:
802  if (typed)
803  {
804  char* ps = pString((poly) d);
805  s = (char*) omAlloc(strlen(ps) + 10);
806  sprintf(s,"%s(%s)", (t /*Typ()*/ == POLY_CMD ? "poly" : "vector"), ps);
807  omFree(ps);
808  return s;
809  }
810  else
811  return pString((poly)d);
812 
813  case CRING_CMD:
814  return nCoeffString((coeffs)d);
815  #ifdef SINGULAR_4_2
816  case CNUMBER_CMD:
817  return n2String((number2)d,typed);
818  case CMATRIX_CMD:
819  {
820  bigintmat *b=(bigintmat*)d;
821  return b->String();
822  }
823  #endif
824 
825  case NUMBER_CMD:
826  StringSetS((char*) (typed ? "number(" : ""));
828  {
829  nfShowMipo(currRing->cf);
830  }
831  else
832  {
833  nWrite((number)d);
834  }
835  StringAppendS((char*) (typed ? ")" : ""));
836  return StringEndS();
837 
838  case BIGINT_CMD:
839  {
840  StringSetS((char*) (typed ? "bigint(" : ""));
841  number nl=(number)d;
843  StringAppendS((char*) (typed ? ")" : ""));
844  return StringEndS();
845  }
846 
847  case MATRIX_CMD:
849  if (typed)
850  {
851  char* ns = (char*) omAlloc(strlen(s) + 40);
852  sprintf(ns, "matrix(ideal(%s),%d,%d)", s,
853  ((ideal) d)->nrows, ((ideal) d)->ncols);
854  omCheckAddr(ns);
855  return ns;
856  }
857  else
858  {
859  return omStrDup(s);
860  }
861 
862  case MODUL_CMD:
863  case IDEAL_CMD:
864  case MAP_CMD:
866  if (typed)
867  {
868  char* ns = (char*) omAlloc(strlen(s) + 10);
869  sprintf(ns, "%s(%s)", (t/*Typ()*/==MODUL_CMD ? "module" : "ideal"), s);
870  omFree(s);
871  omCheckAddr(ns);
872  return ns;
873  }
874  return s;
875 
876  case INTVEC_CMD:
877  case INTMAT_CMD:
878  {
879  intvec *v=(intvec *)d;
880  s = v->String(dim);
881  if (typed)
882  {
883  char* ns;
884  if (t/*Typ()*/ == INTMAT_CMD)
885  {
886  ns = (char*) omAlloc(strlen(s) + 40);
887  sprintf(ns, "intmat(intvec(%s),%d,%d)", s, v->rows(), v->cols());
888  }
889  else
890  {
891  ns = (char*) omAlloc(strlen(s) + 10);
892  sprintf(ns, "intvec(%s)", s);
893  }
894  omCheckAddr(ns);
895  omFree(s);
896  return ns;
897  }
898  else
899  return s;
900  }
901  case BIGINTMAT_CMD:
902  {
903  bigintmat *bim=(bigintmat*)d;
904  s = bim->String();
905  if (typed)
906  {
907  char* ns = (char*) omAlloc0(strlen(s) + 40);
908  sprintf(ns, "bigintmat(bigintvec(%s),%d,%d)", s, bim->rows(), bim->cols());
909  omCheckAddr(ns);
910  return ns;
911  }
912  else
913  return omStrDup(s);
914  }
915 
916  case RING_CMD:
917  s = rString((ring)d);
918 
919  if (typed)
920  {
921  char* ns;
922  ring r=(ring)d;
923  if (r->qideal!=NULL)
924  {
925  char* id = iiStringMatrix((matrix) ((ring) d)->qideal, dim,
926  currRing);
927  ns = (char*) omAlloc(strlen(s) + strlen(id) + 20);
928  sprintf(ns, "\"%s\";%sideal(%s)", s,(dim == 2 ? "\n" : " "), id);
929  }
930  else
931  {
932  ns = (char*) omAlloc(strlen(s) + 4);
933  sprintf(ns, "\"%s\"", s);
934  }
935  omFree(s);
936  omCheckAddr(ns);
937  return ns;
938  }
939  return s;
940  case RESOLUTION_CMD:
941  {
942  lists l = syConvRes((syStrategy)d);
943  s = lString(l, typed, dim);
944  l->Clean();
945  return s;
946  }
947 
948  case PROC_CMD:
949  {
950  procinfo* pi = (procinfo*) d;
951  if((pi->language == LANG_SINGULAR) && (pi->data.s.body!=NULL))
952  s = (pi->data.s.body);
953  else
954  s = (char *)"";
955  if (typed)
956  {
957  char* ns = (char*) omAlloc(strlen(s) + 4);
958  sprintf(ns, "\"%s\"", s);
959  omCheckAddr(ns);
960  return ns;
961  }
962  return omStrDup(s);
963  }
964 
965  case LINK_CMD:
966  s = slString((si_link) d);
967  if (typed)
968  {
969  char* ns = (char*) omAlloc(strlen(s) + 10);
970  sprintf(ns, "link(\"%s\")", s);
971  omFreeBinAddr(s);
972  omCheckAddr(ns);
973  return ns;
974  }
975  return s;
976 
977  case LIST_CMD:
978  return lString((lists) d, typed, dim);
979 
980  default:
981  if(t> MAX_TOK)
982  {
983  blackbox *bb=getBlackboxStuff(t);
984  if (bb!=NULL) return bb->blackbox_String(bb,d);
985  }
986  } /* end switch: (Typ()) */
987  }
988  return omStrDup("");
989 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
char * pString(poly p)
Definition: polys.h:292
#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:3122
char * rString(ring r)
Definition: ring.cc:648
int rows() const
Definition: bigintmat.h:146
Definition: tok.h:215
int rows() const
Definition: intvec.h:94
language_defs language
Definition: subexpr.h:59
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:513
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:992
#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:68
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, BOOLEAN typed, int dim) (from Singular/subexpr.cc) for printing minpoly.
Definition: ffields.cc:564
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:592
procinfodata data
Definition: subexpr.h:63
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
char * String(int dim=2) const
Definition: intvec.cc:127
#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
int cols() const
Definition: intvec.h:93
int rtyp
Definition: subexpr.h:91
void Clean(ring r=currRing)
Definition: lists.h:25
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:1134
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:973
char * iiStringMatrix(matrix im, int dim, const ring r, char ch)
Definition: matpol.cc:755
#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 992 of file subexpr.cc.

993 {
994  if (e==NULL)
995  {
996  switch (rtyp)
997  {
998  case IDHDL:
999  return IDTYP((idhdl)data);
1000  case ALIAS_CMD:
1001  {
1002  idhdl h=(idhdl)data;
1003  return ((idhdl)h->data.ustring)->typ;
1004  }
1005  case VECHO:
1006  case VPRINTLEVEL:
1007  case VCOLMAX:
1008  case VTIMER:
1009  case VRTIMER:
1010  case VOICE:
1011  case VMAXDEG:
1012  case VMAXMULT:
1013  case TRACE:
1014  case VSHORTOUT:
1015  return INT_CMD;
1016  case VMINPOLY:
1017  data=NULL;
1018  return NUMBER_CMD;
1019  case VNOETHER:
1020  data=NULL;
1021  return POLY_CMD;
1022  //case COMMAND:
1023  // return COMMAND;
1024  default:
1025  return rtyp;
1026  }
1027  }
1028  int r=0;
1029  int t=rtyp;
1030  void *d=data;
1031  if (t==IDHDL) t=IDTYP((idhdl)d);
1032  else if (t==ALIAS_CMD)
1033  { idhdl h=(idhdl)IDDATA((idhdl)data); t=IDTYP(h);d=IDDATA(h); }
1034  switch (t)
1035  {
1036 #ifdef SINGULAR_4_2
1037  case CMATRIX_CMD:
1038  {
1039  bigintmat *b=(bigintmat*)d;
1040  if ((currRing!=NULL)&&(currRing->cf==b->basecoeffs()))
1041  return NUMBER_CMD;
1042  else
1043  return CNUMBER_CMD;
1044  }
1045 #endif
1046  case INTVEC_CMD:
1047  case INTMAT_CMD:
1048  r=INT_CMD;
1049  break;
1050  case BIGINTMAT_CMD:
1051  r=BIGINT_CMD;
1052  break;
1053  case IDEAL_CMD:
1054  case MATRIX_CMD:
1055  case MAP_CMD:
1056  r=POLY_CMD;
1057  break;
1058  case MODUL_CMD:
1059  r=VECTOR_CMD;
1060  break;
1061  case STRING_CMD:
1062  r=STRING_CMD;
1063  break;
1064  default:
1065  {
1066  blackbox *b=NULL;
1067  if (t>MAX_TOK)
1068  {
1069  b=getBlackboxStuff(t);
1070  }
1071  if ((t==LIST_CMD)||((b!=NULL)&&BB_LIKE_LIST(b)))
1072  {
1073  lists l;
1074  if (rtyp==IDHDL) l=IDLIST((idhdl)d);
1075  else l=(lists)d;
1076  if ((0<e->start)&&(e->start<=l->nr+1))
1077  {
1078  Subexpr tmp=l->m[e->start-1].e;
1079  l->m[e->start-1].e=e->next;
1080  r=l->m[e->start-1].Typ();
1081  e->next=l->m[e->start-1].e;
1082  l->m[e->start-1].e=tmp;
1083  }
1084  else
1085  {
1086  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1087  r=DEF_CMD;
1088  }
1089  }
1090  else
1091  Werror("cannot index type %s(%d)",Tok2Cmdname(t),t);
1092  break;
1093  }
1094  }
1095  return r;
1096 }
#define IDLIST(a)
Definition: ipid.h:132
Definition: tok.h:209
Definition: tok.h:205
sleftv * m
Definition: lists.h:45
Definition: tok.h:96
Definition: tok.h:206
Subexpr e
Definition: subexpr.h:105
Definition: lists.h:22
Definition: tok.h:38
Matrices of numbers.
Definition: bigintmat.h:51
Definition: tok.h:215
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
int Typ()
Definition: subexpr.cc:992
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:210
CanonicalForm b
Definition: cfModGcd.cc:4044
Definition: tok.h:58
idrec * idhdl
Definition: ring.h:21
Definition: tok.h:208
Definition: tok.h:34
Definition: tok.h:211
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:138
coeffs basecoeffs() const
Definition: bigintmat.h:147
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:207
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
utypes data
Definition: idrec.h:40

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: