My Project
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)
 
char * String (BOOLEAN typed=FALSE)
 

Data Fields

idhdl next
 
const char * id
 
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 72 of file ipid.cc.

73 {
74  assume(s!=NULL);
75  assume((level>=0) && (level<=1000)); //not really, but if it isnt in that bounds..
76  idhdl h = this;
78  int l;
79  const char *id_;
80  unsigned long i=iiS2I(s);
81  int less4=(i < (1L<<((SIZEOF_LONG-1)*8)));
82  while (h!=NULL)
83  {
85  l=IDLEV(h);
86  if ((l==0)||(l==level))
87  {
88  if (i==h->id_i)
89  {
90  id_=IDID(h);
91  if (less4 || (0 == strcmp(s+SIZEOF_LONG,id_+SIZEOF_LONG)))
92  {
93  if(l==level) return h;
94  found=h;
95  }
96  }
97  }
98  h = IDNEXT(h);
99  }
100  return found;
101 }
void * ADDRESS
Definition: auxiliary.h:119
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
Definition: facFactorize.cc:55
static long iiS2I(const char *s)
Definition: ipid.cc:65
#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:387
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
#define NULL
Definition: omList.c:12

◆ get_level()

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

Definition at line 103 of file ipid.cc.

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

◆ 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 236 of file ipid.cc.

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

◆ String()

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

Definition at line 268 of file ipid.cc.

269 {
270  sleftv tmp;
271  tmp.Init();
272  tmp.rtyp=IDTYP(this);
273  tmp.data=IDDATA(this);
274  tmp.name=IDID(this);
275  return tmp.String(NULL, typed);
276 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
const char * name
Definition: subexpr.h:87
int rtyp
Definition: subexpr.h:91
void Init()
Definition: subexpr.h:107
char * String(void *d=NULL, BOOLEAN typed=FALSE, int dim=1)
Called for conversion to string (used by string(..), write(..),..)
Definition: subexpr.cc:761
void * data
Definition: subexpr.h:88
#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: