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
expres defined in line 67; used 3 times
lchild defined in line 51; used 4 times
level defined in line 90; used 3 times
negpart defined in line 76; used 3 times
predic defined in line 83; used 3 times
stlfmt defined in line 96; used 4 times
vxpart defined in line 59; used 11 times

Defined variables

arcsper defined in line 35; used 4 times
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
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: 2265
Valid CSS Valid XHTML 1.0 Strict