Changeset 2bf04b in git
- Timestamp:
- Nov 12, 2015, 2:39:46 PM (7 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 6da2d6765f8866f8426131bf3a097a5c051e956e
- Parents:
- 412c61b77c65fd4adca8f6576d7f1a597459552e
- Files:
-
- 59 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/gradedModules.lib
r412c61 r2bf04b 1655 1655 { // no middle part 1656 1656 if(a[1]>0) 1657 1658 1659 1660 1661 1662 1657 { 1658 N=grtwist(a[1],0); 1659 1660 if(a[n+1]>0) 1661 { N=grsum(N,grtwist(a[n+1],-1));} 1662 } 1663 1663 else 1664 1664 { N=grtwist(a[n+1],-1);} 1665 1665 1666 1666 return (N); // grorder(N)); … … 1678 1678 1679 1679 for(; i <= n; i++) 1680 1681 1682 1683 1684 1680 { 1681 if(a[i]==0) { i++; continue; } 1682 j = i - 1; 1683 S = grsum( S, grpower(grshift( grobj( kos[j+2], attrib(kos[j+2], "isHomog")), j), a[i]) ); 1684 } 1685 1685 1686 1686 // S is the middle (non-zero) part 1687 1687 1688 1688 if(a[1] > 0 ) 1689 1690 1691 1689 { 1690 N=grsum(grtwist(a[1],0), S); 1691 } 1692 1692 else 1693 1693 { N = S;} 1694 1694 1695 1695 if(a[n+1] > 0 ) 1696 1696 { N=grsum(N, grtwist(a[n+1],-1)); } 1697 1697 1698 1698 … … 2461 2461 { // no middle part 2462 2462 if(a[1]>0) 2463 2464 2465 2466 2467 2468 2463 { 2464 N=grtwist(a[1],-1); 2465 2466 if(a[n+1]>0) 2467 { N=grsum(N,grtwist(a[n+1],0));} 2468 } 2469 2469 else 2470 2470 { N=grtwist(a[n+1],0);} 2471 2471 2472 2472 return (N); // grorder(N)); … … 2486 2486 2487 2487 for(; i <= n; i++) 2488 2489 2488 { 2489 if(a[i]==0) { i++; continue; } 2490 2490 int j=size(a)-i; 2491 2492 2491 S = grsum( S, grpower(grshift( grobj( kos[j+2], attrib(kos[j+2], "isHomog")), j), a[i]) ); 2492 } 2493 2493 2494 2494 // S is the middle (non-zero) part 2495 2495 2496 2496 if(a[1] > 0 ) 2497 2498 2499 2497 { 2498 N=grsum(grtwist(a[1],-1), S); 2499 } 2500 2500 else 2501 2501 { N = S;} 2502 2502 2503 2503 if(a[n+1] > 0 ) 2504 2504 { N=grsum(N, grtwist(a[n+1],0)); } 2505 2505 2506 2506 -
Singular/LIB/hdepth.lib
r412c61 r2bf04b 23 23 { 24 24 if(bound<=1) 25 26 27 25 { 26 ERROR("My inverse : negative bound in the inverse"); 27 } 28 28 if(p == 0) 29 30 31 32 29 { 30 ERROR("My inverse : p is 0"); 31 } 32 poly original; 33 33 original = p; 34 34 if(leadcoef(p) == 0) 35 36 37 35 { 36 ERROR("My inverse : the power series is not a unit."); 37 } 38 38 poly q = 1/p[1]; 39 39 poly res = q; … … 42 42 while(p != 0) 43 43 { 44 45 44 res = res + q * p; 45 p = jet(p*s,bound); 46 46 } 47 47 //TEST 48 48 if(jet(original*res,bound) != poly(1)) 49 50 51 49 { 50 ERROR("Myinverse does not work properly."); 51 } 52 52 return(res); 53 53 } … … 60 60 " 61 61 { 62 63 64 65 66 67 68 62 poly f; 63 int i; 64 for(i=0;i<size(v)-1;i++) 65 { 66 f=f+v[i+1]*t^i; 67 } 68 return(f); 69 69 } 70 70 /////////////////////////////////////////////////////////////////////////////////// … … 74 74 " 75 75 { 76 77 78 79 80 81 82 83 84 85 76 int pos=1; 77 while( (f!=0) && (pos==1) ) 78 { 79 if(leadcoef(f)<0) 80 { 81 pos=0; 82 } 83 f=f-lead(f); 84 } 85 return(pos); 86 86 } 87 87 /////////////////////////////////////////////////////////////////////////////////// … … 91 91 " 92 92 { 93 94 95 96 97 98 99 93 number c; 94 while(f!=0) 95 { 96 c = c+leadcoef(f); 97 f=f-lead(f); 98 } 99 return(int(c)); 100 100 } 101 101 /////////////////////////////////////////////////////////////////////////////////// … … 105 105 " 106 106 { 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 107 int dd = d; 108 if(debug == 0) 109 {"G(t)=",g;} 110 if(positiv(g)==1) 111 { 112 if(debug == 0) 113 {return("hdepth =",dd);} 114 else 115 {return(dd);} 116 } 117 poly f=g; 118 number ag; 119 int c1; 120 int bound; 121 bound = deg(g); 122 while(dd >= 0) 123 { 124 dd = dd-1; 125 f = jet( g*myinverse( (1-t)^(d-dd),2*bound ) , bound ); 126 if(positiv(f) == 1) 127 { 128 if(debug == 0) 129 { 130 "G(t)/(1-t)^",d-dd,"=",f,"+..."; 131 return("hdepth =",dd); 132 } 133 else 134 {return(d);} 135 } 136 136 c1=sumcoef(f); 137 if(c1<0) 138 { 139 while(c1<0) 140 { 141 bound=bound+1; 142 f=jet( g*myinverse( (1-t)^(d-dd),2*bound ) , bound ); 143 c1=sumcoef(f); 144 } 145 } 146 if(debug == 0) 147 {"G(t)/(1-t)^",d-dd,"=",f,"+...";} 137 if(c1<0) 138 { 139 while(c1<0) 140 { 141 bound=bound+1; 142 f=jet( g*myinverse( (1-t)^(d-dd),2*bound ) , bound ); 143 c1=sumcoef(f); 144 } 148 145 } 149 ERROR("g was not a Hilbert Series since the coefficient sum is not > 0"); 146 if(debug == 0) 147 {"G(t)/(1-t)^",d-dd,"=",f,"+...";} 148 } 149 ERROR("g was not a Hilbert Series since the coefficient sum is not > 0"); 150 150 } 151 152 151 example 153 152 { … … 167 166 " 168 167 { 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 168 int debug; 169 if(size(#)>0) 170 { 171 if(typeof(#[1])=="int") 172 {debug = #[1];} 173 } 174 else 175 {debug = 1;} 176 M = std(M); 177 int d=nvars(basering)-dim(M); 178 intvec v=hilb(M,2); 179 ring R = 0,t,ds; 180 poly hp=hilbconstruct(v); 181 if(debug == 0) 182 {"dim =",d;} 183 return(hdepth_p(hp,d,debug)); 185 184 } 186 185 example -
Singular/LIB/inout.lib
r412c61 r2bf04b 487 487 @@s = tab(@li@)+"// ring:"; @@s,s; 488 488 @@s = tab(@li@)+"// minpoly ="; @@s,minpoly; 489 490 489 if (size(ideal(@id@))>0) 490 { 491 491 @@s = tab(@li@)+"// quotient ring from ideal:"; @@s;ideal(@id@); 492 492 } 493 493 kill @id@; 494 494 "// objects belonging to this ring:"; -
Singular/LIB/mathml.lib
r412c61 r2bf04b 29 29 30 30 /********************************************************* 31 ** 32 ** TOOLs**33 ** 31 ** ** 32 ** TOOLs ** 33 ** ** 34 34 *********************************************************/ 35 35 36 36 static proc mathmlStringReplace(string s,string dummy,string origin)"USAGE: texStringReplace(s); where s is a string 37 37 ASSUME: s is a string 38 RETURN: 38 RETURN: s including origin instead of dummy 39 39 THEORY: if s contains dummy, these parts will be replaced by origin 40 40 "{ 41 42 43 44 45 46 47 if(k+L<=size(S)){ 48 49 50 51 41 int k,L; 42 string S; 43 S = s; 44 while(find(S,dummy)>0){ 45 k = find(S,dummy); 46 L = size(dummy); 47 if(k+L<=size(S)){ 48 S = S[1,k-1] + origin + S[k+L..size(S)]; 49 } 50 else{S = S[1,k-1] + origin;} 51 } 52 52 53 53 return(S); … … 56 56 57 57 proc mathmlRingType(){ 58 string S= charstr(basering);59 int i= find(S,",");58 string S = charstr(basering); 59 int i = find(S,","); 60 60 int n; 61 62 63 61 if(i>0){S = S[1,i-1];} 62 if(S=="real" || S =="complex"){return(0)} 63 else{ if (npars(basering)>0) { 64 64 n=ringlist(basering)[1][1]; 65 65 if (n!=0 && prime(n)!=n) {return(2);} … … 71 71 72 72 /********************************************************* 73 ** 74 ** POLY**75 ** 73 ** ** 74 ** POLY ** 75 ** ** 76 76 *********************************************************/ 77 77 … … 85 85 while (i<size(s)) { 86 86 if (s[i]=="/") {u=1; 87 i=size(s);} 87 i=size(s);} 88 88 i=i+1; 89 89 } … … 95 95 t=t+"<mfrac> <mn>"; 96 96 while (i<=size(s)) { 97 if (s[i]=="/") {t=t+"</mn> <mn>";} 97 if (s[i]=="/") {t=t+"</mn> <mn>";} 98 98 else {t=t+s[i];} 99 99 i=i+1; … … 105 105 t=t+"<mn>"+s+"</mn>";} 106 106 return(t); 107 } 107 } 108 108 109 109 proc mathmlVariablesEncoding(string s) { … … 111 111 int p; 112 112 if(s[size(s)]==")"){ 113 114 115 116 else{ 117 if (size(s)>1) { 113 p = find(s,"("); 114 S = S + "<msub><mi>"+s[1,p-1] + "</mi><mn>" + s[p+1,size(s)-p-1]+ "</mn></msub>"; 115 } 116 else{ 117 if (size(s)>1) { 118 118 S = S + "<msub><mi>"+s[1] + "</mi><mn>" + s[2,size(s)-1]+ "</mn></msub>";} 119 119 else {S="<mi>"+s+"</mi>";} … … 136 136 g=g+"</mn></msup>"; 137 137 k=k+1;} 138 } 138 } 139 139 return(g); 140 140 } … … 186 186 187 187 proc mathmlPolyGAL(poly p){ 188 189 190 188 string S; 189 for(int i = 1;i<size(p);i++){ 190 S = S + mathmlTermGAL(p[i]); 191 191 if (string(leadcoef(p[i+1]))!="-1") {S=S+"<mo>+</mo>";} 192 193 192 } 193 S = S+ mathmlTermGAL(p[i]); 194 194 return(S); 195 195 } 196 196 197 197 proc mathmlTermGAL(poly p){ 198 199 int B = 0; 200 201 202 203 204 198 int b = 0; 199 int B = 0; 200 string S,S1,C,Pname; 201 Pname = ringlist(basering)[1][2][1]; 202 C = string(leadcoef(p)); 203 204 C = mathmlStringReplace(C,Pname,""); 205 205 C = mathmlStringReplace(C,"^",""); 206 206 if (p==-1 || p==1 || p==0) {return("<mn>"+string(p)+"</mn>");} 207 207 else { 208 208 if (C=="-1") {S=S+"<mo>-</mo>";} 209 else { 209 else { 210 210 if (C!="1") {S =S+ "<msup><mi>"+Pname+"</mi><mn>"+C +"</mi></msup>";} 211 211 } … … 220 220 proc mathmlPolyR(poly a) { 221 221 string S; 222 222 223 223 def origin = basering; 224 224 225 225 if(npars(origin) == 0){ 226 list l= ringlist(basering);227 l[1][3]= "parTMP";228 def ringCOMPLEX= ring(l);229 230 231 226 list l = ringlist(basering); 227 l[1][3] = "parTMP"; 228 def ringCOMPLEX = ring(l); 229 setring ringCOMPLEX; 230 poly a = fetch(origin,a); 231 } 232 232 string S1; 233 233 string S2; … … 243 243 S1=mathmlMonomial(leadmonom(d)); 244 244 if (leadcoef(d)==1) { 245 if (S1=="") {S=S+"<mn>1</mn>";} 245 if (S1=="") {S=S+"<mn>1</mn>";} 246 246 } 247 247 else { … … 269 269 int n=npars(basering); 270 270 271 if (n>0) { 271 if (n>0) { 272 272 if (SignumLeadcoef(numerator(d))) { 273 273 g=g+"<mo>-</mo>"; … … 297 297 else {if (SignumLeadcoef(numerator(leadcoef(a)))==0) {g=g+"<mo>+</mo>";}} 298 298 g=g+mathmlPolyN(a,r); 299 } 299 } 300 300 return(g); 301 301 } … … 317 317 { "EXAMPLE:"; echo=2; 318 318 string h; 319 320 321 319 ring r = (0,a),(x1,x2),dp; 320 h=h+mathmlPoly(x1+a2)+"<br>"; 321 h=h+mathmlPoly(x1*x2^3)+"<br>"; 322 322 ring r=(0,a,b),(x(1..2)),lp; 323 323 poly z=(3*a^2-12*b)*x(1)^2*x(2)+(3*a^3-1)*x(2)+x(1)^2-3/5*x(1)+1; … … 356 356 357 357 /********************************************************* 358 ** 359 ** ring**360 ** 358 ** ** 359 ** ring ** 360 ** ** 361 361 *********************************************************/ 362 362 … … 365 365 ASSUME: r is a ring 366 366 RETURN: lateX-code for the ring r 367 THEORY: 367 THEORY: 368 368 KEYWORDS: ring, lateX, teX, tex, latex 369 369 EXAMPLE: example texRing; shows an example 370 370 " 371 371 { setring r; 372 373 l= ringlist(r);372 list l,l1,l2; 373 l = ringlist(r); 374 374 l2 = ringlist(r)[2]; 375 375 376 377 378 379 380 376 string c,p,P,V,C,S,h; 377 378 int i,b; 379 int bchar; 380 381 381 382 382 list l3=l; … … 386 386 list l=fetch(r,l); 387 387 setring r; 388 389 390 391 c = charstr(r); 392 393 394 c= c[1,find(c,",")-1];395 396 if(typeof(l[1][2][1]) != "string" && b==0&& c =="integer"){bchar= 1;b = 1;} 397 398 399 else {bchar=3;} 400 } 401 } 402 403 404 405 406 407 408 409 410 411 if(p != "0"){P=P+"[";} 412 413 414 415 416 417 388 389 390 //characteristic 391 c = charstr(r); 392 bchar = 0; 393 if(find(c,",") != 0){ 394 c = c[1,find(c,",")-1]; 395 b = 0; 396 if(typeof(l[1][2][1]) != "string" && b==0&& c =="integer"){bchar= 1;b = 1;} 397 if(typeof(l[1][2][1]) != "string" && b==0){bchar = 2;b=1;} 398 if(b==0){ if (mathmlRingType()==2) {bchar = 4;} 399 else {bchar=3;} 400 } 401 } 402 403 //minimalpolynom 404 p = string(minpoly); 405 406 407 408 409 //parameters 410 if(bchar==3){ 411 if(p != "0"){P=P+"[";} 412 else{P=P+"(";} 413 for(i=1;i<size(l[1][2]);i++){ 414 P = P + mathmlVariablesEncoding(string(l[1][2][i])) +","; 415 } 416 P=P+mathmlVariablesEncoding(string(l[1][2][size(l[1][2])])); 417 if(p != "0"){ 418 418 l3[1][4]=ideal(0); 419 419 w=ring(l3); … … 428 428 setring(r); 429 429 } 430 431 432 433 434 435 436 437 V = V + mathmlVariablesEncoding((string(l2[i]))) + ","; 438 439 440 441 442 443 444 if(bchar==1){//Z/(p^k)445 446 447 448 449 450 451 else{C = C + "<mn>ℤ</mn>";b=1;}//Z452 453 if(c == "0" && b == 0){C = C + "<mn>ℚ</mn>";b=1;}//Q454 if(c == "real" && b == 0){C = C + "<mn>ℝ</mn>";b=1;}//R455 456 457 458 if(l[1][3]!="i"){C = C + "<mn>ℝ</mn>("+l[1][3]+")";}//R(j)459 460 461 else{C = C + "<mn>ℂ</mn";}//C462 463 430 else{P=P+")";} 431 } 432 433 434 //variables 435 V = V + "["; 436 for(i = 1;i<size(l2);i++){ 437 V = V + mathmlVariablesEncoding((string(l2[i]))) + ","; 438 } 439 V = V + mathmlVariablesEncoding((string(l2[size(l2)]))); 440 V = V + "]"; 441 442 b = 0; 443 if(c == "integer" && b == 0){ 444 if(bchar==1){ //Z/(p^k) 445 if(string(l[1][2][2])!="1"){ 446 C=C+"<msub><mrow><mn>ℤ</mn></mrow><mrow><msup><mrow>"+string(l[1][2][1])+"</mrow><mrow>"+string(l[1][2][2])+"<mrow></msup></mrow></msub>"; 447 } 448 else{C=C+"<msub><mn>ℤ</mn>"+"<mn>"+string(l[1][2][1])+"</mn></msub>";} 449 b = 1; 450 } 451 else{C = C + "<mn>ℤ</mn>";b=1;} //Z 452 } 453 if(c == "0" && b == 0){C = C + "<mn>ℚ</mn>";b=1;} //Q 454 if(c == "real" && b == 0){C = C + "<mn>ℝ</mn>";b=1;} //R 455 if(c == "complex" && b == 0){ 456 b=1; 457 if(typeof(l[1][3]) != "none"){ 458 if(l[1][3]!="i"){C = C + "<mn>ℝ</mn>("+l[1][3]+")";} //R(j) 459 else{C = C + "<mn>ℂ</mn>";} 460 } 461 else{C = C + "<mn>ℂ</mn";} //C 462 } 463 if(b == 0){ if (bchar==4) {C = C + "<msub><mn>F</mn>"+c+"</msub>";} //F/p 464 464 else {C = C + "<msub><mn>ℤ</mn>"+c+"</msub>";b=1;} //Z/p 465 466 467 468 469 470 471 if (l[4]!=0) { 465 466 } 467 //epic conclusion 468 if(size(P)!=0){S = S + C+P+V;} 469 else{S=S+C+V;} 470 471 if (l[4]!=0) { 472 472 setring w; 473 473 474 474 S=S+"<mo>/</mo><mo>(</mo>"; 475 475 for(int k=1;k<=size(l[4]);k++) { … … 480 480 S=S[1,size(S)-10]+"<mo>)</mo>"; 481 481 } 482 483 482 483 S = "<math xmlns=http://www.w3.org/1998/Math/MathML>" + S + "</math>"; 484 484 return(S); 485 485 } … … 489 489 { "EXAMPLE:"; echo=2; 490 490 string h; 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 491 ring r = 32003,(x,y,z),dp; 492 h=h+mathmlRing(r)+"<br>"; 493 ring r = 32003,(x(1..10)),dp; 494 h=h+mathmlRing(r)+"<br>"; 495 ring r = 0,(a,b,c,d),lp; 496 h=h+mathmlRing(r)+"<br>"; 497 ring r =7,(x,y,z),ds; 498 h=h+mathmlRing(r)+"<br>"; 499 ring r = 7,(x(1..6)),(lp(3),dp); 500 h=h+mathmlRing(r)+"<br>"; 501 ring r =0,(x,y,z),(c,wp(2,1,3)); 502 h=h+mathmlRing(r)+"<br>"; 503 ring r =(7,a,b,c),(x,y,z),Dp; 504 h=h+mathmlRing(r)+"<br>"; 505 ring r =(7,a),(x,y,z),dp; minpoly = a^2+a+3; 506 h=h+mathmlRing(r)+"<br>"; 507 ring r =real,(x,y,z),dp; 508 h=h+mathmlRing(r)+"<br>"; 509 509 ring r =(real,50),(x,y,z),dp; 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 510 h=h+mathmlRing(r)+"<br>"; 511 ring r =(real,10,50),(x,y,z),dp; 512 h=h+mathmlRing(r)+"<br>"; 513 ring r = (complex,30,j),(x,y,z),dp; 514 h=h+mathmlRing(r)+"<br>"; 515 ring r =complex,(x,y,z),dp; 516 h=h+mathmlRing(r)+"<br>"; 517 ring r =7,(x,y,z), dp; 518 h=h+mathmlRing(r)+"<br>"; 519 ring r =integer,(x,y,z), dp; 520 h=h+mathmlRing(r)+"<br>"; 521 ring r =(integer, 6, 3),(x,y,z), dp; 522 h=h+mathmlRing(r)+"<br>"; 523 ring r =(integer, 100),(x,y,z), dp; 524 h=h+mathmlRing(r)+"<br>"; 525 525 ring r=(121,a),x,lp; 526 526 h=h+mathmlRing(r); … … 531 531 532 532 /********************************************************* 533 ** 534 ** map**535 ** 533 ** ** 534 ** map ** 535 ** ** 536 536 *********************************************************/ 537 537 … … 540 540 ASSUME: f is a map, #[1] ring or empty 541 541 RETURN: lateX-code for the map f 542 THEORY: 542 THEORY: 543 543 KEYWORDS: map, lateX, teX, tex, latex 544 544 EXAMPLE: example texMap; shows an example 545 545 " 546 { 547 548 549 546 { 547 548 // f: s--->r (rings) || f:s1--->s2 (string) 549 string s1,s2; 550 550 string h1,h2; 551 string T,S; //variables, output string 552 553 554 555 556 557 558 559 560 561 defs;562 563 564 s1= mathmlRing(s);565 s1 = s1[48,size(s1)-54]; 566 list l1; 567 568 569 570 571 572 551 string T,S; //variables, output string 552 s2 = mathmlRing(basering); 553 s2 = s2[48,size(s2)-54]; 554 int B = 0; 555 int b = 0; 556 if(nameof(basering)==nameof(preimage(f))){b=1;} 557 558 def r = basering; 559 if(size(#)!=0){ 560 if(typeof(#[1]) != "ring"){return("ERROR - wrong input. check texMap documentation." );} 561 def s; 562 s = #[1]; 563 setring s; 564 s1 = mathmlRing(s); 565 s1 = s1[48,size(s1)-54]; 566 list l1; 567 for(int k=1;k<=nvars(s);k++){ 568 l1[k] = mathmlVariablesEncoding(string(var(k))); 569 } 570 571 setring r; 572 for(int i = 1;i<=nvars(s);i++){ 573 573 h1=mathmlPoly(f[i]); 574 574 h2=h1[48,size(h1)-54]; 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 575 T =T+ "<mtr><mtd>"+l1[i]+"</mtd><mtd>"+"<mo>↦</mo>"+"</mtd><mtd>"+h2+"</mtd></mtr>"; 576 } 577 } 578 else{ 579 if(b==1){ 580 mathmlMap(f,basering); 581 return(); 582 } 583 else{ 584 s1 = "'"+nameof(preimage(f))+"'"; 585 print("For detailed information we need the source"); 586 B = 1; 587 } 588 589 } 590 S = "<mtr><mtd>"+s1+"</mtd><mtd>" + "<mo>→</mo>" +"</mtd><mtd>"+ s2+"</mtd></mtr>"+T; 591 S = "<math xmlns=http://www.w3.org/1998/Math/MathML><mtable>" + S + "</mtable></math>"; 592 593 return(S); 594 594 } 595 595 example 596 596 { "EXAMPLE:"; echo=2; 597 597 string h; 598 ring U= 0,(x,y,z),lp;599 600 601 map f= U,z(1)*z(2)^3,z(1),-z(2);602 603 604 605 606 607 608 598 ring U = 0,(x,y,z),lp; 599 ring M2 = real,(z(1..3)),lp; 600 setring M2; 601 map f = U,z(1)*z(2)^3,z(1),-z(2); 602 h=h+mathmlMap(f)+"<br>"; 603 //2nd 604 h=h+mathmlMap(f,U)+"<br>"; 605 //3rd 606 ring R = real,(x,y,z),lp; 607 map f2 = R,x2,y2,z-x; 608 h=h+string(mathmlMap(f2)); 609 609 viewMathml(h);} 610 610 … … 617 617 618 618 /********************************************************* 619 ** 620 ** IDEAL**621 ** 619 ** ** 620 ** IDEAL ** 621 ** ** 622 622 *********************************************************/ 623 623 proc mathmlIdeal(ideal I)"USAGE: texIdeal(I), where I is an ideal 624 624 ASSUME: I is an ideal 625 625 RETURN: lateX-code for the ideal I 626 THEORY: 626 THEORY: 627 627 KEYWORDS: ideal, lateX, teX, tex, latex 628 628 EXAMPLE: example texIdeal; shows an example 629 629 "{ 630 631 632 633 634 635 636 630 string S = ""; 631 for(int i = 1;i<size(I);i++){ 632 S = S + mathmlPoly(I[i],"no$") + ","; 633 } 634 S = S + mathmlPoly(I[size(I)],"no$"); 635 S = "<math xmlns=http://www.w3.org/1998/Math/MathML><mo>⟨</mo>" + S + "<mo>⟩</mo></math>"; 636 return(S); 637 637 } 638 638 example 639 639 {"EXAMPLE: "; echo=2; 640 641 642 643 } 644 645 646 647 /********************************************************* 648 ** 649 ** LIST**650 ** 640 ring r = 0,(x,y,z),dp; 641 ideal I = x2,y3,z; 642 viewMathml(mathmlIdeal(I)); 643 } 644 645 646 647 /********************************************************* 648 ** ** 649 ** LIST ** 650 ** ** 651 651 *********************************************************/ 652 652 proc mathmlList(list l)"USAGE: texList(l), where l is a list 653 653 ASSUME: l is a list 654 654 RETURN: lateX-code for the list l 655 THEORY: 655 THEORY: 656 656 KEYWORDS: list, lateX, teX, tex, latex 657 657 EXAMPLE: example texList; shows an example 658 658 "{ 659 660 661 662 tmp = mathml(l[i]); 663 664 665 S = S + tmp + ";"; 666 667 //tmp = tex(l[size(l)]); 668 669 670 671 S = S + tmp; 672 673 659 string tmp; 660 string S = ""; 661 for(int i=1;i<size(l);i++){ 662 tmp = mathml(l[i]); 663 tmp = tmp[48,size(tmp)-54]; 664 //S = S + tex(l[i]) + ";"; 665 S = S + tmp + ";"; 666 } 667 //tmp = tex(l[size(l)]); 668 tmp = mathml(l[size(l)]); 669 tmp = tmp[48,size(tmp)-54]; 670 //S = S + tex(l[size(l)]); 671 S = S + tmp; 672 S = "<math xmlns=http://www.w3.org/1998/Math/MathML><mo>{</mo>" + S + "<mo>}</mo></math>";; 673 return(S); 674 674 } 675 675 example 676 676 {"EXAMPLE:"; echo=2; 677 677 string h; 678 //int 679 680 681 682 //ring 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 678 //int 679 ring r = integer,(x,y,z),dp; 680 list l = 1,2,3; 681 h=h+mathmlList(l)+"<br>"; 682 //ring 683 ring r2 = real,(a,b,c),dp; 684 ring r3 = complex,(x(1..3)),dp; 685 list l2 = r,r2,r3; 686 h=h+mathmlList(l2)+"<br>"; 687 //matrix 688 setring r; 689 matrix m1[2][2]=x2y,-xz3,0,17x3z2; 690 matrix m2[2][2]=1,2,3,4; 691 list l3 = m1,m2; 692 h=h+mathmlList(l3); 693 //poly 694 poly p = x2-1; 695 poly p2 = x3-y+z; 696 poly p3 = y3-z7; 697 list l4 = p,p2,p3; 698 //mathmlList(l4); 699 699 viewMathml(h); 700 700 } … … 703 703 704 704 /********************************************************* 705 ** 706 ** BIGINT,INT**707 ** 705 ** ** 706 ** BIGINT,INT ** 707 ** ** 708 708 *********************************************************/ 709 709 proc mathmlBigInt (bigint I){ 710 710 return("<math xmlns=http://www.w3.org/1998/Math/MathML>"+string(I)+"</math>"); 711 711 } 712 712 713 713 proc mathmlInt(int I){ 714 715 } 716 717 718 /********************************************************* 719 ** 720 ** STRING**721 ** 714 return(mathmlBigInt(I)); 715 } 716 717 718 /********************************************************* 719 ** ** 720 ** STRING ** 721 ** ** 722 722 *********************************************************/ 723 723 proc mathmlString(string m){ … … 727 727 728 728 /********************************************************* 729 ** 730 ** NUMBER**731 ** 732 **requires: mathmlPoly - since there might be a parameter 729 ** ** 730 ** NUMBER ** 731 ** ** 732 **requires: mathmlPoly - since there might be a parameter ** 733 733 *********************************************************/ 734 734 735 735 proc mathmlNumber(number n){ 736 737 S = mathmlPoly(n); 736 string S; 737 S = mathmlPoly(n); 738 738 return(S); 739 739 } 740 740 741 741 /********************************************************* 742 ** 743 ** VECTOR, INTVEC**744 ** INTMAT, BIGINTMAT, MATRIX**745 ** 742 ** ** 743 ** VECTOR, INTVEC ** 744 ** INTMAT, BIGINTMAT, MATRIX ** 745 ** ** 746 746 *********************************************************/ 747 747 748 748 proc mathmlVector(vector v){ 749 int L= size(v);750 matrix m[L][1]= v;751 string S= mathmlMatrix(m);749 int L = size(v); 750 matrix m[L][1] = v; 751 string S = mathmlMatrix(m); 752 752 return(S); 753 753 } 754 754 755 755 proc mathmlIntvec(intvec v){ 756 757 756 matrix m = v; 757 string S = mathmlMatrix(m); 758 758 return(S); 759 759 } 760 760 proc mathmlIntmat(intmat M){ 761 762 761 matrix m = M; 762 string S = mathmlMatrix(m); 763 763 return(S); 764 764 } 765 765 proc mathmlBigintmat(bigintmat M){ 766 767 766 matrix m = M; 767 string S = mathmlMatrix(m); 768 768 return(S); 769 769 } … … 792 792 793 793 /********************************************************* 794 ** 795 ** View**796 ** 794 ** ** 795 ** View ** 796 ** ** 797 797 *********************************************************/ 798 798 … … 800 800 801 801 proc viewMathml(string s){ 802 803 string Sstart= "<!doctype html><html><head><meta charset=UTF-8><title>MathML Examples</title></head><body>";804 string Send= "</body></html> ";805 string S = Sstart + s + Send; 806 807 808 809 } 810 811 812 813 802 string p = "firefox"; 803 string Sstart = "<!doctype html><html><head><meta charset=UTF-8><title>MathML Examples</title></head><body>"; 804 string Send = "</body></html> "; 805 string S = Sstart + s + Send; 806 write(":w singular_mathml.html", S); 807 808 system("sh",p+" singular_mathml.html"); 809 } 810 811 812 813 -
Singular/dyn_modules/gfanlib/gfan.h
r412c61 r2bf04b 44 44 class facet 45 45 { 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 ideal flipGB;//The Groebner Basis on the other side, computed via gcone::flip70 71 72 73 74 75 76 bool isFlippable;//**flippable facet? */77 //bool isIncoming;//Is the facet incoming or outgoing in the reverse search? No longer in use78 facet *next;//Pointer to next facet79 facet *prev;//Pointer to predecessor. Needed for the SearchList in noRevS80 facet *codim2Ptr;//Pointer to (codim-2)-facet. Bit of recursion here ;-)81 int numCodim2Facets;//#of (codim-2)-facets of this facet. Set in getCodim2Normals()82 unsigned numRays;//Number of spanning rays of the facet83 ring flipRing;//the ring on the other side of the facet84 // 85 86 87 88 89 90 91 92 93 94 95 96 97 98 // 99 100 // 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 46 private: 47 /** \brief Inner normal of the facet, describing it uniquely up to isomorphism */ 48 int64vec *fNormal; 49 50 /** \brief An interior point of the facet*/ 51 int64vec *interiorPoint; 52 53 /** \brief Universal Cone Number 54 * The number of the cone the facet belongs to, Set in getConeNormals() 55 */ 56 int UCN; 57 58 /** \brief The codim of the facet 59 */ 60 short codim; 61 62 /** \brief The Groebner basis on the other side of a shared facet 63 * 64 * In order not to have to compute the flipped GB twice we store the basis we already get 65 * when identifying search facets. Thus in the next step of the reverse search we can 66 * just copy the old cone and update the facet and the gcBasis. 67 * facet::flibGB is set via facet::setFlipGB() and printed via facet::printFlipGB 68 */ 69 ideal flipGB; //The Groebner Basis on the other side, computed via gcone::flip 70 71 public: 72 /** \brief Boolean value to indicate whether a facet is flippable or not 73 * This is also used to mark facets that nominally are flippable but which do 74 * not intersect with the positive orthant. This check is done in gcone::getCodim2Normals 75 */ 76 bool isFlippable; //**flippable facet? */ 77 //bool isIncoming; //Is the facet incoming or outgoing in the reverse search? No longer in use 78 facet *next; //Pointer to next facet 79 facet *prev; //Pointer to predecessor. Needed for the SearchList in noRevS 80 facet *codim2Ptr; //Pointer to (codim-2)-facet. Bit of recursion here ;-) 81 int numCodim2Facets; //#of (codim-2)-facets of this facet. Set in getCodim2Normals() 82 unsigned numRays; //Number of spanning rays of the facet 83 ring flipRing; //the ring on the other side of the facet 84 // int64vec **fRays; 85 86 /** The default constructor. */ 87 facet(); 88 /** Constructor for lower dimensional faces*/ 89 facet(const int &n); 90 /** The copy constructor */ 91 facet(const facet& f); 92 /** A shallow copy of facets*/ 93 facet* shallowCopy(const facet& f); 94 void shallowDelete(); 95 /** The default destructor */ 96 ~facet(); 97 /** Comparison operator*/ 98 // inline bool operator==(const facet *f,const facet *g); 99 /** \brief Comparison of facets*/ 100 // inline bool areEqual(facet *f, facet *g);//Now static 101 /** Stores the facet normal \param int64vec*/ 102 inline void setFacetNormal(int64vec *iv); 103 /** Returns the facet normal */ 104 inline int64vec *getFacetNormal() const; 105 /** Return a reference to the facet normal*/ 106 inline const int64vec *getRef2FacetNormal() const; 107 /** Method to print the facet normal*/ 108 inline void printNormal() const; 109 /** Store the flipped GB*/ 110 inline void setFlipGB(ideal I); 111 /** Return the flipped GB*/ 112 inline ideal getFlipGB(); 113 /** Print the flipped GB*/ 114 inline void printFlipGB(); 115 /** Set the UCN */ 116 inline void setUCN(int n); 117 /** \brief Get the UCN 118 * Returns the UCN iff this != NULL, else -1 119 */ 120 inline int getUCN(); 121 /** Store an interior point of the facet */ 122 inline void setInteriorPoint(int64vec *iv); 123 inline int64vec *getInteriorPoint(); 124 inline const int64vec *getRef2InteriorPoint(); 125 /** \brief Debugging function 126 * prints the facet normal an all (codim-2)-facets that belong to it 127 */ 128 volatile void fDebugPrint(); 129 friend class gcone; 130 130 }; 131 131 … … 140 140 class gcone 141 141 { 142 143 ideal inputIdeal;//the original144 ring baseRing;//the basering of the cone145 int64vec *ivIntPt;//an interior point of the cone146 int UCN;//unique number of the cone147 int pred;//UCN of the cone this one is derived from148 149 150 151 152 facet *facetPtr;//Will hold the adress of the first facet; set by gcone::getConeNormals142 private: 143 ideal inputIdeal; //the original 144 ring baseRing; //the basering of the cone 145 int64vec *ivIntPt; //an interior point of the cone 146 int UCN; //unique number of the cone 147 int pred; //UCN of the cone this one is derived from 148 static int counter; 149 150 public: 151 /** \brief Pointer to the first facet */ 152 facet *facetPtr; //Will hold the adress of the first facet; set by gcone::getConeNormals 153 153 #ifdef gfanp 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 #endif 174 175 176 177 178 179 180 181 182 static int numVars;//#of variables in the ring183 184 185 186 187 188 189 190 191 int numFacets;//#of facets of the cone192 193 194 195 196 197 198 dd_MatrixPtr ddFacets;//Matrix to store irredundant facets of the cone199 200 201 202 unsigned numRays;//#rays of the cone203 204 ideal gcBasis;//GB of the cone, set by gcone::getGB();205 gcone *next;//Pointer to next cone206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 // 225 // 226 // 227 // 228 // 229 // 230 // 231 // 232 233 // 234 235 236 237 // 238 239 240 241 242 243 244 245 246 247 248 249 250 // 251 252 253 254 // ring rCopyAndChangeWeight(const ring &r, int64vec *ivw);//NOTE remove255 // 256 // 257 258 // 259 260 261 // 262 263 264 265 266 267 // 268 // 154 static float time_getConeNormals; 155 static float time_getCodim2Normals; 156 static float t_getExtremalRays; 157 static float t_ddPolyh; 158 static float time_flip; 159 static float time_flip2; 160 static float t_areEqual; 161 static float t_ffG; 162 static float t_markings; 163 static float t_dd; 164 static float t_kStd; 165 static float time_enqueue; 166 static float time_computeInv; 167 static float t_ddMC; 168 static float t_mI; 169 static float t_iP; 170 static float t_isParallel; 171 static unsigned parallelButNotEqual; 172 static unsigned numberOfFacetChecks; 173 #endif 174 /** Matrix to contain the homogeneity/lineality space */ 175 static dd_MatrixPtr dd_LinealitySpace; 176 static int lengthOfSearchList; 177 /** Maximum size of the searchlist*/ 178 static int maxSize; 179 /** is the ideal homogeneous? */ 180 static bool hasHomInput; 181 /** # of variables in the ring */ 182 static int numVars; //#of variables in the ring 183 /** The hilbert function - for the homogeneous case*/ 184 static int64vec *hilbertFunction; 185 /** The zero vector. Needed in case of fNormal mismatch*/ 186 static int64vec *ivZeroVector; 187 188 /** # of facets of the cone 189 * This value is set by gcone::getConeNormals 190 */ 191 int numFacets; //#of facets of the cone 192 193 /** 194 * At least as a workaround we store the irredundant facets of a matrix here. 195 * This is needed to compute an interior points of a cone. Note that there 196 * will be non-flippable facets in it! 197 */ 198 dd_MatrixPtr ddFacets; //Matrix to store irredundant facets of the cone 199 200 /** Array of intvecs representing the rays of the cone*/ 201 int64vec **gcRays; 202 unsigned numRays; //#rays of the cone 203 /** Contains the Groebner basis of the cone. Is set by gcone::getGB(ideal I)*/ 204 ideal gcBasis; //GB of the cone, set by gcone::getGB(); 205 gcone *next; //Pointer to next cone 206 gcone *prev; 207 208 gcone(); 209 gcone(ring r, ideal I); 210 gcone(const gcone& gc, const facet &f); 211 ~gcone(); 212 inline int getCounter(); 213 inline ring getBaseRing(); 214 inline ring getRef2BaseRing(); 215 inline void setBaseRing(ring r); 216 inline void setIntPoint(int64vec *iv); 217 inline int64vec *getIntPoint(bool shallow=FALSE); 218 inline void showIntPoint(); 219 inline void setNumFacets(); 220 inline int getNumFacets(); 221 inline int getUCN(); 222 inline int getPredUCN(); 223 volatile void showFacets(short codim=1); 224 // volatile void showSLA(facet &f); 225 // void idDebugPrint(const ideal &I); 226 // void invPrint(const ideal &I); 227 // bool isMonomial(const ideal &I); 228 // int64vec *ivNeg(const int64vec *iv); 229 // inline int dotProduct(int64vec &iva, int64vec &ivb); 230 // inline int dotProduct(const int64vec &iva, const int64vec &ivb); 231 // inline bool isParallel(const int64vec &a, const int64vec &b); 232 void noRevS(gcone &gcRoot, bool usingIntPoint=FALSE); 233 // inline int intgcd(const int &a, const int &b); 234 void writeConeToFile(const gcone &gc, bool usingIntPoints=FALSE); 235 void readConeFromFile(int gcNum, gcone *gc); 236 int64vec f2M(gcone *gc, facet *f, int n=1); 237 // inline void sortRays(gcone *gc); 238 //The real stuff 239 void getConeNormals(const ideal &I, bool compIntPoint=FALSE); 240 void getCodim2Normals(const gcone &gc); 241 void getExtremalRays(const gcone &gc); 242 void orderRays(); 243 void flip(ideal gb, facet *f); 244 void flip2(const ideal &gb, facet *f); 245 void computeInv(const ideal &gb, ideal &inv, const int64vec &f); 246 //poly restOfDiv(poly const &f, ideal const &I); removed with r12286 247 inline ideal ffG(const ideal &H, const ideal &G); 248 inline void getGB(ideal const &inputIdeal); 249 void interiorPoint( dd_MatrixPtr &M, int64vec &iv);//used from flip and optionally from getConeNormals 250 // void interiorPoint2(); //removed Feb 8th, 2010, new method Feb 19th, 2010, again removed Mar 16th, 2010 251 void preprocessInequalities(dd_MatrixPtr &M); 252 ring rCopyAndAddWeight(const ring &r, int64vec *ivw); 253 ring rCopyAndAddWeight2(const ring &, const int64vec *, const int64vec *); 254 // ring rCopyAndChangeWeight(const ring &r, int64vec *ivw); //NOTE remove 255 // void reverseSearch(gcone *gcAct); //NOTE both removed from r12286 256 // bool isSearchFacet(gcone &gcTmp, facet *testfacet); //NOTE remove 257 void makeInt(const dd_MatrixPtr &M, const int line, int64vec &n); 258 // void normalize();//NOTE REMOVE 259 facet * enqueueNewFacets(facet *f); 260 facet * enqueue2(facet *f); 261 // dd_MatrixPtr facets2Matrix(const gcone &gc);//NOTE remove 262 /** Compute the lineality space Ax=0 and return it as dd_MatrixPtr dd_LinealitySpace*/ 263 dd_MatrixPtr computeLinealitySpace(); 264 inline bool iv64isStrictlyPositive(const int64vec *); 265 /** Exchange 2 ordertype_a by just 1 */ 266 void replaceDouble_ringorder_a_ByASingleOne(); 267 // static void gcone::idPrint(ideal &I); 268 // friend class facet; 269 269 }; 270 270 lists lprepareResult(gcone *gc, const int n); -
Singular/links/ndbm.h
r412c61 r2bf04b 39 39 * SUCH DAMAGE. 40 40 * 41 * @(#)ndbm.h5.1 (Berkeley) 5/30/8541 * @(#)ndbm.h 5.1 (Berkeley) 5/30/85 42 42 * 43 43 * Par. 3 removed due to a license change (1999) … … 53 53 54 54 typedef struct { 55 int dbm_dirf;/* open directory file */56 int dbm_pagf;/* open page file */57 int dbm_flags;/* flags, see below */58 long dbm_maxbno;/* last ``bit'' in dir file */59 long dbm_bitno;/* current bit number */60 long dbm_hmask;/* hash mask */61 long dbm_blkptr;/* current block for dbm_nextkey */62 int dbm_keyptr;/* current key for dbm_nextkey */63 long dbm_blkno;/* current page to read/write */64 long dbm_pagbno;/* current page in pagbuf */65 char dbm_pagbuf[PBLKSIZ];/* page file block buffer */66 long dbm_dirbno;/* current block in dirbuf */67 char dbm_dirbuf[DBLKSIZ];/* directory file block buffer */55 int dbm_dirf; /* open directory file */ 56 int dbm_pagf; /* open page file */ 57 int dbm_flags; /* flags, see below */ 58 long dbm_maxbno; /* last ``bit'' in dir file */ 59 long dbm_bitno; /* current bit number */ 60 long dbm_hmask; /* hash mask */ 61 long dbm_blkptr; /* current block for dbm_nextkey */ 62 int dbm_keyptr; /* current key for dbm_nextkey */ 63 long dbm_blkno; /* current page to read/write */ 64 long dbm_pagbno; /* current page in pagbuf */ 65 char dbm_pagbuf[PBLKSIZ]; /* page file block buffer */ 66 long dbm_dirbno; /* current block in dirbuf */ 67 char dbm_dirbuf[DBLKSIZ]; /* directory file block buffer */ 68 68 } DBM; 69 69 70 #define _DBM_RDONLY 0x01/* data base open read-only */71 #define _DBM_IOERR 0x02/* data base I/O error */70 #define _DBM_RDONLY 0x01 /* data base open read-only */ 71 #define _DBM_IOERR 0x02 /* data base I/O error */ 72 72 73 #define dbm_rdonly(db) 73 #define dbm_rdonly(db) ((db)->dbm_flags & _DBM_RDONLY) 74 74 75 #define dbm_error(db) 76 77 #define dbm_clearerr(db) 75 #define dbm_error(db) ((db)->dbm_flags & _DBM_IOERR) 76 /* use this one at your own risk! */ 77 #define dbm_clearerr(db) ((db)->dbm_flags &= ~_DBM_IOERR) 78 78 79 79 /* for flock(2) and fstat(2) */ 80 #define dbm_dirfno(db) 81 #define dbm_pagfno(db) 80 #define dbm_dirfno(db) ((db)->dbm_dirf) 81 #define dbm_pagfno(db) ((db)->dbm_pagf) 82 82 83 83 typedef struct { 84 char*dptr;85 intdsize;84 char *dptr; 85 int dsize; 86 86 } datum; 87 87 … … 89 89 * flags to dbm_store() 90 90 */ 91 #define DBM_INSERT 92 #define DBM_REPLACE 91 #define DBM_INSERT 0 92 #define DBM_REPLACE 1 93 93 94 DBM 95 void 96 datum 97 datum 98 datum 99 long 100 int 101 int 94 DBM *dbm_open(char *file, int flags, int mode); 95 void dbm_close(DBM *db); 96 datum dbm_fetch(register DBM *db, datum key); 97 datum dbm_firstkey(DBM *db); 98 datum dbm_nextkey(register DBM *db); 99 long dbm_forder(register DBM *db, datum key); 100 int dbm_delete(register DBM *db, datum key); 101 int dbm_store(register DBM *db, datum key, datum dat, int replace); 102 102 103 103 #endif /* NDBM_H */ -
Singular/links/sing_dbm.cc
r412c61 r2bf04b 122 122 { 123 123 if (!SI_LINK_CLOSE_P(l)) 124 125 126 124 { 125 if (!dbClose(l)) {Print("cannot close link!\n");} 126 } 127 127 //(SI_LINK_CLOSE_P(l)) automatically 128 128 if (dbOpen(l, SI_LINK_READ)) return NULL; … … 160 160 if (db->actual.dptr==NULL) 161 161 { 162 162 db->actual=gdbm_firstkey(db->db); 163 163 } 164 164 d_key = gdbm_nextkey(db->db,db->actual); … … 215 215 { 216 216 if (!SI_LINK_W_OPEN_P(l)) //exceptions 217 218 219 220 221 222 223 217 { 218 if (!SI_LINK_CLOSE_P(l)) 219 { 220 if (!dbClose(l)) {Print("close error\n");}; 221 } 222 if (!dbOpen(l,SI_LINK_WRITE)) {Print("open_for_write error\n");} 223 } 224 224 } 225 225 … … 238 238 ret = gdbm_store(db->db, d_key, d_value, GDBM_REPLACE); 239 239 // db->actual=d_key; 240 240 if (ret==-1) {Print("reader calls gdbm_store!");} 241 241 if (ret==0) 242 242 { b=FALSE; } … … 247 247 { 248 248 Werror("GDBM link I/O error: '%s' ", gdbm_errno); 249 249 // Print(gdbm_strerror(gdbm_errno)); 250 250 //dbm_clearerr(db->db); 251 251 // gdbm_errno=0; 252 252 } 253 253 } -
Singular/pyobject_setup.cc
r412c61 r2bf04b 28 28 assume(bbx != NULL); 29 29 return (pyobject_load() || (bbx->blackbox_Init == pyobject_autoload)? 30 30 NULL: bbx->blackbox_Init(bbx)); 31 31 } 32 32 -
Tst/Long/classify_l.tst
r412c61 r2bf04b 111 111 classify(f); 112 112 113 f=(x+3y3)*(x3+xy18+y26); // Z[3,67], step 44, 113 f=(x+3y3)*(x3+xy18+y26); // Z[3,67], step 44, k=3, i=5 114 114 classify(f); 115 115 -
Tst/Long/nfmodstd_l.tst
r412c61 r2bf04b 11 11 minpoly = a^2+1; 12 12 ideal HJa=(2*a+3)*x*y^4*z^2 + (a+2)*x^2*y^3*z*w-x^2*y^3*z*w + 2*x*y*z^2*w^3 + (7*a-1)*y^3*w^4, 13 14 15 16 13 2*x^2*y^4*z + x^2*y*z^2*w^2-a*x*y^2*z^2*w^2 + (a+11)*x^2*y*z*w^3 -12*x*w^6 + 12*y*w^6, 14 2*y^5*z + x^2*y^2*z*w-x*y^3*z*w -x*y^3*w^2 +a*y^4*w^2 + 2*y^2*z*w^3, 15 3*x*y^4*z^3 + x^2*y^2*z*w^3-x*y^3*z*w^3 +(4+a)*y^3*z^2*w^3 +3*x*y*z^3*w^3 +4*a*z^2*w^6 16 -x*w^7+y*w^7; 17 17 18 18 tst_test_nfmodstd(HJa); … … 21 21 minpoly = a^4+a^3+a^2+a+1; 22 22 ideal I1=(8/a^2)*x^2*y^2+5*x*y^3+(3-a^2)*x^3*z + x^2*y*z, 23 24 25 23 x^5+ 2*y^3*z^2+ 13*y^2*z^3+ 5*y*z^4, 24 8*x^3+(12*a+a^2)*y^3 +x*z^2+3, 25 (7*a^2-a)*x^2*y^4+18*y^3*z^2+y^3*z^3; 26 26 tst_test_nfmodstd(I1); 27 27 28 28 ideal HUa = a*x+(a-1)*y+(a+2)*w+u,x*y+(a-1)*y*z+z*w + (a+2)*x*w+a*w*u, 29 30 29 a*x*y*z+(a+5)*y*z*w+a*x*y*u+(a+2)*x*w*u+a*z*w*u,(a-11)*x*y*z*w+(a+5)*x*y*z*u+a*x*y*w*u + 30 a*x*z*w*u+a*y*z*w*u,(a + 3)*x*y*z*w*u -(a+23)*v^5; 31 31 tst_test_nfmodstd(HUa); 32 32 kill r; … … 34 34 minpoly = a^3 + 5a + 7; 35 35 ideal I6a=a*x+(a+2)*y+z+w+u+v,x*y+y*z+z*w+w*u+(a+3)*x*v+u*v,x*y*z+y*z*w 36 37 36 + (a+1)*z*w*u+x*y*v+x*u*v+w*u*v,(a-1)*x*y*z*w + y*z*w*u +x*y*z*v +x*y*u*v+ x*w*u*v+ z*w*u*v, 37 x*y*z*w*u+(a+1)*x*y*z*w*v+x*y*z*u*v+x*y*w*u*v+x*z*w*u*v+y*z*w*u*v,x*y*z*w*u*v-a+2; 38 38 tst_test_nfmodstd(I6a); 39 39 kill r; … … 41 41 minpoly = a^3+2; 42 42 ideal I= (2*w*y-2*a+3)*x-z*y^2-z,2*z*x^3 + (4*w*y + 5)*x^2 + (4*z*y^2 + 4*z)*x + 43 44 43 2*w*y^3-10*y^2 - 10*w*y,(w^2-a^2+2*a)*x + 11*w*y*z-2*z, (-z^2 + 4*w^2+a^2+2)*x*z 44 + (4*w*z^2 + 2*w^3-10*w)*y + 4*z^2-10*w^2 + a^2+a; 45 45 tst_test_nfmodstd(I); 46 46 ideal I1= (2*w*y-(2*a+3)*z^2)*x-z*y^2-z^2*x, … … 53 53 minpoly = a^3 + 2a + 11; 54 54 ideal Ua = (a-x)^2 + (a-1)^2*y + z + (a+2)*w + u,x*y + (a-1)*y*z + z*w + 55 56 55 (a + 2)*x*w + a*w*u,a*x*y*z + (a + 5)*y*z*w + a*x*y*u + (a+2)*x*w*u + a*z*w*u, 56 (a-11)*x*y*z*w + (a + 5)*x*y*z*u + a*x*y*w*u + a*x*z*w*u + a*y*z*w*u,(a + 3)*x*y*z*w*u + a+23; 57 57 tst_test_nfmodstd(Ua); 58 58 kill r; -
Tst/Long/stdZtests.tst
r412c61 r2bf04b 8 8 reduce(I,gI); 9 9 ideal ggI = std(gI); 10 size(gI);size(ggI); 10 size(gI);size(ggI); 11 11 ideal gJ = std(J); 12 12 gJ; 13 13 reduce(J,gJ); 14 14 ideal ggJ = std(gJ); 15 size(gJ);size(ggJ); 15 size(gJ);size(ggJ); 16 16 17 17 tst_status(1); -
Tst/New/gndlib.tst
r412c61 r2bf04b 45 45 y3 = 1+a1*x2+a1*x2^2+a3*x1*x2^4+a4*x1*x2^6; 46 46 y4 = 1+a4*x2+(a2^2+a3)*x2^10+(a1+a2+a3+a4)*x1*x2^11; 47 47 48 48 list as,xs; 49 49 if(nra != 0) … … 193 193 y3 = 1+a1*x2+(a2+a3+a4)*x2^2; 194 194 y4 = 1+a2*x2^2; 195 195 196 196 list as,xs; 197 197 if(nra != 0) … … 231 231 y3 = 1+a1*x2; 232 232 y4 = 1+a2*x2^2; 233 233 234 234 list as,xs; 235 235 if(nra != 0) -
Tst/New/hilblocinhom.res.gz.uu
r412c61 r2bf04b 1 begin 6 64hilblocinhom.res.gz2 M'XL("& :MI%$``VAI;&)L;V-I;FAO;2YR97,`E91+;YM`$(#/\:^86CU`3,B^3 M ,!`7#E4OD:H>FMXBJW)L7%;:0L1L7)LH_[U#FBQ(?LA%6G9W9G8>S,?>_?AR4 M ^PT`>`Y?;S_#V*(-C7X8ST9W;QJ1`PE_ZDI;SY^-NAGR'$IM'DR]U%59_PZK5 M XD^(=F'=(9F#6ZL0ZD>KZ\I[;&KK]YZC'!I=_8+O&0N\;;`+6C]88:^?YJ!76 M Q<*`SF`K=^UDRUFPW8E6T+N5O6'\;H@Z0[OR-`6YYTPE41S=B'GD"1^1,^2"7 M ID2HJQ%ELGI:6E@VVA8-Y7;#8%DN=#60*.<_(?^5W11+V&1=W1[J@`\*25U\8 M _!<_V)S(H"S/#-^%*AH+2(("!RKQ'IFS'-9UXU%V8#(^,Y\RU&U!^?DS,YGX9 M SHZ'</'L=H)V>DU6]V;^(4.DJ3>-2'GQ/%XO#!;CV8N3IR1W.\'[!@MRY];R10 M 2+.%.M!L0\V^OH;+2VB*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9 ideal ss=std(i,v); 10 10 for(int l=1;l<=size(si);l++) 11 12 13 14 11 { 12 if(si[l]!=ss[l]) 13 {"false";} 14 } 15 15 16 16 … … 22 22 ideal ss=std(i,v); 23 23 for(int l=1;l<=size(si);l++) 24 25 26 27 24 { 25 if(si[l]!=ss[l]) 26 {"false";} 27 } 28 28 29 29 -
Tst/New/stdZtests.tst
r412c61 r2bf04b 159 159 reduce(J,gJ); 160 160 kill rng; 161 161 162 162 ring rng = (integer),(x,y,z),(ls(3),C); 163 163 ideal I = 7*x*z+3*x*z^2-x^2,4*z+6*z^2+2*y; … … 168 168 ideal gJ = std(J); 169 169 gJ; 170 reduce(J,gJ); 170 reduce(J,gJ); 171 171 kill rng; 172 172 … … 354 354 ideal g= std(inI); 355 355 reduce(inI,g); 356 /// 356 /// 357 357 ring rng = (integer),(x,y,z),(ws(-1,-1,-1),C); 358 358 ideal I = 6yz-6,6xy-6yz-8y; … … 383 383 384 384 ring r=integer,(t,x(1..4)),ws(1,-1,-11,-3,-19); 385 ideal inJ = 385 ideal inJ = 386 386 3, 387 387 t*x(3)*x(4)+2*t*x(1)*x(2), 388 388 t*x(1)*x(2)^2+2*t^3*x(1)*x(2)*x(3), 389 389 x(1)^2*x(2)*x(3)*x(4)+2*t^2*x(1)^3*x(2)*x(3); 390 ideal J = 390 ideal J = 391 391 x(1)^2*x(2)*x(3)*x(4)-t*x(1)^2*x(2)^3+5*t*x(1)^2*x(2)*x(3)*x(4)+16*t^3*x(1)*x(2)*x(3)^2*x(4)-2*x(1)^3*x(2)^2-1536*x(1)^3*x(3)*x(4)+32*t^2*x(1)^2*x(3)^2*x(4), 392 392 t*x(1)*x(2)^2+2*x(1)^2*x(2)+2*t^3*x(1)*x(2)*x(3)-192*x(1)^3+4*t^2*x(1)^2*x(3), … … 469 469 std(J2); 470 470 kill r; 471 471 472 472 // Infinite reduction small example 473 473 … … 477 477 gi; 478 478 reduce(i,gi); 479 kill r; 479 kill r; 480 480 481 481 // Intersect with the elimination takes for ever. With the module is immediate … … 488 488 I_J; 489 489 kill rng; 490 490 491 491 // Github Adi #61 492 492 … … 495 495 qring QR = QQQ; 496 496 ideal I = 41,-36*x1; 497 module syzI = syz (I); 497 module syzI = syz (I); 498 498 print(syzI); 499 kill rng,QR; 499 kill rng,QR; 500 500 501 501 // Github Adi #60 … … 510 510 ideal IGJ = I+gJ; 511 511 intersect(I_J, IGJ) ; 512 kill rng,QR; 513 512 kill rng,QR; 513 514 514 // Github Adi #59 515 515 … … 536 536 intersect(I_J, I+gJ); 537 537 kill rng; 538 538 539 539 // Github Adi #56 540 540 … … 584 584 reduce (I,gI ); 585 585 kill rng; 586 586 587 587 // Singular Trac: #719 588 588 589 589 ring r = integer,(t,x(1..5)),ws(1,-1,-1,-1,-1,-1); 590 590 poly h = 3*t*x(2)*x(4)-21*t*x(1)*x(5)-12*t^2*x(1)*x(2)-2*t^2*x(1)*x(3)-6*t^2*x(1)*x(4); 591 ideal G = 591 ideal G = 592 592 x(2)+6*x(4)+7*x(5)+4*t*x(2), 593 593 x(2)+8*x(3)+7*x(5)+t*x(2), … … 600 600 reduce(G,Gstd); 601 601 kill r; 602 602 603 603 // Memory leak 604 604 … … 646 646 ideal ngIJ = intersect(gI,gJ ); // wrong 647 647 kill rng; 648 649 tst_status(1);$; 650 648 649 tst_status(1);$; 650 -
Tst/New/std_integer5.tst
r412c61 r2bf04b 13 13 ideal stdstdIJ = std(stdIJ); 14 14 stdstdIJ; 15 15 16 16 tst_status(1);$ -
Tst/Short/bug_tr712.tst
r412c61 r2bf04b 11 11 ideal gI_J = std(gI,J); 12 12 size( std(reduce (I,gI ) )); 13 size( std(reduce (IJ,gIJ ) )); 13 size( std(reduce (IJ,gIJ ) )); 14 14 size( std(reduce (IJ,gI_J ) )); 15 size( std(reduce (gI_J, gIJ) )); 15 size( std(reduce (gI_J, gIJ) )); 16 16 gI_J; 17 17 gIJ; -
Tst/Short/bug_tr719.tst
r412c61 r2bf04b 5 5 ring r=integer,(t,x(1..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3B 38 M10Q[-XVR%$999L5C>@/IGZ:!X:Q)/=7EP?G3/6@_<:<:U^`/_'=@-@:FGN'S 39 MD,%<BI(8%VF#"T/_&97-Q302$B*F.A+M8Q8B0K%7M&/LO'4[$?CCRLO7KGSF 40 M$IE)-=<QG.A0R@78U[45W5&`]F5]8C+4"<VOXL>,__Q-C3\P^11+A\*[7#%. 41 900&G(/Y:B[_'%AFH6_XP^@=\>L$JXQ4````` 43 42 ` 44 43 end -
Tst/Short/polylib_s.stat
r412c61 r2bf04b 1 1 >> tst_memory_0 :: 1447333028:4022, 64 bit:4.0.2:x86_64-Linux:nepomuck:208936 2 1 >> tst_memory_1 :: 1447333028:4022, 64 bit:4.0.2:x86_64-Linux:nepomuck:2273280 3 1 >> tst_memory_2 :: 1447333028:4022, 64 bit:4.0.2:x86_64-Linux:nepomuck:2400256 4 1 >> tst_timer_1 :: 1447333028:4022, 64 bit:4.0.2:x86_64-Linux:nepomuck:5 -
Tst/Short/polylib_s.tst
r412c61 r2bf04b 5 5 6 6 example cyclic; 7 killall();8 7 9 8 example katsura; 10 killall();11 9 12 10 example freerank; 13 killall();14 11 15 12 example maxcoef; 16 killall();17 13 18 14 example maxdeg; 19 killall();20 15 21 16 example maxdeg1; 22 killall();23 17 24 18 example mindeg; 25 killall();26 19 27 20 example mindeg1; 28 killall();29 21 30 22 example normalize; 31 killall();32 23 33 24 example rad_con; 34 killall();35 25 36 26 example content; 37 killall();38 27 39 28 /*example numerator;// core function in SW*/ring r=0,x,dp;number n=3/2;numerator(n);kill r; -
factory/gfops.h
r412c61 r2bf04b 66 66 { 67 67 while ( i < 0 ) 68 68 i += gf_p; 69 69 while ( i >= gf_p ) 70 70 i -= gf_p; 71 71 if ( i == 0 ) 72 72 return gf_q; 73 73 int c = 0; 74 74 while ( i > 1 ) { 75 76 75 c = gf_table[c]; 76 i--; 77 77 } 78 78 return c; … … 82 82 { 83 83 while ( i < 0 ) 84 84 i += gf_p; 85 85 while ( i >= gf_p ) 86 86 i -= gf_p; 87 87 if ( i == 0 ) 88 88 return gf_q; 89 89 long c = 0; 90 90 while ( i > 1 ) { 91 92 91 c = gf_table[c]; 92 i--; 93 93 } 94 94 return c; … … 114 114 { 115 115 if ( gf_iszero( a ) ) 116 117 else 118 116 return 0; 117 else 118 return 1; 119 119 } 120 120 //}}} … … 127 127 int i = a + gf_m1; 128 128 if ( i >= gf_q1 ) 129 129 i -= gf_q1; 130 130 return i; 131 131 } … … 139 139 int zb, zab, r; 140 140 if ( a >= b ) { 141 142 143 } 144 else { 145 146 141 zb = b; 142 zab = a - b; 143 } 144 else { 145 zb = a; 146 zab = b - a; 147 147 } 148 148 if ( gf_table[zab] == gf_q ) 149 150 else { 151 152 153 149 r = gf_q; /*if z^(a-b)+1 =0*/ 150 else { 151 r= zb + gf_table[zab]; 152 if ( r >= gf_q1 ) 153 r -= gf_q1; 154 154 } 155 155 return r; … … 164 164 { 165 165 if ( a == gf_q || b == gf_q ) 166 167 else { 168 169 170 166 return gf_q; 167 else { 168 int i = a + b; 169 if ( i >= gf_q1 ) i -= gf_q1; 170 return i; 171 171 } 172 172 } … … 175 175 { 176 176 if ( a == gf_q || b == gf_q ) 177 178 else { 179 180 181 177 return gf_q; 178 else { 179 long i = a + b; 180 if ( i >= gf_q1 ) i -= gf_q1; 181 return i; 182 182 } 183 183 } … … 187 187 ASSERT( b != gf_q, "divide by zero" ); 188 188 if ( a == gf_q ) 189 190 else { 191 192 193 194 189 return gf_q; 190 else { 191 int s = a - b; 192 if (s < 0) 193 s += gf_q1; 194 return s; 195 195 } 196 196 } … … 208 208 { 209 209 if ( a == gf_q ) 210 210 os << "0"; 211 211 else if ( a == 0 ) 212 212 os << "1"; 213 213 else if ( a == 1 ) 214 215 else 216 214 os << gf_name; 215 else 216 os << gf_name << "^" << a; 217 217 } 218 218 #endif /* NOSTREAMIO */ … … 223 223 { 224 224 if ( n == 0 ) 225 225 return 0; 226 226 else if ( n == 1 ) 227 228 else 229 227 return a; 228 else 229 return gf_mul( a, gf_power( a, n-1 ) ); 230 230 } 231 231 … … 233 233 { 234 234 if ( n == 0 ) 235 235 return 0; 236 236 else if ( n == 1 ) 237 238 else 239 237 return a; 238 else 239 return gf_mul( a, gf_power( a, n-1 ) ); 240 240 } 241 241 //}}} -
factory/parseutil.cc
r412c61 r2bf04b 83 83 static PUtilBase * create( const char * str ) 84 84 { 85 86 87 88 85 if ( strlen( str ) < 9 ) 86 return new PUtilInt( atoi( str ) ); 87 else 88 return new PUtilCF( CanonicalForm( str ) ); 89 89 } 90 90 }; … … 123 123 { 124 124 if ( this != &pu ) { 125 126 125 delete value; 126 value = pu.value->copy(); 127 127 } 128 128 return *this; -
factory/templates/ftmpl_afactor.cc
r412c61 r2bf04b 26 26 { 27 27 if ( exp() == 1 ) 28 28 s << "(" << factor() << ", " << minpoly() << ")"; 29 29 else 30 30 s << "((" << factor() << ")^" << exp() << ", " << minpoly() << ")"; 31 31 } 32 32 -
factory/templates/ftmpl_array.cc
r412c61 r2bf04b 12 12 { 13 13 if ( a._size > 0 ) { 14 15 16 17 18 19 14 _min = a._min; 15 _max = a._max; 16 _size = a._size; 17 data = new T[_size]; 18 for ( int i = 0; i < _size; i++ ) 19 data[i] = a.data[i]; 20 20 } 21 21 else { 22 23 24 22 data = 0; 23 _min = _size = 0; 24 _max = -1; 25 25 } 26 26 } … … 33 33 _size = i; 34 34 if ( i == 0 ) 35 35 data = 0; 36 36 else 37 37 data = new T[_size]; 38 38 } 39 39 … … 42 42 { 43 43 if ( max < min ) { 44 45 46 44 _min = _size = 0; 45 _max = -1; 46 data = 0; 47 47 } 48 48 else { 49 50 51 52 49 _min = min; 50 _max = max; 51 _size = _max - _min + 1; 52 data = new T[_size]; 53 53 } 54 54 } … … 64 64 { 65 65 if ( this != &a ) { 66 67 68 69 70 71 72 73 74 75 76 77 78 79 66 delete [] data; 67 _min = a._min; 68 _max = a._max; 69 _size = a._size; 70 if ( a._size > 0 ) { 71 _size = a._size; 72 data = new T[_size]; 73 for ( int i = 0; i < _size; i++ ) 74 data[i] = a.data[i]; 75 } 76 else { 77 data = 0; 78 _size = 0; 79 } 80 80 } 81 81 return *this; … … 112 112 { 113 113 for ( int i = 0; i < _size; i++ ) 114 114 data[i] *= t; 115 115 return *this; 116 116 } … … 120 120 { 121 121 for ( int i = 0; i < _size; i++ ) 122 122 data[i] += t; 123 123 return *this; 124 124 } … … 129 129 ASSERT ( _size == a._size, "warning: array size mismatch." ); 130 130 for ( int i = 0; i < _size; i++ ) 131 131 data[i] += a.data[i]; 132 132 return *this; 133 133 } … … 139 139 { 140 140 if ( _size == 0 ) 141 141 os << "( )"; 142 142 else { 143 144 145 146 143 os << "( " << data[0]; 144 for ( int i = 1; i < _size; i++ ) 145 os << ", " << data[i]; 146 os << " )"; 147 147 } 148 148 } -
factory/templates/ftmpl_factor.cc
r412c61 r2bf04b 7 7 { 8 8 if ( this != &f ) { 9 10 9 _factor = f._factor; 10 _exp = f._exp; 11 11 } 12 12 return *this; … … 32 32 { 33 33 if ( exp() == 1 ) 34 34 s << factor(); 35 35 else 36 36 s << "(" << factor() << ")^" << exp(); 37 37 } 38 38 -
factory/templates/ftmpl_matrix.cc
r412c61 r2bf04b 8 8 ASSERT( (nr > 0 && nc > 0) || (nr == 0 && nc == 0), "illegal index" ); 9 9 if ( nr == 0 ) 10 10 elems = 0; 11 11 else { 12 13 14 15 12 int i; 13 elems = new T_ptr[nr]; 14 for ( i = 0; i < nr; i++ ) 15 elems[i] = new T[nc]; 16 16 } 17 17 } … … 21 21 { 22 22 if ( NR == 0 ) 23 23 elems = 0; 24 24 else { 25 26 27 28 29 30 31 25 int i, j; 26 elems = new T_ptr[NR]; 27 for ( i = 0; i < NR; i++ ) { 28 elems[i] = new T[NC]; 29 for ( j = 0; j < NC; j++ ) 30 elems[i][j] = M.elems[i][j]; 31 } 32 32 } 33 33 } … … 37 37 { 38 38 if ( elems != 0 ) { 39 40 41 42 39 int i; 40 for ( i = 0; i < NR; i++ ) 41 delete [] elems[i]; 42 delete [] elems; 43 43 } 44 44 } … … 48 48 { 49 49 if ( this != &M ) { 50 51 52 53 54 55 56 57 58 59 60 61 62 50 int i, j; 51 if ( NR != M.NR || NC != M.NC ) { 52 for ( i = 0; i < NR; i++ ) 53 delete [] elems[i]; 54 delete elems; 55 NR = M.NR; NC = M.NC; 56 elems = new T_ptr[NR]; 57 for ( i = 0; i < NR; i++ ) 58 elems[i] = new T[NC]; 59 } 60 for ( i = 0; i < NR; i++ ) 61 for ( j = 0; j < NC; j++ ) 62 elems[i][j] = M.elems[i][j]; 63 63 } 64 64 return *this; … … 112 112 ASSERT( i > 0 && i <= NR && j > 0 && j <= NR, "illegal index" ); 113 113 if ( i != j ) { 114 115 116 117 114 i--; j--; 115 T * h = elems[i]; 116 elems[i] = elems[j]; 117 elems[j] = h; 118 118 } 119 119 } … … 124 124 ASSERT( i > 0 && i <= NC && j > 0 && j <= NC, "illegal index" ); 125 125 if ( i != j ) { 126 127 128 129 130 131 132 126 int k; 127 i--; j--; 128 for ( k = 0; k < NR; k++ ) { 129 T h = elems[k][i]; 130 elems[k][i] = elems[k][j]; 131 elems[k][j] = h; 132 } 133 133 } 134 134 } … … 140 140 s << "( " << elems[i][0]; 141 141 for ( int j = 1; j < NC; j++ ) 142 142 s << ", " << elems[i][j]; 143 143 s << " )"; 144 144 } … … 148 148 { 149 149 if ( NR == 0 ) 150 150 s << "( )"; 151 151 else if ( NR == 1 ) { 152 153 154 152 s << "( "; 153 printrow( s, 0 ); 154 s << " )"; 155 155 } 156 156 else { 157 158 159 160 161 162 163 164 157 int i; 158 s << "(\n"; 159 printrow( s, 0 ); 160 for ( i = 1; i < NR; i++ ) { 161 s << ",\n"; 162 printrow( s, i ); 163 } 164 s << "\n)"; 165 165 } 166 166 } … … 174 174 int i, j; 175 175 for ( i = 0; i < lhs.NR; i++ ) 176 177 176 for ( j = 0; j < lhs.NC; j++ ) 177 res.elems[i][j] = lhs.elems[i][j] + rhs.elems[i][j]; 178 178 return res; 179 179 } … … 186 186 int i, j; 187 187 for ( i = 0; i < lhs.NR; i++ ) 188 189 188 for ( j = 0; j < lhs.NC; j++ ) 189 res.elems[i][j] = lhs.elems[i][j] - rhs.elems[i][j]; 190 190 return res; 191 191 } … … 197 197 int i, j; 198 198 for ( i = 0; i < lhs.NR; i++ ) 199 200 199 for ( j = 0; j < lhs.NC; j++ ) 200 res.elems[i][j] = lhs.elems[i][j] * rhs; 201 201 return res; 202 202 } … … 208 208 int i, j; 209 209 for ( i = 0; i < rhs.NR; i++ ) 210 211 210 for ( j = 0; j < rhs.NC; j++ ) 211 res.elems[i][j] = rhs.elems[i][j] * lhs; 212 212 return res; 213 213 } … … 220 220 int i, j, k; 221 221 for ( i = 0; i < lhs.NR; i++ ) 222 223 224 225 226 222 for ( j = 0; j < rhs.NC; j++ ) { 223 res[i][j] = 0; 224 for ( k = 0; k < lhs.NC; k++ ) 225 res[i][j]+= lhs.elems[i][k] * rhs.elems[k][j]; 226 } 227 227 return res; 228 228 }*/ … … 239 239 ASSERT( r_max - r_min + 1 == S.NR && c_max - c_min + 1 == S.NC, "incompatible matrices" ); 240 240 if ( M.elems != S.elems ) { 241 242 243 244 241 int i, j; 242 for ( i = 0; i < S.NR; i++ ) 243 for ( j = 0; j < S.NC; j++ ) 244 M.elems[r_min+i-1][c_min+j-1] = S.elems[i][j]; 245 245 } 246 246 return *this; … … 255 255 m = c_max - c_min + 1; 256 256 if ( M.elems == S.M.elems ) { 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 257 if ( r_min < S.r_min ) { 258 for ( i = 0; i < n; i++ ) 259 for ( j = 0; j < m; j++ ) 260 M.elems[r_min+i-1][c_min+j-1] = S.M.elems[S.r_min+i-1][S.c_min+j-1]; 261 } 262 else if ( r_min > S.r_min ) { 263 for ( i = n-1; i >= 0; i-- ) 264 for ( j = 0; j < m; j++ ) 265 M.elems[r_min+i-1][c_min+j-1] = S.M.elems[S.r_min+i-1][S.c_min+j-1]; 266 } 267 else if ( c_min < S.c_min ) { 268 for ( j = 0; j < m; j++ ) 269 for ( i = 0; i < n; i++ ) 270 M.elems[r_min+i-1][c_min+j-1] = S.M.elems[S.r_min+i-1][S.c_min+j-1]; 271 } 272 else if ( c_min > S.c_min ) { 273 for ( j = m-1; j >= 0; j-- ) 274 for ( i = 0; i < n; i++ ) 275 M.elems[r_min+i-1][c_min+j-1] = S.M.elems[S.r_min+i-1][S.c_min+j-1]; 276 } 277 277 } 278 278 else { 279 280 281 279 for ( i = 0; i < n; i++ ) 280 for ( j = 0; j < m; j++ ) 281 M.elems[r_min+i-1][c_min+j-1] = S.M.elems[S.r_min+i-1][S.c_min+j-1]; 282 282 } 283 283 return *this; … … 291 291 int n = r_max - r_min + 1, m = c_max - c_min + 1; 292 292 for ( i = 0; i < n; i++ ) 293 294 293 for ( j = 0; j < m; j++ ) 294 res.elems[i][j] = M.elems[r_min+i-1][c_min+j-1]; 295 295 return res; 296 296 } -
factory/timing.h
r412c61 r2bf04b 48 48 #define TIMING_END_AND_PRINT(t, msg) times( &timing_ ## t ## _end ); \ 49 49 fprintf( stderr, "%s%.2f sec\n", msg, \ 50 50 float( timing_ ## t ## _end - timing_ ## t ## _start ) / HZ ); \ 51 51 timing_ ## t ## _time += timing_ ## t ## _end - timing_ ## t ## _start; 52 52 #define TIMING_DEFINE_PRINT(t) static clock_t timing_ ## t ## _start, timing_ ## t ## _end; \ … … 66 66 #define TIMING_END_AND_PRINT(t, msg) times( &timing_ ## t ## _end ); \ 67 67 fprintf( stderr, "%s%.2f sec\n", msg, \ 68 68 float( timing_ ## t ## _end.tms_utime - timing_ ## t ## _start.tms_utime ) / HZ ); \ 69 69 timing_ ## t ## _time += timing_ ## t ## _end.tms_utime - timing_ ## t ## _start.tms_utime; 70 70 #define TIMING_DEFINE_PRINT(t) static struct tms timing_ ## t ## _start, timing_ ## t ## _end; \ -
factory/variable.h
r412c61 r2bf04b 44 44 Variable& operator= ( const Variable & v ) 45 45 { 46 47 46 _level = v._level; 47 return *this; 48 48 } 49 49 int level() const { return _level; } … … 53 53 friend bool operator == ( const Variable & lhs, const Variable & rhs ) 54 54 { 55 55 return lhs._level == rhs._level; 56 56 } 57 57 friend bool operator != ( const Variable & lhs, const Variable & rhs ) 58 58 { 59 59 return lhs._level != rhs._level; 60 60 } 61 61 friend bool operator > ( const Variable & lhs, const Variable & rhs ) 62 62 { 63 63 return lhs._level > rhs._level; 64 64 } 65 65 friend bool operator < ( const Variable & lhs, const Variable & rhs ) 66 66 { 67 67 return lhs._level < rhs._level; 68 68 } 69 69 friend bool operator >= ( const Variable & lhs, const Variable & rhs ) 70 70 { 71 71 return lhs._level >= rhs._level; 72 72 } 73 73 friend bool operator <= ( const Variable & lhs, const Variable & rhs ) 74 74 { 75 75 return lhs._level <= rhs._level; 76 76 } 77 77 #ifndef NOSTREAMIO -
gfanlib/gfanlib_matrix.h
r412c61 r2bf04b 197 197 std::string toString()const 198 198 { 199 200 201 199 std::stringstream f; 200 f<<*this; 201 return f.str(); 202 202 } 203 203 -
gfanlib/gfanlib_symmetriccomplex.cpp
r412c61 r2bf04b 185 185 int SymmetricComplex::getLinDim()const 186 186 { 187 187 return linealitySpace.getHeight(); 188 188 } 189 189 -
gfanlib/gfanlib_vector.h
r412c61 r2bf04b 293 293 std::string toString()const 294 294 { 295 296 297 295 std::stringstream f; 296 f<<*this; 297 return f.str(); 298 298 } 299 299 -
gfanlib/gfanlib_zcone.cpp
r412c61 r2bf04b 459 459 dd_ErrorType err=dd_NoError; 460 460 461 461 cddinitGmp(); 462 462 463 463 A=ZMatrix2MatrixGmp(inequalities, equations, &err); … … 748 748 std::string ZCone::toString()const 749 749 { 750 751 752 750 std::stringstream f; 751 f<<*this; 752 return f.str(); 753 753 // ======= 754 754 // std::stringstream s; … … 983 983 } 984 984 */ 985 // 986 985 // ZCone dual(newGenerators,linealitySpace); 986 ZCone dual(generators,linealitySpace); 987 987 // dual.findFacets(); 988 988 // dual.canonicalize(); -
gfanlib/gfanlibtest.cpp
r412c61 r2bf04b 20 20 if(tab)s<<tab; 21 21 for(int j=0;j<m.getWidth();j++) 22 23 24 25 26 27 28 22 { 23 s<<m[i][j]; 24 if(i+1!=m.getHeight() || j+1!=m.getWidth()) 25 { 26 s<<","; 27 } 28 } 29 29 s<<endl; 30 30 } … … 40 40 if(tab)s<<tab; 41 41 for(int j=0;j<m.getWidth();j++) 42 43 44 45 46 47 48 49 50 51 52 42 { 43 stringstream temp; 44 temp<<m[i][j]; 45 string temp2=temp.str(); 46 for(int k=temp2.size();k<fieldWidth;k++)s<<" "; 47 s<<temp2; 48 if(i+1!=m.getHeight() || j+1!=m.getWidth()) 49 { 50 s<<" "; 51 } 52 } 53 53 s<<endl; 54 54 } -
kernel/GBEngine/kstd1.h
r412c61 r2bf04b 37 37 38 38 ideal kStdShift(ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp, 39 39 int newIdeal, intvec *vw, int uptodeg, int lVblock); 40 40 41 41 /* the following global data are defined in kutil.cc */ -
kernel/GBEngine/tgb_internal.h
r412c61 r2bf04b 1570 1570 { 1571 1571 if (row_array[i]!=zero) 1572 1572 { STATISTIC(n_Sub); 1573 1573 other_row_array[i]=F4mat_to_number_type(npSubM((number)(long) other_row_array[i], (number)(long) row_array[i],currRing->cf)); 1574 1574 } 1575 1575 1576 1576 } … … 1582 1582 { 1583 1583 if (row_array[i]!=zero) 1584 1584 { STATISTIC(n_Add); 1585 1585 other_row_array[i]=F4mat_to_number_type(npAddM(npMult(coef2,(number)(long) row_array[i],currRing->cf),(number)(long) other_row_array[i],currRing->cf)); 1586 1586 } 1587 1587 1588 1588 } … … 1733 1733 { 1734 1734 if (row_array[i]!=zero) 1735 1736 1735 { 1736 STATISTIC(n_Add); 1737 1737 other_row_array[i]=F4mat_to_number_type(npAddM(npMult(coef,(number)(long)row_array[i],currRing->cf),(number)(long)other_row_array[i],currRing->cf)); 1738 1738 } 1739 1739 } 1740 1740 updateLastReducibleIndex(other_row,r); … … 1854 1854 { 1855 1855 for(i=0;i<len;i++) 1856 1856 { 1857 1857 int idx=old_to_new_indices[idx_array[i]]; 1858 1858 row[idx]=F4mat_to_number_type(coef_array[i]); … … 1862 1862 { 1863 1863 for(i=0;i<len;i++) 1864 1864 { 1865 1865 row[old_to_new_indices[i]]=F4mat_to_number_type(coef_array[i]); 1866 1866 } -
kernel/combinatorics/hdegree.cc
r412c61 r2bf04b 1014 1014 { 1015 1015 //consider just monic generators (over rings with zero-divisors) 1016 ideal SS=id_Copy(S,tailRing); 1016 ideal SS=id_Copy(S,tailRing); 1017 1017 for(i=0;i<=idElem(S);i++) 1018 1018 { 1019 1020 {1021 1022 1023 1024 1025 1019 if(p_IsPurePower(SS->m[i],tailRing)==0) 1020 { 1021 p_Delete(&SS->m[i],tailRing); 1022 } 1023 } 1024 S=id_Copy(SS,tailRing); 1025 idSkipZeroes(S); 1026 1026 } 1027 1027 #if 0 -
kernel/fglm/fglmcomb.cc
r412c61 r2bf04b 92 92 } 93 93 } 94 if ( best > 0 ) { 94 if ( best > 0 ) 95 { 95 96 // OwnSPoly 96 97 poly p2 = (source->m)[best-1]; … … 99 100 poly m = pOne(); 100 101 for ( i= (currRing->N); i > 0; i-- ) 101 102 { 102 103 diff= pGetExp( *pptr, i ) - pGetExp( p2, i ); 103 104 pSetExp( m, i, diff ); -
kernel/fglm/fglmhom.cc
r412c61 r2bf04b 72 72 void initialize( poly m, int b, BOOLEAN ind ) 73 73 { 74 75 76 77 74 basis = b; 75 inDest = ind; 76 mon.dm = m; 77 mon.sm = NULL; 78 78 } 79 79 void initialize( const homogElem h ) 80 80 { 81 82 83 84 81 basis = h.basis; 82 inDest = h.inDest; 83 mon.dm = h.mon.dm; 84 mon.sm = h.mon.sm; 85 85 } 86 86 #endif … … 167 167 int k; 168 168 #ifdef HAVE_EXPLICIT_CONSTR 169 169 // Expand array using Singulars ReAlloc function 170 170 dat->monlist= 171 172 173 171 (homogElem * )omReallocSize( dat->monlist, 172 (dat->monlistmax)*sizeof( homogElem ), 173 (dat->monlistmax+dat->monlistblock) * sizeof( homogElem ) ); 174 174 for ( k= dat->monlistmax; k < (dat->monlistmax+dat->monlistblock); k++ ) 175 175 dat->monlist[k].homogElem(); 176 176 #else 177 178 179 180 181 182 183 184 177 // Expand array by generating new one and copying 178 int newsize = dat->monlistmax + dat->monlistblock; 179 homogElem * tempelem = new homogElem[ newsize ]; 180 // Copy old elements 181 for ( k= dat->monlistmax - 1; k >= 0; k-- ) 182 tempelem[k].initialize( dat->monlist[k] ); 183 delete [] homogElem; 184 homogElem = tempelem; 185 185 #endif 186 186 dat->monlistmax+= dat->monlistblock; … … 189 189 dat->monlist[dat->numMonoms]= homogElem( mon, basis, inDest ); 190 190 #else 191 191 dat->monlist[dat->numMonoms].initialize( mon, basis, inDest ); 192 192 #endif 193 193 dat->numMonoms++; … … 388 388 for ( j= dat.monlistmax - 1; j >= 0; j-- ) dat.monlist[j].homogElem(); 389 389 #else 390 390 dat.monlist = new homogElem[ dat.monlistmax ]; 391 391 #endif 392 392 dat.numMonoms= 0; … … 417 417 omFreeSize( (ADDRESS)dat.monlist, dat.monlistmax*sizeof( homogElem ) ); 418 418 #else 419 419 delete [] dat.monlist; 420 420 #endif 421 421 PROT( "<\n" ); -
kernel/groebner_walk/walkProc.cc
r412c61 r2bf04b 94 94 { 95 95 snames=sring->cf->extRing->names; 96 96 dnames=dring->cf->extRing->names; 97 97 pperm= (int *)omAlloc0( (npar+1)*sizeof( int ) ); 98 98 } … … 100 100 { 101 101 snames=NULL; 102 102 dnames=NULL; 103 103 pperm= NULL; 104 104 } … … 264 264 { 265 265 snames=sring->cf->extRing->names; 266 266 dnames=dring->cf->extRing->names; 267 267 pperm= (int *)omAlloc0( (npar+1)*sizeof( int ) ); 268 268 } … … 270 270 { 271 271 pperm= NULL; 272 273 272 snames=NULL; 273 dnames=NULL; 274 274 } 275 275 -
kernel/numeric/mpr_numeric.cc
r412c61 r2bf04b 936 936 WarnS("rootArranger::arrange: precision lost"); 937 937 mprec*=10; 938 938 } 939 939 } while(!found); 940 940 #if 0 -
kernel/numeric/mpr_numeric.h
r412c61 r2bf04b 30 30 public: 31 31 vandermonde( const long _cn, const long _n, 32 32 const long _maxdeg, number *_p, const bool _homog = true ); 33 33 ~vandermonde(); 34 34 … … 72 72 73 73 void fillContainer( number *_coeffs, number *_ievpoint, 74 75 74 const int _var, const int _tdg, 75 const rootType _rt, const int _anz ); 76 76 77 77 bool solver( const int polishmode= PM_NONE ); … … 153 153 154 154 rootArranger( rootContainer ** _roots, 155 156 155 rootContainer ** _mu, 156 const int _howclean = PM_CORRUPT ); 157 157 ~rootArranger() {} 158 158 -
kernel/old/old.IIntvec.h
r412c61 r2bf04b 6 6 public: 7 7 Intvec(iterator first, 8 9 8 iterator last, 9 const allocator_type& __a = allocator_type()): 10 10 std::vector<int>(first,last,__a){ 11 11 } -
libpolys/misc/options.c
r412c61 r2bf04b 6 6 unsigned si_opt_2 = Sy_bit(V_QUIET) 7 7 //| Sy_bit(V_QRING) // not default, as speed drops by 10 % 8 9 10 11 12 8 | Sy_bit(V_REDEFINE) 9 | Sy_bit(V_LOAD_LIB) 10 | Sy_bit(V_SHOW_USE) 11 | Sy_bit(V_PROMPT) 12 ; 13 13 -
libpolys/polys/monomials/p_polys.cc
r412c61 r2bf04b 2544 2544 d=pGetCoeff(ph); 2545 2545 s=ns; 2546 2546 if (s2<=3) break; 2547 2547 } 2548 2548 else if (ns<s) -
libpolys/polys/nc/ncSAFormula.cc
r412c61 r2bf04b 276 276 return p; 277 277 278 } // 278 } // return ncSA_1xy0x0y0(GetI(), GetJ(), expRight, expLeft, r); 279 279 /////////////////////////////////////////////////////////////////////////////////////////// 280 280 static inline poly ncSA_Mxy0x0y0(const int i, const int j, const int n, const int m, const ring r) … … 296 296 return p; 297 297 298 } // 298 } // return ncSA_Mxy0x0y0(GetI(), GetJ(), expRight, expLeft, r); 299 299 /////////////////////////////////////////////////////////////////////////////////////////// 300 300 static inline poly ncSA_Qxy0x0y0(const int i, const int j, const int n, const int m, const number m_q, const ring r) … … 345 345 return p; 346 346 347 } // 347 } // return ncSA_Qxy0x0y0(GetI(), GetJ(), expRight, expLeft, m_q, r); 348 348 /////////////////////////////////////////////////////////////////////////////////////////// 349 349 static inline poly ncSA_1xy0x0yG(const int i, const int j, const int n, const int m, const number m_g, const ring r) -
libpolys/polys/nc/ncSAMult.cc
r412c61 r2bf04b 554 554 /////////////////////////////////////////////////////////////////////////////////////////// 555 555 CAntiCommutativeSpecialPairMultiplier::CAntiCommutativeSpecialPairMultiplier(ring r, int i, int j): 556 557 { 558 #if OUTPUT 559 560 556 CSpecialPairMultiplier(r, i, j) 557 { 558 #if OUTPUT 559 Print("CAntiCommutativeSpecialPairMultiplier::CAntiCommutativeSpecialPairMultiplier(ring, i: %d, j: %d)!", i, j); 560 PrintLn(); 561 561 #endif 562 562 } … … 566 566 { 567 567 #if OUTPUT 568 569 568 PrintS("CAntiCommutativeSpecialPairMultiplier::~CAntiCommutativeSpecialPairMultiplier()"); 569 PrintLn(); 570 570 #endif 571 571 } … … 575 575 { 576 576 #if OUTPUT 577 578 579 #endif 580 581 582 583 577 Print("CAntiCommutativeSpecialPairMultiplier::MultiplyEE(var(%d)^{%d}, var(%d)^{%d})!", GetJ(), expLeft, GetI(), expRight); 578 PrintLn(); 579 #endif 580 581 const ring r = GetBasering(); 582 583 return CFormulaPowerMultiplier::ncSA_Mxy0x0y0(GetI(), GetJ(), expRight, expLeft, r); 584 584 } 585 585 586 586 /////////////////////////////////////////////////////////////////////////////////////////// 587 587 CQuasiCommutativeSpecialPairMultiplier::CQuasiCommutativeSpecialPairMultiplier(ring r, int i, int j, number q): 588 589 { 590 #if OUTPUT 591 592 593 594 588 CSpecialPairMultiplier(r, i, j), m_q(q) 589 { 590 #if OUTPUT 591 Print("CQuasiCommutativeSpecialPairMultiplier::CQuasiCommutativeSpecialPairMultiplier(ring, i: %d, j: %d, q)!", i, j); 592 PrintLn(); 593 PrintS("Parameter q: "); 594 n_Write(q, r); 595 595 #endif 596 596 } … … 600 600 { 601 601 #if OUTPUT 602 603 602 PrintS("CQuasiCommutativeSpecialPairMultiplier::~CQuasiCommutativeSpecialPairMultiplier()"); 603 PrintLn(); 604 604 #endif 605 605 } … … 609 609 { 610 610 #if OUTPUT 611 612 613 #endif 614 615 616 617 611 Print("CQuasiCommutativeSpecialPairMultiplier::MultiplyEE(var(%d)^{%d}, var(%d)^{%d})!", GetJ(), expLeft, GetI(), expRight); 612 PrintLn(); 613 #endif 614 615 const ring r = GetBasering(); 616 617 return CFormulaPowerMultiplier::ncSA_Qxy0x0y0(GetI(), GetJ(), expRight, expLeft, m_q, r); 618 618 } 619 619 -
libpolys/polys/nc/ncSAMult.h
r412c61 r2bf04b 505 505 class CCommutativeSpecialPairMultiplier: public CSpecialPairMultiplier 506 506 { 507 508 509 510 511 512 507 public: 508 CCommutativeSpecialPairMultiplier(ring r, int i, int j); 509 virtual ~CCommutativeSpecialPairMultiplier(); 510 511 // Exponent * Exponent 512 virtual poly MultiplyEE(const int expLeft, const int expRight); 513 513 }; 514 514 … … 516 516 class CAntiCommutativeSpecialPairMultiplier: public CSpecialPairMultiplier 517 517 { 518 519 520 521 522 523 518 public: 519 CAntiCommutativeSpecialPairMultiplier(ring r, int i, int j); 520 virtual ~CAntiCommutativeSpecialPairMultiplier(); 521 522 // Exponent * Exponent 523 virtual poly MultiplyEE(const int expLeft, const int expRight); 524 524 }; 525 525 … … 528 528 class CQuasiCommutativeSpecialPairMultiplier: public CSpecialPairMultiplier 529 529 { 530 531 532 533 534 public: 535 536 537 538 539 530 private: 531 const number m_q; 532 // TODO: make cache for some 'good' powers!? 533 534 public: 535 CQuasiCommutativeSpecialPairMultiplier(ring r, int i, int j, number q); 536 virtual ~CQuasiCommutativeSpecialPairMultiplier(); 537 538 // Exponent * Exponent 539 virtual poly MultiplyEE(const int expLeft, const int expRight); 540 540 }; 541 541 -
libpolys/polys/nc/old.gring.cc
r412c61 r2bf04b 2711 2711 if ( p != NULL) 2712 2712 { 2713 2714 2715 2716 2717 2718 2719 2713 q = p_One(r); 2714 p_SetExp(q,i,1,r); 2715 p_SetExp(q,j,1,r); 2716 p_Setm(q,r); 2717 if (p_LmCmp(q,p,r) != 1) /* i.e. lm(p)==xy < lm(q)==D_ij */ 2718 { 2719 Werror("Bad ordering at %d,%d\n",i,j); 2720 2720 #if 0 /*Singularg should not differ from Singular except in error case*/ 2721 2721 p_Write(p,r); 2722 2722 p_Write(q,r); 2723 2723 #endif 2724 2725 2726 2727 2728 2724 report = 1; 2725 } 2726 p_Delete(&q,r); 2727 p_Delete(&p,r); 2728 p = NULL; 2729 2729 } 2730 2730 } … … 2931 2931 qN = NULL; 2932 2932 else 2933 2934 2933 { 2934 if (!p_IsConstant(MATELEM(CC,i,j),curr)) 2935 2935 { 2936 2936 Werror("Incorrect input : non-constants are not allowed as coefficients (first argument at [%d, %d])", i, j); 2937 2937 return TRUE; 2938 2938 } 2939 2939 assume(p_IsConstant(MATELEM(CC,i,j),curr)); 2940 2940 qN = p_GetCoeff(MATELEM(CC,i,j),curr); 2941 2941 } 2942 2942 2943 2943 … … 3306 3306 for (i=n+1; i<=rN; i++) 3307 3307 { 3308 3309 3308 SUF[i] = PRE[i]; 3309 PRE[i] = 0; 3310 3310 } 3311 3311 res = p_Power(p_Copy(e, r),pow, r); -
libpolys/polys/templates/p_kBucketSetLm__T.cc
r412c61 r2bf04b 161 161 { 162 162 if(p_LmEqual(bucket->buckets[i], copy,r)) 163 163 { 164 164 poly q=kBucketExtractLmOfBucket(bucket,i); 165 165 assume(p!=q); -
libpolys/reporter/si_signals.h
r412c61 r2bf04b 29 29 static inline return_type newfunc decl \ 30 30 { \ 31 int res = -1; 31 int res = -1; \ 32 32 do \ 33 33 { \ 34 res = func args; 34 res = func args; \ 35 35 } while((res err_domain) && (errno == EINTR));\ 36 36 return res; \ … … 122 122 SI_EINTR_SAVE_FUNC(int, dup2, (int oldfd, int newfd), (oldfd, newfd)) 123 123 //SI_EINTR_SAVE_FUNC(int, dup3, (int oldfd, int newfd, int flags), 124 // 124 // (oldfd, newfd, flags)) 125 125 126 126 SI_EINTR_SAVE_FUNC(int, unlink, (const char *pathname), (pathname)) 127 127 128 128 SI_EINTR_SAVE_SCANF(int, vscanf, 129 130 129 (const char *format, va_list ap), 130 (format, ap)) 131 131 132 132 static inline … … 141 141 142 142 SI_EINTR_SAVE_SCANF(int, vfscanf, 143 144 143 (FILE *stream, const char *format, va_list ap), 144 (stream, format, ap)) 145 145 146 146 static inline int … … 155 155 156 156 SI_EINTR_SAVE_SCANF(int, vsscanf, 157 158 157 (const char *str, const char *format, va_list ap), 158 (str, format, ap)) 159 159 160 160 static inline int -
libpolys/tests/cxxtest/Win32Gui.h
r412c61 r2bf04b 29 29 public: 30 30 void enterGui( int &argc, char **argv ) 31 32 33 31 { 32 parseCommandLine( argc, argv ); 33 } 34 34 35 35 void enterWorld( const WorldDescription &wd ) … … 40 40 } 41 41 42 43 44 42 void guiEnterSuite( const char *suiteName ) 43 { 44 showSuiteName( suiteName ); 45 45 reset( _suiteStart ); 46 46 } 47 47 48 48 void guiEnterTest( const char *suiteName, const char *testName ) … … 51 51 setTestCaption( suiteName, testName ); 52 52 showTestName( testName ); 53 53 showTestsDone(); 54 54 progressBarMessage( PBM_STEPIT ); 55 55 reset( _testStart ); … … 58 58 void yellowBar() 59 59 { 60 60 setColor( 255, 255, 0 ); 61 61 setIcon( IDI_WARNING ); 62 62 getTotalTests(); … … 67 67 if ( _startMinimized ) 68 68 showMainWindow( SW_SHOWNORMAL ); 69 70 69 setColor( 255, 0, 0 ); 70 setIcon( IDI_ERROR ); 71 71 getTotalTests(); 72 72 } … … 107 107 { 108 108 _startMinimized = _keep = false; 109 109 _title = argv[0]; 110 110 111 111 for ( int i = 1; i < argc; ++ i ) … … 134 134 { 135 135 _canStartTests = CreateEvent( NULL, TRUE, FALSE, NULL ); 136 136 DWORD threadId; 137 137 _gui = CreateThread( NULL, 0, &(Win32Gui::guiThread), (LPVOID)this, 0, &threadId ); 138 138 WaitForSingleObject( _canStartTests, INFINITE ); … … 187 187 HMODULE dll = LoadLibraryA( "comctl32.dll" ); 188 188 if ( !dll ) 189 return;190 191 typedef void (WINAPI *FUNC)( void );192 FUNC func = (FUNC)GetProcAddress( dll, "InitCommonControls" );193 if ( !func )194 189 return; 195 190 196 func(); 191 typedef void (WINAPI *FUNC)( void ); 192 FUNC func = (FUNC)GetProcAddress( dll, "InitCommonControls" ); 193 if ( !func ) 194 return; 195 196 func(); 197 197 } 198 198 … … 204 204 progressBarMessage( PBM_SETRANGE32, 0, _numTotalTests ); 205 205 #else // No PBM_SETRANGE32, use PBM_SETRANGE 206 206 progressBarMessage( PBM_SETRANGE, 0, MAKELPARAM( 0, (WORD)_numTotalTests ) ); 207 207 #endif // PBM_SETRANGE32 208 208 progressBarMessage( PBM_SETPOS, 0 ); … … 433 433 { 434 434 setStatusPart( STATUS_SUITE_NAME, suiteName ); 435 436 437 438 435 } 436 437 void showTestName( const char *testName ) 438 { 439 439 setStatusPart( STATUS_TEST_NAME, testName ); 440 441 442 443 440 } 441 442 void showTestsDone() 443 { 444 444 wsprintfA( _statusTestsDone, "%u of %s (%u%%)", 445 445 _testsDone, _strTotalTests, -
old_modgen/modgen/getopt.c
r412c61 r2bf04b 4 4 before changing it! 5 5 Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001 6 6 Free Software Foundation, Inc. 7 7 This file is part of the GNU C Library. 8 8 … … 66 66 /* This needs to come after some library #include 67 67 to get __GNU_LIBRARY__ defined. */ 68 #ifdef 68 #ifdef __GNU_LIBRARY__ 69 69 /* Don't include stdlib.h for non-GNU C libraries because some of them 70 70 contain conflicting prototypes for getopt. */ 71 71 # include <stdlib.h> 72 72 # include <unistd.h> 73 #endif 73 #endif /* GNU C library. */ 74 74 75 75 #ifdef VMS … … 85 85 # include <libintl.h> 86 86 # ifndef _ 87 # define _(msgid) 87 # define _(msgid) gettext (msgid) 88 88 # endif 89 89 # else 90 # define _(msgid) 90 # define _(msgid) (msgid) 91 91 # endif 92 92 #endif … … 195 195 196 196 197 #ifdef 197 #ifdef __GNU_LIBRARY__ 198 198 /* We want to avoid inclusion of string.h with non-GNU libraries 199 199 because there are many ways it can cause trouble. … … 201 201 in GCC. */ 202 202 # include <string.h> 203 # define my_index 203 # define my_index strchr 204 204 #else 205 205 … … 225 225 { 226 226 if (*str == chr) 227 227 return (char *) str; 228 228 str++; 229 229 } … … 275 275 # ifdef USE_NONOPTION_FLAGS 276 276 # define SWAP_FLAGS(ch1, ch2) \ 277 if (nonoption_flags_len > 0) 278 { 279 char __tmp = __getopt_nonoption_flags[ch1]; 280 __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; 281 __getopt_nonoption_flags[ch2] = __tmp; 277 if (nonoption_flags_len > 0) \ 278 { \ 279 char __tmp = __getopt_nonoption_flags[ch1]; \ 280 __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ 281 __getopt_nonoption_flags[ch2] = __tmp; \ 282 282 } 283 283 # else 284 284 # define SWAP_FLAGS(ch1, ch2) 285 285 # endif 286 #else 286 #else /* !_LIBC */ 287 287 # define SWAP_FLAGS(ch1, ch2) 288 #endif 288 #endif /* _LIBC */ 289 289 290 290 /* Exchange two adjacent subsequences of ARGV. … … 322 322 { 323 323 /* We must extend the array. The user plays games with us and 324 324 presents new arguments. */ 325 325 char *new_str = malloc (top + 1); 326 326 if (new_str == NULL) 327 327 nonoption_flags_len = nonoption_flags_max_len = 0; 328 328 else 329 330 331 332 333 334 335 329 { 330 memset (__mempcpy (new_str, __getopt_nonoption_flags, 331 nonoption_flags_max_len), 332 '\0', top + 1 - nonoption_flags_max_len); 333 nonoption_flags_max_len = top + 1; 334 __getopt_nonoption_flags = new_str; 335 } 336 336 } 337 337 #endif … … 340 340 { 341 341 if (top - middle > middle - bottom) 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 342 { 343 /* Bottom segment is the short one. */ 344 int len = middle - bottom; 345 register int i; 346 347 /* Swap it with the top part of the top segment. */ 348 for (i = 0; i < len; i++) 349 { 350 tem = argv[bottom + i]; 351 argv[bottom + i] = argv[top - (middle - bottom) + i]; 352 argv[top - (middle - bottom) + i] = tem; 353 SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); 354 } 355 /* Exclude the moved bottom segment from further swapping. */ 356 top -= len; 357 } 358 358 else 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 359 { 360 /* Top segment is the short one. */ 361 int len = top - middle; 362 register int i; 363 364 /* Swap it with the bottom part of the bottom segment. */ 365 for (i = 0; i < len; i++) 366 { 367 tem = argv[bottom + i]; 368 argv[bottom + i] = argv[middle + i]; 369 argv[middle + i] = tem; 370 SWAP_FLAGS (bottom + i, middle + i); 371 } 372 /* Exclude the moved top segment from further swapping. */ 373 bottom += len; 374 } 375 375 } 376 376 … … 424 424 { 425 425 if (nonoption_flags_max_len == 0) 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 426 { 427 if (__getopt_nonoption_flags == NULL 428 || __getopt_nonoption_flags[0] == '\0') 429 nonoption_flags_max_len = -1; 430 else 431 { 432 const char *orig_str = __getopt_nonoption_flags; 433 int len = nonoption_flags_max_len = strlen (orig_str); 434 if (nonoption_flags_max_len < argc) 435 nonoption_flags_max_len = argc; 436 __getopt_nonoption_flags = 437 (char *) malloc (nonoption_flags_max_len); 438 if (__getopt_nonoption_flags == NULL) 439 nonoption_flags_max_len = -1; 440 else 441 memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), 442 '\0', nonoption_flags_max_len - len); 443 } 444 } 445 445 nonoption_flags_len = nonoption_flags_max_len; 446 446 } … … 530 530 { 531 531 if (optind == 0) 532 optind = 1;/* Don't scan ARGV[0], the program name. */532 optind = 1; /* Don't scan ARGV[0], the program name. */ 533 533 optstring = _getopt_initialize (argc, argv, optstring); 534 534 __getopt_initialized = 1; … … 540 540 is only used when the used in the GNU libc. */ 541 541 #if defined _LIBC && defined USE_NONOPTION_FLAGS 542 # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' 543 || (optind < nonoption_flags_len\544 542 # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ 543 || (optind < nonoption_flags_len \ 544 && __getopt_nonoption_flags[optind] == '1')) 545 545 #else 546 546 # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') … … 552 552 553 553 /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been 554 554 moved back by the user (who may also have changed the arguments). */ 555 555 if (last_nonopt > optind) 556 556 last_nonopt = optind; 557 557 if (first_nonopt > optind) 558 558 first_nonopt = optind; 559 559 560 560 if (ordering == PERMUTE) 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 561 { 562 /* If we have just processed some options following some non-options, 563 exchange them so that the options come first. */ 564 565 if (first_nonopt != last_nonopt && last_nonopt != optind) 566 exchange ((char **) argv); 567 else if (last_nonopt != optind) 568 first_nonopt = optind; 569 570 /* Skip any additional non-options 571 and extend the range of non-options previously skipped. */ 572 573 while (optind < argc && NONOPTION_P) 574 optind++; 575 last_nonopt = optind; 576 } 577 577 578 578 /* The special ARGV-element `--' means premature end of options. 579 580 581 579 Skip it like a null option, 580 then exchange with previous non-options as if it were an option, 581 then skip everything else like a non-option. */ 582 582 583 583 if (optind != argc && !strcmp (argv[optind], "--")) 584 585 586 587 588 589 590 591 592 593 594 584 { 585 optind++; 586 587 if (first_nonopt != last_nonopt && last_nonopt != optind) 588 exchange ((char **) argv); 589 else if (first_nonopt == last_nonopt) 590 first_nonopt = optind; 591 last_nonopt = argc; 592 593 optind = argc; 594 } 595 595 596 596 /* If we have done all the ARGV-elements, stop the scan 597 597 and back over any non-options that we skipped and permuted. */ 598 598 599 599 if (optind == argc) 600 601 602 603 604 605 606 600 { 601 /* Set the next-arg-index to point at the non-options 602 that we previously skipped, so the caller will digest them. */ 603 if (first_nonopt != last_nonopt) 604 optind = first_nonopt; 605 return -1; 606 } 607 607 608 608 /* If we have come to a non-option and did not permute it, 609 609 either stop the scan or describe it to the caller and pass it by. */ 610 610 611 611 if (NONOPTION_P) 612 613 614 615 616 617 612 { 613 if (ordering == REQUIRE_ORDER) 614 return -1; 615 optarg = argv[optind++]; 616 return 1; 617 } 618 618 619 619 /* We have found another option-ARGV-element. 620 620 Skip the initial punctuation. */ 621 621 622 622 nextchar = (argv[optind] + 1 623 623 + (longopts != NULL && argv[optind][1] == '-')); 624 624 } 625 625 … … 641 641 if (longopts != NULL 642 642 && (argv[optind][1] == '-' 643 643 || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) 644 644 { 645 645 char *nameend; … … 652 652 653 653 for (nameend = nextchar; *nameend && *nameend != '='; nameend++) 654 654 /* Do nothing. */ ; 655 655 656 656 /* Test all long options for either exact match 657 657 or abbreviated matches. */ 658 658 for (p = longopts, option_index = 0; p->name; p++, option_index++) 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 659 if (!strncmp (p->name, nextchar, nameend - nextchar)) 660 { 661 if ((unsigned int) (nameend - nextchar) 662 == (unsigned int) strlen (p->name)) 663 { 664 /* Exact match found. */ 665 pfound = p; 666 indfound = option_index; 667 exact = 1; 668 break; 669 } 670 else if (pfound == NULL) 671 { 672 /* First nonexact match found. */ 673 pfound = p; 674 indfound = option_index; 675 } 676 else if (long_only 677 || pfound->has_arg != p->has_arg 678 || pfound->flag != p->flag 679 || pfound->val != p->val) 680 /* Second or later nonexact match found. */ 681 ambig = 1; 682 } 683 683 684 684 if (ambig && !exact) 685 686 687 688 689 690 691 692 693 685 { 686 if (print_errors) 687 fprintf (stderr, _("%s: option `%s' is ambiguous\n"), 688 argv[0], argv[optind]); 689 nextchar += strlen (nextchar); 690 optind++; 691 optopt = 0; 692 return '?'; 693 } 694 694 695 695 if (pfound != NULL) 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 696 { 697 option_index = indfound; 698 optind++; 699 if (*nameend) 700 { 701 /* Don't test has_arg with >, because some C compilers don't 702 allow it to be used on enums. */ 703 if (pfound->has_arg) 704 optarg = nameend + 1; 705 else 706 { 707 if (print_errors) 708 { 709 if (argv[optind - 1][1] == '-') 710 /* --option */ 711 fprintf (stderr, 712 _("%s: option `--%s' doesn't allow an argument\n"), 713 argv[0], pfound->name); 714 else 715 /* +option or -option */ 716 fprintf (stderr, 717 _("%s: option `%c%s' doesn't allow an argument\n"), 718 argv[0], argv[optind - 1][0], pfound->name); 719 } 720 721 nextchar += strlen (nextchar); 722 723 optopt = pfound->val; 724 return '?'; 725 } 726 } 727 else if (pfound->has_arg == 1) 728 { 729 if (optind < argc) 730 optarg = argv[optind++]; 731 else 732 { 733 if (print_errors) 734 fprintf (stderr, 735 _("%s: option `%s' requires an argument\n"), 736 argv[0], argv[optind - 1]); 737 nextchar += strlen (nextchar); 738 optopt = pfound->val; 739 return optstring[0] == ':' ? ':' : '?'; 740 } 741 } 742 nextchar += strlen (nextchar); 743 if (longind != NULL) 744 *longind = option_index; 745 if (pfound->flag) 746 { 747 *(pfound->flag) = pfound->val; 748 return 0; 749 } 750 return pfound->val; 751 } 752 752 753 753 /* Can't find it as a long option. If this is not getopt_long_only, 754 755 756 754 or the option starts with '--' or is not a valid short 755 option, then it's an error. 756 Otherwise interpret it as a short option. */ 757 757 if (!long_only || argv[optind][1] == '-' 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 758 || my_index (optstring, *nextchar) == NULL) 759 { 760 if (print_errors) 761 { 762 if (argv[optind][1] == '-') 763 /* --option */ 764 fprintf (stderr, _("%s: unrecognized option `--%s'\n"), 765 argv[0], nextchar); 766 else 767 /* +option or -option */ 768 fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), 769 argv[0], argv[optind][0], nextchar); 770 } 771 nextchar = (char *) ""; 772 optind++; 773 optopt = 0; 774 return '?'; 775 } 776 776 } 777 777 … … 788 788 if (temp == NULL || c == ':') 789 789 { 790 791 792 793 794 795 796 797 798 799 800 801 790 if (print_errors) 791 { 792 if (posixly_correct) 793 /* 1003.2 specifies the format of this message. */ 794 fprintf (stderr, _("%s: illegal option -- %c\n"), 795 argv[0], c); 796 else 797 fprintf (stderr, _("%s: invalid option -- %c\n"), 798 argv[0], c); 799 } 800 optopt = c; 801 return '?'; 802 802 } 803 803 /* Convenience. Treat POSIX -W foo same as long option --foo */ 804 804 if (temp[0] == 'W' && temp[1] == ';') 805 805 { 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 806 char *nameend; 807 const struct option *p; 808 const struct option *pfound = NULL; 809 int exact = 0; 810 int ambig = 0; 811 int indfound = 0; 812 int option_index; 813 814 /* This is an option that requires an argument. */ 815 if (*nextchar != '\0') 816 { 817 optarg = nextchar; 818 /* If we end this ARGV-element by taking the rest as an arg, 819 we must advance to the next element now. */ 820 optind++; 821 } 822 else if (optind == argc) 823 { 824 if (print_errors) 825 { 826 /* 1003.2 specifies the format of this message. */ 827 fprintf (stderr, _("%s: option requires an argument -- %c\n"), 828 argv[0], c); 829 } 830 optopt = c; 831 if (optstring[0] == ':') 832 c = ':'; 833 else 834 c = '?'; 835 return c; 836 } 837 else 838 /* We already incremented `optind' once; 839 increment it again when taking next ARGV-elt as argument. */ 840 optarg = argv[optind++]; 841 842 /* optarg is now the argument, see if it's in the 843 table of longopts. */ 844 845 for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) 846 /* Do nothing. */ ; 847 848 /* Test all long options for either exact match 849 or abbreviated matches. */ 850 for (p = longopts, option_index = 0; p->name; p++, option_index++) 851 if (!strncmp (p->name, nextchar, nameend - nextchar)) 852 { 853 if ((unsigned int) (nameend - nextchar) == strlen (p->name)) 854 { 855 /* Exact match found. */ 856 pfound = p; 857 indfound = option_index; 858 exact = 1; 859 break; 860 } 861 else if (pfound == NULL) 862 { 863 /* First nonexact match found. */ 864 pfound = p; 865 indfound = option_index; 866 } 867 else 868 /* Second or later nonexact match found. */ 869 ambig = 1; 870 } 871 if (ambig && !exact) 872 { 873 if (print_errors) 874 fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), 875 argv[0], argv[optind]); 876 nextchar += strlen (nextchar); 877 optind++; 878 return '?'; 879 } 880 if (pfound != NULL) 881 { 882 option_index = indfound; 883 if (*nameend) 884 { 885 /* Don't test has_arg with >, because some C compilers don't 886 allow it to be used on enums. */ 887 if (pfound->has_arg) 888 optarg = nameend + 1; 889 else 890 { 891 if (print_errors) 892 fprintf (stderr, _("\ 893 893 %s: option `-W %s' doesn't allow an argument\n"), 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 return 'W';/* Let the application handle it. */894 argv[0], pfound->name); 895 896 nextchar += strlen (nextchar); 897 return '?'; 898 } 899 } 900 else if (pfound->has_arg == 1) 901 { 902 if (optind < argc) 903 optarg = argv[optind++]; 904 else 905 { 906 if (print_errors) 907 fprintf (stderr, 908 _("%s: option `%s' requires an argument\n"), 909 argv[0], argv[optind - 1]); 910 nextchar += strlen (nextchar); 911 return optstring[0] == ':' ? ':' : '?'; 912 } 913 } 914 nextchar += strlen (nextchar); 915 if (longind != NULL) 916 *longind = option_index; 917 if (pfound->flag) 918 { 919 *(pfound->flag) = pfound->val; 920 return 0; 921 } 922 return pfound->val; 923 } 924 nextchar = NULL; 925 return 'W'; /* Let the application handle it. */ 926 926 } 927 927 if (temp[1] == ':') 928 928 { 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 929 if (temp[2] == ':') 930 { 931 /* This is an option that accepts an argument optionally. */ 932 if (*nextchar != '\0') 933 { 934 optarg = nextchar; 935 optind++; 936 } 937 else 938 optarg = NULL; 939 nextchar = NULL; 940 } 941 else 942 { 943 /* This is an option that requires an argument. */ 944 if (*nextchar != '\0') 945 { 946 optarg = nextchar; 947 /* If we end this ARGV-element by taking the rest as an arg, 948 we must advance to the next element now. */ 949 optind++; 950 } 951 else if (optind == argc) 952 { 953 if (print_errors) 954 { 955 /* 1003.2 specifies the format of this message. */ 956 fprintf (stderr, 957 _("%s: option requires an argument -- %c\n"), 958 argv[0], c); 959 } 960 optopt = c; 961 if (optstring[0] == ':') 962 c = ':'; 963 else 964 c = '?'; 965 } 966 else 967 /* We already incremented `optind' once; 968 increment it again when taking next ARGV-elt as argument. */ 969 optarg = argv[optind++]; 970 nextchar = NULL; 971 } 972 972 } 973 973 return c; … … 982 982 { 983 983 return _getopt_internal (argc, argv, optstring, 984 985 986 984 (const struct option *) 0, 985 (int *) 0, 986 0); 987 987 } 988 988 989 #endif 989 #endif /* Not ELIDE_CODE. */ 990 990 991 991 … … 1009 1009 c = getopt (argc, argv, "abc:d:0123456789"); 1010 1010 if (c == -1) 1011 1011 break; 1012 1012 1013 1013 switch (c) 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1014 { 1015 case '0': 1016 case '1': 1017 case '2': 1018 case '3': 1019 case '4': 1020 case '5': 1021 case '6': 1022 case '7': 1023 case '8': 1024 case '9': 1025 if (digit_optind != 0 && digit_optind != this_option_optind) 1026 printf ("digits occur in two different argv-elements.\n"); 1027 digit_optind = this_option_optind; 1028 printf ("option %c\n", c); 1029 break; 1030 1031 case 'a': 1032 printf ("option a\n"); 1033 break; 1034 1035 case 'b': 1036 printf ("option b\n"); 1037 break; 1038 1039 case 'c': 1040 printf ("option c with value `%s'\n", optarg); 1041 break; 1042 1043 case '?': 1044 break; 1045 1046 default: 1047 printf ("?? getopt returned character code 0%o ??\n", c); 1048 } 1049 1049 } 1050 1050 … … 1053 1053 printf ("non-option ARGV-elements: "); 1054 1054 while (optind < argc) 1055 1055 printf ("%s ", argv[optind++]); 1056 1056 printf ("\n"); 1057 1057 } -
old_modgen/modgen/main.cc
r412c61 r2bf04b 117 117 break; 118 118 default: 119 120 119 printf("\t-%c (--%s) %s\n", long_options[i].val, 120 long_options[i].name, "<argument>"); 121 121 } 122 122 } else … … 147 147 case 'v' : trace=1; break; 148 148 case 'm' : do_create_makefile = 0; break; 149 150 149 case 'i' : inst_dir=optarg; break; 150 case 's' : do_create_srcdir = 0; break; 151 151 152 152