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

1394 {
1395  if (e==NULL) return &attribute;
1396  if ((rtyp==LIST_CMD)
1397  ||((rtyp==IDHDL)&&(IDTYP((idhdl)data)==LIST_CMD))
1398  || (rtyp>MAX_TOK)
1399  || ((rtyp==IDHDL)&&(IDTYP((idhdl)data)>MAX_TOK)))
1400  {
1401  leftv v=LData();
1402  return &(v->attribute);
1403  }
1404  return NULL;
1405 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Subexpr e
Definition: subexpr.h:106
Definition: tok.h:213
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:1407

§ CleanUp()

void sleftv::CleanUp ( ring  r = currRing)

Definition at line 333 of file subexpr.cc.

334 {
335  if (rtyp!=IDHDL)
336  {
337  if ((name!=NULL) && (name!=sNoName) && (rtyp!=ALIAS_CMD))
338  {
339  //::Print("free %x (%s)\n",name,name);
340  omFree((ADDRESS)name);
341  }
342  //name=NULL;
343  //flag=0;
344  if (data!=NULL)
345  {
346  //if (rtyp==IDHDL) attribute=NULL; // is only a pointer to attribute of id
348  //data=NULL; // will be done by Init() at the end
349  }
350  if (attribute!=NULL)
351  {
352  switch (rtyp)
353  {
354  case PACKAGE_CMD:
355  //case IDHDL:
356  case ANY_TYPE:
357  case VECHO:
358  case VPRINTLEVEL:
359  case VCOLMAX:
360  case VTIMER:
361  case VRTIMER:
362  case VOICE:
363  case VMAXDEG:
364  case VMAXMULT:
365  case TRACE:
366  case VSHORTOUT:
367  case VNOETHER:
368  case VMINPOLY:
369  case 0:
370  //attribute=NULL; // will be done by Init() at the end
371  break;
372  default:
373  {
374  attribute->killAll(r);
375  }
376  }
377  }
378  }
379  Subexpr h;
380  while (e!=NULL)
381  {
382  h=e->next;
384  e=h;
385  }
386  //rtyp=NONE; // will be done by Init() at the end
387  if (next!=NULL)
388  {
389  leftv tmp_n;
390  do
391  {
392  tmp_n=next->next;
393  //next->name=NULL;
394  next->next=NULL;
395  next->CleanUp(r);
397  next=tmp_n;
398  } while (next!=NULL);
399  }
400  Init();
401 }
Definition: tok.h:207
Definition: tok.h:203
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#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: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:115
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:89
Definition: tok.h:208
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:496
Definition: tok.h:206
leftv next
Definition: subexpr.h:87
Definition: tok.h:34
Definition: tok.h:209
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
attr attribute
Definition: subexpr.h:90
#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 689 of file subexpr.cc.

690 {
691  Init();
692  rtyp=source->Typ();
693  void *d=source->Data();
694  if(!errorreported)
695  {
697  if ((source->attribute!=NULL)||(source->e!=NULL))
698  attribute=source->CopyA();
699  flag=source->flag;
700  if (source->next!=NULL)
701  {
703  next->Copy(source->next);
704  }
705  }
706 }
#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:1958
void Copy(leftv e)
Definition: subexpr.cc:689
static void * s_internalCopy(const int t, void *d)
Definition: subexpr.cc:415
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 744 of file subexpr.cc.

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

§ CopyD() [1/2]

void * sleftv::CopyD ( int  t)

Definition at line 708 of file subexpr.cc.

709 {
710  if ((rtyp!=IDHDL)&&(rtyp!=ALIAS_CMD)&&(e==NULL))
711  {
712  if (iiCheckRing(t)) return NULL;
713  void *x = data;
714  if (rtyp==VNOETHER) x = (void *)pCopy((currRing->ppNoether));
715  else if ((rtyp==VMINPOLY) && nCoeff_is_algExt(currRing->cf) && (!nCoeff_is_GF(currRing->cf)))
716  {
717  const ring A = currRing->cf->extRing;
718 
719  assume( A != NULL );
720  assume( A->qideal != NULL );
721 
722  x=(void *)p_Copy(A->qideal->m[0], A);
723  }
724  data=NULL;
725  return x;
726  }
727  void *d=Data(); // will also do a iiCheckRing
728  if ((!errorreported) && (d!=NULL)) return slInternalCopy(this,t,d,e);
729  return NULL;
730 }
void * slInternalCopy(leftv source, const int t, void *d, Subexpr e)
Definition: subexpr.cc:660
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: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:1461
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1138
#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:996

§ Data()

void * sleftv::Data ( )

Definition at line 1138 of file subexpr.cc.

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

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

1408 {
1409  if (e!=NULL)
1410  {
1411  lists l=NULL;
1412  blackbox *b=getBlackboxStuff(rtyp);
1413 
1414  if ((rtyp==LIST_CMD)
1415  || ((b!=NULL)&&(BB_LIKE_LIST(b))))
1416  l=(lists)data;
1417  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1418  l=IDLIST((idhdl)data);
1419  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)>MAX_TOK))
1420  {
1421  b=getBlackboxStuff(IDTYP((idhdl)data));
1422  if (BB_LIKE_LIST(b)) l=IDLIST((idhdl)data);
1423  }
1424  else if (rtyp==ALIAS_CMD)
1425  {
1426  idhdl h=(idhdl)data;
1427  l= (lists)(((idhdl)h->data.ustring)->data.ustring);
1428  }
1429  if (l!=NULL)
1430  {
1431  if ((0>=e->start)||(e->start>l->nr+1))
1432  return NULL;
1433  if (e->next!=NULL)
1434  {
1435  l->m[e->start-1].e=e->next;
1436  leftv r=l->m[e->start-1].LData();
1437  l->m[e->start-1].e=NULL;
1438  return r;
1439  }
1440  return &(l->m[e->start-1]);
1441  }
1442  }
1443  return this;
1444 }
#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: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: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:1407
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 1102 of file subexpr.cc.

