Changeset 77686d in git


Ignore:
Timestamp:
Sep 23, 2014, 6:18:15 PM (10 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
49d2b5a60475c4c6d2d66343db6babe5c5cc32ca
Parents:
0e8dab27bf2f0f78deb06b2627bb3f13ab41e7c5
Message:
chg: table interface for iiAddCproc: 2/3 args
Location:
Singular
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    r0e8dab r77686d  
    77447744 * then alphabetically */
    77457745
    7746 BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
     7746static BOOLEAN iiExprArith2TabIntern(leftv res, leftv a, int op, leftv b,
     7747                                    BOOLEAN proccall,
     7748                                    struct sValCmd2* dArith2,int i,
     7749                                    int at, int bt,
     7750                                    struct sConvertTypes *dConvertTypes)
    77477751{
    77487752  memset(res,0,sizeof(sleftv));
     
    77517755  if (!errorreported)
    77527756  {
    7753 #ifdef SIQ
    7754     if (siq>0)
    7755     {
    7756       //Print("siq:%d\n",siq);
    7757       command d=(command)omAlloc0Bin(sip_command_bin);
    7758       memcpy(&d->arg1,a,sizeof(sleftv));
    7759       //a->Init();
    7760       memcpy(&d->arg2,b,sizeof(sleftv));
    7761       //b->Init();
    7762       d->argc=2;
    7763       d->op=op;
    7764       res->data=(char *)d;
    7765       res->rtyp=COMMAND;
    7766       return FALSE;
    7767     }
    7768 #endif
    7769     int at=a->Typ();
    7770     int bt=b->Typ();
    7771     // handling bb-objects ----------------------------------------------------
    7772     if (at>MAX_TOK)
    7773     {
    7774       blackbox *bb=getBlackboxStuff(at);
    7775       if (bb!=NULL)
    7776       {
    7777         if (!bb->blackbox_Op2(op,res,a,b)) return FALSE;
    7778         if (errorreported) return TRUE;
    7779         // else: no op defined
    7780       }
    7781       else          return TRUE;
    7782     }
    7783     else if ((bt>MAX_TOK)&&(op!='('))
    7784     {
    7785       blackbox *bb=getBlackboxStuff(bt);
    7786       if (bb!=NULL)
    7787       {
    7788         if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
    7789         if (errorreported) return TRUE;
    7790         // else: no op defined
    7791       }
    7792       else          return TRUE;
    7793     }
    7794     int i=iiTabIndex(dArithTab2,JJTAB2LEN,op);
    77957757    int index=i;
    77967758
     
    79267888  return TRUE;
    79277889}
     7890BOOLEAN iiExprArith2Tab(leftv res, leftv a, int op,
     7891                                    struct sValCmd2* dArith2,int i,
     7892                                    int at,
     7893                                    struct sConvertTypes *dConvertTypes)
     7894{
     7895  leftv b=a->next;
     7896  a->next=NULL;
     7897  int bt=b->Typ();
     7898  BOOLEAN bo=iiExprArith2TabIntern(res,a,op,b,TRUE,dArith2,i,at,bt,dConvertTypes);
     7899  a->next=b;
     7900  a->CleanUp();
     7901  return bo;
     7902}
     7903BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
     7904{
     7905  memset(res,0,sizeof(sleftv));
     7906  BOOLEAN call_failed=FALSE;
     7907
     7908  if (!errorreported)
     7909  {
     7910#ifdef SIQ
     7911    if (siq>0)
     7912    {
     7913      //Print("siq:%d\n",siq);
     7914      command d=(command)omAlloc0Bin(sip_command_bin);
     7915      memcpy(&d->arg1,a,sizeof(sleftv));
     7916      //a->Init();
     7917      memcpy(&d->arg2,b,sizeof(sleftv));
     7918      //b->Init();
     7919      d->argc=2;
     7920      d->op=op;
     7921      res->data=(char *)d;
     7922      res->rtyp=COMMAND;
     7923      return FALSE;
     7924    }
     7925#endif
     7926    int at=a->Typ();
     7927    int bt=b->Typ();
     7928    // handling bb-objects ----------------------------------------------------
     7929    if (at>MAX_TOK)
     7930    {
     7931      blackbox *bb=getBlackboxStuff(at);
     7932      if (bb!=NULL)
     7933      {
     7934        if (!bb->blackbox_Op2(op,res,a,b)) return FALSE;
     7935        if (errorreported) return TRUE;
     7936        // else: no op defined
     7937      }
     7938      else          return TRUE;
     7939    }
     7940    else if ((bt>MAX_TOK)&&(op!='('))
     7941    {
     7942      blackbox *bb=getBlackboxStuff(bt);
     7943      if (bb!=NULL)
     7944      {
     7945        if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
     7946        if (errorreported) return TRUE;
     7947        // else: no op defined
     7948      }
     7949      else          return TRUE;
     7950    }
     7951    int i=iiTabIndex(dArithTab2,JJTAB2LEN,op);
     7952    return iiExprArith2TabIntern(res,a,op,b,proccall,dArith2,i,at,bt,dConvertTypes);
     7953  }
     7954  a->CleanUp();
     7955  b->CleanUp();
     7956  return TRUE;
     7957}
    79287958
    79297959/*==================== operations with 1 arg. ===============================*/
     
    80918121 * then alphabetically */
    80928122
    8093 BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
     8123static BOOLEAN iiExprArith3TabIntern(leftv res, int op, leftv a, leftv b, leftv c,
     8124  struct sValCmd3* dArith3,int i, int at, int bt, int ct,
     8125  struct sConvertTypes *dConvertTypes)
    80948126{
    80958127  memset(res,0,sizeof(sleftv));
     
    80988130  if (!errorreported)
    80998131  {
    8100 #ifdef SIQ
    8101     if (siq>0)
    8102     {
    8103       //Print("siq:%d\n",siq);
    8104       command d=(command)omAlloc0Bin(sip_command_bin);
    8105       memcpy(&d->arg1,a,sizeof(sleftv));
    8106       //a->Init();
    8107       memcpy(&d->arg2,b,sizeof(sleftv));
    8108       //b->Init();
    8109       memcpy(&d->arg3,c,sizeof(sleftv));
    8110       //c->Init();
    8111       d->op=op;
    8112       d->argc=3;
    8113       res->data=(char *)d;
    8114       res->rtyp=COMMAND;
    8115       return FALSE;
    8116     }
    8117 #endif
    8118     int at=a->Typ();
    8119     // handling bb-objects ----------------------------------------------
    8120     if (at>MAX_TOK)
    8121     {
    8122       blackbox *bb=getBlackboxStuff(at);
    8123       if (bb!=NULL)
    8124       {
    8125         if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
    8126         if (errorreported) return TRUE;
    8127         // else: no op defined
    8128       }
    8129       else          return TRUE;
    8130       if (errorreported) return TRUE;
    8131     }
    8132     int bt=b->Typ();
    8133     int ct=c->Typ();
    8134 
    81358132    iiOp=op;
    8136     int i=0;
    8137     while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
     8133    int index=i;
    81388134    while (dArith3[i].cmd==op)
    81398135    {
     
    81698165      leftv cn = (leftv)omAlloc0Bin(sleftv_bin);
    81708166      BOOLEAN failed=FALSE;
    8171       i=0;
     8167      i=index;
    81728168      while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
    81738169      while (dArith3[i].cmd==op)
     
    82458241      else
    82468242      {
    8247         i=0;
     8243        i=index;
    82488244        while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
    82498245        const char *s = iiTwoOps(op);
     
    82768272        //Print("op: %d,result typ:%d\n",op,res->rtyp);
    82778273  return TRUE;
     8274}
     8275BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
     8276{
     8277  memset(res,0,sizeof(sleftv));
     8278  BOOLEAN call_failed=FALSE;
     8279
     8280  if (!errorreported)
     8281  {
     8282#ifdef SIQ
     8283    if (siq>0)
     8284    {
     8285      //Print("siq:%d\n",siq);
     8286      command d=(command)omAlloc0Bin(sip_command_bin);
     8287      memcpy(&d->arg1,a,sizeof(sleftv));
     8288      //a->Init();
     8289      memcpy(&d->arg2,b,sizeof(sleftv));
     8290      //b->Init();
     8291      memcpy(&d->arg3,c,sizeof(sleftv));
     8292      //c->Init();
     8293      d->op=op;
     8294      d->argc=3;
     8295      res->data=(char *)d;
     8296      res->rtyp=COMMAND;
     8297      return FALSE;
     8298    }
     8299#endif
     8300    int at=a->Typ();
     8301    // handling bb-objects ----------------------------------------------
     8302    if (at>MAX_TOK)
     8303    {
     8304      blackbox *bb=getBlackboxStuff(at);
     8305      if (bb!=NULL)
     8306      {
     8307        if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
     8308        if (errorreported) return TRUE;
     8309        // else: no op defined
     8310      }
     8311      else          return TRUE;
     8312      if (errorreported) return TRUE;
     8313    }
     8314    int bt=b->Typ();
     8315    int ct=c->Typ();
     8316
     8317    iiOp=op;
     8318    int i=0;
     8319    while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
     8320    return iiExprArith3TabIntern(res,op,a,b,c,dArith3,i,at,bt,ct,dConvertTypes);
     8321  }
     8322  a->CleanUp();
     8323  b->CleanUp();
     8324  c->CleanUp();
     8325        //Print("op: %d,result typ:%d\n",op,res->rtyp);
     8326  return TRUE;
     8327}
     8328BOOLEAN iiExprArith3Tab(leftv res, leftv a, int op,
     8329                                    struct sValCmd3* dArith3,int i,
     8330                                    int at,
     8331                                    struct sConvertTypes *dConvertTypes)
     8332{
     8333  leftv b=a->next;
     8334  a->next=NULL;
     8335  int bt=b->Typ();
     8336  leftv c=b->next;
     8337  b->next=NULL;
     8338  int ct=c->Typ();
     8339  BOOLEAN bo=iiExprArith3TabIntern(res,op,a,b,c,dArith3,i,at,bt,ct,dConvertTypes);
     8340  b->next=c;
     8341  a->next=b;
     8342  a->CleanUp();
     8343  return bo;
    82788344}
    82798345/*==================== operations with many arg. ===============================*/
  • Singular/ipshell.h

    r0e8dab r77686d  
    255255            struct sValCmd1* dArith1, int i, int at,
    256256            struct sConvertTypes *dConvertTypes);
    257 #endif
    258 
     257BOOLEAN iiExprArith2Tab(leftv res, leftv a, int op,
     258            struct sValCmd2* dArith2,int i, int at,
     259            struct sConvertTypes *dConvertTypes);
     260BOOLEAN iiExprArith3Tab(leftv res, leftv a, int op,
     261            struct sValCmd3* dArith3,int i, int at,
     262            struct sConvertTypes *dConvertTypes);
     263
     264#endif
     265
Note: See TracChangeset for help on using the changeset viewer.