Make WIDL not depend on Windows headers
Filip Navara
xnavara at volny.cz
Wed Apr 21 15:53:47 CDT 2004
This patch makes the WIDL compile without most of Windows/Wine headers,
so it can be reused by other projects.
- Filip
-------------- next part --------------
--- widl/header.c Mon Apr 19 23:08:22 2004
+++ widl/header.c Wed Apr 21 20:27:14 2004
@@ -63,7 +63,7 @@
return NULL;
}
-DWORD get_attrv(attr_t *a, enum attr_type t)
+unsigned long get_attrv(attr_t *a, enum attr_type t)
{
while (a) {
if (a->type == t) return a->u.ival;
@@ -789,7 +780,7 @@
void write_rpc_interface(type_t *iface)
{
- DWORD ver = get_attrv(iface->attrs, ATTR_VERSION);
+ unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION);
if (!iface->funcs) return;
--- widl/header.h Wed Jan 7 05:21:28 2004
+++ widl/header.h Wed Apr 21 20:27:02 2004
@@ -23,7 +23,7 @@
extern int is_attr(attr_t *a, enum attr_type t);
extern void *get_attrp(attr_t *a, enum attr_type t);
-extern DWORD get_attrv(attr_t *a, enum attr_type t);
+extern unsigned long get_attrv(attr_t *a, enum attr_type t);
extern int is_void(type_t *t, var_t *v);
extern void write_name(FILE *h, var_t *v);
extern char* get_name(var_t *v);
--- widl/parser.y Mon Apr 19 23:08:22 2004
+++ widl/parser.y Wed Apr 21 20:28:46 2004
@@ -64,7 +64,7 @@
#endif
static attr_t *make_attr(enum attr_type type);
-static attr_t *make_attrv(enum attr_type type, DWORD val);
+static attr_t *make_attrv(enum attr_type type, unsigned long val);
static attr_t *make_attrp(enum attr_type type, void *val);
static expr_t *make_expr(enum expr_type type);
static expr_t *make_exprl(enum expr_type type, long val);
@@ -72,8 +72,7 @@
static expr_t *make_exprt(enum expr_type type, typeref_t *tref, expr_t *expr);
static expr_t *make_expr1(enum expr_type type, expr_t *expr);
static expr_t *make_expr2(enum expr_type type, expr_t *exp1, expr_t *exp2);
-static expr_t *make_expr3(enum expr_type type, expr_t *exp1, expr_t *exp2, expr_t *exp3);
-static type_t *make_type(BYTE type, type_t *ref);
+static type_t *make_type(unsigned char type, type_t *ref);
static typeref_t *make_tref(char *name, type_t *ref);
static typeref_t *uniq_tref(typeref_t *ref);
static type_t *type_ref(typeref_t *ref);
@@ -87,8 +86,8 @@
static type_t *reg_types(type_t *type, var_t *names, int t);
static type_t *find_type(char *name, int t);
static type_t *find_type2(char *name, int t);
-static type_t *get_type(BYTE type, char *name, int t);
-static type_t *get_typev(BYTE type, var_t *name, int t);
+static type_t *get_type(unsigned char type, char *name, int t);
+static type_t *get_typev(unsigned char type, var_t *name, int t);
static var_t *reg_const(var_t *var);
static var_t *find_const(char *name, int f);
@@ -732,7 +728,7 @@
return a;
}
-static attr_t *make_attrv(enum attr_type type, DWORD val)
+static attr_t *make_attrv(enum attr_type type, unsigned long val)
{
attr_t *a = xmalloc(sizeof(attr_t));
a->type = type;
@@ -888,7 +884,7 @@
return e;
}
-static type_t *make_type(BYTE type, type_t *ref)
+static type_t *make_type(unsigned char type, type_t *ref)
{
type_t *t = xmalloc(sizeof(type_t));
t->name = NULL;
@@ -1116,7 +1087,7 @@
return FALSE;
}
-static type_t *get_type(BYTE type, char *name, int t)
+static type_t *get_type(unsigned char type, char *name, int t)
{
struct rtype *cur = NULL;
type_t *tp;
@@ -1135,7 +1106,7 @@
return reg_type(tp, name, t);
}
-static type_t *get_typev(BYTE type, var_t *name, int t)
+static type_t *get_typev(unsigned char type, var_t *name, int t)
{
char *sname = NULL;
if (name) {
--- widl/widltypes.h Mon Apr 19 23:08:22 2004
+++ widl/widltypes.h Wed Apr 21 20:30:52 2004
@@ -22,8 +22,6 @@
#define __WIDL_WIDLTYPES_H
#include <stdarg.h>
-#include "windef.h"
-#include "winbase.h"
#include "guiddef.h"
#include "wine/rpcfc.h"
@@ -32,6 +30,13 @@
typedef GUID UUID;
#endif
+#define TRUE 1
+#define FALSE 0
+
+#define LOWORD(l) ((unsigned short)(l))
+#define HIWORD(l) ((unsigned short)((unsigned long)(l) >> 16))
+#define MAKELONG(low,high) ((unsigned long)(((unsigned short)(low)) | (((unsigned long)((unsigned short)(high))) << 16)))
+
typedef struct _attr_t attr_t;
typedef struct _expr_t expr_t;
typedef struct _type_t type_t;
@@ -110,7 +114,7 @@
struct _attr_t {
enum attr_type type;
union {
- DWORD ival;
+ unsigned long ival;
void *pval;
} u;
/* parser-internal */
@@ -141,7 +143,7 @@
struct _type_t {
char *name;
- BYTE type;
+ unsigned char type;
struct _type_t *ref;
char *rname;
attr_t *attrs;
More information about the wine-patches
mailing list