Loading...
Searching...
No Matches
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 1505 of file subexpr.cc.

{
if (e==NULL) return &attribute;
if ((rtyp==LIST_CMD)
||((rtyp==IDHDL)&&(IDTYP((idhdl)data)==LIST_CMD))
|| (rtyp>MAX_TOK)
|| ((rtyp==IDHDL)&&(IDTYP((idhdl)data)>MAX_TOK)))
{
leftv v=LData();
return &(v->attribute);
}
return NULL;
}
sleftv::rtyp
int rtyp
Definition subexpr.h:91
sleftv::data
void * data
Definition subexpr.h:88
sleftv::e
Subexpr e
Definition subexpr.h:105
sleftv::LData
leftv LData()
Definition subexpr.cc:1519
sleftv::attribute
attr attribute
Definition subexpr.h:89
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
IDTYP
#define IDTYP(a)
Definition ipid.h:119
NULL
#define NULL
Definition omList.c:12
idhdl
idrec * idhdl
Definition ring.h:22
leftv
sleftv * leftv
Definition subexpr.h:79
IDHDL
#define IDHDL
Definition tok.h:31
LIST_CMD
@ LIST_CMD
Definition tok.h:118
MAX_TOK
@ MAX_TOK
Definition tok.h:220

## CleanUp()

void sleftv::CleanUp | ( | ring | r = currRing | ) |

Definition at line 351 of file subexpr.cc.

{
if (rtyp!=IDHDL)
{
if ((name!=NULL) && (name!=sNoName_fe) && (rtyp!=ALIAS_CMD))
{
//::Print("free %x (%s)\n",name,name);
omFree((ADDRESS)name); // may be larger >1000 char (large int)
}
//name=NULL;
//flag=0;
if (data!=NULL)
{
//if (rtyp==IDHDL) attribute=NULL; // is only a pointer to attribute of id
s_internalDelete(rtyp,data,r);
//data=NULL; // will be done by Init() at the end
}
if (attribute!=NULL)
{
switch (rtyp)
{
case PACKAGE_CMD:
//case IDHDL:
case ANY_TYPE:
case VECHO:
case VPRINTLEVEL:
case VCOLMAX:
case VTIMER:
case VRTIMER:
case VOICE:
case VMAXDEG:
case VMAXMULT:
case TRACE:
case VSHORTOUT:
case VNOETHER:
case VMINPOLY:
case 0:
//attribute=NULL; // will be done by Init() at the end
break;
default:
{
attribute->killAll(r);
}
}
}
}
Subexpr h;
while (e!=NULL)
{
h=e->next;
omFreeBin((ADDRESS)e, sSubexpr_bin);
e=h;
}
//rtyp=NONE; // will be done by Init() at the end
if (next!=NULL)
{
leftv tmp_n;
do
{
tmp_n=next->next;
//next->name=NULL;
next->next=NULL;
next->CleanUp(r);
omFreeBin((ADDRESS)next, sleftv_bin);
next=tmp_n;
} while (next!=NULL);
}
Init();
}
ADDRESS
void * ADDRESS
Definition auxiliary.h:120
sleftv::name
const char * name
Definition subexpr.h:87
sleftv::Init
void Init()
Definition subexpr.h:107
sleftv::next
leftv next
Definition subexpr.h:86
sNoName_fe
const char sNoName_fe[]
Definition fevoices.cc:57
VMAXMULT
@ VMAXMULT
Definition grammar.cc:308
VMAXDEG
@ VMAXDEG
Definition grammar.cc:307
VMINPOLY
@ VMINPOLY
Definition grammar.cc:310
VNOETHER
@ VNOETHER
Definition grammar.cc:309
sleftv_bin
EXTERN_VAR omBin sleftv_bin
Definition ipid.h:145
h
STATIC_VAR Poly * h
Definition janet.cc:971
omFree
#define omFree(addr)
Definition omAllocDecl.h:261
omFreeBin
#define omFreeBin(addr, bin)
Definition omAllocDecl.h:259
s_internalDelete
void s_internalDelete(const int t, void *d, const ring r)
Definition subexpr.cc:518
sSubexpr_bin
EXTERN_VAR omBin sSubexpr_bin
Definition subexpr.h:174
VCOLMAX
@ VCOLMAX
Definition tok.h:211
ALIAS_CMD
@ ALIAS_CMD
Definition tok.h:34
VSHORTOUT
@ VSHORTOUT
Definition tok.h:216
VPRINTLEVEL
@ VPRINTLEVEL
Definition tok.h:217
PACKAGE_CMD
@ PACKAGE_CMD
Definition tok.h:150
VECHO
@ VECHO
Definition tok.h:210
TRACE
@ TRACE
Definition tok.h:214
VTIMER
@ VTIMER
Definition tok.h:212
VRTIMER
@ VRTIMER
Definition tok.h:213
VOICE
@ VOICE
Definition tok.h:215
ANY_TYPE
#define ANY_TYPE
Definition tok.h:30

## Copy()

void sleftv::Copy | ( | leftv | e | ) |

Definition at line 689 of file subexpr.cc.

{
Init();
rtyp=source->Typ();
void *d=source->Data();
if(!errorreported)
{
if (rtyp==BUCKET_CMD)
{
rtyp=POLY_CMD;
data=(void*)pCopy(sBucketPeek((sBucket_pt)d));
}
else
data=s_internalCopy(rtyp,d);
if ((source->attribute!=NULL)||(source->e!=NULL))
attribute=source->CopyA();
flag=source->flag;
if (source->next!=NULL)
{
next=(leftv)omAllocBin(sleftv_bin);
next->Copy(source->next);
}
}
}
sleftv::flag
BITSET flag
Definition subexpr.h:90
errorreported
VAR short errorreported
Definition feFopen.cc:23
BUCKET_CMD
@ BUCKET_CMD
Definition grammar.cc:284
POLY_CMD
@ POLY_CMD
Definition grammar.cc:290
omAllocBin
#define omAllocBin(bin)
Definition omAllocDecl.h:205
pCopy
#define pCopy(p)
return a copy of the poly
Definition polys.h:186
sBucketPeek
poly sBucketPeek(sBucket_pt b)
Definition sbuckets.cc:455
sBucket_pt
sBucket * sBucket_pt
Definition sbuckets.h:16
s_internalCopy
static void * s_internalCopy(const int t, void *d)
Definition subexpr.cc:433

## CopyA()

attr sleftv::CopyA | ( |  | ) |

Definition at line 757 of file subexpr.cc.

{
attr *a=Attribute();
if ((a!=NULL) && (*a!=NULL))
return (*a)->Copy();
return NULL;
}
attr
sattr * attr
Definition attrib.h:16
sleftv::Attribute
attr * Attribute()
Definition subexpr.cc:1505

## CopyD() [1/2]

void * sleftv::CopyD | ( |  | ) |

inline

Definition at line 119 of file subexpr.h.

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

## CopyD() [2/2]

