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.
 
charString (void *d=NULL, BOOLEAN typed=FALSE, int dim=1)
 Called for conversion to string (used by string(..), write(..),..)
 
void Copy (leftv e)
 
attr CopyA ()
 
voidCopyD (int t)
 
voidCopyD ()
 
const charName ()
 
const charFullname ()
 
int Typ ()
 
int LTyp ()
 
voidData ()
 
leftv LData ()
 
attrAttribute ()
 
leftv Next ()
 
int listLength ()
 
int Eval ()
 
BOOLEAN RingDependend ()
 

Data Fields

leftv next
 
const charname
 
voiddata
 
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 1505 of file subexpr.cc.

1506{
1507 if (e==NULL) return &attribute;
1508 if ((rtyp==LIST_CMD)
1509 ||((rtyp==IDHDL)&&(IDTYP((idhdl)data)==LIST_CMD))
1510 || (rtyp>MAX_TOK)
1511 || ((rtyp==IDHDL)&&(IDTYP((idhdl)data)>MAX_TOK)))
1512 {
1513 leftv v=LData();
1514 return &(v->attribute);
1515 }
1516 return NULL;
1517}
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:1519
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 351 of file subexpr.cc.

352{
353 if (rtyp!=IDHDL)
354 {
355 if ((name!=NULL) && (name!=sNoName_fe) && (rtyp!=ALIAS_CMD))
356 {
357 //::Print("free %x (%s)\n",name,name);
358 omFree((ADDRESS)name); // may be larger >1000 char (large int)
359 }
360 //name=NULL;
361 //flag=0;
362 if (data!=NULL)
363 {
364 //if (rtyp==IDHDL) attribute=NULL; // is only a pointer to attribute of id
366 //data=NULL; // will be done by Init() at the end
367 }
368 if (attribute!=NULL)
369 {
370 switch (rtyp)
371 {
372 case PACKAGE_CMD:
373 //case IDHDL:
374 case ANY_TYPE:
375 case VECHO:
376 case VPRINTLEVEL:
377 case VCOLMAX:
378 case VTIMER:
379 case VRTIMER:
380 case VOICE:
381 case VMAXDEG:
382 case VMAXMULT:
383 case TRACE:
384 case VSHORTOUT:
385 case VNOETHER:
386 case VMINPOLY:
387 case 0:
388 //attribute=NULL; // will be done by Init() at the end
389 break;
390 default:
391 {
392 attribute->killAll(r);
393 }
394 }
395 }
396 }
397 Subexpr h;
398 while (e!=NULL)
399 {
400 h=e->next;
402 e=h;
403 }
404 //rtyp=NONE; // will be done by Init() at the end
405 if (next!=NULL)
406 {
407 leftv tmp_n;
408 do
409 {
410 tmp_n=next->next;
411 //next->name=NULL;
412 next->next=NULL;
413 next->CleanUp(r);
415 next=tmp_n;
416 } while (next!=NULL);
417 }
418 Init();
419}
void killAll(const ring r)
Definition attrib.cc:189
const char * name
Definition subexpr.h:87
void Init()
Definition subexpr.h:107
leftv next
Definition subexpr.h:86
void CleanUp(ring r=currRing)
Definition subexpr.cc:351
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:518
EXTERN_VAR omBin sSubexpr_bin
Definition subexpr.h:174
@ 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 689 of file subexpr.cc.

690{
691 Init();
692 rtyp=source->Typ();
693 void *d=source->Data();
694 if(!errorreported)
695 {
696 if (rtyp==BUCKET_CMD)
697 {
699 data=(void*)pCopy(sBucketPeek((sBucket_pt)d));
700 }
701 else
703 if ((source->attribute!=NULL)||(source->e!=NULL))
704 attribute=source->CopyA();
705 flag=source->flag;
706 if (source->next!=NULL)
707 {
709 next->Copy(source->next);
710 }
711 }
712}
void Copy(leftv e)
Definition subexpr.cc:689
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:433
sleftv * leftv
Definition subexpr.h:79

◆ CopyA()

attr sleftv::CopyA ( )

Definition at line 757 of file subexpr.cc.

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

◆ CopyD() [1/2]

