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

1353 {
1354  if (e==NULL) return &attribute;
1355  if ((rtyp==LIST_CMD)
1356  ||((rtyp==IDHDL)&&(IDTYP((idhdl)data)==LIST_CMD))
1357  || (rtyp>MAX_TOK)
1358  || ((rtyp==IDHDL)&&(IDTYP((idhdl)data)>MAX_TOK)))
1359  {
1360  leftv v=LData();
1361  return &(v->attribute);
1362  }
1363  return NULL;
1364 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Subexpr e
Definition: subexpr.h:106
Definition: tok.h:167
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:96
attr attribute
Definition: subexpr.h:90
leftv LData()
Definition: subexpr.cc:1366
void sleftv::CleanUp ( ring  r = currRing)

Definition at line 307 of file subexpr.cc.

308 {
309  if ((name!=NULL) && (name!=sNoName) && (rtyp!=IDHDL) && (rtyp!=ALIAS_CMD))
310  {
311  //::Print("free %x (%s)\n",name,name);
312  omFree((ADDRESS)name);
313  }
314  //name=NULL;
315  //flag=0;
316  if (data!=NULL)
317  {
318  if (rtyp==IDHDL) attribute=NULL; // is only a pointer to attribute of id
319  else s_internalDelete(rtyp,data,r);
320  //data=NULL; // will be done by Init() at the end
321  }
322  if (attribute!=NULL)
323  {
324  switch (rtyp)
325  {
326  case PACKAGE_CMD:
327  case IDHDL:
328  case ANY_TYPE:
329  case VECHO:
330  case VPRINTLEVEL:
331  case VCOLMAX:
332  case VTIMER:
333  case VRTIMER:
334  case VOICE:
335  case VMAXDEG:
336  case VMAXMULT:
337  case TRACE:
338  case VSHORTOUT:
339  case VNOETHER:
340  case VMINPOLY:
341  case LIB_CMD:
342  case 0:
343  //attribute=NULL; // will be done by Init() at the end
344  break;
345  default:
346  {
347  attribute->killAll(r);
348  }
349  }
350  }
351  Subexpr h;
352  while (e!=NULL)
353  {
354  h=e->next;
356  e=h;
357  }
358  //rtyp=NONE; // will be done by Init() at the end
359  if (next!=NULL)
360  {
361  leftv tmp_n;
362  do
363  {
364  tmp_n=next->next;
365  //next->name=NULL;
366  next->next=NULL;
367  next->CleanUp(r);
369  next=tmp_n;
370  } while (next!=NULL);
371  }
372  Init();
373 }
Definition: tok.h:161
Definition: tok.h:157
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define ANY_TYPE
Definition: tok.h:34
Definition: tok.h:158
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:162
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:464
Definition: tok.h:160
leftv next
Definition: subexpr.h:87
Definition: tok.h:38
Definition: tok.h:163
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
attr attribute
Definition: subexpr.h:90
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
Definition: tok.h:159
static Poly * h
Definition: janet.cc:978
void sleftv::Copy ( leftv  e)

Definition at line 643 of file subexpr.cc.

644 {
645  Init();
646  rtyp=source->Typ();
647  void *d=source->Data();
648  if(!errorreported)
649  {
651  if ((source->attribute!=NULL)||(source->e!=NULL))
652  attribute=source->CopyA();
653  flag=source->flag;
654  if (source->next!=NULL)
655  {
657  next->Copy(source->next);
658  }
659  }
660 }
#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:1918
void Copy(leftv e)
Definition: subexpr.cc:643
static void * s_internalCopy(const int t, void *d)
Definition: subexpr.cc:387
short errorreported
Definition: feFopen.cc:22
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 698 of file subexpr.cc.

699 {
700  attr *a=Attribute();
701  if ((a!=NULL) && (*a!=NULL))
702  return (*a)->Copy();
703  return NULL;
704 }
const poly a
Definition: syzextra.cc:212
Definition: attrib.h:15
attr * Attribute()
Definition: subexpr.cc:1352
#define NULL
Definition: omList.c:10
void * sleftv::CopyD ( int  t)

Definition at line 662 of file subexpr.cc.

663 {
664  if ((rtyp!=IDHDL)&&(rtyp!=ALIAS_CMD)&&(e==NULL))
665  {
666  if (iiCheckRing(t)) return NULL;
667  void *x = data;
668  if (rtyp==VNOETHER) x = (void *)pCopy((currRing->ppNoether));
669  else if ((rtyp==VMINPOLY) && nCoeff_is_algExt(currRing->cf) && (!nCoeff_is_GF(currRing->cf)))
670  {
671  const ring A = currRing->cf->extRing;
672 
673  assume( A != NULL );
674  assume( A->qideal != NULL );
675 
676  x=(void *)p_Copy(A->qideal->m[0], A);
677  }
678  data=NULL;
679  return x;
680  }
681  void *d=Data(); // will also do a iiCheckRing
682  if ((!errorreported) && (d!=NULL)) return slInternalCopy(this,t,d,e);
683  return NULL;
684 }
void * slInternalCopy(leftv source, const int t, void *d, Subexpr e)
Definition: subexpr.cc:614
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:811
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:911
#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:837
short errorreported
Definition: feFopen.cc:22
Definition: tok.h:38
BOOLEAN iiCheckRing(int i)
Definition: ipshell.cc:1460
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
#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:955
void * sleftv::Data ( )

Definition at line 1097 of file subexpr.cc.

1098 {
1099  if ((rtyp!=IDHDL) && iiCheckRing(rtyp))
1100  return NULL;
1101  if (e==NULL)
1102  {
1103  switch (rtyp)
1104  {
1105  case ALIAS_CMD:
1106  {
1107  idhdl h=(idhdl)data;
1108  return ((idhdl)h->data.ustring)->data.ustring;
1109  }
1110  case VECHO: return (void *)(long)si_echo;
1111  case VPRINTLEVEL:return (void *)(long)printlevel;
1112  case VCOLMAX: return (void *)(long)colmax;
1113  case VTIMER: return (void *)(long)getTimer();
1114  case VRTIMER: return (void *)(long)getRTimer();
1115  case VOICE: return (void *)(long)(myynest+1);
1116  case VMAXDEG: return (void *)(long)Kstd1_deg;
1117  case VMAXMULT: return (void *)(long)Kstd1_mu;
1118  case TRACE: return (void *)(long)traceit;
1119  case VSHORTOUT: return (void *)(long)(currRing != NULL ? currRing->ShortOut : 0);
1120  case VMINPOLY:
1121  if ( (currRing != NULL) && nCoeff_is_algExt(currRing->cf) && !nCoeff_is_GF(currRing->cf))
1122  {
1123  /* Q(a), Fp(a), but not GF(q) */
1124  const ring A = currRing->cf->extRing;
1125 
1126  assume( A != NULL );
1127  assume( A->qideal != NULL );
1128 
1129  return (void *)A->qideal->m[0];
1130  }
1131  else
1132  return (void *)currRing->cf->nNULL;
1133 
1134  case VNOETHER: return (void *) (currRing->ppNoether);
1135  case IDHDL:
1136  return IDDATA((idhdl)data);
1137  case COMMAND:
1138  //return NULL;
1139  default:
1140  return data;
1141  }
1142  }
1143  /* e != NULL : */
1144  int t=rtyp;
1145  void *d=data;
1146  if (t==IDHDL)
1147  {
1148  t=((idhdl)data)->typ;
1149  d=IDDATA((idhdl)data);
1150  }
1151  else if (t==ALIAS_CMD)
1152  {
1153  idhdl h=(idhdl)IDDATA((idhdl)data);
1154  t=IDTYP(h);
1155  d=IDDATA(h);
1156  }
1157  if (iiCheckRing(t))
1158  return NULL;
1159  char *r=NULL;
1160  int index=e->start;
1161  switch (t)
1162  {
1163  case INTVEC_CMD:
1164  {
1165  intvec *iv=(intvec *)d;
1166  if ((index<1)||(index>iv->length()))
1167  {
1168  if (!errorreported)
1169  Werror("wrong range[%d] in intvec %s(%d)",index,this->Name(),iv->length());
1170  }
1171  else
1172  r=(char *)(long)((*iv)[index-1]);
1173  break;
1174  }
1175  case INTMAT_CMD:
1176  {
1177  intvec *iv=(intvec *)d;
1178  if ((index<1)
1179  ||(index>iv->rows())
1180  ||(e->next->start<1)
1181  ||(e->next->start>iv->cols()))
1182  {
1183  if (!errorreported)
1184  Werror("wrong range[%d,%d] in intmat %s(%dx%d)",index,e->next->start,
1185  this->Name(),iv->rows(),iv->cols());
1186  }
1187  else
1188  r=(char *)(long)(IMATELEM((*iv),index,e->next->start));
1189  break;
1190  }
1191  case BIGINTMAT_CMD:
1192  {
1193  bigintmat *m=(bigintmat *)d;
1194  if ((index<1)
1195  ||(index>m->rows())
1196  ||(e->next->start<1)
1197  ||(e->next->start>m->cols()))
1198  {
1199  if (!errorreported)
1200  Werror("wrong range[%d,%d] in bigintmat %s(%dx%d)",index,e->next->start,
1201  this->Name(),m->rows(),m->cols());
1202  }
1203  else
1204  r=(char *)(BIMATELEM((*m),index,e->next->start));
1205  break;
1206  }
1207 #ifdef SINGULAR_4_1
1208  case CMATRIX_CMD:
1209  {
1210  bigintmat *m=(bigintmat *)d;
1211  if ((index<1)
1212  ||(index>m->rows())
1213  ||(e->next->start<1)
1214  ||(e->next->start>m->cols()))
1215  {
1216  if (!errorreported)
1217  Werror("wrong range[%d,%d] in matrix %s(%dx%d)",index,e->next->start,
1218  this->Name(),m->rows(),m->cols());
1219  }
1220  else
1221  {
1223  iiNumber2Data[iiCmatrix_index].n=BIMATELEM((*m),index,e->next->start);
1224  r=(char*)&iiNumber2Data[iiCmatrix_index];
1226  }
1227  break;
1228  }
1229 #endif
1230  case IDEAL_CMD:
1231  case MODUL_CMD:
1232  case MAP_CMD:
1233  {
1234  ideal I=(ideal)d;
1235  if ((index<1)||(index>IDELEMS(I)))
1236  {
1237  if (!errorreported)
1238  Werror("wrong range[%d] in ideal/module %s(%d)",index,this->Name(),IDELEMS(I));
1239  }
1240  else
1241  r=(char *)I->m[index-1];
1242  break;
1243  }
1244  case STRING_CMD:
1245  {
1246  // this was a memory leak
1247  // we evalute it, cleanup and replace this leftv by it's evalutated form
1248  // the evalutated form will be build in tmp
1249  sleftv tmp;
1250  tmp.Init();
1251  tmp.rtyp=STRING_CMD;
1252  r=(char *)omAllocBin(size_two_bin);
1253  if ((index>0)&& (index<=(int)strlen((char *)d)))
1254  {
1255  r[0]=*(((char *)d)+index-1);
1256  r[1]='\0';
1257  }
1258  else
1259  {
1260  r[0]='\0';
1261  }
1262  tmp.data=r;
1263  if ((rtyp==IDHDL)||(rtyp==STRING_CMD))
1264  {
1265  tmp.next=next; next=NULL;
1266  //if (rtyp==STRING_CMD) { omFree((ADDRESS)data); }
1267  //data=NULL;
1268  d=NULL;
1269  CleanUp();
1270  memcpy(this,&tmp,sizeof(tmp));
1271  }
1272  // and, remember, r is also the result...
1273  else
1274  {
1275  // ???
1276  // here we still have a memory leak...
1277  // example: list L="123","456";
1278  // L[1][2];
1279  // therefore, it should never happen:
1280  assume(0);
1281  // but if it happens: here is the temporary fix:
1282  // omMarkAsStaticAddr(r);
1283  }
1284  break;
1285  }
1286  case MATRIX_CMD:
1287  {
1288  if ((index<1)
1289  ||(index>MATROWS((matrix)d))
1290  ||(e->next->start<1)
1291  ||(e->next->start>MATCOLS((matrix)d)))
1292  {
1293  if (!errorreported)
1294  Werror("wrong range[%d,%d] in matrix %s(%dx%d)",
1295  index,e->next->start,
1296  this->Name(),
1297  MATROWS((matrix)d),MATCOLS((matrix)d));
1298  }
1299  else
1300  r=(char *)MATELEM((matrix)d,index,e->next->start);
1301  break;
1302  }
1303  default:
1304  {
1305  blackbox *b=NULL;
1306  if (t>MAX_TOK)
1307  {
1308  b=getBlackboxStuff(t);
1309  }
1310  if ((t==LIST_CMD)||((b!=NULL)&&(BB_LIKE_LIST(b))))
1311  {
1312  lists l=(lists)d;
1313  if ((0<index)&&(index<=l->nr+1))
1314  {
1315  if ((e->next!=NULL)
1316  && (l->m[index-1].rtyp==STRING_CMD))
1317  // string[..].Data() modifies sleftv, so let's do it ourself
1318  {
1319  char *dd=(char *)l->m[index-1].data;
1320  int j=e->next->start-1;
1321  r=(char *)omAllocBin(size_two_bin);
1322  if ((j>=0) && (j<(int)strlen(dd)))
1323  {
1324  r[0]=*(dd+j);
1325  r[1]='\0';
1326  }
1327  else
1328  {
1329  r[0]='\0';
1330  }
1331  }
1332  else
1333  {
1334  Subexpr tmp=l->m[index-1].e;
1335  l->m[index-1].e=e->next;
1336  r=(char *)l->m[index-1].Data();
1337  e->next=l->m[index-1].e;
1338  l->m[index-1].e=tmp;
1339  }
1340  }
1341  else //if (!errorreported)
1342  Werror("wrong range[%d] in list %s(%d)",index,this->Name(),l->nr+1);
1343  }
1344  else
1345  Werror("cannot index %s of type %s(%d)",this->Name(),Tok2Cmdname(t),t);
1346  break;
1347  }
1348  }
1349  return r;
1350 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
Definition: tok.h:161
Definition: tok.h:157
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:158
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:32
Definition: tok.h:167
#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:162
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:911
Definition: intvec.h:16
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:160
Definition: tok.h:88
static int iiCmatrix_index
Definition: subexpr.cc:1095
#define IDELEMS(i)
Definition: simpleideals.h:24
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:837
int cols() const
Definition: bigintmat.h:128
short errorreported
Definition: feFopen.cc:22
leftv next
Definition: subexpr.h:87
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:597
#define BIMATELEM(M, I, J)
Definition: bigintmat.h:117
Definition: tok.h:38
BOOLEAN iiCheckRing(int i)
Definition: ipshell.cc:1460
Definition: tok.h:163
int nr
Definition: lists.h:43
int rows() const
Definition: bigintmat.h:129
#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:1094
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
int rows() const
Definition: intvec.h:88
coeffs basecoeffs() const
Definition: bigintmat.h:130
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
void * Data()
Definition: subexpr.cc:1097
Definition: tok.h:96
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:159
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 1721 of file subexpr.cc.

1722 {
1723  BOOLEAN nok=FALSE;
1724  leftv nn=next;
1725  next=NULL;
1726  if(rtyp==IDHDL)
1727  {
1728  int t=Typ();
1729  if (t!=PROC_CMD)
1730  {
1731  void *d=CopyD(t);
1732  data=d;
1733  rtyp=t;
1734  name=NULL;
1735  e=NULL;
1736  }
1737  }
1738  else if (rtyp==COMMAND)
1739  {
1740  command d=(command)data;
1741  if(d->op==PROC_CMD) //assume d->argc==2
1742  {
1743  char *what=(char *)(d->arg1.Data());
1744  idhdl h=ggetid(what);
1745  if((h!=NULL)&&(IDTYP(h)==PROC_CMD))
1746  {
1747  nok=d->arg2.Eval();
1748  if(!nok)
1749  {
1750  nok=iiMake_proc(h,req_packhdl,&d->arg2);
1751  this->CleanUp(currRing);
1752  if (!nok)
1753  {
1754  memcpy(this,&iiRETURNEXPR,sizeof(sleftv));
1755  memset(&iiRETURNEXPR,0,sizeof(sleftv));
1756  }
1757  }
1758  }
1759  else nok=TRUE;
1760  }
1761  else if (d->op=='=') //assume d->argc==2
1762  {
1763  if ((d->arg1.rtyp!=IDHDL)&&(d->arg1.rtyp!=DEF_CMD))
1764  {
1765  nok=d->arg1.Eval();
1766  }
1767  if (!nok)
1768  {
1769  const char *n=d->arg1.name;
1770  nok=(n == NULL) || d->arg2.Eval();
1771  if (!nok)
1772  {
1773  int save_typ=d->arg1.rtyp;
1774  omCheckAddr((ADDRESS)n);
1775  if (d->arg1.rtyp!=IDHDL)
1776  syMake(&d->arg1,n);
1777  omCheckAddr((ADDRESS)d->arg1.name);
1778  if (d->arg1.rtyp==IDHDL)
1779  {
1780  n=omStrDup(IDID((idhdl)d->arg1.data));
1781  killhdl((idhdl)d->arg1.data);
1782  d->arg1.Init();
1783  //d->arg1.data=NULL;
1784  d->arg1.name=n;
1785  }
1786  d->arg1.rtyp=DEF_CMD;
1787  sleftv t;
1788  if(save_typ!=PROC_CMD) save_typ=d->arg2.rtyp;
1789  if (::RingDependend(d->arg2.rtyp))
1790  nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&currRing->idroot);
1791  else
1792  nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&IDROOT);
1793  memcpy(&d->arg1,&t,sizeof(sleftv));
1794  omCheckAddr((ADDRESS)d->arg1.name);
1795  nok=nok||iiAssign(&d->arg1,&d->arg2);
1796  omCheckIf(d->arg1.name != NULL, // OB: ????
1797  omCheckAddr((ADDRESS)d->arg1.name));
1798  if (!nok)
1799  {
1800  memset(&d->arg1,0,sizeof(sleftv));
1801  this->CleanUp();
1802  rtyp=NONE;
1803  }
1804  }
1805  }
1806  else nok=TRUE;
1807  }
1808  else
1809  {
1810  sleftv tmp; tmp.Init();
1811  int toktype=iiTokType(d->op);
1812  if ((toktype==CMD_M)
1813  ||( toktype==ROOT_DECL_LIST)
1814  ||( toktype==RING_DECL_LIST))
1815  {
1816  if (d->argc <=3)
1817  {
1818  if (d->argc>=1) nok=d->arg1.Eval();
1819  if ((!nok) && (d->argc>=2))
1820  {
1821  nok=d->arg2.Eval();
1822  d->arg1.next=(leftv)omAllocBin(sleftv_bin);
1823  memcpy(d->arg1.next,&d->arg2,sizeof(sleftv));
1824  d->arg2.Init();
1825  }
1826  if ((!nok) && (d->argc==3))
1827  {
1828  nok=d->arg3.Eval();
1829  d->arg1.next->next=(leftv)omAllocBin(sleftv_bin);
1830  memcpy(d->arg1.next->next,&d->arg3,sizeof(sleftv));
1831  d->arg3.Init();
1832  }
1833  if (d->argc==0)
1834  nok=nok||iiExprArithM(&tmp,NULL,d->op);
1835  else
1836  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1837  }
1838  else
1839  {
1840  nok=d->arg1.Eval();
1841  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1842  }
1843  }
1844  else if (d->argc==1)
1845  {
1846  nok=d->arg1.Eval();
1847  nok=nok||iiExprArith1(&tmp,&d->arg1,d->op);
1848  }
1849  else if(d->argc==2)
1850  {
1851  nok=d->arg1.Eval();
1852  nok=nok||d->arg2.Eval();
1853  nok=nok||iiExprArith2(&tmp,&d->arg1,d->op,&d->arg2);
1854  }
1855  else if(d->argc==3)
1856  {
1857  nok=d->arg1.Eval();
1858  nok=nok||d->arg2.Eval();
1859  nok=nok||d->arg3.Eval();
1860  nok=nok||iiExprArith3(&tmp,d->op,&d->arg1,&d->arg2,&d->arg3);
1861  }
1862  else if(d->argc!=0)
1863  {
1864  nok=d->arg1.Eval();
1865  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1866  }
1867  else // d->argc == 0
1868  {
1869  nok = iiExprArithM(&tmp, NULL, d->op);
1870  }
1871  this->CleanUp();
1872  memcpy(this,&tmp,sizeof(tmp));
1873  }
1874  }
1875  else if (((rtyp==0)||(rtyp==DEF_CMD))
1876  &&(name!=NULL))
1877  {
1878  syMake(this,name);
1879  }
1880 #ifdef MDEBUG
1881  switch(Typ())
1882  {
1883  case NUMBER_CMD:
1884 #ifdef LDEBUG
1885  nTest((number)Data());
1886 #endif
1887  break;
1888  case BIGINT_CMD:
1889 #ifdef LDEBUG
1890  n_Test((number)Data(),coeffs_BIGINT);
1891 #endif
1892  break;
1893  case POLY_CMD:
1894  pTest((poly)Data());
1895  break;
1896  case IDEAL_CMD:
1897  case MODUL_CMD:
1898  case MATRIX_CMD:
1899  {
1900  ideal id=(ideal)Data();
1901  omCheckAddrSize(id,sizeof(*id));
1902  int i=id->ncols*id->nrows-1;
1903  for(;i>=0;i--) pTest(id->m[i]);
1904  }
1905  break;
1906  }
1907 #endif
1908  if (nn!=NULL) nok=nok||nn->Eval();
1909  next=nn;
1910  return nok;
1911 }
#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:1721
ip_command * command
Definition: ipid.h:24
void syMake(leftv v, const char *id, idhdl packhdl)
Definition: subexpr.cc:1460
Subexpr e
Definition: subexpr.h:106
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:8313
#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:8525
omBin sleftv_bin
Definition: subexpr.cc:50
#define pTest(p)
Definition: polys.h:387
sleftv iiRETURNEXPR
Definition: iplib.cc:527
#define omCheckIf(cond, test)
Definition: omAllocDecl.h:323
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#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:8613
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
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:573
BOOLEAN RingDependend()
Definition: subexpr.cc:375
#define nTest(a)
Definition: numbers.h:35
Definition: tok.h:58
const char * name
Definition: subexpr.h:88
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:923
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:1112
#define NULL
Definition: omList.c:10
package req_packhdl
Definition: subexpr.h:107
void killhdl(idhdl h, package proot)
Definition: ipid.cc:369
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
void * Data()
Definition: subexpr.cc:1097
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
int iiTokType(int op)
Definition: iparith.cc:254
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:8126
#define NONE
Definition: tok.h:170
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
Definition: ipid.cc:487
#define COMMAND
Definition: tok.h:33
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1772
#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:1913
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 1366 of file subexpr.cc.

