Loading...
Searching...
No Matches
attrib.cc File Reference
`#include "kernel/mod2.h"`
`#include "misc/options.h"`
`#include "misc/intvec.h"`
`#include "polys/matpol.h"`
`#include "kernel/polys.h"`
`#include "kernel/ideals.h"`
`#include "Singular/tok.h"`
`#include "Singular/ipid.h"`
`#include "Singular/ipshell.h"`
`#include "Singular/attrib.h"`

Go to the source code of this file.

## Functions

static void | attr_free (attr h, const ring r=currRing)
void * | atGet (idhdl root, const char *name, int t, void *defaultReturnValue)
void * | atGet (leftv root, const char *name, int t)
void | atSet (idhdl root, char *name, void *data, int typ)
void | atSet (leftv root, char *name, void *data, int typ)
void | at_Kill (idhdl root, const char *name, const ring r)
void | at_KillAll (idhdl root, const ring r)
void | at_KillAll (leftv root, const ring r)
BOOLEAN | atATTRIB1 (leftv res, leftv v)
BOOLEAN | atATTRIB2 (leftv res, leftv v, leftv b)
BOOLEAN | atATTRIB3 (leftv, leftv v, leftv b, leftv c)
BOOLEAN | atKILLATTR1 (leftv, leftv a)
BOOLEAN | atKILLATTR2 (leftv, leftv a, leftv b)

## Variables

STATIC_VAR omBin | sattr_bin = omGetSpecBin(sizeof(sattr))

## Function Documentation

## at_Kill()

void at_Kill | ( | idhdl | root,
|  | const char * | name,
|  | const ring | r )

Definition at line 202 of file attrib.cc.

{
attr temp = root->attribute->get(name);
if (temp!=NULL)
{
attr N = temp->next;
attr temp1 = root->attribute;
if (temp1==temp)
{
root->attribute = N;
}
else
{
while (temp1->next!=temp) temp1 = temp1->next;
temp1->next = N;
}
temp->kill(r);
}
}
attr
sattr * attr
Definition attrib.h:16
N
const CanonicalForm CFMap CFMap & N
Definition cfEzgcd.cc:56
idrec::attribute
attr attribute
Definition idrec.h:41
sattr::get
attr get(const char *s)
Definition attrib.cc:93
sattr::kill
void kill(const ring r)
Definition attrib.cc:183
sattr::next
attr next
Definition attrib.h:26
name
char name(const Variable &v)
Definition factory.h:189
NULL
#define NULL
Definition omList.c:12

## at_KillAll() [1/2]

void at_KillAll | ( | idhdl | root,
|  | const ring | r )

Definition at line 222 of file attrib.cc.

{
root->attribute->killAll(r);
root->attribute = NULL;
}
sattr::killAll
void killAll(const ring r)
Definition attrib.cc:189

## at_KillAll() [2/2]

void at_KillAll | ( | leftv | root,
|  | const ring | r )

Definition at line 228 of file attrib.cc.

{
root->attribute->killAll(r);
root->attribute = NULL;
}
sleftv::attribute
attr attribute
Definition subexpr.h:89

## atATTRIB1()

BOOLEAN atATTRIB1 | ( | leftv | res,
|  | leftv | v )

Definition at line 234 of file attrib.cc.

{
attr *aa=(v->Attribute());
if (aa==NULL)
{
WerrorS("this object cannot have attributes");
return TRUE;
}
attr a=*aa;
BOOLEAN haveNoAttribute=TRUE;
if (v->e==NULL)
{
if (hasFlag(v,FLAG_STD))
{
PrintS("attr:isSB, type int\n");
haveNoAttribute=FALSE;
}
if (hasFlag(v,FLAG_QRING))
{
PrintS("attr:qringNF, type int\n");
haveNoAttribute=FALSE;
}
if (v->Typ()==RING_CMD)
{
PrintS("attr:cf_class, type int\n");
PrintS("attr:cf_class_Zp, type int\n");
PrintS("attr:cf_class_QQ, type int\n");
PrintS("attr:global, type int\n");
PrintS("attr:maxExp, type int\n");
PrintS("attr:ring_cf, type int\n");
#ifdef HAVE_SHIFTBBA
PrintS("attr:isLetterplaceRing, type int\n");
if (rIsLPRing((ring)v->Data()))
PrintS("attr:ncgenCount, type int\n");
#endif
haveNoAttribute=FALSE;
}
}
else
{
leftv at=v->LData();
return atATTRIB1(res,at);
}
if (a!=NULL) a->Print();
else if(haveNoAttribute) PrintS("no attributes\n");
return FALSE;
}
atATTRIB1
BOOLEAN atATTRIB1(leftv res, leftv v)
Definition attrib.cc:234
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
sattr::Print
void Print()
Definition attrib.cc:26
res
CanonicalForm res
Definition facAbsFact.cc:60
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
RING_CMD
@ RING_CMD
Definition grammar.cc:282
hasFlag
#define hasFlag(A, F)
Definition ipid.h:112
FLAG_QRING
#define FLAG_QRING
Definition ipid.h:108
FLAG_STD
#define FLAG_STD
Definition ipid.h:106
PrintS
void PrintS(const char *s)
Definition reporter.cc:288
rIsLPRing
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:417
leftv
sleftv * leftv
Definition structs.h:53

