2 * (c) Oleg Puchinin 2006
3 * graycardinalster@gmail.com
8 * January 2006 - most bugs is killed.
11 #include "functions.h"
13 char * globals_main (struct tt_state_t
* d_tt_state
, int d_type
)
15 struct pair_t
* d_attachment
;
16 bool b_infunction
= false;
19 char *d_out
, *d_ptr
; // for t_op
29 d_ptr
= d_tt_state
->d_output
;
30 d_file
= d_tt_state
->d_file_name
;
31 d_attachment
= d_tt_state
->d_attachment
;
37 ch
= t_op (&d_ptr
, &d_out
);
49 if (! local_define_test (d_out
)) {
50 skip_macro (&d_ptr
, &d_out
, ch
);
52 if (d_type
& GLOBAL_TYPE_DEFINE
) {
53 d_found_type
|= GLOBAL_TYPE_DEFINE
;
66 if (brace_depth
&& (d_type
!= OP_TYPE_CALL
)) {
71 if (*d_out
== 0 || ch
== '\n') {
76 d_found_type
= d_type
& what_is_this (d_out
, ch
);
77 if (d_found_type
& GLOBAL_TYPE_FUNCTION
)
93 if (bb
== BB_BEGIN
&& !brace_depth
)
97 if (brace_depth
< 0) // Suddenly head
101 if (d_found_type
& GLOBAL_TYPE_STRUCT
&& ch
== '{') {
102 bb_line
= d_attachment
[t_op_no
].pair_line
+1;
103 bb_line
+= ww_begin_line (d_tt_state
,
104 d_out
, d_attachment
[t_op_no
].offset
);
108 if (bb
== BB_TAIL
) { // struct { ... } .*? ;
111 if (strlen (d_out
) > 1)
112 mk_tag_structtail (d_out
, d_file
, bb_line
);
115 if (b_found
&& !SB_FLGET (SB_FLSIMULATE
)) {
116 t_line
= d_attachment
[t_op_no
].pair_line
+1;
117 t_line
+= ww_begin_line (d_tt_state
,
118 d_out
, d_attachment
[t_op_no
].offset
);
120 if (SB_FLGET(SB_FLTAGSTYLE
))
121 mk_tag (d_out
, d_file
, t_line
, d_found_type
);
123 printf ("%s\t\t//file %s //line %i\n", d_out
, d_file
, t_line
);
126 if (b_found
&& d_found_type
& GLOBAL_TYPE_DEFINE
)
127 skip_macro (&d_ptr
, &d_out
, ch
);
133 void globals (char * d_file
, int d_type
)
137 struct tt_state_t
* d_tt_state
;
139 d_tt_state
= CNEW (tt_state_t
, 1);
140 d_tt_state
->d_file_name
= d_file
;
142 d_ptr
= do_tt(d_tt_state
);
145 fprintf (d_stream_dbg
, "\tglobals, do_tt result is NULL\n");
150 globals_main (d_tt_state
, d_type
);
152 THE_TT::free_tt_state (d_tt_state
);