From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/etc/error.x | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 sys/etc/error.x (limited to 'sys/etc/error.x') 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 -- 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 -- cgit