[SCM] an open source computer algebra system branch, cleanedupstream, updated. 6125e540ca6d66c307958938a9d53b245507c323
Bernhard R. Link
brlink at debian.org
Tue Apr 24 15:54:31 UTC 2012
The following commit has been merged in the cleanedupstream branch:
commit ee11ecc703a3e5e733f577f944d4c4b3338cfde4
Author: Hans Schoenemann <hannes at mathematik.uni-kl.de>
Date: Thu Mar 29 16:17:21 2012 +0200
fix: OP2 stuff for newstruct
diff --git a/Singular/newstruct.cc b/Singular/newstruct.cc
index 758d6cf..8d00cfa 100644
--- a/Singular/newstruct.cc
+++ b/Singular/newstruct.cc
@@ -178,96 +178,105 @@ BOOLEAN newstruct_Assign(leftv l, leftv r)
BOOLEAN newstruct_Op2(int op, leftv res, leftv a1, leftv a2)
{
- // interpreter: a1 is newstruct
+ // interpreter: a1 or a2 is newstruct
blackbox *a=getBlackboxStuff(a1->Typ());
newstruct_desc nt=(newstruct_desc)a->data;
lists al=(lists)a1->Data();
- switch(op)
+ if (a!=NULL)
{
- case '.':
+ switch(op)
{
- if (a2->name!=NULL)
+ case '.':
{
- BOOLEAN search_ring=FALSE;
- newstruct_member nm=nt->member;
- while ((nm!=NULL)&&(strcmp(nm->name,a2->name)!=0)) nm=nm->next;
- if ((nm==NULL) && (strncmp(a2->name,"r_",2)==0))
- {
- nm=nt->member;
- while ((nm!=NULL)&&(strcmp(nm->name,a2->name+2)!=0)) nm=nm->next;
- if ((nm!=NULL)&&(RingDependend(nm->typ)))
- search_ring=TRUE;
- else
- nm=NULL;
- }
- if (nm==NULL)
- {
- Werror("member %s nor found", a2->name);
- return TRUE;
- }
- if (search_ring)
+ if (a2->name!=NULL)
{
- ring r;
- res->rtyp=RING_CMD;
- res->data=al->m[nm->pos-1].data;
- r=(ring)res->data;
- if (r==NULL) { res->data=(void *)currRing; r=currRing; }
- if (r!=NULL) r->ref++;
- else Werror("ring of this member is not set and no basering found");
- return r==NULL;
- }
- else if (RingDependend(nm->typ))
- {
- if (al->m[nm->pos].data==NULL)
+ BOOLEAN search_ring=FALSE;
+ newstruct_member nm=nt->member;
+ while ((nm!=NULL)&&(strcmp(nm->name,a2->name)!=0)) nm=nm->next;
+ if ((nm==NULL) && (strncmp(a2->name,"r_",2)==0))
{
- // NULL belongs to any ring
- ring r=(ring)al->m[nm->pos-1].data;
- if (r!=NULL)
- {
- r->ref--;
- al->m[nm->pos-1].data=NULL;
- al->m[nm->pos-1].rtyp=DEF_CMD;
- }
+ nm=nt->member;
+ while ((nm!=NULL)&&(strcmp(nm->name,a2->name+2)!=0)) nm=nm->next;
+ if ((nm!=NULL)&&(RingDependend(nm->typ)))
+ search_ring=TRUE;
+ else
+ nm=NULL;
}
- else
+ if (nm==NULL)
+ {
+ Werror("member %s nor found", a2->name);
+ return TRUE;
+ }
+ if (search_ring)
{
- //Print("checking ring at pos %d for dat at pos %d\n",nm->pos-1,nm->pos);
- if ((al->m[nm->pos-1].data!=(void *)currRing)
- &&(al->m[nm->pos-1].data!=(void*)0L))
+ ring r;
+ res->rtyp=RING_CMD;
+ res->data=al->m[nm->pos-1].data;
+ r=(ring)res->data;
+ if (r==NULL) { res->data=(void *)currRing; r=currRing; }
+ if (r!=NULL) r->ref++;
+ else Werror("ring of this member is not set and no basering found");
+ return r==NULL;
+ }
+ else if (RingDependend(nm->typ))
+ {
+ if (al->m[nm->pos].data==NULL)
+ {
+ // NULL belongs to any ring
+ ring r=(ring)al->m[nm->pos-1].data;
+ if (r!=NULL)
+ {
+ r->ref--;
+ al->m[nm->pos-1].data=NULL;
+ al->m[nm->pos-1].rtyp=DEF_CMD;
+ }
+ }
+ else
{
- Werror("different ring %lx(data) - %lx(basering)",
- (long unsigned)(al->m[nm->pos-1].data),(long unsigned)currRing);
- return TRUE;
+ //Print("checking ring at pos %d for dat at pos %d\n",nm->pos-1,nm->pos);
+ if ((al->m[nm->pos-1].data!=(void *)currRing)
+ &&(al->m[nm->pos-1].data!=(void*)0L))
+ {
+ Werror("different ring %lx(data) - %lx(basering)",
+ (long unsigned)(al->m[nm->pos-1].data),(long unsigned)currRing);
+ return TRUE;
+ }
+ }
+ if ((currRing!=NULL)&&(al->m[nm->pos-1].data==NULL))
+ {
+ // remember the ring, if not already set
+ al->m[nm->pos-1].data=(void *)currRing;
+ al->m[nm->pos-1].rtyp=RING_CMD;
+ currRing->ref++;
}
}
- if ((currRing!=NULL)&&(al->m[nm->pos-1].data==NULL))
+ Subexpr r=(Subexpr)omAlloc0Bin(sSubexpr_bin);
+ r->start = nm->pos+1;
+ memcpy(res,a1,sizeof(sleftv));
+ memset(a1,0,sizeof(sleftv));
+ if (res->e==NULL) res->e=r;
+ else
{
- // remember the ring, if not already set
- al->m[nm->pos-1].data=(void *)currRing;
- al->m[nm->pos-1].rtyp=RING_CMD;
- currRing->ref++;
+ Subexpr sh=res->e;
+ while (sh->next != NULL) sh=sh->next;
+ sh->next=r;
}
+ return FALSE;
}
- Subexpr r=(Subexpr)omAlloc0Bin(sSubexpr_bin);
- r->start = nm->pos+1;
- memcpy(res,a1,sizeof(sleftv));
- memset(a1,0,sizeof(sleftv));
- if (res->e==NULL) res->e=r;
else
{
- Subexpr sh=res->e;
- while (sh->next != NULL) sh=sh->next;
- sh->next=r;
+ WerrorS("name expected");
+ return TRUE;
}
- return FALSE;
- }
- else
- {
- WerrorS("name expected");
- return TRUE;
}
}
}
+ else
+ {
+ a=getBlackboxStuff(a2->Typ());
+ lists al=(lists)a2->Data();
+ nt=(newstruct_desc)a->data;
+ }
newstruct_proc p=nt->procs;
while((p!=NULL) &&(p->t=op)&&(p->args!=2)) p=p->next;
if (p!=NULL)
--
an open source computer algebra system
More information about the debian-science-commits
mailing list