2 * (c) Oleg Puchinin 2006.
3 * graycardinalster@gmail.com
10 int what_is_this (char * d_op
, char ch
)
18 if (*d_op
== '#' || ch
== '\n') {
24 d_words_count
= words_count (d_op
);
29 if (d_words_count
== 1) {
30 if (ww_call_cmp (d_op
, (char *) "if", 2) ||
31 ww_call_cmp (d_op
, (char *) "else", 4) ||
32 ww_call_cmp (d_op
, (char *) "do", 2) ||
33 ww_call_cmp (d_op
, (char *) "while", 5) ||
34 ww_call_cmp (d_op
, (char *) "switch", 6) ||
35 ww_case_cmp (d_op
, (char *) "case", 4))
38 if (ww_after_word (d_op
) == '(')
41 return OT::Other
; // Macro or operations (e.g. "+-=*/%^" etc...)
44 if (! strncmp (d_op
, "else if ", 8))
46 if (! strncmp (d_op
, "class ", 6) && ch
== ';') // class definition
49 d_last_ch
= last_ch (d_op
);
53 b_local_ftest
= local_ftest (d_op
);
54 if ((ch
== '{' && d_last_ch
== ')')) {
55 if (b_local_ftest
) // Paranoid.
59 if (! strncmp (d_op
, "extern ", 7))
64 if (! strncmp (d_op
, "typedef ", 8)) {
69 if (! strncmp (d_op
, "static ", 7))
72 if (! strncmp (d_op
, "const ", 6)) // "static const struct"
75 if (! strncmp (d_op
, "union ", 6))
76 return Ret
| OT::Other
;
78 if (! strncmp (d_op
, "enum ", 5))
79 return Ret
| OT::Other
;
81 if (! strncmp (d_op
, "struct ", 7))
82 return Ret
| OT::Struct
;
84 if (! strncmp (d_op
, "class ", 6))
87 if (! strncmp (d_op
, "namespace ", 10))
90 if ((words_count (d_op
) > 1) && !b_local_ftest
)
99 if (!strncmp (d_op
, "typedef ", 8))
103 S
= strchr (d_op
, '(');
108 if (words_count (S
) <= 1) {
109 S
= strchr_r (S
, ')', 0);
111 if (words_count (S
) > 1)
112 return OT::Other
; // declaration... or not ?
115 if (d_words_count
<= 1)
118 if (!strncmp (d_op
, "struct ", 7) && d_words_count
== 2)
121 if (!strncmp (d_op
, "return ", 7))
124 if (!strncmp (d_op
, "delete ", 7))
129 // Function defenition, callback defenition... it's all ?