msi: Only insert entries into listbox if property value matches.
[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 #include "wine/list.h"
28
29 #ifndef UUID_DEFINED
30 #define UUID_DEFINED
31 typedef GUID UUID;
32 #endif
33
34 #define TRUE 1
35 #define FALSE 0
36
37 typedef struct _attr_t attr_t;
38 typedef struct _expr_t expr_t;
39 typedef struct _type_t type_t;
40 typedef struct _typeref_t typeref_t;
41 typedef struct _var_t var_t;
42 typedef struct _func_t func_t;
43 typedef struct _ifref_t ifref_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 typedef struct list attr_list_t;
50 typedef struct list func_list_t;
51 typedef struct list expr_list_t;
52 typedef struct list var_list_t;
53 typedef struct list ifref_list_t;
54 typedef struct list array_dims_t;
55
56 enum attr_type
57 {
58     ATTR_AGGREGATABLE,
59     ATTR_APPOBJECT,
60     ATTR_ASYNC,
61     ATTR_AUTO_HANDLE,
62     ATTR_BINDABLE,
63     ATTR_CALLAS,
64     ATTR_CASE,
65     ATTR_CONTEXTHANDLE,
66     ATTR_CONTROL,
67     ATTR_DEFAULT,
68     ATTR_DEFAULTCOLLELEM,
69     ATTR_DEFAULTVALUE_EXPR,
70     ATTR_DEFAULTVALUE_STRING,
71     ATTR_DEFAULTVTABLE,
72     ATTR_DISPINTERFACE,
73     ATTR_DISPLAYBIND,
74     ATTR_DLLNAME,
75     ATTR_DUAL,
76     ATTR_ENDPOINT,
77     ATTR_ENTRY_ORDINAL,
78     ATTR_ENTRY_STRING,
79     ATTR_EXPLICIT_HANDLE,
80     ATTR_HANDLE,
81     ATTR_HELPCONTEXT,
82     ATTR_HELPFILE,
83     ATTR_HELPSTRING,
84     ATTR_HELPSTRINGCONTEXT,
85     ATTR_HELPSTRINGDLL,
86     ATTR_HIDDEN,
87     ATTR_ID,
88     ATTR_IDEMPOTENT,
89     ATTR_IIDIS,
90     ATTR_IMMEDIATEBIND,
91     ATTR_IMPLICIT_HANDLE,
92     ATTR_IN,
93     ATTR_INPUTSYNC,
94     ATTR_LENGTHIS,
95     ATTR_LOCAL,
96     ATTR_NONBROWSABLE,
97     ATTR_NONCREATABLE,
98     ATTR_NONEXTENSIBLE,
99     ATTR_OBJECT,
100     ATTR_ODL,
101     ATTR_OLEAUTOMATION,
102     ATTR_OPTIONAL,
103     ATTR_OUT,
104     ATTR_POINTERDEFAULT,
105     ATTR_POINTERTYPE,
106     ATTR_PROPGET,
107     ATTR_PROPPUT,
108     ATTR_PROPPUTREF,
109     ATTR_PUBLIC,
110     ATTR_RANGE,
111     ATTR_READONLY,
112     ATTR_REQUESTEDIT,
113     ATTR_RESTRICTED,
114     ATTR_RETVAL,
115     ATTR_SIZEIS,
116     ATTR_SOURCE,
117     ATTR_STRING,
118     ATTR_SWITCHIS,
119     ATTR_SWITCHTYPE,
120     ATTR_TRANSMITAS,
121     ATTR_UUID,
122     ATTR_V1ENUM,
123     ATTR_VARARG,
124     ATTR_VERSION,
125     ATTR_WIREMARSHAL
126 };
127
128 enum expr_type
129 {
130     EXPR_VOID,
131     EXPR_NUM,
132     EXPR_HEXNUM,
133     EXPR_IDENTIFIER,
134     EXPR_NEG,
135     EXPR_NOT,
136     EXPR_PPTR,
137     EXPR_CAST,
138     EXPR_SIZEOF,
139     EXPR_SHL,
140     EXPR_SHR,
141     EXPR_MUL,
142     EXPR_DIV,
143     EXPR_ADD,
144     EXPR_SUB,
145     EXPR_AND,
146     EXPR_OR,
147     EXPR_COND,
148     EXPR_TRUEFALSE,
149 };
150
151 enum type_kind
152 {
153     TKIND_PRIMITIVE = -1,
154     TKIND_ENUM,
155     TKIND_RECORD,
156     TKIND_MODULE,
157     TKIND_INTERFACE,
158     TKIND_DISPATCH,
159     TKIND_COCLASS,
160     TKIND_ALIAS,
161     TKIND_UNION,
162     TKIND_MAX
163 };
164
165 struct _attr_t {
166   enum attr_type type;
167   union {
168     unsigned long ival;
169     void *pval;
170   } u;
171   /* parser-internal */
172   struct list entry;
173 };
174
175 struct _expr_t {
176   enum expr_type type;
177   const expr_t *ref;
178   union {
179     long lval;
180     const char *sval;
181     const expr_t *ext;
182     const typeref_t *tref;
183   } u;
184   const expr_t *ext2;
185   int is_const;
186   long cval;
187   /* parser-internal */
188   struct list entry;
189 };
190
191 struct _type_t {
192   const char *name;
193   enum type_kind kind;
194   unsigned char type;
195   struct _type_t *ref;
196   const attr_list_t *attrs;
197   func_list_t *funcs;             /* interfaces and modules */
198   var_list_t *fields;             /* interfaces, structures and enumerations */
199   ifref_list_t *ifaces;           /* coclasses */
200   type_t *orig;                   /* dup'd types */
201   int ignore, is_const, sign;
202   int defined, written, user_types_registered;
203   int typelib_idx;
204 };
205
206 struct _typeref_t {
207   char *name;
208   type_t *ref;
209   int uniq;
210 };
211
212 struct _var_t {
213   char *name;
214   int ptr_level;
215   array_dims_t *array;
216   type_t *type;
217   var_list_t *args;  /* for function pointers */
218   const char *tname;
219   attr_list_t *attrs;
220   expr_t *eval;
221
222   /* parser-internal */
223   struct list entry;
224 };
225
226 struct _func_t {
227   var_t *def;
228   var_list_t *args;
229   int ignore, idx;
230
231   /* parser-internal */
232   struct list entry;
233 };
234
235 struct _ifref_t {
236   type_t *iface;
237   attr_list_t *attrs;
238
239   /* parser-internal */
240   struct list entry;
241 };
242
243 struct _typelib_entry_t {
244     type_t *type;
245     struct list entry;
246 };
247
248 struct _importinfo_t {
249     int offset;
250     GUID guid;
251     int flags;
252     int id;
253
254     char *name;
255
256     importlib_t *importlib;
257 };
258
259 struct _importlib_t {
260     char *name;
261
262     int version;
263     GUID guid;
264
265     importinfo_t *importinfos;
266     int ntypeinfos;
267
268     int allocated;
269
270     struct list entry;
271 };
272
273 struct _typelib_t {
274     char *name;
275     char *filename;
276     attr_list_t *attrs;
277     struct list entries;
278     struct list importlibs;
279 };
280
281 void init_types(void);
282
283 type_t *duptype(type_t *t, int dupname);
284 type_t *alias(type_t *t, const char *name);
285
286 int is_ptr(const type_t *t);
287 int is_var_ptr(const var_t *v);
288 int cant_be_null(const var_t *v);
289
290 #endif