My Project
Loading...
Searching...
No Matches
attrib.h File Reference

Go to the source code of this file.

Data Structures

class  sattr
 

Macros

#define atKillAll(H)
 
#define atKill(H, A)
 

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 )
Value:
void at_Kill(idhdl root, const char *name, const ring r)
Definition attrib.cc:202
CanonicalForm H
Definition facAbsFact.cc:60
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
#define A
Definition sirandom.c:24

Definition at line 49 of file attrib.h.

◆ atKillAll

#define atKillAll ( H)
Value:
void at_KillAll(idhdl root, const ring r)
Definition attrib.cc:222

Definition at line 47 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 202 of file attrib.cc.

203{
204 attr temp = root->attribute->get(name);
205 if (temp!=NULL)
206 {
207 attr N = temp->next;
208 attr temp1 = root->attribute;
209 if (temp1==temp)
210 {
211 root->attribute = N;
212 }
213 else
214 {
215 while (temp1->next!=temp) temp1 = temp1->next;
216 temp1->next = N;
217 }
218 temp->kill(r);
219 }
220}
sattr * attr
Definition attrib.h:16
const CanonicalForm CFMap CFMap & N
Definition cfEzgcd.cc:56
attr attribute
Definition idrec.h:41
attr get(const char *s)
Definition attrib.cc:93
void kill(const ring r)
Definition attrib.cc:183
attr next
Definition attrib.h:26
#define NULL
Definition omList.c:12
int name
New type name for int.

◆ at_KillAll() [1/2]

void at_KillAll ( idhdl root,
const ring r )

Definition at line 222 of file attrib.cc.

223{
224 root->attribute->killAll(r);
225 root->attribute = NULL;
226}
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.

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

◆ atATTRIB1()

BOOLEAN atATTRIB1 ( leftv res,
leftv a )

Definition at line 234 of file attrib.cc.

235{
236 attr *aa=(v->Attribute());
237 if (aa==NULL)
238 {
239 WerrorS("this object cannot have attributes");
240 return TRUE;
241 }
242 attr a=*aa;
243 BOOLEAN haveNoAttribute=TRUE;
244 if (v->e==NULL)
245 {
246 if (hasFlag(v,FLAG_STD))
247 {
248 PrintS("attr:isSB, type int\n");
249 haveNoAttribute=FALSE;
250 }
251 if (hasFlag(v,FLAG_QRING))
252 {
253 PrintS("attr:qringNF, type int\n");
254 haveNoAttribute=FALSE;
255 }
256 if (v->Typ()==RING_CMD)
257 {
258 PrintS("attr:cf_class, type int\n");
259 PrintS("attr:cf_class_Zp, type int\n");
260 PrintS("attr:cf_class_QQ, type int\n");
261 PrintS("attr:global, type int\n");
262 PrintS("attr:maxExp, type int\n");
263 PrintS("attr:ring_cf, type int\n");
264 #ifdef HAVE_SHIFTBBA
265 PrintS("attr:isLetterplaceRing, type int\n");
266 if (rIsLPRing((ring)v->Data()))
267 PrintS("attr:ncgenCount, type int\n");
268 #endif
269
270 haveNoAttribute=FALSE;
271 }
272 }
273 else
274 {
275 leftv at=v->LData();
276 return atATTRIB1(res,at);
277 }
278 if (a!=NULL) a->Print();
279 else if(haveNoAttribute) PrintS("no attributes\n");
280 return FALSE;
281}
BOOLEAN atATTRIB1(leftv res, leftv v)
Definition attrib.cc:234
int BOOLEAN
Definition auxiliary.h:88
#define TRUE
Definition auxiliary.h:101
#define FALSE
Definition auxiliary.h:97
void Print()
Definition attrib.cc:26
CanonicalForm res
Definition facAbsFact.cc:60
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
void WerrorS(const char *s)
Definition feFopen.cc:24
@ RING_CMD
Definition grammar.cc:282
#define hasFlag(A, F)
Definition ipid.h:112
#define FLAG_QRING
Definition ipid.h:108
#define FLAG_STD
Definition ipid.h:106
void PrintS(const char *s)
Definition reporter.cc:284
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:417
sleftv * leftv
Definition structs.h:53

◆ atATTRIB2()

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

Definition at line 282 of file attrib.cc.

