Changeset 8357e21 in git


Ignore:
Timestamp:
Jun 28, 2012, 3:32:59 PM (11 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'ad2543eab51733612ba7d118afc77edca719600e')
Children:
19b0184aff4a5a9ba4c2d12f88c2c9ec66e5552c
Parents:
6dffa9e5b66ac5a81df2b68ff1c38dafc918b1f9
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2012-06-28 15:32:59+02:00
git-committer:
Alexander Dreyer <alexander.dreyer@itwm.fraunhofer.de>2012-09-08 00:20:22+02:00
Message:
fix: #433, type change in newstruct assignments
Location:
Singular
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Singular/blackbox.cc

    r6dffa9 r8357e21  
    6161{
    6262  assume( bb->Typ() > MAX_TOK ); // it IS a blackbox type, right?!
    63  
     63
    6464  if( op > 127 )
    6565    Werror("'%s' of type %s(%d) for op %s(%d) not implemented",
     
    108108}
    109109
    110 BOOLEAN blackbox_default_Check(blackbox *b, void *d)
     110BOOLEAN blackbox_default_Check(blackbox *,leftv,leftv)
    111111{
    112112  return FALSE;
     
    149149    if (bb->blackbox_Op3==NULL)     bb->blackbox_Op3=blackbox_default_Op3;
    150150    if (bb->blackbox_OpM==NULL)     bb->blackbox_OpM=blackbox_default_OpM;
    151     if (bb->blackbox_Check==NULL)   bb->blackbox_Check=blackbox_default_Check;
     151    if (bb->blackbox_CheckAssign==NULL) bb->blackbox_CheckAssign=blackbox_default_Check;
    152152    if (bb->blackbox_serialize==NULL) bb->blackbox_serialize=blackbox_default_serialize;
    153153    if (bb->blackbox_deserialize==NULL) bb->blackbox_deserialize=blackbox_default_deserialize;
  • Singular/blackbox.h

    r6dffa9 r8357e21  
    3939  /// interpreter: operations with undefined number of operands
    4040  BOOLEAN (*blackbox_OpM)(int op,leftv l, leftv r);
    41   /// check internal structure
    42   BOOLEAN (*blackbox_Check)(blackbox *b,void *d);
     41  /// is an assign of r to l (part of b) impossible?
     42  BOOLEAN (*blackbox_CheckAssign)(blackbox *b,leftv l, leftv r);
    4343  /// serialize
    4444  BOOLEAN (*blackbox_serialize)(blackbox *b,void *d, si_link f);
  • Singular/ipassign.cc

    r6dffa9 r8357e21  
    15101510      {
    15111511        bb=getBlackboxStuff(bt);
    1512         like_lists=BB_LIKE_LIST(bb);
     1512        like_lists=BB_LIKE_LIST(bb); // bb like a list
    15131513      }
    15141514      else if (((l->rtyp==IDHDL) && (IDTYP((idhdl)l->data)==LIST_CMD))
    15151515        || (l->rtyp==LIST_CMD))
    15161516      {
    1517         like_lists=2;
     1517        like_lists=2; // bb in a list
    15181518      }
    15191519      if(like_lists)
    15201520      {
    15211521        if (TEST_V_ALLWARN) PrintS("assign list[..]=...or similiar\n");
     1522        if (like_lists==1)
     1523        {
     1524          // check blackbox/newtype type:
     1525          if(bb->blackbox_CheckAssign(bb,l,r)) return TRUE;
     1526        }
    15221527        b=jiAssign_list(l,r);
    15231528        if((!b) && (like_lists==2))
     
    15381543          omFreeBin((ADDRESS)l->e, sSubexpr_bin);
    15391544          l->e=h;
    1540         }
    1541         if ((!b) && (like_lists==1))
    1542         {
    1543           // check blackbox/newtype type:
    1544           if(bb->blackbox_Check(bb,l->Data())) return TRUE;
    15451545        }
    15461546        return b;
  • Singular/newstruct.cc

    r6dffa9 r8357e21  
    3939};
    4040
    41 int newstruct_desc_size() 
     41int newstruct_desc_size()
    4242{
    4343  return sizeof(newstruct_desc_s);
     
    441441  }
    442442  newstruct_proc p=nt->procs;
    443  
     443
    444444  while((p!=NULL) &&( (p->t!=op) || (p->args!=4) )) p=p->next;
    445445
     
    510510}
    511511
    512 BOOLEAN newstruct_Check(blackbox *b, void *d)
     512BOOLEAN newstruct_CheckAssign(blackbox *b, leftv L, leftv R)
     513{
     514  int lt=L->Typ();
     515  int rt=R->Typ();
     516  if ((lt!=DEF_CMD)&&(lt!=rt))
     517  {
     518    Werror("can not assign %s(%d) to member of type %s(%d)",
     519            Tok2Cmdname(rt),rt,
     520            Tok2Cmdname(lt),lt);
     521    return TRUE;
     522  }
     523  return FALSE;
     524}
     525
     526/* check internal structure:
     527* BOOLEAN newstruct_Check(blackbox *b, void *d)
    513528{
    514529  newstruct_desc n=(newstruct_desc)b->data;
     
    529544  return FALSE;
    530545}
     546*/
    531547
    532548BOOLEAN newstruct_serialize(blackbox *b, void *d, si_link f)
     
    598614  //b->blackbox_Op3=blackbox_default_Op3;
    599615  b->blackbox_OpM=newstruct_OpM;
    600   b->blackbox_Check=newstruct_Check;
     616  b->blackbox_CheckAssign=newstruct_CheckAssign;
    601617  b->blackbox_serialize=newstruct_serialize;
    602618  b->blackbox_deserialize=newstruct_deserialize;
Note: See TracChangeset for help on using the changeset viewer.