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

attr * sleftv::Attribute ( )

Definition at line 1373 of file subexpr.cc.

1374 {
1375  if (e==NULL) return &attribute;
1376  if ((rtyp==LIST_CMD)
1377  ||((rtyp==IDHDL)&&(IDTYP((idhdl)data)==LIST_CMD))
1378  || (rtyp>MAX_TOK)
1379  || ((rtyp==IDHDL)&&(IDTYP((idhdl)data)>MAX_TOK)))
1380  {
1381  leftv v=LData();
1382  return &(v->attribute);
1383  }
1384  return NULL;
1385 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Subexpr e
Definition: subexpr.h:106
Definition: tok.h:217
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
#define IDTYP(a)
Definition: ipid.h:118
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:120
attr attribute
Definition: subexpr.h:90
leftv LData()
Definition: subexpr.cc:1387
void sleftv::CleanUp ( ring  r = currRing)

Definition at line 321 of file subexpr.cc.

322 {
323  if ((name!=NULL) && (name!=sNoName) && (rtyp!=IDHDL) && (rtyp!=ALIAS_CMD))
324  {
325  //::Print("free %x (%s)\n",name,name);
326  omFree((ADDRESS)name);
327  }
328  //name=NULL;
329  //flag=0;
330  if (data!=NULL)
331  {
332  if (rtyp==IDHDL) attribute=NULL; // is only a pointer to attribute of id
333  else s_internalDelete(rtyp,data,r);
334  //data=NULL; // will be done by Init() at the end
335  }
336  if (attribute!=NULL)
337  {
338  switch (rtyp)
339  {
340  case PACKAGE_CMD:
341  case IDHDL:
342  case ANY_TYPE:
343  case VECHO:
344  case VPRINTLEVEL:
345  case VCOLMAX:
346  case VTIMER:
347  case VRTIMER:
348  case VOICE:
349  case VMAXDEG:
350  case VMAXMULT:
351  case TRACE:
352  case VSHORTOUT:
353  case VNOETHER:
354  case VMINPOLY:
355  case LIB_CMD:
356  case 0:
357  //attribute=NULL; // will be done by Init() at the end
358  break;
359  default:
360  {
361  attribute->killAll(r);
362  }
363  }
364  }
365  Subexpr h;
366  while (e!=NULL)
367  {
368  h=e->next;
370  e=h;
371  }
372  //rtyp=NONE; // will be done by Init() at the end
373  if (next!=NULL)
374  {
375  leftv tmp_n;
376  do
377  {
378  tmp_n=next->next;
379  //next->name=NULL;
380  next->next=NULL;
381  next->CleanUp(r);
383  next=tmp_n;
384  } while (next!=NULL);
385  }
386  Init();
387 }
Definition: tok.h:211
Definition: tok.h:207
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define ANY_TYPE
Definition: tok.h:34
Definition: tok.h:208
void killAll(const ring r)
Definition: attrib.cc:196
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:161
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
Definition: tok.h:212
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:478
Definition: tok.h:210
leftv next
Definition: subexpr.h:87
Definition: tok.h:38
Definition: tok.h:213
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:321
attr attribute
Definition: subexpr.h:90
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
Definition: tok.h:209
static Poly * h
Definition: janet.cc:978
void sleftv::Copy ( leftv  e)

Definition at line 657 of file subexpr.cc.

658 {
659  Init();
660  rtyp=source->Typ();
661  void *d=source->Data();
662  if(!errorreported)
663  {
665  if ((source->attribute!=NULL)||(source->e!=NULL))
666  attribute=source->CopyA();
667  flag=source->flag;
668  if (source->next!=NULL)
669  {
671  next->Copy(source->next);
672  }
673  }
674 }
#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:1938
void Copy(leftv e)
Definition: subexpr.cc:657
static void * s_internalCopy(const int t, void *d)
Definition: subexpr.cc:401
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
attr sleftv::CopyA ( )

Definition at line 712 of file subexpr.cc.

713 {
714  attr *a=Attribute();
715  if ((a!=NULL) && (*a!=NULL))
716  return (*a)->Copy();
717  return NULL;
718 }
const poly a
Definition: syzextra.cc:212
Definition: attrib.h:15
attr * Attribute()
Definition: subexpr.cc:1373
#define NULL
Definition: omList.c:10
void * sleftv::CopyD ( int  t)

Definition at line 676 of file subexpr.cc.

677 {
678  if ((rtyp!=IDHDL)&&(rtyp!=ALIAS_CMD)&&(e==NULL))
679  {
680  if (iiCheckRing(t)) return NULL;
681  void *x = data;
682  if (rtyp==VNOETHER) x = (void *)pCopy((currRing->ppNoether));
683  else if ((rtyp==VMINPOLY) && nCoeff_is_algExt(currRing->cf) && (!nCoeff_is_GF(currRing->cf)))
684  {
685  const ring A = currRing->cf->extRing;
686 
687  assume( A != NULL );
688  assume( A->qideal != NULL );
689 
690  x=(void *)p_Copy(A->qideal->m[0], A);
691  }
692  data=NULL;
693  return x;
694  }
695  void *d=Data(); // will also do a iiCheckRing
696  if ((!errorreported) && (d!=NULL)) return slInternalCopy(this,t,d,e);
697  return NULL;
698 }
void * slInternalCopy(leftv source, const int t, void *d, Subexpr e)
Definition: subexpr.cc:628
Subexpr e
Definition: subexpr.h:106
#define IDHDL
Definition: tok.h:35
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:810
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:12
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:913
#define assume(x)
Definition: mod2.h:405
#define A
Definition: sirandom.c:23
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:842
short errorreported
Definition: feFopen.cc:23
Definition: tok.h:38
BOOLEAN iiCheckRing(int i)
Definition: ipshell.cc:1472
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1118
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
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:976
void * sleftv::Data ( )

Definition at line 1118 of file subexpr.cc.

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

Definition at line 1741 of file subexpr.cc.

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

Definition at line 108 of file subexpr.h.

108 { memset(this,0,sizeof(*this)); }
leftv sleftv::LData ( )

Definition at line 1387 of file subexpr.cc.

1388 {
1389  if (e!=NULL)
1390  {
1391  lists l=NULL;
1392  blackbox *b=getBlackboxStuff(rtyp);
1393 
1394  if ((rtyp==LIST_CMD)
1395  || ((b!=NULL)&&(BB_LIKE_LIST(b))))
1396  l=(lists)data;
1397  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1398  l=IDLIST((idhdl)data);
1399  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)>MAX_TOK))
1400  {
1401  b=getBlackboxStuff(IDTYP((idhdl)data));
1402  if (BB_LIKE_LIST(b)) l=IDLIST((idhdl)data);
1403  }
1404  else if (rtyp==ALIAS_CMD)
1405  {
1406  idhdl h=(idhdl)data;
1407  l= (lists)(((idhdl)h->data.ustring)->data.ustring);
1408  }
1409  if (l!=NULL)
1410  {
1411  if ((0>=e->start)||(e->start>l->nr+1))
1412  return NULL;
1413  if (e->next!=NULL)
1414  {
1415  l->m[e->start-1].e=e->next;
1416  leftv r=l->m[e->start-1].LData();
1417  l->m[e->start-1].e=NULL;
1418  return r;
1419  }
1420  return &(l->m[e->start-1]);
1421  }
1422  }
1423  return this;
1424 }
#define IDLIST(a)
Definition: ipid.h:136
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:217
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
#define IDTYP(a)
Definition: ipid.h:118
const ring r
Definition: syzextra.cc:208
idrec * idhdl
Definition: ring.h:18
Definition: tok.h:38
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:120
static Poly * h
Definition: janet.cc:978
const poly b
Definition: syzextra.cc:213
leftv LData()
Definition: subexpr.cc:1387
int l
Definition: cfEzgcd.cc:94
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
utypes data
Definition: idrec.h:40
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
int sleftv::LTyp ( )

