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

1347 {
1348  if (e==NULL) return &attribute;
1349  if ((rtyp==LIST_CMD)
1350  ||((rtyp==IDHDL)&&(IDTYP((idhdl)data)==LIST_CMD))
1351  || (rtyp>MAX_TOK)
1352  || ((rtyp==IDHDL)&&(IDTYP((idhdl)data)>MAX_TOK)))
1353  {
1354  leftv v=LData();
1355  return &(v->attribute);
1356  }
1357  return NULL;
1358 }
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:1360
void sleftv::CleanUp ( ring  r = currRing)

Definition at line 301 of file subexpr.cc.

302 {
303  if ((name!=NULL) && (name!=sNoName) && (rtyp!=IDHDL) && (rtyp!=ALIAS_CMD))
304  {
305  //::Print("free %x (%s)\n",name,name);
306  omFree((ADDRESS)name);
307  }
308  //name=NULL;
309  //flag=0;
310  if (data!=NULL)
311  {
312  if (rtyp==IDHDL) attribute=NULL; // is only a pointer to attribute of id
313  else s_internalDelete(rtyp,data,r);
314  //data=NULL; // will be done by Init() at the end
315  }
316  if (attribute!=NULL)
317  {
318  switch (rtyp)
319  {
320  case PACKAGE_CMD:
321  case IDHDL:
322  case ANY_TYPE:
323  case VECHO:
324  case VPRINTLEVEL:
325  case VCOLMAX:
326  case VTIMER:
327  case VRTIMER:
328  case VOICE:
329  case VMAXDEG:
330  case VMAXMULT:
331  case TRACE:
332  case VSHORTOUT:
333  case VNOETHER:
334  case VMINPOLY:
335  case LIB_CMD:
336  case 0:
337  //attribute=NULL; // will be done by Init() at the end
338  break;
339  default:
340  {
341  attribute->killAll(r);
342  }
343  }
344  }
345  Subexpr h;
346  while (e!=NULL)
347  {
348  h=e->next;
350  e=h;
351  }
352  //rtyp=NONE; // will be done by Init() at the end
353  if (next!=NULL)
354  {
355  leftv tmp_n;
356  do
357  {
358  tmp_n=next->next;
359  //next->name=NULL;
360  next->next=NULL;
361  next->CleanUp(r);
363  next=tmp_n;
364  } while (next!=NULL);
365  }
366  Init();
367 }
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:458
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:301
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 637 of file subexpr.cc.

638 {
639  Init();
640  rtyp=source->Typ();
641  void *d=source->Data();
642  if(!errorreported)
643  {
645  if ((source->attribute!=NULL)||(source->e!=NULL))
646  attribute=source->CopyA();
647  flag=source->flag;
648  if (source->next!=NULL)
649  {
651  next->Copy(source->next);
652  }
653  }
654 }
#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:1912
void Copy(leftv e)
Definition: subexpr.cc:637
static void * s_internalCopy(const int t, void *d)
Definition: subexpr.cc:381
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 692 of file subexpr.cc.

693 {
694  attr *a=Attribute();
695  if ((a!=NULL) && (*a!=NULL))
696  return (*a)->Copy();
697  return NULL;
698 }
const poly a
Definition: syzextra.cc:212
Definition: attrib.h:14
attr * Attribute()
Definition: subexpr.cc:1346
#define NULL
Definition: omList.c:10
void * sleftv::CopyD ( int  t)

Definition at line 656 of file subexpr.cc.

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

Definition at line 1091 of file subexpr.cc.

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

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

1361 {
1362  if (e!=NULL)
1363  {
1364  lists l=NULL;
1365  blackbox *b=getBlackboxStuff(rtyp);
1366 
1367  if ((rtyp==LIST_CMD)
1368  || ((b!=NULL)&&(BB_LIKE_LIST(b))))
1369  l=(lists)data;
1370  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1371  l=IDLIST((idhdl)data);
1372  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)>MAX_TOK))
1373  {
1374  b=getBlackboxStuff(IDTYP((idhdl)data));
1375  if (BB_LIKE_LIST(b)) l=IDLIST((idhdl)data);
1376  }
1377  else if (rtyp==ALIAS_CMD)
1378  {
1379  idhdl h=(idhdl)data;
1380  l= (lists)(((idhdl)h->data.ustring)->data.ustring);
1381  }
1382  if (l!=NULL)
1383  {
1384  if ((0>=e->start)||(e->start>l->nr+1))
1385  return NULL;
1386  if (e->next!=NULL)
1387  {
1388  l->m[e->start-1].e=e->next;
1389  leftv r=l->m[e->start-1].LData();
1390  l->m[e->start-1].e=NULL;
1391  return r;
1392  }
1393  return &(l->m[e->start-1]);
1394  }
1395  }
1396  return this;
1397 }
#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:1360
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 1055 of file subexpr.cc.

