Annotation of researchv10no/cmd/trace/trace.d, revision 1.1.1.1

1.1       root        1:  struct ELM {
                      2:        short transf;           /* next state function */
                      3:        short valtrans;         /* value transferred   */
                      4:  };
                      5: 
                      6:  struct IND {
                      7:        short nrpils;
                      8:        struct ELM *one;
                      9:  };
                     10: 
                     11:  struct VARPARS {
                     12:        short nrms,    *ms;             /* message parameters */
                     13:        short nrvs,    *vs;             /* pvar parameters    */
                     14:        short nrlvars, *lvarvals;       /* local variables    */
                     15:  };
                     16: 
                     17:  struct TBLPARS {
                     18:        short nrms;
                     19:        short nrvs;                     /* max available space for params */    
                     20:        short nrlvars;                  /* max available space for locvars */
                     21:  };
                     22: 
                     23:  struct LOCVARS {
                     24:        short nrlvars, *lvarvals;
                     25:  };
                     26: 
                     27:  struct CPARS {
                     28:        short callwhat;
                     29:        short nrms,    *ms;             /* message parameters */
                     30:        short nrvs,    *vs;             /* pvar parameters    */
                     31:  };
                     32: 
                     33:  struct LBT {
                     34:        int *mapcol, *orgcol;           /* mapped versions of colmap and colorg */
                     35:  };
                     36: 
                     37: /*
                     38:  *     endrow:         proper endstates of the process table
                     39:  *     deadrow:        set if deadend (eg return state)
                     40:  *     badrow:         row with at least one output option
                     41:  *     labrow:         labeled row (potential start of a loop)
                     42:  */
                     43: 
                     44:  struct TBL {
                     45:        int nrrows, nrcols;
                     46:        int *endrow, *deadrow, *badrow, *labrow;
                     47:        int *colmap, *colorg, *coltyp;
                     48:        char **rowname;
                     49: 
                     50:        struct IND **ptr;
                     51:        struct CPARS *calls;
                     52:  };
                     53: 
                     54:  struct MBOX {
                     55:        char limit;             /* length of queue */
                     56:        char owner;             /* the process reading from this queue */
                     57:        char qname[PLENTY];     /* user-level name for the queue */
                     58:  };
                     59: 
                     60:  struct MNAME {
                     61:        char mname[PLENTY];
                     62:  };
                     63: 
                     64:  struct BLTIN {
                     65:        short target;
                     66:        short type;
                     67:        short value;
                     68:  };
                     69: 
                     70:  struct REVPOL {
                     71:        char toktyp;
                     72:        short tokval;
                     73:  };
                     74: 
                     75:  struct PROCSTACK {
                     76:        short uptable;                  /* table where we come from         */
                     77:        short uptransf;                 /* pending transition in that table */
                     78: 
                     79:        struct VARPARS  *varparsaved;   /* saves parameters and locals */
                     80:        struct PROCSTACK *follow;       /* next stackframe */
                     81:  };
                     82: 
                     83: #define USED   32768
                     84: #define PASSED 16384
                     85: #define TRAIL  1
                     86: 
                     87:  struct QUEUE {
                     88:        short mesg;                     /* on rcv PASSED is OR'ed in */
                     89:        unsigned short cargo;           /* when set USED is OR'ed in */
                     90: #if TRAIL
                     91:        short tstate[2];                /* linecode reference */
                     92: #endif TRAIL
                     93:        struct QUEUE *next;
                     94:        struct QUEUE *last;
                     95:        struct QUEUE *s_forw;
                     96:        struct QUEUE *s_back;
                     97:  };
                     98: 
                     99:  struct CONTS {
                    100:        short mesg;
                    101:        unsigned short cargo;
                    102:  };
                    103: 
                    104:  struct TEMPLATE {
                    105:        short *g_vars;                  /* current globals   */
                    106:        struct LOCVARS   **l_vars;      /* current local vars */
                    107:        struct PROCSTACK **traceback;   /* traceback of complete stack */
                    108:  };
                    109: 
                    110:  struct STATE {
                    111:        unsigned short *pstate;         /* old states & maps    */
                    112:        struct TEMPLATE *pcon;          /* variables and stacks */
                    113:        struct VISIT *next;
                    114:  };
                    115: 
                    116: #define ANALYZED       16384
                    117: 
                    118:  struct VISIT {
                    119:        unsigned int howmany;   /* which queues are nonempty */
                    120:        struct CONTS **c;       /* queue contents  */
                    121:        union {
                    122:                struct QUEUE *s;        /* when searching, last message sent  */
                    123:                short countme;          /* when analyzed, counts nr of returns */
                    124:        } prop;
                    125:        unsigned short depth;   /* level of first visit, ANALYZED is OR'ed in */
                    126:        struct VISIT *next;
                    127:  };
                    128: 
                    129: #define ISANA(x)       (x->depth &  ANALYZED)
                    130: #define DEPTH(x)       (x->depth & ~ANALYZED)
                    131: 
                    132: /*
                    133:  *     normal ppushes (via forward()) save the parameters in the procstack
                    134:  *     so that the corresponding ppop (via backup()) can reset them properly
                    135:  *
                    136:  *     series of ppushes and ppops, performed in a single freeze() call
                    137:  *     (via the retable() and dotable() subroutines) are different:
                    138:  *
                    139:  *     additional ppushes are no problem, since they save the
                    140:  *     proper state information via the normal route
                    141:  *
                    142:  *     additional ppops however would lose the procstacked info
                    143:  *     that info is stored in the CUBE structure so that when
                    144:  *     a ppop from freeze() is undone in unfreeze()
                    145:  *     the proper state information can be restored onto the procstack
                    146:  */
                    147: 
                    148:  struct CUBE {
                    149:        short poporpush;
                    150:        short which;
                    151:        short procsaved;
                    152:        short transfsaved;
                    153: 
                    154:        struct VARPARS  *varparsaved;   /* parameter map and local var map */
                    155: 
                    156:        struct CUBE *pntr;
                    157:        struct CUBE *rtnp;
                    158:  };
                    159: 
                    160:  struct FREEZE {
                    161:        short lastsav;
                    162:        short *statsaved;               /* save states of tables */
                    163:        short *varsaved;                /* save global variables */
                    164:        short whichvar;                 /* set if a var changed */
                    165:        short oldvalue;                 /* of that loc var      */
                    166: 
                    167:        struct CUBE *cube;              /* place to save stackframe */
                    168:  };
                    169: 
                    170:  struct Swiffle {
                    171:        struct STATE *st;
                    172:        struct VISIT *vi;
                    173:        struct Swiffle *next;
                    174:        struct Swiffle *last;
                    175:  };

unix.superglobalmegacorp.com

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