void * sleftv::CopyD ( )
inline

Definition at line 119 of file subexpr.h.

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

◆ CopyD() [2/2]

void * sleftv::CopyD ( int  t)

Definition at line 714 of file subexpr.cc.

715{
717 {
718 flag&=~Sy_bit(FLAG_OTHER_RING);
719 WerrorS("object from another ring");
720 return NULL;
721 }
722
723 if ((rtyp!=IDHDL)&&(rtyp!=ALIAS_CMD)&&(e==NULL))
724 {
725 if (iiCheckRing(t)) return NULL;
726 void *x = data;
727 if (rtyp==VNOETHER) x = (void *)pCopy((currRing->ppNoether));
728 else if ((rtyp==VMINPOLY) && nCoeff_is_algExt(currRing->cf) && (!nCoeff_is_GF(currRing->cf)))
729 {
730 const ring A = currRing->cf->extRing;
731
732 assume( A != NULL );
733 assume( A->qideal != NULL );
734
735 x=(void *)p_Copy(A->qideal->m[0], A);
736 }
737 data=NULL;
738 return x;
739 }
740 void *d=Data(); // will also do a iiCheckRing
741 if ((!errorreported) && (d!=NULL)) return s_internalCopy(t,d);
742 return NULL;
743}
Variable x
Definition cfModGcd.cc:4090
void * Data()
Definition subexpr.cc:1192
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition coeffs.h:832
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition coeffs.h:903
void WerrorS(const char *s)
Definition feFopen.cc:24
#define FLAG_OTHER_RING
Definition ipid.h:110
BOOLEAN iiCheckRing(int i)
Definition ipshell.cc:1585
#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 1192 of file subexpr.cc.

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

