Public Member Functions | Data Fields
sleftv Class Reference

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

#include <subexpr.h>

Public Member Functions

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

Data Fields

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

Detailed Description

Class used for (list of) interpreter objects.

Definition at line 83 of file subexpr.h.

Member Function Documentation

§ Attribute()

attr * sleftv::Attribute ( )

Definition at line 1401 of file subexpr.cc.

1402 {
1403  if (e==NULL) return &attribute;
1404  if ((rtyp==LIST_CMD)
1405  ||((rtyp==IDHDL)&&(IDTYP((idhdl)data)==LIST_CMD))
1406  || (rtyp>MAX_TOK)
1407  || ((rtyp==IDHDL)&&(IDTYP((idhdl)data)>MAX_TOK)))
1408  {
1409  leftv v=LData();
1410  return &(v->attribute);
1411  }
1412  return NULL;
1413 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Subexpr e
Definition: subexpr.h:106
Definition: tok.h:215
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:89
#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:92
Definition: tok.h:117
attr attribute
Definition: subexpr.h:90
leftv LData()
Definition: subexpr.cc:1415

§ CleanUp()

void sleftv::CleanUp ( ring  r = currRing)

Definition at line 335 of file subexpr.cc.

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

§ Copy()

void sleftv::Copy ( leftv  e)

Definition at line 695 of file subexpr.cc.

696 {
697  Init();
698  rtyp=source->Typ();
699  void *d=source->Data();
700  if(!errorreported)
701  {
703  if ((source->attribute!=NULL)||(source->e!=NULL))
704  attribute=source->CopyA();
705  flag=source->flag;
706  if (source->next!=NULL)
707  {
709  next->Copy(source->next);
710  }
711  }
712 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
BITSET flag
Definition: subexpr.h:91
omBin sleftv_bin
Definition: subexpr.cc:50
void Init()
Definition: subexpr.h:108
sleftv * leftv
Definition: structs.h:60
void * data
Definition: subexpr.h:89
void * CopyA()
Definition: subexpr.cc:1966
void Copy(leftv e)
Definition: subexpr.cc:695
static void * s_internalCopy(const int t, void *d)
Definition: subexpr.cc:417
short errorreported
Definition: feFopen.cc:23
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
attr attribute
Definition: subexpr.h:90

§ CopyA()

attr sleftv::CopyA ( )

Definition at line 750 of file subexpr.cc.

751 {
752  attr *a=Attribute();
753  if ((a!=NULL) && (*a!=NULL))
754  return (*a)->Copy();
755  return NULL;
756 }
const poly a
Definition: syzextra.cc:212
Definition: attrib.h:15
attr * Attribute()
Definition: subexpr.cc:1401
#define NULL
Definition: omList.c:10

§ CopyD() [1/2]

void * sleftv::CopyD ( int  t)

Definition at line 714 of file subexpr.cc.

715 {
716  if ((rtyp!=IDHDL)&&(rtyp!=ALIAS_CMD)&&(e==NULL))
717  {
718  if (iiCheckRing(t)) return NULL;
719  void *x = data;
720  if (rtyp==VNOETHER) x = (void *)pCopy((currRing->ppNoether));
721  else if ((rtyp==VMINPOLY) && nCoeff_is_algExt(currRing->cf) && (!nCoeff_is_GF(currRing->cf)))
722  {
723  const ring A = currRing->cf->extRing;
724 
725  assume( A != NULL );
726  assume( A->qideal != NULL );
727 
728  x=(void *)p_Copy(A->qideal->m[0], A);
729  }
730  data=NULL;
731  return x;
732  }
733  void *d=Data(); // will also do a iiCheckRing
734  if ((!errorreported) && (d!=NULL)) return slInternalCopy(this,t,d,e);
735  return NULL;
736 }
void * slInternalCopy(leftv source, const int t, void *d, Subexpr e)
Definition: subexpr.cc:666
Subexpr e
Definition: subexpr.h:106
#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:89
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:924
#define assume(x)
Definition: mod2.h:403
#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:1469
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1146
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

§ CopyD() [2/2]

void* sleftv::CopyD ( )
inline

Definition at line 120 of file subexpr.h.

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

§ Data()

void * sleftv::Data ( )

Definition at line 1146 of file subexpr.cc.

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

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

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

§ Init()

void sleftv::Init ( )
inline

Definition at line 108 of file subexpr.h.

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

§ LData()

leftv sleftv::LData ( )

Definition at line 1415 of file subexpr.cc.

1416 {
1417  if (e!=NULL)
1418  {
1419  lists l=NULL;
1420  blackbox *b=getBlackboxStuff(rtyp);
1421 
1422  if ((rtyp==LIST_CMD)
1423  || ((b!=NULL)&&(BB_LIKE_LIST(b))))
1424  l=(lists)data;
1425  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1426  l=IDLIST((idhdl)data);
1427  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)>MAX_TOK))
1428  {
1429  b=getBlackboxStuff(IDTYP((idhdl)data));
1430  if (BB_LIKE_LIST(b)) l=IDLIST((idhdl)data);
1431  }
1432  else if (rtyp==ALIAS_CMD)
1433  {
1434  idhdl h=(idhdl)data;
1435  l= (lists)(((idhdl)h->data.ustring)->data.ustring);
1436  }
1437  if (l!=NULL)
1438  {
1439  if ((0>=e->start)||(e->start>l->nr+1))
1440  return NULL;
1441  if (e->next!=NULL)
1442  {
1443  l->m[e->start-1].e=e->next;
1444  leftv r=l->m[e->start-1].LData();
1445  l->m[e->start-1].e=NULL;
1446  return r;
1447  }
1448  return &(l->m[e->start-1]);
1449  }
1450  }
1451  return this;
1452 }
#define IDLIST(a)
Definition: ipid.h:134
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Subexpr e
Definition: subexpr.h:106
Definition: lists.h:22
Definition: tok.h: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:89
#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:92
Definition: tok.h:117
static Poly * h
Definition: janet.cc:978
const poly b
Definition: syzextra.cc:213
leftv LData()
Definition: subexpr.cc:1415
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 61 of file subexpr.cc.

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

