# 2.11BSD#431 - /usr/src/usr.bin/struct/0.parts.c

##### Functions

    arc               X
    create            X
    expres            X
    lchild            X
    level             X
    negpart           X
    predic            X
    stlfmt            X
    vxpart            X

##### Variables

    arcsper           X
    childper          X
    hascom            X
    nonarcs           X
    typename          X

       1: #ifndef lint
       2: static char sccsid[] = "@(#)0.parts.c	4.1	(Berkeley)	2/11/83";
       3: #endif not lint
       4:
       5: #include <stdio.h>
       6: #include "def.h"
       7:
       8: char *typename[TYPENUM] = {"STLNVX",    "IFVX",     "DOVX",     "IOVX", "FMTVX",
       9:             "COMPVX",   "ASVX",     "ASGOVX",   "LOOPVX",   "WHIVX",
      10:             "UNTVX",    "ITERVX",   "THENVX",   "STOPVX",   "RETVX",
      11:             "DUMVX",    "GOVX",     "BRKVX",    "NXTVX",    "SWCHVX",
      12:             "ACASVX",   "ICASVX"
      13:     };
      14: int hascom[TYPENUM] = {2,       2,      2,      2,      2,
      15:             2,      2,      2,      0,      0,
      16:             0,      0,      2,      0,      0,
      17:             0,      0,      0,      0,      2,
      18:             2,      0
      19:             };
      20:
      21: int nonarcs[TYPENUM]    = {FIXED+3,     FIXED+4,    FIXED+2,    FIXED+3,    FIXED+2,
      22:             FIXED+2,    FIXED+2,    FIXED+2,    FIXED+1,    FIXED+1,
      23:             FIXED+1,    FIXED+4,    FIXED+3,    FIXED,      FIXED,
      24:             FIXED+2,    FIXED+1,    FIXED + 1,  FIXED + 1,  FIXED+3,
      25:             FIXED+4,    FIXED+2
      26:             };
      27:
      28: int childper[TYPENUM]   = {0,   2,  1,  0,  0,
      29:             0,  0,  0,  1,  1,
      30:             1,  1,  1,  0,  0,
      31:             1,  0,  0,  0,  1,
      32:             2,  1
      33:             };
      34:
      35: int arcsper[TYPENUM]    = {1,       2,      2,  3,  0,
      36:             -(FIXED+1), 1,  -(FIXED+1), 1,  1,
      37:             1,      1,      2,  0,  0,
      38:             -FIXED,     1,  1,      1,  -(FIXED+1),
      39:             2,      1
      40:             };
      41:
      42: VERT *arc(v,i)
      43: VERT v;
      44: int i;
      45:     {
      46:     ASSERT(DEFINED(v),arc);
      47:     ASSERT(0 <= i && i < ARCNUM(v), arc);
      48:     return(&graph[v][nonarcs[NTYPE(v)] + i ]);
      49:     }
      50:
      51: VERT *lchild(v,i)
      52: VERT v; int i;
      53:     {
      54:     ASSERT(DEFINED(v),lchild);
      55:     ASSERT(0 <= i && i < childper[NTYPE(v)],lchild);
      56:     return(&graph[v][nonarcs[NTYPE(v)]-i-1]);
      57:     }
      58:
      59: int *vxpart(v,type,j)
      60: VERT v;
      61: int type,j;
      62:     {
      63:     ASSERT((NTYPE(v) == type) && (0 <= j) && (j < nonarcs[type] - FIXED), vxpart);
      64:     return(&graph[v][FIXED+j]);
      65:     }
      66:
      67: int *expres(v)
      68: VERT v;
      69:     {
      70:     int ty;
      71:     ty = NTYPE(v);
      72:     ASSERT(ty == COMPVX || ty == ASGOVX || ty == ASVX || ty == SWCHVX || ty == ICASVX,expres);
      73:     return(&graph[v][FIXED]);
      74:     }
      75:
      76: int *negpart(v)
      77: VERT v;
      78:     {
      79:     ASSERT(NTYPE(v) == IFVX || NTYPE(v) == ACASVX,negpart);
      80:     return(&graph[v][FIXED+1]);
      81:     }
      82:
      83: int *predic(v)
      84: VERT v;
      85:     {
      86:     ASSERT(NTYPE(v) == IFVX || NTYPE(v) == ACASVX, predic);
      87:     return(&graph[v][FIXED]);
      88:     }
      89:
      90: int *level(v)
      91: VERT v;
      92:     {
      93:     ASSERT(NTYPE(v) == GOVX || NTYPE(v) == BRKVX || NTYPE(v) == NXTVX, level);
      94:     return(&graph[v][FIXED]);
      95:     }
      96: int *stlfmt(v,n)
      97: VERT v;
      98: int n;
      99:     {
     100:     ASSERT(NTYPE(v) == STLNVX || NTYPE(v) == FMTVX,stlfmt);
     101:     return(&graph[v][FIXED + n]);
     102:     }
     103:
     104: create(type,arcnum)
     105: int type, arcnum;
     106:     {
     107:     int i, *temp, wds;
     108:     if (nodenum >= maxnode)
     109:         {
     110:         maxnode += 100;
     111:         temp=(int *)realloc(graph,maxnode*sizeof(*graph));
     112:         free(graph);
     113:         graph=(int **)temp;
     114:         }
     115:     wds = nonarcs[type] + arcnum;
     116:     graph[nodenum] = (int *)galloc(sizeof(*graph) * wds);
     117:     for (i = 0; i < wds; i++)  graph[nodenum][i] = 0;
     118:     NTYPE(nodenum) = type;
     119:     if (arcsper[type] < 0)
     120:         ARCNUM(nodenum) = arcnum;
     121:
     122:     return(nodenum++);
     123:     }

#### Defined functions

arc defined in line 42; used 4 times

- in line 46-47(2)
- in /usr/src/usr.bin/struct/def.h line 46, 56

create defined in line 104; used 6 times

- in /usr/src/usr.bin/struct/1.finish.c line 33
- in /usr/src/usr.bin/struct/1.node.c line 18
- in /usr/src/usr.bin/struct/2.dfs.c line 139-140(2)
- in /usr/src/usr.bin/struct/3.flow.c line 88
- in /usr/src/usr.bin/struct/3.loop.c line 139

expres defined in line 67; used 3 times

- in line 72
- in /usr/src/usr.bin/struct/def.h line 47, 86

lchild defined in line 51; used 4 times

- in line 54-55(2)
- in /usr/src/usr.bin/struct/def.h line 46, 54

level defined in line 90; used 3 times

- in line 93
- in /usr/src/usr.bin/struct/def.h line 47, 91

negpart defined in line 76; used 3 times

- in line 79
- in /usr/src/usr.bin/struct/def.h line 47, 81

predic defined in line 83; used 3 times

- in line 86
- in /usr/src/usr.bin/struct/def.h line 47, 80

stlfmt defined in line 96; used 4 times

- in line 100
- in /usr/src/usr.bin/struct/def.h line 47, 60-61(2)

vxpart defined in line 59; used 11 times

- in line 63
- in /usr/src/usr.bin/struct/def.h line 47, 62-77(8), 87

#### Defined variables

arcsper defined in line 35; used 4 times

- in line 119
- in /usr/src/usr.bin/struct/def.h line 57(3)

childper defined in line 28; used 1 times

- in line 55

hascom defined in line 14; never used
nonarcs defined in line 21; used 4 times

- in line 48, 56, 63, 115

sccsid defined in line 2; never used
typename defined in line 8; never used

Last modified: 1993-01-18 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 737 |