1*21975Sdist /* 2*21975Sdist * Copyright (c) 1980 Regents of the University of California. 3*21975Sdist * All rights reserved. The Berkeley software License Agreement 4*21975Sdist * specifies the terms and conditions for redistribution. 5*21975Sdist * 6*21975Sdist * @(#)indent_globs.h 5.1 (Berkeley) 06/04/85 7*21975Sdist */ 88802Smckusick 98802Smckusick /* 108802Smckusick 118802Smckusick Copyright (C) 1976 128802Smckusick by the 138802Smckusick Board of Trustees 148802Smckusick of the 158802Smckusick University of Illinois 168802Smckusick 178802Smckusick All rights reserved 188802Smckusick 198802Smckusick FILE NAME: 208802Smckusick indent_globs.h 218802Smckusick 228802Smckusick PURPOSE: 238802Smckusick This include file contains the declarations for all global variables 248802Smckusick used in indent. 258802Smckusick 268802Smckusick GLOBALS: 278802Smckusick The names of all of the variables will not be repeated here. The 288802Smckusick declarations start on the next page. 298802Smckusick 308802Smckusick FUNCTIONS: 318802Smckusick None 328802Smckusick */ 338802Smckusick #define bufsize 600/* size of internal buffers */ 348802Smckusick #define inp_bufs 512 358802Smckusick /* size of input buffer */ 368802Smckusick #define sc_size 5000 378802Smckusick /* size of save_com buffer */ 388802Smckusick #define label_offset 2 398802Smckusick /* number of levels a label is placed to left of code 408802Smckusick */ 418802Smckusick 428802Smckusick #define d_ljust 0 /* default for ljust_decl */ 438802Smckusick #define d_max_col 75 448802Smckusick /* default for max_col */ 458802Smckusick #define d_com_ind 33 468802Smckusick /* default com_ind */ 478802Smckusick #define d_ind_size 4 488802Smckusick /* default ind_size */ 498802Smckusick #define d_verbose 0/* default verbose */ 508802Smckusick #define d_unindent 1 518802Smckusick /* default value for unindent_displace */ 528802Smckusick #define d_leave_comma 0 538802Smckusick /* default value for leave_comma */ 548802Smckusick #define d_btype_2 1/* default value for btype_2 */ 558802Smckusick 568802Smckusick #define tabsize 8 /* the size of a tab */ 578802Smckusick #define tabmask 0177770 588802Smckusick /* mask used when figuring length of lines with tabs */ 598802Smckusick 608802Smckusick 618802Smckusick #define false 0 628802Smckusick #define true 1 638802Smckusick 648802Smckusick 658802Smckusick int input; /* the fid for the input file */ 668802Smckusick int output; /* the fid for the output file */ 678802Smckusick 688802Smckusick char labbuf[bufsize]; 698802Smckusick /* buffer for label */ 708802Smckusick char *s_lab; /* start ... */ 718802Smckusick char *e_lab; /* .. and end of stored label */ 728802Smckusick 738802Smckusick char codebuf[bufsize]; 748802Smckusick /* buffer for code section */ 758802Smckusick char *s_code; /* start ... */ 768802Smckusick char *e_code; /* .. and end of stored code */ 778802Smckusick 788802Smckusick char combuf[bufsize]; 798802Smckusick /* buffer for comments */ 808802Smckusick char *s_com; /* start ... */ 818802Smckusick char *e_com; /* ... and end of stored comments */ 828802Smckusick 838802Smckusick char in_buffer[inp_bufs]; 848802Smckusick /* input buffer */ 858802Smckusick char *buf_ptr; /* ptr to next character to be taken from in_buffer */ 868802Smckusick char *buf_end; /* ptr to first after last char in in_buffer */ 878802Smckusick 888802Smckusick char save_com[sc_size]; 898802Smckusick /* input text is saved here when looking for the brace 908802Smckusick after an if, while, etc */ 918802Smckusick char *sc_end; /* pointer into save_com buffer */ 928802Smckusick 938802Smckusick char *bp_save; /* saved value of buf_ptr when taking input from 948802Smckusick save_com */ 958802Smckusick char *be_save; /* similarly saved value of buf_end */ 968802Smckusick 978802Smckusick char token[bufsize]; 988802Smckusick /* the last token scanned */ 998802Smckusick 1008802Smckusick 1018802Smckusick 1028802Smckusick 1038802Smckusick int bl_line; /* set to 1 by dump_line if the line is blank */ 1048802Smckusick int break_comma; 1058802Smckusick /* when true and not in parens, break after a comma */ 1068802Smckusick int btype_2; /* when true, brace should be on same line as if, 1078802Smckusick while, etc */ 1088802Smckusick int case_ind; /* indentation level to be used for a "case n:" */ 1098802Smckusick int code_lines;/* count of lines with code */ 1108802Smckusick int col_1; /* set to true if the last token started in column 1 */ 1118802Smckusick int com_col; /* this is the column in which the current coment 1128802Smckusick should start */ 1138802Smckusick int com_ind; /* the column in which comments to the right of code 1148802Smckusick should start */ 1158802Smckusick int com_lines; /* the number of lines with comments, set by dump_line 1168802Smckusick */ 1178802Smckusick int dec_nest; /* current nesting level for structure or init */ 1188802Smckusick int decl_com_ind; 1198802Smckusick /* the column in which comments after declarations 1208802Smckusick should be put */ 1218802Smckusick int decl_on_line; 1228802Smckusick /* set to true if this line of code has part of a 1238802Smckusick declaration on it */ 1248802Smckusick int had_eof; /* set to true when input is exhausted */ 1258802Smckusick int i_l_follow;/* the level to which ind_level should be set after the 1268802Smckusick current line is printed */ 1278802Smckusick int in_decl; /* set to true when we are in a declaration stmt. The 1288802Smckusick processing of braces is then slightly different */ 1298802Smckusick int in_stmt; /* set to 1 while in a stmt */ 1308802Smckusick int ind_level; /* the current indentation level */ 1318802Smckusick int ind_size; /* the size of one indentation level */ 1328802Smckusick int ind_stmt; /* set to 1 if next line should have an extra 1338802Smckusick indentation level because we are in the middle of a 1348802Smckusick stmt */ 1358802Smckusick int last_u_d; /* set to true after scanning a token which forces a 1368802Smckusick following operator to be unary */ 1378802Smckusick int leave_comma; 1388802Smckusick /* if true, never break declarations after commas */ 1398802Smckusick int line_no; /* the current line number. */ 1408802Smckusick int ljust_decl;/* true if declarations should be left justified */ 1418802Smckusick int max_col; /* the maximum allowable line length */ 1428802Smckusick int out_coms; /* the number of comments processed, set by pr_comment 1438802Smckusick */ 1448802Smckusick int out_lines; /* the number of lines written, set by dump_line */ 1458802Smckusick int p_l_follow;/* used to remember how to indent following statement 1468802Smckusick */ 1478802Smckusick int paren_level; 1488802Smckusick /* parenthesization level. used to indent within stmts 1498802Smckusick */ 1508802Smckusick int pcase; /* set to 1 if the current line label is a case. It is 1518802Smckusick printed differently from a regular label */ 1528802Smckusick int search_brace; 1538802Smckusick /* set to true by parse when it is necessary to buffer 1548802Smckusick up all info up to the start of a stmt after an if, 1558802Smckusick while, etc */ 1568802Smckusick int unindent_displace; 1578802Smckusick /* comments not to the right of code will be placed 1588802Smckusick this many indentation levels to the left of code */ 1598802Smckusick int use_ff; /* set to one if the current line should be terminated 1608802Smckusick with a form feed */ 1618802Smckusick int verbose; /* when true, non-essential error messages are printed 1628802Smckusick */ 163