=================================================================== RCS file: /home/cvs/OpenXM/src/asir-contrib/packages/doc/Attic/gentexi.c,v retrieving revision 1.2 retrieving revision 1.4 diff -u -p -r1.2 -r1.4 --- OpenXM/src/asir-contrib/packages/doc/Attic/gentexi.c 2002/01/27 08:18:52 1.2 +++ OpenXM/src/asir-contrib/packages/doc/Attic/gentexi.c 2002/08/08 08:56:32 1.4 @@ -1,4 +1,4 @@ - /* $OpenXM: OpenXM/src/asir-contrib/packages/doc/gentexi.c,v 1.1 2002/01/27 07:13:28 takayama Exp $ */ + /* $OpenXM: OpenXM/src/asir-contrib/packages/doc/gentexi.c,v 1.3 2002/02/09 08:50:48 takayama Exp $ */ #include int Debug = 0; @@ -15,10 +15,13 @@ struct item { char *optv[VMAX]; char *shortDescription; char *description; + char *algorithm; char *examplev[VMAX]; + char *exampleDescv[VMAX]; int examplec; int refc; char *refv[VMAX]; + char *author; }; struct item *getItem(void); char *str(char *key); @@ -135,7 +138,7 @@ struct item * newItem(){ } a->argc = 0; a->optc = 0; a->refc=0; a->examplec = 0; a->category = a->category2 = a->name = a->shortDescription - = a->description = NULL; + = a->description = a->author = a->algorithm = NULL; return a; } @@ -193,10 +196,16 @@ printItem(struct item *it) { printf("shortDescription=%s\n",it->shortDescription); if (it->description != NULL) printf("description=%s\n",it->description); + if (it->algorithm != NULL) + printf("algorithm=%s\n",it->algorithm); for (i=0; i examplec; i++) printf("examplev[%d]=%s\n",i,it->examplev[i]); + for (i=0; i examplec; i++) + printf("exampleDescv[%d]=%s\n",i,it->exampleDescv[i]); for (i=0; irefc; i++) printf(" refv[%d]=%s\n",i,it->refv[i]); + if (it->author != NULL) + printf("author=%s\n",it->author); printf("\n"); } @@ -323,7 +332,10 @@ struct item *getItem() { /* Get Description or Examples */ if (strcmp(key,"end:") == 0) break; if (strcmp(key,"description:") == 0 || - strcmp(key,"example:") == 0) { + strcmp(key,"algorithm:") == 0 || + strcmp(key,"author:") == 0 || + strcmp(key,"example:") == 0 || + strcmp(key,"example_description:") ==0 ) { pp = p; strcpy(key2,key); do { @@ -337,12 +349,22 @@ struct item *getItem() { } if (strcmp(key2,"example:") == 0) { it->examplev[examplec++] = str2(&(S[pp]),pOld-pp); + it->exampleDescv[examplec-1] = ""; it->examplec = examplec; if (examplec > VMAX-1) { fprintf(stderr,"Too many examples. \n"); exit(20); } } + if (strcmp(key2,"example_description:") == 0) { + it->exampleDescv[examplec-1] = str2(&(S[pp]),pOld-pp); + } + if (strcmp(key2,"author:") == 0) { + 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) { argc = 0; while ((pp=nextToken(key,LIMIT)) >= 0) { @@ -358,7 +380,7 @@ struct item *getItem() { } } }else{ - fprintf(stderr,"Unknown keyword at %s\n",it->name); + fprintf(stderr,"Unknown keyword << %s >> at %s\n",key, it->name); exit(10); } }while (p >= 0); @@ -447,15 +469,35 @@ printTexi(FILE *fp, struct item *it) { fprintf(fp,"@c @item \n"); fprintf(fp,"@c @end itemize\n"); + if (it->description != NULL) { + 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) { for (i=0; iexamplec; i++) { + if (it->examplec == 1) { + fprintf(fp,"Example:\n"); + }else{ + fprintf(fp,"Example %d:\n",i); + } fprintf(fp,"@example\n"); fprintf(fp,"%s\n",it->examplev[i]); if (GenExample) { outputOfExample(it->examplev[i]); } fprintf(fp,"@end example\n"); + if (it->exampleDescv[i] != NULL && strlen(it->exampleDescv[i]) > 0) { + fprintf(fp,"%s\n\n",it->exampleDescv[i]); + } } + } + if (it->author != NULL) { + fprintf(fp,"Author : %s\n\n",it->author); } if (it->refc > 0) { fprintf(fp,"@table @t\n");