summaryrefslogtreecommitdiff
path: root/UMain.c
diff options
context:
space:
mode:
Diffstat (limited to 'UMain.c')
-rw-r--r--UMain.c84
1 files changed, 38 insertions, 46 deletions
diff --git a/UMain.c b/UMain.c
index 717eee1..752f640 100644
--- a/UMain.c
+++ b/UMain.c
@@ -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);
}