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

1393 {
1394  if (e==NULL) return &attribute;
1395  if ((rtyp==LIST_CMD)
1396  ||((rtyp==IDHDL)&&(IDTYP((idhdl)data)==LIST_CMD))
1397  || (rtyp>MAX_TOK)
1398  || ((rtyp==IDHDL)&&(IDTYP((idhdl)data)>MAX_TOK)))
1399  {
1400  leftv v=LData();
1401  return &(v->attribute);
1402  }
1403  return NULL;
1404 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
Subexpr e
Definition: subexpr.h:105
Definition: tok.h:213
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:88
#define IDTYP(a)
Definition: ipid.h:116
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:117
attr attribute
Definition: subexpr.h:89
leftv LData()
Definition: subexpr.cc:1406

◆ CleanUp()

void sleftv::CleanUp ( ring  r = currRing)

Definition at line 332 of file subexpr.cc.

333 {
334  if (rtyp!=IDHDL)
335  {
336  if ((name!=NULL) && (name!=sNoName_fe) && (rtyp!=ALIAS_CMD))
337  {
338  //::Print("free %x (%s)\n",name,name);
339  omFree((ADDRESS)name);
340  }
341  //name=NULL;
342  //flag=0;
343  if (data!=NULL)
344  {
345  //if (rtyp==IDHDL) attribute=NULL; // is only a pointer to attribute of id
347  //data=NULL; // will be done by Init() at the end
348  }
349  if (attribute!=NULL)
350  {
351  switch (rtyp)
352  {
353  case PACKAGE_CMD:
354  //case IDHDL:
355  case ANY_TYPE:
356  case VECHO:
357  case VPRINTLEVEL:
358  case VCOLMAX:
359  case VTIMER:
360  case VRTIMER:
361  case VOICE:
362  case VMAXDEG:
363  case VMAXMULT:
364  case TRACE:
365  case VSHORTOUT:
366  case VNOETHER:
367  case VMINPOLY:
368  case 0:
369  //attribute=NULL; // will be done by Init() at the end
370  break;
371  default:
372  {
373  attribute->killAll(r);
374  }
375  }
376  }
377  }
378  Subexpr h;
379  while (e!=NULL)
380  {
381  h=e->next;
383  e=h;
384  }
385  //rtyp=NONE; // will be done by Init() at the end
386  if (next!=NULL)
387  {
388  leftv tmp_n;
389  do
390  {
391  tmp_n=next->next;
392  //next->name=NULL;
393  next->next=NULL;
394  next->CleanUp(r);
396  next=tmp_n;
397  } while (next!=NULL);
398  }
399  Init();
400 }
Definition: tok.h:207
Definition: tok.h:203
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
#define ANY_TYPE
Definition: tok.h:30
Definition: tok.h:204
void killAll(const ring r)
Definition: attrib.cc:194
Subexpr e
Definition: subexpr.h:105
const char sNoName_fe[]
Definition: fevoices.cc:65
omBin sleftv_bin
Definition: subexpr.cc:50
void Init()
Definition: subexpr.h:107
void * ADDRESS
Definition: auxiliary.h:115
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:88
Definition: tok.h:208
const ring r
Definition: syzextra.cc:208
const char * name
Definition: subexpr.h:87
#define omFree(addr)
Definition: omAllocDecl.h:261
omBin sSubexpr_bin
Definition: subexpr.cc:49
void s_internalDelete(const int t, void *d, const ring r)
Definition: subexpr.cc:495
Definition: tok.h:206
leftv next
Definition: subexpr.h:86
Definition: tok.h:34
Definition: tok.h:209
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void CleanUp(ring r=currRing)
Definition: subexpr.cc:332
attr attribute
Definition: subexpr.h:89
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
Definition: tok.h:205
static Poly * h
Definition: janet.cc:978

◆ Copy()

void sleftv::Copy ( leftv  e)

Definition at line 688 of file subexpr.cc.

689 {
690  Init();
691  rtyp=source->Typ();
692  void *d=source->Data();
693  if(!errorreported)
694  {
696  if ((source->attribute!=NULL)||(source->e!=NULL))
697  attribute=source->CopyA();
698  flag=source->flag;
699  if (source->next!=NULL)
700  {
702  next->Copy(source->next);
703  }
704  }
705 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
BITSET flag
Definition: subexpr.h:90
omBin sleftv_bin
Definition: subexpr.cc:50
void Init()
Definition: subexpr.h:107
sleftv * leftv
Definition: structs.h:60
void * data
Definition: subexpr.h:88
void * CopyA()
Definition: subexpr.cc:1952
void Copy(leftv e)
Definition: subexpr.cc:688
static void * s_internalCopy(const int t, void *d)
Definition: subexpr.cc:414
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 743 of file subexpr.cc.

744 {
745  attr *a=Attribute();
746  if ((a!=NULL) && (*a!=NULL))
747  return (*a)->Copy();
748  return NULL;
749 }
const poly a
Definition: syzextra.cc:212
Definition: attrib.h:15
attr * Attribute()
Definition: subexpr.cc:1392
#define NULL
Definition: omList.c:10

◆ CopyD() [1/2]

void * sleftv::CopyD ( int  t)

Definition at line 707 of file subexpr.cc.

708 {
709  if ((rtyp!=IDHDL)&&(rtyp!=ALIAS_CMD)&&(e==NULL))
710  {
711  if (iiCheckRing(t)) return NULL;
712  void *x = data;
713  if (rtyp==VNOETHER) x = (void *)pCopy((currRing->ppNoether));
714  else if ((rtyp==VMINPOLY) && nCoeff_is_algExt(currRing->cf) && (!nCoeff_is_GF(currRing->cf)))
715  {
716  const ring A = currRing->cf->extRing;
717 
718  assume( A != NULL );
719  assume( A->qideal != NULL );
720 
721  x=(void *)p_Copy(A->qideal->m[0], A);
722  }
723  data=NULL;
724  return x;
725  }
726  void *d=Data(); // will also do a iiCheckRing
727  if ((!errorreported) && (d!=NULL)) return slInternalCopy(this,t,d,e);
728  return NULL;
729 }
void * slInternalCopy(leftv source, const int t, void *d, Subexpr e)
Definition: subexpr.cc:659
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:804
void * data
Definition: subexpr.h:88
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:927
#define assume(x)
Definition: mod2.h:394
#define A
Definition: sirandom.c:23
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:856
short errorreported
Definition: feFopen.cc:23
Definition: tok.h:34
BOOLEAN iiCheckRing(int i)
Definition: ipshell.cc:1491
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

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

◆ Data()

void * sleftv::Data ( )

Definition at line 1137 of file subexpr.cc.

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

1761 {
1762  BOOLEAN nok=FALSE;
1763  leftv nn=next;
1764  next=NULL;
1765  if(rtyp==IDHDL)
1766  {
1767  int t=Typ();
1768  if (t!=PROC_CMD)
1769  {
1770  void *d=CopyD(t);
1771  data=d;
1772  rtyp=t;
1773  name=NULL;
1774  e=NULL;
1775  }
1776  }
1777  else if (rtyp==COMMAND)
1778  {
1779  command d=(command)data;
1780  if(d->op==PROC_CMD) //assume d->argc==2
1781  {
1782  char *what=(char *)(d->arg1.Data());
1783  idhdl h=ggetid(what);
1784  if((h!=NULL)&&(IDTYP(h)==PROC_CMD))
1785  {
1786  nok=d->arg2.Eval();
1787  if(!nok)
1788  {
1789  nok=iiMake_proc(h,req_packhdl,&d->arg2);
1790  this->CleanUp(currRing);
1791  if (!nok)
1792  {
1793  memcpy(this,&iiRETURNEXPR,sizeof(sleftv));
1794  memset(&iiRETURNEXPR,0,sizeof(sleftv));
1795  }
1796  }
1797  }
1798  else nok=TRUE;
1799  }
1800  else if (d->op=='=') //assume d->argc==2
1801  {
1802  if ((d->arg1.rtyp!=IDHDL)&&(d->arg1.rtyp!=DEF_CMD))
1803  {
1804  nok=d->arg1.Eval();
1805  }
1806  if (!nok)
1807  {
1808  const char *n=d->arg1.name;
1809  nok=(n == NULL) || d->arg2.Eval();
1810  if (!nok)
1811  {
1812  int save_typ=d->arg1.rtyp;
1813  omCheckAddr((ADDRESS)n);
1814  if (d->arg1.rtyp!=IDHDL)
1815  syMake(&d->arg1,n);
1816  omCheckAddr((ADDRESS)d->arg1.name);
1817  if (d->arg1.rtyp==IDHDL)
1818  {
1819  n=omStrDup(IDID((idhdl)d->arg1.data));
1820  killhdl((idhdl)d->arg1.data);
1821  d->arg1.Init();
1822  //d->arg1.data=NULL;
1823  d->arg1.name=n;
1824  }
1825  d->arg1.rtyp=DEF_CMD;
1826  sleftv t;
1827  if(save_typ!=PROC_CMD) save_typ=d->arg2.rtyp;
1828  if (::RingDependend(d->arg2.rtyp))
1829  nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&currRing->idroot);
1830  else
1831  nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&IDROOT);
1832  memcpy(&d->arg1,&t,sizeof(sleftv));
1833  omCheckAddr((ADDRESS)d->arg1.name);
1834  nok=nok||iiAssign(&d->arg1,&d->arg2);
1835  omCheckIf(d->arg1.name != NULL, // OB: ????
1836  omCheckAddr((ADDRESS)d->arg1.name));
1837  if (!nok)
1838  {
1839  memset(&d->arg1,0,sizeof(sleftv));
1840  this->CleanUp();
1841  rtyp=NONE;
1842  }
1843  }
1844  }
1845  else nok=TRUE;
1846  }
1847  else
1848  {
1849  sleftv tmp; tmp.Init();
1850  int toktype=iiTokType(d->op);
1851  if ((toktype==CMD_M)
1852  ||( toktype==ROOT_DECL_LIST)
1853  ||( toktype==RING_DECL_LIST))
1854  {
1855  if (d->argc <=3)
1856  {
1857  if (d->argc>=1) nok=d->arg1.Eval();
1858  if ((!nok) && (d->argc>=2))
1859  {
1860  nok=d->arg2.Eval();
1861  d->arg1.next=(leftv)omAllocBin(sleftv_bin);
1862  memcpy(d->arg1.next,&d->arg2,sizeof(sleftv));
1863  d->arg2.Init();
1864  }
1865  if ((!nok) && (d->argc==3))
1866  {
1867  nok=d->arg3.Eval();
1868  d->arg1.next->next=(leftv)omAllocBin(sleftv_bin);
1869  memcpy(d->arg1.next->next,&d->arg3,sizeof(sleftv));
1870  d->arg3.Init();
1871  }
1872  if (d->argc==0)
1873  nok=nok||iiExprArithM(&tmp,NULL,d->op);
1874  else
1875  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1876  }
1877  else
1878  {
1879  nok=d->arg1.Eval();
1880  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1881  }
1882  }
1883  else if (d->argc==1)
1884  {
1885  nok=d->arg1.Eval();
1886  nok=nok||iiExprArith1(&tmp,&d->arg1,d->op);
1887  }
1888  else if(d->argc==2)
1889  {
1890  nok=d->arg1.Eval();
1891  nok=nok||d->arg2.Eval();
1892  nok=nok||iiExprArith2(&tmp,&d->arg1,d->op,&d->arg2);
1893  }
1894  else if(d->argc==3)
1895  {
1896  nok=d->arg1.Eval();
1897  nok=nok||d->arg2.Eval();
1898  nok=nok||d->arg3.Eval();
1899  nok=nok||iiExprArith3(&tmp,d->op,&d->arg1,&d->arg2,&d->arg3);
1900  }
1901  else if(d->argc!=0)
1902  {
1903  nok=d->arg1.Eval();
1904  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1905  }
1906  else // d->argc == 0
1907  {
1908  nok = iiExprArithM(&tmp, NULL, d->op);
1909  }
1910  this->CleanUp();
1911  memcpy(this,&tmp,sizeof(tmp));
1912  }
1913  }
1914  else if (((rtyp==0)||(rtyp==DEF_CMD))
1915  &&(name!=NULL))
1916  {
1917  syMake(this,name);
1918  }
1919 #ifdef MDEBUG
1920  switch(Typ())
1921  {
1922  case NUMBER_CMD:
1923 #ifdef LDEBUG
1924  nTest((number)Data());
1925 #endif
1926  break;
1927  case BIGINT_CMD:
1928 #ifdef LDEBUG
1929  n_Test((number)Data(),coeffs_BIGINT);
1930 #endif
1931  break;
1932  case POLY_CMD:
1933  pTest((poly)Data());
1934  break;
1935  case IDEAL_CMD:
1936  case MODUL_CMD:
1937  case MATRIX_CMD:
1938  {
1939  ideal id=(ideal)Data();
1940  omCheckAddrSize(id,sizeof(*id));
1941  int i=id->ncols*id->nrows-1;
1942  for(;i>=0;i--) pTest(id->m[i]);
1943  }
1944  break;
1945  }
1946 #endif
1947  if (nn!=NULL) nok=nok||nn->Eval();
1948  next=nn;
1949  return nok;
1950 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
idhdl ggetid(const char *n)
Definition: ipid.cc:510
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
int Eval()
Definition: subexpr.cc:1760
ip_command * command
Definition: ipid.h:24
Subexpr e
Definition: subexpr.h:105
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:8319
#define IDID(a)
Definition: ipid.h:119
#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:8531
omBin sleftv_bin
Definition: subexpr.cc:50
#define pTest(p)
Definition: polys.h:397
sleftv iiRETURNEXPR
Definition: iplib.cc:473
#define omCheckIf(cond, test)
Definition: omAllocDecl.h:323
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:98
void Init()
Definition: subexpr.h:107
void * ADDRESS
Definition: auxiliary.h:115
void * CopyD()
Definition: subexpr.h:119
sleftv * leftv
Definition: structs.h:60
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition: iparith.cc:8621
coeffs coeffs_BIGINT
Definition: ipid.cc:54
int Typ()
Definition: subexpr.cc:995
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:88
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define IDTYP(a)
Definition: ipid.h:116
BOOLEAN RingDependend()
Definition: subexpr.cc:402
#define nTest(a)
Definition: numbers.h:35
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:742
int i
Definition: cfEzgcd.cc:123
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:503
#define NULL
Definition: omList.c:10
package req_packhdl
Definition: subexpr.h:106
void killhdl(idhdl h, package proot)
Definition: ipid.cc:377
int rtyp
Definition: subexpr.h:91
void CleanUp(ring r=currRing)
Definition: subexpr.cc:332
void * Data()
Definition: subexpr.cc:1137
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
int iiTokType(int op)
Definition: iparith.cc:239
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
Definition: iparith.cc:8130
#define NONE
Definition: tok.h:216
void syMake(leftv v, const char *id, package pa)
Definition: subexpr.cc:1500
#define COMMAND
Definition: tok.h:29
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1793
#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:65
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 1406 of file subexpr.cc.

1407 {
1408  if (e!=NULL)
1409  {
1410  lists l=NULL;
1411  blackbox *b=getBlackboxStuff(rtyp);
1412 
1413  if ((rtyp==LIST_CMD)
1414  || ((b!=NULL)&&(BB_LIKE_LIST(b))))
1415  l=(lists)data;
1416  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1417  l=IDLIST((idhdl)data);
1418  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)>MAX_TOK))
1419  {
1420  b=getBlackboxStuff(IDTYP((idhdl)data));
1421  if (BB_LIKE_LIST(b)) l=IDLIST((idhdl)data);
1422  }
1423  else if (rtyp==ALIAS_CMD)
1424  {
1425  idhdl h=(idhdl)data;
1426  l= (lists)(((idhdl)h->data.ustring)->data.ustring);
1427  }
1428  if (l!=NULL)
1429  {
1430  if ((0>=e->start)||(e->start>l->nr+1))
1431  return NULL;
1432  if (e->next!=NULL)
1433  {
1434  l->m[e->start-1].e=e->next;
1435  leftv r=l->m[e->start-1].LData();
1436  l->m[e->start-1].e=NULL;
1437  return r;
1438  }
1439  return &(l->m[e->start-1]);
1440  }
1441  }
1442  return this;
1443 }
#define IDLIST(a)
Definition: ipid.h:134
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:213
#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:116
const ring r
Definition: syzextra.cc:208
idrec * idhdl
Definition: ring.h:18
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:117
static Poly * h
Definition: janet.cc:978
const poly b
Definition: syzextra.cc:213
leftv LData()
Definition: subexpr.cc:1406
int l
Definition: cfEzgcd.cc:94
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 60 of file subexpr.cc.

