[BACK]Return to oxgentexi.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / util

Diff for /OpenXM/src/util/oxgentexi.c between version 1.4 and 1.7

version 1.4, 2005/04/05 13:12:06 version 1.7, 2005/04/11 11:13:32
Line 1 
Line 1 
 /*  $OpenXM: OpenXM/src/util/oxgentexi.c,v 1.3 2005/04/04 12:38:32 takayama Exp $ */  /*  $OpenXM: OpenXM/src/util/oxgentexi.c,v 1.6 2005/04/06 09:26:29 takayama Exp $ */
   
 #include <stdio.h>  #include <stdio.h>
 int Debug = 0;  int Debug = 0;
Line 41  int GenExample = 0;
Line 41  int GenExample = 0;
 int DebugItem = 0;  int DebugItem = 0;
 char *Title = NULL;  char *Title = NULL;
 char *Author = NULL;  char *Author = NULL;
   char *InfoName = NULL;
 int NoSorting = 0;  int NoSorting = 0;
   
 main(int argc,char *argv[]) {  main(int argc,char *argv[]) {
Line 71  main(int argc,char *argv[]) {
Line 72  main(int argc,char *argv[]) {
       DebugItem = 1;        DebugItem = 1;
     }else if (strcmp(argv[i],"--title") == 0) {      }else if (strcmp(argv[i],"--title") == 0) {
       i++; Title = str(argv[i]);        i++; Title = str(argv[i]);
       }else if (strcmp(argv[i],"--infoName") == 0) {
         i++; InfoName = str(argv[i]);
     }else if (strcmp(argv[i],"--author") == 0) {      }else if (strcmp(argv[i],"--author") == 0) {
       i++; Author = str(argv[i]);        i++; Author = str(argv[i]);
     }else if (strcmp(argv[i],"--noSorting") == 0) {      }else if (strcmp(argv[i],"--noSorting") == 0) {
Line 125  main(int argc,char *argv[]) {
Line 128  main(int argc,char *argv[]) {
         exit(0);          exit(0);
   }    }
   
   if (Title) printTitlePage(Title,Author);    if (Title) printTitlePage(Title,Author,InfoName);
   
   printMenu(stdout,items,n);    printMenu(stdout,items,n);
   
Line 300  struct item *getItem() {
Line 303  struct item *getItem() {
   int pp,pOld;    int pp,pOld;
   int argc;    int argc;
   int examplec = 0;    int examplec = 0;
     int i;
   it = newItem();    it = newItem();
   do {    do {
     p = nextToken(key,LIMIT);      p = nextToken(key,LIMIT);
Line 379  struct item *getItem() {
Line 383  struct item *getItem() {
       do {        do {
         pOld = p;          pOld = p;
         p = nextToken(key,LIMIT);          p = nextToken(key,LIMIT);
         /* printf("%s\n",key); */          /* printf("key=%s\n",key); */
         if (key[strlen(key)-1] == ':') break; /* Next keyword. */          if (key[strlen(key)-1] == ':') {
             pOld = p-strlen(key);
             break; /* Next keyword. */
           }
       }while (p >= 0);        }while (p >= 0);
       if (strcmp(key2,"description:") == 0) {        if (strcmp(key2,"description:") == 0) {
         it->description = str2(&(S[pp]),pOld-pp);          it->description = str2(&(S[pp]),pOld-pp);
Line 422  struct item *getItem() {
Line 429  struct item *getItem() {
         }          }
       }        }
     }else{      }else{
       fprintf(stderr,"Warning: unknown keyword << %s >> at %s. Ignored.\n",key, it->name);        fprintf(stderr,"Error: unknown keyword << %s >> at %s.\n",key, it->name);
             fprintf(stderr,"       The error occurs around ");
             for (i=pp ; i < p; i++) fputc(S[i],stderr);
             fprintf(stderr,"\n\n");
             exit(1);
       p = nextToken(key,LIMIT);        p = nextToken(key,LIMIT);
     }      }
   }while (p >= 0);    }while (p >= 0);
Line 512  printTexi_common(FILE *fp,struct item *it) {
Line 523  printTexi_common(FILE *fp,struct item *it) {
 printTexi0(FILE *fp, struct item *it) {  printTexi0(FILE *fp, struct item *it) {
   int i;    int i;
   
   fprintf(fp,"@c DO NOT EDIT THIS FILE. Generated by gentexi0.\n");    fprintf(fp,"@c DO NOT EDIT THIS FILE. Generated by gentexi for asir function item.\n");
   if (it == NULL) {    if (it == NULL) {
     fprintf(fp,"@c item is NULL.\n");      fprintf(fp,"@c item is NULL.\n");
     return ;      return ;
Line 586  printTexi1(FILE *fp, struct item *it) {
Line 597  printTexi1(FILE *fp, struct item *it) {
   int i;    int i;
   /* For  it->type == 1 */    /* For  it->type == 1 */
   
   fprintf(fp,"@c DO NOT EDIT THIS FILE. Generated by gentexi1.\n");    fprintf(fp,"@c DO NOT EDIT THIS FILE. Generated by gentexi for verbose item.\n");
   if (it == NULL) {    if (it == NULL) {
     fprintf(fp,"@c item is NULL.\n");      fprintf(fp,"@c item is NULL.\n");
     return ;      return ;
Line 620  outputExample(FILE *fp,char *s) {
Line 631  outputExample(FILE *fp,char *s) {
                 fprintf(fp,":"); i += 5;                  fprintf(fp,":"); i += 5;
           }else fprintf(fp,"@@");            }else fprintf(fp,"@@");
     }else{      }else{
           fputc(s[i],fp);            if (s[i] == '{') {fprintf(fp,"%s","@{"); }
             else if (s[i] == '}') {fprintf(fp,"%s","@}");}
             else fputc(s[i],fp);
     }      }
   }    }
 }  }
Line 652  outputOfExample(char *com) {
Line 665  outputOfExample(char *com) {
   putchar('\n');    putchar('\n');
 }  }
   
 printTitlePage(char *title, char *author) {  printTitlePage(char *title, char *author,char *infoName) {
   printf("\\input texinfo\n");    printf("\\input texinfo\n");
   printf("@def@colon{:}\n\n");    printf("@def@colon{:}\n\n");
   printf("@iftex\n");    printf("@iftex\n");
Line 662  printTitlePage(char *title, char *author) {
Line 675  printTitlePage(char *title, char *author) {
   printf("@end iftex\n");    printf("@end iftex\n");
   printf("@overfullrule=0pt\n");    printf("@overfullrule=0pt\n");
   
   printf("@setfilename %s\n",Title);    if (infoName != NULL) printf("@setfilename %s\n",infoName);
   printf("@settitle %s\n",Title);    printf("@settitle %s\n",Title);
   
   printf("@titlepage\n");    printf("@titlepage\n");
Line 675  printTitlePage(char *title, char *author) {
Line 688  printTitlePage(char *title, char *author) {
 }  }
   
 printBye() {  printBye() {
     printf("@node Index,,, Top\n");
     printf("@unnumbered Index\n");
     printf("@printindex fn\n");
     printf("@printindex cp\n");
     printf("@iftex\n");
     printf("@vfill @eject\n");
     printf("@end iftex\n");
     printf("@summarycontents\n");
     printf("@contents\n");
   printf("\n@bye\n");    printf("\n@bye\n");
 }  }
 /* Old file was OpenXM/src/asir-contrib/packages/doc/gentexi.c */  /* Old file was OpenXM/src/asir-contrib/packages/doc/gentexi.c */

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.7

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>