void * sleftv::CopyD | ( | int | t | ) |

Definition at line 714 of file subexpr.cc.

{
if (Sy_inset(FLAG_OTHER_RING,flag))
{
flag&=~Sy_bit(FLAG_OTHER_RING);
Werror("object(of type %s) from another ring",Tok2Cmdname(t));
return NULL;
}
if ((rtyp!=IDHDL)&&(rtyp!=ALIAS_CMD)&&(e==NULL))
{
if (iiCheckRing(t)) return NULL;
void *x = data;
if (rtyp==VNOETHER) x = (void *)pCopy((currRing->ppNoether));
else if ((rtyp==VMINPOLY) && nCoeff_is_algExt(currRing->cf) && (!nCoeff_is_GF(currRing->cf)))
{
const ring A = currRing->cf->extRing;
assume( A != NULL );
assume( A->qideal != NULL );
x=(void *)p_Copy(A->qideal->m[0], A);
}
data=NULL;
return x;
}
void *d=Data(); // will also do a iiCheckRing
if ((!errorreported) && (d!=NULL)) return s_internalCopy(t,d);
return NULL;
}
x
Variable x
Definition cfModGcd.cc:4090
sleftv::Data
void * Data()
Definition subexpr.cc:1192
nCoeff_is_GF
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition coeffs.h:834
nCoeff_is_algExt
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition coeffs.h:905
Tok2Cmdname
const char * Tok2Cmdname(int tok)
Definition gentable.cc:137
FLAG_OTHER_RING
#define FLAG_OTHER_RING
Definition ipid.h:110
iiCheckRing
BOOLEAN iiCheckRing(int i)
Definition ipshell.cc:1585
assume
#define assume(x)
Definition mod2.h:389
Sy_inset
#define Sy_inset(x, s)
Definition options.h:33
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:848
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
Werror
void Werror(const char *fmt,...)
Definition reporter.cc:189
A
#define A
Definition sirandom.c:24

## Data()

void * sleftv::Data | ( |  | ) |

Definition at line 1192 of file subexpr.cc.

