Definition at line 66 of file indent.c.
67{
72
75
77
79
80
84
88
89
90
91
92
93
95
98
118
125
139
145
148
149
150
151
152
153#ifdef undef
164
165
168
169
180#endif
181
182 for (
i = 1;
i < argc; ++
i)
183 if (
strcmp(argv[
i],
"-npro") == 0)
184 break;
185 else if (argv[
i][0] ==
'-' && argv[
i][1] ==
'P' && argv[
i][2] !=
'\0')
190
191 for (
i = 1;
i < argc; ++
i) {
192
193
194
195
196 if (argv[
i][0] !=
'-') {
202 continue;
203 }
207
208 errx(1,
"input and output files must be different");
209 }
213 continue;
214 }
215 errx(1,
"unknown parameter: %s", argv[
i]);
216 }
217 else
219 }
225 else {
228 }
229 }
230
242
244 {
247
248 while (1) {
249 if (*p == ' ')
251 else if (*p == '\t')
253 else
254 break;
255 p++;
256 }
259 }
260
261
262
263
264
265 while (1) {
266
268
270
271
272
273
274
275
276
277
278
279
287 }
289
290
291
292
293
294
295
296
297
299 break;
301 break;
304
305
306
307
308
313 }
317 for (;;) {
322 break;
324
325 diag2(1,
"Internal buffer overflow - Move big comment from right after if, while, or whatever");
328 }
329 }
333 break;
335
336
337
338
339
342
343
344
345
346
347
352 break;
353 }
355 }
357 default:
358 {
360
362
365
371
374 }
377 }
383 }
384 }
386
389
393
394 diag2(0,
"Line broken");
395 }
398
401
405
406
410 break;
411 }
412 }
413
414
415
416
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
441 errx(1,
"input too long");
442 }
443 }
446 }
447 }
453 }
454 }
455 }
463 diag2(1,
"Stuff missing from end of file");
464
466 printf(
"There were %d output lines and %d comments\n",
468 printf(
"(Lines with comments)/(Lines with code): %6.3f\n",
470 }
473 }
474 if (
482
484 diag2(0,
"Line broken");
488 }
490
491
493
495
504 }
505 }
508
509
510
511
512
513
514
516
517
518
520
525 break;
526
532 }
534 break;
535
537
539 diag3(0,
"Reached internal limit of %d unclosed parens",
542 }
544 ;
547
550 }
553
554
555
565
566
567
568
569
572
573 }
574
575
576
577
578
582 break;
583
589 } else
595 }
598
600
602
606
608
609
611 }
613
614
615
616 break;
617
621
622
623
624
625
626
628 ;
631 }
634
635 {
637
641 }
643 break;
644
646 {
648
654 }
656 break;
657
662 break;
663
666
667
672 break;
673
677
685 break;
686 }
690 break;
691 }
693
694
695
696
697 {
699
706 }
708
709
710
711
714 break;
715
719
729
732
735 }
736
738
739
740
742
743
744
745
746
747
748 diag2(1,
"Unbalanced parens");
751
754 }
755 }
759
760
764 }
765 break;
766
771
774 else
776
781 }
785
788 } else
790 }
791 }
794
796
797 diag2(1,
"Unbalanced parens");
803 }
804 }
807
809
812 diag3(0,
"Reached internal limit of %d struct levels",
815 }
816
817 }
818 else {
820
821
822
828 }
832
837 break;
838
841
842
845 diag2(1,
"Unbalanced parens");
848 }
852
854 diag2(0,
"Line broken");
856 }
861
866 }
873 break;
874
878
880
883
886
887
888
889
891
897 diag2(0,
"Line broken");
900 }
904 }
905 else {
908 diag2(0,
"Line broken");
911 }
915 }
917
922
933 }
934 }
938 }
940
946
948
951 } else {
952
955 }
957
966 }
969 }
971 }
974
978 }
979 }
986 }
988 {
990
996 }
999 break;
1000
1002 {
1004
1010 }
1012 break;
1013
1015
1018 break;
1019
1022
1023
1026
1029 }
1038 }
1039 break;
1040
1048 {
1051 char quote = 0;
1053
1058 }
1070 }
1071 break;
1072 case '/':
1077 }
1078 break;
1079 case '"':
1080 if (quote == '"')
1081 quote = 0;
1082 break;
1083 case '\'':
1084 if (quote == '\'')
1085 quote = 0;
1086 break;
1087 case '*':
1092 }
1093 break;
1094 }
1095 }
1096
1100
1102
1105 }
1106 else {
1108
1111 }
1113 errx(1,
"input too long");
1122
1123
1127 }
1131 }
1132
1137 }
1138 else
1139 diag2(1,
"#if stack overflow");
1140 }
1143 diag2(1,
s_lab[3] ==
'i' ?
"Unmatched #elif" :
"Unmatched #else");
1144 else {
1147 }
1148 }
1151 diag2(1,
"Unmatched #endif");
1152 else
1154 } else {
1156 int size;
1158 }
1160 {7, "include"},
1161 {6, "define"},
1162 {5, "undef"},
1163 {4, "line"},
1164 {5, "error"},
1165 {6, "pragma"}
1166 };
1168 while (--d >= 0)
1170 break;
1171 if (d < 0) {
1172 diag2(1,
"Unrecognized cpp directive");
1173 break;
1174 }
1175 }
1179 }
1180 else {
1183 }
1184 break;
1185
1186
1189 break;
1190 }
1191
1195 }
1196}
void set_profile(const char *profile_name)
void errx(int eval, const char *fmt,...)
static void bakcopy(void)
static void indent_declaration(int cur_dec_ind, int tabs_to_var)
int compute_code_target(void)
int lexi(struct parser_state *)
void diag2(int, const char *)
void diag3(int, const char *, int)
int count_spaces_until(int, char *, char *)
void alloc_typenames(void)
int block_comment_max_col
int blanklines_after_procs
int postfix_blankline_requested
struct parser_state state_stack[5]
int prefix_blankline_requested
int extra_expression_indent
int format_block_comments
int comment_delimiter_on_blankline
#define CHECK_SIZE_LAB(desired_size)
struct parser_state match_state[5]
int blanklines_around_conditional_compilation
int swallow_optional_blanklines
int lineup_to_parens_always
int blanklines_after_declarations_at_proctop
int in_parameter_declaration
References alloc_typenames(), BACKSLASH, bakcopy(), be_save, Bill_Shannon, binary_op, parser_state::bl_line, blanklines_after_declarations_at_proctop, blanklines_after_procs, blanklines_around_conditional_compilation, block_comment_max_col, parser_state::block_init, parser_state::block_init_level, bp_save, break_comma, btype_2, buf_end, buf_ptr, bufsize, parser_state::case_indent, casestmt, parser_state::cast_mask, CHECK_SIZE_CODE, CHECK_SIZE_LAB, code_lines, codebuf, colon, parser_state::com_ind, parser_state::com_lines, combuf, comma, comment, comment_delimiter_on_blankline, compute_code_target(), continuation_indent, count_spaces_until(), cuddle_else, parser_state::dec_nest, decl, parser_state::decl_com_ind, parser_state::decl_indent, parser_state::decl_on_line, diag2(), diag3(), dolit, dump_line(), parser_state::dumped_decl_indent, e_code, e_com, e_lab, e_token, parser_state::else_if, elselit, err(), errx(), extra_expression_indent, fb(), fill_buffer(), form_feed, format_block_comments, format_col1_comments, forstmt, found_err, funcname, function_brace_split, had_eof, i, parser_state::i_l_follow, ident, ifdef_level, ifhead, ifstmt, parser_state::il, in_buffer, in_buffer_limit, parser_state::in_decl, in_name, parser_state::in_or_st, parser_state::in_parameter_declaration, parser_state::in_stmt, parser_state::ind_level, parser_state::ind_size, parser_state::ind_stmt, indent_declaration(), parser_state::indent_parameters, input, parser_state::just_saw_decl, parser_state::keyword, l_code, l_com, l_lab, l_token, labbuf, parser_state::last_nl, parser_state::last_token, parser_state::last_u_d, lbrace, parser_state::leave_comma, len, lexi(), line_no, lineup_to_parens, lineup_to_parens_always, parser_state::ljust_decl, parser_state::local_decl_indent, lparen, malloc, match_state, max_col, n_real_blanklines, newline, nitems, parser_state::not_cast_mask, parser_state::out_coms, parser_state::out_lines, out_name, output, parser_state::p_l_follow, parser_state::p_stack, parser_state::paren_indents, parser_state::paren_level, parse(), parser_state::pcase, period, pg_fallthrough, postfix_blankline_requested, postop, pr_comment(), preesc, prefix_blankline_requested, printf, proc_calls_space, parser_state::procname, procnames_start_line, ps, question, rbrace, rparen, s_code, s_com, s_lab, s_token, save_com, sc_buf, sc_end, sc_size, parser_state::search_brace, semicolon, set_defaults(), set_option, set_profile(), sp_nparen, sp_paren, space_after_cast, star_comment_cont, state_stack, stmt, storage, strpfx, structure, swallow_optional_blanklines, swstmt, tabsize, tokenbuf, parser_state::tos, type_def, unary_op, parser_state::unindent_displace, parser_state::use_ff, use_tabs, verbose, parser_state::want_blank, and whilestmt.