Annotation of cci/usr/src/usr.lib/libsF77/main.c, revision 1.1

1.1     ! root        1: /* STARTUP PROCEDURE FOR UNIX FORTRAN PROGRAMS */
        !             2: 
        !             3: #include <stdio.h>
        !             4: #include <signal.h>
        !             5: 
        !             6: int    xargc;
        !             7: char   **xargv;
        !             8: int    _sigfdie(), _sigidie(), _sigqdie(), _sigindie(), _sigtdie();
        !             9: 
        !            10: main(argc, argv, arge)
        !            11:        int argc;
        !            12:        char **argv;
        !            13:        char **arge;
        !            14: {
        !            15: 
        !            16:        xargc = argc;
        !            17:        xargv = argv;
        !            18:        signal(SIGFPE, _sigfdie);       /* ignore underflow, enable overflow */
        !            19:        signal(SIGIOT, _sigidie);
        !            20:        if ((int)signal(SIGQUIT,_sigqdie) & 01)
        !            21:                signal(SIGQUIT, SIG_IGN);
        !            22:        if ((int)signal(SIGINT, _sigindie) & 01)
        !            23:                signal(SIGINT, SIG_IGN);
        !            24:        signal(SIGTERM,_sigtdie);
        !            25: 
        !            26: #ifdef pdp11
        !            27:        ldfps(01200); /* detect overflow as an exception */
        !            28: #endif
        !            29:        f_init();
        !            30:        MAIN__();
        !            31:        f_exit();
        !            32: }
        !            33: 
        !            34: #if vax || tahoe
        !            35: static char *fpenames[] = {
        !            36:        "unknown floating exception",
        !            37:        "integer overflow",
        !            38:        "integer divide by zero",
        !            39:        "floating overflow",
        !            40:        "floating/decimal divide by zero",
        !            41:        "floating underflow",
        !            42:        "decimal overflow",
        !            43:        "subscript out of range",
        !            44:        "floating overflow",
        !            45:        "floating divide by zero",
        !            46:        "floating underflow"
        !            47: };
        !            48: 
        !            49: _sigfdie(sig, code)
        !            50:        int sig, code;
        !            51: {
        !            52:        if (code < 0 || code >= sizeof fpenames/sizeof fpenames[0])
        !            53:                code = 0;
        !            54:        _sigdie(fpenames[code], 1);
        !            55: }
        !            56: #else
        !            57: _sigfdie() { _sigdie("floating exception, 1); }
        !            58: #endif
        !            59: 
        !            60: _sigidie() { _sigdie("IOT Trap", 1); }
        !            61: _sigqdie() { _sigdie("Quit signal", 1); }
        !            62: _sigindie() { _sigdie("Interrupt", 0); }
        !            63: _sigtdie() { _sigdie("Killed", 0); }
        !            64: 
        !            65: _sigdie(s, kill)
        !            66:        register char *s;
        !            67:        int kill;
        !            68: {
        !            69: 
        !            70:        /* print error message, then clear buffers */
        !            71:        fflush(stderr);
        !            72:        fprintf(stderr, "%s\n", s);
        !            73:        f_exit();
        !            74:        fflush(stderr);
        !            75:        if (kill) {
        !            76:                /* now get a core */
        !            77:                signal(SIGIOT, 0);
        !            78:                abort();
        !            79:                /*NOTREACHED*/
        !            80:        }
        !            81:        exit(1);
        !            82: }

unix.superglobalmegacorp.com

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