{
if ((rtyp!=IDHDL) && iiCheckRing(rtyp))
return NULL;
if (Sy_inset(FLAG_OTHER_RING,flag))
{
flag&=~Sy_bit(FLAG_OTHER_RING);
Werror("object(of type %s) from another ring",Tok2Cmdname(rtyp));
return NULL;
}
if (e==NULL)
{
switch (rtyp)
{
case ALIAS_CMD:
{
idhdl h=(idhdl)data;
return ((idhdl)h->data.ustring)->data.ustring;
}
case VECHO: return (void *)(long)si_echo;
case VPRINTLEVEL:return (void *)(long)printlevel;
case VCOLMAX: return (void *)(long)colmax;
case VTIMER: return (void *)(long)getTimer();
case VRTIMER: return (void *)(long)getRTimer();
case VOICE: return (void *)(long)(myynest+1);
case VMAXDEG: return (void *)(long)Kstd1_deg;
case VMAXMULT: return (void *)(long)Kstd1_mu;
case TRACE: return (void *)(long)traceit;
case VSHORTOUT: return (void *)(long)(currRing != NULL ? currRing->ShortOut : 0);
case VMINPOLY:
if ( (currRing != NULL) && nCoeff_is_algExt(currRing->cf) && !nCoeff_is_GF(currRing->cf))
{
/* Q(a), Fp(a), but not GF(q) */
const ring A = currRing->cf->extRing;
assume( A != NULL );
assume( A->qideal != NULL );
return (void *)A->qideal->m[0];
}
else
return (void *)nInit(0);
case VNOETHER: return (void *) (currRing->ppNoether);
case IDHDL:
return IDDATA((idhdl)data);
case COMMAND:
//return NULL;
default:
return data;
}
}
/* e != NULL : */
int t=rtyp;
void *d=data;
if (t==IDHDL)
{
t=((idhdl)data)->typ;
d=IDDATA((idhdl)data);
}
else if (t==ALIAS_CMD)
{
idhdl h=(idhdl)IDDATA((idhdl)data);
t=IDTYP(h);
d=IDDATA(h);
}
if (iiCheckRing(t))
return NULL;
char *r=NULL;
int index=e->start;
switch (t)
{
case INTVEC_CMD:
{
intvec *iv=(intvec *)d;
if ((index<1)||(index>iv->length()))
{
if (!errorreported)
Werror("wrong range[%d] in intvec %s(%d)",index,this->Name(),iv->length());
}
else
r=(char *)(long)((*iv)[index-1]);
break;
}
case INTMAT_CMD:
{
intvec *iv=(intvec *)d;
if ((index<1)
||(index>iv->rows())
||(e->next->start<1)
||(e->next->start>iv->cols()))
{
if (!errorreported)
Werror("wrong range[%d,%d] in intmat %s(%dx%d)",index,e->next->start,
this->Name(),iv->rows(),iv->cols());
}
else
r=(char *)(long)(IMATELEM((*iv),index,e->next->start));
break;
}
case BIGINTVEC_CMD:
{
bigintmat *m=(bigintmat *)d;
if ((index<1)
||(index>m->cols()))
{
if (!errorreported)
Werror("wrong range[%d] in bigintvec %s(%d)",index,this->Name(),m->cols());
}
else
r=(char *)(BIMATELEM((*m),1,index));
break;
}
case BIGINTMAT_CMD:
{
bigintmat *m=(bigintmat *)d;
if ((index<1)
||(index>m->rows())
||(e->next->start<1)
||(e->next->start>m->cols()))
{
if (!errorreported)
Werror("wrong range[%d,%d] in bigintmat %s(%dx%d)",index,e->next->start,
this->Name(),m->rows(),m->cols());
}
else
r=(char *)(BIMATELEM((*m),index,e->next->start));
break;
}
#ifdef SINGULAR_4_2
case CMATRIX_CMD:
{
bigintmat *m=(bigintmat *)d;
if ((index<1)
||(index>m->rows())
||(e->next->start<1)
||(e->next->start>m->cols()))
{
if (!errorreported)
Werror("wrong range[%d,%d] in matrix %s(%dx%d)",index,e->next->start,
this->Name(),m->rows(),m->cols());
}
else
{
iiNumber2Data[iiCmatrix_index].cf=m->basecoeffs();
iiNumber2Data[iiCmatrix_index].n=BIMATELEM((*m),index,e->next->start);
r=(char*)&iiNumber2Data[iiCmatrix_index];
iiCmatrix_index=(iiCmatrix_index+1) % 4;
}
break;
}
#endif
case IDEAL_CMD:
case MODUL_CMD:
case MAP_CMD:
{
ideal I=(ideal)d;
if ((index<1)||(index>IDELEMS(I)))
{
if (!errorreported)
Werror("wrong range[%d] in ideal/module %s(%d)",index,this->Name(),IDELEMS(I));
}
else
r=(char *)I->m[index-1];
break;
}
case SMATRIX_CMD:
{
ideal I=(ideal)d;
int c;
sleftv tmp;
tmp.Init();
tmp.rtyp=POLY_CMD;
if ((index>0)&& (index<=I->rank)
&& (e->next!=NULL)
&& ((c=e->next->start)>0) &&(c<=IDELEMS(I)))
{
r=(char*)SMATELEM(I,index-1,c-1,currRing);
}
else
{
r=NULL;
}
tmp.data=r;
if ((rtyp==IDHDL)||(rtyp==SMATRIX_CMD))
{
tmp.next=next; next=NULL;
d=NULL;
CleanUp();
memcpy(this,&tmp,sizeof(tmp));
}
// and, remember, r is also the result...
else
{
// ???
// here we still have a memory leak...
// example: list L="123","456";
// L[1][2];
// therefore, it should never happen:
assume(0);
// but if it happens: here is the temporary fix:
// omMarkAsStaticAddr(r);
}
break;
}
case STRING_CMD:
{
// this was a memory leak
// we evalute it, cleanup and replace this leftv by it's evalutated form
// the evalutated form will be build in tmp
sleftv tmp;
tmp.Init();
tmp.rtyp=STRING_CMD;
r=(char *)omAllocBin(size_two_bin);
if ((index>0)&& (index<=(int)strlen((char *)d)))
{
r[0]=*(((char *)d)+index-1);
r[1]='\0';
}
else
{
r[0]='\0';
}
tmp.data=r;
if ((rtyp==IDHDL)||(rtyp==STRING_CMD))
{
tmp.next=next; next=NULL;
//if (rtyp==STRING_CMD) { omFree((ADDRESS)data); }
//data=NULL;
d=NULL;
CleanUp();
memcpy(this,&tmp,sizeof(tmp));
}
// and, remember, r is also the result...
else
{
// ???
// here we still have a memory leak...
// example: list L="123","456";
// L[1][2];
// therefore, it should never happen:
assume(0);
// but if it happens: here is the temporary fix:
// omMarkAsStaticAddr(r);
}
break;
}
case MATRIX_CMD:
{
if ((index<1)
||(index>MATROWS((matrix)d))
||(e->next->start<1)
||(e->next->start>MATCOLS((matrix)d)))
{
if (!errorreported)
Werror("wrong range[%d,%d] in matrix %s(%dx%d)",
index,e->next->start,
this->Name(),
MATROWS((matrix)d),MATCOLS((matrix)d));
}
else
r=(char *)MATELEM((matrix)d,index,e->next->start);
break;
}
default:
{
blackbox *b=NULL;
if (t>MAX_TOK)
{
b=getBlackboxStuff(t);
}
if ((t==LIST_CMD)||((b!=NULL)&&(BB_LIKE_LIST(b))))
{
lists l=(lists)d;
if ((0<index)&&(index<=l->nr+1))
{
if ((e->next!=NULL)
&& (l->m[index-1].rtyp==STRING_CMD))
// string[..].Data() modifies sleftv, so let's do it ourself
{
char *dd=(char *)l->m[index-1].data;
int j=e->next->start-1;
r=(char *)omAllocBin(size_two_bin);
if ((j>=0) && (j<(int)strlen(dd)))
{
r[0]=*(dd+j);
r[1]='\0';
}
else
{
r[0]='\0';
}
}
else
{
Subexpr tmp=l->m[index-1].e;
l->m[index-1].e=e->next;
r=(char *)l->m[index-1].Data();
e->next=l->m[index-1].e;
l->m[index-1].e=tmp;
}
}
else //if (!errorreported)
Werror("wrong range[%d] in list %s(%d)",index,this->Name(),l->nr+1);
}
else
Werror("cannot index %s of type %s(%d)",this->Name(),Tok2Cmdname(t),t);
break;
}
}
return r;
}
BIMATELEM
#define BIMATELEM(M, I, J)
Definition bigintmat.h:133
getBlackboxStuff
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition blackbox.cc:17
BB_LIKE_LIST
#define BB_LIKE_LIST(B)
Definition blackbox.h:53
l
int l
Definition cfEzgcd.cc:100
m
int m
Definition cfEzgcd.cc:128
b
CanonicalForm b
Definition cfModGcd.cc:4111
intvec::length
int length() const
Definition intvec.h:95
intvec::cols
int cols() const
Definition intvec.h:96
intvec::rows
int rows() const
Definition intvec.h:97
sleftv::Name
const char * Name()
Definition subexpr.h:120
sleftv::CleanUp
void CleanUp(ring r=currRing)
Definition subexpr.cc:351
j
int j
Definition facHensel.cc:110
printlevel
VAR int printlevel
Definition febase.cc:36
si_echo
VAR int si_echo
Definition febase.cc:35
myynest
VAR int myynest
Definition febase.cc:41
IDEAL_CMD
@ IDEAL_CMD
Definition grammar.cc:285
MATRIX_CMD
@ MATRIX_CMD
Definition grammar.cc:287
BIGINTMAT_CMD
@ BIGINTMAT_CMD
Definition grammar.cc:278
MAP_CMD
@ MAP_CMD
Definition grammar.cc:286
INTMAT_CMD
@ INTMAT_CMD
Definition grammar.cc:280
MODUL_CMD
@ MODUL_CMD
Definition grammar.cc:288
SMATRIX_CMD
@ SMATRIX_CMD
Definition grammar.cc:292
BIGINTVEC_CMD
@ BIGINTVEC_CMD
Definition grammar.cc:279
IMATELEM
#define IMATELEM(M, I, J)
Definition intvec.h:86
IDDATA
#define IDDATA(a)
Definition ipid.h:126
Kstd1_deg
EXTERN_VAR int Kstd1_deg
Definition kstd1.h:70
Kstd1_mu
EXTERN_VAR int Kstd1_mu
Definition kstd1.h:70
MATELEM
#define MATELEM(mat, i, j)
1-based access to matrix
Definition matpol.h:29
matrix
ip_smatrix * matrix
Definition matpol.h:43
SMATELEM
#define SMATELEM(A, i, j, R)
Definition matpol.h:123
MATROWS
#define MATROWS(i)
Definition matpol.h:26
MATCOLS
#define MATCOLS(i)
Definition matpol.h:27
lists
slists * lists
Definition mpr_numeric.h:146
nInit
#define nInit(i)
Definition numbers.h:24
index
static int index(p_Length length, p_Ord ord)
Definition p_Procs_Impl.h:592
traceit
EXTERN_VAR int traceit
Definition reporter.h:24
colmax
EXTERN_VAR int colmax
Definition reporter.h:17
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23
size_two_bin
STATIC_VAR omBin size_two_bin
Definition subexpr.cc:44
getRTimer
int getRTimer()
Definition timer.cc:150
getTimer
long getTimer()
Definition timer.cc:80
INTVEC_CMD
@ INTVEC_CMD
Definition tok.h:101
CMATRIX_CMD
@ CMATRIX_CMD
Definition tok.h:46
STRING_CMD
@ STRING_CMD
Definition tok.h:187
COMMAND
#define COMMAND
Definition tok.h:29

