My Project
Loading...
Searching...
No Matches
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.
 
char * String (void *d=NULL, BOOLEAN typed=FALSE, int dim=1)
 Called for conversion to string (used by string(..), write(..),..)
 
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 ()
 
attr * Attribute ()
 
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 82 of file subexpr.h.

Member Function Documentation

◆ Attribute()

attr * sleftv::Attribute ( )

Definition at line 1504 of file subexpr.cc.

1505{
1506 if (e==NULL) return &attribute;
1507 if ((rtyp==LIST_CMD)
1508 ||((rtyp==IDHDL)&&(IDTYP((idhdl)data)==LIST_CMD))
1509 || (rtyp>MAX_TOK)
1510 || ((rtyp==IDHDL)&&(IDTYP((idhdl)data)>MAX_TOK)))
1511 {
1512 leftv v=LData();
1513 return &(v->attribute);
1514 }
1515 return NULL;
1516}
Definition idrec.h:35
Class used for (list of) interpreter objects.
Definition subexpr.h:83
int rtyp
Definition subexpr.h:91
void * data
Definition subexpr.h:88
Subexpr e
Definition subexpr.h:105
leftv LData()
Definition subexpr.cc:1518
attr attribute
Definition subexpr.h:89
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
#define IDTYP(a)
Definition ipid.h:119
#define NULL
Definition omList.c:12
#define IDHDL
Definition tok.h:31
@ LIST_CMD
Definition tok.h:118
@ MAX_TOK
Definition tok.h:220

◆ CleanUp()

void sleftv::CleanUp ( ring r = currRing)

Definition at line 349 of file subexpr.cc.

350{
351 if (rtyp!=IDHDL)
352 {
353 if ((name!=NULL) && (name!=sNoName_fe) && (rtyp!=ALIAS_CMD))
354 {
355 //::Print("free %x (%s)\n",name,name);
356 omFree((ADDRESS)name); // may be larger >1000 char (large int)
357 }
358 //name=NULL;
359 //flag=0;
360 if (data!=NULL)
361 {
362 //if (rtyp==IDHDL) attribute=NULL; // is only a pointer to attribute of id
364 //data=NULL; // will be done by Init() at the end
365 }
366 if (attribute!=NULL)
367 {
368 switch (rtyp)
369 {
370 case PACKAGE_CMD:
371 //case IDHDL:
372 case ANY_TYPE:
373 case VECHO:
374 case VPRINTLEVEL:
375 case VCOLMAX:
376 case VTIMER:
377 case VRTIMER:
378 case VOICE:
379 case VMAXDEG:
380 case VMAXMULT:
381 case TRACE:
382 case VSHORTOUT:
383 case VNOETHER:
384 case VMINPOLY:
385 case 0:
386 //attribute=NULL; // will be done by Init() at the end
387 break;
388 default:
389 {
390 attribute->killAll(r);
391 }
392 }
393 }
394 }
395 Subexpr h;
396 while (e!=NULL)
397 {
398 h=e->next;
400 e=h;
401 }
402 //rtyp=NONE; // will be done by Init() at the end
403 if (next!=NULL)
404 {
405 leftv tmp_n;
406 do
407 {
408 tmp_n=next->next;
409 //next->name=NULL;
410 next->next=NULL;
411 next->CleanUp(r);
413 next=tmp_n;
414 } while (next!=NULL);
415 }
416 Init();
417}
void killAll(const ring r)
Definition attrib.cc:189
void Init()
Definition subexpr.h:107
leftv next
Definition subexpr.h:86
void CleanUp(ring r=currRing)
Definition subexpr.cc:349
const char sNoName_fe[]
Definition fevoices.cc:57
@ VMAXMULT
Definition grammar.cc:308
@ VMAXDEG
Definition grammar.cc:307
@ VMINPOLY
Definition grammar.cc:310
@ VNOETHER
Definition grammar.cc:309
EXTERN_VAR omBin sleftv_bin
Definition ipid.h:145
STATIC_VAR Poly * h
Definition janet.cc:971
#define omFree(addr)
#define omFreeBin(addr, bin)
void s_internalDelete(const int t, void *d, const ring r)
Definition subexpr.cc:516
EXTERN_VAR omBin sSubexpr_bin
Definition subexpr.h:174
int name
New type name for int.
@ VCOLMAX
Definition tok.h:211
@ ALIAS_CMD
Definition tok.h:34
@ VSHORTOUT
Definition tok.h:216
@ VPRINTLEVEL
Definition tok.h:217
@ PACKAGE_CMD
Definition tok.h:150
@ VECHO
Definition tok.h:210
@ TRACE
Definition tok.h:214
@ VTIMER
Definition tok.h:212
@ VRTIMER
Definition tok.h:213
@ VOICE
Definition tok.h:215
#define ANY_TYPE
Definition tok.h:30

◆ Copy()

void sleftv::Copy ( leftv e)

Definition at line 688 of file subexpr.cc.

689{
690 Init();
691 rtyp=source->Typ();
692 void *d=source->Data();
693 if(!errorreported)
694 {
695 if (rtyp==BUCKET_CMD)
696 {
698 data=(void*)pCopy(sBucketPeek((sBucket_pt)d));
699 }
700 else
702 if ((source->attribute!=NULL)||(source->e!=NULL))
703 attribute=source->CopyA();
704 flag=source->flag;
705 if (source->next!=NULL)
706 {
708 next->Copy(source->next);
709 }
710 }
711}
void Copy(leftv e)
Definition subexpr.cc:688
BITSET flag
Definition subexpr.h:90
VAR short errorreported
Definition feFopen.cc:23
@ BUCKET_CMD
Definition grammar.cc:284
@ POLY_CMD
Definition grammar.cc:290
#define omAllocBin(bin)
#define pCopy(p)
return a copy of the poly
Definition polys.h:185
poly sBucketPeek(sBucket_pt b)
Definition sbuckets.cc:455
static void * s_internalCopy(const int t, void *d)
Definition subexpr.cc:431
sleftv * leftv
Definition subexpr.h:79

◆ CopyA()

attr sleftv::CopyA ( )

Definition at line 756 of file subexpr.cc.

757{
758 attr *a=Attribute();
759 if ((a!=NULL) && (*a!=NULL))
760 return (*a)->Copy();
761 return NULL;
762}
Definition attrib.h:21
attr * Attribute()
Definition subexpr.cc:1504

◆ CopyD() [1/2]

void * sleftv::CopyD ( )
inline

Definition at line 119 of file subexpr.h.

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

◆ CopyD() [2/2]

void * sleftv::CopyD ( int t)

Definition at line 713 of file subexpr.cc.

