Go to the source code of this file.
|
int | newstruct_desc_size () |
|
static int | NeedShadowRing (int t) |
|
char * | newstruct_String (blackbox *b, void *d) |
|
lists | lCopy_newstruct (lists L) |
|
void * | newstruct_Copy (blackbox *, void *d) |
|
BOOLEAN | newstruct_Assign_user (int op, leftv l, leftv r) |
|
void | lClean_newstruct (lists l) |
|
static BOOLEAN | newstruct_Assign_same (leftv l, leftv r) |
|
BOOLEAN | newstruct_Op1 (int op, leftv res, leftv arg) |
|
BOOLEAN | newstruct_Assign (leftv l, leftv r) |
|
BOOLEAN | newstruct_Op2 (int op, leftv res, leftv a1, leftv a2) |
|
BOOLEAN | newstruct_OpM (int op, leftv res, leftv args) |
|
void | newstruct_destroy (blackbox *, void *d) |
|
void * | newstruct_Init (blackbox *b) |
|
BOOLEAN | newstruct_CheckAssign (blackbox *, leftv L, leftv R) |
|
BOOLEAN | newstruct_serialize (blackbox *b, void *d, si_link f) |
|
BOOLEAN | newstruct_deserialize (blackbox **, void **d, si_link f) |
|
void | newstruct_Print (blackbox *b, void *d) |
|
void | newstruct_setup (const char *n, newstruct_desc d) |
|
static newstruct_desc | scanNewstructFromString (const char *s, newstruct_desc res) |
|
newstruct_desc | newstructFromString (const char *s) |
|
newstruct_desc | newstructChildFromString (const char *parent, const char *s) |
|
void | newstructShow (newstruct_desc d) |
|
BOOLEAN | newstruct_set_proc (const char *bbname, const char *func, int args, procinfov pr) |
|
◆ newstruct_member_s
struct newstruct_member_s |
Definition at line 15 of file newstruct.cc.
Data Fields |
char * |
name |
|
newstruct_member |
next |
|
int |
pos |
|
int |
typ |
|
◆ newstruct_proc_a
◆ newstruct_desc_s
Definition at line 33 of file newstruct.cc.
Data Fields |
int |
id |
|
newstruct_member |
member |
|
newstruct_desc |
parent |
|
newstruct_proc |
procs |
|
int |
size |
|
◆ lClean_newstruct()
void lClean_newstruct |
( |
lists |
l | ) |
|
Definition at line 209 of file newstruct.cc.
210{
212 {
215 for(
i=
l->nr;
i>=0;
i--)
216 {
218 r=(ring)(
l->m[
i-1].data);
219 else
222 }
225 }
227}
Class used for (list of) interpreter objects.
#define omFreeSize(addr, size)
#define omFreeBin(addr, bin)
◆ lCopy_newstruct()
Definition at line 126 of file newstruct.cc.
127{
132 for(;n>=0;n--)
133 {
136 {
139 {
142 N->m[n].Copy(&L->
m[n]);
143 }
144 else
145 {
146 N->m[n].rtyp=L->
m[n].
rtyp;
148 }
149 }
151 {
152 N->m[n].rtyp=L->
m[n].
rtyp;
154 }
156 {
157 N->m[n].rtyp=L->
m[n].
rtyp;
159 N->m[n].data=(
void *)
b->blackbox_Copy(
b,L->
m[n].
data);
160 }
161 else
162 N->m[n].Copy(&L->
m[n]);
163 }
166}
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
const CanonicalForm CFMap CFMap & N
static int RingDependend(int t)
void * idrecDataInit(int t)
BOOLEAN lRingDependend(lists L)
void rChangeCurrRing(ring r)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
◆ NeedShadowRing()
static int NeedShadowRing |
( |
int |
t | ) |
|
|
inlinestatic |
◆ newstruct_Assign()
Definition at line 279 of file newstruct.cc.
280{
282 if (
l->Typ()==r->
Typ())
283 {
285 }
287 {
289 if (
l->Typ()!=r->
Typ())
290 {
291 newstruct_desc rrn=(newstruct_desc)rr->data;
292
294 {
295 Werror(
"custom type %s(%d) cannot be assigned to newstruct %s(%d)",
298 }
299
300
301 newstruct_desc rrp=rrn->parent;
302 while ((rrp!=
NULL)&&(rrp->id!=
l->Typ())) rrp=rrp->parent;
304 {
306 {
308 }
309 else
310 {
312 }
313 }
314 else
315 {
319 }
320 }
321 if (
l->Typ()==r->
Typ())
322 {
324 }
325 }
326 else
327 {
330 }
331 Werror(
"assign %s(%d) = %s(%d)",
334}
if(!FE_OPT_NO_SHELL_FLAG)(void) system(sys)
const char * Tok2Cmdname(int tok)
BOOLEAN newstruct_Assign_user(int op, leftv l, leftv r)
static BOOLEAN newstruct_Assign_same(leftv l, leftv r)
BOOLEAN newstruct_Op1(int op, leftv res, leftv arg)
BOOLEAN newstruct_Assign(leftv l, leftv r)
void Werror(const char *fmt,...)
◆ newstruct_Assign_same()
Definition at line 229 of file newstruct.cc.
230{
233 {
236 }
241 {
243 }
244 else
245 {
247 }
249}
void CleanUp(ring r=currRing)
void lClean_newstruct(lists l)
lists lCopy_newstruct(lists L)
◆ newstruct_Assign_user()
Definition at line 174 of file newstruct.cc.
175{
178 newstruct_desc nt=(newstruct_desc)ll->data;
179 newstruct_proc
p=nt->procs;
180
181 while( (
p!=
NULL) && ((
p->t!=
'=')||(
p->args!=1)) )
p=
p->next;
182
184 {
194 if (!sl)
195 {
197 {
201 }
204 }
205 }
207}
BOOLEAN iiMake_proc(idhdl pn, package pack, leftv args)
INST_VAR sleftv iiRETURNEXPR
◆ newstruct_CheckAssign()
Definition at line 549 of file newstruct.cc.
550{
554 {
557 if ((rt>0) && (lt>0)
559 {
560 Werror(
"can not assign %s(%d) to member of type %s(%d)",
561 rt1,rt,lt1,lt);
562 }
563 else
564 {
565 Werror(
"can not assign %s to member of type %s",rt1,lt1);
566 }
568 }
570}
int iiTestConvert(int inputType, int outputType)
const struct sConvertTypes dConvertTypes[]
◆ newstruct_Copy()
void * newstruct_Copy |
( |
blackbox * |
, |
|
|
void * |
d |
|
) |
| |
◆ newstruct_desc_size()
int newstruct_desc_size |
( |
| ) |
|
◆ newstruct_deserialize()
Definition at line 636 of file newstruct.cc.
637{
638
639
640
641
643 int Ll=(int)(
long)(
l->data);
647 for(
int i=0;
i<=Ll;
i++)
648 {
652 }
653
654
655 *d=L;
657}
INLINE_THIS void Init(int l=0)
EXTERN_VAR omBin sleftv_bin
◆ newstruct_destroy()
void newstruct_destroy |
( |
blackbox * |
, |
|
|
void * |
d |
|
) |
| |
◆ newstruct_Init()
void * newstruct_Init |
( |
blackbox * |
b | ) |
|
Definition at line 528 of file newstruct.cc.
529{
530 newstruct_desc n=(newstruct_desc)
b->data;
533 newstruct_member nm=n->member;
535 {
536 l->m[nm->pos].rtyp=nm->typ;
538 {
542 }
544 nm=nm->next;
545 }
547}
static int NeedShadowRing(int t)
static ring rIncRefCnt(ring r)
◆ newstruct_Op1()
Definition at line 251 of file newstruct.cc.
252{
253
255 newstruct_desc nt=(newstruct_desc)a->data;
256 newstruct_proc
p=nt->procs;
257
258 while((
p!=
NULL) &&( (
p->t!=op) || (
p->args!=1) ))
p=
p->next;
259
261 {
269 else
270 {
274 }
275 }
277}
BOOLEAN blackboxDefaultOp1(int op, leftv l, leftv r)
default procedure blackboxDefaultOp1, to be called as "default:" branch
◆ newstruct_Op2()
Definition at line 336 of file newstruct.cc.
337{
338
340 newstruct_desc nt;
343 {
344 nt=(newstruct_desc)a->data;
345 switch(op)
346 {
347 case '.':
348 {
350 {
352 newstruct_member nm=nt->member;
353 while ((nm!=
NULL)&&(strcmp(nm->name,a2->
name)!=0)) nm=nm->next;
354 if ((nm==
NULL) && (strncmp(a2->
name,
"r_",2)==0))
355 {
356 nm=nt->member;
357 while ((nm!=
NULL)&&(strcmp(nm->name,a2->
name+2)!=0)) nm=nm->next;
360 else
362 }
364 {
367 }
368 if (search_ring)
369 {
370 ring r=(ring)al->
m[nm->pos-1].
data;
373 {
376 WerrorS(
"ring of this member is not set and no basering found");
377 }
382 }
385 {
387 {
388
389 ring r=(ring)al->
m[nm->pos-1].
data;
391 {
395 }
396 }
398 {
399
401
402 }
403 else
404 {
405
407
408 }
410 }
412 {
414 {
415 ring old=(ring)al->
m[nm->pos-1].
data;
417 }
420 }
422 r->start = nm->pos+1;
426 else
427 {
429 while (sh->next !=
NULL) sh=sh->next;
430 sh->next=r;
431 }
432
435 }
436 else
437 {
440 }
441 }
442 }
443 }
444 else
445 {
447 nt=(newstruct_desc)a->data;
449 }
450 newstruct_proc
p=nt->procs;
451 while((
p!=
NULL) && ( (
p->t!=op) || (
p->args!=2) ))
p=
p->next;
453 {
467 else
468 {
472 }
473 }
475}
BOOLEAN blackboxDefaultOp2(int, leftv, leftv, leftv)
default procedure blackboxDefaultOp2, to be called as "default:" branch
void WerrorS(const char *s)
static void rDecRefCnt(ring r)
◆ newstruct_OpM()
Definition at line 478 of file newstruct.cc.
479{
480
482 newstruct_desc nt=(newstruct_desc)a->data;
483 switch(op)
484 {
486 {
487 res->data=(
void *)a->blackbox_String(a,args->
Data());
491 }
492 default:
493 break;
494 }
495 newstruct_proc
p=nt->procs;
496
497 while((
p!=
NULL) &&( (
p->t!=op) || (
p->args!=4) ))
p=
p->next;
498
500 {
509 else
510 {
514 }
515 }
517}
BOOLEAN blackboxDefaultOpM(int op, leftv res, leftv args)
default procedure blackboxDefaultOpM, to be called as "default:" branch
◆ newstruct_Print()
void newstruct_Print |
( |
blackbox * |
b, |
|
|
void * |
d |
|
) |
| |
Definition at line 659 of file newstruct.cc.
660{
661 newstruct_desc dd=(newstruct_desc)
b->data;
662 newstruct_proc
p=dd->procs;
666 {
678 if (!sl)
679 {
682 }
684 }
685 else
687}
void blackbox_default_Print(blackbox *b, void *d)
default procedure blackbox_default_Print: print the string
void * newstruct_Copy(blackbox *, void *d)
◆ newstruct_serialize()
Definition at line 594 of file newstruct.cc.
595{
596 newstruct_desc dd=(newstruct_desc)
b->data;
605 l.data=(
void*)(
long)Ll;
607
609 newstruct_member elem=dd->member;
611 {
612 rings[elem->pos]='\1';
613 elem=elem->next;
614 }
619 {
621 {
623 {
626 }
627 }
628 f->m->Write(
f,&(ll->
m[
i]));
629 }
631 if (ring_changed && (save_ring!=
NULL))
632 f->m->SetRing(
f,save_ring,
FALSE);
634}
const char * getBlackboxName(const int t)
return the name to the type given by t (r/o)
◆ newstruct_set_proc()
Definition at line 846 of file newstruct.cc.
847{
848 int id=0;
851 {
852 Werror(
">>%s<< is not a newstruct type",bbname);
854 }
856 newstruct_desc desc=(newstruct_desc)bb->data;
857 newstruct_proc
p=(newstruct_proc)
omAlloc(
sizeof(*
p));
858 p->next=desc->procs; desc->procs=
p;
859
862
863 int tt;
864 if(!(tt=
IsCmd(func,
p->t)))
865 {
866 int t;
868 {
873 ||(t=='='))
875 else if (t=='(')
877 else if (t=='-')
879 }
880 else
881 {
884 Werror(
">>%s<< is not a kernel command",func);
887 }
888 }
889 switch(tt)
890 {
891
898
900 if(args!=1) {
Warn(
"args must be 1 for %s in %s",func,
my_yylinebuf);args=1;}
901 break;
904 break;
907 break;
910 break;
913 break;
916 break;
919 break;
923 break;
924 default:
926 break;
927 }
930 {
934 }
939}
int blackboxIsCmd(const char *n, int &tok)
used by scanner: returns ROOT_DECL for known types (and the type number in tok)
VAR char my_yylinebuf[80]
int IsCmd(const char *n, int &tok)
int iiOpsTwoChar(const char *s)
◆ newstruct_setup()
void newstruct_setup |
( |
const char * |
n, |
|
|
newstruct_desc |
d |
|
) |
| |
Definition at line 688 of file newstruct.cc.
689{
690 blackbox *
b=(blackbox*)
omAlloc0(
sizeof(blackbox));
691
692
693
702
710 d->id=rt;
711
712}
int setBlackboxStuff(blackbox *bb, const char *n)
define a new type
BOOLEAN newstruct_Op2(int op, leftv res, leftv a1, leftv a2)
BOOLEAN newstruct_deserialize(blackbox **, void **d, si_link f)
void newstruct_destroy(blackbox *, void *d)
char * newstruct_String(blackbox *b, void *d)
BOOLEAN newstruct_serialize(blackbox *b, void *d, si_link f)
void * newstruct_Init(blackbox *b)
BOOLEAN newstruct_OpM(int op, leftv res, leftv args)
BOOLEAN newstruct_CheckAssign(blackbox *, leftv L, leftv R)
void newstruct_Print(blackbox *b, void *d)
◆ newstruct_String()
char * newstruct_String |
( |
blackbox * |
b, |
|
|
void * |
d |
|
) |
| |
Definition at line 50 of file newstruct.cc.
51{
53 else
54 {
55 newstruct_desc ad=(newstruct_desc)(
b->data);
56
57 newstruct_proc
p=ad->procs;
60
62 {
74
76 {
80 }
83 }
84
86 newstruct_member a=ad->member;
89 {
95 {
97 {
99 }
101 {
103 }
104 else
105 {
106 char *
tmp2=
l->m[a->pos].String();
108 {
112 }
115 }
116 }
118 if (a->next==
NULL)
break;
121 a=a->next;
122 }
124 }
125}
void StringSetS(const char *st)
void StringAppendS(const char *st)
BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr)
returns TRUE, if r1 equals r2 FALSE, otherwise Equality is determined componentwise,...
◆ newstructChildFromString()
newstruct_desc newstructChildFromString |
( |
const char * |
parent, |
|
|
const char * |
s |
|
) |
| |
Definition at line 799 of file newstruct.cc.
800{
801
802 int parent_id=0;
805 {
806 Werror(
">>%s< not found",parent);
808 }
810
812 {
813 Werror(
">>%s< is not a user defined type",parent);
815 }
816
818 newstruct_desc parent_desc=(newstruct_desc)parent_bb->data;
819 res->size=parent_desc->size;
820 res->member=parent_desc->member;
821 res->parent=parent_desc;
822
824}
const CanonicalForm int s
static newstruct_desc scanNewstructFromString(const char *s, newstruct_desc res)
◆ newstructFromString()
newstruct_desc newstructFromString |
( |
const char * |
s | ) |
|
◆ newstructShow()
void newstructShow |
( |
newstruct_desc |
d | ) |
|
Definition at line 826 of file newstruct.cc.
827{
828 newstruct_member elem;
829 Print(
"id: %d\n",d->id);
830 elem=d->member;
832 {
833 Print(
">>%s<< at pos %d, type %d (%s)\n",elem->name,elem->pos,elem->typ,
Tok2Cmdname(elem->typ));
835 Print(
">>r_%s<< at pos %d, shadow ring\n",elem->name,elem->pos-1);
836 elem=elem->next;
837 }
838 newstruct_proc
p=d->procs;
840 {
841 Print(
"op:%d(%s) with %d args -> %s\n",
p->t,
iiTwoOps(
p->t),
p->args,
p->p->procname);
843 }
844}
const char * iiTwoOps(int t)
◆ scanNewstructFromString()
static newstruct_desc scanNewstructFromString |
( |
const char * |
s, |
|
|
newstruct_desc |
res |
|
) |
| |
|
static |
Definition at line 714 of file newstruct.cc.
715{
718 char *start;
719 int t;
720 char c;
721 newstruct_member elem;
722
726 {
727
728 while ((*
p!=
'\0') && (*
p<=
' '))
p++;
730 while (isalnum(*
p))
p++;
733 if (t==0)
734 {
735 Werror(
"unknown type `%s`",start);
740 }
744
745 elem=(newstruct_member)
omAlloc0(
sizeof(*elem));
746
748 while ((*
p!=
'\0') && (*
p<=
' '))
p++;
750 while (isalnum(*
p))
p++;
753 elem->typ=t;
755 if ((*start=='\0') ||(isdigit(*start)))
756 {
757 WerrorS(
"illegal/empty name for element");
758 goto error_in_newstruct_def;
759 }
761
762 elem->next=
res->member;
765
766
768 while ((*
p!=
'\0') && (*
p<=
' '))
p++;
770 {
772 {
773 Werror(
"unknown character in newstruct:>>%s<<",
p);
774 goto error_in_newstruct_def;
775 }
776 break;
777 }
779 }
782
783
785error_in_newstruct_def:
791}