Changeset 0a64d50 in git


Ignore:
Timestamp:
Jun 18, 2012, 10:21:31 PM (11 years ago)
Author:
Alexander Dreyer <alexander.dreyer@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '2234726c50d679d6664181a5c72f75a6fd64a787')
Children:
33337c143d6dc39838d00eaa1ff98d10aab9f874
Parents:
2262abc0b0f7509cc606cb82563a0117962af611
git-author:
Alexander Dreyer <alexander.dreyer@itwm.fraunhofer.de>2012-06-18 22:21:31+02:00
git-committer:
Alexander Dreyer <alexander.dreyer@itwm.fraunhofer.de>2012-08-01 22:47:27+02:00
Message:
Enhancement: unary custom operation for newstruct
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/newstruct.cc

    r2262ab r0a64d50  
    176176  return TRUE;
    177177}
     178
     179BOOLEAN newstruct_Op1(int op, leftv res, leftv arg)
     180{
     181  // interpreter: arg is newstruct
     182  blackbox *a=getBlackboxStuff(arg->Typ());
     183  newstruct_desc nt=(newstruct_desc)a->data;
     184  newstruct_proc p=nt->procs;
     185
     186  while((p!=NULL) &&( (p->t!=op) || (p->args!=1) )) p=p->next;
     187
     188  if (p!=NULL)
     189  {
     190    leftv sl;
     191    sleftv tmp;
     192    memset(&tmp,0,sizeof(sleftv));
     193    tmp.Copy(arg);
     194    idrec hh;
     195    memset(&hh,0,sizeof(hh));
     196    hh.id=Tok2Cmdname(p->t);
     197    hh.typ=PROC_CMD;
     198    hh.data.pinf=p->p;
     199    sl=iiMake_proc(&hh,NULL,&tmp);
     200    if (sl==NULL) return TRUE;
     201    else
     202    {
     203      res->Copy(sl);
     204      return FALSE;
     205    }
     206  }
     207  return blackboxDefaultOp1(op,res,arg);
     208}
     209
     210
    178211
    179212BOOLEAN newstruct_Op2(int op, leftv res, leftv a1, leftv a2)
     
    476509  b->blackbox_Copy=newstruct_Copy;
    477510  b->blackbox_Assign=newstruct_Assign;
    478   //b->blackbox_Op1=blackboxDefaultOp1;
     511  b->blackbox_Op1=newstruct_Op1;
    479512  b->blackbox_Op2=newstruct_Op2;
    480513  //b->blackbox_Op3=blackbox_default_Op3;
Note: See TracChangeset for help on using the changeset viewer.