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