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 84 of file subexpr.h.

Member Function Documentation

§ Attribute()

attr * sleftv::Attribute ( )

Definition at line 1376 of file subexpr.cc.

1377 {
1378  if (e==NULL) return &attribute;
1379  if ((rtyp==LIST_CMD)
1380  ||((rtyp==IDHDL)&&(IDTYP((idhdl)data)==LIST_CMD))
1381  || (rtyp>MAX_TOK)
1382  || ((rtyp==IDHDL)&&(IDTYP((idhdl)data)>MAX_TOK)))
1383  {
1384  leftv v=LData();
1385  return &(v->attribute);
1386  }
1387  return NULL;
1388 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
Subexpr e
Definition: subexpr.h:107
Definition: tok.h:213
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:90
#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:93
Definition: tok.h:116
attr attribute
Definition: subexpr.h:91
leftv LData()
Definition: subexpr.cc:1390

§ CleanUp()

void sleftv::CleanUp ( ring  r = currRing)

Definition at line 320 of file subexpr.cc.

321 {
322  if (rtyp!=IDHDL)
323  {
324  if ((name!=NULL) && (name!=sNoName) && (rtyp!=ALIAS_CMD))
325  {
326  //::Print("free %x (%s)\n",name,name);
327  omFree((ADDRESS)name);
328  }
329  //name=NULL;
330  //flag=0;
331  if (data!=NULL)
332  {
333  //if (rtyp==IDHDL) attribute=NULL; // is only a pointer to attribute of id
335  //data=NULL; // will be done by Init() at the end
336  }
337  if (attribute!=NULL)
338  {
339  switch (rtyp)
340  {
341  case PACKAGE_CMD:
342  //case IDHDL:
343  case ANY_TYPE:
344  case VECHO:
345  case VPRINTLEVEL:
346  case VCOLMAX:
347  case VTIMER:
348  case VRTIMER:
349  case VOICE:
350  case VMAXDEG:
351  case VMAXMULT:
352  case TRACE:
353  case VSHORTOUT:
354  case VNOETHER:
355  case VMINPOLY:
356  case LIB_CMD:
357  case 0:
358  //attribute=NULL; // will be done by Init() at the end
359  break;
360  default:
361  {
362  attribute->killAll(r);
363  }
364  }
365  }
366  }
367  Subexpr h;
368  while (e!=NULL)
369  {
370  h=e->next;
372  e=h;
373  }
374  //rtyp=NONE; // will be done by Init() at the end
375  if (next!=NULL)
376  {
377  leftv tmp_n;
378  do
379  {
380  tmp_n=next->next;
381  //next->name=NULL;
382  next->next=NULL;
383  next->CleanUp(r);
385  next=tmp_n;
386  } while (next!=NULL);
387  }
388  Init();
389 }
Definition: tok.h:207
Definition: tok.h:203
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
#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:107
omBin sleftv_bin
Definition: subexpr.cc:50
const char sNoName[]
Definition: subexpr.cc:56
void Init()
Definition: subexpr.h:109
void * ADDRESS
Definition: auxiliary.h:118
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:90
Definition: tok.h:208
const ring r
Definition: syzextra.cc:208
const char * name
Definition: subexpr.h:89
#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:482
Definition: tok.h:206
leftv next
Definition: subexpr.h:88
Definition: tok.h:34
Definition: tok.h:209
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:93
void CleanUp(ring r=currRing)
Definition: subexpr.cc:320
attr attribute
Definition: subexpr.h:91
#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 660 of file subexpr.cc.

661 {
662  Init();
663  rtyp=source->Typ();
664  void *d=source->Data();
665  if(!errorreported)
666  {
668  if ((source->attribute!=NULL)||(source->e!=NULL))
669  attribute=source->CopyA();
670  flag=source->flag;
671  if (source->next!=NULL)
672  {
674  next->Copy(source->next);
675  }
676  }
677 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
BITSET flag
Definition: subexpr.h:92
omBin sleftv_bin
Definition: subexpr.cc:50
void Init()
Definition: subexpr.h:109
sleftv * leftv
Definition: structs.h:60
void * data
Definition: subexpr.h:90
void * CopyA()
Definition: subexpr.cc:1941
void Copy(leftv e)
Definition: subexpr.cc:660
static void * s_internalCopy(const int t, void *d)
Definition: subexpr.cc:403
short errorreported
Definition: feFopen.cc:23
leftv next
Definition: subexpr.h:88
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:93
attr attribute
Definition: subexpr.h:91

§ CopyA()

attr sleftv::CopyA ( )

Definition at line 715 of file subexpr.cc.

716 {
717  attr *a=Attribute();
718  if ((a!=NULL) && (*a!=NULL))
719  return (*a)->Copy();
720  return NULL;
721 }
const poly a
Definition: syzextra.cc:212
Definition: attrib.h:15
attr * Attribute()
Definition: subexpr.cc:1376
#define NULL
Definition: omList.c:10

§ CopyD() [1/2]

void * sleftv::CopyD ( int  t)

Definition at line 679 of file subexpr.cc.

680 {
681  if ((rtyp!=IDHDL)&&(rtyp!=ALIAS_CMD)&&(e==NULL))
682  {
683  if (iiCheckRing(t)) return NULL;
684  void *x = data;
685  if (rtyp==VNOETHER) x = (void *)pCopy((currRing->ppNoether));
686  else if ((rtyp==VMINPOLY) && nCoeff_is_algExt(currRing->cf) && (!nCoeff_is_GF(currRing->cf)))
687  {
688  const ring A = currRing->cf->extRing;
689 
690  assume( A != NULL );
691  assume( A->qideal != NULL );
692 
693  x=(void *)p_Copy(A->qideal->m[0], A);
694  }
695  data=NULL;
696  return x;
697  }
698  void *d=Data(); // will also do a iiCheckRing
699  if ((!errorreported) && (d!=NULL)) return slInternalCopy(this,t,d,e);
700  return NULL;
701 }
void * slInternalCopy(leftv source, const int t, void *d, Subexpr e)
Definition: subexpr.cc:631
Subexpr e
Definition: subexpr.h:107
#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:90
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:1465
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
int rtyp
Definition: subexpr.h:93
void * Data()
Definition: subexpr.cc:1121
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

§ CopyD() [2/2]

void* sleftv::CopyD ( )
inline

Definition at line 121 of file subexpr.h.

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

§ Data()

void * sleftv::Data ( )

Definition at line 1121 of file subexpr.cc.

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

1745 {
1746  BOOLEAN nok=FALSE;
1747  leftv nn=next;
1748  next=NULL;
1749  if(rtyp==IDHDL)
1750  {
1751  int t=Typ();
1752  if (t!=PROC_CMD)
1753  {
1754  void *d=CopyD(t);
1755  data=d;
1756  rtyp=t;
1757  name=NULL;
1758  e=NULL;
1759  }
1760  }
1761  else if (rtyp==COMMAND)
1762  {
1763  command d=(command)data;
1764  if(d->op==PROC_CMD) //assume d->argc==2
1765  {
1766  char *what=(char *)(d->arg1.Data());
1767  idhdl h=ggetid(what);
1768  if((h!=NULL)&&(IDTYP(h)==PROC_CMD))
1769  {
1770  nok=d->arg2.Eval();
1771  if(!nok)
1772  {
1773  nok=iiMake_proc(h,req_packhdl,&d->arg2);
1774  this->CleanUp(currRing);
1775  if (!nok)
1776  {
1777  memcpy(this,&iiRETURNEXPR,sizeof(sleftv));
1778  memset(&iiRETURNEXPR,0,sizeof(sleftv));
1779  }
1780  }
1781  }
1782  else nok=TRUE;
1783  }
1784  else if (d->op=='=') //assume d->argc==2
1785  {
1786  if ((d->arg1.rtyp!=IDHDL)&&(d->arg1.rtyp!=DEF_CMD))
1787  {
1788  nok=d->arg1.Eval();
1789  }
1790  if (!nok)
1791  {
1792  const char *n=d->arg1.name;
1793  nok=(n == NULL) || d->arg2.Eval();
1794  if (!nok)
1795  {
1796  int save_typ=d->arg1.rtyp;
1797  omCheckAddr((ADDRESS)n);
1798  if (d->arg1.rtyp!=IDHDL)
1799  syMake(&d->arg1,n);
1800  omCheckAddr((ADDRESS)d->arg1.name);
1801  if (d->arg1.rtyp==IDHDL)
1802  {
1803  n=omStrDup(IDID((idhdl)d->arg1.data));
1804  killhdl((idhdl)d->arg1.data);
1805  d->arg1.Init();
1806  //d->arg1.data=NULL;
1807  d->arg1.name=n;
1808  }
1809  d->arg1.rtyp=DEF_CMD;
1810  sleftv t;
1811  if(save_typ!=PROC_CMD) save_typ=d->arg2.rtyp;
1812  if (::RingDependend(d->arg2.rtyp))
1813  nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&currRing->idroot);
1814  else
1815  nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&IDROOT);
1816  memcpy(&d->arg1,&t,sizeof(sleftv));
1817  omCheckAddr((ADDRESS)d->arg1.name);
1818  nok=nok||iiAssign(&d->arg1,&d->arg2);
1819  omCheckIf(d->arg1.name != NULL, // OB: ????
1820  omCheckAddr((ADDRESS)d->arg1.name));
1821  if (!nok)
1822  {
1823  memset(&d->arg1,0,sizeof(sleftv));
1824  this->CleanUp();
1825  rtyp=NONE;
1826  }
1827  }
1828  }
1829  else nok=TRUE;
1830  }
1831  else
1832  {
1833  sleftv tmp; tmp.Init();
1834  int toktype=iiTokType(d->op);
1835  if ((toktype==CMD_M)
1836  ||( toktype==ROOT_DECL_LIST)
1837  ||( toktype==RING_DECL_LIST))
1838  {
1839  if (d->argc <=3)
1840  {
1841  if (d->argc>=1) nok=d->arg1.Eval();
1842  if ((!nok) && (d->argc>=2))
1843  {
1844  nok=d->arg2.Eval();
1845  d->arg1.next=(leftv)omAllocBin(sleftv_bin);
1846  memcpy(d->arg1.next,&d->arg2,sizeof(sleftv));
1847  d->arg2.Init();
1848  }
1849  if ((!nok) && (d->argc==3))
1850  {
1851  nok=d->arg3.Eval();
1852  d->arg1.next->next=(leftv)omAllocBin(sleftv_bin);
1853  memcpy(d->arg1.next->next,&d->arg3,sizeof(sleftv));
1854  d->arg3.Init();
1855  }
1856  if (d->argc==0)
1857  nok=nok||iiExprArithM(&tmp,NULL,d->op);
1858  else
1859  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1860  }
1861  else
1862  {
1863  nok=d->arg1.Eval();
1864  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1865  }
1866  }
1867  else if (d->argc==1)
1868  {
1869  nok=d->arg1.Eval();
1870  nok=nok||iiExprArith1(&tmp,&d->arg1,d->op);
1871  }
1872  else if(d->argc==2)
1873  {
1874  nok=d->arg1.Eval();
1875  nok=nok||d->arg2.Eval();
1876  nok=nok||iiExprArith2(&tmp,&d->arg1,d->op,&d->arg2);
1877  }
1878  else if(d->argc==3)
1879  {
1880  nok=d->arg1.Eval();
1881  nok=nok||d->arg2.Eval();
1882  nok=nok||d->arg3.Eval();
1883  nok=nok||iiExprArith3(&tmp,d->op,&d->arg1,&d->arg2,&d->arg3);
1884  }
1885  else if(d->argc!=0)
1886  {
1887  nok=d->arg1.Eval();
1888  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1889  }
1890  else // d->argc == 0
1891  {
1892  nok = iiExprArithM(&tmp, NULL, d->op);
1893  }
1894  this->CleanUp();
1895  memcpy(this,&tmp,sizeof(tmp));
1896  }
1897  }
1898  else if (((rtyp==0)||(rtyp==DEF_CMD))
1899  &&(name!=NULL))
1900  {
1901  syMake(this,name);
1902  }
1903 #ifdef MDEBUG
1904  switch(Typ())
1905  {
1906  case NUMBER_CMD:
1907 #ifdef LDEBUG
1908  nTest((number)Data());
1909 #endif
1910  break;
1911  case BIGINT_CMD:
1912 #ifdef LDEBUG
1913  n_Test((number)Data(),coeffs_BIGINT);
1914 #endif
1915  break;
1916  case POLY_CMD:
1917  pTest((poly)Data());
1918  break;
1919  case IDEAL_CMD:
1920  case MODUL_CMD:
1921  case MATRIX_CMD:
1922  {
1923  ideal id=(ideal)Data();
1924  omCheckAddrSize(id,sizeof(*id));
1925  int i=id->ncols*id->nrows-1;
1926  for(;i>=0;i--) pTest(id->m[i]);
1927  }
1928  break;
1929  }
1930 #endif
1931  if (nn!=NULL) nok=nok||nn->Eval();
1932  next=nn;
1933  return nok;
1934 }
#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:84
int Eval()
Definition: subexpr.cc:1744
ip_command * command
Definition: ipid.h:24
Subexpr e
Definition: subexpr.h:107
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:8422
#define IDID(a)
Definition: ipid.h:119
#define FALSE
Definition: auxiliary.h:97
Definition: tok.h:38
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition: iparith.cc:8634
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:101
void Init()
Definition: subexpr.h:109
void * ADDRESS
Definition: auxiliary.h:118
void * CopyD()
Definition: subexpr.h:121
sleftv * leftv
Definition: structs.h:60
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition: iparith.cc:8722
coeffs coeffs_BIGINT
Definition: ipid.cc:54
int Typ()
Definition: subexpr.cc:979
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:90
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:391
#define nTest(a)
Definition: numbers.h:35
Definition: tok.h:57
const char * name
Definition: subexpr.h:89
#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:88
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1124
#define NULL
Definition: omList.c:10
package req_packhdl
Definition: subexpr.h:108
void killhdl(idhdl h, package proot)
Definition: ipid.cc:372
int rtyp
Definition: subexpr.h:93
void CleanUp(ring r=currRing)
Definition: subexpr.cc:320
void * Data()
Definition: subexpr.cc:1121
#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:88
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
Definition: iparith.cc:8235
#define NONE
Definition: tok.h:216
void syMake(leftv v, const char *id, package pa)
Definition: subexpr.cc:1484
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
Definition: ipid.cc:490
#define COMMAND
Definition: tok.h:29
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1780
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ Fullname()

