diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/etc/error.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'sys/etc/error.x')
-rw-r--r-- | sys/etc/error.x | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/sys/etc/error.x b/sys/etc/error.x new file mode 100644 index 00000000..42c390b5 --- /dev/null +++ b/sys/etc/error.x @@ -0,0 +1,60 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <error.h> + +# ERROR -- Take an error action. A call to ERROR does not necessarily +# terminate task execution, i.e., if an IFERR error handler is posted it +# will receive control after the procedure call stack is unwound back +# to the procedure containing the error handler. + +procedure error (error_code, message) + +int error_code # positive error code identifying error +char message[ARB] # error message describing error +include "error.com" + +begin + if (xerflg) { # error already posted? + if (max(error_code,1) == xercod) + return # same error again + else + call erract (EA_FATAL) # too many errors + } + + call xeract (error_code, message, EA_ERROR) +end + + +# FATAL -- Called when a fatal (irrecoverable) error occurs. Fatal errors +# cannot be caught by IFERR handlers. The calling task is terminated and +# error recovery is initiated in the IRAF Main. + +procedure fatal (error_code, message) + +int error_code # positive error code identifying error +char message[ARB] # error message describing error + +begin + call xeract (error_code, message, EA_FATAL) +end + + +# XERACT -- Take an error action; called by ERROR or FATAL. + +procedure xeract (error_code, message, severity) + +int error_code # positive error code identifying error +char message[ARB] # error message describing error +int severity # severity of the error +include "error.com" + +begin + xerflg = true # post error + xercod = max (1, error_code) + call strcpy (message, xermsg, SZ_XERMSG) + + if (nhandlers > 0 && severity == EA_ERROR) # is a handler posted? + return + else + call erract (severity) # take error action +end |