714{
716 {
717 flag&=~Sy_bit(FLAG_OTHER_RING);
718 WerrorS("object from another ring");
719 return NULL;
720 }
721
722 if ((rtyp!=IDHDL)&&(rtyp!=ALIAS_CMD)&&(e==NULL))
723 {
724 if (iiCheckRing(t)) return NULL;
725 void *x = data;
726 if (rtyp==VNOETHER) x = (void *)pCopy((currRing->ppNoether));
727 else if ((rtyp==VMINPOLY) && nCoeff_is_algExt(currRing->cf) && (!nCoeff_is_GF(currRing->cf)))
728 {
729 const ring A = currRing->cf->extRing;
730
731 assume( A != NULL );
732 assume( A->qideal != NULL );
733
734 x=(void *)p_Copy(A->qideal->m[0], A);
735 }
736 data=NULL;
737 return x;
738 }
739 void *d=Data(); // will also do a iiCheckRing
740 if ((!errorreported) && (d!=NULL)) return s_internalCopy(t,d);
741 return NULL;
742}
Variable x
Definition cfModGcd.cc:4090
void * Data()
Definition subexpr.cc:1191
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition coeffs.h:843
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition coeffs.h:914
void WerrorS(const char *s)
Definition feFopen.cc:24
#define FLAG_OTHER_RING
Definition ipid.h:110
BOOLEAN iiCheckRing(int i)
Definition ipshell.cc:1587
#define assume(x)
Definition mod2.h:387
#define Sy_inset(x, s)
Definition options.h:33
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:846
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
#define A
Definition sirandom.c:24

◆ Data()

void * sleftv::Data ( )

Definition at line 1191 of file subexpr.cc.

