My Project  debian-1:4.1.2-p1+ds-2
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 48 of file attrib.h.

◆ atKillAll

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

Definition at line 46 of file attrib.h.

Typedef Documentation

◆ attr

typedef sattr* attr

Definition at line 14 of file attrib.h.

Function Documentation

◆ at_Kill()

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

Definition at line 198 of file attrib.cc.

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

◆ at_KillAll() [1/2]

void at_KillAll ( idhdl  root,
const ring  r 
)

Definition at line 218 of file attrib.cc.

220 {
221  root->attribute->killAll(r);
222  root->attribute = NULL;

◆ at_KillAll() [2/2]

void at_KillAll ( leftv  root,
const ring  r 
)

Definition at line 224 of file attrib.cc.

226 {
227  root->attribute->killAll(r);
228  root->attribute = NULL;

◆ atATTRIB1()

BOOLEAN atATTRIB1 ( leftv  res,
leftv  a 
)

Definition at line 230 of file attrib.cc.

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

◆ atATTRIB2()

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

Definition at line 274 of file attrib.cc.

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

◆ atATTRIB3()

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

Definition at line 356 of file attrib.cc.

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

◆ atGet() [1/2]

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

Definition at line 128 of file attrib.cc.

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

◆ atGet() [2/2]

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

Definition at line 137 of file attrib.cc.

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

◆ atKILLATTR1()

BOOLEAN atKILLATTR1 ( leftv  res,
leftv  a 
)

Definition at line 447 of file attrib.cc.

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

◆ atKILLATTR2()

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

Definition at line 464 of file attrib.cc.

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

◆ atSet() [1/2]

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

Definition at line 149 of file attrib.cc.

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

◆ atSet() [2/2]

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

Definition at line 161 of file attrib.cc.

163 {
164  if (root!=NULL)
165  {
166  attr *a=root->Attribute();
167  int rt=root->Typ();
168  if (a==NULL)
169  WerrorS("cannot set attributes of this object");
170  else if ((rt!=RING_CMD)
171  && (!RingDependend(rt))&&(RingDependend(typ)))
172  WerrorS("cannot set ring-dependend objects at this type");
173  else
174  {
175  *a=(*a)->set(name,data,typ);
176  }
177  }
FALSE
#define FALSE
Definition: auxiliary.h:96
sleftv::Data
void * Data()
Definition: subexpr.cc:1175
sattr::killAll
void killAll(const ring r)
Definition: attrib.cc:185
sattr::set
attr set(char *s, void *data, int t)
Definition: attrib.cc:66
sattr::Print
void Print()
Definition: attrib.cc:25
atKillAll
#define atKillAll(H)
Definition: attrib.h:46
MODUL_CMD
Definition: grammar.cc:287
STRING_CMD
Definition: tok.h:183
h
STATIC_VAR Poly * h
Definition: janet.cc:971
cf
CanonicalForm cf
Definition: cfModGcd.cc:4024
sattr
Definition: attrib.h:16
omStrDup
#define omStrDup(s)
Definition: omAllocDecl.h:261
sleftv::attribute
attr attribute
Definition: subexpr.h:88
N
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:48
sattr::data
void * data
Definition: attrib.h:24
sleftv
Class used for (list of) interpreter objects.
Definition: subexpr.h:81
idhdl
idrec * idhdl
Definition: ring.h:20
RING_CMD
Definition: grammar.cc:281
b
CanonicalForm b
Definition: cfModGcd.cc:4044
RingDependend
int RingDependend(int t)
Definition: gentable.cc:27
TRUE
#define TRUE
Definition: auxiliary.h:100
hasFlag
#define hasFlag(A, F)
Definition: ipid.h:106
res
CanonicalForm res
Definition: facAbsFact.cc:64
INT_CMD
Definition: tok.h:95
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:790
PrintS
void PrintS(const char *s)
Definition: reporter.cc:283
BOOLEAN
int BOOLEAN
Definition: auxiliary.h:87
rField_is_Ring
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:478
resetFlag
#define resetFlag(A, F)
Definition: ipid.h:108
sattr::kill
void kill(const ring r)
Definition: attrib.cc:179
coeffs
atSet
void atSet(idhdl root, char *name, void *data, int typ)
Definition: attrib.cc:149
sleftv::data
void * data
Definition: subexpr.h:87
idrec::attribute
attr attribute
Definition: idrec.h:40
IDTYP
#define IDTYP(a)
Definition: ipid.h:113
sattr::CopyA
void * CopyA()
Definition: subexpr.cc:2033
sleftv::e
Subexpr e
Definition: subexpr.h:104
idrec
Definition: idrec.h:33
sleftv::Attribute
attr * Attribute()
Definition: subexpr.cc:1469
si_max
static int si_max(const int a, const int b)
Definition: auxiliary.h:140
sattr::next
attr next
Definition: attrib.h:25
FLAG_QRING
#define FLAG_QRING
Definition: ipid.h:105
Werror
void Werror(const char *fmt,...)
Definition: reporter.cc:188
name
char name(const Variable &v)
Definition: factory.h:180
IDHDL
#define IDHDL
Definition: tok.h:30
WerrorS
void WerrorS(const char *s)
Definition: feFopen.cc:24
sleftv::Typ
int Typ()
Definition: subexpr.cc:1032
sleftv::rtyp
int rtyp
Definition: subexpr.h:90
NULL
#define NULL
Definition: omList.c:11
sleftv::CopyD
void * CopyD(int t)
Definition: subexpr.cc:738
atATTRIB1
BOOLEAN atATTRIB1(leftv res, leftv v)
Definition: attrib.cc:230
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
setFlag
#define setFlag(A, F)
Definition: ipid.h:107
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
atKill
#define atKill(H, A)
Definition: attrib.h:48
FLAG_STD
#define FLAG_STD
Definition: ipid.h:103
sattr::atyp
int atyp
Definition: attrib.h:26
sattr::get
attr get(const char *s)
Definition: attrib.cc:89
if
if(yy_init)
Definition: libparse.cc:1419