summaryrefslogtreecommitdiff
path: root/unsorted/IO.c
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2022-10-14 23:15:32 +0100
committerAsh Wolf <ninji@wuffs.org>2022-10-14 23:15:32 +0100
commit775b6861666af36d317fb577cf489e2c6377f878 (patch)
tree2ae8c829eb861c85a6e2b5acf42f51919a0d78f2 /unsorted/IO.c
parentb8df05413a4e8b299de07b915cddce73a3bb16e3 (diff)
downloadMWCC-775b6861666af36d317fb577cf489e2c6377f878.tar.gz
MWCC-775b6861666af36d317fb577cf489e2c6377f878.zip
add tons of stuff
Diffstat (limited to '')
-rw-r--r--unsorted/IO.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/unsorted/IO.c b/unsorted/IO.c
new file mode 100644
index 0000000..7ef3cb1
--- /dev/null
+++ b/unsorted/IO.c
@@ -0,0 +1,83 @@
+#include "mwcc_decomp.h"
+
+void ShowTextHandle(const char *description, Handle text) {
+ CWMemHandle mh;
+
+ if (!text)
+ return;
+
+ if (description)
+ CLPStatus(71, description);
+ CWSecretAttachHandle(parseopts.context, text, &mh);
+ CWParserDisplayTextHandle(parseopts.context, description, mh);
+}
+
+void ShowVersion(Boolean decorate) {
+ char *vplugin;
+ char *valtplugin;
+ const char *bdate;
+ const char *btime;
+ Handle txt;
+ int x;
+
+ vplugin = 0;
+ valtplugin = 0;
+ if (parseopts.printedVersion)
+ return;
+
+ txt = NewHandle(0);
+ if (!txt) {
+ fprintf(stderr, "\n*** Out of memory\n");
+ exit(-23);
+ }
+
+ for (x = 0; x < parseopts.numPlugins; x++) {
+ if (parseopts.plugins[x].plugintype == CWFOURCHAR('c','l','d','r')) continue;
+ if (parseopts.plugins[x].plugintype == CWFOURCHAR('P','a','r','s')) continue;
+
+ if (pTool->TYPE == parseopts.plugins[x].plugintype) {
+ if (!vplugin && pTool->LANG == parseopts.plugins[x].language)
+ vplugin = parseopts.plugins[x].version;
+ else
+ valtplugin = parseopts.plugins[x].version;
+ }
+ }
+
+ CWParserGetBuildDate(parseopts.context, &bdate, &btime);
+ HPrintF(txt, "\n");
+ if (parseopts.toolVersion) {
+ HPrintF(
+ txt,
+ "%s.\n%s, %s\nAll rights reserved.\n%s\n",
+ pTool->toolInfo,
+ parseopts.toolVersion->copyright,
+ parseopts.toolVersion->company,
+ parseopts.toolVersion->version
+ );
+ } else {
+ HPrintF(
+ txt,
+ "%s.\nCopyright (c)%s Metrowerks, Inc.\nAll rights reserved.\n%s\n",
+ pTool->toolInfo,
+ pTool->copyright,
+ vplugin ? vplugin : valtplugin ? valtplugin : ""
+ );
+ }
+
+ HPrintF(txt, "Runtime Built: %s %s\n", bdate, btime);
+ HPrintF(txt, "\n");
+
+ if (decorate) {
+ HPrintF(
+ txt,
+ "Please enter '%s %chelp' for information about options.\n\n",
+ OS_GetFileNamePtr(parseopts.args->argv[0]),
+ MAINOPTCHAR[0]
+ );
+ }
+
+ ShowTextHandle(0, txt);
+ DisposeHandle(txt);
+
+ parseopts.printedVersion = 1;
+}