1192{
1193 if ((rtyp!=IDHDL) && iiCheckRing(rtyp))
1194 return NULL;
1196 {
1197 flag&=~Sy_bit(FLAG_OTHER_RING);
1198 WerrorS("object from another ring");
1199 return NULL;
1200 }
1201 if (e==NULL)
1202 {
1203 switch (rtyp)
1204 {
1205 case ALIAS_CMD:
1206 {
1207 idhdl h=(idhdl)data;
1208 return ((idhdl)h->data.ustring)->data.ustring;
1209 }
1210 case VECHO: return (void *)(long)si_echo;
1211 case VPRINTLEVEL:return (void *)(long)printlevel;
1212 case VCOLMAX: return (void *)(long)colmax;
1213 case VTIMER: return (void *)(long)getTimer();
1214 case VRTIMER: return (void *)(long)getRTimer();
1215 case VOICE: return (void *)(long)(myynest+1);
1216 case VMAXDEG: return (void *)(long)Kstd1_deg;
1217 case VMAXMULT: return (void *)(long)Kstd1_mu;
1218 case TRACE: return (void *)(long)traceit;
1219 case VSHORTOUT: return (void *)(long)(currRing != NULL ? currRing->ShortOut : 0);
1220 case VMINPOLY:
1221 if ( (currRing != NULL) && nCoeff_is_algExt(currRing->cf) && !nCoeff_is_GF(currRing->cf))
1222 {
1223 /* Q(a), Fp(a), but not GF(q) */
1224 const ring A = currRing->cf->extRing;
1225
1226 assume( A != NULL );
1227 assume( A->qideal != NULL );
1228
1229 return (void *)A->qideal->m[0];
1230 }
1231 else
1232 return (void *)nInit(0);
1233
1234 case VNOETHER: return (void *) (currRing->ppNoether);
1235 case IDHDL:
1236 return IDDATA((idhdl)data);
1237 case COMMAND:
1238 //return NULL;
1239 default:
1240 return data;
1241 }
1242 }
1243 /* e != NULL : */
1244 int t=rtyp;
1245 void *d=data;
1246 if (t==IDHDL)
1247 {
1248 t=((idhdl)data)->typ;
1249 d=IDDATA((idhdl)data);
1250 }
1251 else if (t==ALIAS_CMD)
1252 {
1254 t=IDTYP(h);
1255 d=IDDATA(h);
1256 }
1257 if (iiCheckRing(t))
1258 return NULL;
1259 char *r=NULL;
1260 int index=e->start;
1261 switch (t)
1262 {
1263 case INTVEC_CMD:
1264 {
1265 intvec *iv=(intvec *)d;
1266 if ((index<1)||(index>iv->length()))
1267 {
1268 if (!errorreported)
1269 Werror("wrong range[%d] in intvec %s(%d)",index,this->Name(),iv->length());
1270 }
1271 else
1272 r=(char *)(long)((*iv)[index-1]);
1273 break;
1274 }
1275 case INTMAT_CMD:
1276 {
1277 intvec *iv=(intvec *)d;
1278 if ((index<1)
1279 ||(index>iv->rows())
1280 ||(e->next->start<1)
1281 ||(e->next->start>iv->cols()))
1282 {
1283 if (!errorreported)
1284 Werror("wrong range[%d,%d] in intmat %s(%dx%d)",index,e->next->start,
1285 this->Name(),iv->rows(),iv->cols());
1286 }
1287 else
1288 r=(char *)(long)(IMATELEM((*iv),index,e->next->start));
1289 break;
1290 }
1291 case BIGINTVEC_CMD:
1292 {
1293 bigintmat *m=(bigintmat *)d;
1294 if ((index<1)
1295 ||(index>m->cols()))
1296 {
1297 if (!errorreported)
1298 Werror("wrong range[%d] in bigintvec %s(%d)",index,this->Name(),m->cols());
1299 }
1300 else
1301 r=(char *)(BIMATELEM((*m),1,index));
1302 break;
1303 }
1304 case BIGINTMAT_CMD:
1305 {
1306 bigintmat *m=(bigintmat *)d;
1307 if ((index<1)
1308 ||(index>m->rows())
1309 ||(e->next->start<1)
1310 ||(e->next->start>m->cols()))
1311 {
1312 if (!errorreported)
1313 Werror("wrong range[%d,%d] in bigintmat %s(%dx%d)",index,e->next->start,
1314 this->Name(),m->rows(),m->cols());
1315 }
1316 else
1317 r=(char *)(BIMATELEM((*m),index,e->next->start));
1318 break;
1319 }
1320#ifdef SINGULAR_4_2
1321 case CMATRIX_CMD:
1322 {
1323 bigintmat *m=(bigintmat *)d;
1324 if ((index<1)
1325 ||(index>m->rows())
1326 ||(e->next->start<1)
1327 ||(e->next->start>m->cols()))
1328 {
1329 if (!errorreported)
1330 Werror("wrong range[%d,%d] in matrix %s(%dx%d)",index,e->next->start,
1331 this->Name(),m->rows(),m->cols());
1332 }
1333 else
1334 {
1335 iiNumber2Data[iiCmatrix_index].cf=m->basecoeffs();
1336 iiNumber2Data[iiCmatrix_index].n=BIMATELEM((*m),index,e->next->start);
1337 r=(char*)&iiNumber2Data[iiCmatrix_index];
1339 }
1340 break;
1341 }
1342#endif
1343 case IDEAL_CMD:
1344 case MODUL_CMD:
1345 case MAP_CMD:
1346 {
1347 ideal I=(ideal)d;
1348 if ((index<1)||(index>IDELEMS(I)))
1349 {
1350 if (!errorreported)
1351 Werror("wrong range[%d] in ideal/module %s(%d)",index,this->Name(),IDELEMS(I));
1352 }
1353 else
1354 r=(char *)I->m[index-1];
1355 break;
1356 }
1357 case SMATRIX_CMD:
1358 {
1359 ideal I=(ideal)d;
1360 int c;
1361 sleftv tmp;
1362 tmp.Init();
1363 tmp.rtyp=POLY_CMD;
1364 if ((index>0)&& (index<=I->rank)
1365 && (e->next!=NULL)
1366 && ((c=e->next->start)>0) &&(c<=IDELEMS(I)))
1367 {
1368 r=(char*)SMATELEM(I,index-1,c-1,currRing);
1369 }
1370 else
1371 {
1372 r=NULL;
1373 }
1374 tmp.data=r;
1375 if ((rtyp==IDHDL)||(rtyp==SMATRIX_CMD))
1376 {
1377 tmp.next=next; next=NULL;
1378 d=NULL;
1379 CleanUp();
1380 memcpy(this,&tmp,sizeof(tmp));
1381 }
1382 // and, remember, r is also the result...
1383 else
1384 {
1385 // ???
1386 // here we still have a memory leak...
1387 // example: list L="123","456";
1388 // L[1][2];
1389 // therefore, it should never happen:
1390 assume(0);
1391 // but if it happens: here is the temporary fix:
1392 // omMarkAsStaticAddr(r);
1393 }
1394 break;
1395 }
1396 case STRING_CMD:
1397 {
1398 // this was a memory leak
1399 // we evalute it, cleanup and replace this leftv by it's evalutated form
1400 // the evalutated form will be build in tmp
1401 sleftv tmp;
1402 tmp.Init();
1403 tmp.rtyp=STRING_CMD;
1404 r=(char *)omAllocBin(size_two_bin);
1405 if ((index>0)&& (index<=(int)strlen((char *)d)))
1406 {
1407 r[0]=*(((char *)d)+index-1);
1408 r[1]='\0';
1409 }
1410 else
1411 {
1412 r[0]='\0';
1413 }
1414 tmp.data=r;
1415 if ((rtyp==IDHDL)||(rtyp==STRING_CMD))
1416 {
1417 tmp.next=next; next=NULL;
1418 //if (rtyp==STRING_CMD) { omFree((ADDRESS)data); }
1419 //data=NULL;
1420 d=NULL;
1421 CleanUp();
1422 memcpy(this,&tmp,sizeof(tmp));
1423 }
1424 // and, remember, r is also the result...
1425 else
1426 {
1427 // ???
1428 // here we still have a memory leak...
1429 // example: list L="123","456";
1430 // L[1][2];
1431 // therefore, it should never happen:
1432 assume(0);
1433 // but if it happens: here is the temporary fix:
1434 // omMarkAsStaticAddr(r);
1435 }
1436 break;
1437 }
1438 case MATRIX_CMD:
1439 {
1440 if ((index<1)
1441 ||(index>MATROWS((matrix)d))
1442 ||(e->next->start<1)
1443 ||(e->next->start>MATCOLS((matrix)d)))
1444 {
1445 if (!errorreported)
1446 Werror("wrong range[%d,%d] in matrix %s(%dx%d)",
1447 index,e->next->start,
1448 this->Name(),
1449 MATROWS((matrix)d),MATCOLS((matrix)d));
1450 }
1451 else
1452 r=(char *)MATELEM((matrix)d,index,e->next->start);
1453 break;
1454 }
1455 default:
1456 {
1457 blackbox *b=NULL;
1458 if (t>MAX_TOK)
1459 {
1461 }
1462 if ((t==LIST_CMD)||((b!=NULL)&&(BB_LIKE_LIST(b))))
1463 {
1464 lists l=(lists)d;
1465 if ((0<index)&&(index<=l->nr+1))
1466 {
1467 if ((e->next!=NULL)
1468 && (l->m[index-1].rtyp==STRING_CMD))
1469 // string[..].Data() modifies sleftv, so let's do it ourself
1470 {
1471 char *dd=(char *)l->m[index-1].data;
1472 int j=e->next->start-1;
1473 r=(char *)omAllocBin(size_two_bin);
1474 if ((j>=0) && (j<(int)strlen(dd)))
1475 {
1476 r[0]=*(dd+j);
1477 r[1]='\0';
1478 }
1479 else
1480 {
1481 r[0]='\0';
1482 }
1483 }
1484 else
1485 {
1486 Subexpr tmp=l->m[index-1].e;
1487 l->m[index-1].e=e->next;
1488 r=(char *)l->m[index-1].Data();
1489 e->next=l->m[index-1].e;
1490 l->m[index-1].e=tmp;
1491 }
1492 }
1493 else //if (!errorreported)
1494 Werror("wrong range[%d] in list %s(%d)",index,this->Name(),l->nr+1);
1495 }
1496 else
1497 Werror("cannot index %s of type %s(%d)",this->Name(),Tok2Cmdname(t),t);
1498 break;
1499 }
1500 }
1501 return r;
1502}
#define BIMATELEM(M, I, J)
Definition bigintmat.h:133
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition blackbox.cc:17
#define BB_LIKE_LIST(B)
Definition blackbox.h:53
int l
Definition cfEzgcd.cc:100
int m
Definition cfEzgcd.cc:128
CanonicalForm b
Definition cfModGcd.cc:4111
Matrices of numbers.
Definition bigintmat.h:51
int cols() const
Definition bigintmat.h:144
int length() const
Definition intvec.h:94
int cols() const
Definition intvec.h:95
int rows() const
Definition intvec.h:96
const char * Name()
Definition subexpr.h:120
Definition lists.h:24
int nr
Definition lists.h:44
int j
Definition facHensel.cc:110
VAR int printlevel
Definition febase.cc:36
VAR int si_echo
Definition febase.cc:35
VAR int myynest
Definition febase.cc:41
const char * Tok2Cmdname(int tok)
Definition gentable.cc:140
@ IDEAL_CMD
Definition grammar.cc:285
@ MATRIX_CMD
Definition grammar.cc:287
@ BIGINTMAT_CMD
Definition grammar.cc:278
@ MAP_CMD
Definition grammar.cc:286
@ INTMAT_CMD
Definition grammar.cc:280
@ MODUL_CMD
Definition grammar.cc:288
@ SMATRIX_CMD
Definition grammar.cc:292
@ BIGINTVEC_CMD
Definition grammar.cc:279
#define IMATELEM(M, I, J)
Definition intvec.h:85
#define IDDATA(a)
Definition ipid.h:126
EXTERN_VAR int Kstd1_deg
Definition kstd1.h:50
EXTERN_VAR int Kstd1_mu
Definition kstd1.h:50
#define MATELEM(mat, i, j)
1-based access to matrix
Definition matpol.h:29
#define SMATELEM(A, i, j, R)
Definition matpol.h:123
#define MATROWS(i)
Definition matpol.h:26
#define MATCOLS(i)
Definition matpol.h:27
slists * lists
#define nInit(i)
Definition numbers.h:24
static int index(p_Length length, p_Ord ord)
void Werror(const char *fmt,...)
Definition reporter.cc:189
EXTERN_VAR int traceit
Definition reporter.h:24
EXTERN_VAR int colmax
Definition reporter.h:17
idrec * idhdl
Definition ring.h:21
#define IDELEMS(i)
STATIC_VAR omBin size_two_bin
Definition subexpr.cc:44
int getTimer()
Definition timer.cc:95
int getRTimer()
Definition timer.cc:170
@ INTVEC_CMD
Definition tok.h:101
@ CMATRIX_CMD
Definition tok.h:46
@ STRING_CMD
Definition tok.h:187
#define COMMAND
Definition tok.h:29

◆ Eval()

int sleftv::Eval ( )

Definition at line 1999 of file subexpr.cc.

