Very old versions for history.
[opsoft_archive.git] / silentbob / silent_bob / functions.h
bloba44d8d7e16f94b5610f43750193efe896726c6f2
1 /*
2 * (c) Oleg Puchinin (aka GrayCardinal) 2006
3 * graycardinalster@gmail.com
4 *
5 */
7 #ifndef __FUNCTIONS_H
8 #define __FUNCTIONS_H
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <unistd.h>
13 #include <string.h>
14 #include <dlib.h>
15 #include "structs.h"
16 #include "mod.h"
18 /*** ./got_tag.cpp ***/
19 EArray * got_tag_ctags (char * d_tag) ;
21 void make_ctags (EArray * d_files);
22 void mk_tags (char *f_name, DArray *d_in = NULL);
23 bool local_define_test (char * d_op);
24 char * cts (struct c_word * d_word);
25 DArray * split_to_words (char * d_op);
26 char * ww_last_word (char *d_op);
27 int ww_begin_line (struct tt_state_t * d_tt_state, char *d_out, int d_offset);
28 void mk_tag_macro (char * d_op, char * d_file, int t_line);
29 void mk_tag (char * d_op, char * d_file, int line, int d_found_type);
30 void mk_tag_structtail (char * S, char * d_file, int t_line);
31 void tags (DArray * d_names, char * d_file_output = NULL);
32 void nogui_tagsdump (char * f_name, int n_trip);
33 void tree_echo (int n_trip, char *S);
34 struct tt_state_t * get_onett_tag (char * f_name, char ** d_tt_buf);
35 struct hash_t * parse_variable (char *OP);
36 int fdecl_parse (char * d_out, DArray * d_vars);
37 char * sstrkill (char *OP);
38 void bug_system ();
40 #define GLOBAL_TYPE_VARIABLE (1<<0)
41 #define GLOBAL_TYPE_TYPEDEF (1<<1)
42 #define GLOBAL_TYPE_EXTERN (1<<2)
43 #define GLOBAL_TYPE_FUNCTION (1<<3)
44 #define GLOBAL_TYPE_STRUCT (1<<4)
46 // defenitions
47 #define OP_TYPE_VARIABLE GLOBAL_TYPE_VARIABLE
48 #define OP_TYPE_TYPEDEF GLOBAL_TYPE_TYPEDEF
49 #define OP_TYPE_EXTERN GLOBAL_TYPE_EXTERN
50 #define OP_TYPE_FUNCTION GLOBAL_TYPE_FUNCTION
51 #define OP_TYPE_STRUCT GLOBAL_TYPE_STRUCT
52 #define OP_TYPE_MACRO (1<<5)
53 // others
54 #define OP_TYPE_OP (1<<6)
55 #define OP_TYPE_CALL (1<<7)
56 #define OP_TYPE_DEFINE (1<<8)
57 #define OP_TYPE_NOP (1<<9)
58 #define OP_TYPE_OTHER (1<<31)
59 #define GLOBAL_TYPE_DEFINE OP_TYPE_DEFINE
61 #define GLOBAL_TYPE_CLASS (1<<10)
62 #define OP_TYPE_CLASS GLOBAL_TYPE_CLASS
63 #define GLOBAL_TYPE_NAMESPACE (1<<11)
64 #define OP_TYPE_NAMESPACE GLOBAL_TYPE_NAMESPACE
66 char * sstrend (char * d_ptr);
67 int words_count (char *S);
68 int what_is_this (char * d_op, char ch);
70 /*** ./nogui_fdump.cpp ***/
71 void nogui_fdump (fdump_param_t * d_param);
73 /*** ./the_tt.cpp ***/
74 namespace THE_TT {
75 void tt_skip () ;
76 void tt_comment () ;
77 int the_tt_main (char * f_name) ;
78 char * do_tt_file (tt_state_t * d_tt_state);
79 void free_tt_state (struct tt_state_t * S);
81 #define do_tt THE_TT::do_tt_file
83 void skip_macro (char ** d_ptr, char ** d_out, char ch);
84 char * macro_name (char * d_op, char * mname);
85 char t_op (char ** d_in, char ** d_out, bool b_no_operator = false) ;
87 // Informational functions
88 void bug_longmacro ();
89 void bug_nosuch_tag (char *);
90 void bug_nocalltags ();
92 inline bool abc_test (char * ptr)
94 while (*ptr) {
95 if (if_abc (ptr))
96 return true;
97 ptr++;
99 return false;
102 // Hmm. It's not globals. It's environments.
103 /***/
104 #ifndef I_IN_MAIN
105 #define __EXTERN extern
106 #else
107 #define __EXTERN
108 #endif
110 __EXTERN uint32_t sb_flags;
112 enum {
113 SB_FLVERBOSE = 0,
114 SB_FLLINEAR,
115 SB_FLGVIM,
116 SB_FLNOLINKS,
117 SB_FLSIMULATE,
118 SB_FLNOCSCOPE,
119 SB_FLTAGSTYLE,
120 SB_FLORIGINAL,
121 SB_FLFNAMES,
122 SB_FLALL,
123 SB_FLPERL,
124 SB_FLTEST,
125 SB_FLRTREE,
126 SB_FLCTAGSAPPEND
130 #define SB_FLSET(arg) (sb_flags |= (1<<arg))
131 #define SB_FLGET(arg) (sb_flags & (1<<arg))
133 __EXTERN EArray * d_tags_file;
134 __EXTERN bool d_dbg_SDBG_active;
135 __EXTERN int t_op_no;
136 __EXTERN FILE *cscope_in, *cscope_out;
137 __EXTERN FILE *d_stream_dbg;
138 __EXTERN pid_t gvim_pid;
139 __EXTERN EArray * immune_list;
140 __EXTERN EArray * full_list;
141 __EXTERN int d_depth;
143 inline bool tree_immune (char * m_fname)
145 return immune_list->sfind (m_fname) == -1 ? false : true;
148 // Initial constants.
149 __EXTERN EArray * d_cops;
150 /***/
152 #endif