## Eval()

int sleftv::Eval | ( |  | ) |

Definition at line 2000 of file subexpr.cc.

{
BOOLEAN nok=FALSE;
leftv nn=next;
next=NULL;
if(rtyp==IDHDL)
{
int t=Typ();
if (t!=PROC_CMD)
{
void *d=CopyD(t);
data=d;
rtyp=t;
name=NULL;
e=NULL;
}
}
else if (rtyp==COMMAND)
{
command d=(command)data;
if(d->op==PROC_CMD) //assume d->argc==2
{
char *what=(char *)(d->arg1.Data());
idhdl h=ggetid(what);
if((h!=NULL)&&(IDTYP(h)==PROC_CMD))
{
nok=d->arg2.Eval();
if(!nok)
{
nok=iiMake_proc(h,req_packhdl,&d->arg2);
this->CleanUp(currRing);
if (!nok)
{
memcpy(this,&iiRETURNEXPR,sizeof(sleftv));
iiRETURNEXPR.Init();
}
}
}
else nok=TRUE;
}
else if (d->op=='=') //assume d->argc==2
{
if ((d->arg1.rtyp!=IDHDL)&&(d->arg1.rtyp!=DEF_CMD))
{
nok=d->arg1.Eval();
}
if (!nok)
{
const char *n=d->arg1.name;
nok=(n == NULL) || d->arg2.Eval();
if (!nok)
{
int save_typ=d->arg1.rtyp;
omCheckAddr((ADDRESS)n);
if (d->arg1.rtyp!=IDHDL)
syMake(&d->arg1,n);
omCheckAddr((ADDRESS)d->arg1.name);
if (d->arg1.rtyp==IDHDL)
{
n=omStrDup(IDID((idhdl)d->arg1.data));
killhdl((idhdl)d->arg1.data);
d->arg1.Init();
//d->arg1.data=NULL;
d->arg1.name=n;
}
d->arg1.rtyp=DEF_CMD;
sleftv t;
if(save_typ!=PROC_CMD) save_typ=d->arg2.rtyp;
if (::RingDependend(d->arg2.rtyp))
nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&currRing->idroot);
else
nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&IDROOT);
memcpy(&d->arg1,&t,sizeof(sleftv));
omCheckAddr((ADDRESS)d->arg1.name);
nok=nok||iiAssign(&d->arg1,&d->arg2);
omCheckIf(d->arg1.name != NULL, // OB: ????
omCheckAddr((ADDRESS)d->arg1.name));
if (!nok)
{
d->arg1.Init();
this->CleanUp();
rtyp=NONE;
}
}
}
else nok=TRUE;
}
else
{
sleftv tmp; tmp.Init();
int toktype=iiTokType(d->op);
if ((toktype==CMD_M)
||( toktype==ROOT_DECL_LIST)
||( toktype==RING_DECL_LIST))
{
if (d->argc <=3)
{
if (d->argc>=1) nok=d->arg1.Eval();
if ((!nok) && (d->argc>=2))
{
nok=d->arg2.Eval();
d->arg1.next=(leftv)omAllocBin(sleftv_bin);
memcpy(d->arg1.next,&d->arg2,sizeof(sleftv));
d->arg2.Init();
}
if ((!nok) && (d->argc==3))
{
nok=d->arg3.Eval();
d->arg1.next->next=(leftv)omAllocBin(sleftv_bin);
memcpy(d->arg1.next->next,&d->arg3,sizeof(sleftv));
d->arg3.Init();
}
if (d->argc==0)
nok=nok||iiExprArithM(&tmp,NULL,d->op);
else
nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
}
else
{
nok=d->arg1.Eval();
nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
}
}
else if (d->argc==1)
{
nok=d->arg1.Eval();
nok=nok||iiExprArith1(&tmp,&d->arg1,d->op);
}
else if(d->argc==2)
{
nok=d->arg1.Eval();
nok=nok||d->arg2.Eval();
nok=nok||iiExprArith2(&tmp,&d->arg1,d->op,&d->arg2);
}
else if(d->argc==3)
{
nok=d->arg1.Eval();
nok=nok||d->arg2.Eval();
nok=nok||d->arg3.Eval();
nok=nok||iiExprArith3(&tmp,d->op,&d->arg1,&d->arg2,&d->arg3);
}
else if(d->argc!=0)
{
nok=d->arg1.Eval();
nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
}
else // d->argc == 0
{
nok = iiExprArithM(&tmp, NULL, d->op);
}
this->CleanUp();
memcpy(this,&tmp,sizeof(tmp));
}
}
else if (((rtyp==0)||(rtyp==DEF_CMD))
&&(name!=NULL))
{
syMake(this,name);
}
#ifdef MDEBUG
switch(Typ())
{
case NUMBER_CMD:
#ifdef LDEBUG
nTest((number)Data());
#endif
break;
case BIGINT_CMD:
#ifdef LDEBUG
n_Test((number)Data(),coeffs_BIGINT);
#endif
break;
case POLY_CMD:
pTest((poly)Data());
break;
case IDEAL_CMD:
case MODUL_CMD:
case MATRIX_CMD:
{
ideal id=(ideal)Data();
omCheckAddrSize(id,sizeof(*id));
int i=id->ncols*id->nrows-1;
for(;i>=0;i--) pTest(id->m[i]);
}
break;
}
#endif
if (nn!=NULL) nok=nok||nn->Eval();
next=nn;
return nok;
}
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
i
int i
Definition cfEzgcd.cc:132
sleftv::req_packhdl
package req_packhdl
Definition subexpr.h:106
sleftv::RingDependend
BOOLEAN RingDependend()
Definition subexpr.cc:421
sleftv::Eval
int Eval()
Definition subexpr.cc:2000
n_Test
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r).
Definition coeffs.h:715
RING_DECL_LIST
@ RING_DECL_LIST
Definition grammar.cc:323
PROC_CMD
@ PROC_CMD
Definition grammar.cc:281
ROOT_DECL_LIST
@ ROOT_DECL_LIST
Definition grammar.cc:321
NUMBER_CMD
@ NUMBER_CMD
Definition grammar.cc:289
CMD_M
@ CMD_M
Definition grammar.cc:319
iiExprArith2
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
Definition iparith.cc:9176
iiExprArith1
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition iparith.cc:9365
iiExprArithM
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition iparith.cc:9666
iiExprArith3
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition iparith.cc:9575
iiTokType
int iiTokType(int op)
Definition iparith.cc:230
iiAssign
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition ipassign.cc:2099
ggetid
idhdl ggetid(const char *n)
Definition ipid.cc:581
killhdl
void killhdl(idhdl h, package proot)
Definition ipid.cc:414
command
ip_command * command
Definition ipid.h:23
IDID
#define IDID(a)
Definition ipid.h:122
IDROOT
#define IDROOT
Definition ipid.h:19
iiMake_proc
BOOLEAN iiMake_proc(idhdl pn, package pack, leftv args)
Definition iplib.cc:513
iiRETURNEXPR
INST_VAR sleftv iiRETURNEXPR
Definition iplib.cc:483
iiDeclCommand
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition ipshell.cc:1206
nTest
#define nTest(a)
Definition numbers.h:35
omStrDup
#define omStrDup(s)
Definition omAllocDecl.h:263
omCheckAddr
#define omCheckAddr(addr)
Definition omAllocDecl.h:328
omCheckIf
#define omCheckIf(cond, test)
Definition omAllocDecl.h:323
omCheckAddrSize
#define omCheckAddrSize(addr, size)
Definition omAllocDecl.h:327
coeffs_BIGINT
VAR coeffs coeffs_BIGINT
Definition polys.cc:14
pTest
#define pTest(p)
Definition polys.h:415
syMake
void syMake(leftv v, const char *name, package pa=NULL)
Definition subexpr.cc:1613
BIGINT_CMD
@ BIGINT_CMD
Definition tok.h:38
DEF_CMD
@ DEF_CMD
Definition tok.h:58
NONE
#define NONE
Definition tok.h:223

