/* dbToMenu.c */ /* Author: Marty Kraimer Date: 11Sep95 */ /***************************************************************** COPYRIGHT NOTIFICATION ***************************************************************** (C) COPYRIGHT 1993 UNIVERSITY OF CHICAGO This software was developed under a United States Government license described on the COPYRIGHT_UniversityOfChicago file included as part of this distribution. **********************************************************************/ /* Modification Log: * ----------------- * .01 11Sep95 mrk Initial Implementation */ #include #include #include #include #include #include #include #include #include #include DBBASE *pdbbase = NULL; #define MAX_PATH_LENGTH 256 static void addPath(char *path,char *newdir) { if((strlen(path)+strlen(newdir)+2) > (size_t)MAX_PATH_LENGTH) { fprintf(stderr,"path > 256 characters\n"); exit(-1); } if(strlen(path) > (size_t)0) strcat(path,":"); strcat(path,newdir); } int main(int argc,char **argv) { long status; dbMenu *pdbMenu; char *outFilename; char *pext; FILE *outFile; char *plastSlash; int strip; char path[MAX_PATH_LENGTH]; int i; /*Look for path, i.e. -I dir or -Idir*/ path[0] = 0; while(strncmp(argv[1],"-I",2)==0) { if(strlen(argv[1])==2) { addPath(path,argv[2]); strip = 2; } else { addPath(path,argv[1]+2); strip = 1; } argc -= strip; for(i=1; iignoreMissingMenus = TRUE; status = dbReadDatabase(&pdbbase,argv[1],path); if(status) { fprintf(stderr,"Terminal error For input file %s\n",argv[1]); exit(-1); } pdbMenu = (dbMenu *)ellFirst(&pdbbase->menuList); while(pdbMenu) { fprintf(outFile,"#ifndef INC%sH\n",pdbMenu->name); fprintf(outFile,"#define INC%sH\n",pdbMenu->name); fprintf(outFile,"typedef enum {\n"); for(i=0; inChoice; i++) { fprintf(outFile,"\t%s,\n",pdbMenu->papChoiceName[i]); } fprintf(outFile,"}%s;\n",pdbMenu->name); fprintf(outFile,"#endif /*INC%sH*/\n",pdbMenu->name); pdbMenu = (dbMenu *)ellNext(&pdbMenu->node); } fclose(outFile); free((void *)outFilename); return(0); }