1: #ifndef lint
   2: static char sccsid[] = "@(#)4.brace.c	4.1	(Berkeley)	2/11/83";
   3: #endif not lint
   4: 
   5: #include <stdio.h>
   6: #include "def.h"
   7: #include "4.def.h"
   8: #include "3.def.h"
   9: 
  10: ndbrace(v)          /* determine whether braces needed around subparts of v */
  11:                 /* return TRUE if v ends with IF THEN not in braces */
  12: VERT v;
  13:     {
  14:     VERT w;
  15:     int i;
  16:     LOGICAL endif;
  17:     endif = FALSE;
  18:     for (i = 0; i < CHILDNUM(v); ++i)
  19:         {
  20:         endif = FALSE;
  21:         for (w = LCHILD(v,i); DEFINED(w); w = RSIB(w))
  22:             endif = ndbrace(w);
  23:         if (NTYPE(v) != DUMVX && NTYPE(v) != ITERVX &&
  24:             (!DEFINED(LCHILD(v,i)) || compound(v,i) ||
  25:             (endif && NTYPE(v) == IFVX && !IFTHEN(v) && i == THEN )))
  26:                 /* DUMVX doesn't nest, ITERVX doen't nest since
  27: 					nesting is done at LOOPNODE, etc., must
  28: 					check for IFTHEN followed by unrelated ELSE */
  29:             {
  30:             YESBRACE(v,i);
  31:             endif = FALSE;
  32:             }
  33:         }
  34:     return(endif || IFTHEN(v) );
  35:     }
  36: 
  37: 
  38: compound(v,ch)      /* return TRUE iff subpart ch of v has multiple statements */
  39: VERT v;
  40: int ch;
  41:     {
  42:     VERT w;
  43:     w = LCHILD(v,ch);
  44:     if (!DEFINED(w))
  45:         return(FALSE);
  46:     if (NTYPE(w) == ITERVX)
  47:         {
  48:         ASSERT(DEFINED(NXT(w)),compound);
  49:         if (LABEL(NXT(w)))
  50:             return(TRUE);       /* loop ends with labeled CONTINUE statement */
  51:         else
  52:             return(compound(w,0));
  53:         }
  54:     else if (DEFINED(RSIB(w)))
  55:         return(TRUE);
  56:     else if (NTYPE(w) == STLNVX && CODELINES(w) > 1)
  57:         return(TRUE);
  58:     else
  59:         return(FALSE);
  60:     }

Defined functions

compound defined in line 38; used 3 times
ndbrace defined in line 10; 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: 1598
Valid CSS Valid XHTML 1.0 Strict