widl: Add support for the broadcast and idempotent operation attributes.
[wine/multimedia.git] / tools / widl / widltypes.h
blobd046447412ba4f0fc644e4d746b4658ed5860f36
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 #define RPC_FC_FUNCTION 0xfe
39 typedef struct _attr_t attr_t;
40 typedef struct _expr_t expr_t;
41 typedef struct _type_t type_t;
42 typedef struct _typeref_t typeref_t;
43 typedef struct _var_t var_t;
44 typedef struct _pident_t pident_t;
45 typedef struct _func_t func_t;
46 typedef struct _ifref_t ifref_t;
47 typedef struct _typelib_entry_t typelib_entry_t;
48 typedef struct _importlib_t importlib_t;
49 typedef struct _importinfo_t importinfo_t;
50 typedef struct _typelib_t typelib_t;
51 typedef struct _user_type_t user_type_t;
52 typedef struct _user_type_t context_handle_t;
54 typedef struct list attr_list_t;
55 typedef struct list str_list_t;
56 typedef struct list func_list_t;
57 typedef struct list expr_list_t;
58 typedef struct list var_list_t;
59 typedef struct list pident_list_t;
60 typedef struct list ifref_list_t;
61 typedef struct list array_dims_t;
62 typedef struct list user_type_list_t;
63 typedef struct list context_handle_list_t;
65 enum attr_type
67 ATTR_AGGREGATABLE,
68 ATTR_APPOBJECT,
69 ATTR_ASYNC,
70 ATTR_AUTO_HANDLE,
71 ATTR_BINDABLE,
72 ATTR_BROADCAST,
73 ATTR_CALLAS,
74 ATTR_CALLCONV, /* calling convention pseudo-attribute */
75 ATTR_CASE,
76 ATTR_CONTEXTHANDLE,
77 ATTR_CONTROL,
78 ATTR_DEFAULT,
79 ATTR_DEFAULTCOLLELEM,
80 ATTR_DEFAULTVALUE_EXPR,
81 ATTR_DEFAULTVALUE_STRING,
82 ATTR_DEFAULTVTABLE,
83 ATTR_DISPINTERFACE,
84 ATTR_DISPLAYBIND,
85 ATTR_DLLNAME,
86 ATTR_DUAL,
87 ATTR_ENDPOINT,
88 ATTR_ENTRY_ORDINAL,
89 ATTR_ENTRY_STRING,
90 ATTR_EXPLICIT_HANDLE,
91 ATTR_HANDLE,
92 ATTR_HELPCONTEXT,
93 ATTR_HELPFILE,
94 ATTR_HELPSTRING,
95 ATTR_HELPSTRINGCONTEXT,
96 ATTR_HELPSTRINGDLL,
97 ATTR_HIDDEN,
98 ATTR_ID,
99 ATTR_IDEMPOTENT,
100 ATTR_IIDIS,
101 ATTR_IMMEDIATEBIND,
102 ATTR_IMPLICIT_HANDLE,
103 ATTR_IN,
104 ATTR_INPUTSYNC,
105 ATTR_LENGTHIS,
106 ATTR_LOCAL,
107 ATTR_NONBROWSABLE,
108 ATTR_NONCREATABLE,
109 ATTR_NONEXTENSIBLE,
110 ATTR_OBJECT,
111 ATTR_ODL,
112 ATTR_OLEAUTOMATION,
113 ATTR_OPTIONAL,
114 ATTR_OUT,
115 ATTR_POINTERDEFAULT,
116 ATTR_POINTERTYPE,
117 ATTR_PROPGET,
118 ATTR_PROPPUT,
119 ATTR_PROPPUTREF,
120 ATTR_PUBLIC,
121 ATTR_RANGE,
122 ATTR_READONLY,
123 ATTR_REQUESTEDIT,
124 ATTR_RESTRICTED,
125 ATTR_RETVAL,
126 ATTR_SIZEIS,
127 ATTR_SOURCE,
128 ATTR_STRICTCONTEXTHANDLE,
129 ATTR_STRING,
130 ATTR_SWITCHIS,
131 ATTR_SWITCHTYPE,
132 ATTR_TRANSMITAS,
133 ATTR_UUID,
134 ATTR_V1ENUM,
135 ATTR_VARARG,
136 ATTR_VERSION,
137 ATTR_WIREMARSHAL
140 enum expr_type
142 EXPR_VOID,
143 EXPR_NUM,
144 EXPR_HEXNUM,
145 EXPR_DOUBLE,
146 EXPR_IDENTIFIER,
147 EXPR_NEG,
148 EXPR_NOT,
149 EXPR_PPTR,
150 EXPR_CAST,
151 EXPR_SIZEOF,
152 EXPR_SHL,
153 EXPR_SHR,
154 EXPR_MUL,
155 EXPR_DIV,
156 EXPR_ADD,
157 EXPR_SUB,
158 EXPR_AND,
159 EXPR_OR,
160 EXPR_COND,
161 EXPR_TRUEFALSE,
162 EXPR_ADDRESSOF,
165 enum type_kind
167 TKIND_PRIMITIVE = -1,
168 TKIND_ENUM,
169 TKIND_RECORD,
170 TKIND_MODULE,
171 TKIND_INTERFACE,
172 TKIND_DISPATCH,
173 TKIND_COCLASS,
174 TKIND_ALIAS,
175 TKIND_UNION,
176 TKIND_MAX
179 struct str_list_entry_t
181 char *str;
182 struct list entry;
185 struct _attr_t {
186 enum attr_type type;
187 union {
188 unsigned long ival;
189 void *pval;
190 } u;
191 /* parser-internal */
192 struct list entry;
195 struct _expr_t {
196 enum expr_type type;
197 const expr_t *ref;
198 union {
199 long lval;
200 double dval;
201 const char *sval;
202 const expr_t *ext;
203 type_t *tref;
204 } u;
205 const expr_t *ext2;
206 int is_const;
207 long cval;
208 /* parser-internal */
209 struct list entry;
212 struct _type_t {
213 const char *name;
214 enum type_kind kind;
215 unsigned char type;
216 struct _type_t *ref;
217 const attr_list_t *attrs;
218 func_list_t *funcs; /* interfaces and modules */
219 var_list_t *fields_or_args; /* interfaces, structures, enumerations and functions (for args) */
220 ifref_list_t *ifaces; /* coclasses */
221 unsigned long dim; /* array dimension */
222 expr_t *size_is, *length_is;
223 type_t *orig; /* dup'd types */
224 unsigned int typestring_offset;
225 unsigned int ptrdesc; /* used for complex structs */
226 int typelib_idx;
227 unsigned int declarray : 1; /* if declared as an array */
228 unsigned int ignore : 1;
229 unsigned int is_const : 1;
230 unsigned int defined : 1;
231 unsigned int written : 1;
232 unsigned int user_types_registered : 1;
233 unsigned int tfswrite : 1; /* if the type needs to be written to the TFS */
234 int sign : 2;
237 struct _var_t {
238 char *name;
239 type_t *type;
240 attr_list_t *attrs;
241 expr_t *eval;
243 /* parser-internal */
244 struct list entry;
247 struct _pident_t {
248 var_t *var;
249 int ptr_level;
251 int is_func;
252 /* levels of indirection for function pointers */
253 int func_ptr_level;
254 var_list_t *args;
255 char *callconv;
257 /* parser-internal */
258 struct list entry;
261 struct _func_t {
262 var_t *def;
263 var_list_t *args;
264 int ignore, idx;
266 /* parser-internal */
267 struct list entry;
270 struct _ifref_t {
271 type_t *iface;
272 attr_list_t *attrs;
274 /* parser-internal */
275 struct list entry;
278 struct _typelib_entry_t {
279 type_t *type;
280 struct list entry;
283 struct _importinfo_t {
284 int offset;
285 GUID guid;
286 int flags;
287 int id;
289 char *name;
291 importlib_t *importlib;
294 struct _importlib_t {
295 char *name;
297 int version;
298 GUID guid;
300 importinfo_t *importinfos;
301 int ntypeinfos;
303 int allocated;
305 struct list entry;
308 struct _typelib_t {
309 char *name;
310 char *filename;
311 const attr_list_t *attrs;
312 struct list entries;
313 struct list importlibs;
316 struct _user_type_t {
317 struct list entry;
318 const char *name;
321 extern unsigned char pointer_default;
323 extern user_type_list_t user_type_list;
324 void check_for_additional_prototype_types(const var_list_t *list);
326 void init_types(void);
327 type_t *alloc_type(void);
328 void set_all_tfswrite(int val);
330 type_t *duptype(type_t *t, int dupname);
331 type_t *alias(type_t *t, const char *name);
333 int is_ptr(const type_t *t);
334 int is_array(const type_t *t);
335 int is_var_ptr(const var_t *v);
336 int cant_be_null(const var_t *v);
337 int is_struct(unsigned char tc);
338 int is_union(unsigned char tc);
340 static inline type_t *get_func_return_type(const func_t *func)
342 return func->def->type->ref;
345 #endif