My Project  debian-1:4.1.1-p2+ds-4build3
Data Structures | Macros | Typedefs | Functions
attrib.h File Reference
#include "kernel/structs.h"
#include "omalloc/omalloc.h"
#include "omalloc/omallocClass.h"

Go to the source code of this file.

Data Structures

class  sattr
 

Macros

#define atKillAll(H)   at_KillAll(H,currRing)
 
#define atKill(H, A)   at_Kill(H,A,currRing)
 

Typedefs

typedef sattrattr
 

Functions

void * atGet (idhdl root, const char *name, int t, void *defaultReturnValue=NULL)
 
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_KillAll (idhdl root, const ring r)
 
void at_KillAll (leftv root, const ring r)
 
void at_Kill (idhdl root, const char *name, const ring r)
 
BOOLEAN atATTRIB1 (leftv res, leftv a)
 
BOOLEAN atATTRIB2 (leftv res, leftv a, leftv b)
 
BOOLEAN atATTRIB3 (leftv res, leftv a, leftv b, leftv c)
 
BOOLEAN atKILLATTR1 (leftv res, leftv a)
 
BOOLEAN atKILLATTR2 (leftv res, leftv a, leftv b)
 

Macro Definition Documentation

◆ atKill

#define atKill (   H,
  A 
)    at_Kill(H,A,currRing)

Definition at line 50 of file attrib.h.

◆ atKillAll

#define atKillAll (   H)    at_KillAll(H,currRing)

Definition at line 48 of file attrib.h.

Typedef Documentation

◆ attr

typedef sattr* attr

Definition at line 16 of file attrib.h.

Function Documentation

◆ at_Kill()

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

Definition at line 201 of file attrib.cc.

202 {
203  attr temp = root->attribute->get(name);
204  if (temp!=NULL)
205  {
206  attr N = temp->next;
207  attr temp1 = root->attribute;
208  if (temp1==temp)
209  {
210  root->attribute = N;
211  }
212  else
213  {
214  while (temp1->next!=temp) temp1 = temp1->next;
215  temp1->next = N;
216  }
217  temp->kill(r);
218  }
219 }

◆ at_KillAll() [1/2]

void at_KillAll ( idhdl  root,
const ring  r 
)

Definition at line 221 of file attrib.cc.

222 {
223  root->attribute->killAll(r);
224  root->attribute = NULL;
225 }

◆ at_KillAll() [2/2]

void at_KillAll ( leftv  root,
const ring  r 
)

Definition at line 227 of file attrib.cc.

228 {
229  root->attribute->killAll(r);
230  root->attribute = NULL;
231 }

◆ atATTRIB1()

BOOLEAN atATTRIB1 ( leftv  res,
leftv  a 
)

Definition at line 233 of file attrib.cc.

234 {
235  attr *aa=(v->Attribute());
236  if (aa==NULL)
237  {
238  WerrorS("this object cannot have attributes");
239  return TRUE;
240  }
241  attr a=*aa;
242  BOOLEAN haveNoAttribute=TRUE;
243  if (v->e==NULL)
244  {
245  if (hasFlag(v,FLAG_STD))
246  {
247  PrintS("attr:isSB, type int\n");
248  haveNoAttribute=FALSE;
249  }
250  if (hasFlag(v,FLAG_QRING))
251  {
252  PrintS("attr:qringNF, type int\n");
253  haveNoAttribute=FALSE;
254  }
255  if (v->Typ()==RING_CMD)
256  {
257  PrintS("attr:cf_class, type int\n");
258  PrintS("attr:global, type int\n");
259  PrintS("attr:maxExp, type int\n");
260  PrintS("attr:ring_cf, type int\n");
261  #ifdef HAVE_SHIFTBBA
262  PrintS("attr:isLPring, type int\n");
263  #endif
264 
265  haveNoAttribute=FALSE;
266  }
267  }
268  else
269  {
270  leftv at=v->LData();
271  return atATTRIB1(res,at);
272  }
273  if (a!=NULL) a->Print();
274  else if(haveNoAttribute) PrintS("no attributes\n");
275  return FALSE;
276 }

◆ atATTRIB2()

BOOLEAN atATTRIB2 ( leftv  res,
leftv  a,
leftv  b 
)

Definition at line 277 of file attrib.cc.

