]>
Commit | Line | Data |
---|---|---|
c90f71dd RD |
1 | /******************************************************************************* |
2 | * Simplified Wrapper and Interface Generator (SWIG) | |
3 | * | |
4 | * Author : David Beazley | |
5 | * | |
6 | * Department of Computer Science | |
7 | * University of Chicago | |
8 | * 1100 E 58th Street | |
9 | * Chicago, IL 60637 | |
10 | * beazley@cs.uchicago.edu | |
11 | * | |
12 | * Please read the file LICENSE for the copyright and terms by which SWIG | |
13 | * can be used and distributed. | |
14 | *******************************************************************************/ | |
15 | ||
16 | /*********************************************************************** | |
17 | * $Header$ | |
18 | * | |
19 | * internals.h | |
20 | * | |
21 | * Contains global variables used in libswig, but which are otherwise | |
22 | * inaccessible to the user. | |
23 | * | |
24 | ***********************************************************************/ | |
25 | ||
26 | #include "swig.h" | |
27 | ||
28 | // ------------------------------------------------------------------- | |
29 | // class DocTitle : public DocEntry | |
30 | // | |
31 | // Top level class for managing documentation. Prints out a title, | |
32 | // date, etc... | |
33 | // ------------------------------------------------------------------- | |
34 | ||
35 | class DocTitle : public DocEntry { | |
36 | public: | |
37 | DocTitle(char *title, DocEntry *_parent); // Create a new title | |
38 | void output(Documentation *d); // Output documentation | |
39 | }; | |
40 | ||
41 | // -------------------------------------------------------------------- | |
42 | // class DocSection : public DocEntry | |
43 | // | |
44 | // Documentation entry for a section | |
45 | // -------------------------------------------------------------------- | |
46 | ||
47 | class DocSection : public DocEntry { | |
48 | public: | |
49 | DocSection(char *section, DocEntry *_parent); | |
50 | void output(Documentation *d); | |
51 | }; | |
52 | ||
53 | // -------------------------------------------------------------------- | |
54 | // class DocFunction : public DocEntry | |
55 | // | |
56 | // Documentation entry for generic sorts of declarations | |
57 | // -------------------------------------------------------------------- | |
58 | ||
59 | class DocDecl : public DocEntry { | |
60 | public: | |
61 | DocDecl(char *fname, DocEntry *_parent); | |
62 | DocDecl(DocEntry *de, DocEntry *_parent); | |
63 | void output(Documentation *d); | |
64 | }; | |
65 | ||
66 | // -------------------------------------------------------------------- | |
67 | // class DocClass : public DocEntry | |
68 | // | |
69 | // Documentation entry for a C++ class or C struct | |
70 | // -------------------------------------------------------------------- | |
71 | ||
72 | class DocClass : public DocEntry { | |
73 | public: | |
74 | DocClass(char *classname, DocEntry *_parent); | |
75 | void output(Documentation *d); | |
76 | }; | |
77 | ||
78 | // -------------------------------------------------------------------- | |
79 | // class DocText : public DocEntry | |
80 | // | |
81 | // Documentation entry for some plain ole text. Declared using | |
82 | // the %text %{,%} directive. | |
83 | // -------------------------------------------------------------------- | |
84 | ||
85 | class DocText : public DocEntry { | |
86 | public: | |
87 | DocText(char *_text, DocEntry *_parent); | |
88 | void output(Documentation *d); | |
89 | }; | |
90 | ||
91 | // -------------------------------------------------------------------- | |
92 | // class CommentHandler | |
93 | // | |
94 | // Class for managing comment processing. | |
95 | // -------------------------------------------------------------------- | |
96 | ||
97 | class CommentHandler { | |
98 | public: | |
99 | CommentHandler(); | |
100 | CommentHandler(CommentHandler *c); | |
101 | ~CommentHandler(); | |
102 | void add_comment(char *text, int line_num, int col, char *file); // Add a comment | |
103 | void set_entry(DocEntry *d); // Set documentation entry | |
104 | static void cleanup(); // Clean-up everything before quitting | |
105 | void style(char *name, char *value); | |
106 | void parse_args(int argc, char **argv); // Parse command line options | |
107 | ||
108 | // Comment handling style parameters | |
109 | int skip_lines; // # blank lines before comment is throw away | |
110 | int location; // Comment location (BEFORE or AFTER) | |
111 | int chop_top; // Lines to chop from the top of a comment | |
112 | int chop_bottom; // Lines to chop from the bottom | |
113 | int chop_left; // Characters to chop from left | |
114 | int chop_right; // Characters to chop from right | |
115 | int untabify; // Expand tabs | |
116 | int ignore; // Ignore comments | |
117 | }; | |
118 | ||
119 | #define BEFORE 0 | |
120 | #define AFTER 1 | |
121 | ||
122 | ||
123 | extern int include_file(char *); // Insert library file | |
124 | extern char category[256]; | |
125 | extern char title[256]; | |
126 | extern DocEntry *doc_entry; | |
127 | extern DocEntry *doctitle; // The very first docentry | |
128 | extern DocEntry *doc_stack[256]; // Stack of documentation entries | |
129 | extern CommentHandler *handler_stack[256]; // Stack of comment handlers | |
130 | extern int doc_stack_top; // Top of stack | |
131 | ||
132 | extern Language *lang; | |
133 | extern Documentation *doc; | |
134 | extern CommentHandler *comment_handler; // Comment handling system | |
135 | extern void swig_append(char *, FILE *); | |
136 | extern int Stat_func, Stat_var, Stat_const; | |
137 | extern int IgnoreDoc; | |
138 | extern int ForceExtern; | |
139 | extern int WrapExtern; | |
140 | extern String CCode; | |
141 | extern int GenerateDefault; | |
142 | extern int type_id; | |
143 | extern char *ConfigFile; | |
144 | extern char *objc_construct; | |
145 | extern char *objc_destruct; | |
146 | extern int DocOnly; | |
147 | ||
148 | // Structure for holding typemap parameters | |
149 | // A typemap parameter consists of a single parameter (type + name) | |
150 | // and an optional list of arguments corresponding to local variables. | |
151 | // Has an optional link for building linked lists of parameter lists | |
152 | ||
153 | struct TMParm { | |
154 | Parm *p; | |
155 | ParmList *args; | |
156 | TMParm *next; | |
157 | TMParm() { | |
158 | next = 0; | |
159 | } | |
160 | }; | |
161 | ||
162 | /* Global variables. Needs to be cleaned up */ | |
163 | ||
164 | #ifdef WRAP | |
165 | ||
166 | FILE *f_header; // Some commonly used | |
167 | FILE *f_wrappers; // FILE pointers | |
168 | FILE *f_init; | |
169 | FILE *f_input; | |
170 | char InitName[256]; | |
171 | char LibDir[512]; // Library directory | |
172 | char **InitNames = 0; | |
173 | int Status; | |
174 | int TypeStrict; // Type checking strictness | |
175 | int Verbose; | |
176 | char category[256]; // Variables for documentation | |
177 | char title[256]; | |
178 | DocEntry *doc_entry = 0; // Current documentation entry | |
179 | DocEntry *doctitle = 0; // First doc entry | |
180 | DocEntry *doc_stack[256]; // Stack of documentation entries | |
181 | CommentHandler *handler_stack[256]; // Stack of comment handlers | |
182 | int doc_stack_top = 0; // Top of stack | |
183 | ||
184 | Language *lang; // Language method | |
185 | Documentation *doc; // Documentation method | |
186 | int Stat_func = 0; | |
187 | int Stat_var = 0; | |
188 | int Stat_const = 0; | |
189 | int CPlusPlus = 0; | |
190 | int ObjC = 0; | |
191 | int ObjCClass = 0; | |
192 | int AddMethods = 0; // AddMethods flag | |
193 | int NewObject = 0; // NewObject flag | |
194 | int Inline = 0; // Inline mode | |
195 | int Stats = 0; | |
196 | int IgnoreDoc = 0; // Ignore documentation mode | |
197 | int ForceExtern = 0; // Force extern mode | |
198 | int WrapExtern = 0; | |
199 | int GenerateDefault = 0; // Generate default constructors | |
200 | char *Config = 0; | |
201 | int NoInclude = 0; | |
202 | char *typemap_lang = 0; // Typemap name | |
203 | int type_id = 0; // Type identifier | |
204 | int error_count = 0; // Error count | |
205 | char *ConfigFile = 0; | |
206 | int DocOnly = 0; // Only produce documentation | |
207 | ||
208 | #endif | |
209 | ||
210 | /* Number of initialization names that can be used */ | |
211 | ||
212 | #define NI_NAMES 512 | |
213 | ||
214 | extern void type_undefined_check(void); | |
215 |