[BACK]Return to gentexi.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-contrib / packages / doc

Diff for /OpenXM/src/asir-contrib/packages/doc/Attic/gentexi.c between version 1.3 and 1.6

version 1.3, 2002/02/09 08:50:48 version 1.6, 2002/10/23 01:11:41
Line 1 
Line 1 
  /*  $OpenXM: OpenXM/src/asir-contrib/packages/doc/gentexi.c,v 1.2 2002/01/27 08:18:52 takayama Exp $  */   /*  $OpenXM: OpenXM/src/asir-contrib/packages/doc/gentexi.c,v 1.5 2002/08/23 03:26:16 noro Exp $  */
   
 #include <stdio.h>  #include <stdio.h>
 int Debug = 0;  int Debug = 0;
Line 15  struct item {
Line 15  struct item {
   char *optv[VMAX];    char *optv[VMAX];
   char *shortDescription;    char *shortDescription;
   char *description;    char *description;
     char *algorithm;
   char *examplev[VMAX];    char *examplev[VMAX];
   char *exampleDescv[VMAX];    char *exampleDescv[VMAX];
   int examplec;    int examplec;
Line 100  main(int argc,char *argv[]) {
Line 101  main(int argc,char *argv[]) {
   shell(items,n);    shell(items,n);
   if (Debug) fprintf(stderr,"Done.\n");    if (Debug) fprintf(stderr,"Done.\n");
   
     printMenu(stdout,items,n);
   
   for (i=0; i<n; i++) {    for (i=0; i<n; i++) {
     printTexi(stdout,items[i]);      printTexi(stdout,items[i]);
   }    }
Line 114  genInclude(char *name) {
Line 117  genInclude(char *name) {
   sprintf(fname,"tmp/%s-auto-%s.texi",name,Lang);    sprintf(fname,"tmp/%s-auto-%s.texi",name,Lang);
   fp = fopen(fname,"r");    fp = fopen(fname,"r");
   if (fp == NULL) {    if (fp == NULL) {
     fprintf(stderr,"No file %s\n",fname);      /* fprintf(stderr,"No file %s\n",fname); */
     return 0;      return 0;
   }    }
   while ((c=fgetc(fp)) != EOF) {    while ((c=fgetc(fp)) != EOF) {
Line 137  struct item * newItem(){
Line 140  struct item * newItem(){
   }    }
   a->argc = 0; a->optc = 0; a->refc=0; a->examplec = 0;    a->argc = 0; a->optc = 0; a->refc=0; a->examplec = 0;
   a->category = a->category2 = a->name = a->shortDescription    a->category = a->category2 = a->name = a->shortDescription
     = a->description = a->author = NULL;      = a->description = a->author = a->algorithm = NULL;
   return a;    return a;
 }  }
   
Line 195  printItem(struct item *it) {
Line 198  printItem(struct item *it) {
     printf("shortDescription=%s\n",it->shortDescription);      printf("shortDescription=%s\n",it->shortDescription);
   if (it->description != NULL)    if (it->description != NULL)
     printf("description=%s\n",it->description);      printf("description=%s\n",it->description);
     if (it->algorithm != NULL)
       printf("algorithm=%s\n",it->algorithm);
   for (i=0; i <it->examplec; i++)    for (i=0; i <it->examplec; i++)
     printf("examplev[%d]=%s\n",i,it->examplev[i]);      printf("examplev[%d]=%s\n",i,it->examplev[i]);
   for (i=0; i <it->examplec; i++)    for (i=0; i <it->examplec; i++)
Line 329  struct item *getItem() {
Line 334  struct item *getItem() {
     /* Get Description or Examples */      /* Get Description or Examples */
     if (strcmp(key,"end:") == 0) break;      if (strcmp(key,"end:") == 0) break;
     if (strcmp(key,"description:") == 0 ||      if (strcmp(key,"description:") == 0 ||
           strcmp(key,"algorithm:") == 0 ||
         strcmp(key,"author:") == 0 ||          strcmp(key,"author:") == 0 ||
         strcmp(key,"example:") == 0 ||          strcmp(key,"example:") == 0 ||
                 strcmp(key,"example_description:") ==0 ) {                  strcmp(key,"example_description:") ==0 ) {
Line 358  struct item *getItem() {
Line 364  struct item *getItem() {
       if (strcmp(key2,"author:") == 0) {        if (strcmp(key2,"author:") == 0) {
         it->author = str2(&(S[pp]),pOld-pp);          it->author = str2(&(S[pp]),pOld-pp);
       }        }
         if (strcmp(key2,"algorithm:") == 0) {
           it->algorithm = str2(&(S[pp]),pOld-pp);
         }
     }else if (strcmp(key,"ref:") == 0) {      }else if (strcmp(key,"ref:") == 0) {
       argc = 0;        argc = 0;
       while ((pp=nextToken(key,LIMIT)) >= 0) {        while ((pp=nextToken(key,LIMIT)) >= 0) {
Line 373  struct item *getItem() {
Line 382  struct item *getItem() {
         }          }
       }        }
     }else{      }else{
       fprintf(stderr,"Unknown keyword << %s >> at %s\n",key, it->name);        fprintf(stderr,"Warning: unknown keyword << %s >> at %s. Ignored.\n",key, it->name);
       exit(10);        p = nextToken(key,LIMIT);
     }      }
   }while (p >= 0);    }while (p >= 0);
   
Line 396  shell(struct item *v[],int n) {
Line 405  shell(struct item *v[],int n) {
   }    }
 }  }
   
   printMenu(FILE *fp, struct item **it, int n) {
     int i;
   
     fprintf(fp,"@menu\n");
     for ( i = 0; i < n; i++ )
           fprintf(fp,"* %s::\n",it[i]->name);
     fprintf(fp,"@end menu\n");
   }
   
 printTexi(FILE *fp, struct item *it) {  printTexi(FILE *fp, struct item *it) {
   int i;    int i;
   fprintf(fp,"@c DO NOT EDIT THIS FILE. Generated by gentexi.\n");    fprintf(fp,"@c DO NOT EDIT THIS FILE. Generated by gentexi.\n");
Line 408  printTexi(FILE *fp, struct item *it) {
Line 426  printTexi(FILE *fp, struct item *it) {
     return ;      return ;
   }    }
   
   #if 0
   fprintf(fp,"@menu\n");    fprintf(fp,"@menu\n");
   fprintf(fp,"* %s\n",it->name);    fprintf(fp,"* %s::\n",it->name);
   fprintf(fp,"@end menu\n");    fprintf(fp,"@end menu\n");
   #endif
   fprintf(fp,"@node %s,,, %s\n",it->name,Upnode);    fprintf(fp,"@node %s,,, %s\n",it->name,Upnode);
   fprintf(fp,"@subsection @code{%s}\n",it->name);    fprintf(fp,"@subsection @code{%s}\n",it->name);
   fprintf(fp,"@findex %s\n",it->name);    fprintf(fp,"@findex %s\n",it->name);
Line 464  printTexi(FILE *fp, struct item *it) {
Line 484  printTexi(FILE *fp, struct item *it) {
   
   if (it->description != NULL) {    if (it->description != NULL) {
     fprintf(fp,"%s\n\n",it->description);      fprintf(fp,"%s\n\n",it->description);
     }
   
     if (it->algorithm != NULL) {
       fprintf(fp,"\n\n@noindent\nAlgorithm: \n");
       fprintf(fp,"%s\n\n",it->algorithm);
   }    }
   
   if (it->examplec > 0) {    if (it->examplec > 0) {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.6

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