=================================================================== RCS file: /home/cvs/OpenXM/src/util/oxgentexi.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -r1.2 -r1.3 --- OpenXM/src/util/oxgentexi.c 2005/04/04 07:36:44 1.2 +++ OpenXM/src/util/oxgentexi.c 2005/04/04 12:38:32 1.3 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/util/oxgentexi.c,v 1.1 2005/04/04 06:10:58 takayama Exp $ */ +/* $OpenXM: OpenXM/src/util/oxgentexi.c,v 1.2 2005/04/04 07:36:44 takayama Exp $ */ #include int Debug = 0; @@ -39,6 +39,8 @@ char *Lang="en"; int Include = 0; int GenExample = 0; int DebugItem = 0; +char *Title = NULL; +char *Author = NULL; main(int argc,char *argv[]) { char *t; @@ -66,6 +68,10 @@ main(int argc,char *argv[]) { Debug = 1; }else if (strcmp(argv[i],"--debugItem") == 0) { DebugItem = 1; + }else if (strcmp(argv[i],"--title") == 0) { + i++; Title = str(argv[i]); + }else if (strcmp(argv[i],"--author") == 0) { + i++; Author = str(argv[i]); }else { fprintf(stderr,"Unknown option\n"); exit(1); } @@ -113,11 +119,15 @@ main(int argc,char *argv[]) { exit(0); } + if (Title) printTitlePage(Title,Author); + printMenu(stdout,items,n); for (i=0; itype = 1; /* For non-functions */ + goto LL ; }else{ it->type = 0; /* For functions */ argc = 0; @@ -346,7 +357,8 @@ struct item *getItem() { }while (p >= 0); it->shortDescription = str2(&(S[pp]),pOld-pp); - + LL: ; + if (it->type == 1 ) {strcpy(key,"description:"); p++; } do { /* Get Description or Examples */ if (strcmp(key,"end:") == 0) break; @@ -466,7 +478,7 @@ printTexi_common(FILE *fp,struct item *it) { fprintf(fp,"Example %d:\n",i); } fprintf(fp,"@example\n"); - fprintf(fp,"%s\n",it->examplev[i]); + outputExample(fp,it->examplev[i]); if (GenExample) { outputOfExample(it->examplev[i]); } @@ -499,6 +511,7 @@ printTexi0(FILE *fp, struct item *it) { fprintf(fp,"@c item is NULL.\n"); return ; } + fprintf(fp,"@c sortKey: %s\n",it->sortKey); if (it->name == NULL) { fprintf(fp,"@c item name is missing.\n"); return ; @@ -572,6 +585,7 @@ printTexi1(FILE *fp, struct item *it) { fprintf(fp,"@c item is NULL.\n"); return ; } + fprintf(fp,"@c sortKey: %s\n",it->sortKey); if (it->shortDescription != NULL) { for (i=0; ishortDescription); i++) { @@ -589,6 +603,16 @@ printTexi1(FILE *fp, struct item *it) { printTexi_common(fp,it); } +outputExample(FILE *fp,char *s) { + int i; + for (i=0; s[i] != 0; i++) { + if (s[i] == '{') fprintf(fp,"%s","@{"); + else if (s[i] == '}') fprintf(fp,"%s","@}"); + else if (s[i] == '@') fprintf(fp,"%s","@@"); + else fputc(s[i],fp); + } +} + outputOfExample(char *com) { FILE *fp2; int c; @@ -616,4 +640,30 @@ outputOfExample(char *com) { putchar('\n'); } +printTitlePage(char *title, char *author) { + printf("\\input texinfo\n"); + printf("@def@pi{PI}\n"); + printf("@def@colon{:}\n\n"); + printf("@iftex\n"); + printf("@catcode`@#=6\n"); + printf("@def@b#1{{@bf@gt #1}}\n"); + printf("@catcode`@#=@other\n"); + printf("@end iftex\n"); + printf("@overfullrule=0pt\n"); + + printf("@setfilename %s\n",Title); + printf("@settitle %s\n",Title); + + printf("@titlepage\n"); + printf("@title %s\n",Title); + printf("@subtitle Edition : auto generated by oxgentexi on @today{}\n"); + if (author != NULL) printf("@author %s\n",author); + printf("@end titlepage\n\n"); + printf("@synindex vr fn\n"); + printf("@node Top,, (dir), (dir)\n\n"); +} + +printBye() { + printf("\n@bye\n"); +} /* Old file was OpenXM/src/asir-contrib/packages/doc/gentexi.c */