Release 0.9.39.
[wine/gsoc-2012-control.git] / tools / widl / widltypes.h
blob6235620bf4918d9ceab942de79d03d21dfbfb4f5
1 /*
2 * IDL Compiler
4 * Copyright 2002 Ove Kaaven
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WIDL_WIDLTYPES_H
22 #define __WIDL_WIDLTYPES_H
24 #include <stdarg.h>
25 #include "guiddef.h"
26 #include "wine/rpcfc.h"
27 #include "wine/list.h"
29 #ifndef UUID_DEFINED
30 #define UUID_DEFINED
31 typedef GUID UUID;
32 #endif
34 #define TRUE 1
35 #define FALSE 0
37 typedef struct _attr_t attr_t;
38 typedef struct _expr_t expr_t;
39 typedef struct _type_t type_t;
40 typedef struct _typeref_t typeref_t;
41 typedef struct _var_t var_t;
42 typedef struct _pident_t pident_t;
43 typedef struct _func_t func_t;
44 typedef struct _ifref_t ifref_t;
45 typedef struct _typelib_entry_t typelib_entry_t;
46 typedef struct _importlib_t importlib_t;
47 typedef struct _importinfo_t importinfo_t;
48 typedef struct _typelib_t typelib_t;
49 typedef struct _user_type_t user_type_t;
51 typedef struct list attr_list_t;
52 typedef struct list str_list_t;
53 typedef struct list func_list_t;
54 typedef struct list expr_list_t;
55 typedef struct list var_list_t;
56 typedef struct list pident_list_t;
57 typedef struct list ifref_list_t;
58 typedef struct list array_dims_t;
59 typedef struct list user_type_list_t;
61 enum attr_type
63 ATTR_AGGREGATABLE,
64 ATTR_APPOBJECT,
65 ATTR_ASYNC,
66 ATTR_AUTO_HANDLE,
67 ATTR_BINDABLE,
68 ATTR_CALLAS,
69 ATTR_CASE,
70 ATTR_CONTEXTHANDLE,
71 ATTR_CONTROL,
72 ATTR_DEFAULT,
73 ATTR_DEFAULTCOLLELEM,
74 ATTR_DEFAULTVALUE_EXPR,
75 ATTR_DEFAULTVALUE_STRING,
76 ATTR_DEFAULTVTABLE,
77 ATTR_DISPINTERFACE,
78 ATTR_DISPLAYBIND,
79 ATTR_DLLNAME,
80 ATTR_DUAL,
81 ATTR_ENDPOINT,
82 ATTR_ENTRY_ORDINAL,
83 ATTR_ENTRY_STRING,
84 ATTR_EXPLICIT_HANDLE,
85 ATTR_HANDLE,
86 ATTR_HELPCONTEXT,
87 ATTR_HELPFILE,
88 ATTR_HELPSTRING,
89 ATTR_HELPSTRINGCONTEXT,
90 ATTR_HELPSTRINGDLL,
91 ATTR_HIDDEN,
92 ATTR_ID,
93 ATTR_IDEMPOTENT,
94 ATTR_IIDIS,
95 ATTR_IMMEDIATEBIND,
96 ATTR_IMPLICIT_HANDLE,
97 ATTR_IN,
98 ATTR_INPUTSYNC,
99 ATTR_LENGTHIS,
100 ATTR_LOCAL,
101 ATTR_NONBROWSABLE,
102 ATTR_NONCREATABLE,
103 ATTR_NONEXTENSIBLE,
104 ATTR_OBJECT,
105 ATTR_ODL,
106 ATTR_OLEAUTOMATION,
107 ATTR_OPTIONAL,
108 ATTR_OUT,
109 ATTR_POINTERDEFAULT,
110 ATTR_POINTERTYPE,
111 ATTR_PROPGET,
112 ATTR_PROPPUT,
113 ATTR_PROPPUTREF,
114 ATTR_PUBLIC,
115 ATTR_RANGE,
116 ATTR_READONLY,
117 ATTR_REQUESTEDIT,
118 ATTR_RESTRICTED,
119 ATTR_RETVAL,
120 ATTR_SIZEIS,
121 ATTR_SOURCE,
122 ATTR_STRING,
123 ATTR_SWITCHIS,
124 ATTR_SWITCHTYPE,
125 ATTR_TRANSMITAS,
126 ATTR_UUID,
127 ATTR_V1ENUM,
128 ATTR_VARARG,
129 ATTR_VERSION,
130 ATTR_WIREMARSHAL
133 enum expr_type
135 EXPR_VOID,
136 EXPR_NUM,
137 EXPR_HEXNUM,
138 EXPR_IDENTIFIER,
139 EXPR_NEG,
140 EXPR_NOT,
141 EXPR_PPTR,
142 EXPR_CAST,
143 EXPR_SIZEOF,
144 EXPR_SHL,
145 EXPR_SHR,
146 EXPR_MUL,
147 EXPR_DIV,
148 EXPR_ADD,
149 EXPR_SUB,
150 EXPR_AND,
151 EXPR_OR,
152 EXPR_COND,
153 EXPR_TRUEFALSE,
156 enum type_kind
158 TKIND_PRIMITIVE = -1,
159 TKIND_ENUM,
160 TKIND_RECORD,
161 TKIND_MODULE,
162 TKIND_INTERFACE,
163 TKIND_DISPATCH,
164 TKIND_COCLASS,
165 TKIND_ALIAS,
166 TKIND_UNION,
167 TKIND_MAX
170 struct str_list_entry_t
172 char *str;
173 struct list entry;
176 struct _attr_t {
177 enum attr_type type;
178 union {
179 unsigned long ival;
180 void *pval;
181 } u;
182 /* parser-internal */
183 struct list entry;
186 struct _expr_t {
187 enum expr_type type;
188 const expr_t *ref;
189 union {
190 long lval;
191 const char *sval;
192 const expr_t *ext;
193 type_t *tref;
194 } u;
195 const expr_t *ext2;
196 int is_const;
197 long cval;
198 /* parser-internal */
199 struct list entry;
202 struct _type_t {
203 const char *name;
204 enum type_kind kind;
205 unsigned char type;
206 struct _type_t *ref;
207 const attr_list_t *attrs;
208 func_list_t *funcs; /* interfaces and modules */
209 var_list_t *fields; /* interfaces, structures and enumerations */
210 ifref_list_t *ifaces; /* coclasses */
211 unsigned long dim; /* array dimension */
212 expr_t *size_is, *length_is;
213 type_t *orig; /* dup'd types */
214 unsigned int typestring_offset;
215 int typelib_idx;
216 unsigned int declarray : 1; /* if declared as an array */
217 unsigned int ignore : 1;
218 unsigned int is_const : 1;
219 unsigned int defined : 1;
220 unsigned int written : 1;
221 unsigned int user_types_registered : 1;
222 unsigned int tfswrite : 1; /* if the type needs to be written to the TFS */
223 int sign : 2;
226 struct _var_t {
227 char *name;
228 type_t *type;
229 var_list_t *args; /* for function pointers */
230 attr_list_t *attrs;
231 expr_t *eval;
233 /* parser-internal */
234 struct list entry;
237 struct _pident_t {
238 var_t *var;
239 int ptr_level;
241 /* parser-internal */
242 struct list entry;
245 struct _func_t {
246 var_t *def;
247 var_list_t *args;
248 int ignore, idx;
250 /* parser-internal */
251 struct list entry;
254 struct _ifref_t {
255 type_t *iface;
256 attr_list_t *attrs;
258 /* parser-internal */
259 struct list entry;
262 struct _typelib_entry_t {
263 type_t *type;
264 struct list entry;
267 struct _importinfo_t {
268 int offset;
269 GUID guid;
270 int flags;
271 int id;
273 char *name;
275 importlib_t *importlib;
278 struct _importlib_t {
279 char *name;
281 int version;
282 GUID guid;
284 importinfo_t *importinfos;
285 int ntypeinfos;
287 int allocated;
289 struct list entry;
292 struct _typelib_t {
293 char *name;
294 char *filename;
295 attr_list_t *attrs;
296 struct list entries;
297 struct list importlibs;
300 struct _user_type_t {
301 struct list entry;
302 const char *name;
305 extern user_type_list_t user_type_list;
306 void check_for_user_types(const var_list_t *list);
308 void init_types(void);
310 type_t *duptype(type_t *t, int dupname);
311 type_t *alias(type_t *t, const char *name);
313 int is_ptr(const type_t *t);
314 int is_array(const type_t *t);
315 int is_var_ptr(const var_t *v);
316 int cant_be_null(const var_t *v);
317 int is_struct(unsigned char tc);
318 int is_union(unsigned char tc);
320 #endif