283{
284 char *name=(char *)b->Data();
285 int t=v->Typ();
286 leftv at=NULL;
287 if (v->e!=NULL)
288 at=v->LData();
289 if (strcmp(name,"isSB")==0)
290 {
291 res->rtyp=INT_CMD;
292 res->data=(void *)(long)hasFlag(v,FLAG_STD);
293 if (at!=NULL) res->data=(void *)(long)(hasFlag(v,FLAG_STD)||(hasFlag(at,FLAG_STD)));
294 }
295 else if ((strcmp(name,"rank")==0)&&(/*v->Typ()*/t==MODUL_CMD))
296 {
297 res->rtyp=INT_CMD;
298 res->data=(void *)(((ideal)v->Data())->rank);
299 }
300 else if ((strcmp(name,"global")==0)
301 &&(/*v->Typ()*/t==RING_CMD))
302 {
303 res->rtyp=INT_CMD;
304 res->data=(void *)(((ring)v->Data())->OrdSgn==1);
305 }
306 else if ((strcmp(name,"maxExp")==0)
307 &&(/*v->Typ()*/t==RING_CMD))
308 {
309 res->rtyp=INT_CMD;
310 res->data=(void *)(long)(((ring)v->Data())->bitmask);
311 }
312 else if ((strcmp(name,"ring_cf")==0)
313 &&(/*v->Typ()*/t==RING_CMD))
314 {
315 res->rtyp=INT_CMD;
316 res->data=(void *)(long)(rField_is_Ring((ring)v->Data()));
317 }
318 else if ((strncmp(name,"cf_class",strlen("cf_class"))==0)
319 &&(/*v->Typ()*/t==RING_CMD))
320 {
321 res->rtyp=INT_CMD;
322 coeffs cf;
323 cf=((ring)v->Data())->cf;
324 if (strcmp(name,"cf_class_Zp")==0)
325 res->data=(void *)(long)(int)(cf->type==n_Zp);
326 else if (strcmp(name,"cf_class_QQ")==0)
327 res->data=(void *)(long)(int)(cf->type==n_Q);
328 else
329 res->data=(void *)(long)(int)cf->type;
330 }
331 else if (strcmp(name,"qringNF")==0)
332 {
333 res->rtyp=INT_CMD;
334 res->data=(void *)(long)hasFlag(v,FLAG_QRING);
335 if (at!=NULL) res->data=(void *)(long)(hasFlag(v,FLAG_QRING)||(hasFlag(at,FLAG_QRING)));
336 }
337#ifdef HAVE_SHIFTBBA
338 else if ((strcmp(name,"isLetterplaceRing")==0)
339 &&(/*v->Typ()*/t==RING_CMD))
340 {
341 res->rtyp=INT_CMD;
342 res->data=(void *)(long)(((ring)v->Data())->isLPring);
343 }
344 else if ((strcmp(name,"ncgenCount")==0)
345 &&(/*v->Typ()*/t==RING_CMD))
346 {
347 res->rtyp=INT_CMD;
348 res->data=(void *)(long)(((ring)v->Data())->LPncGenCount);
349 }
350#endif
351 else
352 {
353 attr *aa=v->Attribute();
354 if (aa==NULL)
355 {
356 WerrorS("this object cannot have attributes");
357 return TRUE;
358 }
359 attr a=*aa;
360 a=a->get(name);
361 if (a!=NULL)
362 {
363 res->rtyp=a->atyp;
364 res->data=a->CopyA();
365 }
366 else
367 {
368 res->rtyp=STRING_CMD;
369 res->data=omStrDup("");
370 }
371 }
372 return FALSE;
373}
CanonicalForm cf
Definition cfModGcd.cc:4091
CanonicalForm b
Definition cfModGcd.cc:4111
void * CopyA()
Definition subexpr.cc:2192
int atyp
Definition attrib.h:27
@ n_Q
rational (GMP) numbers
Definition coeffs.h:30
@ n_Zp
\F{p < 2^31}
Definition coeffs.h:29
@ MODUL_CMD
Definition grammar.cc:288
The main handler for Singular numbers which are suitable for Singular polynomials.
#define omStrDup(s)
#define rField_is_Ring(R)
Definition ring.h:491
@ STRING_CMD
Definition tok.h:187
@ INT_CMD
Definition tok.h:96

◆ atATTRIB3()

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

Definition at line 374 of file attrib.cc.