2000{
2002 leftv nn=next;
2003 next=NULL;
2004 if(rtyp==IDHDL)
2005 {
2006 int t=Typ();
2007 if (t!=PROC_CMD)
2008 {
2009 void *d=CopyD(t);
2010 data=d;
2011 rtyp=t;
2012 name=NULL;
2013 e=NULL;
2014 }
2015 }
2016 else if (rtyp==COMMAND)
2017 {
2018 command d=(command)data;
2019 if(d->op==PROC_CMD) //assume d->argc==2
2020 {
2021 char *what=(char *)(d->arg1.Data());
2022 idhdl h=ggetid(what);
2023 if((h!=NULL)&&(IDTYP(h)==PROC_CMD))
2024 {
2025 nok=d->arg2.Eval();
2026 if(!nok)
2027 {
2028 nok=iiMake_proc(h,req_packhdl,&d->arg2);
2029 this->CleanUp(currRing);
2030 if (!nok)
2031 {
2032 memcpy(this,&iiRETURNEXPR,sizeof(sleftv));
2034 }
2035 }
2036 }
2037 else nok=TRUE;
2038 }
2039 else if (d->op=='=') //assume d->argc==2
2040 {
2041 if ((d->arg1.rtyp!=IDHDL)&&(d->arg1.rtyp!=DEF_CMD))
2042 {
2043 nok=d->arg1.Eval();
2044 }
2045 if (!nok)
2046 {
2047 const char *n=d->arg1.name;
2048 nok=(n == NULL) || d->arg2.Eval();
2049 if (!nok)
2050 {
2051 int save_typ=d->arg1.rtyp;
2052 omCheckAddr((ADDRESS)n);
2053 if (d->arg1.rtyp!=IDHDL)
2054 syMake(&d->arg1,n);
2055 omCheckAddr((ADDRESS)d->arg1.name);
2056 if (d->arg1.rtyp==IDHDL)
2057 {
2058 n=omStrDup(IDID((idhdl)d->arg1.data));
2059 killhdl((idhdl)d->arg1.data);
2060 d->arg1.Init();
2061 //d->arg1.data=NULL;
2062 d->arg1.name=n;
2063 }
2064 d->arg1.rtyp=DEF_CMD;
2065 sleftv t;
2066 if(save_typ!=PROC_CMD) save_typ=d->arg2.rtyp;
2067 if (::RingDependend(d->arg2.rtyp))
2068 nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&currRing->idroot);
2069 else
2070 nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&IDROOT);
2071 memcpy(&d->arg1,&t,sizeof(sleftv));
2072 omCheckAddr((ADDRESS)d->arg1.name);
2073 nok=nok||iiAssign(&d->arg1,&d->arg2);
2074 omCheckIf(d->arg1.name != NULL, // OB: ????
2075 omCheckAddr((ADDRESS)d->arg1.name));
2076 if (!nok)
2077 {
2078 d->arg1.Init();
2079 this->CleanUp();
2080 rtyp=NONE;
2081 }
2082 }
2083 }
2084 else nok=TRUE;
2085 }
2086 else
2087 {
2088 sleftv tmp; tmp.Init();
2089 int toktype=iiTokType(d->op);
2090 if ((toktype==CMD_M)
2091 ||( toktype==ROOT_DECL_LIST)
2092 ||( toktype==RING_DECL_LIST))
2093 {
2094 if (d->argc <=3)
2095 {
2096 if (d->argc>=1) nok=d->arg1.Eval();
2097 if ((!nok) && (d->argc>=2))
2098 {
2099 nok=d->arg2.Eval();
2100 d->arg1.next=(leftv)omAllocBin(sleftv_bin);
2101 memcpy(d->arg1.next,&d->arg2,sizeof(sleftv));
2102 d->arg2.Init();
2103 }
2104 if ((!nok) && (d->argc==3))
2105 {
2106 nok=d->arg3.Eval();
2107 d->arg1.next->next=(leftv)omAllocBin(sleftv_bin);
2108 memcpy(d->arg1.next->next,&d->arg3,sizeof(sleftv));
2109 d->arg3.Init();
2110 }
2111 if (d->argc==0)
2112 nok=nok||iiExprArithM(&tmp,NULL,d->op);
2113 else
2114 nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
2115 }
2116 else
2117 {
2118 nok=d->arg1.Eval();
2119 nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
2120 }
2121 }
2122 else if (d->argc==1)
2123 {
2124 nok=d->arg1.Eval();
2125 nok=nok||iiExprArith1(&tmp,&d->arg1,d->op);
2126 }
2127 else if(d->argc==2)
2128 {
2129 nok=d->arg1.Eval();
2130 nok=nok||d->arg2.Eval();
2131 nok=nok||iiExprArith2(&tmp,&d->arg1,d->op,&d->arg2);
2132 }
2133 else if(d->argc==3)
2134 {
2135 nok=d->arg1.Eval();
2136 nok=nok||d->arg2.Eval();
2137 nok=nok||d->arg3.Eval();
2138 nok=nok||iiExprArith3(&tmp,d->op,&d->arg1,&d->arg2,&d->arg3);
2139 }
2140 else if(d->argc!=0)
2141 {
2142 nok=d->arg1.Eval();
2143 nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
2144 }
2145 else // d->argc == 0
2146 {
2147 nok = iiExprArithM(&tmp, NULL, d->op);
2148 }
2149 this->CleanUp();
2150 memcpy(this,&tmp,sizeof(tmp));
2151 }
2152 }
2153 else if (((rtyp==0)||(rtyp==DEF_CMD))
2154 &&(name!=NULL))
2155 {
2156 syMake(this,name);
2157 }
2158#ifdef MDEBUG
2159 switch(Typ())
2160 {
2161 case NUMBER_CMD:
2162#ifdef LDEBUG
2163 nTest((number)Data());
2164#endif
2165 break;
2166 case BIGINT_CMD:
2167#ifdef LDEBUG
2169#endif
2170 break;
2171 case POLY_CMD:
2172 pTest((poly)Data());
2173 break;
2174 case IDEAL_CMD:
2175 case MODUL_CMD:
2176 case MATRIX_CMD:
2177 {
2178 ideal id=(ideal)Data();
2179 omCheckAddrSize(id,sizeof(*id));
2180 int i=id->ncols*id->nrows-1;
2181 for(;i>=0;i--) pTest(id->m[i]);
2182 }
2183 break;
2184 }
2185#endif
2186 if (nn!=NULL) nok=nok||nn->Eval();
2187 next=nn;
2188 return nok;
2189}
int BOOLEAN
Definition auxiliary.h:87
#define TRUE
Definition auxiliary.h:100
#define FALSE
Definition auxiliary.h:96
int i
Definition cfEzgcd.cc:132
package req_packhdl
Definition subexpr.h:106
BOOLEAN RingDependend()
Definition subexpr.cc:419
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition coeffs.h:716
@ RING_DECL_LIST
Definition grammar.cc:323
@ PROC_CMD
Definition grammar.cc:281
@ ROOT_DECL_LIST
Definition grammar.cc:321
@ NUMBER_CMD
Definition grammar.cc:289
@ CMD_M
Definition grammar.cc:319
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
Definition iparith.cc:9182
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition iparith.cc:9371
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition iparith.cc:9672
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition iparith.cc:9581
int iiTokType(int op)
Definition iparith.cc:233
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition ipassign.cc:2034
idhdl ggetid(const char *n)
Definition ipid.cc:560
void killhdl(idhdl h, package proot)
Definition ipid.cc:393
VAR coeffs coeffs_BIGINT
Definition ipid.cc:50
ip_command * command
Definition ipid.h:23
#define IDID(a)
Definition ipid.h:122
#define IDROOT
Definition ipid.h:19
BOOLEAN iiMake_proc(idhdl pn, package pack, leftv args)
Definition iplib.cc:512
INST_VAR sleftv iiRETURNEXPR
Definition iplib.cc:482
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition ipshell.cc:1199
#define nTest(a)
Definition numbers.h:35
#define omStrDup(s)
#define omCheckAddr(addr)
#define omCheckIf(cond, test)
#define omCheckAddrSize(addr, size)
#define pTest(p)
Definition polys.h:414
void syMake(leftv v, const char *name, package pa=NULL)
Definition subexpr.cc:1612
@ BIGINT_CMD
Definition tok.h:38
@ DEF_CMD
Definition tok.h:58
#define NONE
Definition tok.h:223