## atATTRIB2()

BOOLEAN atATTRIB2 | ( | leftv | res,
|  | leftv | v,
|  | leftv | b )

Definition at line 282 of file attrib.cc.

{
char *name=(char *)b->Data();
int t=v->Typ();
leftv at=NULL;
if (v->e!=NULL)
at=v->LData();
if (strcmp(name,"isSB")==0)
{
res->rtyp=INT_CMD;
res->data=(void *)(long)hasFlag(v,FLAG_STD);
if (at!=NULL) res->data=(void *)(long)(hasFlag(v,FLAG_STD)||(hasFlag(at,FLAG_STD)));
}
else if ((strcmp(name,"rank")==0)&&(/*v->Typ()*/t==MODUL_CMD))
{
res->rtyp=INT_CMD;
res->data=(void *)(((ideal)v->Data())->rank);
}
else if ((strcmp(name,"global")==0)
&&(/*v->Typ()*/t==RING_CMD))
{
res->rtyp=INT_CMD;
res->data=(void *)(((ring)v->Data())->OrdSgn==1);
}
else if ((strcmp(name,"maxExp")==0)
&&(/*v->Typ()*/t==RING_CMD))
{
res->rtyp=INT_CMD;
res->data=(void *)(long)(((ring)v->Data())->bitmask);
}
else if ((strcmp(name,"ring_cf")==0)
&&(/*v->Typ()*/t==RING_CMD))
{
res->rtyp=INT_CMD;
res->data=(void *)(long)(rField_is_Ring((ring)v->Data()));
}
else if ((strncmp(name,"cf_class",strlen("cf_class"))==0)
&&(/*v->Typ()*/t==RING_CMD))
{
res->rtyp=INT_CMD;
coeffs cf;
cf=((ring)v->Data())->cf;
if (strcmp(name,"cf_class_Zp")==0)
res->data=(void *)(long)(int)(cf->type==n_Zp);
else if (strcmp(name,"cf_class_QQ")==0)
res->data=(void *)(long)(int)(cf->type==n_Q);
else
res->data=(void *)(long)(int)cf->type;
}
else if (strcmp(name,"qringNF")==0)
{
res->rtyp=INT_CMD;
res->data=(void *)(long)hasFlag(v,FLAG_QRING);
if (at!=NULL) res->data=(void *)(long)(hasFlag(v,FLAG_QRING)||(hasFlag(at,FLAG_QRING)));
}
#ifdef HAVE_SHIFTBBA
else if ((strcmp(name,"isLetterplaceRing")==0)
&&(/*v->Typ()*/t==RING_CMD))
{
res->rtyp=INT_CMD;
res->data=(void *)(long)(((ring)v->Data())->isLPring);
}
else if ((strcmp(name,"ncgenCount")==0)
&&(/*v->Typ()*/t==RING_CMD))
{
res->rtyp=INT_CMD;
res->data=(void *)(long)(((ring)v->Data())->LPncGenCount);
}
#endif
else
{
attr *aa=v->Attribute();
if (aa==NULL)
{
WerrorS("this object cannot have attributes");
return TRUE;
}
attr a=*aa;
a=a->get(name);
if (a!=NULL)
{
res->rtyp=a->atyp;
res->data=a->CopyA();
}
else
{
res->rtyp=STRING_CMD;
res->data=omStrDup("");
}
}
return FALSE;
}
cf
CanonicalForm cf
Definition cfModGcd.cc:4091
b
CanonicalForm b
Definition cfModGcd.cc:4111
sattr::CopyA
void * CopyA()
Definition subexpr.cc:2192
sattr::atyp
int atyp
Definition attrib.h:27
n_Q
@ n_Q
rational (GMP) numbers
Definition coeffs.h:30
n_Zp
@ n_Zp
\F{p < 2^31}
Definition coeffs.h:29
MODUL_CMD
@ MODUL_CMD
Definition grammar.cc:288
coeffs
The main handler for Singular numbers which are suitable for Singular polynomials.
omStrDup
#define omStrDup(s)
Definition omAllocDecl.h:263
rField_is_Ring
#define rField_is_Ring(R)
Definition ring.h:491
STRING_CMD
@ STRING_CMD
Definition tok.h:187
INT_CMD
@ INT_CMD
Definition tok.h:96