2001{
2003 leftv nn=next;
2004 next=NULL;
2005 if(rtyp==IDHDL)
2006 {
2007 int t=Typ();
2008 if (t!=PROC_CMD)
2009 {
2010 void *d=CopyD(t);
2011 data=d;
2012 rtyp=t;
2013 name=NULL;
2014 e=NULL;
2015 }
2016 }
2017 else if (rtyp==COMMAND)
2018 {
2019 command d=(command)data;
2020 if(d->op==PROC_CMD) //assume d->argc==2
2021 {
2022 char *what=(char *)(d->arg1.Data());
2023 idhdl h=ggetid(what);
2024 if((h!=NULL)&&(IDTYP(h)==PROC_CMD))
2025 {
2026 nok=d->arg2.Eval();
2027 if(!nok)
2028 {
2029 nok=iiMake_proc(h,req_packhdl,&d->arg2);
2030 this->CleanUp(currRing);
2031 if (!nok)
2032 {
2033 memcpy(this,&iiRETURNEXPR,sizeof(sleftv));
2035 }
2036 }
2037 }
2038 else nok=TRUE;
2039 }
2040 else if (d->op=='=') //assume d->argc==2
2041 {
2042 if ((d->arg1.rtyp!=IDHDL)&&(d->arg1.rtyp!=DEF_CMD))
2043 {
2044 nok=d->arg1.Eval();
2045 }
2046 if (!nok)
2047 {
2048 const char *n=d->arg1.name;
2049 nok=(n == NULL) || d->arg2.Eval();
2050 if (!nok)
2051 {
2052 int save_typ=d->arg1.rtyp;
2053 omCheckAddr((ADDRESS)n);
2054 if (d->arg1.rtyp!=IDHDL)
2055 syMake(&d->arg1,n);
2056 omCheckAddr((ADDRESS)d->arg1.name);
2057 if (d->arg1.rtyp==IDHDL)
2058 {
2059 n=omStrDup(IDID((idhdl)d->arg1.data));
2060 killhdl((idhdl)d->arg1.data);
2061 d->arg1.Init();
2062 //d->arg1.data=NULL;
2063 d->arg1.name=n;
2064 }
2065 d->arg1.rtyp=DEF_CMD;
2066 sleftv t;
2067 if(save_typ!=PROC_CMD) save_typ=d->arg2.rtyp;
2068 if (::RingDependend(d->arg2.rtyp))
2069 nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&currRing->idroot);
2070 else
2071 nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&IDROOT);
2072 memcpy(&d->arg1,&t,sizeof(sleftv));
2073 omCheckAddr((ADDRESS)d->arg1.name);
2074 nok=nok||iiAssign(&d->arg1,&d->arg2);
2075 omCheckIf(d->arg1.name != NULL, // OB: ????
2076 omCheckAddr((ADDRESS)d->arg1.name));
2077 if (!nok)
2078 {
2079 d->arg1.Init();
2080 this->CleanUp();
2081 rtyp=NONE;
2082 }
2083 }
2084 }
2085 else nok=TRUE;
2086 }
2087 else
2088 {
2089 sleftv tmp; tmp.Init();
2090 int toktype=iiTokType(d->op);
2091 if ((toktype==CMD_M)
2092 ||( toktype==ROOT_DECL_LIST)
2093 ||( toktype==RING_DECL_LIST))
2094 {
2095 if (d->argc <=3)
2096 {
2097 if (d->argc>=1) nok=d->arg1.Eval();
2098 if ((!nok) && (d->argc>=2))
2099 {
2100 nok=d->arg2.Eval();
2101 d->arg1.next=(leftv)omAllocBin(sleftv_bin);
2102 memcpy(d->arg1.next,&d->arg2,sizeof(sleftv));
2103 d->arg2.Init();
2104 }
2105 if ((!nok) && (d->argc==3))
2106 {
2107 nok=d->arg3.Eval();
2108 d->arg1.next->next=(leftv)omAllocBin(sleftv_bin);
2109 memcpy(d->arg1.next->next,&d->arg3,sizeof(sleftv));
2110 d->arg3.Init();
2111 }
2112 if (d->argc==0)
2113 nok=nok||iiExprArithM(&tmp,NULL,d->op);
2114 else
2115 nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
2116 }
2117 else
2118 {
2119 nok=d->arg1.Eval();
2120 nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
2121 }
2122 }
2123 else if (d->argc==1)
2124 {
2125 nok=d->arg1.Eval();
2126 nok=nok||iiExprArith1(&tmp,&d->arg1,d->op);
2127 }
2128 else if(d->argc==2)
2129 {
2130 nok=d->arg1.Eval();
2131 nok=nok||d->arg2.Eval();
2132 nok=nok||iiExprArith2(&tmp,&d->arg1,d->op,&d->arg2);
2133 }
2134 else if(d->argc==3)
2135 {
2136 nok=d->arg1.Eval();
2137 nok=nok||d->arg2.Eval();
2138 nok=nok||d->arg3.Eval();
2139 nok=nok||iiExprArith3(&tmp,d->op,&d->arg1,&d->arg2,&d->arg3);
2140 }
2141 else if(d->argc!=0)
2142 {
2143 nok=d->arg1.Eval();
2144 nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
2145 }
2146 else // d->argc == 0
2147 {
2148 nok = iiExprArithM(&tmp, NULL, d->op);
2149 }
2150 this->CleanUp();
2151 memcpy(this,&tmp,sizeof(tmp));
2152 }
2153 }
2154 else if (((rtyp==0)||(rtyp==DEF_CMD))
2155 &&(name!=NULL))
2156 {
2157 syMake(this,name);
2158 }
2159#ifdef MDEBUG
2160 switch(Typ())
2161 {
2162 case NUMBER_CMD:
2163#ifdef LDEBUG
2164 nTest((number)Data());
2165#endif
2166 break;
2167 case BIGINT_CMD:
2168#ifdef LDEBUG
2170#endif
2171 break;
2172 case POLY_CMD:
2173 pTest((poly)Data());
2174 break;
2175 case IDEAL_CMD:
2176 case MODUL_CMD:
2177 case MATRIX_CMD:
2178 {
2179 ideal id=(ideal)Data();
2180 omCheckAddrSize(id,sizeof(*id));
2181 int i=id->ncols*id->nrows-1;
2182 for(;i>=0;i--) pTest(id->m[i]);
2183 }
2184 break;
2185 }
2186#endif
2187 if (nn!=NULL) nok=nok||nn->Eval();
2188 next=nn;
2189 return nok;
2190}
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:421
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition coeffs.h:713
@ 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:9163
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition iparith.cc:9352
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition iparith.cc:9653
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition iparith.cc:9562
int iiTokType(int op)
Definition iparith.cc:228
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition ipassign.cc:2097
idhdl ggetid(const char *n)
Definition ipid.cc:583
void killhdl(idhdl h, package proot)
Definition ipid.cc:416
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:1197
#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:1613
@ 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 1519 of file subexpr.cc.

