static void addIncPath(char *s, int readOnly, int addAtEnd) { static char *delims = ";"; pFDReadInd entry; char *p; if (s == NULL) { return; } s = wicStrdup(s); p = strtok(s, delims); while (p != NULL) { entry = createFDReadInd(wicStrdup(p), readOnly); if (addAtEnd) { addSLListElem(g_opt.incPathList, entry); } else { addBegSLListElem(g_opt.incPathList, entry); } p = strtok(NULL, delims); } wicFree(s); }
void outputZapEOF(pToken eofToken) { addSLListElem(g_logList, eofToken); // !! This is a band-aid. outputZapAll(NULL); }
static void _scanCurrArg(char *currArg) { char *saveCurrArg = currArg; switch (currArg[0]) { case '-': case '/': currArg++; switch (currArg++[0]) { case 'F': g_opt.structFieldsSep = currArg; break; case 'f': g_opt.targetLang = TLT_FORTRAN; break; case '?': case 'h': printUsageAndExit(); break; case 'i': addIncPath(currArg, 0, 1); break; case 'I': _scanSize(currArg, &(g_opt.intSize)); break; case 'j': g_opt.signedChar = 1; break; case 'l': if (currArg[0] == '=') { currArg++; } sscanf(currArg, "%u", &(g_opt.outLineLen)); if (!WITHIN_RANGE(g_opt.outLineLen, 30, MAX_OUT_LINE_LEN)) { reportError(ERR_LINE_LEN_OUT_OF_RANGE, g_opt.outLineLen); g_opt.outLineLen = 0; } break; case 'a': switch (currArg++[0]) { case 'd': g_opt.asmAttachD = 1; break; case 0: g_opt.targetLang = TLT_ASM; break; default: reportError(ERR_INV_CMD_LINE_OPTION, saveCurrArg); break; } break; case 's': switch (currArg++[0]) { case '-': g_opt.prefixStructFields = 0; _scanCurrArg("-F"); break; case '+': g_opt.prefixStructFields = 1; break; case '0': g_opt.supressLevel = 0; break; case '1': g_opt.supressLevel = 1; break; case '2': g_opt.supressLevel = 2; break; case '3': g_opt.supressLevel = 3; break; default: g_opt.supressLevel = 0; break; } break; case '1': if (currArg[0] == '6') { _scanCurrArg("-P16"); _scanCurrArg("-I16"); } break; case '3': if (currArg[0] == '2') { _scanCurrArg("-P32"); _scanCurrArg("-I32"); } break; case 'p': g_opt.conflictPrefix = currArg; break; case 'P': if (currArg[0] == 'n') { _scanSize(currArg+1, &(g_opt.nearPtrSize)); } else if (currArg[0] == 'p' || currArg[0] == 'd') { _scanSize(currArg+1, &(g_opt.ptrSize)); } else if (currArg[0] == 'f') { _scanSize(currArg+1, &(g_opt.farPtrSize)); } else if (currArg[0] == 'h') { _scanSize(currArg+1, &(g_opt.hugePtrSize)); } else { SizeType temp = SIZE_MAX; _scanSize(currArg, &temp); if (temp == SIZE_16) { _scanCurrArg("-Pn16"); _scanCurrArg("-Pd16"); _scanCurrArg("-Pf32"); _scanCurrArg("-Ph32"); } else if (temp == SIZE_32) { _scanCurrArg("-Pn32"); _scanCurrArg("-Pd32"); _scanCurrArg("-Pf32"); _scanCurrArg("-Ph48"); } } break; #ifndef NDEBUG case 'd': g_opt.debug = 1; break; #endif default: reportError(ERR_INV_CMD_LINE_OPTION, saveCurrArg); } break; case '?': printUsageAndExit(); break; default: { char driveDir[_MAX_DRIVE+_MAX_DIR+10]; char drive[_MAX_DRIVE]; char dir[_MAX_DIR]; char name[_MAX_FNAME]; char ext[_MAX_EXT]; int len; _splitpath(currArg, drive, dir, name, ext); _makepath(driveDir, drive, dir, "", ""); len = strlen(driveDir); if (len > 0) if (driveDir[len-1] == '\\') { driveDir[len-1] = 0; } addSLListElem(g_opt.fileNameList, wicStrdup(currArg)); addIncPath(driveDir, 0, 0); // Add at the beginning } } }