ok() does not support '%S'. Store the Ansi version, convert to Unicode
[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 "windef.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 typedef struct _attr_t attr_t;
34 typedef struct _expr_t expr_t;
35 typedef struct _type_t type_t;
36 typedef struct _typeref_t typeref_t;
37 typedef struct _var_t var_t;
38 typedef struct _func_t func_t;
39
40 #define DECL_LINK(type) \
41   type *l_next; \
42   type *l_prev;
43
44 #define LINK(x,y) do { x->l_next = y; if (y) y->l_prev = x; } while (0)
45
46 #define INIT_LINK(x) do { x->l_next = NULL; x->l_prev = NULL; } while (0)
47 #define NEXT_LINK(x) ((x)->l_next)
48 #define PREV_LINK(x) ((x)->l_prev)
49
50 enum attr_type
51 {
52     ATTR_ASYNC,
53     ATTR_CALLAS,
54     ATTR_CASE,
55     ATTR_CONTEXTHANDLE,
56     ATTR_DEFAULT,
57     ATTR_IDEMPOTENT,
58     ATTR_IIDIS,
59     ATTR_IN,
60     ATTR_LENGTHIS,
61     ATTR_LOCAL,
62     ATTR_OBJECT,
63     ATTR_OLEAUTOMATION,
64     ATTR_OUT,
65     ATTR_POINTERDEFAULT,
66     ATTR_POINTERTYPE,
67     ATTR_SIZEIS,
68     ATTR_STRING,
69     ATTR_SWITCHIS,
70     ATTR_SWITCHTYPE,
71     ATTR_UUID,
72     ATTR_V1ENUM,
73     ATTR_VERSION,
74     ATTR_WIREMARSHAL,
75 };
76
77 enum expr_type
78 {
79     EXPR_VOID,
80     EXPR_NUM,
81     EXPR_HEXNUM,
82     EXPR_IDENTIFIER,
83     EXPR_NEG,
84     EXPR_NOT,
85     EXPR_PPTR,
86     EXPR_CAST,
87     EXPR_SIZEOF,
88     EXPR_SHL,
89     EXPR_SHR,
90     EXPR_MUL,
91     EXPR_DIV,
92     EXPR_ADD,
93     EXPR_SUB,
94     EXPR_AND,
95     EXPR_OR,
96 };
97
98 struct _attr_t {
99   enum attr_type type;
100   union {
101     DWORD ival;
102     void *pval;
103   } u;
104   /* parser-internal */
105   DECL_LINK(attr_t)
106 };
107
108 struct _expr_t {
109   enum expr_type type;
110   expr_t *ref;
111   union {
112     long lval;
113     char *sval;
114     expr_t *ext;
115     typeref_t *tref;
116   } u;
117   int is_const;
118   long cval;
119   /* parser-internal */
120   DECL_LINK(expr_t)
121 };
122
123 struct _type_t {
124   char *name;
125   BYTE type;
126   struct _type_t *ref;
127   char *rname;
128   attr_t *attrs;
129   func_t *funcs;
130   var_t *fields;
131   int ignore, is_const, sign;
132   int defined, written;
133
134   /* parser-internal */
135   DECL_LINK(type_t)
136 };
137
138 struct _typeref_t {
139   char *name;
140   type_t *ref;
141   int uniq;
142 };
143
144 struct _var_t {
145   char *name;
146   int ptr_level;
147   expr_t *array;
148   type_t *type;
149   char *tname;
150   attr_t *attrs;
151   expr_t *eval;
152   long lval;
153
154   /* parser-internal */
155   DECL_LINK(var_t)
156 };
157
158 struct _func_t {
159   var_t *def;
160   var_t *args;
161   int ignore, idx;
162
163   /* parser-internal */
164   DECL_LINK(func_t)
165 };
166
167 #endif