Changeset b117e8 in git
- Timestamp:
- Dec 8, 2010, 2:32:40 PM (13 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 295381803a15fde881a84dc11a8d6d1d54928bbe
- Parents:
- 7bb84340b18ebdceb1da60ecdc6f63892358f449
- Location:
- Singular
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/Makefile.in
r7bb8434 rb117e8 173 173 # normal C++ source files 174 174 CXXSOURCES=grammar.cc scanner.cc attrib.cc \ 175 eigenval_ip.cc\175 blackbox.cc eigenval_ip.cc\ 176 176 extra.cc fehelp.cc feOpt.cc \ 177 177 ipassign.cc ipconv.cc ipid.cc iplib.cc \ … … 190 190 Minor.cc \ 191 191 MinorProcessor.cc \ 192 MinorInterface.cc 192 MinorInterface.cc \ 193 bigintm.cc 193 194 194 195 # stuff for MP … … 238 239 mpsr_Put.h walk.h\ 239 240 dbm_sl.h libparse.h pipeLink.h \ 240 gms.h pcv.h eigenval_ip.h \241 gms.h pcv.h eigenval_ip.h blackbox.h \ 241 242 distrib.h walk.h \ 242 243 static.h \ -
Singular/extra.cc
r7bb8434 rb117e8 16 16 #include <kernel/mod2.h> 17 17 #include <misc_ip.h> 18 #include <blackbox.h> 18 19 19 20 #ifdef TIME_WITH_SYS_TIME … … 3668 3669 } 3669 3670 else 3670 3671 3671 #endif 3672 /*==================== listing all blackbox types (debug stuff) =========*/ 3673 if(strcmp(sys_cmd,"blackbox")==0) 3674 { 3675 printBlackboxTypes(); 3676 return FALSE; 3677 } 3678 else 3672 3679 /*==================== Error =================*/ 3673 3680 Werror( "(extended) system(\"%s\",...) %s", sys_cmd, feNotImplemented ); -
Singular/iparith.cc
r7bb8434 rb117e8 69 69 #include <Singular/ipshell.h> 70 70 #include <kernel/mpr_inout.h> 71 #include <Singular/blackbox.h> 71 72 72 73 #ifdef HAVE_FANS … … 3271 3272 } 3272 3273 static BOOLEAN jjINTERSC(leftv res, leftv u, leftv v) 3273 { 3274 { 3274 3275 gfan::ZCone* zc1 = (gfan::ZCone*)u->Data(); 3275 3276 gfan::ZCone* zc2 = (gfan::ZCone*)v->Data(); … … 3477 3478 static BOOLEAN jjINSERTCONE(leftv res, leftv u, leftv v) 3478 3479 { 3479 3480 3481 3482 3480 gfan::ZFan* zf = (gfan::ZFan*)u->Data(); 3481 gfan::ZCone* zc = (gfan::ZCone*)v->Data(); 3482 zf->insert(*zc); 3483 return FALSE; 3483 3484 } 3484 3485 static BOOLEAN jjGETPROPC(leftv res, leftv u, leftv v) … … 5010 5011 static BOOLEAN jjTYPEOF(leftv res, leftv v) 5011 5012 { 5012 switch ((int)(long)v->data) 5013 int t=(int)(long)v->data; 5014 switch (t) 5013 5015 { 5014 5016 case INT_CMD: res->data=omStrDup("int"); break; … … 5037 5039 case DEF_CMD: 5038 5040 case NONE: res->data=omStrDup("none"); break; 5039 default: res->data=omStrDup("?unknown type?"); 5041 default: 5042 { 5043 if (t>MAX_TOK) 5044 res->data=omStrDup(getBlackboxName(t)); 5045 else 5046 res->data=omStrDup("?unknown type?"); 5047 break; 5048 } 5040 5049 } 5041 5050 return FALSE; … … 5116 5125 static gfan::IntMatrix permutationIntMatrix(const intvec* iv) 5117 5126 { 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 int cc = iv->cols(); 5128 int rr = iv->rows(); 5129 intvec* ivCopy = new intvec(rr, cc, 0); 5130 for (int r = 1; r <= rr; r++) 5131 for (int c = 1; c <= cc; c++) 5132 IMATELEM(*ivCopy, r, c) = IMATELEM(*iv, r, c) - 1; 5133 gfan::ZMatrix zm = intmat2ZMatrix(ivCopy); 5134 gfan::IntMatrix* im = new gfan::IntMatrix(gfan::ZToIntMatrix(zm)); 5135 return *im; 5127 5136 } 5128 5137 static BOOLEAN jjFANEMPTY_I(leftv res, leftv v) 5129 5138 { 5130 5131 5132 5133 5134 5135 5136 5137 5139 int ambientDim = (int)(long)v->Data(); 5140 if (ambientDim < 0) 5141 { 5142 Werror("expected non-negative ambient dim but got %d", ambientDim); 5143 return TRUE; 5144 } 5145 res->data = (char*)(new gfan::ZFan(ambientDim)); 5146 return FALSE; 5138 5147 } 5139 5148 static BOOLEAN jjFANEMPTY_IM(leftv res, leftv v) 5140 5149 { 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5150 intvec* permutations = (intvec*)v->Data(); 5151 int ambientDim = permutations->cols(); 5152 gfan::IntMatrix im = permutationIntMatrix(permutations); 5153 if (!gfan::Permutation::arePermutations(im)) 5154 { 5155 Werror("provided intmat contains invalid permutations of {1, ..., %d}", ambientDim); 5156 return TRUE; 5157 } 5158 gfan::SymmetryGroup sg = gfan::SymmetryGroup(ambientDim); 5159 sg.computeClosure(im); 5160 res->data = (char*)(new gfan::ZFan(sg)); 5161 return FALSE; 5153 5162 } 5154 5163 static BOOLEAN jjFANFULL_I(leftv res, leftv v) 5155 5164 { 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 int ambientDim = (int)(long)v->Data(); 5166 if (ambientDim < 0) 5167 { 5168 Werror("expected non-negative ambient dim but got %d", ambientDim); 5169 return TRUE; 5170 } 5171 gfan::ZFan* zf = new gfan::ZFan(gfan::ZFan::fullFan(ambientDim)); 5172 res->data = (char*)zf; 5173 return FALSE; 5165 5174 } 5166 5175 static BOOLEAN jjFANFULL_IM(leftv res, leftv v) 5167 5176 { 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5177 intvec* permutations = (intvec*)v->Data(); 5178 int ambientDim = permutations->cols(); 5179 gfan::IntMatrix im = permutationIntMatrix(permutations); 5180 if (!gfan::Permutation::arePermutations(im)) 5181 { 5182 Werror("provided intmat contains invalid permutations of {1, ..., %d}", ambientDim); 5183 return TRUE; 5184 } 5185 gfan::SymmetryGroup sg = gfan::SymmetryGroup(ambientDim); 5186 sg.computeClosure(im); 5187 gfan::ZFan* zf = new gfan::ZFan(gfan::ZFan::fullFan(sg)); 5188 res->data = (char*)zf; 5189 return FALSE; 5181 5190 } 5182 5191 static BOOLEAN jjCONERAYS1(leftv res, leftv v) … … 5442 5451 case (int)jjDIM_R: dArith1[i].p=(proc1)syDim; break; 5443 5452 case (int)jjidTransp: dArith1[i].p=(proc1)idTransp; break; 5444 #ifdef GENTABLE5445 5453 default: Werror("missing proc1-definition for %d",(int)(long)dArith1[i].p); 5446 #endif5447 5454 } 5448 5455 } … … 8037 8044 #endif 8038 8045 int at=a->Typ(); 8046 if (at>MAX_TOK) 8047 { 8048 blackbox *bb=getBlackboxStuff(at); 8049 if (bb!=NULL) return bb->blackbox_Op2(op,res,a,b); 8050 else return TRUE; 8051 } 8039 8052 int bt=b->Typ(); 8040 8053 int i=iiTabIndex(dArithTab2,JJTAB2LEN,op); … … 8250 8263 #endif 8251 8264 int at=a->Typ(); 8265 if (at>MAX_TOK) 8266 { 8267 blackbox *bb=getBlackboxStuff(at); 8268 if (bb!=NULL) return bb->blackbox_Op1(op,res,a); 8269 else return TRUE; 8270 } 8271 8252 8272 BOOLEAN failed=FALSE; 8253 8254 8273 iiOp=op; 8255 8274 int i=iiTabIndex(dArithTab1,JJTAB1LEN,op); … … 8449 8468 #endif 8450 8469 int at=a->Typ(); 8470 if (at>MAX_TOK) 8471 { 8472 blackbox *bb=getBlackboxStuff(at); 8473 if (bb!=NULL) return bb->blackbox_Op3(op,res,a,b,c); 8474 else return TRUE; 8475 } 8451 8476 int bt=b->Typ(); 8452 8477 int ct=c->Typ(); … … 8699 8724 } 8700 8725 #endif 8726 if ((a!=NULL) && (a->Typ()>MAX_TOK)) 8727 { 8728 blackbox *bb=getBlackboxStuff(a->Typ()); 8729 if (bb!=NULL) return bb->blackbox_OpM(op,res,a); 8730 else return TRUE; 8731 } 8701 8732 BOOLEAN failed=FALSE; 8702 8733 int args=0; … … 8798 8829 else 8799 8830 { 8800 return 0; 8831 // -- blackbox extensions: 8832 // return 0; 8833 return blackboxIsCmd(n,tok); 8801 8834 } 8802 8835 } … … 8905 8938 //if (tok==PRINT_EXPR) return "print_expr"; 8906 8939 if (tok==IDHDL) return "identifier"; 8940 if (tok>MAX_TOK) return getBlackboxName(tok); 8907 8941 for(i=0; i<sArithBase.nCmdUsed; i++) 8908 8942 //while (sArithBase.sCmds[i].tokval!=0) -
Singular/ipassign.cc
r7bb8434 rb117e8 40 40 #include <Singular/ipshell.h> 41 41 #include <kernel/sca.h> 42 #include <Singular/blackbox.h> 42 43 43 44 #ifdef HAVE_FANS … … 766 767 if ((l->rtyp==IDHDL)&&(lt!=QRING_CMD)&&(lt!=RING_CMD)) 767 768 ld=(leftv)l->data; 769 if (lt>MAX_TOK) 770 { 771 blackbox *bb=getBlackboxStuff(lt); 772 Print("bb-assign: bb=%lx\n",bb); 773 return (bb==NULL) || bb->blackbox_Assign(l,r); 774 } 768 775 while (((dAssign[i].res!=lt) 769 776 || (dAssign[i].arg!=rt)) -
Singular/ipid.cc
r7bb8434 rb117e8 29 29 #include <kernel/syz.h> 30 30 #include <Singular/ipid.h> 31 #include <Singular/blackbox.h> 31 32 32 33 #ifdef HAVE_FANS … … 124 125 //printf("define %s, %x, lev: %d, typ: %d\n", s,s,lev,t); 125 126 idhdl h = (idrec *)omAlloc0Bin(idrec_bin); 126 int len = 0;127 127 IDID(h) = s; 128 128 IDTYP(h) = t; … … 156 156 break; 157 157 case STRING_CMD: 158 len=1;158 IDSTRING(h) = (char *)omAlloc0(1); 159 159 break; 160 160 case LIST_CMD: … … 176 176 //the types with the standard init: set the struct to zero 177 177 case RESOLUTION_CMD: 178 len=sizeof(ssyStrategy);178 IDSTRING(h) = (char *)omAlloc0(sizeof(ssyStrategy)); 179 179 break; 180 180 //other types: without init (int,script,poly,def,package) 181 } 182 if (len!=0) 183 { 184 IDSTRING(h) = (char *)omAlloc0(len); 181 case INT_CMD: 182 case DEF_CMD: 183 case POLY_CMD: 184 case VECTOR_CMD: 185 case QRING_CMD: 186 break; 187 default: 188 { 189 if (t>MAX_TOK) 190 { 191 Print("bb-type %d\n",t); 192 blackbox *bb=getBlackboxStuff(t); 193 if (bb!=NULL) 194 IDSTRING(h)=(char *)bb->blackbox_Init(); 195 } 196 else 197 Werror("unknown type %d",t); 198 break; 199 } 185 200 } 186 201 // additional settings:-------------------------------------- … … 475 490 if (IDDATA(h)!=NULL) 476 491 syKillComputation((syStrategy)IDDATA(h),r); 492 } 493 // blackbox ------------------------------------------------------------- 494 else if (IDTYP(h)>MAX_TOK) 495 { 496 blackbox *bb=getBlackboxStuff(IDTYP(h)); 497 if (bb!=NULL) bb->blackbox_destroy(bb,IDDATA(h)); 498 IDDATA(h)=NULL; 477 499 } 478 500 #ifdef HAVE_FANS -
Singular/subexpr.cc
r7bb8434 rb117e8 38 38 #include <Singular/attrib.h> 39 39 #include <Singular/subexpr.h> 40 #include <Singular/blackbox.h> 40 41 41 42 #ifdef HAVE_FANS … … 322 323 break; 323 324 } 324 #ifdef TEST 325 325 326 default: 327 if (t>MAX_TOK) 328 { 329 blackbox * bb=getBlackboxStuff(t); 330 PrintNSpaces(spaces); 331 if (bb!=NULL) { bb->blackbox_Print(bb,d); } 332 else { ::Print("Print: blackbox %d(bb=NULL)",t); } 333 } 334 else 326 335 ::Print("Print:unknown type %s(%d)", Tok2Cmdname(t),t); 327 #endif328 336 } /* end switch: (Typ()) */ 329 337 } … … 437 445 if (r!=NULL) syKillComputation((syStrategy)data,r); 438 446 break; 439 #ifdef TEST440 447 // the following types do not take memory 441 448 // or are not copied … … 459 466 break; 460 467 default: 468 { 469 if (rtyp<=MAX_TOK) 461 470 ::Print("CleanUp: unknown type %d\n",rtyp); /* DEBUG */ 462 #endif 471 else if (data!=NULL) 472 { 473 blackbox *b=getBlackboxStuff(rtyp); 474 if (b!=NULL) b->blackbox_destroy(b,data); 475 data=NULL; 476 } 477 } 463 478 } /* end switch: (rtyp) */ 464 479 //data=NULL; // will be done by Init() at the end … … 592 607 case RESOLUTION_CMD: 593 608 return (void*)syCopy((syStrategy)d); 594 #ifdef TEST595 609 case DEF_CMD: 596 610 case NONE: … … 598 612 //case COMMAND: 599 613 default: 614 { 615 if (t>MAX_TOK) 616 { 617 blackbox *b=getBlackboxStuff(t); 618 if (b!=NULL) return b->blackbox_Copy(b,d); 619 return NULL; 620 } 621 else 600 622 Warn("s_internalCopy: cannot copy type %s(%d)", 601 623 Tok2Cmdname(t),t); 602 #endif 624 } 603 625 } 604 626 return NULL; … … 933 955 case LIST_CMD: 934 956 return lString((lists) d, typed, dim); 957 958 default: 959 if(t> MAX_TOK) 960 { 961 blackbox *bb=getBlackboxStuff(t); 962 if (bb!=NULL) return bb->blackbox_String(bb,d); 963 } 935 964 } /* end switch: (Typ()) */ 936 965 } -
Singular/tesths.cc
r7bb8434 rb117e8 32 32 #include <Singular/slInit.h> 33 33 #include <Singular/ssiLink.h> 34 #include <Singular/bigintm.h> 34 35 35 36 #ifdef HAVE_FACTORY … … 128 129 currPackHdl=h; 129 130 basePackHdl=h; 131 bigintm_setup(); 130 132 } 131 133 #endif
Note: See TracChangeset
for help on using the changeset viewer.