278 {
279  char *name=(char *)b->Data();
280  int t=v->Typ();
281  leftv at=NULL;
282  if (v->e!=NULL)
283  at=v->LData();
284  if (strcmp(name,"isSB")==0)
285  {
286  res->rtyp=INT_CMD;
287  res->data=(void *)(long)hasFlag(v,FLAG_STD);
288  if (at!=NULL) res->data=(void *)(long)(hasFlag(v,FLAG_STD)||(hasFlag(at,FLAG_STD)));
289  }
290  else if ((strcmp(name,"rank")==0)&&(/*v->Typ()*/t==MODUL_CMD))
291  {
292  res->rtyp=INT_CMD;
293  res->data=(void *)(((ideal)v->Data())->rank);
294  }
295  else if ((strcmp(name,"global")==0)
296  &&(/*v->Typ()*/t==RING_CMD))
297  {
298  res->rtyp=INT_CMD;
299  res->data=(void *)(((ring)v->Data())->OrdSgn==1);
300  }
301  else if ((strcmp(name,"maxExp")==0)
302  &&(/*v->Typ()*/t==RING_CMD))
303  {
304  res->rtyp=INT_CMD;
305  res->data=(void *)(long)(((ring)v->Data())->bitmask/2);
306  }
307  else if ((strcmp(name,"ring_cf")==0)
308  &&(/*v->Typ()*/t==RING_CMD))
309  {
310  res->rtyp=INT_CMD;
311  res->data=(void *)(long)(rField_is_Ring((ring)v->Data()));
312  }
313  else if ((strcmp(name,"cf_class")==0)
314  &&(/*v->Typ()*/t==RING_CMD))
315  {
316  res->rtyp=INT_CMD;
317  coeffs cf;
318  if (t==RING_CMD) cf=((ring)v->Data())->cf;
319  else cf=(coeffs)v->Data();
320  res->data=(void *)(long)(cf->type);
321  }
322  else if (strcmp(name,"qringNF")==0)
323  {
324  res->rtyp=INT_CMD;
325  res->data=(void *)(long)hasFlag(v,FLAG_QRING);
326  if (at!=NULL) res->data=(void *)(long)(hasFlag(v,FLAG_QRING)||(hasFlag(at,FLAG_QRING)));
327  }
328 #ifdef HAVE_SHIFTBBA
329  else if ((strcmp(name,"isLPring")==0)
330  &&(/*v->Typ()*/t==RING_CMD))
331  {
332  res->rtyp=INT_CMD;
333  res->data=(void *)(long)(((ring)v->Data())->isLPring);
334  }
335 #endif
336  else
337  {
338  attr *aa=v->Attribute();
339  if (aa==NULL)
340  {
341  WerrorS("this object cannot have attributes");
342  return TRUE;
343  }
344  attr a=*aa;
345  a=a->get(name);
346  if (a!=NULL)
347  {
348  res->rtyp=a->atyp;
349  res->data=a->CopyA();
350  }
351  else
352  {
353  res->rtyp=STRING_CMD;
354  res->data=omStrDup("");
355  }
356  }
357  return FALSE;
358 }

◆ atATTRIB3()

BOOLEAN atATTRIB3 ( leftv  res,
leftv  a,
leftv  b,
leftv  c 
)

Definition at line 359 of file attrib.cc.

