- int dec_ind; /* current indentation for declarations */
- int di_stack[20]; /* a stack of structure indentation levels
- */
- int flushed_nl; /* used when buffering up comments to
- remember that a newline was passed over
- */
- int force_nl; /* when true, code must be broken */
- int hd_type; /* used to store type of stmt for if (...),
- for (...), etc */
- register int i; /* local loop counter */
- int in_or_st; /* Will be true iff there has been a
- declarator (e.g. int or char) and no
- left paren since the last semicolon.
- When true, a { is starting a structure
- definition or an initialization list */
- register int j; /* local loop counter */
- int scase; /* set to true when we see a case, so we
- will know what to do with the following
- colon */
- int sp_sw; /* when true, we are in the expressin of
- if(...), while(...), etc. */
- int squest; /* when this is positive, we have seen a ?
- without the matching : in a <c>?<s>:<s>
- construct */
- register char *t_ptr; /* used for copying tokens */
- int type_code; /* the type of token, returned by lexi */
- int want_blank; /* set to true when the following token
- should be prefixed by a blank. (Said
- prefixing is ignored in some cases.) */
-
-#ifdef dolog /* include declarations needed for log */
- int log_fid; /* fid of log file */
-
- struct logtmpl { /* structure of a log entry */
- int tvec[2]; /* time of execution */
- char inp; /* input fid */
- char outp; /* output fid */
- int nout; /* # output lines */
- int ncom; /* # comments */
- int wcom; /* # lines w/ comments */
- int wcode; /* # lines w/code */
- char mc; /* max line size */
- char ci; /* comment indentation */
- char inds; /* indent size */
- char dci; /* decl comment indentation */
- char verb; /* verbose */
- char ljus; /* left just */
- char lvcom; /* leave commas */
- char unin; /* unindented comment indentation */
- char uid; /* the user id */
- char bropt; /* btype_2 */
- int reserved[2];
- };
-
- struct logtmpl logent;
-#endif
-\f
-/*-----------------------------------------------*\
-| INITIALIZATION
-\*-----------------------------------------------*/
-
-
- combuf[0] = codebuf[0] = labbuf[0] = ' ';
- /* set up code, label, and comment buffers */
+ extern int found_err; /* flag set in diag() on error */
+ int dec_ind; /* current indentation for declarations */
+ int di_stack[20]; /* a stack of structure indentation levels */
+ int flushed_nl; /* used when buffering up comments to remember
+ * that a newline was passed over */
+ int force_nl; /* when true, code must be broken */
+ int hd_type; /* used to store type of stmt for if (...),
+ * for (...), etc */
+ register int i; /* local loop counter */
+ int scase; /* set to true when we see a case, so we will
+ * know what to do with the following colon */
+ int sp_sw; /* when true, we are in the expressin of
+ * if(...), while(...), etc. */
+ int squest; /* when this is positive, we have seen a ?
+ * without the matching : in a <c>?<s>:<s>
+ * construct */
+ register char *t_ptr; /* used for copying tokens */
+ int type_code; /* the type of token, returned by lexi */
+
+ int last_else = 0; /* true iff last keyword was an else */
+
+
+ /*-----------------------------------------------*\
+ | INITIALIZATION |
+ \*-----------------------------------------------*/
+
+
+ ps.p_stack[0] = stmt; /* this is the parser's stack */
+ ps.last_nl = true; /* this is true if the last thing scanned was
+ * a newline */
+ ps.last_token = semicolon;
+ combuf = (char *) malloc(bufsize);
+ labbuf = (char *) malloc(bufsize);
+ codebuf = (char *) malloc(bufsize);
+ l_com = combuf + bufsize - 5;
+ l_lab = labbuf + bufsize - 5;
+ l_code = codebuf + bufsize - 5;
+ combuf[0] = codebuf[0] = labbuf[0] = ' '; /* set up code, label, and
+ * comment buffers */