§ LTyp()

int sleftv::LTyp ( )

Definition at line 1110 of file subexpr.cc.

1111 {
1112  lists l=NULL;
1113  int r;
1114  if (rtyp==LIST_CMD)
1115  l=(lists)data;
1116  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1117  l=IDLIST((idhdl)data);
1118  else
1119  return Typ();
1120  //if (l!=NULL)
1121  {
1122  if ((e!=NULL) && (e->next!=NULL))
1123  {
1124  if ((0<e->start)&&(e->start<=l->nr+1))
1125  {
1126  l->m[e->start-1].e=e->next;
1127  r=l->m[e->start-1].LTyp();
1128  l->m[e->start-1].e=NULL;
1129  }
1130  else
1131  {
1132  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1133  r=NONE;
1134  }
1135  return r;
1136  }
1137  return LIST_CMD;
1138  }
1139  return Typ();
1140 }
#define IDLIST(a)
Definition: ipid.h:134
sleftv * m
Definition: lists.h:45
Subexpr e
Definition: subexpr.h:106
Definition: lists.h:22
int Typ()
Definition: subexpr.cc:1004
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:89
#define IDTYP(a)
Definition: ipid.h:116
const ring r
Definition: syzextra.cc:208
int LTyp()
Definition: subexpr.cc:1110
int nr
Definition: lists.h:43
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
Definition: tok.h:117
#define NONE
Definition: tok.h:218
int l
Definition: cfEzgcd.cc:94

§ Name()

const char* sleftv::Name ( )
inline

Definition at line 121 of file subexpr.h.

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

§ Next()

leftv sleftv::Next ( )
inline

Definition at line 137 of file subexpr.h.

137 { return next; }
leftv next
Definition: subexpr.h:87

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

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

406 {
407  int rt=Typ();
408  if(::RingDependend(rt))
409  return TRUE;
410  if (rt==LIST_CMD)
411  return lRingDependend((lists)Data());
412  if (this->next!=NULL)
413  return this->next->RingDependend();
414  return FALSE;
415 }
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
int Typ()
Definition: subexpr.cc:1004
BOOLEAN RingDependend()
Definition: subexpr.cc:405
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1146
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 758 of file subexpr.cc.

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

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

§ data

void* sleftv::data

Definition at line 89 of file subexpr.h.

§ e

Subexpr sleftv::e

Definition at line 106 of file subexpr.h.

§ flag

BITSET sleftv::flag

Definition at line 91 of file subexpr.h.

§ name

const char* sleftv::name

Definition at line 88 of file subexpr.h.

§ next

leftv sleftv::next

Definition at line 87 of file subexpr.h.

§ req_packhdl

package sleftv::req_packhdl

Definition at line 107 of file subexpr.h.

§ rtyp

int sleftv::rtyp

Definition at line 92 of file subexpr.h.


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