aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/photcal/parser/prerror.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /noao/digiphot/photcal/parser/prerror.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'noao/digiphot/photcal/parser/prerror.x')
-rw-r--r--noao/digiphot/photcal/parser/prerror.x57
1 files changed, 57 insertions, 0 deletions
diff --git a/noao/digiphot/photcal/parser/prerror.x b/noao/digiphot/photcal/parser/prerror.x
new file mode 100644
index 00000000..8821810e
--- /dev/null
+++ b/noao/digiphot/photcal/parser/prerror.x
@@ -0,0 +1,57 @@
+include "../lib/parser.h"
+include "../lib/prdefs.h"
+
+
+# PR_ERROR - Issue an error message to the standard output, and take an
+# error action acording to the severity code. Error messages can be disabled
+# if the error flag is set to NO.
+
+procedure pr_error (msg, severity)
+
+char msg[ARB] # error message
+int severity # severity code
+
+include "lexer.com"
+
+#bool clgetb()
+int pr_geti()
+
+begin
+ # Debug ?
+ #if (clgetb ("debug.parcode")) {
+ #call eprintf ("pr_error (msg=%s) (sev=%d)\n")
+ #call pargstr (msg)
+ #call pargi (severity)
+ #}
+
+ # Test whether to process errors, or not
+ if (pr_geti (FLAGERRORS) == NO)
+ return
+
+ # Branch on error severity code
+ switch (severity) {
+ case PERR_WARNING:
+ call pr_inci (NWARNINGS, 1)
+ call printf ("** Warning near line %d: %s%s\n")
+ call pargi (nlines)
+ call pargstr (line)
+ call pargstr (msg)
+ case PERR_SYNTAX:
+ call pr_inci (NERRORS, 1)
+ call printf ("** Error near line %d: %s%s at '%s'\n")
+ call pargi (nlines)
+ call pargstr (line)
+ call pargstr (msg)
+ call pargstr (id)
+ case PERR_SEMANTIC:
+ call pr_inci (NERRORS, 1)
+ call printf ("** Error near line %d: %s%s\n")
+ call pargi (nlines)
+ call pargstr (line)
+ call pargstr (msg)
+ case PERR_POSTPROC:
+ call pr_inci (NERRORS, 1)
+ call printf ("** Error: %s\n")
+ call pargstr (msg)
+ }
+end