## Fullname()

const char * sleftv::Fullname | ( |  | ) |

inline

Definition at line 125 of file subexpr.h.

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

## Init()

void sleftv::Init | ( |  | ) |

inline

Definition at line 107 of file subexpr.h.

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

## LData()

leftv sleftv::LData | ( |  | ) |

Definition at line 1519 of file subexpr.cc.

{
if (e!=NULL)
{
lists l=NULL;
blackbox *b=getBlackboxStuff(rtyp);
if ((rtyp==LIST_CMD)
|| ((b!=NULL)&&(BB_LIKE_LIST(b))))
l=(lists)data;
else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
l=IDLIST((idhdl)data);
else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)>MAX_TOK))
{
b=getBlackboxStuff(IDTYP((idhdl)data));
if (BB_LIKE_LIST(b)) l=IDLIST((idhdl)data);
}
else if (rtyp==ALIAS_CMD)
{
idhdl h=(idhdl)data;
l= (lists)(((idhdl)h->data.ustring)->data.ustring);
}
if (l!=NULL)
{
if ((0>=e->start)||(e->start>l->nr+1))
return NULL;
if (e->next!=NULL)
{
l->m[e->start-1].e=e->next;
leftv r=l->m[e->start-1].LData();
l->m[e->start-1].e=NULL;
return r;
}
return &(l->m[e->start-1]);
}
}
return this;
}
IDLIST
#define IDLIST(a)
Definition ipid.h:137

## listLength()

int sleftv::listLength | ( |  | ) |

Definition at line 51 of file subexpr.cc.

{
int n = 1;
leftv sl = next;
while (sl!=NULL)
{
n++;
sl=sl->next;
}
return n;
}

## LTyp()

int sleftv::LTyp | ( |  | ) |

Definition at line 1156 of file subexpr.cc.

{
lists l=NULL;
int r;
if (rtyp==LIST_CMD)
l=(lists)data;
else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
l=IDLIST((idhdl)data);
else
return Typ();
//if (l!=NULL)
{
if ((e!=NULL) && (e->next!=NULL))
{
if ((0<e->start)&&(e->start<=l->nr+1))
{
l->m[e->start-1].e=e->next;
r=l->m[e->start-1].LTyp();
l->m[e->start-1].e=NULL;
}
else
{
//Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
r=NONE;
}
return r;
}
return LIST_CMD;
}
return Typ();
}

## Name()

const char * sleftv::Name | ( |  | ) |

inline

Definition at line 120 of file subexpr.h.

{
if ((name!=NULL) && (e==NULL)) return name;
else return sNoName_fe;
}

## Next()

leftv sleftv::Next | ( |  | ) |

inline

Definition at line 136 of file subexpr.h.