1056 {
1057  lists l=NULL;
1058  int r;
1059  if (rtyp==LIST_CMD)
1060  l=(lists)data;
1061  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1062  l=IDLIST((idhdl)data);
1063  else
1064  return Typ();
1065  //if (l!=NULL)
1066  {
1067  if ((e!=NULL) && (e->next!=NULL))
1068  {
1069  if ((0<e->start)&&(e->start<=l->nr+1))
1070  {
1071  l->m[e->start-1].e=e->next;
1072  r=l->m[e->start-1].LTyp();
1073  l->m[e->start-1].e=NULL;
1074  }
1075  else
1076  {
1077  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1078  r=NONE;
1079  }
1080  return r;
1081  }
1082  return LIST_CMD;
1083  }
1084  return Typ();
1085 }
#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:949
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:1055
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  s=String(d);
226  if (s==NULL) return;
227  PrintNSpaces(spaces);
228  PrintS(s);
229  omFree((ADDRESS)s);
230  break;
231  case LIST_CMD:
232  {
233  lists l=(lists)d;
234  if (lSize(l)<0)
235  {
236  PrintNSpaces(spaces);
237  PrintS("empty list\n");
238  }
239  else
240  {
241  int i=0;
242  for (;i<=l->nr;i++)
243  {
244  if (l->m[i].rtyp!=DEF_CMD)
245  {
246  PrintNSpaces(spaces);
247  ::Print("[%d]:\n",i+1);
248  l->m[i].Print(NULL,spaces+3);
249  }
250  }
251  }
252  break;
253  }
254 
255  default:
256  if (t>MAX_TOK)
257  {
258  blackbox * bb=getBlackboxStuff(t);
259  PrintNSpaces(spaces);
260  if (bb!=NULL) { bb->blackbox_Print(bb,d); }
261  else { ::Print("Print: blackbox %d(bb=NULL)",t); }
262  }
263  else
264  ::Print("Print:unknown type %s(%d)", Tok2Cmdname(t),t);
265  } /* end switch: (Typ()) */
266  }
267  if (next!=NULL)
268  {
269  if (t==COMMAND) PrintLn();
270  else if (t!=LIST_CMD) PrintS(" ");
271  next->Print(NULL,spaces);
272  }
273  else if (t!=LIST_CMD)
274  {
275  PrintLn();
276  }
277 #ifdef SIQ
278  if (rtyp!=COMMAND)
279 #endif
280  {
281  if ((store!=NULL)
282  && (store!=this))
283  {
284  if((t/*Typ()*/!=LINK_CMD)
285  && (t/*Typ()*/!=PACKAGE_CMD)
286  && (t/*Typ()*/!=DEF_CMD)
287  )
288  {
289  store->rtyp=t/*Typ()*/;
290  store->data=CopyD();
291  if(attribute!=NULL)
292  {
293  store->attribute=CopyA();
294  }
295  store->flag=flag;
296  }
297  }
298  }
299 }
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:2036
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 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:949
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:738
char * String(void *d=NULL, BOOLEAN typed=FALSE, int dim=1)
Called for conversion to string (used by string(..), write(..),..)
Definition: subexpr.cc:700
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
polyrec * poly
Definition: hilb.h:10
The main handler for Singular numbers which are suitable for Singular polynomials.
attr CopyA()
Definition: subexpr.cc:692
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:6019
#define pi
Definition: libparse.cc:1143
void jjNormalizeQRingId(leftv I)
Definition: ipassign.cc:2001
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:301
void * Data()
Definition: subexpr.cc:1091
Definition: tok.h:96
attr attribute
Definition: subexpr.h:90
Definition: tok.h:126
#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 369 of file subexpr.cc.

370 {
371  int rt=Typ();
372  if(::RingDependend(rt) && (rt!=QRING_CMD))
373  return TRUE;
374  if (rt==LIST_CMD)
375  return lRingDependend((lists)Data());
376  if (this->next!=NULL)
377  return this->next->RingDependend();
378  return FALSE;
379 }
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int Typ()
Definition: subexpr.cc:949
BOOLEAN RingDependend()
Definition: subexpr.cc:369
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1091
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 700 of file subexpr.cc.

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

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