MCPcopy Create free account
hub / github.com/Singular/Singular / ttGen2c

Function ttGen2c

Singular/gentable.cc:663–837  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

661 return 0;
662}
663void ttGen2c()
664{
665 int cmd_size = (sizeof(cmds)/sizeof(cmdnames))-1;
666
667 FILE *outfile = fopen("reference_table.texi","w");
668 fprintf(outfile, "@menu\n");
669/*-------------------------------------------------------------------*/
670 qsort(&cmds, cmd_size, sizeof(cmdnames), (&_texi_sort_cmds));
671
672 int m;
673 for(m=0; m<cmd_size; m++)
674 {
675 // assume that cmds[0].tokval== -1 and all others with tokval -1 at the end
676 if(is_ref_cmd(&(cmds[m])))
677 {
678 fprintf(outfile,"* %s::\n",cmds[m].name);
679 }
680 }
681 fprintf(outfile, "@end menu\n@c ---------------------------\n");
682 for(m=0; m<cmd_size; m++)
683 {
684 // assume that cmds[0].tokval== -1 and all others with tokval -1 at the end
685 if(is_ref_cmd(&(cmds[m])))
686 {
687 fprintf(outfile,"@node %s,",cmds[m].name);
688 // next:
689 int mm=m-1;
690 while((mm>0)&& (is_ref_cmd(&cmds[mm]))) mm--;
691 if((mm>0)&& (is_ref_cmd(&cmds[mm])))
692 fprintf(outfile,"%s,",cmds[mm].name);
693 else
694 fprintf(outfile,",");
695 // prev:
696 mm=m+1;
697 while((mm>0)&& (is_ref_cmd(&cmds[mm]))) mm++;
698 if((mm>0)&& (is_ref_cmd(&cmds[mm])))
699 fprintf(outfile,"%s,",cmds[m-1].name);
700 else
701 fprintf(outfile,",");
702 // up:, and header
703 fprintf(outfile,"Functions\n"
704 "@subsection %s\n"
705 "@cindex %s\n",cmds[m].name,cmds[m].name);
706 fprintf(outfile,"@include %s.part\n",cmds[m].name);
707 char partName[50];
708 snprintf(partName,50,"%s.part",cmds[m].name);
709 struct stat buf;
710 if (lstat(partName,&buf)!=0)
711 {
712 int op,i;
713 int only_field=0,only_comm=0,no_zerodiv=0;
714 FILE *part=fopen(partName,"w");
715 fprintf(part,"@table @code\n@item @strong{Syntax:}\n");
716 if ((cmds[m].toktype==CMD_1)
717 || (cmds[m].toktype==CMD_12)
718 || (cmds[m].toktype==CMD_13)
719 || (cmds[m].toktype==CMD_123))
720 {

Callers 1

mainFunction · 0.85

Calls 2

is_ref_cmdFunction · 0.85
Tok2CmdnameFunction · 0.70

Tested by

no test coverage detected