From d1f153d34b023d81768f6087f67dbfff714bafc9 Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Wed, 19 Oct 2022 21:16:13 +0100 Subject: let's commit all this before my VM blows up and nukes my work --- unsorted/ParserHelpers.c | 65 ++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 32 deletions(-) (limited to 'unsorted/ParserHelpers.c') diff --git a/unsorted/ParserHelpers.c b/unsorted/ParserHelpers.c index c8d4c55..4cb793e 100644 --- a/unsorted/ParserHelpers.c +++ b/unsorted/ParserHelpers.c @@ -1,4 +1,5 @@ -#include "mwcc_decomp.h" +#include "parser.h" +#include "cmdline.h" #include SInt16 lastStage; @@ -44,7 +45,7 @@ char *GetEnvVar(const char *name, Boolean warn, const char **match) { } if (warn) - CLPReportWarning(52, last); + CLPReportWarning(CLPStr52, last); *match = 0; return 0; } @@ -82,7 +83,7 @@ static Boolean MatchesExtension(const char *list, const char *filename) { return !*list && !*ptr; } -int Opt_AddAccessPath(const char *opt, void *var, const char *arg) { +int Opt_AddAccessPath(const char *opt, void *var, const char *arg, int flags) { OSPathSpec spec; int err; @@ -93,16 +94,16 @@ int Opt_AddAccessPath(const char *opt, void *var, const char *arg) { return 1; if (strlen(arg) >= 256) { - CLPReportError(13, arg + strlen(arg) - 32, 256); + CLPReportError(CLPStr13, arg + strlen(arg) - 32, 256); return 0; } err = OS_MakePathSpec(0, arg, &spec); if (err == ENOENT || err == ENOENT) { - CLPReportWarning(45, arg); + CLPReportWarning(CLPStr45, arg); return 1; } else if (err != 0) { - CLPOSAlert(45, err, arg); + CLPOSAlert(CLPStr45, err, arg); return 1; } @@ -113,7 +114,7 @@ int Opt_AddAccessPath(const char *opt, void *var, const char *arg) { return 1; } -int Opt_AddFrameworkPath(const char *opt, void *var, const char *arg) { +int Opt_AddFrameworkPath(const char *opt, void *var, const char *arg, int flags) { OSPathSpec spec; int err; @@ -124,16 +125,16 @@ int Opt_AddFrameworkPath(const char *opt, void *var, const char *arg) { return 1; if (strlen(arg) >= 256) { - CLPReportError(13, arg + strlen(arg) - 32, 256); + CLPReportError(CLPStr13, arg + strlen(arg) - 32, 256); return 0; } err = OS_MakePathSpec(0, arg, &spec); if (err == ENOENT || err == ENOENT) { - CLPReportWarning(45, arg); + CLPReportWarning(CLPStr45, arg); return 1; } else if (err != 0) { - CLPOSAlert(45, err, arg); + CLPOSAlert(CLPStr45, err, arg); return 1; } else { Frameworks_AddPath(&spec); @@ -141,7 +142,7 @@ int Opt_AddFrameworkPath(const char *opt, void *var, const char *arg) { } } -int Opt_AddFramework(const char *opt, void *var, const char *arg) { +int Opt_AddFramework(const char *opt, void *var, const char *arg, int flags) { if (!Frameworks_AddFramework(arg ? arg : opt, 0, 0)) return 0; else @@ -190,7 +191,7 @@ int AddAccessPathList(const char *list, char sep1, char sep2, int source, char * ListParseMessage( CLPReportError_V, (source == 1) ? text : NULL, - 9, + CLPStr9, tmp, tmp + strlen(tmp) - 16, 256); @@ -202,7 +203,7 @@ int AddAccessPathList(const char *list, char sep1, char sep2, int source, char * ListParseMessage( CLPReportWarning_V, (source == 1) ? text : NULL, - 45, + CLPStr45, tmp); } else { AddAccessPath(&spec, type, position, recurse ^ recursive); @@ -218,7 +219,7 @@ int AddAccessPathList(const char *list, char sep1, char sep2, int source, char * return 1; } -int Opt_FindAndAddFile(const char *opt, void *var, const char *arg) { +int Opt_FindAndAddFile(const char *opt, void *var, const char *arg, int flags) { OSSpec spec; int err; Boolean isfile; @@ -235,11 +236,11 @@ int Opt_FindAndAddFile(const char *opt, void *var, const char *arg) { err = OS_Status(&spec); if (!err && !isfile) { - CLPReportError(47, arg); + CLPReportError(CLPStr47, arg); parseopts.unusedFiles++; return 0; } else if (err && err != ENOENT) { - CLPOSAlert(44, err, arg); + CLPOSAlert(CLPStr44, err, arg); parseopts.unusedFiles++; return 0; } else if (err && parseopts.alwaysUsePaths) { @@ -247,13 +248,13 @@ int Opt_FindAndAddFile(const char *opt, void *var, const char *arg) { } if (err) { - CLPReportError(44, arg); + CLPReportError(CLPStr44, arg); parseopts.unusedFiles++; return 0; } if (var && !MatchesExtension((const char *) var, arg)) - CLPReportWarning(76, arg, var); + CLPReportWarning(CLPStr76, arg, var); if (!AddFileToProject(&spec, lastStage, parseopts.lastoutputname, 1, -1)) { parseopts.unusedFiles++; @@ -277,14 +278,14 @@ int Opt_FindAndAddFileRef(const char *opt, void *var, const char *arg) { parseopts.userSpecifiedFiles++; if (var && !MatchesExtension((const char *) var, arg)) - CLPReportWarning(76, arg, var); + CLPReportWarning(CLPStr76, arg, var); err = OS_MakeSpec(arg, &spec, &isfile); if (!err) err = OS_Status(&spec); if (!err && !isfile) { - CLPReportError(47, arg); + CLPReportError(CLPStr47, arg); parseopts.unusedFiles++; return 0; } else if (err && parseopts.alwaysUsePaths) { @@ -307,7 +308,7 @@ int Opt_AddUnixLibraryFile(const char *opt, void *var, const char *name) { char tmpname[64]; if (strlen(name) >= 56) { - CLPReportError(13, name + strlen(name) - 32, 64); + CLPReportError(CLPStr13, name + strlen(name) - 32, 64); return 0; } @@ -336,7 +337,7 @@ int Opt_AddUnixLibraryFile(const char *opt, void *var, const char *name) { if (failed) { failed = !FindFileInPath(name, &spec); if (failed) - CLPReportError(49, name, var, name); + CLPReportError(CLPStr49, name, var, name); } if (!failed) { @@ -368,7 +369,7 @@ int AddFileList(const char *list, char sep1, char sep2, int source, char *text, ListParseMessage( CLPReportError_V, (source == 1) ? text : 0, - 9, + CLPStr9, tmp, tmp + strlen(tmp) - 16, 256 @@ -381,14 +382,14 @@ int AddFileList(const char *list, char sep1, char sep2, int source, char *text, ListParseMessage( CLPReportError_V, (source == 1) ? text : 0, - 16, + CLPStr16, tmp ); } else { ListParseMessage( CLPReportWarning_V, (source == 1) ? text : 0, - 44, + CLPStr44, tmp ); } @@ -416,18 +417,18 @@ void GetCFileNameInOutputDirectory(const char *input, char *name, int maxlen) { err = OS_MakeFileSpec(input, &spec); if (err) { - CLPOSAlert(64, err, input); + CLPOSAlert(CLPStr64, err, input); name[0] = 0; return; } if (!IsFileInOutputDirectory(&spec)) { - CLPReportWarning(61, OS_SpecToStringRelative(&spec, 0, STSbuf, sizeof(STSbuf))); + CLPReportWarning(CLPStr61, OS_SpecToStringRelative(&spec, 0, STSbuf, sizeof(STSbuf))); } OS_NameSpecToString(&spec.name, filename, 256); if (strlen(filename) >= maxlen) { - CLPReportWarning(65, filename, maxlen - 1); + CLPReportWarning(CLPStr65, filename, maxlen - 1); filename[maxlen - 1] = 0; } @@ -469,7 +470,7 @@ void AddStringToHandle(Handle *h, const char *str) { AddStringLenToHandle(h, str, strlen(str)); } -int Opt_PrintVersion(const char *opt, void *var, const char *arg) { +int Opt_PrintVersion(const char *opt, void *var, const char *arg, int flags) { ShowVersion(0); return 1; } @@ -500,7 +501,7 @@ void GetFirstSourceFilenameBase(char *buffer, char *defaul) { strcpy(buffer, defaul); } -int Opt_SavePrefs(const char *opt, void *var, const char *arg) { +int Opt_SavePrefs(const char *opt, void *var, const char *arg, int flags) { Parser_StorePanels(parseopts.context); return 1; } @@ -520,14 +521,14 @@ int ParseNumber(const char *arg, Boolean emit_error, SInt32 *ret, const char **e *endptr = end; if (*end && emit_error) { - CLPReportError(5, "", arg); + CLPReportError(CLPStr5, "", arg); return 0; } return 1; } -int Opt_MaybeMoveAccessPaths(const char *opt, void *var, const char *arg) { +int Opt_MaybeMoveAccessPaths(const char *opt, void *var, const char *arg, int flags) { if (dashIMinusMovesPaths && !usedDashIMinus) MoveSystemPathsIntoUserList(); return 1; -- cgit v1.2.3