2 * (c) Oleg Puchinin 2006
3 * graycardinalster@gmail.com
10 // $ silent_bob --structs
11 void got_structs (char * d_file
)
13 struct tt_state_t
* d_tt_state
= CNEW (tt_state_t
, 1);
22 memset (d_tt_state
, 0, sizeof (struct tt_state_t
));
23 d_tt_state
->fileName
= strdup (d_file
);
24 d_ptr
= do_tt (d_tt_state
);
27 ch
= t_op (&d_ptr
, &d_out
);
33 if (!strncmp (d_out
, "typedef", 7))
35 else if (!strncmp (d_out
, "struct", 6))
38 if (! b_typedef
&& ! b_struct
)
41 if (strchr (d_out
, '('))
44 if (ch
== ';' && b_typedef
&& !SB_FLGET (SB_FLNOLINKS
)) // Link...
45 printf ("%s;\n", d_out
);
51 printf ("%s{\n", d_out
);
53 while (brace_depth
> 0) {
54 ch
= t_op (&d_ptr
, &d_out
);
57 printf ("%s\n", d_out
);
64 for (i
= 0; i
< brace_depth
; i
++)
70 if (ch
!= '}' && ch
!= '{' && strlen (d_out
))
71 printf ("%s;\n", d_out
);
72 else if (brace_depth
) {
76 t_op (&d_ptr
, &d_out
);
78 printf (" %s;", d_out
);
85 } // while (brace_deph > 0)
86 ch
= t_op (&d_ptr
, &d_out
);
88 printf ("} %s;\n\n", d_out
);
91 } // if (!strncmp (d_out, "typedef", 7))
92 free_tt_state (d_tt_state
);