2 * (c) Oleg Puchinin 2006
3 * graycardinalster@gmail.com
8 * January 2006 - most bugs is killed.
15 char * globals_main (struct tt_state_t
* d_tt_state
, int d_type
)
17 struct pair_t
* d_attachment
;
18 bool b_infunction
= false;
21 char *d_out
, *d_ptr
; // for t_op
31 d_ptr
= d_tt_state
->d_output
;
32 d_file
= d_tt_state
->d_file_name
;
33 d_attachment
= d_tt_state
->d_attachment
;
39 ch
= t_op (&d_ptr
, &d_out
);
51 if (! def_test (d_out
)) {
52 skip_macro (&d_ptr
, &d_out
, ch
);
54 if (d_type
& GLOBAL_TYPE_DEFINE
) {
55 d_found_type
|= GLOBAL_TYPE_DEFINE
;
68 if (brace_depth
&& (d_type
!= OP_TYPE_CALL
)) {
73 if (*d_out
== 0 || ch
== '\n') {
78 d_found_type
= d_type
& what_is_this (d_out
, ch
);
79 if (d_found_type
& GLOBAL_TYPE_FUNCTION
)
95 if (bb
== BB_BEGIN
&& !brace_depth
)
99 if (brace_depth
< 0) // Suddenly head
103 if (d_found_type
& GLOBAL_TYPE_STRUCT
&& ch
== '{') {
104 bb_line
= d_attachment
[ENV
->t_op_no
].pair_line
+1;
105 bb_line
+= ww_begin_line (d_tt_state
,
106 d_out
, d_attachment
[ENV
->t_op_no
].offset
);
110 if (bb
== BB_TAIL
) { // struct { ... } .*? ;
113 if (strlen (d_out
) > 1)
114 mk_tag_structtail (d_out
, d_file
, bb_line
);
117 if (b_found
&& !SB_FLGET (SB_FLSIMULATE
)) {
118 t_line
= d_attachment
[ENV
->t_op_no
].pair_line
+1;
119 t_line
+= ww_begin_line (d_tt_state
,
120 d_out
, d_attachment
[ENV
->t_op_no
].offset
);
122 if (SB_FLGET(SB_FLTAGSTYLE
))
123 mk_tag (d_out
, d_file
, t_line
, d_found_type
);
125 printf ("%s\t\t//file %s //line %i\n", d_out
, d_file
, t_line
);
128 if (b_found
&& d_found_type
& GLOBAL_TYPE_DEFINE
)
129 skip_macro (&d_ptr
, &d_out
, ch
);
135 void globals (char * d_file
, int d_type
)
139 struct tt_state_t
* d_tt_state
;
141 d_tt_state
= CNEW (tt_state_t
, 1);
142 d_tt_state
->d_file_name
= d_file
;
144 d_ptr
= do_tt(d_tt_state
);
146 log_globals (d_file
, d_type
, d_tt_state
->d_filein_size
);
149 fprintf (ENV
->d_stream_dbg
, "\tglobals, do_tt result is NULL\n");
154 globals_main (d_tt_state
, d_type
);
156 free_tt_state (d_tt_state
);