Definition at line 1082 of file subexpr.cc.

1083 {
1084  lists l=NULL;
1085  int r;
1086  if (rtyp==LIST_CMD)
1087  l=(lists)data;
1088  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1089  l=IDLIST((idhdl)data);
1090  else
1091  return Typ();
1092  //if (l!=NULL)
1093  {
1094  if ((e!=NULL) && (e->next!=NULL))
1095  {
1096  if ((0<e->start)&&(e->start<=l->nr+1))
1097  {
1098  l->m[e->start-1].e=e->next;
1099  r=l->m[e->start-1].LTyp();
1100  l->m[e->start-1].e=NULL;
1101  }
1102  else
1103  {
1104  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1105  r=NONE;
1106  }
1107  return r;
1108  }
1109  return LIST_CMD;
1110  }
1111  return Typ();
1112 }
#define IDLIST(a)
Definition: ipid.h:136
sleftv * m
Definition: lists.h:45
Subexpr e
Definition: subexpr.h:106
Definition: lists.h:22
int Typ()
Definition: subexpr.cc:976
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
#define IDTYP(a)
Definition: ipid.h:118
const ring r
Definition: syzextra.cc:208
int LTyp()
Definition: subexpr.cc:1082
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:120
#define NONE
Definition: tok.h:220
int l
Definition: cfEzgcd.cc:94
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
leftv sleftv::Next ( )
inline

