diff options
author | schnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2004-12-28 18:55:00 +0000 |
---|---|---|
committer | schnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2004-12-28 18:55:00 +0000 |
commit | fe4ba087da02fb06b41e936626521f0fd77434e3 (patch) | |
tree | e0829b3f03596b79e7f80f827ed0da20468da299 /src/util/ParseFile.c | |
parent | b26a4e235d92a4c2d91fb26db10f5034e7a88bb8 (diff) |
Rename "round" to "myround". Otherwise, the function "round" has the
same name as the one from <math.h> (which is #included) but has a
different return type, which is an error for gcc 4.0.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@3944 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/util/ParseFile.c')
-rw-r--r-- | src/util/ParseFile.c | 73 |
1 files changed, 41 insertions, 32 deletions
diff --git a/src/util/ParseFile.c b/src/util/ParseFile.c index 9c483ced..ca886201 100644 --- a/src/util/ParseFile.c +++ b/src/util/ParseFile.c @@ -51,14 +51,6 @@ 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) @@ -268,8 +260,8 @@ int ParseFile(FILE *ifp, if (c != '\n') value[p++] = c; if (c == '\n') { - printf ("%sWarning:%s Quoted string contains newline for token %s\n", - BOLDON, BOLDOFF, tokens); + printf ("Warning: Quoted string contains newline for token %s\n", + tokens); printf ("This could indicated a parameter file error or missing quote\n"); #ifdef DEBUG printf ("LINE %d\n",lineno); @@ -288,35 +280,52 @@ int ParseFile(FILE *ifp, else if (c == '$') { /* We got a define */ - /* FIXME: Assume it is a parameter file for now */ - char path[500]; - char *parfile; + char buf[1000]; + char * p = buf; - CCTK_ParameterFilename(500,path); - parfile = strrchr (path, '/'); - if (parfile == NULL) - { - parfile = path; - } - else - { - parfile++; - } - /* skip the parameter file extension */ - if (strcmp (parfile + strlen (parfile) - 4, ".par") == 0) - { - parfile[strlen (parfile) - 4] = 0; - } - - /* ignore everything else on the line */ - while (!(c==' ' || c=='\t' || c == '\n' || c == '\r' || c == EOF)) + /* read name */ + do { c = fgetc(ifp); #ifdef DEBUG printf("%c",c); #endif + *p++ = c; + } + while (!(c==' ' || c=='\t' || c == '\n' || c == '\r' || c == EOF)); + *--p = 0; + + if (strcmp (buf, "parfile") == 0) + { + 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); + } + else + { + fprintf(stderr, "Error at line %d. Unknown define '%s'.\n", lineno, buf); + num_errors++; } - set_function(tokens,parfile,lineno); } else { |