◆ Fullname()

const char * sleftv::Fullname ( )
inline

Definition at line 125 of file subexpr.h.

126 {
127 if ((name!=NULL) && (e==NULL)) return(this->name);
128 else return sNoName_fe;
129 }

◆ Init()

void sleftv::Init ( )
inline

Definition at line 107 of file subexpr.h.

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

◆ LData()

leftv sleftv::LData ( )

Definition at line 1518 of file subexpr.cc.

1519{
1520 if (e!=NULL)
1521 {
1522 lists l=NULL;
1524
1525 if ((rtyp==LIST_CMD)
1526 || ((b!=NULL)&&(BB_LIKE_LIST(b))))
1527 l=(lists)data;
1528 else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1529 l=IDLIST((idhdl)data);
1530 else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)>MAX_TOK))
1531 {
1533 if (BB_LIKE_LIST(b)) l=IDLIST((idhdl)data);
1534 }
1535 else if (rtyp==ALIAS_CMD)
1536 {
1537 idhdl h=(idhdl)data;
1538 l= (lists)(((idhdl)h->data.ustring)->data.ustring);
1539 }
1540 if (l!=NULL)
1541 {
1542 if ((0>=e->start)||(e->start>l->nr+1))
1543 return NULL;
1544 if (e->next!=NULL)
1545 {
1546 l->m[e->start-1].e=e->next;
1547 leftv r=l->m[e->start-1].LData();
1548 l->m[e->start-1].e=NULL;
1549 return r;
1550 }
1551 return &(l->m[e->start-1]);
1552 }
1553 }
1554 return this;
1555}
#define IDLIST(a)
Definition ipid.h:137

◆ listLength()

int sleftv::listLength ( )

Definition at line 51 of file subexpr.cc.

52{
53 int n = 1;
54 leftv sl = next;
55 while (sl!=NULL)
56 {
57 n++;
58 sl=sl->next;
59 }
60 return n;
61}

◆ LTyp()

int sleftv::LTyp ( )

Definition at line 1155 of file subexpr.cc.

1156{
1157 lists l=NULL;
1158 int r;
1159 if (rtyp==LIST_CMD)
1160 l=(lists)data;
1161 else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1162 l=IDLIST((idhdl)data);
1163 else
1164 return Typ();
1165 //if (l!=NULL)
1166 {
1167 if ((e!=NULL) && (e->next!=NULL))
1168 {
1169 if ((0<e->start)&&(e->start<=l->nr+1))
1170 {
1171 l->m[e->start-1].e=e->next;
1172 r=l->m[e->start-1].LTyp();
1173 l->m[e->start-1].e=NULL;
1174 }
1175 else
1176 {
1177 //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1178 r=NONE;
1179 }
1180 return r;
1181 }
1182 return LIST_CMD;
1183 }
1184 return Typ();
1185}

◆ Name()

const char * sleftv::Name ( )
inline

Definition at line 120 of file subexpr.h.

121 {
122 if ((name!=NULL) && (e==NULL)) return name;
123 else return sNoName_fe;
124 }
const char * name
Definition subexpr.h:87

◆ Next()

leftv sleftv::Next ( )
inline

Definition at line 136 of file subexpr.h.

136{ return next; }

◆ Print()

void sleftv::Print ( leftv store = NULL,
int spaces = 0 )

Called by type_cmd (e.g. "r;") or as default in jPRINT.

Definition at line 63 of file subexpr.cc.

