QString SchemaDumper::dumpSchema () { QStringList output; output << notr ("---"); dumpTables (output); dumpVersions (output); return output.join (notr ("\n")); }
int main(int argc, char *argv[]) { char filename [FNAME_SIZE+1]; /* Parse command line arguments */ parseArguments(argc, argv); /* Open all output files */ openOutputFiles(); #if !LSTTOFILE lstFile = stdout; #endif /* Open source file -- Use .PAS or command line extension, if supplied */ (void)extension(sourceFileName, "PAS", filename, 0); fprintf(errFile, "%01x=%s\n", FP->include, filename); memset(FP, 0, sizeof(fileState_t)); FP->stream = fopen(filename, "r"); if (!FP->stream) { errmsg("Could not open source file '%s': %s\n", filename, strerror(errno)); showUsage(); } /* Initialization */ primeSignalHandlers(); primeSymbolTable(MAX_SYM); primeBuiltInProcedures(); primeBuiltInFunctions(); primeTokenizer(MAX_STRINGS); /* Initialize the POFF object */ poffHandle = poffCreateHandle(); if (poffHandle == NULL) fatal(eNOMEMORY); /* Save the soure file name in the POFF output file */ FP->include = poffAddFileName(poffHandle, filename); /* Define standard input/output file characteristics */ files[0].defined = -1; files[0].flevel = level; files[0].ftype = sCHAR; files[0].faddr = dstack; files[0].fsize = sCHAR_SIZE; dstack += sCHAR_SIZE; /* We need the following in order to calculate relative stack positions. */ FP->dstack = dstack; /* Indicate that no WITH statement has been processed */ memset(&withRecord, 0, sizeof(WTYPE)); /* Process the pascal program * * FORM: pascal = program | unit * FORM: program = program-heading ';' [uses-section ] block '.' * FORM: program-heading = 'program' identifier [ '(' identifier-list ')' ] * FORM: unit = unit-heading ';' interface-section implementation-section init-section * FORM: unit-heading = 'unit' identifer */ getToken(); if (token == tPROGRAM) { /* Compile a pascal program */ FP->kind = eIsProgram; FP->section = eIsProgramSection; getToken(); program(); } else if (token == tUNIT) { /* Compile a pascal unit */ FP->kind = eIsUnit; FP->section = eIsOtherSection; getToken(); unitImplementation(); } else { /* Expected 'program' or 'unit' */ error(ePROGRAM); } /* Dump the symbol table content (debug only) */ #if CONFIG_DEBUG dumpTables(); #endif /* Write the POFF output file */ poffWriteFile(poffHandle, poffFile); poffDestroyHandle(poffHandle); /* Close all output files */ closeFiles(); /* Write Closing Message */ if (warn_count > 0) { printf(" %ld Warnings Issued\n", warn_count); } /* end if */ if (err_count > 0) { printf(" %d Errors Detected\n\n", err_count); return -1; } /* end if */ return 0; } /* end main */
int main(int argc, char *argv[]) { int version = 0; precision = 0; for(int i=1;i<argc;i++) { if(portstrcmp(argv[i],"-v",sizeof(argv[i]),3) == 1) { version = 1; break; } else if(portstrcmp(argv[i],"-d",sizeof(argv[i]),3) == 1) { dump = 1; break; } else if(portstrcmp(argv[i],"-l",sizeof(argv[i]),3) == 1) { load = 1; } else if(portstrcmp(argv[i],"-c",sizeof(argv[i]),3) == 1) { complete = 1; } else if(portstrcmp(argv[i],"-p",sizeof(argv[i]),3) == 1) { i++; precision = atoi(argv[i]); if(precision == 0) { if(portstrcmp(argv[i],"0",sizeof(argv[i]),2) == 1) { continue; } else { printf("Erroneous precision.\n"); } } else { mpf_set_default_prec(8*precision); continue; } } else { if(tablesFilled == 0) { printf("Populating tables..."); popPtable(); tablesFilled = 1; printf("\t\t\t\t\t[OK!]\n"); } portstrcpy(mutableArg,argv[i]); output = singularParse(muchBetter(mutableArg,sizeof(mutableArg)),sizeof(mutableArg)); if(output != 0) { argHandled = 1; if(complete == 1) { completeElementData(output); } else { basicElementData(output); } } else { printf("No match, try entering an element name or symbol.\n"); } } } if(argHandled == 1) { return 0; } else if(version == 1) { printf("%s\n",Version); return 0; } else if(dump == 1) { printf("This is where tables would be dumped.\n"); printf("Populating tables..."); popPtable(); printf("\t\t\t\t\t[OK!]\n"); printf("Dumping tables..."); dumpTables("tables.frm"); printf("\t\t\t\t\t[OK!]\n"); printf("Exiting...\n"); return 0; } else { if(tablesFilled == 0) { printf("Populating tables..."); popPtable(); tablesFilled = 1; printf("\t\t\t\t\t[OK!]\n"); } usersays[0] = '\0'; while(usersays[0] != 'q' && usersays[0] != 'Q') { printf("~#>"); fgets(usersays,256,stdin); if(usersays[0] == 'q' || usersays[0] == 'Q') { break; } else { output = singularParse(muchBetter(usersays,sizeof(usersays)),sizeof(usersays)); if(output != 0) { if(complete == 1) { completeElementData(output); } else { basicElementData(output); } } else { printf("No match, try entering an element name or symbol.\n"); } } } printf("Exiting...\n"); return 0; } }