Definition at line 137 of file subexpr.h.

137 { return next; }
leftv next
Definition: subexpr.h:87
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  if ((store!=NULL)&&(store!=this))
106  store->CleanUp();
107 
108  switch (t /*=Typ()*/)
109  {
110 #ifdef SINGULAR_4_1
111  case CRING_CMD:
112  crPrint((coeffs)d);
113  break;
114  case CNUMBER_CMD:
115  n2Print((number2)d);
116  break;
117  case CMATRIX_CMD: // like BIGINTMAT
118 #endif
119  case BIGINTMAT_CMD:
120  ((bigintmat *)d)->pprint(80);
121  break;
122  case UNKNOWN:
123  case DEF_CMD:
124  PrintNSpaces(spaces);
125  PrintS("`");PrintS(n);PrintS("`");
126  break;
127  case PACKAGE_CMD:
128  PrintNSpaces(spaces);
129  paPrint(n,(package)d);
130  break;
131  case NONE:
132  return;
133  case INTVEC_CMD:
134  case INTMAT_CMD:
135  ((intvec *)d)->show(t,spaces);
136  break;
137  case RING_CMD:
138  case QRING_CMD:
139  {
140  PrintNSpaces(spaces);
141  const ring r = (const ring)d;
142  rWrite(r, currRing == r);
143  break;
144  }
145  case MATRIX_CMD:
146  iiWriteMatrix((matrix)d,n,2, currRing, spaces);
147  break;
148  case MODUL_CMD:
149  case IDEAL_CMD:
150  if ((TEST_V_QRING) &&(currRing->qideal!=NULL)
151  &&(!hasFlag(this,FLAG_QRING)))
152  {
153  jjNormalizeQRingId(this);
154  d=Data();
155  }
156  // no break:
157  case MAP_CMD:
158  iiWriteMatrix((matrix)d,n,1, currRing, spaces);
159  break;
160  case POLY_CMD:
161  case VECTOR_CMD:
162  if ((e==NULL)
163  && (TEST_V_QRING)
164  &&(currRing->qideal!=NULL)
165  &&(!hasFlag(this,FLAG_QRING)))
166  {
167  setFlag(this,FLAG_QRING);
168  poly p=(poly)d;
170  if (p!=(poly)d)
171  {
172  d=(void*)p;
173  if ((rtyp==POLY_CMD)||(rtyp==VECTOR_CMD)) data=d;
174  else if (rtyp==IDHDL)
175  {
176  idhdl h=(idhdl)data;
177  IDPOLY(h)=p;
178  setFlag(h,FLAG_QRING);
179  }
180  }
181  }
182  PrintNSpaces(spaces);
183  pWrite0((poly)d);
184  break;
185  case RESOLUTION_CMD:
186  {
187  syStrategy tmp=(syStrategy)d;
188  syPrint(tmp,IDID(currRingHdl));
189  break;
190  }
191  case STRING_CMD:
192  PrintNSpaces(spaces);
193  PrintS((char *)d);
194  break;
195  case INT_CMD:
196  PrintNSpaces(spaces);
197  ::Print("%d",(int)(long)d);
198  break;
199  case PROC_CMD:
200  {
202 
203  PrintNSpaces(spaces);
204  PrintS("// libname : ");
205  PrintS(piProcinfo(pi, "libname"));
206  PrintLn();
207 
208  PrintNSpaces(spaces);
209  PrintS("// procname : ");
210  PrintS(piProcinfo(pi, "procname"));
211  PrintLn();
212 
213  PrintNSpaces(spaces);
214  PrintS("// type : ");
215  PrintS(piProcinfo(pi, "type"));
216  // ::Print("%-*.*s// ref : %s",spaces,spaces," ",
217  // piProcinfo(pi, "ref"));
218  break;
219  }
220  case LINK_CMD:
221  {
222  si_link l=(si_link)d;
223  PrintNSpaces(spaces);
224  ::Print("// type : %s\n", slStatus(l, "type"));
225  PrintNSpaces(spaces);
226  ::Print("// mode : %s\n", slStatus(l, "mode"));
227  PrintNSpaces(spaces);
228  ::Print("// name : %s\n", slStatus(l, "name"));
229  PrintNSpaces(spaces);
230  ::Print("// open : %s\n", slStatus(l, "open"));
231  PrintNSpaces(spaces);
232  ::Print("// read : %s\n", slStatus(l, "read"));
233  PrintNSpaces(spaces);
234  ::Print("// write: %s", slStatus(l, "write"));
235  break;
236  }
237  case NUMBER_CMD:
238  case BIGINT_CMD:
239  if (t==NUMBER_CMD)
240  {
241  number n=(number)d;
242  nNormalize(n);
243  d=n;
244  }
245  s=String(d);
246  if (s==NULL) return;
247  PrintNSpaces(spaces);
248  PrintS(s);
249  omFree((ADDRESS)s);
250  break;
251  case LIST_CMD:
252  {
253  lists l=(lists)d;
254  if (lSize(l)<0)
255  {
256  PrintNSpaces(spaces);
257  PrintS("empty list\n");
258  }
259  else
260  {
261  int i=0;
262  for (;i<=l->nr;i++)
263  {
264  if (l->m[i].rtyp!=DEF_CMD)
265  {
266  PrintNSpaces(spaces);
267  ::Print("[%d]:\n",i+1);
268  l->m[i].Print(NULL,spaces+3);
269  }
270  }
271  }
272  break;
273  }
274 
275  default:
276  if (t>MAX_TOK)
277  {
278  blackbox * bb=getBlackboxStuff(t);
279  PrintNSpaces(spaces);
280  if (bb!=NULL) { bb->blackbox_Print(bb,d); }
281  else { ::Print("Print: blackbox %d(bb=NULL)",t); }
282  }
283  else
284  ::Print("Print:unknown type %s(%d)", Tok2Cmdname(t),t);
285  } /* end switch: (Typ()) */
286  }
287  if (next!=NULL)
288  {
289  if (t==COMMAND) PrintLn();
290  else if (t!=LIST_CMD) PrintS(" ");
291  next->Print(NULL,spaces);
292  }
293  else if (t!=LIST_CMD)
294  {
295  PrintLn();
296  }
297 #ifdef SIQ
298  if (rtyp!=COMMAND)
299 #endif
300  {
301  if ((store!=NULL)
302  && (store!=this))
303  {
304  if((t/*Typ()*/!=LINK_CMD)
305  && (t/*Typ()*/!=PACKAGE_CMD)
306  && (t/*Typ()*/!=DEF_CMD)
307  )
308  {
309  store->rtyp=t/*Typ()*/;
310  store->data=CopyD();
311  if(attribute!=NULL)
312  {
313  store->attribute=CopyA();
314  }
315  store->flag=flag;
316  }
317  }
318  }
319 }
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:2163
sleftv * m
Definition: lists.h:45
ip_command * command
Definition: ipid.h:24
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
Definition: tok.h:98
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:121
Definition: tok.h:42
return P p
Definition: myNF.cc:203
Matrices of numbers.
Definition: bigintmat.h:51
Definition: tok.h:217
#define UNKNOWN
Definition: tok.h:221
void * ADDRESS
Definition: auxiliary.h:161
void * CopyD()
Definition: subexpr.h:120
void syPrint(syStrategy syzstr, const char *currRingName)
Definition: syz1.cc:1945
int Typ()
Definition: subexpr.cc:976
void pWrite0(poly p)
Definition: polys.h:280
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:35
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:720
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:12
Definition: tok.h:59
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:61
#define omFree(addr)
Definition: omAllocDecl.h:261
The main handler for Singular numbers which are suitable for Singular polynomials.
attr CopyA()
Definition: subexpr.cc:712
idhdl currRingHdl
Definition: ipid.cc:65
#define setFlag(A, F)
Definition: ipid.h:112
idrec * idhdl
Definition: ring.h:18
#define FLAG_QRING
Definition: ipid.h:110
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#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
void paPrint(const char *n, package p)
Definition: ipshell.cc:6261
#define pi
Definition: libparse.cc:1143
void jjNormalizeQRingId(leftv I)
Definition: ipassign.cc:2128
int nr
Definition: lists.h:43
Definition: tok.h:119
#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:129
#define hasFlag(A, F)
Definition: ipid.h:111
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:321
void * Data()
Definition: subexpr.cc:1118
Definition: tok.h:120
attr attribute
Definition: subexpr.h:90
Definition: tok.h:159
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
#define NONE
Definition: tok.h:220
void PrintNSpaces(const int n)
Definition: reporter.cc:381
int l
Definition: cfEzgcd.cc:94
procinfo * procinfov
Definition: structs.h:63
#define COMMAND
Definition: tok.h:33
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:20
ssyStrategy * syStrategy
Definition: syz.h:35
BOOLEAN sleftv::RingDependend ( )

