Annotation of researchv10no/cmd/trace/trace9.c, revision 1.1

1.1     ! root        1: #include <stdio.h>
        !             2: #include "trace.h"
        !             3: #include "trace.d"
        !             4: 
        !             5:  extern int nrprocs, *processes, *state;
        !             6: 
        !             7:  char *Realloc(), *Emalloc(), *Smalloc();
        !             8: 
        !             9:  unsigned short **pstates;
        !            10:  int pgrowth = 32;
        !            11:  int nrpstates = 0;
        !            12:  int pbound = 0;
        !            13: 
        !            14: growPtable()
        !            15: { int p = pbound + pgrowth;
        !            16: 
        !            17:        if (p == pgrowth)
        !            18:                pstates = (unsigned short **)
        !            19:                        Emalloc(p * sizeof(unsigned short *));
        !            20:        else
        !            21:                pstates = (unsigned  short **)
        !            22:                        Realloc(pstates, p * sizeof(unsigned short *));
        !            23:        pbound = p;
        !            24: }
        !            25: 
        !            26: unsigned short *
        !            27: Pinsert()
        !            28: { unsigned short *try;
        !            29:   register int i;
        !            30: 
        !            31:        if (nrpstates >= pbound)
        !            32:                growPtable();
        !            33: 
        !            34:        try = (unsigned  short *)
        !            35:                Smalloc(nrprocs * sizeof(unsigned  short));
        !            36: 
        !            37:        for (i = 0; i < nrprocs; i++)
        !            38:                try[i] = (unsigned short) (state[i] + (processes[i]<<10));
        !            39: 
        !            40:        pstates[nrpstates++] = try;
        !            41: 
        !            42:        return try;
        !            43: }
        !            44: 
        !            45: unsigned  short *
        !            46: inPtable()
        !            47: { register int i;
        !            48: 
        !            49:        for (i = 0; i < nrpstates; i++)
        !            50:                if (sameP(pstates[i]))
        !            51:                        return pstates[i];
        !            52: 
        !            53:        return Pinsert();
        !            54: }
        !            55: 
        !            56: sameP(at)
        !            57:        unsigned  short *at;
        !            58: { register int i;
        !            59: 
        !            60:        for (i = 0; i < nrprocs; i++)
        !            61:        {       if ((at[i]&1023) != (unsigned short) state[i]
        !            62:                ||   at[i]>>10   != (unsigned short) processes[i])
        !            63:                        return 0;
        !            64:        }
        !            65:        return 1;
        !            66: }

unix.superglobalmegacorp.com

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