xref: /minix3/usr.bin/indent/indent_globs.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: indent_globs.h,v 1.10 2014/09/04 04:06:07 mrg Exp $	*/
297c7d358SVivek Prakash 
397c7d358SVivek Prakash /*
497c7d358SVivek Prakash  * Copyright (c) 1980, 1993
597c7d358SVivek Prakash  *	The Regents of the University of California.  All rights reserved.
697c7d358SVivek Prakash  *
797c7d358SVivek Prakash  * Redistribution and use in source and binary forms, with or without
897c7d358SVivek Prakash  * modification, are permitted provided that the following conditions
997c7d358SVivek Prakash  * are met:
1097c7d358SVivek Prakash  * 1. Redistributions of source code must retain the above copyright
1197c7d358SVivek Prakash  *    notice, this list of conditions and the following disclaimer.
1297c7d358SVivek Prakash  * 2. Redistributions in binary form must reproduce the above copyright
1397c7d358SVivek Prakash  *    notice, this list of conditions and the following disclaimer in the
1497c7d358SVivek Prakash  *    documentation and/or other materials provided with the distribution.
1597c7d358SVivek Prakash  * 3. Neither the name of the University nor the names of its contributors
1697c7d358SVivek Prakash  *    may be used to endorse or promote products derived from this software
1797c7d358SVivek Prakash  *    without specific prior written permission.
1897c7d358SVivek Prakash  *
1997c7d358SVivek Prakash  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2097c7d358SVivek Prakash  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2197c7d358SVivek Prakash  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2297c7d358SVivek Prakash  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2397c7d358SVivek Prakash  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2497c7d358SVivek Prakash  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2597c7d358SVivek Prakash  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2697c7d358SVivek Prakash  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2797c7d358SVivek Prakash  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2897c7d358SVivek Prakash  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2997c7d358SVivek Prakash  * SUCH DAMAGE.
3097c7d358SVivek Prakash  *
3197c7d358SVivek Prakash  *	from: @(#)indent_globs.h	8.1 (Berkeley) 6/6/93
3297c7d358SVivek Prakash  */
3397c7d358SVivek Prakash 
3497c7d358SVivek Prakash /*
3597c7d358SVivek Prakash  * Copyright (c) 1985 Sun Microsystems, Inc.
3697c7d358SVivek Prakash  * Copyright (c) 1976 Board of Trustees of the University of Illinois.
3797c7d358SVivek Prakash  * All rights reserved.
3897c7d358SVivek Prakash  *
3997c7d358SVivek Prakash  * Redistribution and use in source and binary forms, with or without
4097c7d358SVivek Prakash  * modification, are permitted provided that the following conditions
4197c7d358SVivek Prakash  * are met:
4297c7d358SVivek Prakash  * 1. Redistributions of source code must retain the above copyright
4397c7d358SVivek Prakash  *    notice, this list of conditions and the following disclaimer.
4497c7d358SVivek Prakash  * 2. Redistributions in binary form must reproduce the above copyright
4597c7d358SVivek Prakash  *    notice, this list of conditions and the following disclaimer in the
4697c7d358SVivek Prakash  *    documentation and/or other materials provided with the distribution.
4797c7d358SVivek Prakash  * 3. All advertising materials mentioning features or use of this software
4897c7d358SVivek Prakash  *    must display the following acknowledgement:
4997c7d358SVivek Prakash  *	This product includes software developed by the University of
5097c7d358SVivek Prakash  *	California, Berkeley and its contributors.
5197c7d358SVivek Prakash  * 4. Neither the name of the University nor the names of its contributors
5297c7d358SVivek Prakash  *    may be used to endorse or promote products derived from this software
5397c7d358SVivek Prakash  *    without specific prior written permission.
5497c7d358SVivek Prakash  *
5597c7d358SVivek Prakash  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
5697c7d358SVivek Prakash  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5797c7d358SVivek Prakash  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
5897c7d358SVivek Prakash  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
5997c7d358SVivek Prakash  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
6097c7d358SVivek Prakash  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
6197c7d358SVivek Prakash  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
6297c7d358SVivek Prakash  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
6397c7d358SVivek Prakash  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
6497c7d358SVivek Prakash  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
6597c7d358SVivek Prakash  * SUCH DAMAGE.
6697c7d358SVivek Prakash  *
6797c7d358SVivek Prakash  *	from: @(#)indent_globs.h	8.1 (Berkeley) 6/6/93
6897c7d358SVivek Prakash  */
6997c7d358SVivek Prakash 
7097c7d358SVivek Prakash #define BACKSLASH '\\'
7197c7d358SVivek Prakash #define bufsize 200		/* size of internal buffers */
7297c7d358SVivek Prakash #define sc_size 5000		/* size of save_com buffer */
7397c7d358SVivek Prakash #define label_offset 2		/* number of levels a label is placed to left
7497c7d358SVivek Prakash 				 * of code */
7597c7d358SVivek Prakash 
7697c7d358SVivek Prakash #define tabsize 8		/* the size of a tab */
7797c7d358SVivek Prakash #define tabmask 0177770		/* mask used when figuring length of lines
7897c7d358SVivek Prakash 				 * with tabs */
7997c7d358SVivek Prakash 
8097c7d358SVivek Prakash 
8197c7d358SVivek Prakash #define false 0
8297c7d358SVivek Prakash #define true  1
8397c7d358SVivek Prakash 
8497c7d358SVivek Prakash 
8597c7d358SVivek Prakash #ifndef EXTERN
8697c7d358SVivek Prakash #define EXTERN extern
8797c7d358SVivek Prakash #endif
8897c7d358SVivek Prakash 
8997c7d358SVivek Prakash 
9097c7d358SVivek Prakash EXTERN FILE   *input;			/* the fid for the input file */
9197c7d358SVivek Prakash EXTERN FILE   *output;			/* the output file */
9297c7d358SVivek Prakash 
9397c7d358SVivek Prakash #define CHECK_SIZE_CODE \
9497c7d358SVivek Prakash 	if (e_code >= l_code) { \
9597c7d358SVivek Prakash 	    int nsize = l_code-s_code+400; \
9697c7d358SVivek Prakash 	    codebuf = (char *) realloc(codebuf, nsize); \
9797c7d358SVivek Prakash 	    e_code = codebuf + (e_code-s_code) + 1; \
9897c7d358SVivek Prakash 	    l_code = codebuf + nsize - 5; \
9997c7d358SVivek Prakash 	    s_code = codebuf + 1; \
10097c7d358SVivek Prakash 	}
10197c7d358SVivek Prakash #define CHECK_SIZE_COM \
10297c7d358SVivek Prakash 	if (e_com >= l_com) { \
10397c7d358SVivek Prakash 	    int nsize = l_com-s_com+400; \
10497c7d358SVivek Prakash 	    combuf = (char *) realloc(combuf, nsize); \
10597c7d358SVivek Prakash 	    e_com = combuf + (e_com-s_com) + 1; \
10697c7d358SVivek Prakash 	    l_com = combuf + nsize - 5; \
10797c7d358SVivek Prakash 	    s_com = combuf + 1; \
10897c7d358SVivek Prakash 	}
10997c7d358SVivek Prakash #define CHECK_SIZE_LAB \
11097c7d358SVivek Prakash 	if (e_lab >= l_lab) { \
11197c7d358SVivek Prakash 	    int nsize = l_lab-s_lab+400; \
11297c7d358SVivek Prakash 	    labbuf = (char *) realloc(labbuf, nsize); \
11397c7d358SVivek Prakash 	    e_lab = labbuf + (e_lab-s_lab) + 1; \
11497c7d358SVivek Prakash 	    l_lab = labbuf + nsize - 5; \
11597c7d358SVivek Prakash 	    s_lab = labbuf + 1; \
11697c7d358SVivek Prakash 	}
11797c7d358SVivek Prakash #define CHECK_SIZE_TOKEN \
11897c7d358SVivek Prakash 	if (e_token >= l_token) { \
11997c7d358SVivek Prakash 	    int nsize = l_token-s_token+400; \
12097c7d358SVivek Prakash 	    tokenbuf = (char *) realloc(tokenbuf, nsize); \
12197c7d358SVivek Prakash 	    e_token = tokenbuf + (e_token-s_token) + 1; \
12297c7d358SVivek Prakash 	    l_token = tokenbuf + nsize - 5; \
12397c7d358SVivek Prakash 	    s_token = tokenbuf + 1; \
12497c7d358SVivek Prakash 	}
12597c7d358SVivek Prakash 
12697c7d358SVivek Prakash EXTERN char   *labbuf;			/* buffer for label */
12797c7d358SVivek Prakash EXTERN char   *s_lab;			/* start ... */
12897c7d358SVivek Prakash EXTERN char   *e_lab;			/* .. and end of stored label */
12997c7d358SVivek Prakash EXTERN char   *l_lab;			/* limit of label buffer */
13097c7d358SVivek Prakash 
13197c7d358SVivek Prakash EXTERN char   *codebuf;			/* buffer for code section */
13297c7d358SVivek Prakash EXTERN char   *s_code;			/* start ... */
13397c7d358SVivek Prakash EXTERN char   *e_code;			/* .. and end of stored code */
13497c7d358SVivek Prakash EXTERN char   *l_code;			/* limit of code section */
13597c7d358SVivek Prakash 
13697c7d358SVivek Prakash EXTERN char   *combuf;			/* buffer for comments */
13797c7d358SVivek Prakash EXTERN char   *s_com;			/* start ... */
13897c7d358SVivek Prakash EXTERN char   *e_com;			/* ... and end of stored comments */
13997c7d358SVivek Prakash EXTERN char   *l_com;			/* limit of comment buffer */
14097c7d358SVivek Prakash 
14197c7d358SVivek Prakash #define token s_token
14297c7d358SVivek Prakash EXTERN char   *tokenbuf;		/* the last token scanned */
14397c7d358SVivek Prakash EXTERN char   *s_token;
14497c7d358SVivek Prakash EXTERN char   *e_token;
14597c7d358SVivek Prakash EXTERN char   *l_token;
14697c7d358SVivek Prakash 
14797c7d358SVivek Prakash EXTERN char   *in_buffer;		/* input buffer */
14897c7d358SVivek Prakash EXTERN char   *in_buffer_limit;		/* the end of the input buffer */
14997c7d358SVivek Prakash EXTERN char   *buf_ptr;			/* ptr to next character to be taken from
15097c7d358SVivek Prakash 					 * in_buffer */
15197c7d358SVivek Prakash EXTERN char   *buf_end;			/* ptr to first after last char in in_buffer */
15297c7d358SVivek Prakash 
15397c7d358SVivek Prakash EXTERN char    save_com[sc_size];	/* input text is saved here when looking for
15497c7d358SVivek Prakash 				 	 * the brace after an if, while, etc */
15597c7d358SVivek Prakash EXTERN char   *sc_end;			/* pointer into save_com buffer */
15697c7d358SVivek Prakash 
15797c7d358SVivek Prakash EXTERN char   *bp_save;			/* saved value of buf_ptr when taking input
15897c7d358SVivek Prakash 					 * from save_com */
15997c7d358SVivek Prakash EXTERN char   *be_save;			/* similarly saved value of buf_end */
16097c7d358SVivek Prakash 
16197c7d358SVivek Prakash 
16297c7d358SVivek Prakash EXTERN int     pointer_as_binop;
16397c7d358SVivek Prakash EXTERN int     blanklines_after_declarations;
16497c7d358SVivek Prakash EXTERN int     blanklines_before_blockcomments;
16597c7d358SVivek Prakash EXTERN int     blanklines_after_procs;
16697c7d358SVivek Prakash EXTERN int     blanklines_around_conditional_compilation;
16797c7d358SVivek Prakash EXTERN int     swallow_optional_blanklines;
16897c7d358SVivek Prakash EXTERN int     n_real_blanklines;
16997c7d358SVivek Prakash EXTERN int     prefix_blankline_requested;
17097c7d358SVivek Prakash EXTERN int     postfix_blankline_requested;
17197c7d358SVivek Prakash EXTERN int     break_comma;		/* when true and not in parens, break after a
17297c7d358SVivek Prakash 					 * comma */
17397c7d358SVivek Prakash EXTERN int     btype_2;			/* when true, brace should be on same line as
17497c7d358SVivek Prakash 					 * if, while, etc */
17597c7d358SVivek Prakash EXTERN float   case_ind;		/* indentation level to be used for a "case
17697c7d358SVivek Prakash 					 * n:" */
17797c7d358SVivek Prakash EXTERN int     code_lines;		/* count of lines with code */
17897c7d358SVivek Prakash EXTERN int     had_eof;			/* set to true when input is exhausted */
17997c7d358SVivek Prakash EXTERN int     line_no;			/* the current line number. */
18097c7d358SVivek Prakash EXTERN int     max_col;			/* the maximum allowable line length */
18197c7d358SVivek Prakash EXTERN int     verbose;			/* when true, non-essential error messages are
18297c7d358SVivek Prakash 					 * printed */
18397c7d358SVivek Prakash EXTERN int     cuddle_else;		/* true if else should cuddle up to '}' */
18497c7d358SVivek Prakash EXTERN int     star_comment_cont;	/* true iff comment continuation lines should
18597c7d358SVivek Prakash 					 * have stars at the beginning of each line. */
18697c7d358SVivek Prakash EXTERN int     comment_delimiter_on_blankline;
18797c7d358SVivek Prakash EXTERN int     troff;			/* true iff were generating troff input */
18897c7d358SVivek Prakash EXTERN int     procnames_start_line;	/* if true, the names of procedures being
18997c7d358SVivek Prakash 					 * defined get placed in column 1 (ie. a
19097c7d358SVivek Prakash 					 * newline is placed between the type of the
19197c7d358SVivek Prakash 					 * procedure and its name) */
19297c7d358SVivek Prakash EXTERN int     proc_calls_space;	/* If true, procedure calls look like:
19397c7d358SVivek Prakash 					 * foo(bar) rather than foo (bar) */
19497c7d358SVivek Prakash EXTERN int     format_col1_comments;	/* If comments which start in column 1 are to
19597c7d358SVivek Prakash 					 * be magically reformatted (just like
19697c7d358SVivek Prakash 					 * comments that begin in later columns) */
19797c7d358SVivek Prakash EXTERN int     inhibit_formatting;	/* true if INDENT OFF is in effect */
19897c7d358SVivek Prakash EXTERN int     suppress_blanklines;	/* set iff following blanklines should be
19997c7d358SVivek Prakash 					 * suppressed */
20097c7d358SVivek Prakash EXTERN int     continuation_indent;	/* set to the indentation between the edge of
20197c7d358SVivek Prakash 					 * code and continuation lines */
20297c7d358SVivek Prakash EXTERN int     lineup_to_parens;	/* if true, continued code within parens will
20397c7d358SVivek Prakash 					 * be lined up to the open paren */
20497c7d358SVivek Prakash EXTERN int     Bill_Shannon;		/* true iff a blank should always be inserted
20597c7d358SVivek Prakash 					 * after sizeof */
20697c7d358SVivek Prakash EXTERN int     blanklines_after_declarations_at_proctop;	/* This is vaguely
20797c7d358SVivek Prakash 								 * similar to
20897c7d358SVivek Prakash 								 * blanklines_after_decla
20997c7d358SVivek Prakash 								 * rations except that
21097c7d358SVivek Prakash 								 * it only applies to
21197c7d358SVivek Prakash 								 * the first set of
21297c7d358SVivek Prakash 								 * declarations in a
21397c7d358SVivek Prakash 								 * procedure (just after
21497c7d358SVivek Prakash 								 * the first '{') and it
21597c7d358SVivek Prakash 								 * causes a blank line
21697c7d358SVivek Prakash 								 * to be generated even
21797c7d358SVivek Prakash 								 * if there are no
21897c7d358SVivek Prakash 								 * declarations */
21997c7d358SVivek Prakash EXTERN int     block_comment_max_col;
22097c7d358SVivek Prakash EXTERN int     extra_expression_indent; /* True if continuation lines from the
22197c7d358SVivek Prakash 					 * expression part of "if(e)", "while(e)",
22297c7d358SVivek Prakash 					 * "for(e;e;e)" should be indented an extra
22397c7d358SVivek Prakash 					 * tab stop so that they don't conflict with
22497c7d358SVivek Prakash 					 * the code that follows */
225*0a6a1f1dSLionel Sambuc EXTERN int    use_tabs;			/* set true to use tabs for spacing,
226*0a6a1f1dSLionel Sambuc 					 * false uses all spaces */
22797c7d358SVivek Prakash 
22897c7d358SVivek Prakash /* -troff font state information */
22997c7d358SVivek Prakash 
23097c7d358SVivek Prakash struct fstate {
23197c7d358SVivek Prakash 	char    font[4];
23297c7d358SVivek Prakash 	char    size;
23397c7d358SVivek Prakash 	int     allcaps:1;
23497c7d358SVivek Prakash };
23597c7d358SVivek Prakash 
23697c7d358SVivek Prakash EXTERN struct fstate
23797c7d358SVivek Prakash         keywordf,		/* keyword font */
23897c7d358SVivek Prakash         stringf,		/* string font */
23997c7d358SVivek Prakash         boxcomf,		/* Box comment font */
24097c7d358SVivek Prakash         blkcomf,		/* Block comment font */
24197c7d358SVivek Prakash         scomf,			/* Same line comment font */
24297c7d358SVivek Prakash         bodyf;			/* major body font */
24397c7d358SVivek Prakash 
24497c7d358SVivek Prakash #define STACK_SIZE 150
24597c7d358SVivek Prakash 
24697c7d358SVivek Prakash EXTERN struct parser_state {
24797c7d358SVivek Prakash 	int     last_token;
24897c7d358SVivek Prakash 	struct fstate cfont;	/* Current font */
24997c7d358SVivek Prakash         int     p_stack[STACK_SIZE];	/* this is the parsers stack */
25097c7d358SVivek Prakash         int     il[STACK_SIZE];	/* this stack stores indentation levels */
25197c7d358SVivek Prakash         float   cstk[STACK_SIZE];/* used to store case stmt indentation levels */
25297c7d358SVivek Prakash 	int     box_com;	/* set to true when we are in a "boxed"
25397c7d358SVivek Prakash 				 * comment. In that case, the first non-blank
25497c7d358SVivek Prakash 				 * char should be lined up with the comment / */
25597c7d358SVivek Prakash 	int     comment_delta, n_comment_delta;
25697c7d358SVivek Prakash 	int     cast_mask;	/* indicates which close parens close off
25797c7d358SVivek Prakash 				 * casts */
25897c7d358SVivek Prakash 	int     sizeof_mask;	/* indicates which close parens close off
25997c7d358SVivek Prakash 				 * sizeof''s */
26097c7d358SVivek Prakash 	int     block_init;	/* true iff inside a block initialization */
26197c7d358SVivek Prakash 	int     block_init_level;	/* The level of brace nesting in an
26297c7d358SVivek Prakash 					 * initialization */
26397c7d358SVivek Prakash 	int     last_nl;	/* this is true if the last thing scanned was
26497c7d358SVivek Prakash 				 * a newline */
26597c7d358SVivek Prakash 	int     in_or_st;	/* Will be true iff there has been a
26697c7d358SVivek Prakash 				 * declarator (e.g. int or char) and no left
26797c7d358SVivek Prakash 				 * paren since the last semicolon. When true,
26897c7d358SVivek Prakash 				 * a '{' is starting a structure definition or
26997c7d358SVivek Prakash 				 * an initialization list */
27097c7d358SVivek Prakash 	int     bl_line;	/* set to 1 by dump_line if the line is blank */
27197c7d358SVivek Prakash 	int     col_1;		/* set to true if the last token started in
27297c7d358SVivek Prakash 				 * column 1 */
27397c7d358SVivek Prakash 	int     com_col;	/* this is the column in which the current
27497c7d358SVivek Prakash 				 * coment should start */
27597c7d358SVivek Prakash 	int     com_ind;	/* the column in which comments to the right
27697c7d358SVivek Prakash 				 * of code should start */
27797c7d358SVivek Prakash 	int     com_lines;	/* the number of lines with comments, set by
27897c7d358SVivek Prakash 				 * dump_line */
27997c7d358SVivek Prakash 	int     dec_nest;	/* current nesting level for structure or init */
28097c7d358SVivek Prakash 	int     decl_com_ind;	/* the column in which comments after
28197c7d358SVivek Prakash 				 * declarations should be put */
28297c7d358SVivek Prakash 	int     decl_on_line;	/* set to true if this line of code has part
28397c7d358SVivek Prakash 				 * of a declaration on it */
28497c7d358SVivek Prakash 	int     i_l_follow;	/* the level to which ind_level should be set
28597c7d358SVivek Prakash 				 * after the current line is printed */
28697c7d358SVivek Prakash 	int     in_decl;	/* set to true when we are in a declaration
28797c7d358SVivek Prakash 				 * stmt.  The processing of braces is then
28897c7d358SVivek Prakash 				 * slightly different */
28997c7d358SVivek Prakash 	int     in_stmt;	/* set to 1 while in a stmt */
29097c7d358SVivek Prakash 	int     ind_level;	/* the current indentation level */
29197c7d358SVivek Prakash 	int     ind_size;	/* the size of one indentation level */
29297c7d358SVivek Prakash 	int     ind_stmt;	/* set to 1 if next line should have an extra
29397c7d358SVivek Prakash 				 * indentation level because we are in the
29497c7d358SVivek Prakash 				 * middle of a stmt */
29597c7d358SVivek Prakash 	int     last_u_d;	/* set to true after scanning a token which
29697c7d358SVivek Prakash 				 * forces a following operator to be unary */
29797c7d358SVivek Prakash 	int     leave_comma;	/* if true, never break declarations after
29897c7d358SVivek Prakash 				 * commas */
29997c7d358SVivek Prakash 	int     ljust_decl;	/* true if declarations should be left
30097c7d358SVivek Prakash 				 * justified */
30197c7d358SVivek Prakash 	int     out_coms;	/* the number of comments processed, set by
30297c7d358SVivek Prakash 				 * pr_comment */
30397c7d358SVivek Prakash 	int     out_lines;	/* the number of lines written, set by
30497c7d358SVivek Prakash 				 * dump_line */
30597c7d358SVivek Prakash 	int     p_l_follow;	/* used to remember how to indent following
30697c7d358SVivek Prakash 				 * statement */
30797c7d358SVivek Prakash 	int     paren_level;	/* parenthesization level. used to indent
30897c7d358SVivek Prakash 				 * within stmts */
30997c7d358SVivek Prakash 	short   paren_indents[20];	/* column positions of each paren */
31097c7d358SVivek Prakash 	int     pcase;		/* set to 1 if the current line label is a
31197c7d358SVivek Prakash 				 * case.  It is printed differently from a
31297c7d358SVivek Prakash 				 * regular label */
31397c7d358SVivek Prakash 	int     search_brace;	/* set to true by parse when it is necessary
31497c7d358SVivek Prakash 				 * to buffer up all info up to the start of a
31597c7d358SVivek Prakash 				 * stmt after an if, while, etc */
31697c7d358SVivek Prakash 	int     unindent_displace;	/* comments not to the right of code
31797c7d358SVivek Prakash 					 * will be placed this many
31897c7d358SVivek Prakash 					 * indentation levels to the left of
31997c7d358SVivek Prakash 					 * code */
32097c7d358SVivek Prakash 	int     use_ff;		/* set to one if the current line should be
32197c7d358SVivek Prakash 				 * terminated with a form feed */
32297c7d358SVivek Prakash 	int     want_blank;	/* set to true when the following token should
32397c7d358SVivek Prakash 				 * be prefixed by a blank. (Said prefixing is
32497c7d358SVivek Prakash 				 * ignored in some cases.) */
32597c7d358SVivek Prakash 	int     else_if;	/* True iff else if pairs should be handled
32697c7d358SVivek Prakash 				 * specially */
32797c7d358SVivek Prakash 	int     decl_indent;	/* column to indent declared identifiers to */
32897c7d358SVivek Prakash 	int     its_a_keyword;
32997c7d358SVivek Prakash 	int     sizeof_keyword;
33097c7d358SVivek Prakash 	int     dumped_decl_indent;
33197c7d358SVivek Prakash 	float   case_indent;	/* The distance to indent case labels from the
33297c7d358SVivek Prakash 				 * switch statement */
33397c7d358SVivek Prakash 	int     in_parameter_declaration;
33497c7d358SVivek Prakash 	int     indent_parameters;
33597c7d358SVivek Prakash 	int     tos;		/* pointer to top of stack */
33697c7d358SVivek Prakash 	char    procname[100];	/* The name of the current procedure */
33797c7d358SVivek Prakash 	int     just_saw_decl;
33897c7d358SVivek Prakash }       ps;
33997c7d358SVivek Prakash 
34097c7d358SVivek Prakash EXTERN int     ifdef_level;
34197c7d358SVivek Prakash EXTERN int     rparen_count;
34297c7d358SVivek Prakash EXTERN struct parser_state state_stack[5];
34397c7d358SVivek Prakash EXTERN struct parser_state match_state[5];
34497c7d358SVivek Prakash 
34597c7d358SVivek Prakash int compute_code_target(void);
34697c7d358SVivek Prakash int compute_label_target(void);
34797c7d358SVivek Prakash int count_spaces(int, char *);
34897c7d358SVivek Prakash void diag(int, const char *,...) __attribute__((__format__(__printf__, 2, 3)));
34997c7d358SVivek Prakash void dump_line(void);
35097c7d358SVivek Prakash int eqin(const char *, const char *);
35197c7d358SVivek Prakash void fill_buffer(void);
35297c7d358SVivek Prakash int pad_output(int, int);
35397c7d358SVivek Prakash void scan_profile(FILE *);
35497c7d358SVivek Prakash void set_defaults(void);
35597c7d358SVivek Prakash void set_option(char *);
35697c7d358SVivek Prakash void addkey(char *, int);
35797c7d358SVivek Prakash void set_profile(void);
35897c7d358SVivek Prakash char *chfont(struct fstate *, struct fstate *, char *);
35997c7d358SVivek Prakash void parsefont(struct fstate *, const char *);
36097c7d358SVivek Prakash void writefdef(struct fstate *, int);
36197c7d358SVivek Prakash int lexi(void);
36297c7d358SVivek Prakash void reduce(void);
36397c7d358SVivek Prakash void parse(int);
36497c7d358SVivek Prakash void pr_comment(void);
36597c7d358SVivek Prakash void bakcopy(void);
366