1367 {
1368  if (e!=NULL)
1369  {
1370  lists l=NULL;
1371  blackbox *b=getBlackboxStuff(rtyp);
1372 
1373  if ((rtyp==LIST_CMD)
1374  || ((b!=NULL)&&(BB_LIKE_LIST(b))))
1375  l=(lists)data;
1376  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1377  l=IDLIST((idhdl)data);
1378  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)>MAX_TOK))
1379  {
1380  b=getBlackboxStuff(IDTYP((idhdl)data));
1381  if (BB_LIKE_LIST(b)) l=IDLIST((idhdl)data);
1382  }
1383  else if (rtyp==ALIAS_CMD)
1384  {
1385  idhdl h=(idhdl)data;
1386  l= (lists)(((idhdl)h->data.ustring)->data.ustring);
1387  }
1388  if (l!=NULL)
1389  {
1390  if ((0>=e->start)||(e->start>l->nr+1))
1391  return NULL;
1392  if (e->next!=NULL)
1393  {
1394  l->m[e->start-1].e=e->next;
1395  leftv r=l->m[e->start-1].LData();
1396  l->m[e->start-1].e=NULL;
1397  return r;
1398  }
1399  return &(l->m[e->start-1]);
1400  }
1401  }
1402  return this;
1403 }
#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:167
#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:96
static Poly * h
Definition: janet.cc:978
const poly b
Definition: syzextra.cc:213
leftv LData()
Definition: subexpr.cc:1366
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
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
int sleftv::LTyp ( )