const char* sleftv::Fullname ( )
inline

Definition at line 127 of file subexpr.h.

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

§ Init()

void sleftv::Init ( )
inline

Definition at line 109 of file subexpr.h.

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

§ LData()

leftv sleftv::LData ( )

Definition at line 1390 of file subexpr.cc.

1391 {
1392  if (e!=NULL)
1393  {
1394  lists l=NULL;
1395  blackbox *b=getBlackboxStuff(rtyp);
1396 
1397  if ((rtyp==LIST_CMD)
1398  || ((b!=NULL)&&(BB_LIKE_LIST(b))))
1399  l=(lists)data;
1400  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1401  l=IDLIST((idhdl)data);
1402  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)>MAX_TOK))
1403  {
1404  b=getBlackboxStuff(IDTYP((idhdl)data));
1405  if (BB_LIKE_LIST(b)) l=IDLIST((idhdl)data);
1406  }
1407  else if (rtyp==ALIAS_CMD)
1408  {
1409  idhdl h=(idhdl)data;
1410  l= (lists)(((idhdl)h->data.ustring)->data.ustring);
1411  }
1412  if (l!=NULL)
1413  {
1414  if ((0>=e->start)||(e->start>l->nr+1))
1415  return NULL;
1416  if (e->next!=NULL)
1417  {
1418  l->m[e->start-1].e=e->next;
1419  leftv r=l->m[e->start-1].LData();
1420  l->m[e->start-1].e=NULL;
1421  return r;
1422  }
1423  return &(l->m[e->start-1]);
1424  }
1425  }
1426  return this;
1427 }
#define IDLIST(a)
Definition: ipid.h:134
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
Subexpr e
Definition: subexpr.h:107
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:90
#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:93
Definition: tok.h:116
static Poly * h
Definition: janet.cc:978
const poly b
Definition: syzextra.cc:213
leftv LData()
Definition: subexpr.cc:1390
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:84
leftv next
Definition: subexpr.h:88
#define NULL
Definition: omList.c:10

