2 * (c) Oleg Puchinin 2006
3 * graycardinalster@gmail.com
10 * February 2006 - comments and strings BUG fixed...
15 bool brace_count (char * d_str
, int * d_count
, bool b_force_block
) // "nice"
19 if (! d_str
|| ! d_count
)
23 if (!strncmp (d_str
, "/*", 2)) {
30 if (strncmp (d_str
, "*/", 2)) {
40 if (!strncmp (d_str
, "//", 2))
43 if (*d_str
== '\"' || *d_str
== '\'') {
44 d_str
= sstrend (d_str
);
45 if (d_str
== NULL
|| *d_str
== 0) {
46 assert (true, "HimTeh 4");
61 if (*d_str
== ';' && *d_count
== 0 && !b_force_block
) {
71 void nogui_fdump (struct fdump_param_t
* d_param
)
80 if (!d_array
.from_file (d_param
->d_file_name
))
83 if (d_param
->d_file_output
== NULL
)
86 d_file
= fopen (d_param
->d_file_output
, "w");
91 if (! d_param
->linear
) {
92 for (a
= 0; a
< d_param
->n_trip
; a
++)
93 fprintf (d_file
, "\t");
94 fprintf (d_file
, "//<***>\n");
97 i
= d_param
->d_line
-1;
98 d_size
= d_array
.get_size ();
101 if (d_array
.get (i
)[0] != '#') {
103 if (!d_param
->linear
) {
104 for (a
= 0; a
< d_param
->n_trip
; a
++)
105 fprintf (d_file
, "\t");
107 fprintf (d_file
, "%s", d_array
.get(i
));
109 if (brace_count (d_array
.get(i
), &d_count
, d_param
->b_force_block
) && !d_count
)
112 if (!d_count
&& ((i
- d_param
->d_line
) > 2) && !d_param
->b_force_block
)
120 fprintf (d_file
, "%s", S
);
121 S
= &S
[strlen (S
)-2];
122 while ((*S
== ' ') || (*S
== '\t'))
128 } while (i
< d_size
);
131 if (!d_param
->linear
) {
132 for (a
= 0; a
< d_param
->n_trip
; a
++)
133 fprintf (d_file
, "\t");
134 fprintf (d_file
, "//</***>\n");
137 if (d_param
->d_file_output
!= NULL
)
140 d_array
.foreach (free
);