64{
65 int t=Typ();
66 if (errorreported) return;
67#ifdef SIQ
68 if (rtyp==COMMAND)
69 {
71 char ch[2];
72 ch[0]=c->op;ch[1]='\0';
73 const char *s=ch;
74 if (c->op>127) s=iiTwoOps(c->op);
75 ::Print("##command %d(%s), %d args\n",
76 c->op, s, c->argc);
77 if (c->argc>0)
78 c->arg1.Print(NULL,spaces+2);
79 if(c->argc<4)
80 {
81 if (c->argc>1)
82 c->arg2.Print(NULL,spaces+2);
83 if (c->argc>2)
84 c->arg3.Print(NULL,spaces+2);
85 }
86 PrintS("##end");
87 }
88 else
89#endif
90 {
91 const char *n=Name();
92 char *s;
93 void *d=Data();
94 if (errorreported) return;
95
96 switch (t /*=Typ()*/)
97 {
98 case CRING_CMD:
99 crPrint((coeffs)d);
100 break;
101#ifdef SINGULAR_4_2
102 case CNUMBER_CMD:
103 n2Print((number2)d);
104 break;
105 case CPOLY_CMD:
106 p2Print((poly2)d);
107 break;
108 case CMATRIX_CMD: // like BIGINTMAT
109#endif
110 case BIGINTVEC_CMD:
111 case BIGINTMAT_CMD:
112 ((bigintmat *)d)->pprint(colmax);
113 break;
114 case BUCKET_CMD:
115 {
117 if ((e==NULL)
118 && (TEST_V_QRING)
119 &&(currRing->qideal!=NULL))
120 {
121 poly p=pCopy(sBucketPeek(b));
124 pWrite0(p);
125 pDelete(&p);
126 break;
127 }
128 else
130 }
131 break;
132 case UNKNOWN:
133 case DEF_CMD:
135 PrintS("`");PrintS(n);PrintS("`");
136 break;
137 case PACKAGE_CMD:
139 paPrint(n,(package)d);
140 break;
141 case LIB_CMD:
142 case NONE:
143 return;
144 case INTVEC_CMD:
145 case INTMAT_CMD:
146 ((intvec *)d)->show(t,spaces);
147 break;
148 case RING_CMD:
149 {
151 const ring r = (ring)d;
152 rWrite(r, currRing == r);
153 break;
154 }
155 case MATRIX_CMD:
157 break;
158 case SMATRIX_CMD:
159 {
161 ipPrint_MA0(m, n);
163 break;
164 }
165 case MODUL_CMD:
166 case IDEAL_CMD:
167 if ((TEST_V_QRING) &&(currRing->qideal!=NULL)
168 &&(!hasFlag(this,FLAG_QRING)))
169 {
170 jjNormalizeQRingId(this);
171 d=Data();
172 }
173 // no break:
174 case MAP_CMD:
176 break;
177 case POLY_CMD:
178 case VECTOR_CMD:
179 if ((e==NULL)
180 && (TEST_V_QRING)
181 &&(currRing->qideal!=NULL)
182 &&(!hasFlag(this,FLAG_QRING)))
183 {
184 setFlag(this,FLAG_QRING);
185 poly p=(poly)d;
187 if (p!=(poly)d)
188 {
189 d=(void*)p;
190 if ((rtyp==POLY_CMD)||(rtyp==VECTOR_CMD)) data=d;
191 else if (rtyp==IDHDL)
192 {
193 idhdl h=(idhdl)data;
194 IDPOLY(h)=p;
196 }
197 }
198 }
200 pWrite0((poly)d);
201 break;
202 case RESOLUTION_CMD:
203 {
206 break;
207 }
208 case STRING_CMD:
210 PrintS((char *)d);
211 break;
212 case INT_CMD:
214 ::Print("%ld",(long)d);
215 break;
216 case PROC_CMD:
217 {
219
221 PrintS("// libname : ");
222 PrintS(piProcinfo(pi, "libname"));
223 PrintLn();
224
226 PrintS("// procname : ");
227 PrintS(piProcinfo(pi, "procname"));
228 PrintLn();
229
231 PrintS("// type : ");
232 PrintS(piProcinfo(pi, "type"));
233 // ::Print("%-*.*s// ref : %s",spaces,spaces," ",
234 // piProcinfo(pi, "ref"));
235 break;
236 }
237 case LINK_CMD:
238 {
239 si_link l=(si_link)d;
241 ::Print("// type : %s\n", slStatus(l, "type"));
243 ::Print("// mode : %s\n", slStatus(l, "mode"));
245 ::Print("// name : %s\n", slStatus(l, "name"));
247 ::Print("// open : %s\n", slStatus(l, "open"));
249 ::Print("// read : %s\n", slStatus(l, "read"));
251 ::Print("// write: %s", slStatus(l, "write"));
252 break;
253 }
254 case BIGINT_CMD:
255 s=String(d);
256 if (s==NULL) return;
258 PrintS(s);
259 omFree((ADDRESS)s);
260 break;
261 case NUMBER_CMD:
262 {
263 number n=(number)d;
264 nNormalize(n);
265 if ((number)d !=n)
266 {
267 d=n;
268 if (rtyp==IDHDL) IDNUMBER(((idhdl)data))=n;
269 else if(rtyp==NUMBER_CMD) data=(void*)n;
270 }
271 s=String(d);
272 if (s==NULL) return;
273 PrintS(s);
274 omFree((ADDRESS)s);
275 break;
276 }
277 case LIST_CMD:
278 {
279 lists l=(lists)d;
280 if (lSize(l)<0)
281 {
283 PrintS("empty list\n");
284 }
285 else
286 {
287 int i=0;
288 for (;i<=l->nr;i++)
289 {
290 if (l->m[i].rtyp!=DEF_CMD)
291 {
293 ::Print("[%d]:\n",i+1);
294 l->m[i].Print(NULL,spaces+3);
295 }
296 }
297 }
298 break;
299 }
300
301 default:
302 if (t>MAX_TOK)
303 {
306 if (bb!=NULL) { bb->blackbox_Print(bb,d); }
307 else { ::Print("Print: blackbox %d(bb=NULL)",t); }
308 }
309 else
310 ::Print("Print:unknown type %s(%d)", Tok2Cmdname(t),t);
311 } /* end switch: (Typ()) */
312 if ((store!=NULL)&&(store!=this))
313 store->CleanUp();
314 }
315 if (next!=NULL)
316 {
317 if (t==COMMAND) PrintLn();
318 else if (t!=LIST_CMD) PrintS(" ");
320 }
321 else if ((t!=LIST_CMD)&&(t!=SMATRIX_CMD))
322 {
323 PrintLn();
324 }
325#ifdef SIQ
326 if (rtyp!=COMMAND)
327#endif
328 {
329 if ((store!=NULL)
330 && (store!=this))
331 {
332 if((t/*Typ()*/!=LINK_CMD)
333 && (t/*Typ()*/!=PACKAGE_CMD)
334 && (t/*Typ()*/!=DEF_CMD)
335 )
336 {
337 store->rtyp=t/*Typ()*/;
338 store->data=CopyD();
339 if(attribute!=NULL)
340 {
341 store->attribute=CopyA();
342 }
343 store->flag=flag;
344 }
345 }
346 }
347}
int p
Definition cfModGcd.cc:4086
char * String(void *d=NULL, BOOLEAN typed=FALSE, int dim=1)
Called for conversion to string (used by string(..), write(..),..)
Definition subexpr.cc:764
attr CopyA()
Definition subexpr.cc:756
void Print(leftv store=NULL, int spaces=0)
Called by type_cmd (e.g. "r;") or as default in jPRINT.
Definition subexpr.cc:63
#define Print
Definition emacs.cc:80
const CanonicalForm int s
Definition facAbsFact.cc:51
const char * iiTwoOps(int t)
Definition gentable.cc:261
@ LIB_CMD
Definition grammar.cc:328
@ VECTOR_CMD
Definition grammar.cc:293
@ RESOLUTION_CMD
Definition grammar.cc:291
@ RING_CMD
Definition grammar.cc:282
void ipPrint_MA0(matrix m, const char *name)
Definition ipprint.cc:57
ideal id_Copy(ideal h1, const ring r)
copy an ideal
void jjNormalizeQRingId(leftv I)
Definition ipassign.cc:2396
VAR idhdl currRingHdl
Definition ipid.cc:59
#define hasFlag(A, F)
Definition ipid.h:112
#define setFlag(A, F)
Definition ipid.h:113
#define IDPOLY(a)
Definition ipid.h:130
#define FLAG_QRING
Definition ipid.h:108
#define IDNUMBER(a)
Definition ipid.h:132
#define jjNormalizeQRingP(p)
Definition ipid.h:103
void paPrint(const char *n, package p)
Definition ipshell.cc:6335
#define pi
Definition libparse.cc:1145
int lSize(lists L)
Definition lists.cc:25
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
Definition matpol.cc:827
The main handler for Singular numbers which are suitable for Singular polynomials.
void crPrint(coeffs c)
Definition number2.cc:25
#define nNormalize(n)
Definition numbers.h:30
#define TEST_V_QRING
Definition options.h:131
#define pDelete(p_ptr)
Definition polys.h:186
void pWrite0(poly p)
Definition polys.h:309
void PrintNSpaces(const int n)
Definition reporter.cc:364
void PrintS(const char *s)
Definition reporter.cc:284
void PrintLn()
Definition reporter.cc:310
void rWrite(ring r, BOOLEAN details)
Definition ring.cc:227
void sBucketPrint(sBucket_pt bucket)
Definition sbuckets.cc:466
sBucket * sBucket_pt
Definition sbuckets.h:16
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
matrix id_Module2Matrix(ideal mod, const ring R)
ip_package * package
Definition structs.h:43
const char * piProcinfo(procinfov pi, const char *request)
Definition ipid.cc:702
procinfo * procinfov
Definition subexpr.h:66
ssyStrategy * syStrategy
Definition syz.h:36
void syPrint(syStrategy syzstr, const char *currRingName)
Definition syz1.cc:1935
@ CRING_CMD
Definition tok.h:56
@ CNUMBER_CMD
Definition tok.h:47
@ LINK_CMD
Definition tok.h:117
@ CPOLY_CMD
Definition tok.h:48
@ INT_CMD
Definition tok.h:96
#define UNKNOWN
Definition tok.h:224

