Changeset 83ce22 in git


Ignore:
Timestamp:
May 7, 2014, 7:21:51 PM (10 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
1c23171390ebbd253c562bcc46530bec64aa9145
Parents:
68e012cf1864608713cc7b357c6d18b738dc4cc4
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2014-05-07 19:21:51+02:00
git-committer:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2014-05-07 19:22:55+02:00
Message:
chg: allow generic stuff (with type IDHDL etc) to be used with blackbox stuff
Location:
Singular
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/blackbox.cc

    r68e012 r83ce22  
    6262}
    6363
    64 // Tok2Cmdname -> iiTwoOps
    65 BOOLEAN WrongOp(const char* cmd, int op, leftv bb)
    66 {
    67   assume( bb->Typ() > MAX_TOK ); // it IS a blackbox type, right?!
    68 
    69   if( op > 127 )
    70     Werror("'%s' of type %s(%d) for op %s(%d) not implemented",
    71            cmd,
    72            getBlackboxName(bb->Typ()),bb->Typ(),
    73            iiTwoOps(op), op);
    74   else
    75     Werror("'%s' of type %s(%d) for op '%c' not implemented",
    76            cmd,
    77            getBlackboxName(bb->Typ()), bb->Typ(),
    78            op);
    79 
    80   return TRUE;
    81 }
    82 
    8364BOOLEAN blackboxDefaultOp1(int op,leftv l, leftv r)
    8465{
     
    9778  }
    9879
    99   return WrongOp("blackbox_Op1", op, r);
     80  return TRUE;
    10081}
    10182
    10283BOOLEAN blackboxDefaultOp2(int op,leftv /*l*/, leftv r1, leftv /*r2*/)
    10384{
    104   return WrongOp("blackbox_Op2", op, r1);
     85  return TRUE;
    10586}
    10687
    10788BOOLEAN blackbox_default_Op3(int op,leftv /*l*/, leftv r1,leftv /*r2*/, leftv /*r3*/)
    10889{
    109   return WrongOp("blackbox_Op3", op, r1);
     90  return TRUE;
    11091}
    11192
     
    136117    return FALSE;
    137118  }
    138   return WrongOp("blackbox_OpM", op, args);
     119  return TRUE;
    139120}
    140121
  • Singular/blackbox.h

    r68e012 r83ce22  
    3131  BOOLEAN (*blackbox_Assign)(leftv l, leftv r);
    3232  /// interpreter: unary operations op(r), r(), ...
     33  // convention for blackbox_Op1..blackbox_OpM:
     34  //             return FALSE, if op was successfully performed
     35  //             return TRUE (and an error message) for failure
     36  //             return TRUE (and no error message) if not defined
    3337  BOOLEAN (*blackbox_Op1)(int op,leftv l, leftv r);
    3438  /// interpreter: binary operations: op(r1,r2), r1 op r2,...
     
    7882void printBlackboxTypes();
    7983
    80 /// Emit an "op not implemented" error message and return TRUE
    81 BOOLEAN WrongOp(const char* cmd, int op, leftv bb);
    82 
    8384#endif
  • Singular/iparith.cc

    r68e012 r83ce22  
    78347834    int at=a->Typ();
    78357835    int bt=b->Typ();
     7836    // handling bb-objects ----------------------------------------------------
    78367837    if (at>MAX_TOK)
    78377838    {
    78387839      blackbox *bb=getBlackboxStuff(at);
    7839       if (bb!=NULL) return bb->blackbox_Op2(op,res,a,b);
     7840      if (bb!=NULL)
     7841      {
     7842        if (!bb->blackbox_Op2(op,res,a,b)) return FALSE;
     7843        if (errorreported) return TRUE;
     7844        // else: no op defined
     7845      }
    78407846      else          return TRUE;
    78417847    }
     
    78437849    {
    78447850      blackbox *bb=getBlackboxStuff(bt);
    7845       if (bb!=NULL) return bb->blackbox_Op2(op,res,a,b);
     7851      if (bb!=NULL)
     7852      {
     7853        if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
     7854        if (errorreported) return TRUE;
     7855        // else: no op defined
     7856      }
    78467857      else          return TRUE;
    78477858    }
     
    80078018#endif
    80088019    int at=a->Typ();
     8020    // handling bb-objects ----------------------------------------------------
    80098021    if (at>MAX_TOK)
    80108022    {
    80118023      blackbox *bb=getBlackboxStuff(at);
    8012       if (bb!=NULL) return bb->blackbox_Op1(op,res,a);
     8024      if (bb!=NULL)
     8025      {
     8026        if(!bb->blackbox_Op1(op,res,a)) return FALSE;
     8027        if (errorreported) return TRUE;
     8028        // else: no op defined
     8029      }
    80138030      else          return TRUE;
    80148031    }
     
    81768193#endif
    81778194    int at=a->Typ();
     8195    // handling bb-objects ----------------------------------------------
    81788196    if (at>MAX_TOK)
    81798197    {
    81808198      blackbox *bb=getBlackboxStuff(at);
    8181       if (bb!=NULL) return bb->blackbox_Op3(op,res,a,b,c);
     8199      if (bb!=NULL)
     8200      {
     8201        if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
     8202        if (errorreported) return TRUE;
     8203        // else: no op defined
     8204      }
    81828205      else          return TRUE;
     8206      if (errorreported) return TRUE;
    81838207    }
    81848208    int bt=b->Typ();
     
    83988422    {
    83998423      blackbox *bb=getBlackboxStuff(a->Typ());
    8400       if (bb!=NULL) return bb->blackbox_OpM(op,res,a);
     8424      if (bb!=NULL)
     8425      {
     8426        if(!bb->blackbox_OpM(op,res,a)) return FALSE;
     8427        if (errorreported) return TRUE;
     8428        // else: no op defined
     8429      }
    84018430      else          return TRUE;
    84028431    }
Note: See TracChangeset for help on using the changeset viewer.