Definition at line 1061 of file subexpr.cc.

1062 {
1063  lists l=NULL;
1064  int r;
1065  if (rtyp==LIST_CMD)
1066  l=(lists)data;
1067  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1068  l=IDLIST((idhdl)data);
1069  else
1070  return Typ();
1071  //if (l!=NULL)
1072  {
1073  if ((e!=NULL) && (e->next!=NULL))
1074  {
1075  if ((0<e->start)&&(e->start<=l->nr+1))
1076  {
1077  l->m[e->start-1].e=e->next;
1078  r=l->m[e->start-1].LTyp();
1079  l->m[e->start-1].e=NULL;
1080  }
1081  else
1082  {
1083  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1084  r=NONE;
1085  }
1086  return r;
1087  }
1088  return LIST_CMD;
1089  }
1090  return Typ();
1091 }
#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:955
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:1061
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:96
#define NONE
Definition: tok.h:170
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 ((TEST_V_QRING) &&(currRing->qideal!=NULL)
163  &&(!hasFlag(this,FLAG_QRING)))
164  {
165  jjNormalizeQRingP(this);
166  d=Data();
167  }
168  PrintNSpaces(spaces);
169  pWrite0((poly)d);
170  break;
171  case RESOLUTION_CMD:
172  {
173  syStrategy tmp=(syStrategy)d;
174  syPrint(tmp,IDID(currRingHdl));
175  break;
176  }
177  case STRING_CMD:
178  PrintNSpaces(spaces);
179  PrintS((char *)d);
180  break;
181  case INT_CMD:
182  PrintNSpaces(spaces);
183  ::Print("%d",(int)(long)d);
184  break;
185  case PROC_CMD:
186  {
188 
189  PrintNSpaces(spaces);
190  PrintS("// libname : ");
191  PrintS(piProcinfo(pi, "libname"));
192  PrintLn();
193 
194  PrintNSpaces(spaces);
195  PrintS("// procname : ");
196  PrintS(piProcinfo(pi, "procname"));
197  PrintLn();
198 
199  PrintNSpaces(spaces);
200  PrintS("// type : ");
201  PrintS(piProcinfo(pi, "type"));
202  // ::Print("%-*.*s// ref : %s",spaces,spaces," ",
203  // piProcinfo(pi, "ref"));
204  break;
205  }
206  case LINK_CMD:
207  {
208  si_link l=(si_link)d;
209  PrintNSpaces(spaces);
210  ::Print("// type : %s\n", slStatus(l, "type"));
211  PrintNSpaces(spaces);
212  ::Print("// mode : %s\n", slStatus(l, "mode"));
213  PrintNSpaces(spaces);
214  ::Print("// name : %s\n", slStatus(l, "name"));
215  PrintNSpaces(spaces);
216  ::Print("// open : %s\n", slStatus(l, "open"));
217  PrintNSpaces(spaces);
218  ::Print("// read : %s\n", slStatus(l, "read"));
219  PrintNSpaces(spaces);
220  ::Print("// write: %s", slStatus(l, "write"));
221  break;
222  }
223  case NUMBER_CMD:
224  case BIGINT_CMD:
225  if (t==NUMBER_CMD)
226  {
227  number n=(number)d;
228  nNormalize(n);
229  d=n;
230  }
231  s=String(d);
232  if (s==NULL) return;
233  PrintNSpaces(spaces);
234  PrintS(s);
235  omFree((ADDRESS)s);
236  break;
237  case LIST_CMD:
238  {
239  lists l=(lists)d;
240  if (lSize(l)<0)
241  {
242  PrintNSpaces(spaces);
243  PrintS("empty list\n");
244  }
245  else
246  {
247  int i=0;
248  for (;i<=l->nr;i++)
249  {
250  if (l->m[i].rtyp!=DEF_CMD)
251  {
252  PrintNSpaces(spaces);
253  ::Print("[%d]:\n",i+1);
254  l->m[i].Print(NULL,spaces+3);
255  }
256  }
257  }
258  break;
259  }
260 
261  default:
262  if (t>MAX_TOK)
263  {
264  blackbox * bb=getBlackboxStuff(t);
265  PrintNSpaces(spaces);
266  if (bb!=NULL) { bb->blackbox_Print(bb,d); }
267  else { ::Print("Print: blackbox %d(bb=NULL)",t); }
268  }
269  else
270  ::Print("Print:unknown type %s(%d)", Tok2Cmdname(t),t);
271  } /* end switch: (Typ()) */
272  }
273  if (next!=NULL)
274  {
275  if (t==COMMAND) PrintLn();
276  else if (t!=LIST_CMD) PrintS(" ");
277  next->Print(NULL,spaces);
278  }
279  else if (t!=LIST_CMD)
280  {
281  PrintLn();
282  }
283 #ifdef SIQ
284  if (rtyp!=COMMAND)
285 #endif
286  {
287  if ((store!=NULL)
288  && (store!=this))
289  {
290  if((t/*Typ()*/!=LINK_CMD)
291  && (t/*Typ()*/!=PACKAGE_CMD)
292  && (t/*Typ()*/!=DEF_CMD)
293  )
294  {
295  store->rtyp=t/*Typ()*/;
296  store->data=CopyD();
297  if(attribute!=NULL)
298  {
299  store->attribute=CopyA();
300  }
301  store->flag=flag;
302  }
303  }
304  }
305 }
void n2Print(number2 d)
Definition: number2.cc:311
ip_package * package
Definition: structs.h:46
const CanonicalForm int s
Definition: facAbsFact.cc:55
sleftv * m
Definition: lists.h:45
ip_command * command
Definition: ipid.h:24
void jjNormalizeQRingP(leftv I)
Definition: ipassign.cc:2152
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
Definition: tok.h:85
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
Matrices of numbers.
Definition: bigintmat.h:32
Definition: tok.h:167
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define UNKNOWN
Definition: tok.h:171
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:955
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
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:706
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:56
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
const char * iiTwoOps(int t)
Definition: gentable.cc:250
const char * piProcinfo(procinfov pi, const char *request)
Definition: ipid.cc:620
Definition: tok.h:58
#define omFree(addr)
Definition: omAllocDecl.h:261
The main handler for Singular numbers which are suitable for Singular polynomials.
attr CopyA()
Definition: subexpr.cc:698
idhdl currRingHdl
Definition: ipid.cc:64
#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
Definition: tok.h:88
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
int lSize(lists L)
Definition: lists.cc:25
short errorreported
Definition: feFopen.cc:22
leftv next
Definition: subexpr.h:87
void paPrint(const char *n, package p)
Definition: ipshell.cc:5894
#define pi
Definition: libparse.cc:1143
void jjNormalizeQRingId(leftv I)
Definition: ipassign.cc:2117
int nr
Definition: lists.h:43
Definition: tok.h:95
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
#define hasFlag(A, F)
Definition: ipid.h:111
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
void * Data()
Definition: subexpr.cc:1097
Definition: tok.h:96
attr attribute
Definition: subexpr.h:90
Definition: tok.h:126
polyrec * poly
Definition: hilb.h:10
#define NONE
Definition: tok.h:170
void PrintNSpaces(const int n)
Definition: reporter.cc:376
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 375 of file subexpr.cc.

