From 3abd66b09008b065c9dc815462261b910a6180ae Mon Sep 17 00:00:00 2001 From: schnetter Date: Tue, 28 Dec 2004 19:03:14 +0000 Subject: Revert accidental changes from the last commit. Sorry. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3945 17b73243-c579-4c4c-a9d2-2d5706c11dac --- src/util/ParseFile.c | 73 +++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 41 deletions(-) (limited to 'src/util/ParseFile.c') diff --git a/src/util/ParseFile.c b/src/util/ParseFile.c index ca886201..9c483ced 100644 --- a/src/util/ParseFile.c +++ b/src/util/ParseFile.c @@ -51,6 +51,14 @@ int ParseFile(FILE *ifp, ********************* Local Data ***************************** ********************************************************************/ +#ifndef WIN32 +#define BOLDON "\033[1m" +#define BOLDOFF "\033[0m" +#else +#define BOLDON "" +#define BOLDOFF "" +#endif + /* parse buffer size */ #define BUF_SZ (8 * 1024) @@ -260,8 +268,8 @@ int ParseFile(FILE *ifp, if (c != '\n') value[p++] = c; if (c == '\n') { - printf ("Warning: Quoted string contains newline for token %s\n", - tokens); + printf ("%sWarning:%s Quoted string contains newline for token %s\n", + BOLDON, BOLDOFF, tokens); printf ("This could indicated a parameter file error or missing quote\n"); #ifdef DEBUG printf ("LINE %d\n",lineno); @@ -280,52 +288,35 @@ int ParseFile(FILE *ifp, else if (c == '$') { /* We got a define */ - char buf[1000]; - char * p = buf; + /* FIXME: Assume it is a parameter file for now */ + char path[500]; + char *parfile; - /* read name */ - do + CCTK_ParameterFilename(500,path); + parfile = strrchr (path, '/'); + if (parfile == NULL) { - c = fgetc(ifp); -#ifdef DEBUG - printf("%c",c); -#endif - *p++ = c; + parfile = path; } - while (!(c==' ' || c=='\t' || c == '\n' || c == '\r' || c == EOF)); - *--p = 0; - - if (strcmp (buf, "parfile") == 0) + else { - char path[1000]; - char *parfile; - char *dot; - - CCTK_ParameterFilename(sizeof path,path); - /* remove the leading directory part */ - parfile = strrchr (path, '/'); - if (parfile == NULL) - { - parfile = path; - } - else - { - parfile++; - } - /* skip the parameter file extension */ - dot = strrchr (parfile, '.'); - if (dot) - { - *dot = 0; - } - - set_function(tokens,parfile,lineno); + parfile++; } - else + /* skip the parameter file extension */ + if (strcmp (parfile + strlen (parfile) - 4, ".par") == 0) { - fprintf(stderr, "Error at line %d. Unknown define '%s'.\n", lineno, buf); - num_errors++; + parfile[strlen (parfile) - 4] = 0; + } + + /* ignore everything else on the line */ + while (!(c==' ' || c=='\t' || c == '\n' || c == '\r' || c == EOF)) + { + c = fgetc(ifp); +#ifdef DEBUG + printf("%c",c); +#endif } + set_function(tokens,parfile,lineno); } else { -- cgit v1.2.3