Error_handling(3NCARG)

🌸 Error_handling 🌸

okay bestie, pull up a chair, because this is the Error_handling page from the NCAR GRAPHICS manual, section 3NCARG, and it's genuinely a whole vibe. πŸ’– It's a set of routines for error handling in NCAR Graphics. Yes, error handling. Yes, it's the unglamorous part. No, you still need it. Let's go. ✨


✨ NAME ✨

Error_handling β€” a whole little squad of routines for handling errors in NCAR Graphics. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

Here's the roster, and every single one of them matters:

  • ENTSR β€” Enters recovery mode. πŸŽ€
  • EPRIN β€” Prints the current error message.
  • ERROF β€” Turns off the internal error flag.
  • FDUM β€” A dump routine β€” and the default version literally just RETURNS. That's it. That's the whole job. πŸ’€
  • ICFELL β€” Checks for an outstanding error condition.
  • ICLOEM β€” Computes the real length of its character-string argument (and yes, it's ignoring blanks on the end, we do not count trailing whitespace in this house βœ‹).
  • NERRO β€” Gets the current value of the internal error flag.
  • RETSR β€” Restores a previous value of the internal error flag.
  • SEMESS β€” Gets a specified portion of the current error message.
  • SETER β€” Called by NCAR Graphics routines to report error conditions.

πŸ’œ C-BINDING SYNOPSIS πŸ’œ

First, the include, and it has to be exactly this:

#include <ncarg/ncargC.h>

then the C squad, all lowercase, all c_-prefixed, all iconic:

  • c_entsr
  • c_eprin
  • c_errof
  • c_icfell
  • c_icloem
  • c_nerro
  • c_retsr
  • c_semess
  • c_seter

(no c_fdum in that list, bestie, that's just how the page reads, don't come for me πŸ™ˆ)


🌈 USING SETER IN NCAR GRAPHICS 🌈

so there are very specific conventions for how SETER gets used inside NCAR Graphics, and the page lays them out like house rules. Here they are, one by one:

  • All detectable errors shall be recoverable, in the sense described above. (That is, in every call to SETER, the final argument shall be a 1, rather than a 2.) This is by request of the folks doing NCAR Interactive, who rightly consider STOPs in the utilities undesirable. The idea is to let the user decide what is to be done about the various error conditions. periodt. πŸ‘‘
  • Whenever an NCAR Graphics routine calls a lower-level routine that might detect an error and call SETER, it should subsequently use ICFELL to check the error state; if a recoverable error has occurred, it should first do required clean-up chores, if possible, and then pass control back to the routine that called it. In all such uses of ICFELL, the first argument should be the name of the routine referencing ICFELL and the second argument should be a new number for the error, reflecting the position of the reference to the lower-level routine in the upper-level routine. 🧚
  • Any NCAR Graphics routine that can be called by a user and that can potentially yield a call to SETER must immediately check the error state and, if that error state is non-zero, return control without doing anything else. This is most conveniently done using a reference to ICFELL; see the second example in the "Usage" section of the description of ICFELL. All such references should have a first argument of the form 'XXXXXX - UNCLEARED PRIOR ERROR', where "XXXXXX" is the name of the routine in which the reference occurs, and a second argument equal to "1". πŸ”₯
  • It is recommended that, within a given utility routine, the error numbers in references to SETER and ICFELL should start at 1 and increment by 1. These numbers generally have no intrinsic meaning in and of themselves: they are merely intended to allow a consultant to find the reference that generated a given error. iykyk. πŸ”
  • NCAR Graphics routines are not required to turn recovery mode on before calling a lower-level routine that might call SETER (which was the convention in the PORT library, as described in the PORT document). Instead, the assumption is that it is the responsibility of the user of NCAR Graphics to set recovery mode if he/she desires to do recovery. Since, by default, recovery mode is turned off, all NCAR Graphics calls to SETER will be treated as fatal: the error message will be printed and execution will be terminated. Once the user turns recovery mode on, however, no NCAR Graphics error will be treated in this way except for one that the user fails to recover from. 😭
Note: These conventions are being adopted as of December 2, 1993, and represent a goal for the future. The current situation is somewhat muddled: In some utilities, all SETER calls are fatal ones. In other utilities, some SETER calls are fatal and some are not. In other utilities, no SETER calls are fatal. In general, errors at a lower level are not detected and passed back up the call chain. Users have complained (and rightly so) that error recovery is, in general, not possible; observance of these conventions should help to fix the situation. πŸ’€
Further note: As of March 30, 1994, the situation has improved markedly. CONPACK and all utilities referenced by it have been updated to follow the guidelines given above and work is proceeding on other utilities. ✨

And then there's one sticky area in which questions remains to be answered: Sometimes, when an error condition occurs during execution of a utility routine that has changed the internal state of GKS or SPPS, it has not been possible to restore the state of those packages to exactly what it was before that routine was entered. In some cases, better bookkeeping would allow restoration to be done; in other cases, though, restoration would involve calling a routine that could generate a call to SETER, which would cause a STOP. In the latter cases, I have not yet worked out a good solution. For the moment, therefore, the situation is this: if you call an NCAR Graphics utility with recovery mode turned on and, when you get control back, you find that an error has occurred, you must be prepared to deal with the possibility that at least the following things might been changed:

  1. the current SET call;
  2. the current polyline color index;
  3. the current polymarker color index;
  4. the current text color index;
  5. the current fill area color index;
  6. the current dash pattern.

so yeah. six things. possibly different. be prepared, bestie. 🫢


πŸŽ€ ACCESS πŸŽ€

To use the Error_handling C or Fortran routines, load the NCAR Graphics libraries ncarg, ncarg_gks, and ncarg_c, preferably in that order. Order matters, okay? don't be chaotic. πŸ’…


⭐ SEE ALSO ⭐

Online: entsr, eprin, errof, fdum, icfell, icloem, nerro, retsr, semess, seter, ncarg_cbind 🌸


Copyright (C) 1987-2009 University Corporation for Atmospheric Research The use of this Software is governed by a License Agreement.


and that's the whole page, bestie β€” this was Error_handling(3NCARG), from the UNIX manual, dated March 1994 (yes, the footer is giving vintage, and we respect it). go forth and check your error flags. mwah. πŸ’…πŸ¦‹βœ¨