1*8802Smckusick /*	@(#)indent_globs.h	4.1	(Berkeley)	10/21/82	*/
2*8802Smckusick 
3*8802Smckusick /*
4*8802Smckusick 
5*8802Smckusick 			  Copyright (C) 1976
6*8802Smckusick 				by the
7*8802Smckusick 			  Board of Trustees
8*8802Smckusick 				of the
9*8802Smckusick 			University of Illinois
10*8802Smckusick 
11*8802Smckusick 			 All rights reserved
12*8802Smckusick 
13*8802Smckusick FILE NAME:
14*8802Smckusick 	indent_globs.h
15*8802Smckusick 
16*8802Smckusick PURPOSE:
17*8802Smckusick 	This include file contains the declarations for all global variables
18*8802Smckusick 	used in indent.
19*8802Smckusick 
20*8802Smckusick GLOBALS:
21*8802Smckusick 	The names of all of the variables will not be repeated here.  The
22*8802Smckusick 	declarations start on the next page.
23*8802Smckusick 
24*8802Smckusick FUNCTIONS:
25*8802Smckusick 	None
26*8802Smckusick */
27*8802Smckusick #define bufsize 600/* size of internal buffers */
28*8802Smckusick #define inp_bufs 512
29*8802Smckusick 		   /* size of input buffer */
30*8802Smckusick #define sc_size 5000
31*8802Smckusick 		   /* size of save_com buffer */
32*8802Smckusick #define label_offset 2
33*8802Smckusick 		   /* number of levels a label is placed to left of code
34*8802Smckusick 		   */
35*8802Smckusick 
36*8802Smckusick #define d_ljust 0  /* default for ljust_decl */
37*8802Smckusick #define d_max_col 75
38*8802Smckusick 		   /* default for max_col */
39*8802Smckusick #define d_com_ind 33
40*8802Smckusick 		   /* default com_ind */
41*8802Smckusick #define d_ind_size 4
42*8802Smckusick 		   /* default ind_size */
43*8802Smckusick #define d_verbose 0/* default verbose */
44*8802Smckusick #define d_unindent 1
45*8802Smckusick 		   /* default value for unindent_displace */
46*8802Smckusick #define d_leave_comma 0
47*8802Smckusick 		   /* default value for leave_comma */
48*8802Smckusick #define d_btype_2 1/* default value for btype_2 */
49*8802Smckusick 
50*8802Smckusick #define tabsize 8  /* the size of a tab */
51*8802Smckusick #define tabmask 0177770
52*8802Smckusick 		   /* mask used when figuring length of lines with tabs */
53*8802Smckusick 
54*8802Smckusick 
55*8802Smckusick #define false 0
56*8802Smckusick #define true  1
57*8802Smckusick 
58*8802Smckusick 
59*8802Smckusick int     input;     /* the fid for the input file */
60*8802Smckusick int     output;    /* the fid for the output file */
61*8802Smckusick 
62*8802Smckusick char    labbuf[bufsize];
63*8802Smckusick 		   /* buffer for label */
64*8802Smckusick char   *s_lab;     /* start ... */
65*8802Smckusick char   *e_lab;     /* .. and end of stored label */
66*8802Smckusick 
67*8802Smckusick char    codebuf[bufsize];
68*8802Smckusick 		   /* buffer for code section */
69*8802Smckusick char   *s_code;    /* start ... */
70*8802Smckusick char   *e_code;    /* .. and end of stored code */
71*8802Smckusick 
72*8802Smckusick char    combuf[bufsize];
73*8802Smckusick 		   /* buffer for comments */
74*8802Smckusick char   *s_com;     /* start ... */
75*8802Smckusick char   *e_com;     /* ... and end of stored comments */
76*8802Smckusick 
77*8802Smckusick char    in_buffer[inp_bufs];
78*8802Smckusick 		   /* input buffer */
79*8802Smckusick char   *buf_ptr;   /* ptr to next character to be taken from in_buffer */
80*8802Smckusick char   *buf_end;   /* ptr to first after last char in in_buffer */
81*8802Smckusick 
82*8802Smckusick char    save_com[sc_size];
83*8802Smckusick 		   /* input text is saved here when looking for the brace
84*8802Smckusick 		      after an if, while, etc */
85*8802Smckusick char   *sc_end;    /* pointer into save_com buffer */
86*8802Smckusick 
87*8802Smckusick char   *bp_save;   /* saved value of buf_ptr when taking input from
88*8802Smckusick 		      save_com */
89*8802Smckusick char   *be_save;   /* similarly saved value of buf_end */
90*8802Smckusick 
91*8802Smckusick char    token[bufsize];
92*8802Smckusick 		   /* the last token scanned */
93*8802Smckusick 
94*8802Smckusick 
95*8802Smckusick 
96*8802Smckusick 
97*8802Smckusick int     bl_line;   /* set to 1 by dump_line if the line is blank */
98*8802Smckusick int     break_comma;
99*8802Smckusick 		   /* when true and not in parens, break after a comma */
100*8802Smckusick int     btype_2;   /* when true, brace should be on same line as if,
101*8802Smckusick 		      while, etc */
102*8802Smckusick int     case_ind;  /* indentation level to be used for a "case n:" */
103*8802Smckusick int     code_lines;/* count of lines with code */
104*8802Smckusick int     col_1;     /* set to true if the last token started in column 1 */
105*8802Smckusick int     com_col;   /* this is the column in which the current coment
106*8802Smckusick 		      should start */
107*8802Smckusick int     com_ind;   /* the column in which comments to the right of code
108*8802Smckusick 		      should start */
109*8802Smckusick int     com_lines; /* the number of lines with comments, set by dump_line
110*8802Smckusick 		   */
111*8802Smckusick int     dec_nest;  /* current nesting level for structure or init */
112*8802Smckusick int     decl_com_ind;
113*8802Smckusick 		   /* the column in which comments after declarations
114*8802Smckusick 		      should be put */
115*8802Smckusick int     decl_on_line;
116*8802Smckusick 		   /* set to true if this line of code has part of a
117*8802Smckusick 		      declaration on it */
118*8802Smckusick int     had_eof;   /* set to true when input is exhausted */
119*8802Smckusick int     i_l_follow;/* the level to which ind_level should be set after the
120*8802Smckusick 		      current line is printed */
121*8802Smckusick int     in_decl;   /* set to true when we are in a declaration stmt.  The
122*8802Smckusick 		      processing of braces is then slightly different */
123*8802Smckusick int     in_stmt;   /* set to 1 while in a stmt */
124*8802Smckusick int     ind_level; /* the current indentation level */
125*8802Smckusick int     ind_size;  /* the size of one indentation level */
126*8802Smckusick int     ind_stmt;  /* set to 1 if next line should have an extra
127*8802Smckusick 		      indentation level because we are in the middle of a
128*8802Smckusick 		      stmt */
129*8802Smckusick int     last_u_d;  /* set to true after scanning a token which forces a
130*8802Smckusick 		      following operator to be unary */
131*8802Smckusick int     leave_comma;
132*8802Smckusick 		   /* if true, never break declarations after commas */
133*8802Smckusick int     line_no;   /* the current line number. */
134*8802Smckusick int     ljust_decl;/* true if declarations should be left justified */
135*8802Smckusick int     max_col;   /* the maximum allowable line length */
136*8802Smckusick int     out_coms;  /* the number of comments processed, set by pr_comment
137*8802Smckusick 		   */
138*8802Smckusick int     out_lines; /* the number of lines written, set by dump_line */
139*8802Smckusick int     p_l_follow;/* used to remember how to indent following statement
140*8802Smckusick 		   */
141*8802Smckusick int     paren_level;
142*8802Smckusick 		   /* parenthesization level. used to indent within stmts
143*8802Smckusick 		   */
144*8802Smckusick int     pcase;     /* set to 1 if the current line label is a case.  It is
145*8802Smckusick 		      printed differently from  a regular label */
146*8802Smckusick int     search_brace;
147*8802Smckusick 		   /* set to true by parse when it is necessary to buffer
148*8802Smckusick 		      up all info up to the start of a stmt after an if,
149*8802Smckusick 		      while, etc */
150*8802Smckusick int     unindent_displace;
151*8802Smckusick 		   /* comments not to the right of code will be placed
152*8802Smckusick 		      this many indentation levels to the left of code */
153*8802Smckusick int     use_ff;    /* set to one if the current line should be terminated
154*8802Smckusick 		      with a form feed */
155*8802Smckusick int     verbose;   /* when true, non-essential error messages are printed
156*8802Smckusick 		   */
157