Annotation of cci/usr/src/bin/cdb/init.c, revision 1.1

1.1     ! root        1: static char sccsid[] = "@(#)init.c     2.9";
        !             2: 
        !             3: #include "cdb.h"
        !             4: #include "macdefs.h"
        !             5: 
        !             6: char *strrchr();
        !             7: 
        !             8: export pFDR    vrgFd;  /* file descriptors */
        !             9: export int     vifdMac, vifd, vifdNil, vifdTemp;
        !            10: export pPDR    vrgPd;  /* procedure descriptors */
        !            11: export int     vipdMac, vipd;
        !            12: export ADRT    vadrStart; /* AFTER initialization, BEFORE user's code */
        !            13: export ADRT    vadrMain; /* same as vadrStart for C, different for Pascal */
        !            14: 
        !            15: static MODER   amode;
        !            16: export pMODER  vmode;
        !            17: 
        !            18: 
        !            19: /* I N I T   A L L */
        !            20: 
        !            21: local void InitAll()
        !            22: {
        !            23:        /* setup the default display record */
        !            24:        vmode = &amode;
        !            25:        vmode->cnt = 1;
        !            26:        vmode->len = CBINT;
        !            27:        vmode->df = dfDecimal;
        !            28:        vmode->imap = 0;
        !            29:        vimap = 0;      /* kludgey alternate map selector */
        !            30: 
        !            31:        /* break point table stuff */
        !            32:        vibpTemp = 0;   /* we use as a stash for commands of temp bp's */
        !            33:        vibpMac = 1;    /* we never explicitly assign to 0 */
        !            34:        vrgBp = (pBPR) malloc(vibpMax*cbBPR);   /* allocate bp table */
        !            35:        vcbTot += vibpMax * cbBPR;
        !            36: 
        !            37:        /* random things */
        !            38:        vcaseMod = 040; /* start out with case INsensitive searches */
        !            39:        vdot = 0;
        !            40:        vfRecord = false;
        !            41:        vfnDecl = fnNil;        /* the declarations file */
        !            42: #ifdef ONYX
        !            43:        vcBadMax = 12;  /* obscure - see IbpFSingle code in single.c */
        !            44: #endif
        !            45: #ifdef M68000
        !            46:        vcBadMax = 12;  /* obscure - see IbpFSingle code in single.c */
        !            47: #endif
        !            48: #ifdef SUN
        !            49:        vcBadMax = 12;  /* obscure - see IbpFSingle code in single.c */
        !            50: #endif
        !            51: #ifdef TAHOE
        !            52:        vcBadMax = 10;  /* obscure - see IbpFSingle code in single.c */
        !            53: #endif
        !            54: #ifdef VAX
        !            55:        vcBadMax = 1000;        /* obscure - see IbpFSingle code in single.c */
        !            56: #endif
        !            57: 
        !            58:        InitSymfile(vsbSymfile);
        !            59: #ifdef BSD41
        !            60:        InitSs();
        !            61: #endif
        !            62:        InitCorefile(vsbCorefile);
        !            63:        InitTy();       /* variable typing stuff */
        !            64:        InitFdPd();     /* setup symbol stuff */
        !            65:        InitSpc();      /* init special (debugger resident) variables */
        !            66:        InitSa();       /* set default signal handling */
        !            67:        InitAssert();   /* assertions table */
        !            68: 
        !            69:        /* now this one is weird. If there IS a core file, you can look in
        !            70:             * u.u_ar0 and you will find, at least on the Onyx, 03742.  But
        !            71:             * if you do NOT have a core file, and you need this for doing
        !            72:             * accesses into the live child process, how the hell are you
        !            73:             * going to find out???  I don't know!
        !            74:             */
        !            75:        v_ar0 = adrReg0;        /* from macdefs.h */
        !            76:        if (vfnCore != fnNil) {
        !            77:                GetState();     /* to make process globals be correct */
        !            78: #ifdef ONYX
        !            79:                vpc -= 2;       /* so we have true address of error */
        !            80: #endif
        !            81:        } /* if */
        !            82: 
        !            83: #ifdef BSD41
        !            84:        vadrStart = AdrFLabel("program");
        !            85:        vadrMain = AdrFLabel("main");
        !            86:        if (vadrStart != adrNil) {
        !            87:                /* looks like Pascal */
        !            88:                OpenIpd(IpdFName("program"), true);
        !            89:                if (!vfPascal)
        !            90:                        vadrStart = adrNil;     /* filename did NOT end with '.p' */
        !            91:                else if (vadrMain == adrNil)
        !            92:                        vadrMain = vadrStart;
        !            93:        }
        !            94:        if (vadrStart == adrNil) {
        !            95:                if (vadrMain != adrNil) {
        !            96:                        /* not a Pascal program, maybe C? */
        !            97:                        OpenIpd(IpdFName("main"), true);
        !            98:                } 
        !            99:                else {
        !           100:                        Panic("It's not C, it's not Pascal - what is it????");
        !           101:                }
        !           102:        }
        !           103: #else
        !           104:        OpenIpd(IpdFName("main"), true);
        !           105: #endif
        !           106:        vadrStart = AdrFIfdLn(vifd, viln);
        !           107: 
        !           108: #ifdef VAX
        !           109:        vadrBreak = AdrFLabel("vadrBreak");
        !           110:        vadrCall = AdrFLabel("vadrCall");
        !           111: #endif
        !           112: #ifdef TAHOE
        !           113:        vadrBreak = AdrFLabel("vadrBreak");
        !           114:        vadrCall = AdrFLabel("vadrCall");
        !           115: #else
        !           116:        vadrBreak = AdrFLabel("_end_");
        !           117: #endif
        !           118: } /* InitAll */
        !           119: 
        !           120: 
        !           121: /* M I N */
        !           122: 
        !           123: export int Min(x, y)
        !           124: int    x, y;
        !           125: {
        !           126:        return((x<y) ? x : y);
        !           127: } /* Min */
        !           128: 
        !           129: 
        !           130: /* M A X */
        !           131: 
        !           132: export int Max(x, y)
        !           133: int    x, y;
        !           134: {
        !           135:        return((x>y) ? x : y);
        !           136: } /* Max */

unix.superglobalmegacorp.com

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