326{
328 int pid=getpid();
337 fprintf(outfile,
338 "/****************************************\n"
339 "* Computer Algebra System SINGULAR *\n"
340 "****************************************/\n\n");
341
342 fprintf(outfile,"// syntax table for Singular\n//\n");
343 fprintf(outfile,"// - search for an exact match of the argument types\n");
344 fprintf(outfile,"// - otherwise search for the first possibility\n");
345 fprintf(outfile,"// with converted types of the arguments\n");
346 fprintf(outfile,"// - otherwise report an error\n//\n");
347 fprintf(outfile,"// --------------------------------------------------\n");
348 fprintf(outfile,"// depends on Singular/table.h and kernel/mod2.h\n\n");
349
350 int op;
353 {
355 fprintf(outfile,"// DUMMY ");
357 fprintf(outfile,"// operation: %s (%s) -> %s",
362 fprintf(outfile," requires currRing");
364 fprintf(outfile,", commutative subalgebra");
366 fprintf(outfile,", letterplace rings");
368 fprintf(outfile,", only commutative rings");
370 fprintf(outfile,", field coeffs");
372 fprintf(outfile,", domain coeffs");
374 fprintf(outfile,", QQ coeffs");
375
376 fprintf(outfile,"\n");
378 }
379 fprintf(outfile,"/*---------------------------------------------*/\n");
382 {
384 fprintf(outfile,"// DUMMY ");
386 fprintf(outfile,"// operation: %s (%s, %s) -> %s",
394 {
395 fprintf(outfile," requires currRing");
396 }
398 fprintf(outfile,", commutative subalgebra");
400 fprintf(outfile,", only commutative rings");
402 fprintf(outfile,", field coeffs");
404 fprintf(outfile,", domain coeffs");
406 fprintf(outfile,", QQ coeffs");
407
408 fprintf(outfile,"\n");
410 }
411 fprintf(outfile,"/*---------------------------------------------*/\n");
414 {
417 fprintf(outfile,"// DUMMY ");
418 fprintf(outfile,"// operation: %s (%s, %s, %s) -> %s",
428 {
429 fprintf(outfile," requires currRing");
430 }
432 fprintf(outfile,", commutative subalgebra");
434 fprintf(outfile,", only commutative rings");
436 fprintf(outfile,", field coeffs");
438 fprintf(outfile,", domain coeffs");
440 fprintf(outfile,", QQ coeffs");
441
442 fprintf(outfile,"\n");
444 }
445 fprintf(outfile,"/*---------------------------------------------*/\n");
448 {
450 fprintf(outfile,"// operation: %s (...) -> %s",
454 {
455 case -2:
456 fprintf(outfile," ( number of arguments >0 )\n");
457 break;
458 case -1:
459 fprintf(outfile," ( any number of arguments )\n");
460 break;
461 default:
462 fprintf(outfile,
" ( %d arguments )\n",
dArithM[
i].number_of_args);
463 break;
464 }
466 }
467 fprintf(outfile,"/*---------------------------------------------*/\n");
470 {
471 fprintf(outfile,"// assign: %s = %s\n",
475 }
476
477 fprintf(outfile,"/*---------------------------------------------*/\n");
480 {
481 doctable=fopen("convert_table.texi","w");
482 fprintf(doctable,"@multitable @columnfractions .05 .18 .81\n");
483 }
484 int doc_nr=1;
486 {
488 {
491 {
492 fprintf(outfile,"// convert %s -> %s\n",
495 {
496 fprintf(doctable,
497 "@item\n@ %d. @tab @code{%s} @tab @expansion{} @code{%s}\n",
499 doc_nr++;
500 }
502 }
503 }
504 }
506 {
507 fprintf(doctable,"@end multitable\n");
508 fclose(doctable);
509 }
510 fprintf(outfile,"/*---------------------------------------------*/\n");
511 char ops[]="=><+*/[.^,%(;";
512 for(
i=0;ops[
i]!=
'\0';
i++)
513 fprintf(outfile,
"// token %d : %c\n", (
int)ops[
i], ops[
i]);
515 {
518 {
519 fprintf(outfile,
"// token %d : %s\n",
i,
s);
520 }
521 }
522
523 fprintf(outfile,
"/*--max. token: %d, gr: %d --*/\n",
MAX_TOK,
UMINUS);
524
525 fprintf(outfile,"/*---------------------------------------------*/\n");
526 fprintf(outfile,
527 "const struct sValCmdTab dArithTab1[]=\n"
528 "{\n");
530 {
532 {
534 {
535 fprintf(outfile,
" { %d,%d }, /* %s */\n",
j,
i,
iiTwoOps(
j));
536 l1++;
537 break;
538 }
539 }
540 }
541 fprintf(outfile," { 10000,0 }\n};\n");
542 fprintf(outfile,"#define JJTAB1LEN %d\n",l1);
543
544 fprintf(outfile,
545 "const struct sValCmdTab dArithTab2[]=\n"
546 "{\n");
548 {
550 {
552 {
553 fprintf(outfile,
" { %d,%d }, /* %s */\n",
j,
i,
iiTwoOps(
j));
554 l2++;
555 break;
556 }
557 }
558 }
559 fprintf(outfile," { 10000,0 }\n};\n");
560 fprintf(outfile,"#define JJTAB2LEN %d\n",l2);
561 fclose(outfile);
562}
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[]