Fixes for Sparc build.
[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 struct _attr_t {
47   int type;
48   union {
49     DWORD ival;
50     void *pval;
51   } u;
52   /* parser-internal */
53   DECL_LINK(attr_t)
54 };
55
56 struct _type_t {
57   char *name;
58   BYTE type;
59   struct _type_t *ref;
60   char *rname;
61   attr_t *attrs;
62   func_t *funcs;
63   var_t *fields;
64   int ignore, is_const;
65   int defined, written;
66
67   /* parser-internal */
68   DECL_LINK(type_t)
69 };
70
71 struct _typeref_t {
72   char *name;
73   type_t *ref;
74   int uniq;
75 };
76
77 struct _var_t {
78   char *name;
79   int ptr_level;
80   type_t *type;
81   char *tname;
82   attr_t *attrs;
83
84   /* parser-internal */
85   DECL_LINK(var_t)
86 };
87
88 struct _func_t {
89   var_t *def;
90   var_t *args;
91   int ignore, idx;
92
93   /* parser-internal */
94   DECL_LINK(func_t)
95 };
96
97 #endif