Definition at line 389 of file subexpr.cc.

390 {
391  int rt=Typ();
392  if(::RingDependend(rt) && (rt!=QRING_CMD))
393  return TRUE;
394  if (rt==LIST_CMD)
395  return lRingDependend((lists)Data());
396  if (this->next!=NULL)
397  return this->next->RingDependend();
398  return FALSE;
399 }
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int Typ()
Definition: subexpr.cc:976
BOOLEAN RingDependend()
Definition: subexpr.cc:389
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1118
Definition: tok.h:120
Definition: tok.h:159
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
char * sleftv::String ( void *  d = NULL,
BOOLEAN  typed = FALSE,
int  dim = 1 
)

Called for conversion to string (used by string(..), write(..),..)

Definition at line 720 of file subexpr.cc.

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

Definition at line 976 of file subexpr.cc.

977 {
978  if (e==NULL)
979  {
980  switch (rtyp)
981  {
982  case IDHDL:
983  return IDTYP((idhdl)data);
984  case ALIAS_CMD:
985  {
986  idhdl h=(idhdl)data;
987  return ((idhdl)h->data.ustring)->typ;
988  }
989  case VECHO:
990  case VPRINTLEVEL:
991  case VCOLMAX:
992  case VTIMER:
993  case VRTIMER:
994  case VOICE:
995  case VMAXDEG:
996  case VMAXMULT:
997  case TRACE:
998  case VSHORTOUT:
999  return INT_CMD;
1000  case VMINPOLY:
1001  data=NULL;
1002  return NUMBER_CMD;
1003  case VNOETHER:
1004  data=NULL;
1005  return POLY_CMD;
1006  //case COMMAND:
1007  // return COMMAND;
1008  default:
1009  return rtyp;
1010  }
1011  }
1012  int r=0;
1013  int t=rtyp;
1014  void *d=data;
1015  if (t==IDHDL) t=IDTYP((idhdl)d);
1016  else if (t==ALIAS_CMD)
1017  { idhdl h=(idhdl)IDDATA((idhdl)data); t=IDTYP(h);d=IDDATA(h); }
1018  switch (t)
1019  {
1020 #ifdef SINGULAR_4_1
1021  case CMATRIX_CMD:
1022  {
1023  bigintmat *b=(bigintmat*)d;
1024  if ((currRing!=NULL)&&(currRing->cf==b->basecoeffs()))
1025  return NUMBER_CMD;
1026  else
1027  return CNUMBER_CMD;
1028  }
1029 #endif
1030  case INTVEC_CMD:
1031  case INTMAT_CMD:
1032  r=INT_CMD;
1033  break;
1034  case BIGINTMAT_CMD:
1035  r=BIGINT_CMD;
1036  break;
1037  case IDEAL_CMD:
1038  case MATRIX_CMD:
1039  case MAP_CMD:
1040  r=POLY_CMD;
1041  break;
1042  case MODUL_CMD:
1043  r=VECTOR_CMD;
1044  break;
1045  case STRING_CMD:
1046  r=STRING_CMD;
1047  break;
1048  default:
1049  {
1050  blackbox *b=NULL;
1051  if (t>MAX_TOK)
1052  {
1053  b=getBlackboxStuff(t);
1054  }
1055  if ((t==LIST_CMD)||((b!=NULL)&&BB_LIKE_LIST(b)))
1056  {
1057  lists l;
1058  if (rtyp==IDHDL) l=IDLIST((idhdl)d);
1059  else l=(lists)d;
1060  if ((0<e->start)&&(e->start<=l->nr+1))
1061  {
1062  Subexpr tmp=l->m[e->start-1].e;
1063  l->m[e->start-1].e=e->next;
1064  r=l->m[e->start-1].Typ();
1065  e->next=l->m[e->start-1].e;
1066  l->m[e->start-1].e=tmp;
1067  }
1068  else
1069  {
1070  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1071  r=DEF_CMD;
1072  }
1073  }
1074  else
1075  Werror("cannot index type %s(%d)",Tok2Cmdname(t),t);
1076  break;
1077  }
1078  }
1079  return r;
1080 }
#define IDLIST(a)
Definition: ipid.h:136
Definition: tok.h:211
Definition: tok.h:207
sleftv * m
Definition: lists.h:45
Definition: tok.h:98
Definition: tok.h:208
Subexpr e
Definition: subexpr.h:106
Definition: lists.h:22
Definition: tok.h:42
Matrices of numbers.
Definition: bigintmat.h:51
Definition: tok.h:217
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
int Typ()
Definition: subexpr.cc:976
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
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:12
#define IDTYP(a)
Definition: ipid.h:118
Definition: tok.h:212
const ring r
Definition: syzextra.cc:208
Definition: tok.h:61
idrec * idhdl
Definition: ring.h:18
Definition: tok.h:210
Definition: tok.h:38
Definition: tok.h:213
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:92
Definition: tok.h:120
#define IDDATA(a)
Definition: ipid.h:125
Definition: tok.h:209
static Poly * h
Definition: janet.cc:978
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int l
Definition: cfEzgcd.cc:94
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
utypes data
Definition: idrec.h:40

Field Documentation

attr sleftv::attribute

Definition at line 90 of file subexpr.h.

void* sleftv::data

Definition at line 89 of file subexpr.h.

Subexpr sleftv::e

Definition at line 106 of file subexpr.h.

BITSET sleftv::flag

Definition at line 91 of file subexpr.h.

const char* sleftv::name

Definition at line 88 of file subexpr.h.

leftv sleftv::next

Definition at line 87 of file subexpr.h.

package sleftv::req_packhdl

Definition at line 107 of file subexpr.h.

int sleftv::rtyp

Definition at line 92 of file subexpr.h.


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