## atATTRIB3()

BOOLEAN atATTRIB3 | ( | leftv | res,
|  | leftv | v,
|  | leftv | b,
|  | leftv | c )

Definition at line 374 of file attrib.cc.

{
idhdl h=(idhdl)v->data;
if (v->e!=NULL)
{
v=v->LData();
if (v==NULL) return TRUE;
h=NULL;
}
else if (v->rtyp!=IDHDL) h=NULL;
int t=v->Typ();
char *name=(char *)b->Data();
if (strcmp(name,"isSB")==0)
{
if (c->Typ()!=INT_CMD)
{
WerrorS("attribute isSB must be int");
return TRUE;
}
if (((long)c->Data())!=0L)
{
if (h!=NULL) setFlag(h,FLAG_STD);
setFlag(v,FLAG_STD);
}
else
{
if (h!=NULL) resetFlag(h,FLAG_STD);
resetFlag(v,FLAG_STD);
}
}
else if (strcmp(name,"qringNF")==0)
{
if (c->Typ()!=INT_CMD)
{
WerrorS("attribute qringNF must be int");
return TRUE;
}
if (((long)c->Data())!=0L)
{
if (h!=NULL) setFlag(h,FLAG_QRING);
setFlag(v,FLAG_QRING);
}
else
{
if (h!=NULL) resetFlag(h,FLAG_QRING);
resetFlag(v,FLAG_QRING);
}
}
else if ((strcmp(name,"rank")==0)&&(/*v->Typ()*/t==MODUL_CMD))
{
if (c->Typ()!=INT_CMD)
{
WerrorS("attribute `rank` must be int");
return TRUE;
}
ideal I=(ideal)v->Data();
int rk=id_RankFreeModule(I,currRing);
I->rank=si_max(rk,(int)((long)c->Data()));
}
else if (((strcmp(name,"global")==0)
|| (strncmp(name,"cf_class",strlen("cf_class"))==0)
|| (strcmp(name,"ring_cf")==0)
|| (strcmp(name,"maxExp")==0))
&&(/*v->Typ()*/t==RING_CMD))
{
Werror("can not set attribute `%s`",name);
return TRUE;
}
#ifdef HAVE_SHIFTBBA
else if ((strcmp(name,"isLetterplaceRing")==0)
&&(/*v->Typ()*/t==RING_CMD))
{
if (c->Typ()==INT_CMD)
((ring)v->Data())->isLPring=(int)(long)c->Data();
else
{
WerrorS("attribute `isLetterplaceRing` must be int");
return TRUE;
}
}
else if ((strcmp(name,"ncgenCount")==0)
&&(/*v->Typ()*/t==RING_CMD))
{
if (c->Typ()==INT_CMD)
((ring)v->Data())->LPncGenCount=(int)(long)c->Data();
else
{
WerrorS("attribute `ncgenCount` must be int");
return TRUE;
}
}
#endif
else
{
int typ=c->Typ();
if (h!=NULL) atSet(h,omStrDup(name),c->CopyD(typ),typ/*c->T(yp()*/);
else atSet(v,omStrDup(name),c->CopyD(typ),typ/*c->T(yp()*/);
}
return FALSE;
}
atSet
void atSet(idhdl root, char *name, void *data, int typ)
Definition attrib.cc:153
si_max
static int si_max(const int a, const int b)
Definition auxiliary.h:125
sleftv::CopyD
void * CopyD(int t)
Definition subexpr.cc:714
sleftv::Typ
int Typ()
Definition subexpr.cc:1048
sleftv::Data
void * Data()
Definition subexpr.cc:1192
resetFlag
#define resetFlag(A, F)
Definition ipid.h:114
setFlag
#define setFlag(A, F)
Definition ipid.h:113
h
STATIC_VAR Poly * h
Definition janet.cc:971
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
idhdl
idrec * idhdl
Definition ring.h:22
id_RankFreeModule
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
Definition simpleideals.cc:992
IDHDL
#define IDHDL
Definition tok.h:31

