2022-10-19 20:16:13 +00:00
|
|
|
#include "cmdline.h"
|
2022-10-11 02:18:42 +00:00
|
|
|
|
2022-10-19 20:16:13 +00:00
|
|
|
extern const char *CMDLINE_BUILD_TIME;
|
|
|
|
extern const char *CMDLINE_BUILD_DATE;
|
|
|
|
|
|
|
|
// Glue functions
|
2023-01-15 12:14:05 +00:00
|
|
|
extern int RegisterStaticParserPlugins(void);
|
|
|
|
extern int RegisterStaticParserResources(void);
|
2022-10-19 20:16:13 +00:00
|
|
|
|
|
|
|
extern void GetStaticTarget(OSType *cpu, OSType *os);
|
|
|
|
extern void GetStaticPluginType(OSType *language, OSType *plugintype);
|
|
|
|
extern void GetStaticParserPluginType(OSType *style);
|
2023-01-15 12:14:05 +00:00
|
|
|
extern int RegisterStaticTargetResources(void);
|
|
|
|
extern int RegisterStaticTargetPlugins(void);
|
2022-10-19 20:16:13 +00:00
|
|
|
|
2023-01-15 12:14:05 +00:00
|
|
|
extern int RegisterStaticParserToolInfo(void);
|
2022-10-19 20:16:13 +00:00
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
2022-10-11 02:18:42 +00:00
|
|
|
OSType cpu;
|
|
|
|
OSType os;
|
|
|
|
OSType lang;
|
|
|
|
OSType type;
|
|
|
|
OSType style;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (CmdLine_Initialize(argc, argv, CMDLINE_BUILD_DATE, CMDLINE_BUILD_TIME))
|
|
|
|
exit(1);
|
|
|
|
|
|
|
|
if (!RegisterStaticParserResources() || !RegisterStaticTargetResources()) {
|
|
|
|
fprintf(stderr, "\nFATAL ERROR: Could not initialize resource strings\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!RegisterStaticParserPlugins() || !RegisterStaticTargetPlugins()) {
|
|
|
|
fprintf(stderr, "\nFATAL ERROR: Could not initialize built-in plugins\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!RegisterStaticParserToolInfo()) {
|
|
|
|
fprintf(stderr, "\nFATAL ERROR: Could not initialize options\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
GetStaticTarget(&cpu, &os);
|
|
|
|
SetBuildTarget(cpu, os);
|
|
|
|
GetStaticPluginType(&lang, &type);
|
|
|
|
SetPluginType(lang, type);
|
|
|
|
GetStaticParserPluginType(&style);
|
|
|
|
SetParserType(style);
|
|
|
|
|
|
|
|
ret = CmdLine_Driver();
|
|
|
|
if (ret) {
|
|
|
|
if (ret == 2)
|
|
|
|
fprintf(stderr, "\nUser break, cancelled...\n");
|
|
|
|
else
|
|
|
|
fprintf(stderr, "\nErrors caused tool to abort.\n");
|
|
|
|
}
|
|
|
|
CmdLine_Terminate(ret);
|
|
|
|
return ret;
|
|
|
|
}
|