360 {
361  idhdl h=(idhdl)v->data;
362  if (v->e!=NULL)
363  {
364  v=v->LData();
365  if (v==NULL) return TRUE;
366  h=NULL;
367  }
368  else if (v->rtyp!=IDHDL) h=NULL;
369  int t=v->Typ();
370 
371  char *name=(char *)b->Data();
372  if (strcmp(name,"isSB")==0)
373  {
374  if (c->Typ()!=INT_CMD)
375  {
376  WerrorS("attribute isSB must be int");
377  return TRUE;
378  }
379  if (((long)c->Data())!=0L)
380  {
381  if (h!=NULL) setFlag(h,FLAG_STD);
382  setFlag(v,FLAG_STD);
383  }
384  else
385  {
386  if (h!=NULL) resetFlag(h,FLAG_STD);
388  }
389  }
390  else if (strcmp(name,"qringNF")==0)
391  {
392  if (c->Typ()!=INT_CMD)
393  {
394  WerrorS("attribute qringNF must be int");
395  return TRUE;
396  }
397  if (((long)c->Data())!=0L)
398  {
399  if (h!=NULL) setFlag(h,FLAG_QRING);
401  }
402  else
403  {
404  if (h!=NULL) resetFlag(h,FLAG_QRING);
406  }
407  }
408  else if ((strcmp(name,"rank")==0)&&(/*v->Typ()*/t==MODUL_CMD))
409  {
410  if (c->Typ()!=INT_CMD)
411  {
412  WerrorS("attribute `rank` must be int");
413  return TRUE;
414  }
415  ideal I=(ideal)v->Data();
416  int rk=id_RankFreeModule(I,currRing);
417  I->rank=si_max(rk,(int)((long)c->Data()));
418  }
419  else if (((strcmp(name,"global")==0)
420  || (strcmp(name,"cf_class")==0)
421  || (strcmp(name,"ring_cf")==0)
422  || (strcmp(name,"maxExp")==0))
423  &&(/*v->Typ()*/t==RING_CMD))
424  {
425  Werror("can not set attribute `%s`",name);
426  return TRUE;
427  }
428 #ifdef HAVE_SHIFTBBA
429  else if ((strcmp(name,"isLPring")==0)
430  &&(/*v->Typ()*/t==RING_CMD))
431  {
432  if (c->Typ()==INT_CMD)
433  ((ring)v->Data())->isLPring=(int)(long)c->Data();
434  else
435  {
436  WerrorS("attribute `isLPring` must be int");
437  return TRUE;
438  }
439  }
440 #endif
441  else
442  {
443  int typ=c->Typ();
444  if (h!=NULL) atSet(h,omStrDup(name),c->CopyD(typ),typ/*c->T(yp()*/);
445  else atSet(v,omStrDup(name),c->CopyD(typ),typ/*c->T(yp()*/);
446  }
447  return FALSE;
448 }

◆ atGet() [1/2]

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

Definition at line 131 of file attrib.cc.

132 {
133  attr temp = root->attribute->get(name);
134  if ((temp!=NULL) && (temp->atyp==t))
135  return temp->data;
136  else
137  return defaultReturnValue;
138 }

◆ atGet() [2/2]

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

Definition at line 140 of file attrib.cc.

141 {
142  attr *a=(root->Attribute());
143  if (a!=NULL)
144  {
145  attr temp = (*a)->get(name);
146  if ((temp!=NULL) && (temp->atyp==t))
147  return temp->data;
148  }
149  return NULL;
150 }

◆ atKILLATTR1()

BOOLEAN atKILLATTR1 ( leftv  res,
leftv  a 
)

Definition at line 450 of file attrib.cc.

451 {
452  idhdl h=NULL;
453  if ((a->rtyp==IDHDL)&&(a->e==NULL))
454  {
455  h=(idhdl)a->data;
457  }
458  resetFlag(a,FLAG_STD);
459  if (h->attribute!=NULL)
460  {
461  atKillAll(h);
462  a->attribute=NULL;
463  }
464  else atKillAll(a);
465  return FALSE;
466 }

◆ atKILLATTR2()

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

Definition at line 467 of file attrib.cc.

468 {
469  if ((a->rtyp!=IDHDL)||(a->e!=NULL))
470  {
471  WerrorS("object must have a name");
472  return TRUE;
473  }
474  char *name=(char *)b->Data();
475  if (strcmp(name,"isSB")==0)
476  {
477  resetFlag(a,FLAG_STD);
479  }
480  else if (strcmp(name,"global")==0)
481  {
482  WerrorS("can not set attribut `global`");
483  return TRUE;
484  }
485  else
486  {
487  atKill((idhdl)a->data,name);
488  }
489  return FALSE;
490 }

◆ atSet() [1/2]

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

Definition at line 152 of file attrib.cc.

153 {
154  if (root!=NULL)
155  {
156  if ((IDTYP(root)!=RING_CMD)
157  && (!RingDependend(IDTYP(root)))&&(RingDependend(typ)))
158  WerrorS("cannot set ring-dependend objects at this type");
159  else
160  root->attribute=root->attribute->set(name,data,typ);
161  }
162 }

◆ atSet() [2/2]

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

Definition at line 164 of file attrib.cc.