§ LTyp()

int sleftv::LTyp ( )

Definition at line 1085 of file subexpr.cc.

1086 {
1087  lists l=NULL;
1088  int r;
1089  if (rtyp==LIST_CMD)
1090  l=(lists)data;
1091  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1092  l=IDLIST((idhdl)data);
1093  else
1094  return Typ();
1095  //if (l!=NULL)
1096  {
1097  if ((e!=NULL) && (e->next!=NULL))
1098  {
1099  if ((0<e->start)&&(e->start<=l->nr+1))
1100  {
1101  l->m[e->start-1].e=e->next;
1102  r=l->m[e->start-1].LTyp();
1103  l->m[e->start-1].e=NULL;
1104  }
1105  else
1106  {
1107  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1108  r=NONE;
1109  }
1110  return r;
1111  }
1112  return LIST_CMD;
1113  }
1114  return Typ();
1115 }
#define IDLIST(a)
Definition: ipid.h:134
sleftv * m
Definition: lists.h:45
Subexpr e
Definition: subexpr.h:107
Definition: lists.h:22
int Typ()
Definition: subexpr.cc:979
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:90
#define IDTYP(a)
Definition: ipid.h:116
const ring r
Definition: syzextra.cc:208
int LTyp()
Definition: subexpr.cc:1085
int nr
Definition: lists.h:43
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:93
Definition: tok.h:116
#define NONE
Definition: tok.h:216
int l
Definition: cfEzgcd.cc:94

