Annotation of 43BSD/usr.lib/libF77/traper_.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1980 Regents of the University of California.
        !             3:  * All rights reserved.  The Berkeley software License Agreement
        !             4:  * specifies the terms and conditions for redistribution.
        !             5:  *
        !             6:  *     @(#)traper_.c   5.2     6/7/85
        !             7:  *
        !             8:  * Full of Magic! DON'T CHANGE ANYTHING !!
        !             9:  *
        !            10:  * To use from f77:
        !            11:  *     integer oldmsk, traper
        !            12:  *     oldmsk = traper (mask)
        !            13:  * where:
        !            14:  *     mask = 1 to trap integer overflow
        !            15:  *     mask = 2 to trap floating underflow
        !            16:  *     mask = 3 to trap both
        !            17:  *     These 2 bits will be set into the PSW.
        !            18:  *     The old state will be returned.
        !            19:  */
        !            20: 
        !            21: long traper_(msk)
        !            22: long   *msk;
        !            23: {
        !            24:        int     old = 0;
        !            25: #if    vax
        !            26: #define IOV_MASK       0140
        !            27:        int     **s = &msk;
        !            28:        int     psw;
        !            29: 
        !            30:        s -= 5;
        !            31:        psw = (int)*s;
        !            32:        old = (psw & IOV_MASK) >> 5;
        !            33:        psw = (psw & ~IOV_MASK) | ((*msk << 5) & IOV_MASK);
        !            34:        *s = (int *)psw;
        !            35: #endif vax
        !            36:        return((long)old);
        !            37: }

unix.superglobalmegacorp.com

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