1: /* Copyright (c) 1982 Regents of the University of California */
   2: 
   3: static char sccsid[] = "@(#)EXCEPT.c 1.4 10/1/83";
   4: 
   5: #include    <signal.h>
   6: 
   7: /*
   8:  * catch runtime arithmetic errors
   9:  */
  10: EXCEPT(signum, type)
  11:     int signum, type;
  12: {
  13:     signal(SIGFPE, EXCEPT);
  14: #ifndef vax
  15:     ERROR("Overflow, underflow, or division by zero in arithmetic operation\n");
  16:     return;
  17: #endif notvax
  18: #ifdef vax
  19:     /*
  20: 	 * The values for this switch statement come from page 12-5 of
  21: 	 * Volume 1 of the 1978 VAX 11/780 Architecture Handbook
  22: 	 */
  23:     switch (type) {
  24:     case FPE_INTOVF_TRAP:
  25:         ERROR("Integer overflow\n");
  26:         return;
  27:     case FPE_INTDIV_TRAP:
  28:         ERROR("Integer division by zero\n");
  29:         return;
  30:     case FPE_FLTOVF_TRAP:
  31:     case FPE_FLTOVF_FAULT:
  32:         ERROR("Real overflow\n");
  33:         return;
  34:     case FPE_FLTDIV_TRAP:
  35:     case FPE_FLTDIV_FAULT:
  36:         ERROR("Real division by zero\n");
  37:         return;
  38:     case FPE_FLTUND_TRAP:
  39:     case FPE_FLTUND_FAULT:
  40:         ERROR("Real underflow\n");
  41:         return;
  42:     case FPE_DECOVF_TRAP:
  43:     case FPE_SUBRNG_TRAP:
  44:     default:
  45:         ERROR("Undefined arithmetic exception type (%d)\n", type);
  46:         return;
  47:     }
  48: #endif vax
  49: }

Defined functions

EXCEPT defined in line 10; used 2 times

Defined variables

sccsid defined in line 3; never used
Last modified: 1983-10-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 769
Valid CSS Valid XHTML 1.0 Strict