]> granicus.if.org Git - yasm/commitdiff
Add *Now and *At error and warning functions. *At functions still need to
authorPeter Johnson <peter@tortall.net>
Thu, 27 Sep 2001 18:51:37 +0000 (18:51 -0000)
committerPeter Johnson <peter@tortall.net>
Thu, 27 Sep 2001 18:51:37 +0000 (18:51 -0000)
be implemented.  Consider a rename of these functions at some point?

svn path=/trunk/yasm/; revision=248

libyasm/errwarn.c
libyasm/errwarn.h
src/errwarn.c
src/errwarn.h

index f2191f897fdcde8e791602bb932a366c8dec1563..377da658d28c776d0a1415f913af831a8ebf8e82 100644 (file)
@@ -151,7 +151,7 @@ Fatal(fatal_num num)
 
 /* Register an error.  Uses argtypes as described above to specify the
  * argument types.  Does not print the error, only stores it for
- * OutputError() to print. */
+ * OutputAllErrorWarning() to print. */
 void
 Error(char *fmt, ...)
 {
@@ -198,7 +198,7 @@ Error(char *fmt, ...)
 
 /* Register a warning.  Uses argtypes as described above to specify the
  * argument types.  Does not print the warning, only stores it for
- * OutputWarning() to print. */
+ * OutputAllErrorWarning() to print. */
 void
 Warning(char *fmt, ...)
 {
@@ -233,6 +233,41 @@ Warning(char *fmt, ...)
     warning_count++;
 }
 
+void
+ErrorNow(char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    vfprintf(stderr, fmt, ap);
+    va_end(ap);
+    fprintf(stderr, "\n");
+}
+
+void
+WarningNow(char *fmt, ...)
+{
+    va_list ap;
+
+    fprintf(stderr, "%s ", _("warning:"));
+    va_start(ap, fmt);
+    vfprintf(stderr, fmt, ap);
+    va_end(ap);
+    fprintf(stderr, "\n");
+}
+
+void
+ErrorAt(char *filename, unsigned long line, char *fmt, ...)
+{
+    /* TODO */
+}
+
+void
+WarningAt(char *filename, unsigned long line, char *fmt, ...)
+{
+    /* TODO */
+}
+
 /* Output all previously stored errors and warnings to stderr. */
 unsigned int
 OutputAllErrorWarning(void)
index 9a581272da59207ddcc92a2a2e53c3fd4be30f2c..cb701f9569c692d810be5f384028eb1e785bfc20 100644 (file)
@@ -40,6 +40,20 @@ void Fatal(fatal_num);
 void Error(char *, ...);
 void Warning(char *, ...);
 
+/* Use Error() and Warning() instead of ErrorAt() and WarningAt() when being
+ * called in line order from a parser.  The *At() functions are much slower,
+ * at least in the current implementation.
+ */
+void ErrorAt(char *filename, unsigned long line, char *, ...);
+void WarningAt(char *filename, unsigned long line, char *, ...);
+
+/* These two functions immediately output the error or warning, with no file
+ * or line information.  They should be used for errors and warnings outside
+ * the parser stage (at program startup, for instance).
+ */
+void ErrorNow(char *, ...);
+void WarningNow(char *, ...);
+
 /* Returns total number of errors to this point in assembly. */
 unsigned int OutputAllErrorWarning(void);
 
index f2191f897fdcde8e791602bb932a366c8dec1563..377da658d28c776d0a1415f913af831a8ebf8e82 100644 (file)
@@ -151,7 +151,7 @@ Fatal(fatal_num num)
 
 /* Register an error.  Uses argtypes as described above to specify the
  * argument types.  Does not print the error, only stores it for
- * OutputError() to print. */
+ * OutputAllErrorWarning() to print. */
 void
 Error(char *fmt, ...)
 {
@@ -198,7 +198,7 @@ Error(char *fmt, ...)
 
 /* Register a warning.  Uses argtypes as described above to specify the
  * argument types.  Does not print the warning, only stores it for
- * OutputWarning() to print. */
+ * OutputAllErrorWarning() to print. */
 void
 Warning(char *fmt, ...)
 {
@@ -233,6 +233,41 @@ Warning(char *fmt, ...)
     warning_count++;
 }
 
+void
+ErrorNow(char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    vfprintf(stderr, fmt, ap);
+    va_end(ap);
+    fprintf(stderr, "\n");
+}
+
+void
+WarningNow(char *fmt, ...)
+{
+    va_list ap;
+
+    fprintf(stderr, "%s ", _("warning:"));
+    va_start(ap, fmt);
+    vfprintf(stderr, fmt, ap);
+    va_end(ap);
+    fprintf(stderr, "\n");
+}
+
+void
+ErrorAt(char *filename, unsigned long line, char *fmt, ...)
+{
+    /* TODO */
+}
+
+void
+WarningAt(char *filename, unsigned long line, char *fmt, ...)
+{
+    /* TODO */
+}
+
 /* Output all previously stored errors and warnings to stderr. */
 unsigned int
 OutputAllErrorWarning(void)
index 9a581272da59207ddcc92a2a2e53c3fd4be30f2c..cb701f9569c692d810be5f384028eb1e785bfc20 100644 (file)
@@ -40,6 +40,20 @@ void Fatal(fatal_num);
 void Error(char *, ...);
 void Warning(char *, ...);
 
+/* Use Error() and Warning() instead of ErrorAt() and WarningAt() when being
+ * called in line order from a parser.  The *At() functions are much slower,
+ * at least in the current implementation.
+ */
+void ErrorAt(char *filename, unsigned long line, char *, ...);
+void WarningAt(char *filename, unsigned long line, char *, ...);
+
+/* These two functions immediately output the error or warning, with no file
+ * or line information.  They should be used for errors and warnings outside
+ * the parser stage (at program startup, for instance).
+ */
+void ErrorNow(char *, ...);
+void WarningNow(char *, ...);
+
 /* Returns total number of errors to this point in assembly. */
 unsigned int OutputAllErrorWarning(void);