Annotation of 43BSD/ucb/pascal/pxp/const.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: 
        !             7: #ifndef lint
        !             8: static char sccsid[] = "@(#)const.c    5.1 (Berkeley) 6/5/85";
        !             9: #endif not lint
        !            10: 
        !            11: /*
        !            12:  * pxp - Pascal execution profiler
        !            13:  *
        !            14:  * Bill Joy UCB
        !            15:  * Version 1.2 January 1979
        !            16:  */
        !            17: 
        !            18: #include "0.h"
        !            19: #include "tree.h"
        !            20: 
        !            21: STATIC int constcnt = -1;
        !            22: 
        !            23: /*
        !            24:  * The const declaration part
        !            25:  */
        !            26: constbeg(l, cline)
        !            27:        int l, cline;
        !            28: {
        !            29: 
        !            30:        line = l;
        !            31:        if (nodecl)
        !            32:                printoff();
        !            33:        puthedr();
        !            34:        putcm();
        !            35:        ppnl();
        !            36:        indent();
        !            37:        ppkw("const");
        !            38:        ppgoin(DECL);
        !            39:        constcnt = 0;
        !            40:        setline(cline);
        !            41: }
        !            42: 
        !            43: const(cline, cid, cdecl)
        !            44:        int cline;
        !            45:        char *cid;
        !            46:        int *cdecl;
        !            47: {
        !            48: 
        !            49:        if (constcnt)
        !            50:                putcm();
        !            51:        setline(cline);
        !            52:        ppitem();
        !            53:        ppid(cid);
        !            54:        ppsep(" = ");
        !            55:        gconst(cdecl);
        !            56:        ppsep(";");
        !            57:        constcnt++;
        !            58:        setinfo(cline);
        !            59:        putcml();
        !            60: }
        !            61: 
        !            62: constend()
        !            63: {
        !            64: 
        !            65:        if (constcnt == -1)
        !            66:                return;
        !            67:        if (nodecl)
        !            68:                return;
        !            69:        if (constcnt == 0)
        !            70:                ppid("{const decls}");
        !            71:        ppgoout(DECL);
        !            72:        constcnt = -1;
        !            73: }
        !            74: 
        !            75: /*
        !            76:  * A constant in an expression
        !            77:  * or a declaration.
        !            78:  */
        !            79: gconst(r)
        !            80:        int *r;
        !            81: {
        !            82:        register *cn;
        !            83: 
        !            84:        cn = r;
        !            85: loop:
        !            86:        if (cn == NIL) {
        !            87:                ppid("{constant}");
        !            88:                return;
        !            89:        }
        !            90:        switch (cn[0]) {
        !            91:                default:
        !            92:                        panic("gconst");
        !            93:                case T_PLUSC:
        !            94:                        ppop("+");
        !            95:                        cn = cn[1];
        !            96:                        goto loop;
        !            97:                case T_MINUSC:
        !            98:                        ppop("-");
        !            99:                        cn = cn[1];
        !           100:                        goto loop;
        !           101:                case T_ID:
        !           102:                        ppid(cn[1]);
        !           103:                        return;
        !           104:                case T_CBINT:
        !           105:                case T_CINT:
        !           106:                case T_CFINT:
        !           107:                        ppnumb(cn[1]);
        !           108:                        if (cn[0] == T_CBINT)
        !           109:                                ppsep("b");
        !           110:                        return;
        !           111:                case T_CSTRNG:
        !           112:                        ppstr(cn[1]);
        !           113:                        return;
        !           114:        }
        !           115: }

unix.superglobalmegacorp.com

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