Release 0.9.14.
[wine/multimedia.git] / tools / widl / widltypes.h
blob64b45e0229dc41aa946263321cdc667a93e32a48
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"
28 #ifndef UUID_DEFINED
29 #define UUID_DEFINED
30 typedef GUID UUID;
31 #endif
33 #define TRUE 1
34 #define FALSE 0
36 typedef struct _attr_t attr_t;
37 typedef struct _expr_t expr_t;
38 typedef struct _type_t type_t;
39 typedef struct _typeref_t typeref_t;
40 typedef struct _var_t var_t;
41 typedef struct _func_t func_t;
42 typedef struct _ifref_t ifref_t;
43 typedef struct _class_t class_t;
44 typedef struct _typelib_entry_t typelib_entry_t;
45 typedef struct _importlib_t importlib_t;
46 typedef struct _importinfo_t importinfo_t;
47 typedef struct _typelib_t typelib_t;
49 #define DECL_LINK(type) \
50 type *l_next; \
51 type *l_prev;
53 #define LINK(x,y) do { x->l_next = y; if (y) y->l_prev = x; } while (0)
55 #define INIT_LINK(x) do { x->l_next = NULL; x->l_prev = NULL; } while (0)
56 #define NEXT_LINK(x) ((x)->l_next)
57 #define PREV_LINK(x) ((x)->l_prev)
59 enum attr_type
61 ATTR_AGGREGATABLE,
62 ATTR_APPOBJECT,
63 ATTR_ASYNC,
64 ATTR_AUTO_HANDLE,
65 ATTR_BINDABLE,
66 ATTR_CALLAS,
67 ATTR_CASE,
68 ATTR_CONTEXTHANDLE,
69 ATTR_CONTROL,
70 ATTR_DEFAULT,
71 ATTR_DEFAULTCOLLELEM,
72 ATTR_DEFAULTVALUE_EXPR,
73 ATTR_DEFAULTVALUE_STRING,
74 ATTR_DEFAULTVTABLE,
75 ATTR_DISPINTERFACE,
76 ATTR_DISPLAYBIND,
77 ATTR_DLLNAME,
78 ATTR_DUAL,
79 ATTR_ENDPOINT,
80 ATTR_ENTRY_ORDINAL,
81 ATTR_ENTRY_STRING,
82 ATTR_EXPLICIT_HANDLE,
83 ATTR_HANDLE,
84 ATTR_HELPCONTEXT,
85 ATTR_HELPFILE,
86 ATTR_HELPSTRING,
87 ATTR_HELPSTRINGCONTEXT,
88 ATTR_HELPSTRINGDLL,
89 ATTR_HIDDEN,
90 ATTR_ID,
91 ATTR_IDEMPOTENT,
92 ATTR_IIDIS,
93 ATTR_IMMEDIATEBIND,
94 ATTR_IMPLICIT_HANDLE,
95 ATTR_IN,
96 ATTR_INPUTSYNC,
97 ATTR_LENGTHIS,
98 ATTR_LOCAL,
99 ATTR_NONBROWSABLE,
100 ATTR_NONCREATABLE,
101 ATTR_NONEXTENSIBLE,
102 ATTR_OBJECT,
103 ATTR_ODL,
104 ATTR_OLEAUTOMATION,
105 ATTR_OPTIONAL,
106 ATTR_OUT,
107 ATTR_POINTERDEFAULT,
108 ATTR_POINTERTYPE,
109 ATTR_PROPGET,
110 ATTR_PROPPUT,
111 ATTR_PROPPUTREF,
112 ATTR_PUBLIC,
113 ATTR_RANGE,
114 ATTR_READONLY,
115 ATTR_REQUESTEDIT,
116 ATTR_RESTRICTED,
117 ATTR_RETVAL,
118 ATTR_SIZEIS,
119 ATTR_SOURCE,
120 ATTR_STRING,
121 ATTR_SWITCHIS,
122 ATTR_SWITCHTYPE,
123 ATTR_TRANSMITAS,
124 ATTR_UUID,
125 ATTR_V1ENUM,
126 ATTR_VARARG,
127 ATTR_VERSION,
128 ATTR_WIREMARSHAL
131 enum expr_type
133 EXPR_VOID,
134 EXPR_NUM,
135 EXPR_HEXNUM,
136 EXPR_IDENTIFIER,
137 EXPR_NEG,
138 EXPR_NOT,
139 EXPR_PPTR,
140 EXPR_CAST,
141 EXPR_SIZEOF,
142 EXPR_SHL,
143 EXPR_SHR,
144 EXPR_MUL,
145 EXPR_DIV,
146 EXPR_ADD,
147 EXPR_SUB,
148 EXPR_AND,
149 EXPR_OR,
150 EXPR_COND,
153 enum type_kind
155 TKIND_ENUM = 0,
156 TKIND_RECORD,
157 TKIND_MODULE,
158 TKIND_INTERFACE,
159 TKIND_DISPATCH,
160 TKIND_COCLASS,
161 TKIND_ALIAS,
162 TKIND_UNION,
163 TKIND_MAX
166 struct _attr_t {
167 enum attr_type type;
168 union {
169 unsigned long ival;
170 void *pval;
171 } u;
172 /* parser-internal */
173 DECL_LINK(attr_t)
176 struct _expr_t {
177 enum expr_type type;
178 const expr_t *ref;
179 union {
180 long lval;
181 const char *sval;
182 const expr_t *ext;
183 const typeref_t *tref;
184 } u;
185 const expr_t *ext2;
186 int is_const;
187 long cval;
188 /* parser-internal */
189 DECL_LINK(expr_t)
192 struct _type_t {
193 char *name;
194 unsigned char type;
195 struct _type_t *ref;
196 const attr_t *attrs;
197 func_t *funcs;
198 var_t *fields;
199 int ignore, is_const, sign;
200 int defined, written, user_types_registered;
201 int typelib_idx;
202 /* parser-internal */
203 DECL_LINK(type_t)
206 struct _typeref_t {
207 char *name;
208 type_t *ref;
209 int uniq;
212 struct _var_t {
213 char *name;
214 int ptr_level;
215 expr_t *array;
216 type_t *type;
217 var_t *args; /* for function pointers */
218 const char *tname;
219 attr_t *attrs;
220 expr_t *eval;
222 /* parser-internal */
223 DECL_LINK(var_t)
226 struct _func_t {
227 var_t *def;
228 var_t *args;
229 int ignore, idx;
231 /* parser-internal */
232 DECL_LINK(func_t)
235 struct _ifref_t {
236 type_t *iface;
237 attr_t *attrs;
239 /* parser-internal */
240 DECL_LINK(ifref_t)
243 struct _class_t {
244 char *name;
245 attr_t *attrs;
246 ifref_t *ifaces;
248 /* parser-internal */
249 DECL_LINK(class_t)
252 struct _typelib_entry_t {
253 enum type_kind kind;
254 union {
255 class_t *class;
256 type_t *interface;
257 type_t *module;
258 type_t *structure;
259 type_t *enumeration;
260 var_t *tdef;
261 } u;
262 DECL_LINK(typelib_entry_t)
265 struct _importinfo_t {
266 int offset;
267 GUID guid;
268 int flags;
269 int id;
271 char *name;
273 importlib_t *importlib;
276 struct _importlib_t {
277 char *name;
279 int version;
280 GUID guid;
282 importinfo_t *importinfos;
283 int ntypeinfos;
285 int allocated;
287 DECL_LINK(importlib_t);
290 struct _typelib_t {
291 char *name;
292 char *filename;
293 attr_t *attrs;
294 typelib_entry_t *entry;
295 importlib_t *importlibs;
298 #endif