Annotation of cci/usr/src/usr.bin/cdb/transBsd/sym42init.c, revision 1.1.1.1

1.1       root        1: /* $Header: sym42init.c,v 1.1 86/03/24 16:19:22 rcs Exp $ */
                      2: /* (C) Copyright 1985 Third Eye Software, Inc. - All Rights Reserved */
                      3: 
                      4: #include "tes42.h"
                      5: 
                      6: #include <sys/file.h>
                      7: 
                      8: #define UpRatio(x, y, z)  (((x + y - 1) * y) / z)
                      9: 
                     10: 
                     11: export int     vfdSym;         /* file descriptor to read from the file */
                     12: export int     vcsym;          /* globally accessable length of symbol table */
                     13: export char    *vsbStr;        /* string table buffer for our symbol table */
                     14: int             vcbStr;        /* size of string table */
                     15: struct exec    vhead;          /* header info of the object file */
                     16: 
                     17: export int visymMax;           /* max total symbols (regular+global) */
                     18: export int viauxMax;           /* max aux entries */
                     19: export int vifdMax;            /* max file entries */
                     20: export int vipdMax;            /* max proc entries */
                     21: export int vilineMax;          /* max line entries */
                     22: 
                     23: 
                     24: /* S Y M 4 2   I N I T */
                     25: 
                     26: export void Sym42Init (sbObjName)
                     27: char *sbObjName;
                     28: {
                     29:     int                cb, i;
                     30: 
                     31:     if ((vfdSym= open (sbObjName, O_RDONLY, 0)) < 0) {
                     32:        perror (sbObjName);
                     33:        exit (1);
                     34:     } /* if */
                     35: 
                     36:     if (read (vfdSym, &vhead, sizeof (vhead)) != sizeof (vhead)) {
                     37:        perror (sbObjName);
                     38:        exit (1);
                     39:     } /* if */
                     40: 
                     41:     if (lseek (vfdSym, N_STROFF (vhead), 0) < 0) {
                     42:        perror (sbObjName);
                     43:        exit (1);
                     44:     } /* if */
                     45: 
                     46:     if (read (vfdSym, &vcbStr, sizeof (vcbStr)) != sizeof (vcbStr)) {
                     47:        perror (sbObjName);
                     48:        exit (1);
                     49:     } /* if */
                     50: 
                     51:     if ((vsbStr= (char *) malloc (vcbStr))== 0) {
                     52:        printf ("%s: no memory for string table(%d)\n", sbObjName, vcbStr);
                     53:        exit (1);
                     54:     } /* if */
                     55: 
                     56:     if (read (vfdSym, vsbStr+4, vcbStr-4) != vcbStr-4) {
                     57:        perror (sbObjName);
                     58:        exit (1);
                     59:     } /* if */
                     60: 
                     61:     if (lseek (vfdSym, N_SYMOFF (vhead), 0) < 0) {
                     62:        perror (sbObjName);
                     63:        exit (1);
                     64:     } /* if */
                     65: 
                     66:     vcsym= vhead.a_syms / cbNLISTR;
                     67: 
                     68:     /* make the various tables proportionate to the incoming symtab */
                     69:     viauxMax = Max(10000, (vcsym / 2) * vadjust);
                     70:     vrgAux = (pAUXU) malloc(viauxMax * cbAUXU);        /* aux table */
                     71: 
                     72:     vipdMax = Max(2000, (vcsym / 6) * vadjust);
                     73:     vrgPd = (pPDR) malloc(vipdMax * cbPDR);    /* proc table */
                     74: 
                     75:     vifdMax = Max(2000, (vcsym / 15) * vadjust);
                     76:     vrgFd = (pFDR) malloc(vifdMax * cbFDR);    /* file table */
                     77: 
                     78:     vilineMax = Max(10000, (vcsym / 2) * vadjust);
                     79:     vrgLine = (pLINER) malloc(vilineMax * cbLINER); /* line no table */
                     80: 
                     81:     visymMax = Max(10000, vcsym * vadjust);
                     82:     vrgSym = (pSYMR) malloc(visymMax * cbSYMR);        /* symbol table */
                     83:     
                     84:     visymGlMax = Max(10000, (vcsym / 10) * vadjust);
                     85:     vrgSymGlobal = (pSYMR) malloc(visymGlMax * cbSYMR);        /* globals */
                     86:     
                     87:     vissMax = vcbStr * vadjust;        /* should be enough */
                     88:     vsbNewStr = vsbMax = (char *) malloc(vissMax);
                     89:     *vsbMax++ = 0;
                     90:     vissMac = 1;
                     91: 
                     92:     cb = 4000 * sizeof(int);
                     93:     vrgTesF42 = (int *) malloc(cb);
                     94:     ZeroBlock(vrgTesF42, cb);
                     95:     for (i = 0; i < tesF42Low; i++)
                     96:        vrgTesF42[i] = i;
                     97: } /* sym42Init */

unix.superglobalmegacorp.com

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