server: Don't round up the header size for image mappings.
[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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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 _typelib_t typelib_t;
46
47 #define DECL_LINK(type) \
48   type *l_next; \
49   type *l_prev;
50
51 #define LINK(x,y) do { x->l_next = y; if (y) y->l_prev = x; } while (0)
52
53 #define INIT_LINK(x) do { x->l_next = NULL; x->l_prev = NULL; } while (0)
54 #define NEXT_LINK(x) ((x)->l_next)
55 #define PREV_LINK(x) ((x)->l_prev)
56
57 enum attr_type
58 {
59     ATTR_ASYNC,
60     ATTR_AUTO_HANDLE,
61     ATTR_BINDABLE,
62     ATTR_CALLAS,
63     ATTR_CASE,
64     ATTR_CONTEXTHANDLE,
65     ATTR_CONTROL,
66     ATTR_DEFAULT,
67     ATTR_DEFAULTVALUE_EXPR,
68     ATTR_DEFAULTVALUE_STRING,
69     ATTR_DISPINTERFACE,
70     ATTR_DISPLAYBIND,
71     ATTR_DLLNAME,
72     ATTR_DUAL,
73     ATTR_ENDPOINT,
74     ATTR_ENTRY_ORDINAL,
75     ATTR_ENTRY_STRING,
76     ATTR_EXPLICIT_HANDLE,
77     ATTR_HANDLE,
78     ATTR_HELPCONTEXT,
79     ATTR_HELPFILE,
80     ATTR_HELPSTRING,
81     ATTR_HELPSTRINGCONTEXT,
82     ATTR_HELPSTRINGDLL,
83     ATTR_HIDDEN,
84     ATTR_ID,
85     ATTR_IDEMPOTENT,
86     ATTR_IIDIS,
87     ATTR_IMPLICIT_HANDLE,
88     ATTR_IN,
89     ATTR_INPUTSYNC,
90     ATTR_LENGTHIS,
91     ATTR_LOCAL,
92     ATTR_NONCREATABLE,
93     ATTR_OBJECT,
94     ATTR_ODL,
95     ATTR_OLEAUTOMATION,
96     ATTR_OPTIONAL,
97     ATTR_OUT,
98     ATTR_POINTERDEFAULT,
99     ATTR_POINTERTYPE,
100     ATTR_PROPGET,
101     ATTR_PROPPUT,
102     ATTR_PROPPUTREF,
103     ATTR_PUBLIC,
104     ATTR_RANGE,
105     ATTR_READONLY,
106     ATTR_RESTRICTED,
107     ATTR_RETVAL,
108     ATTR_SIZEIS,
109     ATTR_SOURCE,
110     ATTR_STRING,
111     ATTR_SWITCHIS,
112     ATTR_SWITCHTYPE,
113     ATTR_TRANSMITAS,
114     ATTR_UUID,
115     ATTR_V1ENUM,
116     ATTR_VARARG,
117     ATTR_VERSION,
118     ATTR_WIREMARSHAL
119 };
120
121 enum expr_type
122 {
123     EXPR_VOID,
124     EXPR_NUM,
125     EXPR_HEXNUM,
126     EXPR_IDENTIFIER,
127     EXPR_NEG,
128     EXPR_NOT,
129     EXPR_PPTR,
130     EXPR_CAST,
131     EXPR_SIZEOF,
132     EXPR_SHL,
133     EXPR_SHR,
134     EXPR_MUL,
135     EXPR_DIV,
136     EXPR_ADD,
137     EXPR_SUB,
138     EXPR_AND,
139     EXPR_OR,
140     EXPR_COND,
141 };
142
143 enum type_kind
144 {
145     TKIND_ENUM = 0,
146     TKIND_RECORD,
147     TKIND_MODULE,
148     TKIND_INTERFACE,
149     TKIND_DISPATCH,
150     TKIND_COCLASS,
151     TKIND_ALIAS,
152     TKIND_UNION,
153     TKIND_MAX
154 };
155    
156 struct _attr_t {
157   enum attr_type type;
158   union {
159     unsigned long ival;
160     void *pval;
161   } u;
162   /* parser-internal */
163   DECL_LINK(attr_t)
164 };
165
166 struct _expr_t {
167   enum expr_type type;
168   expr_t *ref;
169   union {
170     long lval;
171     char *sval;
172     expr_t *ext;
173     typeref_t *tref;
174   } u;
175   expr_t *ext2;
176   int is_const;
177   long cval;
178   /* parser-internal */
179   DECL_LINK(expr_t)
180 };
181
182 struct _type_t {
183   char *name;
184   unsigned char type;
185   struct _type_t *ref;
186   char *rname;
187   attr_t *attrs;
188   func_t *funcs;
189   var_t *fields;
190   int ignore, is_const, sign;
191   int defined, written, user_types_registered;
192   int typelib_idx;
193   /* parser-internal */
194   DECL_LINK(type_t)
195 };
196
197 struct _typeref_t {
198   char *name;
199   type_t *ref;
200   int uniq;
201 };
202
203 struct _var_t {
204   char *name;
205   int ptr_level;
206   expr_t *array;
207   type_t *type;
208   var_t *args;  /* for function pointers */
209   char *tname;
210   attr_t *attrs;
211   expr_t *eval;
212   long lval;
213
214   /* parser-internal */
215   DECL_LINK(var_t)
216 };
217
218 struct _func_t {
219   var_t *def;
220   var_t *args;
221   int ignore, idx;
222
223   /* parser-internal */
224   DECL_LINK(func_t)
225 };
226
227 struct _ifref_t {
228   type_t *iface;
229   attr_t *attrs;
230
231   /* parser-internal */
232   DECL_LINK(ifref_t)
233 };
234
235 struct _class_t {
236   char *name;
237   attr_t *attrs;
238   ifref_t *ifaces;
239
240   /* parser-internal */
241   DECL_LINK(class_t)
242 };
243
244 struct _typelib_entry_t {
245     enum type_kind kind;
246     union {
247         class_t *class;
248         type_t *interface;
249         type_t *module;
250         type_t *structure;
251         type_t *enumeration;
252         var_t *tdef;
253     } u;
254     DECL_LINK(typelib_entry_t)
255 };
256
257 struct _typelib_t {
258     char *name;
259     char *filename;
260     attr_t *attrs;
261     typelib_entry_t *entry;
262 };
263
264 #endif