stopexit, stop, filerr, finderr strerr, sigstop - Local error handling routines

SYNOPSIS

#include "gp.h"
#include "terrno.h"
#include "uif.h"
#include "formats.h"

/* Uses and (declares!) the following globals */

SETP outset = 0;        /* output dataset pointer */
int outid = -1;         /* CDF output dataset id  : OBSOLETE */
char *outname = 0;      /* name of output dataset */

void stop(error)
int error;

void stopexit(status)

int filerr(err, file)
int err;
char *file;

int finderr(err, file, name)
int err;
char *file;
char *name;

int strerr(str, file)
char *str;
char *file;

void tstop(file)
char *file;

void sigstop(sig)

DESCRIPTION

The functions described here are for local error handling when using TeraScan programming functions (terascan).

stop performs local error handling based on the value of error before stopping an application. If error is 0, stop simply calls stopexit with a status of 0. If error is > 0, stop calls msgout to report the error and then calls stopexit with a status of 1. If error is -1, then either the error has already been reported or an interrupt occurred (sigsetup). In the former case, stopexit is called with a status of 1. In the latter case, the signal is reported and then stopexit is called with a status of 1.

Important: outset and outname can refer to a dataset being created or a dataset being modified in place. If error and outset != 0, a call is made to gpabort to try and clean up the output. If outset != 0, but does not correspond to an open dataset, nothing bad happens.

stopexit, rather than exit, is called by stop so that application-dependent clean-up can be performed. The lib/libapp.a version of stopexit only calls exit with the value of status. Applications requiring special clean-up procedures should link in their own version of stopexit.

filerr calls msgout with the value err, which is typically errno or terrno. If file is not NULL, filerr precedes the error message with the name of the file. Always returns -1.

finderr calls msgout with the value err, which is typically terrno. finderr precedes the message with file and name. An example would be reporting that the variable name could not be found in the file file. Always returns -1.

strerr calls outpstr with the user-supplied error message, err. If file is not NULL, strerr precedes the error message with the name of the file. Always returns -1.

tstop calls stop with an argument of filerr(terrno, file). This routine is generally called when a TeraScan function returns an error condition and has set the value of terrno.

sigstop is a notify routine for signal handling. It calls stop with the value of error equal to -1.

FILES

include/gp.h, include/terrno.h, include/uif.h, include/formats.h, lib/libapp.a

SEE ALSO

terascan, sigsetup, outpstr, datasets, uif


Last Update: $Date: 1999/05/10 20:56:35 $