§ Name()

const char* sleftv::Name ( )
inline

Definition at line 122 of file subexpr.h.

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

§ Next()

leftv sleftv::Next ( )
inline

Definition at line 138 of file subexpr.h.

138 { return next; }
leftv next
Definition: subexpr.h:88

§ 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  case CNUMBER_CMD:
113  n2Print((number2)d);
114  break;
115  case CMATRIX_CMD: // like BIGINTMAT
116 #endif
117  case BIGINTMAT_CMD:
118  ((bigintmat *)d)->pprint(80);
119  break;
120  case UNKNOWN:
121  case DEF_CMD:
122  PrintNSpaces(spaces);
123  PrintS("`");PrintS(n);PrintS("`");
124  break;
125  case PACKAGE_CMD:
126  PrintNSpaces(spaces);
127  paPrint(n,(package)d);
128  break;
129  case NONE:
130  return;
131  case INTVEC_CMD:
132  case INTMAT_CMD:
133  ((intvec *)d)->show(t,spaces);
134  break;
135  case RING_CMD:
136  {
137  PrintNSpaces(spaces);
138  const ring r = (const ring)d;
139  rWrite(r, currRing == r);
140  break;
141  }
142  case MATRIX_CMD:
143  iiWriteMatrix((matrix)d,n,2, currRing, spaces);
144  break;
145  case MODUL_CMD:
146  case IDEAL_CMD:
147  if ((TEST_V_QRING) &&(currRing->qideal!=NULL)
148  &&(!hasFlag(this,FLAG_QRING)))
149  {
150  jjNormalizeQRingId(this);
151  d=Data();
152  }
153  // no break:
154  case MAP_CMD:
155  iiWriteMatrix((matrix)d,n,1, currRing, spaces);
156  break;
157  case POLY_CMD:
158  case VECTOR_CMD:
159  if ((e==NULL)
160  && (TEST_V_QRING)
161  &&(currRing->qideal!=NULL)
162  &&(!hasFlag(this,FLAG_QRING)))
163  {
164  setFlag(this,FLAG_QRING);
165  poly p=(poly)d;
167  if (p!=(poly)d)
168  {
169  d=(void*)p;
170  if ((rtyp==POLY_CMD)||(rtyp==VECTOR_CMD)) data=d;
171  else if (rtyp==IDHDL)
172  {
173  idhdl h=(idhdl)data;
174  IDPOLY(h)=p;
175  setFlag(h,FLAG_QRING);
176  }
177  }
178  }
179  PrintNSpaces(spaces);
180  pWrite0((poly)d);
181  break;
182  case RESOLUTION_CMD:
183  {
184  syStrategy tmp=(syStrategy)d;
185  syPrint(tmp,IDID(currRingHdl));
186  break;
187  }
188  case STRING_CMD:
189  PrintNSpaces(spaces);
190  PrintS((char *)d);
191  break;
192  case INT_CMD:
193  PrintNSpaces(spaces);
194  ::Print("%d",(int)(long)d);
195  break;
196  case PROC_CMD:
197  {
199 
200  PrintNSpaces(spaces);
201  PrintS("// libname : ");
202  PrintS(piProcinfo(pi, "libname"));
203  PrintLn();
204 
205  PrintNSpaces(spaces);
206  PrintS("// procname : ");
207  PrintS(piProcinfo(pi, "procname"));
208  PrintLn();
209 
210  PrintNSpaces(spaces);
211  PrintS("// type : ");
212  PrintS(piProcinfo(pi, "type"));
213  // ::Print("%-*.*s// ref : %s",spaces,spaces," ",
214  // piProcinfo(pi, "ref"));
215  break;
216  }
217  case LINK_CMD:
218  {
219  si_link l=(si_link)d;
220  PrintNSpaces(spaces);
221  ::Print("// type : %s\n", slStatus(l, "type"));
222  PrintNSpaces(spaces);
223  ::Print("// mode : %s\n", slStatus(l, "mode"));
224  PrintNSpaces(spaces);
225  ::Print("// name : %s\n", slStatus(l, "name"));
226  PrintNSpaces(spaces);
227  ::Print("// open : %s\n", slStatus(l, "open"));
228  PrintNSpaces(spaces);
229  ::Print("// read : %s\n", slStatus(l, "read"));
230  PrintNSpaces(spaces);
231  ::Print("// write: %s", slStatus(l, "write"));
232  break;
233  }
234  case NUMBER_CMD:
235  case BIGINT_CMD:
236  if (t==NUMBER_CMD)
237  {
238  number n=(number)d;
239  nNormalize(n);
240  d=n;
241  }
242  s=String(d);
243  if (s==NULL) return;
244  PrintNSpaces(spaces);
245  PrintS(s);
246  omFree((ADDRESS)s);
247  break;
248  case LIST_CMD:
249  {
250  lists l=(lists)d;
251  if (lSize(l)<0)
252  {
253  PrintNSpaces(spaces);
254  PrintS("empty list\n");
255  }
256  else
257  {
258  int i=0;
259  for (;i<=l->nr;i++)
260  {
261  if (l->m[i].rtyp!=DEF_CMD)
262  {
263  PrintNSpaces(spaces);
264  ::Print("[%d]:\n",i+1);
265  l->m[i].Print(NULL,spaces+3);
266  }
267  }
268  }
269  break;
270  }
271 
272  default:
273  if (t>MAX_TOK)
274  {
275  blackbox * bb=getBlackboxStuff(t);
276  PrintNSpaces(spaces);
277  if (bb!=NULL) { bb->blackbox_Print(bb,d); }
278  else { ::Print("Print: blackbox %d(bb=NULL)",t); }
279  }
280  else
281  ::Print("Print:unknown type %s(%d)", Tok2Cmdname(t),t);
282  } /* end switch: (Typ()) */
283  if ((store!=NULL)&&(store!=this))
284  store->CleanUp();
285  }
286  if (next!=NULL)
287  {
288  if (t==COMMAND) PrintLn();
289  else if (t!=LIST_CMD) PrintS(" ");
290  next->Print(NULL,spaces);
291  }
292  else if (t!=LIST_CMD)
293  {
294  PrintLn();
295  }
296 #ifdef SIQ
297  if (rtyp!=COMMAND)
298 #endif
299  {
300  if ((store!=NULL)
301  && (store!=this))
302  {
303  if((t/*Typ()*/!=LINK_CMD)
304  && (t/*Typ()*/!=PACKAGE_CMD)
305  && (t/*Typ()*/!=DEF_CMD)
306  )
307  {
308  store->rtyp=t/*Typ()*/;
309  store->data=CopyD();
310  if(attribute!=NULL)
311  {
312  store->attribute=CopyA();
313  }
314  store->flag=flag;
315  }
316  }
317  }
318 }
void n2Print(number2 d)
Definition: number2.cc:311
ip_package * package
Definition: structs.h:46
const CanonicalForm int s
Definition: facAbsFact.cc:55
void jjNormalizeQRingP(poly &p)
Definition: ipassign.cc:2160
sleftv * m
Definition: lists.h:45
ip_command * command
Definition: ipid.h:24
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
Definition: tok.h:94
Subexpr e
Definition: subexpr.h:107
BITSET flag
Definition: subexpr.h:92
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:118
void * CopyD()
Definition: subexpr.h:121
void syPrint(syStrategy syzstr, const char *currRingName)
Definition: syz1.cc:1945
int Typ()
Definition: subexpr.cc:979
void pWrite0(poly p)
Definition: polys.h:292
const char * Name()
Definition: subexpr.h:122
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:739
char * String(void *d=NULL, BOOLEAN typed=FALSE, int dim=1)
Called for conversion to string (used by string(..), write(..),..)
Definition: subexpr.cc:723
void * data
Definition: subexpr.h:90
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: tok.h:55
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
const char * iiTwoOps(int t)
Definition: gentable.cc:252
const char * piProcinfo(procinfov pi, const char *request)
Definition: ipid.cc:623
Definition: tok.h:57
#define omFree(addr)
Definition: omAllocDecl.h:261
The main handler for Singular numbers which are suitable for Singular polynomials.
attr CopyA()
Definition: subexpr.cc:715
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
Definition: tok.h:99
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:88
void paPrint(const char *n, package p)
Definition: ipshell.cc:6229
#define pi
Definition: libparse.cc:1143
void jjNormalizeQRingId(leftv I)
Definition: ipassign.cc:2125
int nr
Definition: lists.h:43
Definition: tok.h:115
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
#define IDPOLY(a)
Definition: ipid.h:127
#define hasFlag(A, F)
Definition: ipid.h:109
int rtyp
Definition: subexpr.h:93
void CleanUp(ring r=currRing)
Definition: subexpr.cc:320
void * Data()
Definition: subexpr.cc:1121
Definition: tok.h:116
attr attribute
Definition: subexpr.h:91
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 391 of file subexpr.cc.