165 {
166  if (root!=NULL)
167  {
168  attr *a=root->Attribute();
169  int rt=root->Typ();
170  if (a==NULL)
171  WerrorS("cannot set attributes of this object");
172  else if ((rt!=RING_CMD)
173  && (!RingDependend(rt))&&(RingDependend(typ)))
174  WerrorS("cannot set ring-dependend objects at this type");
175  else
176  {
177  *a=(*a)->set(name,data,typ);
178  }
179  }
180 }
FALSE
#define FALSE
Definition: auxiliary.h:94
sleftv::Data
void * Data()
Definition: subexpr.cc:1134
sattr::killAll
void killAll(const ring r)
Definition: attrib.cc:188
sattr::set
attr set(char *s, void *data, int t)
Definition: attrib.cc:69
sattr::Print
void Print()
Definition: attrib.cc:28
atKillAll
#define atKillAll(H)
Definition: attrib.h:47
MODUL_CMD
@ MODUL_CMD
Definition: grammar.cc:286
STRING_CMD
@ STRING_CMD
Definition: tok.h:183
cf
CanonicalForm cf
Definition: cfModGcd.cc:4024
sattr
Definition: attrib.h:21
omStrDup
#define omStrDup(s)
Definition: omAllocDecl.h:263
sleftv::attribute
attr attribute
Definition: subexpr.h:89
N
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
sattr::data
void * data
Definition: attrib.h:25
sleftv
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
idhdl
idrec * idhdl
Definition: ring.h:21
RING_CMD
@ RING_CMD
Definition: grammar.cc:281
b
CanonicalForm b
Definition: cfModGcd.cc:4044
RingDependend
int RingDependend(int t)
Definition: gentable.cc:29
currRing
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
TRUE
#define TRUE
Definition: auxiliary.h:98
hasFlag
#define hasFlag(A, F)
Definition: ipid.h:107
res
CanonicalForm res
Definition: facAbsFact.cc:64
INT_CMD
@ INT_CMD
Definition: tok.h:96
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:782
PrintS
void PrintS(const char *s)
Definition: reporter.cc:284
BOOLEAN
int BOOLEAN
Definition: auxiliary.h:85
rField_is_Ring
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
h
static Poly * h
Definition: janet.cc:972
resetFlag
#define resetFlag(A, F)
Definition: ipid.h:109
sattr::kill
void kill(const ring r)
Definition: attrib.cc:182
coeffs
atSet
void atSet(idhdl root, char *name, void *data, int typ)
Definition: attrib.cc:152
sleftv::data
void * data
Definition: subexpr.h:88
idrec::attribute
attr attribute
Definition: idrec.h:41
IDTYP
#define IDTYP(a)
Definition: ipid.h:114
sattr::CopyA
void * CopyA()
Definition: subexpr.cc:1944
sleftv::e
Subexpr e
Definition: subexpr.h:105
idrec
Definition: idrec.h:35
sleftv::Attribute
attr * Attribute()
Definition: subexpr.cc:1389
si_max
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
sattr::next
attr next
Definition: attrib.h:26
FLAG_QRING
#define FLAG_QRING
Definition: ipid.h:106
Werror
void Werror(const char *fmt,...)
Definition: reporter.cc:189
name
char name(const Variable &v)
Definition: factory.h:180
IDHDL
#define IDHDL
Definition: tok.h:31
WerrorS
void WerrorS(const char *s)
Definition: feFopen.cc:24
sleftv::Typ
int Typ()
Definition: subexpr.cc:992
sleftv::rtyp
int rtyp
Definition: subexpr.h:91
NULL
#define NULL
Definition: omList.c:10
sleftv::CopyD
void * CopyD(int t)
Definition: subexpr.cc:703
atATTRIB1
BOOLEAN atATTRIB1(leftv res, leftv v)
Definition: attrib.cc:233
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
setFlag
#define setFlag(A, F)
Definition: ipid.h:108
atKill
#define atKill(H, A)
Definition: attrib.h:49
FLAG_STD
#define FLAG_STD
Definition: ipid.h:104
sattr::atyp
int atyp
Definition: attrib.h:27
sattr::get
attr get(const char *s)
Definition: attrib.cc:92
if
if(yy_init)
Definition: libparse.cc:1418