376 {
377  int rt=Typ();
378  if(::RingDependend(rt) && (rt!=QRING_CMD))
379  return TRUE;
380  if (rt==LIST_CMD)
381  return lRingDependend((lists)Data());
382  if (this->next!=NULL)
383  return this->next->RingDependend();
384  return FALSE;
385 }
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int Typ()
Definition: subexpr.cc:955
BOOLEAN RingDependend()
Definition: subexpr.cc:375
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1097
Definition: tok.h:96
Definition: tok.h:126
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 706 of file subexpr.cc.

707 {
708 #ifdef SIQ
709  if (rtyp==COMMAND)
710  {
711  ::Print("##command %d\n",((command)data)->op);
712  if (((command)data)->arg1.rtyp!=0)
713  ((command)data)->arg1.Print(NULL,2);
714  if (((command)data)->arg2.rtyp!=0)
715  ((command)data)->arg2.Print(NULL,2);
716  if (((command)data)->arg3.rtyp==0)
717  ((command)data)->arg3.Print(NULL,2);
718  PrintS("##end\n");
719  return omStrDup("");
720  }
721 #endif
722  if (d==NULL) d=Data();
723  if (!errorreported)
724  {
725  char *s;
726  int t=Typ();
727  switch (t /*Typ()*/)
728  {
729  case INT_CMD:
730  if (typed)
731  {
732  s=(char *)omAlloc(MAX_INT_LEN+7);
733  sprintf(s,"int(%d)",(int)(long)d);
734  }
735  else
736  {
737  s=(char *)omAlloc(MAX_INT_LEN+2);
738  sprintf(s,"%d",(int)(long)d);
739  }
740  return s;
741 
742  case STRING_CMD:
743  if (d == NULL)
744  {
745  if (typed) return omStrDup("\"\"");
746  return omStrDup("");
747  }
748  if (typed)
749  {
750  s = (char*) omAlloc(strlen((char*) d) + 3);
751  sprintf(s,"\"%s\"", (char*) d);
752  return s;
753  }
754  else
755  {
756  return omStrDup((char*)d);
757  }
758 
759  case POLY_CMD:
760  case VECTOR_CMD:
761  if (typed)
762  {
763  char* ps = pString((poly) d);
764  s = (char*) omAlloc(strlen(ps) + 10);
765  sprintf(s,"%s(%s)", (t /*Typ()*/ == POLY_CMD ? "poly" : "vector"), ps);
766  omFree(ps);
767  return s;
768  }
769  else
770  return pString((poly)d);
771 
772  #ifdef SINGULAR_4_1
773  case CNUMBER_CMD:
774  return n2String((number2)d,typed);
775  #endif
776 
777  case NUMBER_CMD:
778  StringSetS((char*) (typed ? "number(" : ""));
779  if ((rtyp==IDHDL)&&(IDTYP((idhdl)data)==NUMBER_CMD))
780  {
781  nWrite(IDNUMBER((idhdl)data));
782  }
783  else if (rtyp==NUMBER_CMD)
784  {
785  number n=(number)data;
786  nWrite(n);
787  data=(char *)n;
788  }
789  else if((rtyp==VMINPOLY)&&(rField_is_GF(currRing)))
790  {
791  nfShowMipo(currRing->cf);
792  }
793  else
794  {
795  number n=nCopy((number)d);
796  nWrite(n);
797  nDelete(&n);
798  }
799  StringAppendS((char*) (typed ? ")" : ""));
800  return StringEndS();
801 
802  case BIGINT_CMD:
803  {
804  StringSetS((char*) (typed ? "bigint(" : ""));
805  number nl=(number)d;
807  StringAppendS((char*) (typed ? ")" : ""));
808  return StringEndS();
809  }
810 
811  case MATRIX_CMD:
813  if (typed)
814  {
815  char* ns = (char*) omAlloc(strlen(s) + 40);
816  sprintf(ns, "matrix(ideal(%s),%d,%d)", s,
817  ((ideal) d)->nrows, ((ideal) d)->ncols);
818  omCheckAddr(ns);
819  return ns;
820  }
821  else
822  {
823  return omStrDup(s);
824  }
825 
826  case MODUL_CMD:
827  case IDEAL_CMD:
828  case MAP_CMD:
830  if (typed)
831  {
832  char* ns = (char*) omAlloc(strlen(s) + 10);
833  sprintf(ns, "%s(%s)", (t/*Typ()*/==MODUL_CMD ? "module" : "ideal"), s);
834  omCheckAddr(ns);
835  return ns;
836  }
837  return omStrDup(s);
838 
839  case INTVEC_CMD:
840  case INTMAT_CMD:
841  {
842  intvec *v=(intvec *)d;
843  s = v->String(dim);
844  if (typed)
845  {
846  char* ns;
847  if (t/*Typ()*/ == INTMAT_CMD)
848  {
849  ns = (char*) omAlloc(strlen(s) + 40);
850  sprintf(ns, "intmat(intvec(%s),%d,%d)", s, v->rows(), v->cols());
851  }
852  else
853  {
854  ns = (char*) omAlloc(strlen(s) + 10);
855  sprintf(ns, "intvec(%s)", s);
856  }
857  omCheckAddr(ns);
858  omFree(s);
859  return ns;
860  }
861  else
862  return s;
863  }
864  case BIGINTMAT_CMD:
865  {
866  bigintmat *bim=(bigintmat*)d;
867  s = bim->String();
868  if (typed)
869  {
870  char* ns = (char*) omAlloc0(strlen(s) + 40);
871  sprintf(ns, "bigintmat(bigintvec(%s),%d,%d)", s, bim->rows(), bim->cols());
872  omCheckAddr(ns);
873  return ns;
874  }
875  else
876  return omStrDup(s);
877  }
878 
879  case RING_CMD:
880  case QRING_CMD:
881  s = rString((ring)d);
882 
883  if (typed)
884  {
885  char* ns;
886  if (t/*Typ()*/ == QRING_CMD)
887  {
888  char* id = iiStringMatrix((matrix) ((ring) d)->qideal, dim,
889  currRing);
890  ns = (char*) omAlloc(strlen(s) + strlen(id) + 20);
891  sprintf(ns, "\"%s\";%sideal(%s)", s,(dim == 2 ? "\n" : " "), id);
892  }
893  else
894  {
895  ns = (char*) omAlloc(strlen(s) + 4);
896  sprintf(ns, "\"%s\"", s);
897  }
898  omFree(s);
899  omCheckAddr(ns);
900  return ns;
901  }
902  return s;
903  case RESOLUTION_CMD:
904  {
905  lists l = syConvRes((syStrategy)d);
906  s = lString(l, typed, dim);
907  l->Clean();
908  return s;
909  }
910 
911  case PROC_CMD:
912  {
913  procinfo* pi = (procinfo*) d;
914  if((pi->language == LANG_SINGULAR) && (pi->data.s.body!=NULL))
915  s = (pi->data.s.body);
916  else
917  s = (char *)"";
918  if (typed)
919  {
920  char* ns = (char*) omAlloc(strlen(s) + 4);
921  sprintf(ns, "\"%s\"", s);
922  omCheckAddr(ns);
923  return ns;
924  }
925  return omStrDup(s);
926  }
927 
928  case LINK_CMD:
929  s = slString((si_link) d);
930  if (typed)
931  {
932  char* ns = (char*) omAlloc(strlen(s) + 10);
933  sprintf(ns, "link(\"%s\")", s);
934  omFreeBinAddr(s);
935  omCheckAddr(ns);
936  return ns;
937  }
938  return s;
939 
940  case LIST_CMD:
941  return lString((lists) d, typed, dim);
942 
943  default:
944  if(t> MAX_TOK)
945  {
946  blackbox *bb=getBlackboxStuff(t);
947  if (bb!=NULL) return bb->blackbox_String(bb,d);
948  }
949  } /* end switch: (Typ()) */
950  }
951  return omStrDup("");
952 }
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:85
Definition: lists.h:22
const int MAX_INT_LEN
Definition: mylimits.h:13
Definition: tok.h:42
Matrices of numbers.
Definition: bigintmat.h:32
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:2760
char * rString(ring r)
Definition: ring.cc:644
Definition: tok.h:167
language_defs language
Definition: subexpr.h:58
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:470
char * StringEndS()
Definition: reporter.cc:151
char * lString(lists l, BOOLEAN typed, int dim)
Definition: lists.cc:377
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
#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:146
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: intvec.h:16
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
#define omFree(addr)
Definition: omAllocDecl.h:261
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
Definition: tok.h:88
#define nDelete(n)
Definition: numbers.h:16
int cols() const
Definition: bigintmat.h:128
short errorreported
Definition: feFopen.cc:22
#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:129
Definition: tok.h:95
#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:433
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:1097
Definition: tok.h:96
Definition: tok.h:126
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
polyrec * poly
Definition: hilb.h:10
char * iiStringMatrix(matrix im, int dim, const ring r, char ch)
Definition: matpol.cc:760
#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 955 of file subexpr.cc.

