2 * (c) Oleg Puchinin 2006
3 * graycardinalster@gmail.com
12 extern FILE * d_stream_dbg
;
14 const char * d_lpsz_operators
[] = { "if", "else", "for", "while", "do", "switch", "#define",
15 "#include", "#else", "#if", "#elif","typedef", "struct", "class",
16 "case", "return", NULL
};
18 const char * d_lpsz_oneopops
[] = {"if", "else", "for", "while", "do", NULL
};
19 const char * d_lpsz_mustlined_ops
[] = {"if", "for", "while", "do", NULL
};
20 const char * d_lpsz_greenpeace
[] = {"struct",
32 // $ silent_bob --indent
33 void nogui_indent () // "UN-TT" ;)
35 struct tt_state_t
* d_tt_state
;
36 bool b_inmacro
= false;
46 d_tt_state
= CNEW (tt_state_t
, 1);
47 d_tt_state
->fileName
= strdup ("-");
48 d_ptr
= THE_TT::do_tt_file (d_tt_state
);
51 d_array
.push ((char **) d_lpsz_oneopops
);
52 d_must_lined
.push ((char **) d_lpsz_mustlined_ops
);
53 d_operators
.push ((char **) d_lpsz_operators
);
56 ch
= t_op (&d_ptr
, &d_out
); // t_op on top
64 if (ch
== '\n' && d_ptr
[-1] != '\\') {
65 printf ("%s\n", d_out
);
73 if (d_must_lined
.snfind (d_out
) != -1 && !t_lined
&& !b_inmacro
) {
78 if (ch
!= '\n' && !b_inmacro
) {
79 for (i
= 0; i
< brace_depth
; i
++)
91 if (b_inmacro
&& ch
== '}')
95 if (ch
== '}' && brace_depth
== 0) {
96 if (*d_ptr
== '#' || *d_ptr
== '\n')
98 else if (*d_ptr
&& *d_ptr
!= ';') {
100 fputc ('\n', stdout
);
102 else if (*d_ptr
&& *d_ptr
== ';') {
108 fputc ('\n', stdout
);
116 free_tt_state (d_tt_state
);