Store interfaces, structs, coclasses and modules that are to be
[wine/wine64.git] / tools / widl / widltypes.h
blob4918b4e6784f53d06e030ec0c2b87df440a59276
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 #define LOWORD(l) ((unsigned short)(l))
37 #define HIWORD(l) ((unsigned short)((unsigned long)(l) >> 16))
38 #define MAKELONG(low,high) ((unsigned long)(((unsigned short)(low)) | (((unsigned long)((unsigned short)(high))) << 16)))
40 typedef struct _attr_t attr_t;
41 typedef struct _expr_t expr_t;
42 typedef struct _type_t type_t;
43 typedef struct _typeref_t typeref_t;
44 typedef struct _var_t var_t;
45 typedef struct _func_t func_t;
46 typedef struct _ifref_t ifref_t;
47 typedef struct _class_t class_t;
48 typedef struct _typelib_entry_t typelib_entry_t;
49 typedef struct _typelib_t typelib_t;
51 #define DECL_LINK(type) \
52 type *l_next; \
53 type *l_prev;
55 #define LINK(x,y) do { x->l_next = y; if (y) y->l_prev = x; } while (0)
57 #define INIT_LINK(x) do { x->l_next = NULL; x->l_prev = NULL; } while (0)
58 #define NEXT_LINK(x) ((x)->l_next)
59 #define PREV_LINK(x) ((x)->l_prev)
61 enum attr_type
63 ATTR_ASYNC,
64 ATTR_CALLAS,
65 ATTR_CASE,
66 ATTR_CONTEXTHANDLE,
67 ATTR_DEFAULT,
68 ATTR_DEFAULTVALUE,
69 ATTR_DLLNAME,
70 ATTR_DUAL,
71 ATTR_ENDPOINT,
72 ATTR_ENTRY_STRING,
73 ATTR_ENTRY_ORDINAL,
74 ATTR_HANDLE,
75 ATTR_HELPSTRING,
76 ATTR_ID,
77 ATTR_IDEMPOTENT,
78 ATTR_IIDIS,
79 ATTR_IN,
80 ATTR_INPUTSYNC,
81 ATTR_LENGTHIS,
82 ATTR_LOCAL,
83 ATTR_OBJECT,
84 ATTR_ODL,
85 ATTR_OLEAUTOMATION,
86 ATTR_OPTIONAL,
87 ATTR_OUT,
88 ATTR_POINTERDEFAULT,
89 ATTR_POINTERTYPE,
90 ATTR_PROPGET,
91 ATTR_PROPPUT,
92 ATTR_PUBLIC,
93 ATTR_READONLY,
94 ATTR_RETVAL,
95 ATTR_SIZEIS,
96 ATTR_SOURCE,
97 ATTR_STRING,
98 ATTR_SWITCHIS,
99 ATTR_SWITCHTYPE,
100 ATTR_TRANSMITAS,
101 ATTR_UUID,
102 ATTR_V1ENUM,
103 ATTR_VARARG,
104 ATTR_VERSION,
105 ATTR_WIREMARSHAL,
106 ATTR_DISPINTERFACE
109 enum expr_type
111 EXPR_VOID,
112 EXPR_NUM,
113 EXPR_HEXNUM,
114 EXPR_IDENTIFIER,
115 EXPR_NEG,
116 EXPR_NOT,
117 EXPR_PPTR,
118 EXPR_CAST,
119 EXPR_SIZEOF,
120 EXPR_SHL,
121 EXPR_SHR,
122 EXPR_MUL,
123 EXPR_DIV,
124 EXPR_ADD,
125 EXPR_SUB,
126 EXPR_AND,
127 EXPR_OR,
128 EXPR_COND,
131 enum type_kind
133 TKIND_ENUM = 0,
134 TKIND_RECORD,
135 TKIND_MODULE,
136 TKIND_INTERFACE,
137 TKIND_DISPATCH,
138 TKIND_COCLASS,
139 TKIND_ALIAS,
140 TKIND_UNION,
141 TKIND_MAX
144 struct _attr_t {
145 enum attr_type type;
146 union {
147 unsigned long ival;
148 void *pval;
149 } u;
150 /* parser-internal */
151 DECL_LINK(attr_t)
154 struct _expr_t {
155 enum expr_type type;
156 expr_t *ref;
157 union {
158 long lval;
159 char *sval;
160 expr_t *ext;
161 typeref_t *tref;
162 } u;
163 expr_t *ext2;
164 int is_const;
165 long cval;
166 /* parser-internal */
167 DECL_LINK(expr_t)
170 struct _type_t {
171 char *name;
172 unsigned char type;
173 struct _type_t *ref;
174 char *rname;
175 attr_t *attrs;
176 func_t *funcs;
177 var_t *fields;
178 int ignore, is_const, sign;
179 int defined, written;
181 /* parser-internal */
182 DECL_LINK(type_t)
185 struct _typeref_t {
186 char *name;
187 type_t *ref;
188 int uniq;
191 struct _var_t {
192 char *name;
193 int ptr_level;
194 expr_t *array;
195 type_t *type;
196 var_t *args; /* for function pointers */
197 char *tname;
198 attr_t *attrs;
199 expr_t *eval;
200 long lval;
202 /* parser-internal */
203 DECL_LINK(var_t)
206 struct _func_t {
207 var_t *def;
208 var_t *args;
209 int ignore, idx;
211 /* parser-internal */
212 DECL_LINK(func_t)
215 struct _ifref_t {
216 type_t *iface;
217 attr_t *attrs;
219 /* parser-internal */
220 DECL_LINK(ifref_t)
223 struct _class_t {
224 char *name;
225 attr_t *attrs;
226 ifref_t *ifaces;
228 /* parser-internal */
229 DECL_LINK(class_t)
232 struct _typelib_entry_t {
233 enum type_kind kind;
234 union {
235 class_t *class;
236 type_t *interface;
237 type_t *module;
238 type_t *structure;
239 } u;
240 DECL_LINK(typelib_entry_t)
243 struct _typelib_t {
244 char *name;
245 char *filename;
246 attr_t *attrs;
247 typelib_entry_t *entry;
250 #endif