My Project
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
idrec Class Reference

#include <idrec.h>

Public Member Functions

 idrec ()
 
void Init ()
 
idhdl get (const char *s, int lev)
 
idhdl get_level (const char *s, int lev)
 
idhdl set (const char *s, int lev, int t, BOOLEAN init=TRUE)
 
charString (BOOLEAN typed=FALSE)
 

Data Fields

idhdl next
 
const charid
 
utypes data
 
attr attribute
 
BITSET flag
 
int typ
 
short lev
 
short ref
 
unsigned long id_i
 

Detailed Description

Definition at line 34 of file idrec.h.

Constructor & Destructor Documentation

◆ idrec()

idrec::idrec ( )
inline

Definition at line 49 of file idrec.h.

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

Member Function Documentation

◆ get()

idhdl idrec::get ( const char s,
int  lev 
)

Definition at line 70 of file ipid.cc.

71{
72 assume(s!=NULL);
73 assume((level>=0) && (level<=1000)); //not really, but if it isnt in that bounds..
74 idhdl h = this;
76 int l;
77 const char *id_;
78 unsigned long i=iiS2I(s);
79 char *dummy=(char*)&i;
80 BOOLEAN less4=(dummy[SIZEOF_LONG-1]=='\0');
81 while (h!=NULL)
82 {
84 l=IDLEV(h);
85 if ((l==0)||(l==level))
86 {
87 if (i==h->id_i)
88 {
89 id_=IDID(h);
90 if (less4 || (0 == strcmp(s+SIZEOF_LONG,id_+SIZEOF_LONG)))
91 {
92 if(l==level) return h;
93 found=h;
94 }
95 }
96 }
97 h = IDNEXT(h);
98 }
99 return found;
100}
int BOOLEAN
Definition auxiliary.h:88
int level(const CanonicalForm &f)
int l
Definition cfEzgcd.cc:100
int i
Definition cfEzgcd.cc:132
Definition idrec.h:35
const CanonicalForm int s
Definition facAbsFact.cc:51
bool found
static long iiS2I(const char *s)
Definition ipid.cc:63
#define IDNEXT(a)
Definition ipid.h:118
#define IDID(a)
Definition ipid.h:122
#define IDLEV(a)
Definition ipid.h:121
STATIC_VAR Poly * h
Definition janet.cc:971
#define assume(x)
Definition mod2.h:389
#define omCheckAddr(addr)
#define NULL
Definition omList.c:12

◆ get_level()

idhdl idrec::get_level ( const char s,
int  lev 
)

Definition at line 102 of file ipid.cc.

103{
104 assume(s!=NULL);
105 assume((level>=0) && (level<=1000)); //not really, but if it isnt in that bounds..
106 idhdl h = this;
107 int l;
108 const char *id_;
109 unsigned long i=iiS2I(s);
110 int less4=(i < (1L<<((SIZEOF_LONG-1)*8)));
111 while (h!=NULL)
112 {
114 l=IDLEV(h);
115 if ((l==level)&&(i==h->id_i))
116 {
117 id_=IDID(h);
118 if (less4 || (0 == strcmp(s+SIZEOF_LONG,id_+SIZEOF_LONG)))
119 {
120 return h;
121 }
122 }
123 h = IDNEXT(h);
124 }
125 return NULL;
126}

◆ Init()

void idrec::Init ( )
inline

Definition at line 50 of file idrec.h.

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

◆ set()

idhdl idrec::set ( const char s,
int  lev,
int  t,
BOOLEAN  init = TRUE 
)

Definition at line 237 of file ipid.cc.

238{
239 //printf("define %s, %x, level: %d, typ: %d\n", s,s,level,t);
241 IDID(h) = s;
242 IDTYP(h) = t;
243 IDLEV(h) = level;
244 IDNEXT(h) = this;
245 BOOLEAN at_start=(this==IDROOT);
246 h->id_i=iiS2I(s);
247 if (t==BUCKET_CMD) WarnS("defining polyBucket");
248 if (init)
249 {
250 if ((t==IDEAL_CMD)||(t==MODUL_CMD))
252 IDSTRING(h)=(char *)idrecDataInit(t);
253 // additional settings:--------------------------------------
254#if 0
255 // this leads to a memory leak
256 if (t == QRING_CMD)
257 {
258 // IDRING(h)=rCopy(currRing);
259 /* QRING_CMD is ring dep => currRing !=NULL */
260 }
261#endif
262 }
263 // --------------------------------------------------------
264 if (at_start)
265 IDNEXT(h) = IDROOT;
266 return h;
267}
#define WarnS
Definition emacs.cc:78
@ IDEAL_CMD
Definition grammar.cc:285
@ BUCKET_CMD
Definition grammar.cc:284
@ MODUL_CMD
Definition grammar.cc:288
VAR omBin idrec_bin
Definition ipid.cc:48
void * idrecDataInit(int t)
Definition ipid.cc:138
#define IDSTRING(a)
Definition ipid.h:136
#define IDFLAG(a)
Definition ipid.h:120
#define IDROOT
Definition ipid.h:19
#define IDTYP(a)
Definition ipid.h:119
#define FLAG_STD
Definition ipid.h:106
#define omAlloc0Bin(bin)
#define Sy_bit(x)
Definition options.h:31
@ QRING_CMD
Definition tok.h:160

◆ String()

char * idrec::String ( BOOLEAN  typed = FALSE)

Definition at line 269 of file ipid.cc.

270{
271 sleftv tmp;
272 tmp.Init();
273 tmp.rtyp=IDTYP(this);
274 tmp.data=IDDATA(this);
275 tmp.name=IDID(this);
276 return tmp.String(NULL, typed);
277}
Class used for (list of) interpreter objects.
Definition subexpr.h:83
#define IDDATA(a)
Definition ipid.h:126

Field Documentation

◆ attribute

attr idrec::attribute

Definition at line 41 of file idrec.h.

◆ data

utypes idrec::data

Definition at line 40 of file idrec.h.

◆ flag

BITSET idrec::flag

Definition at line 42 of file idrec.h.

◆ id

const char* idrec::id

Definition at line 39 of file idrec.h.

◆ id_i

unsigned long idrec::id_i

Definition at line 47 of file idrec.h.

◆ lev

short idrec::lev

Definition at line 45 of file idrec.h.

◆ next

idhdl idrec::next

Definition at line 38 of file idrec.h.

◆ ref

short idrec::ref

Definition at line 46 of file idrec.h.

◆ typ

int idrec::typ

Definition at line 43 of file idrec.h.


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