23struct newstruct_proc_s;
55 newstruct_desc ad=(newstruct_desc)(
b->data);
57 newstruct_proc
p=ad->procs;
86 newstruct_member a=ad->member;
106 char *
tmp2=
l->m[a->pos].String();
118 if (a->next==
NULL)
break;
142 N->m[n].Copy(&L->
m[n]);
146 N->m[n].rtyp=L->
m[n].
rtyp;
152 N->m[n].rtyp=L->
m[n].
rtyp;
157 N->m[n].rtyp=L->
m[n].
rtyp;
159 N->m[n].data=(
void *)
b->blackbox_Copy(
b,L->
m[n].
data);
162 N->m[n].Copy(&L->
m[n]);
178 newstruct_desc nt=(newstruct_desc)ll->data;
179 newstruct_proc
p=nt->procs;
181 while( (
p!=
NULL) && ((
p->t!=
'=')||(
p->args!=1)) )
p=
p->next;
215 for(
i=
l->nr;
i>=0;
i--)
218 r=(ring)(
l->m[
i-1].data);
255 newstruct_desc nt=(newstruct_desc)a->data;
256 newstruct_proc
p=nt->procs;
258 while((
p!=
NULL) &&( (
p->t!=op) || (
p->args!=1) ))
p=
p->next;
282 if (
l->Typ()==r->
Typ())
289 if (
l->Typ()!=r->
Typ())
291 newstruct_desc rrn=(newstruct_desc)rr->data;
295 Werror(
"custom type %s(%d) cannot be assigned to newstruct %s(%d)",
301 newstruct_desc rrp=rrn->parent;
302 while ((rrp!=
NULL)&&(rrp->id!=
l->Typ())) rrp=rrp->parent;
321 if (
l->Typ()==r->
Typ())
331 Werror(
"assign %s(%d) = %s(%d)",
344 nt=(newstruct_desc)a->data;
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))
357 while ((nm!=
NULL)&&(strcmp(nm->name,a2->
name+2)!=0)) nm=nm->next;
370 ring r=(ring)al->
m[nm->pos-1].
data;
376 WerrorS(
"ring of this member is not set and no basering found");
389 ring r=(ring)al->
m[nm->pos-1].
data;
415 ring old=(ring)al->
m[nm->pos-1].
data;
422 r->start = nm->pos+1;
429 while (sh->next !=
NULL) sh=sh->next;
447 nt=(newstruct_desc)a->data;
450 newstruct_proc
p=nt->procs;
451 while((
p!=
NULL) && ( (
p->t!=op) || (
p->args!=2) ))
p=
p->next;
482 newstruct_desc nt=(newstruct_desc)a->data;
487 res->data=(
void *)a->blackbox_String(a,args->
Data());
495 newstruct_proc
p=nt->procs;
497 while((
p!=
NULL) &&( (
p->t!=op) || (
p->args!=4) ))
p=
p->next;
530 newstruct_desc n=(newstruct_desc)
b->data;
533 newstruct_member nm=n->member;
536 l->m[nm->pos].rtyp=nm->typ;
560 Werror(
"can not assign %s(%d) to member of type %s(%d)",
565 Werror(
"can not assign %s to member of type %s",rt1,lt1);
596 newstruct_desc dd=(newstruct_desc)
b->data;
605 l.data=(
void*)(
long)Ll;
609 newstruct_member elem=dd->member;
612 rings[elem->pos]=
'\1';
628 f->m->Write(
f,&(ll->
m[
i]));
631 if (ring_changed && (save_ring!=
NULL))
632 f->m->SetRing(
f,save_ring,
FALSE);
643 int Ll=(int)(
long)(
l->data);
647 for(
int i=0;
i<=Ll;
i++)
661 newstruct_desc dd=(newstruct_desc)
b->data;
662 newstruct_proc
p=dd->procs;
690 blackbox *
b=(blackbox*)
omAlloc0(
sizeof(blackbox));
721 newstruct_member elem;
728 while ((*
p!=
'\0') && (*
p<=
' '))
p++;
730 while (isalnum(*
p))
p++;
735 Werror(
"unknown type `%s`",start);
745 elem=(newstruct_member)
omAlloc0(
sizeof(*elem));
748 while ((*
p!=
'\0') && (*
p<=
' '))
p++;
750 while (isalnum(*
p))
p++;
755 if ((*start==
'\0') ||(isdigit(*start)))
757 WerrorS(
"illegal/empty name for element");
758 goto error_in_newstruct_def;
762 elem->next=
res->member;
768 while ((*
p!=
'\0') && (*
p<=
' '))
p++;
773 Werror(
"unknown character in newstruct:>>%s<<",
p);
774 goto error_in_newstruct_def;
785error_in_newstruct_def:
806 Werror(
">>%s< not found",parent);
813 Werror(
">>%s< is not a user defined type",parent);
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;
828 newstruct_member elem;
829 Print(
"id: %d\n",d->id);
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);
838 newstruct_proc
p=d->procs;
841 Print(
"op:%d(%s) with %d args -> %s\n",
p->t,
iiTwoOps(
p->t),
p->args,
p->p->procname);
852 Werror(
">>%s<< is not a newstruct type",bbname);
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;
864 if(!(tt=
IsCmd(func,
p->t)))
884 Werror(
">>%s<< is not a kernel command",func);
900 if(args!=1) {
Warn(
"args must be 1 for %s in %s",func,
my_yylinebuf);args=1;}
int setBlackboxStuff(blackbox *bb, const char *n)
define a new type
BOOLEAN blackboxDefaultOp2(int, leftv, leftv, leftv)
default procedure blackboxDefaultOp2, to be called as "default:" branch
const char * getBlackboxName(const int t)
return the name to the type given by t (r/o)
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
void blackbox_default_Print(blackbox *b, void *d)
default procedure blackbox_default_Print: print the string
int blackboxIsCmd(const char *n, int &tok)
used by scanner: returns ROOT_DECL for known types (and the type number in tok)
BOOLEAN blackboxDefaultOpM(int op, leftv res, leftv args)
default procedure blackboxDefaultOpM, to be called as "default:" branch
BOOLEAN blackboxDefaultOp1(int op, leftv l, leftv r)
default procedure blackboxDefaultOp1, to be called as "default:" branch
const CanonicalForm CFMap CFMap & N
Class used for (list of) interpreter objects.
void CleanUp(ring r=currRing)
INLINE_THIS void Init(int l=0)
const CanonicalForm int s
void WerrorS(const char *s)
VAR char my_yylinebuf[80]
if(!FE_OPT_NO_SHELL_FLAG)(void) system(sys)
int iiTestConvert(int inputType, int outputType)
const char * iiTwoOps(int t)
const char * Tok2Cmdname(int tok)
static int RingDependend(int t)
int IsCmd(const char *n, int &tok)
const struct sConvertTypes dConvertTypes[]
void * idrecDataInit(int t)
EXTERN_VAR omBin sleftv_bin
BOOLEAN iiMake_proc(idhdl pn, package pack, leftv args)
INST_VAR sleftv iiRETURNEXPR
int iiOpsTwoChar(const char *s)
BOOLEAN lRingDependend(lists L)
BOOLEAN newstruct_Op2(int op, leftv res, leftv a1, leftv a2)
BOOLEAN newstruct_Assign_user(int op, leftv l, leftv r)
BOOLEAN newstruct_deserialize(blackbox **, void **d, si_link f)
void newstruct_setup(const char *n, newstruct_desc d)
void lClean_newstruct(lists l)
newstruct_desc newstructChildFromString(const char *parent, const char *s)
void newstruct_destroy(blackbox *, void *d)
char * newstruct_String(blackbox *b, void *d)
static BOOLEAN newstruct_Assign_same(leftv l, leftv r)
static int NeedShadowRing(int t)
BOOLEAN newstruct_Op1(int op, leftv res, leftv arg)
BOOLEAN newstruct_Assign(leftv l, leftv r)
BOOLEAN newstruct_serialize(blackbox *b, void *d, si_link f)
void * newstruct_Copy(blackbox *, void *d)
newstruct_desc newstructFromString(const char *s)
void * newstruct_Init(blackbox *b)
BOOLEAN newstruct_OpM(int op, leftv res, leftv args)
int newstruct_desc_size()
void newstructShow(newstruct_desc d)
lists lCopy_newstruct(lists L)
static newstruct_desc scanNewstructFromString(const char *s, newstruct_desc res)
BOOLEAN newstruct_set_proc(const char *bbname, const char *func, int args, procinfov pr)
BOOLEAN newstruct_CheckAssign(blackbox *, leftv L, leftv R)
void newstruct_Print(blackbox *b, void *d)
#define omFreeSize(addr, size)
#define omFreeBin(addr, bin)
void rChangeCurrRing(ring r)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
void StringSetS(const char *st)
void StringAppendS(const char *st)
void Werror(const char *fmt,...)
BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr)
returns TRUE, if r1 equals r2 FALSE, otherwise Equality is determined componentwise,...
static ring rIncRefCnt(ring r)
static void rDecRefCnt(ring r)