From 7c26fa28dcbf0309ef21f715e2884399fccb444f Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 31 Jul 2002 16:42:21 +0000 Subject: [PATCH] another cmdlib function dies --- tools/qfcc/source/cmdlib.c | 69 -------------------------------------- tools/qfcc/source/qfcc.c | 13 +++---- 2 files changed, 7 insertions(+), 75 deletions(-) diff --git a/tools/qfcc/source/cmdlib.c b/tools/qfcc/source/cmdlib.c index 905077a46..aa834e54f 100644 --- a/tools/qfcc/source/cmdlib.c +++ b/tools/qfcc/source/cmdlib.c @@ -50,8 +50,6 @@ static const char rcsid[] = #include "cmdlib.h" -char qfcc_com_token[1024]; - /* Error @@ -72,73 +70,6 @@ Error (char *error, ...) } -/* - Parse - - Parse a token out of a string -*/ -char * -Parse (char *data) -{ - int c; - int len = 0; - - qfcc_com_token[0] = 0; - - if (!data) - return NULL; - - // skip whitespace - skipwhite: - while ((c = *data) <= ' ') { - if (c == 0) { - return NULL; // end of file; - } - data++; - } - - // skip // comments - if (c == '/' && data[1] == '/') { - while (*data && *data != '\n') - data++; - goto skipwhite; - } - // handle quoted strings specially - if (c == '\"') { - data++; - do { - c = *data++; - if (c == '\"') { - qfcc_com_token[len] = 0; - return data; - } - qfcc_com_token[len] = c; - len++; - } while (1); - } - // parse single characters - if (c == '{' || c == '}' || c == ')' || c == '(' || c == '\'' || c == ':') { - qfcc_com_token[len] = c; - len++; - qfcc_com_token[len] = 0; - return data + 1; - } - // parse a regular word - do { - qfcc_com_token[len] = c; - data++; - len++; - c = *data; - if (c == '{' || c == '}' || c == ')' || c == '(' || c == '\'' - || c == ':') - break; - } while (c > 32); - - qfcc_com_token[len] = 0; - return data; -} - - /* ============================================================================= diff --git a/tools/qfcc/source/qfcc.c b/tools/qfcc/source/qfcc.c index 8f5e83e81..93de2fb9e 100644 --- a/tools/qfcc/source/qfcc.c +++ b/tools/qfcc/source/qfcc.c @@ -54,6 +54,7 @@ static const char rcsid[] = #include #include +#include #include #include #include @@ -572,7 +573,7 @@ static int progs_src_compile (void) { dstring_t *filename = dstring_newstr (); - char *src; + const char *src; int crc = 0; if (options.verbosity >= 1 && strcmp (sourcedir, "")) { @@ -588,13 +589,13 @@ progs_src_compile (void) dsprintf (filename, "%s", progs_src); LoadFile (filename->str, (void *) &src); - if (!(src = Parse (src))) { + if (!(src = COM_Parse (src))) { fprintf (stderr, "No destination filename. qfcc --help for info.\n"); return 1; } if (!options.output_file) - options.output_file = strdup (qfcc_com_token); + options.output_file = strdup (com_token); if (options.verbosity >= 1) { printf ("output file: %s\n", options.output_file); } @@ -606,7 +607,7 @@ progs_src_compile (void) begin_compilation (); // compile all the files - while ((src = Parse (src))) { + while ((src = COM_Parse (src))) { int err; //extern int yydebug; @@ -614,9 +615,9 @@ progs_src_compile (void) if (*sourcedir) dsprintf (filename, "%s%c%s", sourcedir, PATH_SEPARATOR, - qfcc_com_token); + com_token); else - dsprintf (filename, "%s", qfcc_com_token); + dsprintf (filename, "%s", com_token); if (options.verbosity >= 2) printf ("compiling %s\n", filename->str);