## atGet() [1/2]

void * atGet | ( | idhdl | root,
|  | const char * | name,
|  | int | t,
|  | void * | defaultReturnValue )

Definition at line 132 of file attrib.cc.

{
attr temp = root->attribute->get(name);
if ((temp!=NULL) && (temp->atyp==t))
return temp->data;
else
return defaultReturnValue;
}
sattr::data
void * data
Definition attrib.h:25

## atGet() [2/2]

void * atGet | ( | leftv | root,
|  | const char * | name,
|  | int | t )

Definition at line 141 of file attrib.cc.

{
attr *a=(root->Attribute());
if (a!=NULL)
{
attr temp = (*a)->get(name);
if ((temp!=NULL) && (temp->atyp==t))
return temp->data;
}
return NULL;
}
sleftv::Attribute
attr * Attribute()
Definition subexpr.cc:1505

## atKILLATTR1()

BOOLEAN atKILLATTR1 | ( | leftv | res,
|  | leftv | a )

Definition at line 476 of file attrib.cc.

{
idhdl h=NULL;
if ((a->rtyp==IDHDL)&&(a->e==NULL))
{
h=(idhdl)a->data;
resetFlag((idhdl)a->data,FLAG_STD);
}
resetFlag(a,FLAG_STD);
if (h->attribute!=NULL)
{
atKillAll(h);
a->attribute=NULL;
}
else atKillAll(a);
return FALSE;
}
atKillAll
#define atKillAll(H)
Definition attrib.h:47
sleftv::rtyp
int rtyp
Definition subexpr.h:91
sleftv::data
void * data
Definition subexpr.h:88
sleftv::e
Subexpr e
Definition subexpr.h:105

## atKILLATTR2()

BOOLEAN atKILLATTR2 | ( | leftv | res,
|  | leftv | a,
|  | leftv | b )

Definition at line 493 of file attrib.cc.

{
if ((a->rtyp!=IDHDL)||(a->e!=NULL))
{
WerrorS("object must have a name");
return TRUE;
}
char *name=(char *)b->Data();
if (strcmp(name,"isSB")==0)
{
resetFlag(a,FLAG_STD);
resetFlag((idhdl)a->data,FLAG_STD);
}
else if (strcmp(name,"global")==0)
{
WerrorS("can not set attribut `global`");
return TRUE;
}
else
{
atKill((idhdl)a->data,name);
}
return FALSE;
}
atKill
#define atKill(H, A)
Definition attrib.h:49

## atSet() [1/2]

void atSet | ( | idhdl | root,
|  | char * | name,
|  | void * | data,
|  | int | typ )

Definition at line 153 of file attrib.cc.

{
if (root!=NULL)
{
if ((IDTYP(root)!=RING_CMD)
&& (!RingDependend(IDTYP(root)))&&(RingDependend(typ)))
WerrorS("cannot set ring-dependend objects at this type");
else
root->attribute=root->attribute->set(name,data,typ);
}
}
sattr::set
attr set(char *s, void *data, int t)
Definition attrib.cc:70
RingDependend
static int RingDependend(int t)
Definition gentable.cc:23
IDTYP
#define IDTYP(a)
Definition ipid.h:119

## atSet() [2/2]

void atSet | ( | leftv | root,
|  | char * | name,
|  | void * | data,
|  | int | typ )

Definition at line 165 of file attrib.cc.

{
if (root!=NULL)
{
attr *a=root->Attribute();
int rt=root->Typ();
if (a==NULL)
WerrorS("cannot set attributes of this object");
else if ((rt!=RING_CMD)
&& (!RingDependend(rt))&&(RingDependend(typ)))
WerrorS("cannot set ring-dependend objects at this type");
else
{
*a=(*a)->set(name,data,typ);
}
}
}

## attr_free()

void attr_free | ( | attr | h,
|  | const ring | r = currRing )

static

Definition at line 56 of file attrib.cc.

{
if (h->name!=NULL)
{
omFree(h->name);
h->name=NULL;
}
if (h->data!=NULL) /*avoid assume failure */
{
s_internalDelete(h->atyp,h->data,r);
h->data=NULL;
}
}
omFree
#define omFree(addr)
Definition omAllocDecl.h:261
s_internalDelete
void s_internalDelete(const int t, void *d, const ring r)
Definition subexpr.cc:518

## Variable Documentation

## sattr_bin

STATIC_VAR omBin sattr_bin = omGetSpecBin(sizeof(sattr))

Definition at line 24 of file attrib.cc.