Changeset 83ce22 in git
- Timestamp:
- May 7, 2014, 7:21:51 PM (10 years ago)
- 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
- Location:
- Singular
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/blackbox.cc
r68e012 r83ce22 62 62 } 63 63 64 // Tok2Cmdname -> iiTwoOps65 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 else75 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 83 64 BOOLEAN blackboxDefaultOp1(int op,leftv l, leftv r) 84 65 { … … 97 78 } 98 79 99 return WrongOp("blackbox_Op1", op, r);80 return TRUE; 100 81 } 101 82 102 83 BOOLEAN blackboxDefaultOp2(int op,leftv /*l*/, leftv r1, leftv /*r2*/) 103 84 { 104 return WrongOp("blackbox_Op2", op, r1);85 return TRUE; 105 86 } 106 87 107 88 BOOLEAN blackbox_default_Op3(int op,leftv /*l*/, leftv r1,leftv /*r2*/, leftv /*r3*/) 108 89 { 109 return WrongOp("blackbox_Op3", op, r1);90 return TRUE; 110 91 } 111 92 … … 136 117 return FALSE; 137 118 } 138 return WrongOp("blackbox_OpM", op, args);119 return TRUE; 139 120 } 140 121 -
Singular/blackbox.h
r68e012 r83ce22 31 31 BOOLEAN (*blackbox_Assign)(leftv l, leftv r); 32 32 /// 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 33 37 BOOLEAN (*blackbox_Op1)(int op,leftv l, leftv r); 34 38 /// interpreter: binary operations: op(r1,r2), r1 op r2,... … … 78 82 void printBlackboxTypes(); 79 83 80 /// Emit an "op not implemented" error message and return TRUE81 BOOLEAN WrongOp(const char* cmd, int op, leftv bb);82 83 84 #endif -
Singular/iparith.cc
r68e012 r83ce22 7834 7834 int at=a->Typ(); 7835 7835 int bt=b->Typ(); 7836 // handling bb-objects ---------------------------------------------------- 7836 7837 if (at>MAX_TOK) 7837 7838 { 7838 7839 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 } 7840 7846 else return TRUE; 7841 7847 } … … 7843 7849 { 7844 7850 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 } 7846 7857 else return TRUE; 7847 7858 } … … 8007 8018 #endif 8008 8019 int at=a->Typ(); 8020 // handling bb-objects ---------------------------------------------------- 8009 8021 if (at>MAX_TOK) 8010 8022 { 8011 8023 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 } 8013 8030 else return TRUE; 8014 8031 } … … 8176 8193 #endif 8177 8194 int at=a->Typ(); 8195 // handling bb-objects ---------------------------------------------- 8178 8196 if (at>MAX_TOK) 8179 8197 { 8180 8198 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 } 8182 8205 else return TRUE; 8206 if (errorreported) return TRUE; 8183 8207 } 8184 8208 int bt=b->Typ(); … … 8398 8422 { 8399 8423 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 } 8401 8430 else return TRUE; 8402 8431 }
Note: See TracChangeset
for help on using the changeset viewer.