956 {
957  if (e==NULL)
958  {
959  switch (rtyp)
960  {
961  case IDHDL:
962  return IDTYP((idhdl)data);
963  case ALIAS_CMD:
964  {
965  idhdl h=(idhdl)data;
966  return ((idhdl)h->data.ustring)->typ;
967  }
968  case VECHO:
969  case VPRINTLEVEL:
970  case VCOLMAX:
971  case VTIMER:
972  case VRTIMER:
973  case VOICE:
974  case VMAXDEG:
975  case VMAXMULT:
976  case TRACE:
977  case VSHORTOUT:
978  return INT_CMD;
979  case VMINPOLY:
980  data=NULL;
981  return NUMBER_CMD;
982  case VNOETHER:
983  data=NULL;
984  return POLY_CMD;
985  //case COMMAND:
986  // return COMMAND;
987  default:
988  return rtyp;
989  }
990  }
991  int r=0;
992  int t=rtyp;
993  void *d=data;
994  if (t==IDHDL) t=IDTYP((idhdl)d);
995  else if (t==ALIAS_CMD)
996  { idhdl h=(idhdl)IDDATA((idhdl)data); t=IDTYP(h);d=IDDATA(h); }
997  switch (t)
998  {
999 #ifdef SINGULAR_4_1
1000  case CMATRIX_CMD:
1001  {
1002  bigintmat *b=(bigintmat*)d;
1003  if ((currRing!=NULL)&&(currRing->cf==b->basecoeffs()))
1004  return NUMBER_CMD;
1005  else
1006  return CNUMBER_CMD;
1007  }
1008 #endif
1009  case INTVEC_CMD:
1010  case INTMAT_CMD:
1011  r=INT_CMD;
1012  break;
1013  case BIGINTMAT_CMD:
1014  r=BIGINT_CMD;
1015  break;
1016  case IDEAL_CMD:
1017  case MATRIX_CMD:
1018  case MAP_CMD:
1019  r=POLY_CMD;
1020  break;
1021  case MODUL_CMD:
1022  r=VECTOR_CMD;
1023  break;
1024  case STRING_CMD:
1025  r=STRING_CMD;
1026  break;
1027  default:
1028  {
1029  blackbox *b=NULL;
1030  if (t>MAX_TOK)
1031  {
1032  b=getBlackboxStuff(t);
1033  }
1034  if ((t==LIST_CMD)||((b!=NULL)&&BB_LIKE_LIST(b)))
1035  {
1036  lists l;
1037  if (rtyp==IDHDL) l=IDLIST((idhdl)d);
1038  else l=(lists)d;
1039  if ((0<e->start)&&(e->start<=l->nr+1))
1040  {
1041  Subexpr tmp=l->m[e->start-1].e;
1042  l->m[e->start-1].e=e->next;
1043  r=l->m[e->start-1].Typ();
1044  e->next=l->m[e->start-1].e;
1045  l->m[e->start-1].e=tmp;
1046  }
1047  else
1048  {
1049  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1050  r=DEF_CMD;
1051  }
1052  }
1053  else
1054  Werror("cannot index type %s(%d)",Tok2Cmdname(t),t);
1055  break;
1056  }
1057  }
1058  return r;
1059 }
#define IDLIST(a)
Definition: ipid.h:136
Definition: tok.h:161
Definition: tok.h:157
sleftv * m
Definition: lists.h:45
Definition: tok.h:85
Definition: tok.h:158
Subexpr e
Definition: subexpr.h:106
Definition: lists.h:22
Definition: tok.h:42
Matrices of numbers.
Definition: bigintmat.h:32
Definition: tok.h:167
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
int Typ()
Definition: subexpr.cc:955
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:162
const ring r
Definition: syzextra.cc:208
Definition: tok.h:58
idrec * idhdl
Definition: ring.h:18
Definition: tok.h:160
Definition: tok.h:88
Definition: tok.h:38
Definition: tok.h:163
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:130
int rtyp
Definition: subexpr.h:92
Definition: tok.h:96
#define IDDATA(a)
Definition: ipid.h:125
Definition: tok.h:159
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: