331{
333 int pid=getpid();
342 fprintf(outfile,
343 "/****************************************\n"
344 "* Computer Algebra System SINGULAR *\n"
345 "****************************************/\n\n");
346
347 fprintf(outfile,"// syntax table for Singular\n//\n");
348 fprintf(outfile,"// - search for an exact match of the argument types\n");
349 fprintf(outfile,"// - otherwise search for the first possibility\n");
350 fprintf(outfile,"// with converted types of the arguments\n");
351 fprintf(outfile,"// - otherwise report an error\n//\n");
352 fprintf(outfile,"// --------------------------------------------------\n");
353 fprintf(outfile,"// depends on Singular/table.h and kernel/mod2.h\n\n");
354
355 int op;
358 {
360 fprintf(outfile,"// DUMMY ");
362 fprintf(outfile,"// operation: %s (%s) -> %s",
367 fprintf(outfile," requires currRing");
369 fprintf(outfile,", commutative subalgebra");
371 fprintf(outfile,", letterplace rings");
373 fprintf(outfile,", only commutative rings");
375 fprintf(outfile,", field coeffs");
377 fprintf(outfile,", domain coeffs");
379 fprintf(outfile,", QQ coeffs");
380
381 fprintf(outfile,"\n");
383 }
384 fprintf(outfile,"/*---------------------------------------------*/\n");
387 {
389 fprintf(outfile,"// DUMMY ");
391 fprintf(outfile,"// operation: %s (%s, %s) -> %s",
399 {
400 fprintf(outfile," requires currRing");
401 }
403 fprintf(outfile,", commutative subalgebra");
405 fprintf(outfile,", only commutative rings");
407 fprintf(outfile,", field coeffs");
409 fprintf(outfile,", domain coeffs");
411 fprintf(outfile,", QQ coeffs");
412
413 fprintf(outfile,"\n");
415 }
416 fprintf(outfile,"/*---------------------------------------------*/\n");
419 {
422 fprintf(outfile,"// DUMMY ");
423 fprintf(outfile,"// operation: %s (%s, %s, %s) -> %s",
433 {
434 fprintf(outfile," requires currRing");
435 }
437 fprintf(outfile,", commutative subalgebra");
439 fprintf(outfile,", only commutative rings");
441 fprintf(outfile,", field coeffs");
443 fprintf(outfile,", domain coeffs");
445 fprintf(outfile,", QQ coeffs");
446
447 fprintf(outfile,"\n");
449 }
450 fprintf(outfile,"/*---------------------------------------------*/\n");
453 {
455 fprintf(outfile,"// operation: %s (...) -> %s",
459 {
460 case -2:
461 fprintf(outfile," ( number of arguments >0 )\n");
462 break;
463 case -1:
464 fprintf(outfile," ( any number of arguments )\n");
465 break;
466 default:
467 fprintf(outfile,
" ( %d arguments )\n",
dArithM[
i].number_of_args);
468 break;
469 }
471 }
472 fprintf(outfile,"/*---------------------------------------------*/\n");
475 {
476 fprintf(outfile,"// assign: %s = %s\n",
480 }
481
482 fprintf(outfile,"/*---------------------------------------------*/\n");
485 {
486 doctable=fopen("convert_table.texi","w");
487 fprintf(doctable,"@multitable @columnfractions .05 .18 .81\n");
488 }
489 int doc_nr=1;
491 {
493 {
496 {
497 fprintf(outfile,"// convert %s -> %s\n",
500 {
501 fprintf(doctable,
502 "@item\n@ %d. @tab @code{%s} @tab @expansion{} @code{%s}\n",
504 doc_nr++;
505 }
507 }
508 }
509 }
511 {
512 fprintf(doctable,"@end multitable\n");
513 fclose(doctable);
514 }
515 fprintf(outfile,"/*---------------------------------------------*/\n");
516 char ops[]="=><+*/[.^,%(;";
517 for(
i=0;ops[
i]!=
'\0';
i++)
518 fprintf(outfile,
"// token %d : %c\n", (
int)ops[
i], ops[
i]);
520 {
523 {
524 fprintf(outfile,
"// token %d : %s\n",
i,
s);
525 }
526 }
527
528 fprintf(outfile,
"/*--max. token: %d, gr: %d --*/\n",
MAX_TOK,
UMINUS);
529
530 fprintf(outfile,"/*---------------------------------------------*/\n");
531 fprintf(outfile,
532 "const struct sValCmdTab dArithTab1[]=\n"
533 "{\n");
535 {
537 {
539 {
540 fprintf(outfile,
" { %d,%d }, /* %s */\n",
j,
i,
iiTwoOps(
j));
541 l1++;
542 break;
543 }
544 }
545 }
546 fprintf(outfile," { 10000,0 }\n};\n");
547 fprintf(outfile,"#define JJTAB1LEN %d\n",l1);
548
549 fprintf(outfile,
550 "const struct sValCmdTab dArithTab2[]=\n"
551 "{\n");
553 {
555 {
557 {
558 fprintf(outfile,
" { %d,%d }, /* %s */\n",
j,
i,
iiTwoOps(
j));
559 l2++;
560 break;
561 }
562 }
563 }
564 fprintf(outfile," { 10000,0 }\n};\n");
565 fprintf(outfile,"#define JJTAB2LEN %d\n",l2);
566 fclose(outfile);
567}
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[]