375{
376 idhdl h=(idhdl)v->data;
377 if (v->e!=NULL)
378 {
379 v=v->LData();
380 if (v==NULL) return TRUE;
381 h=NULL;
382 }
383 else if (v->rtyp!=IDHDL) h=NULL;
384 int t=v->Typ();
385
386 char *name=(char *)b->Data();
387 if (strcmp(name,"isSB")==0)
388 {
389 if (c->Typ()!=INT_CMD)
390 {
391 WerrorS("attribute isSB must be int");
392 return TRUE;
393 }
394 if (((long)c->Data())!=0L)
395 {
396 if (h!=NULL) setFlag(h,FLAG_STD);
398 }
399 else
400 {
401 if (h!=NULL) resetFlag(h,FLAG_STD);
403 }
404 }
405 else if (strcmp(name,"qringNF")==0)
406 {
407 if (c->Typ()!=INT_CMD)
408 {
409 WerrorS("attribute qringNF must be int");
410 return TRUE;
411 }
412 if (((long)c->Data())!=0L)
413 {
414 if (h!=NULL) setFlag(h,FLAG_QRING);
416 }
417 else
418 {
419 if (h!=NULL) resetFlag(h,FLAG_QRING);
421 }
422 }
423 else if ((strcmp(name,"rank")==0)&&(/*v->Typ()*/t==MODUL_CMD))
424 {
425 if (c->Typ()!=INT_CMD)
426 {
427 WerrorS("attribute `rank` must be int");
428 return TRUE;
429 }
430 ideal I=(ideal)v->Data();
431 int rk=id_RankFreeModule(I,currRing);
432 I->rank=si_max(rk,(int)((long)c->Data()));
433 }
434 else if (((strcmp(name,"global")==0)
435 || (strncmp(name,"cf_class",strlen("cf_class"))==0)
436 || (strcmp(name,"ring_cf")==0)
437 || (strcmp(name,"maxExp")==0))
438 &&(/*v->Typ()*/t==RING_CMD))
439 {
440 Werror("can not set attribute `%s`",name);
441 return TRUE;
442 }
443#ifdef HAVE_SHIFTBBA
444 else if ((strcmp(name,"isLetterplaceRing")==0)
445 &&(/*v->Typ()*/t==RING_CMD))
446 {
447 if (c->Typ()==INT_CMD)
448 ((ring)v->Data())->isLPring=(int)(long)c->Data();
449 else
450 {
451 WerrorS("attribute `isLetterplaceRing` must be int");
452 return TRUE;
453 }
454 }
455 else if ((strcmp(name,"ncgenCount")==0)
456 &&(/*v->Typ()*/t==RING_CMD))
457 {
458 if (c->Typ()==INT_CMD)
459 ((ring)v->Data())->LPncGenCount=(int)(long)c->Data();
460 else
461 {
462 WerrorS("attribute `ncgenCount` must be int");
463 return TRUE;
464 }
465 }
466#endif
467 else
468 {
469 int typ=c->Typ();
470 if (h!=NULL) atSet(h,omStrDup(name),c->CopyD(typ),typ/*c->T(yp()*/);
471 else atSet(v,omStrDup(name),c->CopyD(typ),typ/*c->T(yp()*/);
472 }
473 return FALSE;
474}
void atSet(idhdl root, char *name, void *data, int typ)
Definition attrib.cc:153
static int si_max(const int a, const int b)
Definition auxiliary.h:125
void * CopyD(int t)
Definition subexpr.cc:714
int Typ()
Definition subexpr.cc:1048
void * Data()
Definition subexpr.cc:1192
#define resetFlag(A, F)
Definition ipid.h:114
#define setFlag(A, F)
Definition ipid.h:113
STATIC_VAR Poly * h
Definition janet.cc:971
void Werror(const char *fmt,...)
Definition reporter.cc:189
idrec * idhdl
Definition ring.h:22
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
#define IDHDL
Definition tok.h:31

◆ atGet() [1/2]

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

Definition at line 132 of file attrib.cc.

133{
134 attr temp = root->attribute->get(name);
135 if ((temp!=NULL) && (temp->atyp==t))
136 return temp->data;
137 else
138 return defaultReturnValue;
139}
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.

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

◆ atKILLATTR1()

BOOLEAN atKILLATTR1 ( leftv res,
leftv a )

Definition at line 476 of file attrib.cc.

477{
478 idhdl h=NULL;
479 if ((a->rtyp==IDHDL)&&(a->e==NULL))
480 {
481 h=(idhdl)a->data;
483 }
485 if (h->attribute!=NULL)
486 {
487 atKillAll(h);
488 a->attribute=NULL;
489 }
490 else atKillAll(a);
491 return FALSE;
492}
#define atKillAll(H)
Definition attrib.h:47
int rtyp
Definition subexpr.h:91
void * data
Definition subexpr.h:88
Subexpr e
Definition subexpr.h:105

◆ atKILLATTR2()

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

Definition at line 493 of file attrib.cc.

494{
495 if ((a->rtyp!=IDHDL)||(a->e!=NULL))
496 {
497 WerrorS("object must have a name");
498 return TRUE;
499 }
500 char *name=(char *)b->Data();
501 if (strcmp(name,"isSB")==0)
502 {
505 }
506 else if (strcmp(name,"global")==0)
507 {
508 WerrorS("can not set attribut `global`");
509 return TRUE;
510 }
511 else
512 {
513 atKill((idhdl)a->data,name);
514 }
515 return FALSE;
516}
#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.

154{
155 if (root!=NULL)
156 {
157 if ((IDTYP(root)!=RING_CMD)
158 && (!RingDependend(IDTYP(root)))&&(RingDependend(typ)))
159 WerrorS("cannot set ring-dependend objects at this type");
160 else
161 root->attribute=root->attribute->set(name,data,typ);
162 }
163}
attr set(char *s, void *data, int t)
Definition attrib.cc:70
static int RingDependend(int t)
Definition gentable.cc:23
#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.

166{
167 if (root!=NULL)
168 {
169 attr *a=root->Attribute();
170 int rt=root->Typ();
171 if (a==NULL)
172 WerrorS("cannot set attributes of this object");
173 else if ((rt!=RING_CMD)
174 && (!RingDependend(rt))&&(RingDependend(typ)))
175 WerrorS("cannot set ring-dependend objects at this type");
176 else
177 {
178 *a=(*a)->set(name,data,typ);
179 }
180 }
181}