◆ RingDependend()

BOOLEAN sleftv::RingDependend ( )

Definition at line 419 of file subexpr.cc.

420{
421 int rt=Typ();
422 if(::RingDependend(rt))
423 return TRUE;
424 if (rt==LIST_CMD)
425 return lRingDependend((lists)Data());
426 if (this->next!=NULL)
427 return this->next->RingDependend();
428 return FALSE;
429}
BOOLEAN lRingDependend(lists L)
Definition lists.cc:222

◆ String()

char * sleftv::String ( void * d = NULL,
BOOLEAN typed = FALSE,
int dim = 1 )

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

Definition at line 764 of file subexpr.cc.

765{
766#ifdef SIQ
767 if (rtyp==COMMAND)
768 {
769 ::Print("##command %d\n",((command)data)->op);
770 if (((command)data)->arg1.rtyp!=0)
771 ((command)data)->arg1.Print(NULL,2);
772 if (((command)data)->arg2.rtyp!=0)
773 ((command)data)->arg2.Print(NULL,2);
774 if (((command)data)->arg3.rtyp==0)
775 ((command)data)->arg3.Print(NULL,2);
776 PrintS("##end\n");
777 return omStrDup("");
778 }
779#endif
780 if (d==NULL) d=Data();
781 if (!errorreported)
782 {
783 char *s;
784 int t=Typ();
785 switch (t /*Typ()*/)
786 {
787 case INT_CMD:
788 if (typed)
789 {
790 #if SIZEOF_LONG==8
791 const size_t len=MAX_INT_LEN+17;
792 #else
793 const size_t len=MAX_INT_LEN+7;
794 #endif
795 s=(char*)omAlloc(len);
796 snprintf(s,len,"int(%ld)",(long)d);
797 }
798 else
799 {
800 #if SIZEOF_LONG==8
801 const size_t len=MAX_INT_LEN+12;
802 #else
803 const size_t len=MAX_INT_LEN+2;
804 #endif
805 s=(char*)omAlloc(len);
806 snprintf(s,len,"%ld",(long)d);
807 }
808 return s;
809
810 case STRING_CMD:
811 if (d == NULL)
812 {
813 if (typed) return omStrDup("\"\"");
814 return omStrDup("");
815 }
816 if (typed)
817 {
818 size_t len=strlen((char*) d) + 3;
819 s = (char*) omAlloc(len);
820 snprintf(s,len,"\"%s\"", (char*) d);
821 return s;
822 }
823 else
824 {
825 return omStrDup((char*)d);
826 }
827
828 case POLY_CMD:
829 case VECTOR_CMD:
830 if (typed)
831 {
832 char* ps = pString((poly) d);
833 size_t len=strlen(ps) + 10;
834 s = (char*) omAlloc(len);
835 snprintf(s,len,"%s(%s)", (t /*Typ()*/ == POLY_CMD ? "poly" : "vector"), ps);
836 omFree(ps);
837 return s;
838 }
839 else
840 return pString((poly)d);
841
842 case CRING_CMD:
843 return nCoeffString((coeffs)d);
844 #ifdef SINGULAR_4_2
845 case CNUMBER_CMD:
846 return n2String((number2)d,typed);
847 case CMATRIX_CMD:
848 {
849 bigintmat *b=(bigintmat*)d;
850 return b->String();
851 }
852 #endif
853
854 case NUMBER_CMD:
855 StringSetS((char*) (typed ? "number(" : ""));
857 {
858 nfShowMipo(currRing->cf);
859 }
860 else
861 {
862 nWrite((number)d);
863 }
864 StringAppendS((char*) (typed ? ")" : ""));
865 return StringEndS();
866
867 case BIGINT_CMD:
868 {
869 StringSetS((char*) (typed ? "bigint(" : ""));
870 number nl=(number)d;
872 StringAppendS((char*) (typed ? ")" : ""));
873 return StringEndS();
874 }
875 case BUCKET_CMD:
876 return sBucketString((sBucket_pt)d);
877 case MATRIX_CMD:
879 if (typed)
880 {
881 size_t len=strlen(s) + 40;
882 char* ns = (char*) omAlloc(len);
883 snprintf(ns,len, "matrix(ideal(%s),%d,%d)", s,
884 ((ideal) d)->nrows, ((ideal) d)->ncols);
886 return ns;
887 }
888 else
889 {
890 return omStrDup(s);
891 }
892
893 case IDEAL_CMD:
894 case MAP_CMD:
895 case MODUL_CMD:
896 case SMATRIX_CMD:
898 if (typed)
899 {
900 size_t len=strlen(s) + 10;
901 char* ns = (char*) omAlloc(len);
902 if ((t/*Typ()*/==IDEAL_CMD)||(t==MAP_CMD))
903 snprintf(ns,len, "ideal(%s)", s);
904 else /*MODUL_CMD, SMATRIX_CMD */
905 snprintf(ns,len, "module(%s)", s);
906 omFree(s);
908 return ns;
909 }
910 return s;
911
912 case INTVEC_CMD:
913 case INTMAT_CMD:
914 {
915 intvec *v=(intvec *)d;
916 s = v->String(dim);
917 if (typed)
918 {
919 char* ns;
920 if (t/*Typ()*/ == INTMAT_CMD)
921 {
922 size_t len=strlen(s) + 40;
923 ns = (char*) omAlloc(len);
924 snprintf(ns,len, "intmat(intvec(%s),%d,%d)", s, v->rows(), v->cols());
925 }
926 else
927 {
928 size_t len=strlen(s) + 10;
929 ns = (char*) omAlloc(len);
930 snprintf(ns,len, "intvec(%s)", s);
931 }
933 omFree(s);
934 return ns;
935 }
936 else
937 return s;
938 }
939 case BIGINTMAT_CMD:
940 {
941 bigintmat *bim=(bigintmat*)d;
942 s = bim->String();
943 if (typed)
944 {
945 size_t len=strlen(s) + 40;
946 char* ns = (char*) omAlloc(len);
947 snprintf(ns,len, "bigintmat(bigintvec(%s),%d,%d)", s, bim->rows(), bim->cols());
948 return ns;
949 }
950 else
951 return omStrDup(s);
952 }
953 case BIGINTVEC_CMD:
954 {
955 bigintmat *bim=(bigintmat*)d;
956 s = bim->String();
957 if (typed)
958 {
959 size_t len=strlen(s) + 40;
960 char* ns = (char*) omAlloc(len);
961 snprintf(ns,len, "bigintvec(%s)", s);
962 return ns;
963 }
964 else
965 return omStrDup(s);
966 }
967
968 case RING_CMD:
969 s = rString((ring)d);
970
971 if (typed)
972 {
973 char* ns;
974 ring r=(ring)d;
975 if (r->qideal!=NULL)
976 {
977 char* id = iiStringMatrix((matrix) ((ring) d)->qideal, dim,
978 currRing);
979 size_t len=strlen(s) + strlen(id) + 20;
980 ns = (char*) omAlloc(len);
981 snprintf(ns,len, "\"%s\";%sideal(%s)", s,(dim == 2 ? "\n" : " "), id);
982 }
983 else
984 {
985 size_t len=strlen(s) + 4;
986 ns = (char*) omAlloc(len);
987 snprintf(ns,len, "\"%s\"", s);
988 }
989 omFree(s);
991 return ns;
992 }
993 return s;
994 case RESOLUTION_CMD:
995 {
997 s = lString(l, typed, dim);
998 l->Clean();
999 return s;
1000 }
1001
1002 case PROC_CMD:
1003 {
1004 procinfo* pi = (procinfo*) d;
1005 if((pi->language == LANG_SINGULAR) && (pi->data.s.body!=NULL))
1006 s = (pi->data.s.body);
1007 else
1008 s = (char *)"";
1009 if (typed)
1010 {
1011 size_t len=strlen(s) + 4;
1012 char* ns = (char*) omAlloc(len);
1013 snprintf(ns,len, "\"%s\"", s);
1014 return ns;
1015 }
1016 return omStrDup(s);
1017 }
1018
1019 case LINK_CMD:
1020 s = slString((si_link) d);
1021 if (typed)
1022 {
1023 size_t len=strlen(s) + 10;
1024 char* ns = (char*) omAlloc(len);
1025 snprintf(ns,len, "link(\"%s\")", s);
1027 omCheckAddr(ns);
1028 return ns;
1029 }
1030 return s;
1031
1032 case LIST_CMD:
1033 return lString((lists) d, typed, dim);
1034
1035 default:
1036 if(t> MAX_TOK)
1037 {
1039 if (bb!=NULL) return bb->blackbox_String(bb,d);
1040 }
1041 } /* end switch: (Typ()) */
1042 }
1043 return omStrDup("");
1044}
int int ncols
Definition cf_linsys.cc:32
int nrows
Definition cf_linsys.cc:32
int rows() const
Definition bigintmat.h:145
char * String()
IO: String returns a singular string containing the matrix, needs freeing afterwards.
Definition bigintmat.cc:432
static FORCE_INLINE char * nCoeffString(const coeffs cf)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
Definition coeffs.h:963
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition coeffs.h:595
void nfShowMipo(const coeffs r)
Show the mininimal polynom.... NOTE: this is used by char * sleftv::String(void *d,...
Definition ffields.cc:547
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition ipshell.cc:3184
char * lString(lists l, BOOLEAN typed, int dim)
Definition lists.cc:403
char * iiStringMatrix(matrix im, int dim, const ring r, char ch)
Definition matpol.cc:848
const int MAX_INT_LEN
Definition mylimits.h:13
#define nWrite(n)
Definition numbers.h:29
#define omAlloc(size)
#define omFreeBinAddr(addr)
char * pString(poly p)
Definition polys.h:306
void StringSetS(const char *st)
Definition reporter.cc:128
void StringAppendS(const char *st)
Definition reporter.cc:107
char * StringEndS()
Definition reporter.cc:151
char * rString(ring r)
Definition ring.cc:675
static BOOLEAN rField_is_GF(const ring r)
Definition ring.h:526
char * sBucketString(sBucket_pt bucket)
Definition sbuckets.cc:461
@ LANG_SINGULAR
Definition subexpr.h:22
int dim(ideal I, ring r)

◆ Typ()

int sleftv::Typ ( )

Definition at line 1047 of file subexpr.cc.

1048{
1049 if (e==NULL)
1050 {
1051 switch (rtyp)
1052 {
1053 case IDHDL:
1054 return IDTYP((idhdl)data);
1055 case ALIAS_CMD:
1056 {
1057 idhdl h=(idhdl)data;
1058 return ((idhdl)h->data.ustring)->typ;
1059 }
1060 case VECHO:
1061 case VPRINTLEVEL:
1062 case VCOLMAX:
1063 case VTIMER:
1064 case VRTIMER:
1065 case VOICE:
1066 case VMAXDEG:
1067 case VMAXMULT:
1068 case TRACE:
1069 case VSHORTOUT:
1070 return INT_CMD;
1071 case VMINPOLY:
1072 data=NULL;
1073 return NUMBER_CMD;
1074 case VNOETHER:
1075 data=NULL;
1076 return POLY_CMD;
1077 //case COMMAND:
1078 // return COMMAND;
1079 default:
1080 return rtyp;
1081 }
1082 }
1083 int r=0;
1084 int t=rtyp;
1085 void *d=data;
1086 if (t==IDHDL) t=IDTYP((idhdl)d);
1087 else if (t==ALIAS_CMD)
1088 { idhdl h=(idhdl)IDDATA((idhdl)data); t=IDTYP(h);d=IDDATA(h); }
1089 switch (t)
1090 {
1091#ifdef SINGULAR_4_2
1092 case CMATRIX_CMD:
1093 {
1094 bigintmat *b=(bigintmat*)d;
1095 if ((currRing!=NULL)&&(currRing->cf==b->basecoeffs()))
1096 return NUMBER_CMD;
1097 else
1098 return CNUMBER_CMD;
1099 }
1100#endif
1101 case INTVEC_CMD:
1102 case INTMAT_CMD:
1103 r=INT_CMD;
1104 break;
1105 case BIGINTVEC_CMD:
1106 case BIGINTMAT_CMD:
1107 r=BIGINT_CMD;
1108 break;
1109 case IDEAL_CMD:
1110 case MATRIX_CMD:
1111 case MAP_CMD:
1112 case SMATRIX_CMD:
1113 r=POLY_CMD;
1114 break;
1115 case MODUL_CMD:
1116 r=VECTOR_CMD;
1117 break;
1118 case STRING_CMD:
1119 r=STRING_CMD;
1120 break;
1121 default:
1122 {
1123 blackbox *b=NULL;
1124 if (t>MAX_TOK)
1125 {
1127 }
1128 if ((t==LIST_CMD)||((b!=NULL)&&BB_LIKE_LIST(b)))
1129 {
1130 lists l;
1131 if (rtyp==IDHDL) l=IDLIST((idhdl)d);
1132 else l=(lists)d;
1133 if ((0<e->start)&&(e->start<=l->nr+1))
1134 {
1135 Subexpr tmp=l->m[e->start-1].e;
1136 l->m[e->start-1].e=e->next;
1137 r=l->m[e->start-1].Typ();
1138 e->next=l->m[e->start-1].e;
1139 l->m[e->start-1].e=tmp;
1140 }
1141 else
1142 {
1143 //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1144 r=DEF_CMD;
1145 }
1146 }
1147 else
1148 Werror("cannot index type %s(%d)",Tok2Cmdname(t),t);
1149 break;
1150 }
1151 }
1152 return r;
1153}

Field Documentation

◆ attribute

attr sleftv::attribute

Definition at line 89 of file subexpr.h.

◆ data

void* sleftv::data

Definition at line 88 of file subexpr.h.

◆ e

Subexpr sleftv::e

Definition at line 105 of file subexpr.h.

◆ flag

BITSET sleftv::flag

Definition at line 90 of file subexpr.h.

◆ name

const char* sleftv::name

Definition at line 87 of file subexpr.h.

◆ next

leftv sleftv::next

Definition at line 86 of file subexpr.h.

◆ req_packhdl

package sleftv::req_packhdl

Definition at line 106 of file subexpr.h.

◆ rtyp

int sleftv::rtyp

Definition at line 91 of file subexpr.h.


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