{ 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.

{
int t=Typ();
if (errorreported) return;
#ifdef SIQ
if (rtyp==COMMAND)
{
command c=(command)data;
char ch[2];
ch[0]=c->op;ch[1]='\0';
const char *s=ch;
if (c->op>127) s=iiTwoOps(c->op);
::Print("##command %d(%s), %d args\n",
c->op, s, c->argc);
if (c->argc>0)
c->arg1.Print(NULL,spaces+2);
if(c->argc<4)
{
if (c->argc>1)
c->arg2.Print(NULL,spaces+2);
if (c->argc>2)
c->arg3.Print(NULL,spaces+2);
}
PrintS("##end");
}
else
#endif
{
const char *n=Name();
char *s;
void *d=Data();
if (errorreported) return;
switch (t /*=Typ()*/)
{
case CRING_CMD:
crPrint((coeffs)d);
break;
#ifdef SINGULAR_4_2
case CNUMBER_CMD:
n2Print((number2)d);
break;
case CPOLY_CMD:
p2Print((poly2)d);
break;
case CMATRIX_CMD: // like BIGINTMAT
#endif
case BIGINTMAT_CMD:
((bigintmat *)d)->pprint(colmax);
break;
case BIGINTVEC_CMD:
((bigintmat *)d)->pprint(4096); // allow longer bigintvec
break;
case BUCKET_CMD:
{
sBucket_pt b=(sBucket_pt)d;
if ((e==NULL)
&& (TEST_V_QRING)
&&(currRing->qideal!=NULL))
{
poly p=pCopy(sBucketPeek(b));
p=jjNormalizeQRingP(p);
PrintNSpaces(spaces);
pWrite0(p);
pDelete(&p);
break;
}
else
sBucketPrint(b);
}
break;
case UNKNOWN:
case DEF_CMD:
PrintNSpaces(spaces);
PrintS("`");PrintS(n);PrintS("`");
break;
case PACKAGE_CMD:
PrintNSpaces(spaces);
paPrint(n,(package)d);
break;
case LIB_CMD:
case NONE:
return;
case INTVEC_CMD:
case INTMAT_CMD:
((intvec *)d)->show(t,spaces);
break;
case RING_CMD:
{
PrintNSpaces(spaces);
const ring r = (ring)d;
rWrite(r, currRing == r);
break;
}
case MATRIX_CMD:
iiWriteMatrix((matrix)d,n,2, currRing, spaces);
break;
case SMATRIX_CMD:
{
matrix m = id_Module2Matrix(id_Copy((ideal)d,currRing),currRing);
ipPrint_MA0(m, n);
id_Delete((ideal *) &m,currRing);
break;
}
case MODUL_CMD:
case IDEAL_CMD:
if ((TEST_V_QRING) &&(currRing->qideal!=NULL)
&&(!hasFlag(this,FLAG_QRING)))
{
jjNormalizeQRingId(this);
d=Data();
}
// no break:
case MAP_CMD:
iiWriteMatrix((matrix)d,n,1, currRing, spaces);
break;
case POLY_CMD:
case VECTOR_CMD:
if ((e==NULL)
&& (TEST_V_QRING)
&&(currRing->qideal!=NULL)
&&(!hasFlag(this,FLAG_QRING)))
{
setFlag(this,FLAG_QRING);
poly p=(poly)d;
p=jjNormalizeQRingP(p);
if (p!=(poly)d)
{
d=(void*)p;
if ((rtyp==POLY_CMD)||(rtyp==VECTOR_CMD)) data=d;
else if (rtyp==IDHDL)
{
idhdl h=(idhdl)data;
IDPOLY(h)=p;
setFlag(h,FLAG_QRING);
}
}
}
PrintNSpaces(spaces);
pWrite0((poly)d);
break;
case RESOLUTION_CMD:
{
syStrategy tmp=(syStrategy)d;
syPrint(tmp,IDID(currRingHdl));
break;
}
case STRING_CMD:
PrintNSpaces(spaces);
PrintS((char *)d);
break;
case INT_CMD:
PrintNSpaces(spaces);
::Print("%ld",(long)d);
break;
case PROC_CMD:
{
procinfov pi=(procinfov)d;
PrintNSpaces(spaces);
PrintS("// libname : ");
PrintS(piProcinfo(pi, "libname"));
PrintLn();
PrintNSpaces(spaces);
PrintS("// procname : ");
PrintS(piProcinfo(pi, "procname"));
PrintLn();
PrintNSpaces(spaces);
PrintS("// type : ");
PrintS(piProcinfo(pi, "type"));
// ::Print("%-*.*s// ref : %s",spaces,spaces," ",
// piProcinfo(pi, "ref"));
break;
}
case LINK_CMD:
{
si_link l=(si_link)d;
PrintNSpaces(spaces);
::Print("// type : %s\n", slStatus(l, "type"));
PrintNSpaces(spaces);
::Print("// mode : %s\n", slStatus(l, "mode"));
PrintNSpaces(spaces);
::Print("// name : %s\n", slStatus(l, "name"));
PrintNSpaces(spaces);
::Print("// open : %s\n", slStatus(l, "open"));
PrintNSpaces(spaces);
::Print("// read : %s\n", slStatus(l, "read"));
PrintNSpaces(spaces);
::Print("// write: %s", slStatus(l, "write"));
break;
}
case BIGINT_CMD:
s=String(d);
if (s==NULL) return;
PrintNSpaces(spaces);
PrintS(s);
omFree((ADDRESS)s);
break;
case NUMBER_CMD:
{
number n=(number)d;
nNormalize(n);
if ((number)d !=n)
{
d=n;
if (rtyp==IDHDL) IDNUMBER(((idhdl)data))=n;
else if(rtyp==NUMBER_CMD) data=(void*)n;
}
s=String(d);
if (s==NULL) return;
PrintS(s);
omFree((ADDRESS)s);
break;
}
case LIST_CMD:
{
lists l=(lists)d;
if (lSize(l)<0)
{
PrintNSpaces(spaces);
PrintS("empty list\n");
}
else
{
int i=0;
for (;i<=l->nr;i++)
{
if (l->m[i].rtyp!=DEF_CMD)
{
PrintNSpaces(spaces);
::Print("[%d]:\n",i+1);
l->m[i].Print(NULL,spaces+3);
}
}
}
break;
}
default:
if (t>MAX_TOK)
{
blackbox * bb=getBlackboxStuff(t);
PrintNSpaces(spaces);
if (bb!=NULL) { bb->blackbox_Print(bb,d); }
else { ::Print("Print: blackbox %d(bb=NULL)",t); }
}
else
::Print("Print:unknown type %s(%d)", Tok2Cmdname(t),t);
} /* end switch: (Typ()) */
if ((store!=NULL)&&(store!=this))
store->CleanUp();
}
if (next!=NULL)
{
if (t==COMMAND) PrintLn();
else if (t!=LIST_CMD) PrintS(" ");
next->Print(NULL,spaces);
}
else if ((t!=LIST_CMD)&&(t!=SMATRIX_CMD))
{
PrintLn();
}
#ifdef SIQ
if (rtyp!=COMMAND)
#endif
{
if ((store!=NULL)
&& (store!=this))
{
if((t/*Typ()*/!=LINK_CMD)
&& (t/*Typ()*/!=PACKAGE_CMD)
&& (t/*Typ()*/!=DEF_CMD)
)
{
store->rtyp=t/*Typ()*/;
store->data=CopyD();
if(attribute!=NULL)
{
store->attribute=CopyA();
}
store->flag=flag;
}
}
}
}
p
int p
Definition cfModGcd.cc:4086
sleftv::String
char * String(void *d=NULL, BOOLEAN typed=FALSE, int dim=1)
Called for conversion to string (used by string(..), write(..),..).
Definition subexpr.cc:765
sleftv::CopyA
attr CopyA()
Definition subexpr.cc:757
Print
#define Print
Definition emacs.cc:80
s
const CanonicalForm int s
Definition facAbsFact.cc:51
iiTwoOps
const char * iiTwoOps(int t)
Definition gentable.cc:258
LIB_CMD
@ LIB_CMD
Definition grammar.cc:328
VECTOR_CMD
@ VECTOR_CMD
Definition grammar.cc:293
RESOLUTION_CMD
@ RESOLUTION_CMD
Definition grammar.cc:291
RING_CMD
@ RING_CMD
Definition grammar.cc:282
ipPrint_MA0
void ipPrint_MA0(matrix m, const char *name)
Definition ipprint.cc:57
id_Copy
ideal id_Copy(ideal h1, const ring r)
copy an ideal
Definition simpleideals.cc:542
jjNormalizeQRingId
void jjNormalizeQRingId(leftv I)
Definition ipassign.cc:2461
currRingHdl
VAR idhdl currRingHdl
Definition ipid.cc:57
hasFlag
#define hasFlag(A, F)
Definition ipid.h:112
setFlag
#define setFlag(A, F)
Definition ipid.h:113
IDPOLY
#define IDPOLY(a)
Definition ipid.h:130
FLAG_QRING
#define FLAG_QRING
Definition ipid.h:108
IDNUMBER
#define IDNUMBER(a)
Definition ipid.h:132
jjNormalizeQRingP
#define jjNormalizeQRingP(p)
Definition ipid.h:103
paPrint
void paPrint(const char *n, package p)
Definition ipshell.cc:6333
pi
#define pi
Definition libparse.cc:1145
lSize
int lSize(lists L)
Definition lists.cc:25
iiWriteMatrix
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
Definition matpol.cc:828
crPrint
void crPrint(coeffs c)
Definition number2.cc:25
nNormalize
#define nNormalize(n)
Definition numbers.h:30
TEST_V_QRING
#define TEST_V_QRING
Definition options.h:133
pDelete
#define pDelete(p_ptr)
Definition polys.h:187
pWrite0
void pWrite0(poly p)
Definition polys.h:310
PrintNSpaces
void PrintNSpaces(const int n)
Definition reporter.cc:368
PrintS
void PrintS(const char *s)
Definition reporter.cc:288
PrintLn
void PrintLn()
Definition reporter.cc:314
rWrite
void rWrite(ring r, BOOLEAN details)
Definition ring.cc:227
sBucketPrint
void sBucketPrint(sBucket_pt bucket)
Definition sbuckets.cc:466
slStatus
const char * slStatus(si_link l, const char *request)
Definition silink.cc:156
si_link
ip_link * si_link
Definition silink.h:20
id_Delete
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
Definition simpleideals.cc:123
id_Module2Matrix
matrix id_Module2Matrix(ideal mod, const ring R)
Definition simpleideals.cc:1594
package
ip_package * package
Definition structs.h:39
piProcinfo
const char * piProcinfo(procinfov pi, const char *request)
Definition ipid.cc:723
procinfov
procinfo * procinfov
Definition subexpr.h:66
syStrategy
ssyStrategy * syStrategy
Definition syz.h:36
syPrint
void syPrint(syStrategy syzstr, const char *currRingName)
Definition syz1.cc:1935
CRING_CMD
@ CRING_CMD
Definition tok.h:56
CNUMBER_CMD
@ CNUMBER_CMD
Definition tok.h:47
LINK_CMD
@ LINK_CMD
Definition tok.h:117
CPOLY_CMD
@ CPOLY_CMD
Definition tok.h:48
INT_CMD
@ INT_CMD
Definition tok.h:96
UNKNOWN
#define UNKNOWN
Definition tok.h:224

## RingDependend()

BOOLEAN sleftv::RingDependend | ( |  | ) |

Definition at line 421 of file subexpr.cc.

{
int rt=Typ();
if(::RingDependend(rt))
return TRUE;
if (rt==LIST_CMD)
return lRingDependend((lists)Data());
if (this->next!=NULL)
return this->next->RingDependend();
return FALSE;
}
lRingDependend
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.

{
#ifdef SIQ
if (rtyp==COMMAND)
{
::Print("##command %d\n",((command)data)->op);
if (((command)data)->arg1.rtyp!=0)
((command)data)->arg1.Print(NULL,2);
if (((command)data)->arg2.rtyp!=0)
((command)data)->arg2.Print(NULL,2);
if (((command)data)->arg3.rtyp==0)
((command)data)->arg3.Print(NULL,2);
PrintS("##end\n");
return omStrDup("");
}
#endif
if (d==NULL) d=Data();
if (!errorreported)
{
char *s;
int t=Typ();
switch (t /*Typ()*/)
{
case INT_CMD:
if (typed)
{
#if SIZEOF_LONG==8
const size_t len=MAX_INT_LEN+17;
#else
const size_t len=MAX_INT_LEN+7;
#endif
s=(char*)omAlloc(len);
snprintf(s,len,"int(%ld)",(long)d);
}
else
{
#if SIZEOF_LONG==8
const size_t len=MAX_INT_LEN+12;
#else
const size_t len=MAX_INT_LEN+2;
#endif
s=(char*)omAlloc(len);
snprintf(s,len,"%ld",(long)d);
}
return s;
case STRING_CMD:
if (d == NULL)
{
if (typed) return omStrDup("\"\"");
return omStrDup("");
}
if (typed)
{
size_t len=strlen((char*) d) + 3;
s = (char*) omAlloc(len);
snprintf(s,len,"\"%s\"", (char*) d);
return s;
}
else
{
return omStrDup((char*)d);
}
case POLY_CMD:
case VECTOR_CMD:
if (typed)
{
char* ps = pString((poly) d);
size_t len=strlen(ps) + 10;
s = (char*) omAlloc(len);
snprintf(s,len,"%s(%s)", (t /*Typ()*/ == POLY_CMD ? "poly" : "vector"), ps);
omFree(ps);
return s;
}
else
return pString((poly)d);
case CRING_CMD:
return nCoeffString((coeffs)d);
#ifdef SINGULAR_4_2
case CNUMBER_CMD:
return n2String((number2)d,typed);
case CMATRIX_CMD:
{
bigintmat *b=(bigintmat*)d;
return b->String();
}
#endif
case NUMBER_CMD:
StringSetS((char*) (typed ? "number(" : ""));
if((rtyp==VMINPOLY)&&(rField_is_GF(currRing)))
{
nfShowMipo(currRing->cf);
}
else
{
nWrite((number)d);
}
StringAppendS((char*) (typed ? ")" : ""));
return StringEndS();
case BIGINT_CMD:
{
StringSetS((char*) (typed ? "bigint(" : ""));
number nl=(number)d;
n_Write(nl,coeffs_BIGINT);
StringAppendS((char*) (typed ? ")" : ""));
return StringEndS();
}
case BUCKET_CMD:
return sBucketString((sBucket_pt)d);
case MATRIX_CMD:
s= iiStringMatrix((matrix)d,dim, currRing);
if (typed)
{
size_t len=strlen(s) + 40;
char* ns = (char*) omAlloc(len);
snprintf(ns,len, "matrix(ideal(%s),%d,%d)", s,
((ideal) d)->nrows, ((ideal) d)->ncols);
omCheckAddr(ns);
return ns;
}
else
{
return omStrDup(s);
}
case IDEAL_CMD:
case MAP_CMD:
case MODUL_CMD:
case SMATRIX_CMD:
s= iiStringMatrix((matrix)d,dim, currRing);
if (typed)
{
size_t len=strlen(s) + 10;
char* ns = (char*) omAlloc(len);
if ((t/*Typ()*/==IDEAL_CMD)||(t==MAP_CMD))
snprintf(ns,len, "ideal(%s)", s);
else /*MODUL_CMD, SMATRIX_CMD */
snprintf(ns,len, "module(%s)", s);
omFree(s);
omCheckAddr(ns);
return ns;
}
return s;
case INTVEC_CMD:
case INTMAT_CMD:
{
intvec *v=(intvec *)d;
s = v->String(dim);
if (typed)
{
char* ns;
if (t/*Typ()*/ == INTMAT_CMD)
{
size_t len=strlen(s) + 40;
ns = (char*) omAlloc(len);
snprintf(ns,len, "intmat(intvec(%s),%d,%d)", s, v->rows(), v->cols());
}
else
{
size_t len=strlen(s) + 10;
ns = (char*) omAlloc(len);
snprintf(ns,len, "intvec(%s)", s);
}
omCheckAddr(ns);
omFree(s);
return ns;
}
else
return s;
}
case BIGINTMAT_CMD:
{
bigintmat *bim=(bigintmat*)d;
s = bim->String();
if (typed)
{
size_t len=strlen(s) + 40;
char* ns = (char*) omAlloc(len);
snprintf(ns,len, "bigintmat(bigintvec(%s),%d,%d)", s, bim->rows(), bim->cols());
return ns;
}
else
return omStrDup(s);
}
case BIGINTVEC_CMD:
{
bigintmat *bim=(bigintmat*)d;
s = bim->String();
if (typed)
{
size_t len=strlen(s) + 40;
char* ns = (char*) omAlloc(len);
snprintf(ns,len, "bigintvec(%s)", s);
return ns;
}
else
return omStrDup(s);
}
case RING_CMD:
s = rString((ring)d);
if (typed)
{
char* ns;
ring r=(ring)d;
if (r->qideal!=NULL)
{
char* id = iiStringMatrix((matrix) ((ring) d)->qideal, dim,
currRing);
size_t len=strlen(s) + strlen(id) + 20;
ns = (char*) omAlloc(len);
snprintf(ns,len, "\"%s\";%sideal(%s)", s,(dim == 2 ? "\n" : " "), id);
}
else
{
size_t len=strlen(s) + 4;
ns = (char*) omAlloc(len);
snprintf(ns,len, "\"%s\"", s);
}
omFree(s);
omCheckAddr(ns);
return ns;
}
return s;
case RESOLUTION_CMD:
{
lists l = syConvRes((syStrategy)d);
s = lString(l, typed, dim);
l->Clean();
return s;
}
case PROC_CMD:
{
procinfo* pi = (procinfo*) d;
if((pi->language == LANG_SINGULAR) && (pi->data.s.body!=NULL))
s = (pi->data.s.body);
else
s = (char *)"";
if (typed)
{
size_t len=strlen(s) + 4;
char* ns = (char*) omAlloc(len);
snprintf(ns,len, "\"%s\"", s);
return ns;
}
return omStrDup(s);
}
case LINK_CMD:
s = slString((si_link) d);
if (typed)
{
size_t len=strlen(s) + 10;
char* ns = (char*) omAlloc(len);
snprintf(ns,len, "link(\"%s\")", s);
omFreeBinAddr(s);
omCheckAddr(ns);
return ns;
}
return s;
case LIST_CMD:
return lString((lists) d, typed, dim);
default:
if(t> MAX_TOK)
{
blackbox *bb=getBlackboxStuff(t);
if (bb!=NULL) return bb->blackbox_String(bb,d);
}
} /* end switch: (Typ()) */
}
return omStrDup("");
}
ncols
int int ncols
Definition cf_linsys.cc:32
nrows
int nrows
Definition cf_linsys.cc:32
bigintmat::cols
int cols() const
Definition bigintmat.h:144
bigintmat::rows
int rows() const
Definition bigintmat.h:145
bigintmat::String
char * String()
IO: String returns a singular string containing the matrix, needs freeing afterwards.
Definition bigintmat.cc:430
nCoeffString
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:958
n_Write
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition coeffs.h:594
nfShowMipo
void nfShowMipo(const coeffs r)
Show the mininimal polynom.... NOTE: this is used by char * sleftv::String(void *d,...
Definition ffields.cc:547
syConvRes
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition ipshell.cc:3178
lString
char * lString(lists l, BOOLEAN typed, int dim)
Definition lists.cc:409
iiStringMatrix
char * iiStringMatrix(matrix im, int dim, const ring r, char ch)
Definition matpol.cc:849
MAX_INT_LEN
const int MAX_INT_LEN
Definition mylimits.h:13
nWrite
#define nWrite(n)
Definition numbers.h:29
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
omFreeBinAddr
#define omFreeBinAddr(addr)
Definition omAllocDecl.h:258
pString
char * pString(poly p)
Definition polys.h:307
StringSetS
void StringSetS(const char *st)
Definition reporter.cc:128
StringAppendS
void StringAppendS(const char *st)
Definition reporter.cc:107
StringEndS
char * StringEndS()
Definition reporter.cc:151
rString
char * rString(ring r)
Definition ring.cc:678
rField_is_GF
static BOOLEAN rField_is_GF(const ring r)
Definition ring.h:527
sBucketString
char * sBucketString(sBucket_pt bucket)
Definition sbuckets.cc:461
slString
static char * slString(si_link l)
Definition silink.h:101
LANG_SINGULAR
@ LANG_SINGULAR
Definition subexpr.h:22
dim
int dim(ideal I, ring r)
Definition tropicalStrategy.cc:23

## Typ()

int sleftv::Typ | ( |  | ) |

Definition at line 1048 of file subexpr.cc.

{
if (e==NULL)
{
switch (rtyp)
{
case IDHDL:
return IDTYP((idhdl)data);
case ALIAS_CMD:
{
idhdl h=(idhdl)data;
return ((idhdl)h->data.ustring)->typ;
}
case VECHO:
case VPRINTLEVEL:
case VCOLMAX:
case VTIMER:
case VRTIMER:
case VOICE:
case VMAXDEG:
case VMAXMULT:
case TRACE:
case VSHORTOUT:
return INT_CMD;
case VMINPOLY:
data=NULL;
return NUMBER_CMD;
case VNOETHER:
data=NULL;
return POLY_CMD;
//case COMMAND:
// return COMMAND;
default:
return rtyp;
}
}
int r=0;
int t=rtyp;
void *d=data;
if (t==IDHDL) t=IDTYP((idhdl)d);
else if (t==ALIAS_CMD)
{ idhdl h=(idhdl)IDDATA((idhdl)data); t=IDTYP(h);d=IDDATA(h); }
switch (t)
{
#ifdef SINGULAR_4_2
case CMATRIX_CMD:
{
bigintmat *b=(bigintmat*)d;
if ((currRing!=NULL)&&(currRing->cf==b->basecoeffs()))
return NUMBER_CMD;
else
return CNUMBER_CMD;
}
#endif
case INTVEC_CMD:
case INTMAT_CMD:
r=INT_CMD;
break;
case BIGINTVEC_CMD:
case BIGINTMAT_CMD:
r=BIGINT_CMD;
break;
case IDEAL_CMD:
case MATRIX_CMD:
case MAP_CMD:
case SMATRIX_CMD:
r=POLY_CMD;
break;
case MODUL_CMD:
r=VECTOR_CMD;
break;
case STRING_CMD:
r=STRING_CMD;
break;
default:
{
blackbox *b=NULL;
if (t>MAX_TOK)
{
b=getBlackboxStuff(t);
}
if ((t==LIST_CMD)||((b!=NULL)&&BB_LIKE_LIST(b)))
{
lists l;
if (rtyp==IDHDL) l=IDLIST((idhdl)d);
else l=(lists)d;
if ((0<e->start)&&(e->start<=l->nr+1))
{
Subexpr tmp=l->m[e->start-1].e;
l->m[e->start-1].e=e->next;
r=l->m[e->start-1].Typ();
e->next=l->m[e->start-1].e;
l->m[e->start-1].e=tmp;
}
else
{
//Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
r=DEF_CMD;
}
}
else
Werror("cannot index type %s(%d)",Tok2Cmdname(t),t);
break;
}
}
return r;
}

## 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:

- Singular/subexpr.h
- Singular/subexpr.cc