61 {
62  int n = 1;
63  leftv sl = next;
64  while (sl!=NULL)
65  {
66  n++;
67  sl=sl->next;
68  }
69  return n;
70 }
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 1101 of file subexpr.cc.

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

◆ 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:65
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 72 of file subexpr.cc.

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

403 {
404  int rt=Typ();
405  if(::RingDependend(rt))
406  return TRUE;
407  if (rt==LIST_CMD)
408  return lRingDependend((lists)Data());
409  if (this->next!=NULL)
410  return this->next->RingDependend();
411  return FALSE;
412 }
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int Typ()
Definition: subexpr.cc:995
BOOLEAN RingDependend()
Definition: subexpr.cc:402
leftv next
Definition: subexpr.h:86
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1137
Definition: tok.h:117
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 751 of file subexpr.cc.

752 {
753 #ifdef SIQ
754  if (rtyp==COMMAND)
755  {
756  ::Print("##command %d\n",((command)data)->op);
757  if (((command)data)->arg1.rtyp!=0)
758  ((command)data)->arg1.Print(NULL,2);
759  if (((command)data)->arg2.rtyp!=0)
760  ((command)data)->arg2.Print(NULL,2);
761  if (((command)data)->arg3.rtyp==0)
762  ((command)data)->arg3.Print(NULL,2);
763  PrintS("##end\n");
764  return omStrDup("");
765  }
766 #endif
767  if (d==NULL) d=Data();
768  if (!errorreported)
769  {
770  char *s;
771  int t=Typ();
772  switch (t /*Typ()*/)
773  {
774  case INT_CMD:
775  if (typed)
776  {
777  s=(char *)omAlloc(MAX_INT_LEN+7);
778  sprintf(s,"int(%d)",(int)(long)d);
779  }
780  else
781  {
782  s=(char *)omAlloc(MAX_INT_LEN+2);
783  sprintf(s,"%d",(int)(long)d);
784  }
785  return s;
786 
787  case STRING_CMD:
788  if (d == NULL)
789  {
790  if (typed) return omStrDup("\"\"");
791  return omStrDup("");
792  }
793  if (typed)
794  {
795  s = (char*) omAlloc(strlen((char*) d) + 3);
796  sprintf(s,"\"%s\"", (char*) d);
797  return s;
798  }
799  else
800  {
801  return omStrDup((char*)d);
802  }
803 
804  case POLY_CMD:
805  case VECTOR_CMD:
806  if (typed)
807  {
808  char* ps = pString((poly) d);
809  s = (char*) omAlloc(strlen(ps) + 10);
810  sprintf(s,"%s(%s)", (t /*Typ()*/ == POLY_CMD ? "poly" : "vector"), ps);
811  omFree(ps);
812  return s;
813  }
814  else
815  return pString((poly)d);
816 
817  case CRING_CMD:
818  return nCoeffString((coeffs)d);
819  #ifdef SINGULAR_4_2
820  case CNUMBER_CMD:
821  return n2String((number2)d,typed);
822  case CMATRIX_CMD:
823  {
824  bigintmat *b=(bigintmat*)d;
825  return b->String();
826  }
827  #endif
828 
829  case NUMBER_CMD:
830  StringSetS((char*) (typed ? "number(" : ""));
832  {
833  nfShowMipo(currRing->cf);
834  }
835  else
836  {
837  nWrite((number)d);
838  }
839  StringAppendS((char*) (typed ? ")" : ""));
840  return StringEndS();
841 
842  case BIGINT_CMD:
843  {
844  StringSetS((char*) (typed ? "bigint(" : ""));
845  number nl=(number)d;
847  StringAppendS((char*) (typed ? ")" : ""));
848  return StringEndS();
849  }
850 
851  case MATRIX_CMD:
853  if (typed)
854  {
855  char* ns = (char*) omAlloc(strlen(s) + 40);
856  sprintf(ns, "matrix(ideal(%s),%d,%d)", s,
857  ((ideal) d)->nrows, ((ideal) d)->ncols);
858  omCheckAddr(ns);
859  return ns;
860  }
861  else
862  {
863  return omStrDup(s);
864  }
865 
866  case MODUL_CMD:
867  case IDEAL_CMD:
868  case MAP_CMD:
870  if (typed)
871  {
872  char* ns = (char*) omAlloc(strlen(s) + 10);
873  sprintf(ns, "%s(%s)", (t/*Typ()*/==MODUL_CMD ? "module" : "ideal"), s);
874  omCheckAddr(ns);
875  return ns;
876  }
877  return omStrDup(s);
878 
879  case INTVEC_CMD:
880  case INTMAT_CMD:
881  {
882  intvec *v=(intvec *)d;
883  s = v->String(dim);
884  if (typed)
885  {
886  char* ns;
887  if (t/*Typ()*/ == INTMAT_CMD)
888  {
889  ns = (char*) omAlloc(strlen(s) + 40);
890  sprintf(ns, "intmat(intvec(%s),%d,%d)", s, v->rows(), v->cols());
891  }
892  else
893  {
894  ns = (char*) omAlloc(strlen(s) + 10);
895  sprintf(ns, "intvec(%s)", s);
896  }
897  omCheckAddr(ns);
898  omFree(s);
899  return ns;
900  }
901  else
902  return s;
903  }
904  case BIGINTMAT_CMD:
905  {
906  bigintmat *bim=(bigintmat*)d;
907  s = bim->String();
908  if (typed)
909  {
910  char* ns = (char*) omAlloc0(strlen(s) + 40);
911  sprintf(ns, "bigintmat(bigintvec(%s),%d,%d)", s, bim->rows(), bim->cols());
912  omCheckAddr(ns);
913  return ns;
914  }
915  else
916  return omStrDup(s);
917  }
918 
919  case RING_CMD:
920  s = rString((ring)d);
921 
922  if (typed)
923  {
924  char* ns;
925  ring r=(ring)d;
926  if (r->qideal!=NULL)
927  {
928  char* id = iiStringMatrix((matrix) ((ring) d)->qideal, dim,
929  currRing);
930  ns = (char*) omAlloc(strlen(s) + strlen(id) + 20);
931  sprintf(ns, "\"%s\";%sideal(%s)", s,(dim == 2 ? "\n" : " "), id);
932  }
933  else
934  {
935  ns = (char*) omAlloc(strlen(s) + 4);
936  sprintf(ns, "\"%s\"", s);
937  }
938  omFree(s);
939  omCheckAddr(ns);
940  return ns;
941  }
942  return s;
943  case RESOLUTION_CMD:
944  {
945  lists l = syConvRes((syStrategy)d);
946  s = lString(l, typed, dim);
947  l->Clean();
948  return s;
949  }
950 
951  case PROC_CMD:
952  {
953  procinfo* pi = (procinfo*) d;
954  if((pi->language == LANG_SINGULAR) && (pi->data.s.body!=NULL))
955  s = (pi->data.s.body);
956  else
957  s = (char *)"";
958  if (typed)
959  {
960  char* ns = (char*) omAlloc(strlen(s) + 4);
961  sprintf(ns, "\"%s\"", s);
962  omCheckAddr(ns);
963  return ns;
964  }
965  return omStrDup(s);
966  }
967 
968  case LINK_CMD:
969  s = slString((si_link) d);
970  if (typed)
971  {
972  char* ns = (char*) omAlloc(strlen(s) + 10);
973  sprintf(ns, "link(\"%s\")", s);
974  omFreeBinAddr(s);
975  omCheckAddr(ns);
976  return ns;
977  }
978  return s;
979 
980  case LIST_CMD:
981  return lString((lists) d, typed, dim);
982 
983  default:
984  if(t> MAX_TOK)
985  {
986  blackbox *bb=getBlackboxStuff(t);
987  if (bb!=NULL) return bb->blackbox_String(bb,d);
988  }
989  } /* end switch: (Typ()) */
990  }
991  return omStrDup("");
992 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
char * pString(poly p)
Definition: polys.h:288
#define nWrite(n)
Definition: numbers.h:29
ip_command * command
Definition: ipid.h:24
Definition: tok.h:95
Definition: lists.h:22
const int MAX_INT_LEN
Definition: mylimits.h:13
Definition: tok.h:38
Matrices of numbers.
Definition: bigintmat.h:51
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:3109
char * rString(ring r)
Definition: ring.cc:648
int rows() const
Definition: bigintmat.h:146
Definition: tok.h:213
int rows() const
Definition: intvec.h:88
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:377
coeffs coeffs_BIGINT
Definition: ipid.cc:54
int Typ()
Definition: subexpr.cc:995
#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:72
void * data
Definition: subexpr.h:88
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
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:530
Definition: tok.h:56
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
#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:595
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:128
#define pi
Definition: libparse.cc:1143
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
Definition: tok.h:116
#define NULL
Definition: omList.c:10
char * String()
IO: String returns a singular string containing the matrix, needs freeing afterwards.
Definition: bigintmat.cc:437
int int ncols
Definition: cf_linsys.cc:32
int cols() const
Definition: intvec.h:87
int rtyp
Definition: subexpr.h:91
void Clean(ring r=currRing)
Definition: lists.h:25
void * Data()
Definition: subexpr.cc:1137
Definition: tok.h:117
#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:976
polyrec * poly
Definition: hilb.h:10
char * iiStringMatrix(matrix im, int dim, const ring r, char ch)
Definition: matpol.cc:764
const poly b
Definition: syzextra.cc:213
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
#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 995 of file subexpr.cc.

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