diff options
author | Ash Wolf <ninji@wuffs.org> | 2022-10-11 03:18:42 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2022-10-11 03:18:42 +0100 |
commit | 26b57fbea1a969ef6405365ff78391e9d3605621 (patch) | |
tree | b6f14f5c083d0fbb42c5495eea7c74099ff45315 /UMain.c | |
parent | 7d4bee5f8f28b72610c8518e5cb9dc145c68b816 (diff) | |
download | MWCC-26b57fbea1a969ef6405365ff78391e9d3605621.tar.gz MWCC-26b57fbea1a969ef6405365ff78391e9d3605621.zip |
add cmakelists for CLion, tons and tons of reorganisation using new info from the Pro8 compiler
Diffstat (limited to '')
-rw-r--r-- | UMain.c | 84 |
1 files changed, 38 insertions, 46 deletions
@@ -1,21 +1,13 @@ -#include "UCWInterface.h" - -// 1C40 to 2008 - -// TODO move me -// TODO move me - -// unsure where this is, may be here, maybe not? -extern char cmdline_build_date[32]; -extern char cmdline_build_time[32]; +#include "includes/mwcc_decomp.h" +// TODO split main off into CLStaticMain.c int main(int argc, const char **argv) { - unsigned long cpu; - unsigned long os; - unsigned long language; - unsigned long plugintype; - unsigned long style; - int result; + CWDataType cpu; + CWDataType os; + CWDataType lang; + CWDataType type; + CWDataType style; + int ret; if (CmdLine_Initialize(argc, argv, CMDLINE_BUILD_DATE, CMDLINE_BUILD_TIME)) exit(1); @@ -37,48 +29,48 @@ int main(int argc, const char **argv) { GetStaticTarget(&cpu, &os); SetBuildTarget(cpu, os); - GetStaticPluginType(&language, &plugintype); - SetPluginType(language, plugintype); + GetStaticPluginType(&lang, &type); + SetPluginType(lang, type); GetStaticParserPluginType(&style); SetParserType(style); - result = CmdLine_Driver(); - if (result) { - if (result == 2) + 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(result); - return result; + CmdLine_Terminate(ret); + return ret; } -int RegisterResource(const char *name, short index, void *data) { - Handle r; +int RegisterResource(const char *name, short rsrcid, Handle list) { + Handle h; if (data == 0) { - r = GetResource('STR#', index); - if (r == 0) { - CLFatalError("Resource ('STR#',%d) '%s' not found in executable\n", index, name); + h = GetResource('STR#', rsrcid); + if (h == 0) { + CLFatalError("Resource ('STR#',%d) '%s' not found in executable\n", rsrcid, name); return 0; } - ReleaseResource(r); + ReleaseResource(h); return 1; } else { - return Res_AddResource(name, index, data); + return Res_AddResource(name, rsrcid, list); } } -int RegisterStaticPlugin(const BasePluginCallbacks *cb) { - return Plugins_Add(Plugin_New(cb, 0, 0)); +int RegisterStaticPlugin(const BasePluginCallbacks *callbacks) { + return Plugins_Add(Plugin_New(callbacks, 0, 0)); } -int RegisterStaticCompilerLinkerPlugin(const BasePluginCallbacks *cb, void *b) { - return Plugins_Add(Plugin_New(cb, b, 0)); +int RegisterStaticCompilerLinkerPlugin(const BasePluginCallbacks *callbacks, const CompilerLinkerPluginCallbacks *cl_callbacks) { + return Plugins_Add(Plugin_New(callbacks, cl_callbacks, 0)); } -int RegisterStaticParserPlugin(const BasePluginCallbacks *cb, void *b) { - return Plugins_Add(Plugin_New(cb, 0, b)); +int RegisterStaticParserPlugin(const BasePluginCallbacks *callbacks, const ParserPluginCallbacks *pr_callbacks) { + return Plugins_Add(Plugin_New(callbacks, 0, pr_callbacks)); } void SetBuildTarget(CWDataType cpu, CWDataType os) { @@ -86,18 +78,18 @@ void SetBuildTarget(CWDataType cpu, CWDataType os) { clState.os = os; } -void SetParserType(CWDataType style) { - clState.style = style; +void SetParserType(CWDataType plang) { + clState.parserstyle = plang; } -void SetPluginType(CWDataType language, CWDataType plugintype) { - clState.language = language; - clState.plugintype = plugintype; +void SetPluginType(CWDataType lang, CWDataType type) { + clState.language = lang; + clState.plugintype = type; } -int CmdLine_Initialize(int argc, const char **argv, const char *buildDate, const char *buildTime) { - strncpy(cmdline_build_date, buildDate, sizeof(cmdline_build_date)); - strncpy(cmdline_build_time, buildTime, sizeof(cmdline_build_time)); +int CmdLine_Initialize(int argc, const char **argv, const char *builddate, const char *buildtime) { + strncpy(cmdline_build_date, builddate, sizeof(cmdline_build_date)); + strncpy(cmdline_build_time, buildtime, sizeof(cmdline_build_time)); return Main_Initialize(argc, argv); } @@ -105,6 +97,6 @@ int CmdLine_Driver() { return Main_Driver(); } -int CmdLine_Terminate(int code) { - return Main_Terminate(code); +int CmdLine_Terminate(int exitcode) { + return Main_Terminate(exitcode); } |