示例#1
0
void wicExit(int exitCode) {
    if (exitCode == 0) {
        zapOutputSystem();
        zapCmdLineOptions();
        zapTokPos(g_currPos);
        assert(isEmptySLList(g_logList));  zapSLList(g_logList, NULL);
        assert(isEmptySLList(g_dirList));  zapSLList(g_dirList, NULL);
        assert(isEmptySLList(g_commentList));  zapSLList(g_commentList, NULL);
        zapMemory();
        zapDebug();
        zapWicResources();
        checkMemory();
    } else {
        printf("WIC: Terminating with error...\n");
        fcloseall();
    }
    exit(exitCode);
}
示例#2
0
void getCmdLineOptions(int argc, char *argv[]) {
    int i;
    char *currArg;

    g_opt.targetLang = TLT_FORTRAN;
    g_opt.signedChar = 0;
    g_opt.asmAttachD = 0;
    g_opt.prefixStructFields = -1;
    g_opt.structFieldsSep = NULL;
    g_opt.conflictPrefix = "WIC_";
    g_opt.supressLevel = 1;
    g_opt.outLineLen = 0;
    g_opt.fileNameList = createSLList();
    g_opt.incPathList = createSLList();
    g_opt.intSize = SIZE_32;
    g_opt.nearPtrSize = SIZE_32;
    g_opt.ptrSize = SIZE_32;
    g_opt.farPtrSize = SIZE_32;
    g_opt.hugePtrSize = SIZE_48;
    g_opt.debug = 0;

    if (argc <= 1) {
        printUsageAndExit();
    } else {
        for (i = 1; i < argc; i++) {
            currArg = argv[i];
            _scanCurrArg(currArg);
        }
    }

    addIncPath(getenv("INCLUDE"), 1, 1);
    if (isEmptySLList(g_opt.fileNameList)) {
        reportError(FATAL_FILE_NOT_SPECIFIED);
    }
    if (g_opt.outLineLen == 0) {
        switch (g_opt.targetLang) {
            case TLT_FORTRAN: g_opt.outLineLen = 72; break;
            case TLT_ASM: g_opt.outLineLen = 79; break;
            default: assert(0);
        }
    }
    if (g_opt.prefixStructFields == -1) {
        switch (g_opt.targetLang) {
            case TLT_FORTRAN: g_opt.prefixStructFields = 0; break;
            case TLT_ASM: g_opt.prefixStructFields = 1; break;
            default: assert(0);
        }
    }
    if (g_opt.structFieldsSep == NULL) {
        switch (g_opt.targetLang) {
            case TLT_FORTRAN: g_opt.structFieldsSep = ""; break;
            case TLT_ASM: g_opt.structFieldsSep = "_FS_"; break;
            default: assert(0);
        }
    }

}
示例#3
0
int paramListNotVoid(pDeclList list) {
    pDeclInfo decl;

    if (isEmptySLList(list)) {
        return 0;
    }
    rewindCurrSLListPos(list);
    getCurrSLListPosElem(list, &decl);
    if (decl->type == DIT_SCALAR) {
        if (decl->repr.scalar.scalar == SCL_DOT_DOT_DOT) {
            return 0;
        } else if (decl->repr.scalar.scalar == SCL_VOID) {
            if (!isDclrPtr(decl->dclr)) {
                return 0;
            }
        }
    }
    return 1;
}