winuser.h: Add some missing virtual key symbols.
[wine] / tools / widl / widltypes.h
1 /*
2  * IDL Compiler
3  *
4  * Copyright 2002 Ove Kaaven
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #ifndef __WIDL_WIDLTYPES_H
22 #define __WIDL_WIDLTYPES_H
23
24 #include <stdarg.h>
25 #include "guiddef.h"
26 #include "wine/rpcfc.h"
27
28 #ifndef UUID_DEFINED
29 #define UUID_DEFINED
30 typedef GUID UUID;
31 #endif
32
33 #define TRUE 1
34 #define FALSE 0
35
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;
48
49 #define DECL_LINK(type) \
50   type *l_next; \
51   type *l_prev;
52
53 #define LINK(x,y) do { x->l_next = y; if (y) y->l_prev = x; } while (0)
54
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)
58
59 #define END_OF_LIST(list)       \
60   do {                          \
61     if (list) {                 \
62       while (NEXT_LINK(list))   \
63         list = NEXT_LINK(list); \
64     }                           \
65   } while(0)
66
67 enum attr_type
68 {
69     ATTR_AGGREGATABLE,
70     ATTR_APPOBJECT,
71     ATTR_ASYNC,
72     ATTR_AUTO_HANDLE,
73     ATTR_BINDABLE,
74     ATTR_CALLAS,
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_STRING,
129     ATTR_SWITCHIS,
130     ATTR_SWITCHTYPE,
131     ATTR_TRANSMITAS,
132     ATTR_UUID,
133     ATTR_V1ENUM,
134     ATTR_VARARG,
135     ATTR_VERSION,
136     ATTR_WIREMARSHAL
137 };
138
139 enum expr_type
140 {
141     EXPR_VOID,
142     EXPR_NUM,
143     EXPR_HEXNUM,
144     EXPR_IDENTIFIER,
145     EXPR_NEG,
146     EXPR_NOT,
147     EXPR_PPTR,
148     EXPR_CAST,
149     EXPR_SIZEOF,
150     EXPR_SHL,
151     EXPR_SHR,
152     EXPR_MUL,
153     EXPR_DIV,
154     EXPR_ADD,
155     EXPR_SUB,
156     EXPR_AND,
157     EXPR_OR,
158     EXPR_COND,
159 };
160
161 enum type_kind
162 {
163     TKIND_ENUM = 0,
164     TKIND_RECORD,
165     TKIND_MODULE,
166     TKIND_INTERFACE,
167     TKIND_DISPATCH,
168     TKIND_COCLASS,
169     TKIND_ALIAS,
170     TKIND_UNION,
171     TKIND_MAX
172 };
173    
174 struct _attr_t {
175   enum attr_type type;
176   union {
177     unsigned long ival;
178     void *pval;
179   } u;
180   /* parser-internal */
181   DECL_LINK(attr_t)
182 };
183
184 struct _expr_t {
185   enum expr_type type;
186   const expr_t *ref;
187   union {
188     long lval;
189     const char *sval;
190     const expr_t *ext;
191     const typeref_t *tref;
192   } u;
193   const expr_t *ext2;
194   int is_const;
195   long cval;
196   /* parser-internal */
197   DECL_LINK(expr_t)
198 };
199
200 struct _type_t {
201   char *name;
202   unsigned char type;
203   struct _type_t *ref;
204   const attr_t *attrs;
205   func_t *funcs;
206   var_t *fields;
207   int ignore, is_const, sign;
208   int defined, written, user_types_registered;
209   int typelib_idx;
210   /* parser-internal */
211   DECL_LINK(type_t)
212 };
213
214 struct _typeref_t {
215   char *name;
216   type_t *ref;
217   int uniq;
218 };
219
220 struct _var_t {
221   char *name;
222   int ptr_level;
223   expr_t *array;
224   type_t *type;
225   var_t *args;  /* for function pointers */
226   const char *tname;
227   attr_t *attrs;
228   expr_t *eval;
229
230   /* parser-internal */
231   DECL_LINK(var_t)
232 };
233
234 struct _func_t {
235   var_t *def;
236   var_t *args;
237   int ignore, idx;
238
239   /* parser-internal */
240   DECL_LINK(func_t)
241 };
242
243 struct _ifref_t {
244   type_t *iface;
245   attr_t *attrs;
246
247   /* parser-internal */
248   DECL_LINK(ifref_t)
249 };
250
251 struct _class_t {
252   char *name;
253   attr_t *attrs;
254   ifref_t *ifaces;
255
256   /* parser-internal */
257   DECL_LINK(class_t)
258 };
259
260 struct _typelib_entry_t {
261     enum type_kind kind;
262     union {
263         class_t *class;
264         type_t *interface;
265         type_t *module;
266         type_t *structure;
267         type_t *enumeration;
268         var_t *tdef;
269     } u;
270     DECL_LINK(typelib_entry_t)
271 };
272
273 struct _importinfo_t {
274     int offset;
275     GUID guid;
276     int flags;
277     int id;
278
279     char *name;
280
281     importlib_t *importlib;
282 };
283
284 struct _importlib_t {
285     char *name;
286
287     int version;
288     GUID guid;
289
290     importinfo_t *importinfos;
291     int ntypeinfos;
292
293     int allocated;
294
295     DECL_LINK(importlib_t);
296 };
297
298 struct _typelib_t {
299     char *name;
300     char *filename;
301     attr_t *attrs;
302     typelib_entry_t *entry;
303     importlib_t *importlibs;
304 };
305
306 #endif