next up previous contents
Next: Function: grasp_open() Up: GRASP Error Handling Previous: Writing Custom Error Handlers   Contents


Functions: GR_start_error(), GR_report_error(), GR_end_error()

These three functions are the GRASP error handlers. Their use is best illustrated by example. A typical usage is shown below - a fragment taken from a fictitous routine called ``trouble()".

...
GR_start_error("trouble()",rcsid,__FILE__,__LINE__);
GR_report_error("The GR_report_error() function is like printf().\n");
GR_report_error("It can have no arguments.\n");
GR_report_error("It can have a float argument %f\n",x1);
GR_report_error("Or any mixture of valid types %d %d %s\n",i1,i2,stringptr);
GR_end_error();
...
The use of these three routines as shown will print out, for example:
GRASP: Message from function trouble() at line number 123 of file "source.c".
The GR_report_error() function is like printf().
It can have no arguments.
It can have a float argument 5.43210
Or any mixture of valid types -2 17 the string pointed to by the pointer
$Id: man_utility.tex,v 1.38 1999/07/11 21:22:18 ballen Exp $
$Name:  $
In particular, the line number, release number, and file name are all filled in automatically. The environment variables that govern the behavior of the default error handler are shown in Table [*] below.

Table: The behavior of the error handler is determined by three environment variables, which can be set and un-set using the shell commands setenv and unsetenv. These permit the error messages to be turned off, saved in a file, and control the file name and its over-write properties.
Environment variable. How to set, and effect obtained.
GRASP_NODEBUG setenv GRASP_NODEBUG $\qquad \qquad \qquad $ turns off error messages.
GRASP_ERRORFILE setenv GRASP_ERRORFILE thisfile sends errors to file ``thisfile".
GRASP_ERRORFILE_OVERWRITE setenv GRASP_ERRORFILE_OVERWRITE errors don't accumulate in file.



next up previous contents
Next: Function: grasp_open() Up: GRASP Error Handling Previous: Writing Custom Error Handlers   Contents
Bruce Allen 2000-11-19