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