summaryrefslogtreecommitdiff
path: root/unsorted/Targets.c
blob: 378b9d71c9deaedbe7c34c26cf6e86bae501fd90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "parser.h"

ParserTool *pTool;

int SetParserToolInfo(ParserTool *tool) {
    pTool = tool;

    OS_ASSERT(16, pTool->toolInfo && (parseopts.toolVersion || pTool->copyright));

    return 1;
}

Boolean ParserToolMatchesPlugin(OSType type, OSType lang, OSType cpu, OSType os) {
    if (!pTool) {
        CLPFatalError("No options loaded for command line\n");
        return 0;
    }

    if (
            (type == CWDROPINANYTYPE || pTool->TYPE == CWDROPINANYTYPE || pTool->TYPE == type) &&
            (lang == Lang_Any || pTool->LANG == Lang_Any || pTool->LANG == lang) &&
            (cpu == targetCPUAny || pTool->CPU == targetCPUAny || pTool->CPU == cpu) &&
            (os == targetOSAny || pTool->OS == targetOSAny || pTool->OS == os)
            )
    {
        return 1;
    } else {
        return 0;
    }
}

Boolean ParserToolHandlesPanels(int numPanels, const char **panelNames) {
    int idx;
    int scan;

    if (!pTool)
        CLPFatalError("No options loaded for command line\n");

    for (idx = 0; idx < numPanels; idx++) {
        for (scan = 0; scan < pTool->numPrefPanels; scan++) {
            if (!ustrcmp(pTool->prefPanels[scan], panelNames[idx]))
                break;
        }

        if (scan >= pTool->numPrefPanels)
            break;
    }

    if (idx >= numPanels)
        return 1;
    else
        return 0;
}

Boolean SetupParserToolOptions(void) {
    int idx;

    Options_Init();
    for (idx = 0; idx < pTool->numOptionLists; idx++) {
        Options_AddList(pTool->optionLists[idx]);
    }
    Options_SortOptions();

    return 1;
}