diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-11-23 17:04:15 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-11-23 17:04:15 +0000 |
commit | a440bd5e66dd5b662879b60c0e0ca10c3460fc7d (patch) | |
tree | c1cf06bfc8465e797faa1700220fda84c9382ac3 | |
parent | 5f4531fe43381c81fffea1f1f4adc4d828feb44a (diff) |
Added variable argument CCTK_Warn.
Tom
git-svn-id: http://svn.cactuscode.org/flesh/trunk@1161 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rw-r--r-- | src/main/WarnLevel.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/src/main/WarnLevel.c b/src/main/WarnLevel.c index fae647ae..30ec2667 100644 --- a/src/main/WarnLevel.c +++ b/src/main/WarnLevel.c @@ -153,6 +153,57 @@ void FMODIFIER FORTRAN_NAME(CCTK_Warn)(int *level, int *line, THREE_FORTSTRINGS_ } /*@@ + @routine CCTK_VWarn + @date Sun Nov 14 00:23:29 1999 + @author Tom Goodale + @desc + Warning routine with variable argument list + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ +void CCTK_VWarn(int level, int line, const char *file, const char *thorn, const char *format, ...) +{ + DECLARE_CCTK_PARAMETERS + + va_list ap; + + if(level <= warning_level) + { + + va_start(ap, format); + + if (cctk_full_warnings) + { + fprintf(stderr, "WARNING level %d in thorn %s (line %d of %s): \n", level, thorn, line, file); + fprintf(stderr, " -> "); + vfprintf(stderr, format, ap); + fprintf(stderr, "\n"); + fflush(stderr); + } + else + { + fprintf(stderr, "WARNING (%s): ", thorn); + vfprintf(stderr, format, ap); + fprintf(stderr, "\n"); + fflush(stderr); + } + + va_end(ap); + } + + if(level <= error_level) + { + exit(99); + } +} + + + /*@@ @routine CCTK_ParamWarn @date Wed Feb 17 00:45:07 1999 @author Tom Goodale @@ -357,7 +408,7 @@ void FMODIFIER FORTRAN_NAME(CCTK_VInfo)(int format_number, ...) { format_string = (char *)GetKeyedData(formatlist, format_number); - /* Pick an aribitrary starting length for the message */ + /* Pick an arbitrary starting length for the message */ message_length=5*strlen(format_string); message = (char *)malloc(message_length); |