1103 {
1104  lists l=NULL;
1105  int r;
1106  if (rtyp==LIST_CMD)
1107  l=(lists)data;
1108  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1109  l=IDLIST((idhdl)data);
1110  else
1111  return Typ();
1112  //if (l!=NULL)
1113  {
1114  if ((e!=NULL) && (e->next!=NULL))
1115  {
1116  if ((0<e->start)&&(e->start<=l->nr+1))
1117  {
1118  l->m[e->start-1].e=e->next;
1119  r=l->m[e->start-1].LTyp();
1120  l->m[e->start-1].e=NULL;
1121  }
1122  else
1123  {
1124  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1125  r=NONE;
1126  }
1127  return r;
1128  }
1129  return LIST_CMD;
1130  }
1131  return Typ();
1132 }
#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:996
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:1102
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:216
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  case CRING_CMD:
109  crPrint((coeffs)d);
110  break;
111 #ifdef SINGULAR_4_2
112  case CNUMBER_CMD:
113  n2Print((number2)d);
114  break;
115  case CPOLY_CMD:
116  p2Print((poly2)d);
117  break;
118  case CMATRIX_CMD: // like BIGINTMAT
119 #endif
120  case BIGINTMAT_CMD:
121  ((bigintmat *)d)->pprint(80);
122  break;
123  case UNKNOWN:
124  case DEF_CMD:
125  PrintNSpaces(spaces);
126  PrintS("`");PrintS(n);PrintS("`");
127  break;
128  case PACKAGE_CMD:
129  PrintNSpaces(spaces);
130  paPrint(n,(package)d);
131  break;
132  case LIB_CMD:
133  case NONE:
134  return;
135  case INTVEC_CMD:
136  case INTMAT_CMD:
137  ((intvec *)d)->show(t,spaces);
138  break;
139  case RING_CMD:
140  {
141  PrintNSpaces(spaces);
142  const ring r = (const ring)d;
143  rWrite(r, currRing == r);
144  break;
145  }
146  case MATRIX_CMD:
147  iiWriteMatrix((matrix)d,n,2, currRing, spaces);
148  break;
149  case MODUL_CMD:
150  case IDEAL_CMD:
151  if ((TEST_V_QRING) &&(currRing->qideal!=NULL)
152  &&(!hasFlag(this,FLAG_QRING)))
153  {
154  jjNormalizeQRingId(this);
155  d=Data();
156  }
157  // no break:
158  case MAP_CMD:
159  iiWriteMatrix((matrix)d,n,1, currRing, spaces);
160  break;
161  case POLY_CMD:
162  case VECTOR_CMD:
163  if ((e==NULL)
164  && (TEST_V_QRING)
165  &&(currRing->qideal!=NULL)
166  &&(!hasFlag(this,FLAG_QRING)))
167  {
168  setFlag(this,FLAG_QRING);
169  poly p=(poly)d;
171  if (p!=(poly)d)
172  {
173  d=(void*)p;
174  if ((rtyp==POLY_CMD)||(rtyp==VECTOR_CMD)) data=d;
175  else if (rtyp==IDHDL)
176  {
177  idhdl h=(idhdl)data;
178  IDPOLY(h)=p;
179  setFlag(h,FLAG_QRING);
180  }
181  }
182  }
183  PrintNSpaces(spaces);
184  pWrite0((poly)d);
185  break;
186  case RESOLUTION_CMD:
187  {
188  syStrategy tmp=(syStrategy)d;
189  syPrint(tmp,IDID(currRingHdl));
190  break;
191  }
192  case STRING_CMD:
193  PrintNSpaces(spaces);
194  PrintS((char *)d);
195  break;
196  case INT_CMD:
197  PrintNSpaces(spaces);
198  ::Print("%d",(int)(long)d);
199  break;
200  case PROC_CMD:
201  {
203 
204  PrintNSpaces(spaces);
205  PrintS("// libname : ");
206  PrintS(piProcinfo(pi, "libname"));
207  PrintLn();
208 
209  PrintNSpaces(spaces);
210  PrintS("// procname : ");
211  PrintS(piProcinfo(pi, "procname"));
212  PrintLn();
213 
214  PrintNSpaces(spaces);
215  PrintS("// type : ");
216  PrintS(piProcinfo(pi, "type"));
217  // ::Print("%-*.*s// ref : %s",spaces,spaces," ",
218  // piProcinfo(pi, "ref"));
219  break;
220  }
221  case LINK_CMD:
222  {
223  si_link l=(si_link)d;
224  PrintNSpaces(spaces);
225  ::Print("// type : %s\n", slStatus(l, "type"));
226  PrintNSpaces(spaces);
227  ::Print("// mode : %s\n", slStatus(l, "mode"));
228  PrintNSpaces(spaces);
229  ::Print("// name : %s\n", slStatus(l, "name"));
230  PrintNSpaces(spaces);
231  ::Print("// open : %s\n", slStatus(l, "open"));
232  PrintNSpaces(spaces);
233  ::Print("// read : %s\n", slStatus(l, "read"));
234  PrintNSpaces(spaces);
235  ::Print("// write: %s", slStatus(l, "write"));
236  break;
237  }
238  case BIGINT_CMD:
239  s=String(d);
240  if (s==NULL) return;
241  PrintNSpaces(spaces);
242  PrintS(s);
243  omFree((ADDRESS)s);
244  break;
245  case NUMBER_CMD:
246  {
247  number n=(number)d;
248  nNormalize(n);
249  if ((number)d !=n)
250  {
251  d=n;
252  if (rtyp==IDHDL) IDNUMBER(((idhdl)data))=n;
253  else if(rtyp==NUMBER_CMD) data=(void*)n;
254  }
255  s=String(d);
256  if (s==NULL) return;
257  PrintS(s);
258  omFree((ADDRESS)s);
259  break;
260  }
261  case LIST_CMD:
262  {
263  lists l=(lists)d;
264  if (lSize(l)<0)
265  {
266  PrintNSpaces(spaces);
267  PrintS("empty list\n");
268  }
269  else
270  {
271  int i=0;
272  for (;i<=l->nr;i++)
273  {
274  if (l->m[i].rtyp!=DEF_CMD)
275  {
276  PrintNSpaces(spaces);
277  ::Print("[%d]:\n",i+1);
278  l->m[i].Print(NULL,spaces+3);
279  }
280  }
281  }
282  break;
283  }
284 
285  default:
286  if (t>MAX_TOK)
287  {
288  blackbox * bb=getBlackboxStuff(t);
289  PrintNSpaces(spaces);
290  if (bb!=NULL) { bb->blackbox_Print(bb,d); }
291  else { ::Print("Print: blackbox %d(bb=NULL)",t); }
292  }
293  else
294  ::Print("Print:unknown type %s(%d)", Tok2Cmdname(t),t);
295  } /* end switch: (Typ()) */
296  if ((store!=NULL)&&(store!=this))
297  store->CleanUp();
298  }
299  if (next!=NULL)
300  {
301  if (t==COMMAND) PrintLn();
302  else if (t!=LIST_CMD) PrintS(" ");
303  next->Print(NULL,spaces);
304  }
305  else if (t!=LIST_CMD)
306  {
307  PrintLn();
308  }
309 #ifdef SIQ
310  if (rtyp!=COMMAND)
311 #endif
312  {
313  if ((store!=NULL)
314  && (store!=this))
315  {
316  if((t/*Typ()*/!=LINK_CMD)
317  && (t/*Typ()*/!=PACKAGE_CMD)
318  && (t/*Typ()*/!=DEF_CMD)
319  )
320  {
321  store->rtyp=t/*Typ()*/;
322  store->data=CopyD();
323  if(attribute!=NULL)
324  {
325  store->attribute=CopyA();
326  }
327  store->flag=flag;
328  }
329  }
330  }
331 }
ip_package * package
Definition: structs.h:46
const CanonicalForm int s
Definition: facAbsFact.cc:55
void jjNormalizeQRingP(poly &p)
Definition: ipassign.cc:2173
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:213
#define UNKNOWN
Definition: tok.h:217
void * ADDRESS
Definition: auxiliary.h:115
void * CopyD()
Definition: subexpr.h:120
void syPrint(syStrategy syzstr, const char *currRingName)
Definition: syz1.cc:1942
int Typ()
Definition: subexpr.cc:996
void pWrite0(poly p)
Definition: polys.h:291
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:752
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: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:744
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:6211
#define pi
Definition: libparse.cc:1143
void jjNormalizeQRingId(leftv I)
Definition: ipassign.cc:2138
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:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
void * Data()
Definition: subexpr.cc:1138
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: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 403 of file subexpr.cc.

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

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

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