Annotation of 42BSD/usr.lib/libpc/EXCEPT.c, revision 1.1.1.1

1.1       root        1: /* Copyright (c) 1982 Regents of the University of California */
                      2: 
                      3: static char sccsid[] = "@(#)EXCEPT.c 1.3 1/10/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 1:
                     25:                ERROR("Integer overflow\n");
                     26:                return;
                     27:        case 2:
                     28:                ERROR("Integer division by zero\n");
                     29:                return;
                     30:        case 3:
                     31:                ERROR("Real overflow\n");
                     32:                return;
                     33:        case 4:
                     34:                ERROR("Real division by zero\n");
                     35:                return;
                     36:        case 5:
                     37:                ERROR("Real underflow\n");
                     38:                return;
                     39:        default:
                     40:                ERROR("Panic: Computational error in interpreter\n");
                     41:                return;
                     42:        }
                     43: #endif vax
                     44: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.