Include protection for <unistd.h>, <sys/types.h> and <sys/stat.h>.
[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 "oleauto.h"
26 #include "wine/rpcfc.h"
27
28 typedef struct _attr_t attr_t;
29 typedef struct _type_t type_t;
30 typedef struct _typeref_t typeref_t;
31 typedef struct _var_t var_t;
32 typedef struct _func_t func_t;
33
34 #define DECL_LINK(type) \
35   type *l_next; \
36   type *l_prev;
37
38 #define LINK(x,y) do { x->l_next = y; if (y) y->l_prev = x; } while (0)
39 #define LINK_LAST(x,y) do { if (y) { attr_t *_c = x; while (_c->l_next) _c = _c->l_next; LINK(_c, y); } } while (0)
40 #define LINK_SAFE(x,y) do { if (x) LINK_LAST(x,y); else { x = y; } } while (0)
41
42 #define INIT_LINK(x) do { x->l_next = NULL; x->l_prev = NULL; } while (0)
43 #define NEXT_LINK(x) ((x)->l_next)
44 #define PREV_LINK(x) ((x)->l_prev)
45
46 enum attr_type
47 {
48     ATTR_ASYNC,
49     ATTR_CALLAS,
50     ATTR_DEFAULT,
51     ATTR_IIDIS,
52     ATTR_IN,
53     ATTR_LOCAL,
54     ATTR_OBJECT,
55     ATTR_OLEAUTOMATION,
56     ATTR_OUT,
57     ATTR_POINTERDEFAULT,
58     ATTR_POINTERTYPE,
59     ATTR_STRING,
60     ATTR_V1ENUM,
61     ATTR_WIREMARSHAL,
62 };
63
64 struct _attr_t {
65   enum attr_type type;
66   union {
67     DWORD ival;
68     void *pval;
69   } u;
70   /* parser-internal */
71   DECL_LINK(attr_t)
72 };
73
74 struct _type_t {
75   char *name;
76   BYTE type;
77   struct _type_t *ref;
78   char *rname;
79   attr_t *attrs;
80   func_t *funcs;
81   var_t *fields;
82   int ignore, is_const;
83   int defined, written;
84
85   /* parser-internal */
86   DECL_LINK(type_t)
87 };
88
89 struct _typeref_t {
90   char *name;
91   type_t *ref;
92   int uniq;
93 };
94
95 struct _var_t {
96   char *name;
97   int ptr_level;
98   type_t *type;
99   char *tname;
100   attr_t *attrs;
101
102   /* parser-internal */
103   DECL_LINK(var_t)
104 };
105
106 struct _func_t {
107   var_t *def;
108   var_t *args;
109   int ignore, idx;
110
111   /* parser-internal */
112   DECL_LINK(func_t)
113 };
114
115 #endif