1: #ifndef lint
   2: static char sccsid[] = "@(#)3.branch.c	4.1	(Berkeley)	2/11/83";
   3: #endif not lint
   4: 
   5: #include <stdio.h>
   6: #include "def.h"
   7: #include "3.def.h"
   8: 
   9: 
  10: getbranch(head)
  11: VERT *head;
  12:     {
  13:     VERT v;
  14:     for (v = 0; v < nodenum; ++v)
  15:         LABEL(v) = FALSE;
  16:     for (v = START; DEFINED(v); v = RSIB(v))
  17:         chkbranch(v,head);
  18:     addlab(START);
  19:     }
  20: 
  21: 
  22: 
  23: chkbranch(v,head)
  24: VERT v,*head;
  25:     {
  26:     VERT  w;
  27:     int i;
  28:     switch(NTYPE(v))
  29:         {
  30:         case GOVX:
  31:                 for (i = 1, w = head[v]; DEFINED(w); w = head[w], ++i)
  32:                     {
  33:                     if (i > 1 && !levnxt && !levbrk) break;
  34:                     if (ARC(v,0) == BRK(w) && (levbrk || i == 1))
  35:                         {
  36:                         NTYPE(v) = BRKVX;
  37:                         LEVEL(v) = i;
  38:                         break;
  39:                         }
  40:                     else if (ARC(v,0) == NXT(w) && (levnxt || i == 1))
  41:                         {
  42:                         NTYPE(v) = NXTVX;
  43:                         LEVEL(v) = i;
  44:                         break;
  45:                         }
  46:                     }
  47:             if (NTYPE(v) == GOVX)
  48:                 {
  49:                 if (ARC(v,0) == stopvert)
  50:                     NTYPE(v) = STOPVX;
  51:                 else if (ARC(v,0) == retvert)
  52:                     NTYPE(v) = RETVX;
  53:                 else LABEL(ARC(v,0)) = TRUE;
  54:                 }
  55:             break;
  56:         case COMPVX:
  57:         case ASGOVX:
  58:             for (i = 0; i < ARCNUM(v); ++i)
  59:                 LABEL(ARC(v,i)) = TRUE;
  60:             break;
  61:         case IOVX:
  62:                 if (DEFINED(ARC(v,ENDEQ)))
  63:                     LABEL(ARC(v,ENDEQ)) = TRUE;
  64:                 if (DEFINED(ARC(v,ERREQ)))
  65:                     LABEL(ARC(v,ERREQ)) = TRUE;
  66:                 if (DEFINED(FMTREF(v)))
  67:                     LABEL(FMTREF(v)) = TRUE;
  68:                 break;
  69:         }
  70:     for (i = 0; i < CHILDNUM(v); ++i)
  71:         for (w = LCHILD(v,i); DEFINED(w); w = RSIB(w))
  72:             chkbranch(w,head);
  73:     }
  74: 
  75: 
  76: addlab(v)       /* add labels */
  77: VERT v;
  78:     {
  79:     int recvar;
  80:     if (NTYPE(v) != ITERVX && LABEL(v) )
  81:         LABEL(v) = nxtlab();
  82:     RECURSE(addlab,v,recvar);
  83:     if (NTYPE(v) == ITERVX && LABEL(NXT(v)))
  84:         LABEL(NXT(v)) = nxtlab();
  85:     }
  86: 
  87: 
  88: nxtlab()
  89:     {
  90:     static count;
  91:     return(labinit + (count++) * labinc);
  92:     }

Defined functions

addlab defined in line 76; used 2 times
chkbranch defined in line 23; used 2 times
getbranch defined in line 10; used 1 times
nxtlab defined in line 88; used 2 times

Defined variables

sccsid defined in line 2; never used
Last modified: 1987-02-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1992
Valid CSS Valid XHTML 1.0 Strict