1520{
1521 if (e!=NULL)
1522 {
1523 lists l=NULL;
1525
1526 if ((rtyp==LIST_CMD)
1527 || ((b!=NULL)&&(BB_LIKE_LIST(b))))
1528 l=(lists)data;
1529 else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1530 l=IDLIST((idhdl)data);
1531 else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)>MAX_TOK))
1532 {
1534 if (BB_LIKE_LIST(b)) l=IDLIST((idhdl)data);
1535 }
1536 else if (rtyp==ALIAS_CMD)
1537 {
1538 idhdl h=(idhdl)data;
1539 l= (lists)(((idhdl)h->data.ustring)->data.ustring);
1540 }
1541 if (l!=NULL)
1542 {
1543 if ((0>=e->start)||(e->start>l->nr+1))
1544 return NULL;
1545 if (e->next!=NULL)
1546 {
1547 l->m[e->start-1].e=e->next;
1548 leftv r=l->m[e->start-1].LData();
1549 l->m[e->start-1].e=NULL;
1550 return r;
1551 }
1552 return &(l->m[e->start-1]);
1553 }
1554 }
1555 return this;
1556}
#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 1156 of file subexpr.cc.

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

◆ 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 }

◆ 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 BIGINTMAT_CMD:
111 ((bigintmat *)d)->pprint(colmax);
112 break;
113 case BIGINTVEC_CMD:
114 ((bigintmat *)d)->pprint(4096); // allow longer bigintvec
115 break;
116 case BUCKET_CMD:
117 {
119 if ((e==NULL)
120 && (TEST_V_QRING)
121 &&(currRing->qideal!=NULL))
122 {
123 poly p=pCopy(sBucketPeek(b));
126 pWrite0(p);
127 pDelete(&p);
128 break;
129 }
130 else
132 }
133 break;
134 case UNKNOWN:
135 case DEF_CMD:
137 PrintS("`");PrintS(n);PrintS("`");
138 break;
139 case PACKAGE_CMD:
141 paPrint(n,(package)d);
142 break;
143 case LIB_CMD:
144 case NONE:
145 return;
146 case INTVEC_CMD:
147 case INTMAT_CMD:
148 ((intvec *)d)->show(t,spaces);
149 break;
150 case RING_CMD:
151 {
153 const ring r = (ring)d;
154 rWrite(r, currRing == r);
155 break;
156 }
157 case MATRIX_CMD:
159 break;
160 case SMATRIX_CMD:
161 {
163 ipPrint_MA0(m, n);
165 break;
166 }
167 case MODUL_CMD:
168 case IDEAL_CMD:
169 if ((TEST_V_QRING) &&(currRing->qideal!=NULL)
170 &&(!hasFlag(this,FLAG_QRING)))
171 {
172 jjNormalizeQRingId(this);
173 d=Data();
174 }
175 // no break:
176 case MAP_CMD:
178 break;
179 case POLY_CMD:
180 case VECTOR_CMD:
181 if ((e==NULL)
182 && (TEST_V_QRING)
183 &&(currRing->qideal!=NULL)
184 &&(!hasFlag(this,FLAG_QRING)))
185 {
186 setFlag(this,FLAG_QRING);
187 poly p=(poly)d;
189 if (p!=(poly)d)
190 {
191 d=(void*)p;
192 if ((rtyp==POLY_CMD)||(rtyp==VECTOR_CMD)) data=d;
193 else if (rtyp==IDHDL)
194 {
195 idhdl h=(idhdl)data;
196 IDPOLY(h)=p;
198 }
199 }
200 }
202 pWrite0((poly)d);
203 break;
204 case RESOLUTION_CMD:
205 {
208 break;
209 }
210 case STRING_CMD:
212 PrintS((char *)d);
213 break;
214 case INT_CMD:
216 ::Print("%ld",(long)d);
217 break;
218 case PROC_CMD:
219 {
221
223 PrintS("// libname : ");
224 PrintS(piProcinfo(pi, "libname"));
225 PrintLn();
226
228 PrintS("// procname : ");
229 PrintS(piProcinfo(pi, "procname"));
230 PrintLn();
231
233 PrintS("// type : ");
234 PrintS(piProcinfo(pi, "type"));
235 // ::Print("%-*.*s// ref : %s",spaces,spaces," ",
236 // piProcinfo(pi, "ref"));
237 break;
238 }
239 case LINK_CMD:
240 {
241 si_link l=(si_link)d;
243 ::Print("// type : %s\n", slStatus(l, "type"));
245 ::Print("// mode : %s\n", slStatus(l, "mode"));
247 ::Print("// name : %s\n", slStatus(l, "name"));
249 ::Print("// open : %s\n", slStatus(l, "open"));
251 ::Print("// read : %s\n", slStatus(l, "read"));
253 ::Print("// write: %s", slStatus(l, "write"));
254 break;
255 }
256 case BIGINT_CMD:
257 s=String(d);
258 if (s==NULL) return;
260 PrintS(s);
261 omFree((ADDRESS)s);
262 break;
263 case NUMBER_CMD:
264 {
265 number n=(number)d;
266 nNormalize(n);
267 if ((number)d !=n)
268 {
269 d=n;
270 if (rtyp==IDHDL) IDNUMBER(((idhdl)data))=n;
271 else if(rtyp==NUMBER_CMD) data=(void*)n;
272 }
273 s=String(d);
274 if (s==NULL) return;
275 PrintS(s);
276 omFree((ADDRESS)s);
277 break;
278 }
279 case LIST_CMD:
280 {
281 lists l=(lists)d;
282 if (lSize(l)<0)
283 {
285 PrintS("empty list\n");
286 }
287 else
288 {
289 int i=0;
290 for (;i<=l->nr;i++)
291 {
292 if (l->m[i].rtyp!=DEF_CMD)
293 {
295 ::Print("[%d]:\n",i+1);
296 l->m[i].Print(NULL,spaces+3);
297 }
298 }
299 }
300 break;
301 }
302
303 default:
304 if (t>MAX_TOK)
305 {
308 if (bb!=NULL) { bb->blackbox_Print(bb,d); }
309 else { ::Print("Print: blackbox %d(bb=NULL)",t); }
310 }
311 else
312 ::Print("Print:unknown type %s(%d)", Tok2Cmdname(t),t);
313 } /* end switch: (Typ()) */
314 if ((store!=NULL)&&(store!=this))
315 store->CleanUp();
316 }
317 if (next!=NULL)
318 {
319 if (t==COMMAND) PrintLn();
320 else if (t!=LIST_CMD) PrintS(" ");
322 }
323 else if ((t!=LIST_CMD)&&(t!=SMATRIX_CMD))
324 {
325 PrintLn();
326 }
327#ifdef SIQ
328 if (rtyp!=COMMAND)
329#endif
330 {
331 if ((store!=NULL)
332 && (store!=this))
333 {
334 if((t/*Typ()*/!=LINK_CMD)
335 && (t/*Typ()*/!=PACKAGE_CMD)
336 && (t/*Typ()*/!=DEF_CMD)
337 )
338 {
339 store->rtyp=t/*Typ()*/;
340 store->data=CopyD();
341 if(attribute!=NULL)
342 {
343 store->attribute=CopyA();
344 }
345 store->flag=flag;
346 }
347 }
348 }
349}
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:765
attr CopyA()
Definition subexpr.cc:757
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:256
@ 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:2459
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:6325
#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:725
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 421 of file subexpr.cc.

422{
423 int rt=Typ();
424 if(::RingDependend(rt))
425 return TRUE;
426 if (rt==LIST_CMD)
427 return lRingDependend((lists)Data());
428 if (this->next!=NULL)
429 return this->next->RingDependend();
430 return FALSE;
431}
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 765 of file subexpr.cc.

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

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

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: