예제 #1
0
void initExpandPushListParam(int fileNum, PrintType type,
                                pSLList list, void *param) {
    if (list != NULL) {
        rewindCurrSLListPos(list);
        expandPushListParam(fileNum, type, list, param);
    }
}
예제 #2
0
char *getTokListString(pSLList context) {
    enum { maxBufSize = 500 };
    static char buffer[maxBufSize];
    int bufSize = 0;
    pToken tok;
    static char *tokStr;
    int tokStrSize = 0;

    buffer[0] = 0;
    rewindCurrSLListPos(context);
    while (getCurrSLListPosElem(context, &tok)) {
        incCurrSLListPos(context);
        tokStr = staticGetTokenStr(tok, 0);
        tokStrSize = strlen(tokStr);
        tokStrSize = __min(maxBufSize-bufSize-1,  tokStrSize);
        if (tokStrSize <= 0) {
            goto Return;
        }
        memcpy(buffer + bufSize, tokStr, tokStrSize);
        bufSize += tokStrSize;
        buffer[bufSize] = 0;
    }

    Return:
        return buffer;
}
예제 #3
0
static FILE *_openIncludeFile(char *fname, char **newAllocName) {
    FILE *file = NULL;
    char fullName[_MAX_PATH];
    pFDReadInd dir = NULL;
    char *fullNameCopy;

    strcpy(fullName, fname);
    rewindCurrSLListPos(g_opt.incPathList);
    do {
        setDefaultExt(fullName, "h");
        if (fileReadable(fullName)) {
            file = wicFopen(fullName, "r");
            if (file != NULL) {
                pFDReadInd newElem;
                fullNameCopy = wicStrdup(fullName);
                newElem = createFDReadInd(fullNameCopy,
                            dir == NULL ? 0 : dir->readOnly);
                if (!addHTableElem(g_fileTable, newElem)) {
                    reportError(ERR_FILE_WAS_INCLUDED, fullNameCopy);
                    wicFclose(file);
                    zapFDReadInd(newElem);
                    file = NULL;
                }
                break;
            }
        }
        if (!getCurrSLListPosElem(g_opt.incPathList, &dir)) {
            strcpy(fullName, fname);
            setDefaultExt(fullName, "h");
            reportError(ERR_INC_FILE_NOT_FOUND, fullName);
            break;
        }
        sprintf(fullName, "%s\\%s", dir->name, fname);
        incCurrSLListPos(g_opt.incPathList);
    } while (1);

    if (file == NULL) {
        *newAllocName = NULL;
    } else {
        *newAllocName = fullNameCopy;
    }
    return file;
}
예제 #4
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;
}