Added support for the propget/propput function attributes.
[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 #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)))
39
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
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 enum attr_type
60 {
61     ATTR_ASYNC,
62     ATTR_CALLAS,
63     ATTR_CASE,
64     ATTR_CONTEXTHANDLE,
65     ATTR_DEFAULT,
66     ATTR_DLLNAME,
67     ATTR_DUAL,
68     ATTR_ENDPOINT,
69     ATTR_ENTRY_STRING,
70     ATTR_ENTRY_ORDINAL,
71     ATTR_HANDLE,
72     ATTR_HELPSTRING,
73     ATTR_ID,
74     ATTR_IDEMPOTENT,
75     ATTR_IIDIS,
76     ATTR_IN,
77     ATTR_INPUTSYNC,
78     ATTR_LENGTHIS,
79     ATTR_LOCAL,
80     ATTR_OBJECT,
81     ATTR_ODL,
82     ATTR_OLEAUTOMATION,
83     ATTR_OUT,
84     ATTR_POINTERDEFAULT,
85     ATTR_POINTERTYPE,
86     ATTR_PROPGET,
87     ATTR_PROPPUT,
88     ATTR_PUBLIC,
89     ATTR_READONLY,
90     ATTR_RETVAL,
91     ATTR_SIZEIS,
92     ATTR_SOURCE,
93     ATTR_STRING,
94     ATTR_SWITCHIS,
95     ATTR_SWITCHTYPE,
96     ATTR_TRANSMITAS,
97     ATTR_UUID,
98     ATTR_V1ENUM,
99     ATTR_VERSION,
100     ATTR_WIREMARSHAL,
101 };
102
103 enum expr_type
104 {
105     EXPR_VOID,
106     EXPR_NUM,
107     EXPR_HEXNUM,
108     EXPR_IDENTIFIER,
109     EXPR_NEG,
110     EXPR_NOT,
111     EXPR_PPTR,
112     EXPR_CAST,
113     EXPR_SIZEOF,
114     EXPR_SHL,
115     EXPR_SHR,
116     EXPR_MUL,
117     EXPR_DIV,
118     EXPR_ADD,
119     EXPR_SUB,
120     EXPR_AND,
121     EXPR_OR,
122     EXPR_COND,
123 };
124
125 struct _attr_t {
126   enum attr_type type;
127   union {
128     unsigned long ival;
129     void *pval;
130   } u;
131   /* parser-internal */
132   DECL_LINK(attr_t)
133 };
134
135 struct _expr_t {
136   enum expr_type type;
137   expr_t *ref;
138   union {
139     long lval;
140     char *sval;
141     expr_t *ext;
142     typeref_t *tref;
143   } u;
144   expr_t *ext2;
145   int is_const;
146   long cval;
147   /* parser-internal */
148   DECL_LINK(expr_t)
149 };
150
151 struct _type_t {
152   char *name;
153   unsigned char type;
154   struct _type_t *ref;
155   char *rname;
156   attr_t *attrs;
157   func_t *funcs;
158   var_t *fields;
159   int ignore, is_const, sign;
160   int defined, written;
161
162   /* parser-internal */
163   DECL_LINK(type_t)
164 };
165
166 struct _typeref_t {
167   char *name;
168   type_t *ref;
169   int uniq;
170 };
171
172 struct _var_t {
173   char *name;
174   int ptr_level;
175   expr_t *array;
176   type_t *type;
177   var_t *args;  /* for function pointers */
178   char *tname;
179   attr_t *attrs;
180   expr_t *eval;
181   long lval;
182
183   /* parser-internal */
184   DECL_LINK(var_t)
185 };
186
187 struct _func_t {
188   var_t *def;
189   var_t *args;
190   int ignore, idx;
191
192   /* parser-internal */
193   DECL_LINK(func_t)
194 };
195
196 struct _ifref_t {
197   type_t *iface;
198   attr_t *attrs;
199
200   /* parser-internal */
201   DECL_LINK(ifref_t)
202 };
203
204 struct _class_t {
205   char *name;
206   attr_t *attrs;
207   ifref_t *ifaces;
208
209   /* parser-internal */
210   DECL_LINK(class_t)
211 };
212
213 #endif