392 {
393  int rt=Typ();
394  if(::RingDependend(rt))
395  return TRUE;
396  if (rt==LIST_CMD)
397  return lRingDependend((lists)Data());
398  if (this->next!=NULL)
399  return this->next->RingDependend();
400  return FALSE;
401 }
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
int Typ()
Definition: subexpr.cc:979
BOOLEAN RingDependend()
Definition: subexpr.cc:391
leftv next
Definition: subexpr.h:88
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1121
Definition: tok.h:116
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 723 of file subexpr.cc.

724 {
725 #ifdef SIQ
726  if (rtyp==COMMAND)
727  {
728  ::Print("##command %d\n",((command)data)->op);
729  if (((command)data)->arg1.rtyp!=0)
730  ((command)data)->arg1.Print(NULL,2);
731  if (((command)data)->arg2.rtyp!=0)
732  ((command)data)->arg2.Print(NULL,2);
733  if (((command)data)->arg3.rtyp==0)
734  ((command)data)->arg3.Print(NULL,2);
735  PrintS("##end\n");
736  return omStrDup("");
737  }
738 #endif
739  if (d==NULL) d=Data();
740  if (!errorreported)
741  {
742  char *s;
743  int t=Typ();
744  switch (t /*Typ()*/)
745  {
746  case INT_CMD:
747  if (typed)
748  {
749  s=(char *)omAlloc(MAX_INT_LEN+7);
750  sprintf(s,"int(%d)",(int)(long)d);
751  }
752  else
753  {
754  s=(char *)omAlloc(MAX_INT_LEN+2);
755  sprintf(s,"%d",(int)(long)d);
756  }
757  return s;
758 
759  case STRING_CMD:
760  if (d == NULL)
761  {
762  if (typed) return omStrDup("\"\"");
763  return omStrDup("");
764  }
765  if (typed)
766  {
767  s = (char*) omAlloc(strlen((char*) d) + 3);
768  sprintf(s,"\"%s\"", (char*) d);
769  return s;
770  }
771  else
772  {
773  return omStrDup((char*)d);
774  }
775 
776  case POLY_CMD:
777  case VECTOR_CMD:
778  if (typed)
779  {
780  char* ps = pString((poly) d);
781  s = (char*) omAlloc(strlen(ps) + 10);
782  sprintf(s,"%s(%s)", (t /*Typ()*/ == POLY_CMD ? "poly" : "vector"), ps);
783  omFree(ps);
784  return s;
785  }
786  else
787  return pString((poly)d);
788 
789  #ifdef SINGULAR_4_1
790  case CNUMBER_CMD:
791  return n2String((number2)d,typed);
792  case CRING_CMD:
793  return nCoeffString((coeffs)d);
794  case CMATRIX_CMD:
795  {
796  bigintmat *b=(bigintmat*)d;
797  return b->String();
798  }
799  #endif
800 
801  case NUMBER_CMD:
802  StringSetS((char*) (typed ? "number(" : ""));
803  if ((rtyp==IDHDL)&&(IDTYP((idhdl)data)==NUMBER_CMD))
804  {
805  nWrite(IDNUMBER((idhdl)data));
806  }
807  else if (rtyp==NUMBER_CMD)
808  {
809  number n=(number)data;
810  nWrite(n);
811  data=(char *)n;
812  }
813  else if((rtyp==VMINPOLY)&&(rField_is_GF(currRing)))
814  {
815  nfShowMipo(currRing->cf);
816  }
817  else
818  {
819  number n=nCopy((number)d);
820  nWrite(n);
821  nDelete(&n);
822  }
823  StringAppendS((char*) (typed ? ")" : ""));
824  return StringEndS();
825 
826  case BIGINT_CMD:
827  {
828  StringSetS((char*) (typed ? "bigint(" : ""));
829  number nl=(number)d;
831  StringAppendS((char*) (typed ? ")" : ""));
832  return StringEndS();
833  }
834 
835  case MATRIX_CMD:
837  if (typed)
838  {
839  char* ns = (char*) omAlloc(strlen(s) + 40);
840  sprintf(ns, "matrix(ideal(%s),%d,%d)", s,
841  ((ideal) d)->nrows, ((ideal) d)->ncols);
842  omCheckAddr(ns);
843  return ns;
844  }
845  else
846  {
847  return omStrDup(s);
848  }
849 
850  case MODUL_CMD:
851  case IDEAL_CMD:
852  case MAP_CMD:
854  if (typed)
855  {
856  char* ns = (char*) omAlloc(strlen(s) + 10);
857  sprintf(ns, "%s(%s)", (t/*Typ()*/==MODUL_CMD ? "module" : "ideal"), s);
858  omCheckAddr(ns);
859  return ns;
860  }
861  return omStrDup(s);
862 
863  case INTVEC_CMD:
864  case INTMAT_CMD:
865  {
866  intvec *v=(intvec *)d;
867  s = v->String(dim);
868  if (typed)
869  {
870  char* ns;
871  if (t/*Typ()*/ == INTMAT_CMD)
872  {
873  ns = (char*) omAlloc(strlen(s) + 40);
874  sprintf(ns, "intmat(intvec(%s),%d,%d)", s, v->rows(), v->cols());
875  }
876  else
877  {
878  ns = (char*) omAlloc(strlen(s) + 10);
879  sprintf(ns, "intvec(%s)", s);
880  }
881  omCheckAddr(ns);
882  omFree(s);
883  return ns;
884  }
885  else
886  return s;
887  }
888  case BIGINTMAT_CMD:
889  {
890  bigintmat *bim=(bigintmat*)d;
891  s = bim->String();
892  if (typed)
893  {
894  char* ns = (char*) omAlloc0(strlen(s) + 40);
895  sprintf(ns, "bigintmat(bigintvec(%s),%d,%d)", s, bim->rows(), bim->cols());
896  omCheckAddr(ns);
897  return ns;
898  }
899  else
900  return omStrDup(s);
901  }
902 
903  case RING_CMD:
904  s = rString((ring)d);
905 
906  if (typed)
907  {
908  char* ns;
909  ring r=(ring)d;
910  if (r->qideal!=NULL)
911  {
912  char* id = iiStringMatrix((matrix) ((ring) d)->qideal, dim,
913  currRing);
914  ns = (char*) omAlloc(strlen(s) + strlen(id) + 20);
915  sprintf(ns, "\"%s\";%sideal(%s)", s,(dim == 2 ? "\n" : " "), id);
916  }
917  else
918  {
919  ns = (char*) omAlloc(strlen(s) + 4);
920  sprintf(ns, "\"%s\"", s);
921  }
922  omFree(s);
923  omCheckAddr(ns);
924  return ns;
925  }
926  return s;
927  case RESOLUTION_CMD:
928  {
929  lists l = syConvRes((syStrategy)d);
930  s = lString(l, typed, dim);
931  l->Clean();
932  return s;
933  }
934 
935  case PROC_CMD:
936  {
937  procinfo* pi = (procinfo*) d;
938  if((pi->language == LANG_SINGULAR) && (pi->data.s.body!=NULL))
939  s = (pi->data.s.body);
940  else
941  s = (char *)"";
942  if (typed)
943  {
944  char* ns = (char*) omAlloc(strlen(s) + 4);
945  sprintf(ns, "\"%s\"", s);
946  omCheckAddr(ns);
947  return ns;
948  }
949  return omStrDup(s);
950  }
951 
952  case LINK_CMD:
953  s = slString((si_link) d);
954  if (typed)
955  {
956  char* ns = (char*) omAlloc(strlen(s) + 10);
957  sprintf(ns, "link(\"%s\")", s);
958  omFreeBinAddr(s);
959  omCheckAddr(ns);
960  return ns;
961  }
962  return s;
963 
964  case LIST_CMD:
965  return lString((lists) d, typed, dim);
966 
967  default:
968  if(t> MAX_TOK)
969  {
970  blackbox *bb=getBlackboxStuff(t);
971  if (bb!=NULL) return bb->blackbox_String(bb,d);
972  }
973  } /* end switch: (Typ()) */
974  }
975  return omStrDup("");
976 }
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:94
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:3088
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:59
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:979
#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
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:90
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
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:55
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
procinfodata data
Definition: subexpr.h:63
static FORCE_INLINE void n_Write(number &n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition: coeffs.h:595
int cols() const
Definition: bigintmat.h:145
int dim(ideal I, ring r)
void PrintS(const char *s)
Definition: reporter.cc:284
Definition: tok.h:99
#define nDelete(n)
Definition: numbers.h:16
short errorreported
Definition: feFopen.cc:23
#define IDNUMBER(a)
Definition: ipid.h:129
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:115
#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:93
#define nCopy(n)
Definition: numbers.h:15
void Clean(ring r=currRing)
Definition: lists.h:25
void * Data()
Definition: subexpr.cc:1121
Definition: tok.h:116
#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:760
const poly b
Definition: syzextra.cc:213
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
char * n2String(number2 d, BOOLEAN typed)
Definition: number2.cc:298
#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 979 of file subexpr.cc.

980 {
981  if (e==NULL)
982  {
983  switch (rtyp)
984  {
985  case IDHDL:
986  return IDTYP((idhdl)data);
987  case ALIAS_CMD:
988  {
989  idhdl h=(idhdl)data;
990  return ((idhdl)h->data.ustring)->typ;
991  }
992  case VECHO:
993  case VPRINTLEVEL:
994  case VCOLMAX:
995  case VTIMER:
996  case VRTIMER:
997  case VOICE:
998  case VMAXDEG:
999  case VMAXMULT:
1000  case TRACE:
1001  case VSHORTOUT:
1002  return INT_CMD;
1003  case VMINPOLY:
1004  data=NULL;
1005  return NUMBER_CMD;
1006  case VNOETHER:
1007  data=NULL;
1008  return POLY_CMD;
1009  //case COMMAND:
1010  // return COMMAND;
1011  default:
1012  return rtyp;
1013  }
1014  }
1015  int r=0;
1016  int t=rtyp;
1017  void *d=data;
1018  if (t==IDHDL) t=IDTYP((idhdl)d);
1019  else if (t==ALIAS_CMD)
1020  { idhdl h=(idhdl)IDDATA((idhdl)data); t=IDTYP(h);d=IDDATA(h); }
1021  switch (t)
1022  {
1023 #ifdef SINGULAR_4_1
1024  case CMATRIX_CMD:
1025  {
1026  bigintmat *b=(bigintmat*)d;
1027  if ((currRing!=NULL)&&(currRing->cf==b->basecoeffs()))
1028  return NUMBER_CMD;
1029  else
1030  return CNUMBER_CMD;
1031  }
1032 #endif
1033  case INTVEC_CMD:
1034  case INTMAT_CMD:
1035  r=INT_CMD;
1036  break;
1037  case BIGINTMAT_CMD:
1038  r=BIGINT_CMD;
1039  break;
1040  case IDEAL_CMD:
1041  case MATRIX_CMD:
1042  case MAP_CMD:
1043  r=POLY_CMD;
1044  break;
1045  case MODUL_CMD:
1046  r=VECTOR_CMD;
1047  break;
1048  case STRING_CMD:
1049  r=STRING_CMD;
1050  break;
1051  default:
1052  {
1053  blackbox *b=NULL;
1054  if (t>MAX_TOK)
1055  {
1056  b=getBlackboxStuff(t);
1057  }
1058  if ((t==LIST_CMD)||((b!=NULL)&&BB_LIKE_LIST(b)))
1059  {
1060  lists l;
1061  if (rtyp==IDHDL) l=IDLIST((idhdl)d);
1062  else l=(lists)d;
1063  if ((0<e->start)&&(e->start<=l->nr+1))
1064  {
1065  Subexpr tmp=l->m[e->start-1].e;
1066  l->m[e->start-1].e=e->next;
1067  r=l->m[e->start-1].Typ();
1068  e->next=l->m[e->start-1].e;
1069  l->m[e->start-1].e=tmp;
1070  }
1071  else
1072  {
1073  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1074  r=DEF_CMD;
1075  }
1076  }
1077  else
1078  Werror("cannot index type %s(%d)",Tok2Cmdname(t),t);
1079  break;
1080  }
1081  }
1082  return r;
1083 }
#define IDLIST(a)
Definition: ipid.h:134
Definition: tok.h:207
Definition: tok.h:203
sleftv * m
Definition: lists.h:45
Definition: tok.h:94
Definition: tok.h:204
Subexpr e
Definition: subexpr.h:107
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:979
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:90
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:57
idrec * idhdl
Definition: ring.h:18
Definition: tok.h:206
Definition: tok.h:99
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:128
coeffs basecoeffs() const
Definition: bigintmat.h:147
int rtyp
Definition: subexpr.h:93
Definition: tok.h:116
#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 91 of file subexpr.h.

§ data

void* sleftv::data

Definition at line 90 of file subexpr.h.

§ e

Subexpr sleftv::e

Definition at line 107 of file subexpr.h.

§ flag

BITSET sleftv::flag

Definition at line 92 of file subexpr.h.

§ name

const char* sleftv::name

Definition at line 89 of file subexpr.h.

§ next

leftv sleftv::next

Definition at line 88 of file subexpr.h.

§ req_packhdl

package sleftv::req_packhdl

Definition at line 108 of file subexpr.h.

§ rtyp

int sleftv::rtyp

Definition at line 93 of file subexpr.h.


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