328{
330 int pid=getpid();
339 fprintf(outfile,
340 "/****************************************\n"
341 "* Computer Algebra System SINGULAR *\n"
342 "****************************************/\n\n");
343
344 fprintf(outfile,"// syntax table for Singular\n//\n");
345 fprintf(outfile,"// - search for an exact match of the argument types\n");
346 fprintf(outfile,"// - otherwise search for the first possibility\n");
347 fprintf(outfile,"// with converted types of the arguments\n");
348 fprintf(outfile,"// - otherwise report an error\n//\n");
349 fprintf(outfile,"// --------------------------------------------------\n");
350 fprintf(outfile,"// depends on Singular/table.h and kernel/mod2.h\n\n");
351
352 int op;
355 {
357 fprintf(outfile,"// DUMMY ");
359 fprintf(outfile,"// operation: %s (%s) -> %s",
364 fprintf(outfile," requires currRing");
366 fprintf(outfile,", commutative subalgebra");
368 fprintf(outfile,", letterplace rings");
370 fprintf(outfile,", only commutative rings");
372 fprintf(outfile,", field coeffs");
374 fprintf(outfile,", domain coeffs");
376 fprintf(outfile,", QQ coeffs");
378 fprintf(outfile,", field coeffs for non-global orderings");
379
380 fprintf(outfile,"\n");
382 }
383 fprintf(outfile,"/*---------------------------------------------*/\n");
386 {
388 fprintf(outfile,"// DUMMY ");
390 fprintf(outfile,"// operation: %s (%s, %s) -> %s",
398 {
399 fprintf(outfile," requires currRing");
400 }
402 fprintf(outfile,", commutative subalgebra");
404 fprintf(outfile,", only commutative rings");
406 fprintf(outfile,", field coeffs");
408 fprintf(outfile,", domain coeffs");
410 fprintf(outfile,", QQ coeffs");
411
412 fprintf(outfile,"\n");
414 }
415 fprintf(outfile,"/*---------------------------------------------*/\n");
418 {
421 fprintf(outfile,"// DUMMY ");
422 fprintf(outfile,"// operation: %s (%s, %s, %s) -> %s",
432 {
433 fprintf(outfile," requires currRing");
434 }
436 fprintf(outfile,", commutative subalgebra");
438 fprintf(outfile,", only commutative rings");
440 fprintf(outfile,", field coeffs");
442 fprintf(outfile,", domain coeffs");
444 fprintf(outfile,", QQ coeffs");
445
446 fprintf(outfile,"\n");
448 }
449 fprintf(outfile,"/*---------------------------------------------*/\n");
452 {
454 fprintf(outfile,"// operation: %s (...) -> %s",
458 {
459 case -2:
460 fprintf(outfile," ( number of arguments >0 )\n");
461 break;
462 case -1:
463 fprintf(outfile," ( any number of arguments )\n");
464 break;
465 default:
466 fprintf(outfile,
" ( %d arguments )\n",
dArithM[
i].number_of_args);
467 break;
468 }
470 }
471 fprintf(outfile,"/*---------------------------------------------*/\n");
474 {
475 fprintf(outfile,"// assign: %s = %s\n",
479 }
480
481 fprintf(outfile,"/*---------------------------------------------*/\n");
484 {
485 doctable=fopen("convert_table.texi","w");
486 fprintf(doctable,"@multitable @columnfractions .05 .18 .81\n");
487 }
488 int doc_nr=1;
490 {
492 {
495 {
496 fprintf(outfile,"// convert %s -> %s\n",
499 {
500 fprintf(doctable,
501 "@item\n@ %d. @tab @code{%s} @tab @expansion{} @code{%s}\n",
503 doc_nr++;
504 }
506 }
507 }
508 }
510 {
511 fprintf(doctable,"@end multitable\n");
512 fclose(doctable);
513 }
514 fprintf(outfile,"/*---------------------------------------------*/\n");
515 char ops[]="=><+*/[.^,%(;";
516 for(
i=0;ops[
i]!=
'\0';
i++)
517 fprintf(outfile,
"// token %d : %c\n", (
int)ops[
i], ops[
i]);
519 {
522 {
523 fprintf(outfile,
"// token %d : %s\n",
i,
s);
524 }
525 }
526
527 fprintf(outfile,
"/*--max. token: %d, gr: %d --*/\n",
MAX_TOK,
UMINUS);
528
529 fprintf(outfile,"/*---------------------------------------------*/\n");
530 fprintf(outfile,
531 "const struct sValCmdTab dArithTab1[]=\n"
532 "{\n");
534 {
536 {
538 {
539 fprintf(outfile,
" { %d,%d }, /* %s */\n",
j,
i,
iiTwoOps(
j));
540 l1++;
541 break;
542 }
543 }
544 }
545 fprintf(outfile," { 10000,0 }\n};\n");
546 fprintf(outfile,"#define JJTAB1LEN %d\n",l1);
547
548 fprintf(outfile,
549 "const struct sValCmdTab dArithTab2[]=\n"
550 "{\n");
552 {
554 {
556 {
557 fprintf(outfile,
" { %d,%d }, /* %s */\n",
j,
i,
iiTwoOps(
j));
558 l2++;
559 break;
560 }
561 }
562 }
563 fprintf(outfile," { 10000,0 }\n};\n");
564 fprintf(outfile,"#define JJTAB2LEN %d\n",l2);
565 fclose(outfile);
566}
int iiTestConvert(int inputType, int outputType)
const char * iiTwoOps(int t)
static int RingDependend(int t)
const struct sValCmd1 dArith1[]
const struct sValCmd2 dArith2[]
const struct sValCmdM dArithM[]
const struct sValCmd3 dArith3[]
const struct sValAssign dAssign[]