From 19fd305a7e2a65ca8ba67e6f8e033e42ac4df697 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Thu, 22 Apr 2004 03:40:01 +0000 Subject: [PATCH] Make widl compile without most of Windows/Wine headers, so it can be reused by other projects. --- tools/widl/header.c | 4 ++-- tools/widl/header.h | 2 +- tools/widl/parser.y | 18 +++++++++--------- tools/widl/widltypes.h | 13 +++++++++---- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/tools/widl/header.c b/tools/widl/header.c index f863a0d09b5..5d8ebfbb459 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -63,7 +63,7 @@ void *get_attrp(attr_t *a, enum attr_type t) 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 +789,7 @@ void write_com_interface(type_t *iface) 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; diff --git a/tools/widl/header.h b/tools/widl/header.h index 0fd4e33f112..011161b8886 100644 --- a/tools/widl/header.h +++ b/tools/widl/header.h @@ -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); diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 9a85a3ba203..e048e938fc0 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -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,8 @@ static expr_t *make_exprs(enum expr_type type, char *val); 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 expr_t *make_expr3(enum expr_type type, expr_t *expr1, expr_t *expr2, expr_t *expr3); +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 +87,8 @@ static type_t *reg_type(type_t *type, char *name, int t); 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 +732,7 @@ static attr_t *make_attr(enum attr_type type) 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; @@ -913,7 +913,7 @@ static expr_t *make_expr3(enum expr_type type, expr_t *expr1, expr_t *expr2, exp 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 +1116,7 @@ int is_type(const char *name) 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 +1135,7 @@ static type_t *get_type(BYTE type, char *name, int t) 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) { diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h index a5722c12336..9d437996870 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -22,8 +22,6 @@ #define __WIDL_WIDLTYPES_H #include -#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; @@ -116,7 +121,7 @@ enum expr_type struct _attr_t { enum attr_type type; union { - DWORD ival; + unsigned long ival; void *pval; } u; /* parser-internal */ @@ -141,7 +146,7 @@ struct _expr_t { struct _type_t { char *name; - BYTE type; + unsigned char type; struct _type_t *ref; char *rname; attr_t *attrs;