1: /*
   2:  * except.c
   3:  *
   4:  * Support routines for C exceptions
   5:  *
   6:  (c) Jeffrey Mogul	Stanford	18 February 1983
   7:  */
   8: 
   9: #include <stdio.h>
  10: #include "except.h"
  11: 
  12: extern int errno;
  13: extern int sys_nerr;
  14: extern char *sys_errlist[];
  15: 
  16: _Except_Buf *_Except_Header = 0;
  17: int ExceptMode = 0;
  18: 
  19: raise(code, msg)
  20: int code;
  21: char *msg;
  22: {
  23:     register _Except_Buf *EBp = _Except_Header;
  24: 
  25:     if (EBp == 0) { /* uncaught exception */
  26:         if (ExceptMode&EX_MODE_REPORT) {
  27:             fprintf(stderr,"Uncaught exception: %d, %s\n",
  28:             code, msg);
  29:         }
  30:         if (ExceptMode&EX_MODE_ABORT)
  31:         abort();
  32:         else
  33:         exit(code);
  34:     }
  35: 
  36:     EBp->Code = code;
  37:     EBp->Message = msg;
  38: 
  39:     _Except_Header = EBp->Prev;
  40: 
  41:     longjmp(EBp->Environ, 1);
  42: }
  43: 
  44: raise_sys()
  45: {
  46:     register int errnum = errno;
  47: 
  48:     if ((errnum < 1) || (errnum >= sys_nerr)) {
  49:         raise(-1, "Unknown Unix error code");
  50:     }
  51:     else {
  52:         raise(errnum, sys_errlist[errnum]);
  53:     }
  54: }

Defined functions

raise defined in line 19; used 5 times
raise_sys defined in line 44; never used

Defined variables

ExceptMode defined in line 17; used 2 times
_Except_Header defined in line 16; used 2 times
Last modified: 1986-03-13
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 572
Valid CSS Valid XHTML 1.0 Strict