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