Dan Hipschman : widl: Add an is_ptr function.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Sep 7 03:45:47 CDT 2006
Module: wine
Branch: master
Commit: 929a75989594cbc5e47772b36d89def30a5546e7
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=929a75989594cbc5e47772b36d89def30a5546e7
Author: Dan Hipschman <dsh at linux.ucla.edu>
Date: Tue Aug 29 14:27:27 2006 -0700
widl: Add an is_ptr function.
---
tools/widl/client.c | 2 +-
tools/widl/parser.y | 2 +-
tools/widl/proxy.c | 20 +++-----------------
tools/widl/typelib.c | 11 +++++++++++
tools/widl/widltypes.h | 3 ++-
5 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/tools/widl/client.c b/tools/widl/client.c
index 64cf8c5..a0b0f25 100644
--- a/tools/widl/client.c
+++ b/tools/widl/client.c
@@ -91,7 +91,7 @@ static void check_pointers(const func_t
while (NEXT_LINK(var)) var = NEXT_LINK(var);
while (var)
{
- if (is_pointer(var) && cant_be_null(var))
+ if (is_var_ptr(var) && cant_be_null(var))
{
print_client("if (!%s)\n", var->name);
print_client("{\n");
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 08937d2..0121bca 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -1342,7 +1342,7 @@ static type_t *reg_typedefs(type_t *type
}
cur = alias(cur, names->name);
cur->attrs = attrs;
- if (cur->ref)
+ if (is_ptr(cur))
cur->type = get_pointer_type(cur);
reg_type(cur, cur->name, 0);
}
diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c
index 2c4fa10..cb2b2a9 100644
--- a/tools/widl/proxy.c
+++ b/tools/widl/proxy.c
@@ -128,23 +128,9 @@ static void clear_output_vars( var_t *ar
}
}
-int is_pointer(var_t *arg)
+int is_var_ptr(var_t *v)
{
- if (arg->ptr_level)
- return 1;
-
- switch (ref_type(arg->type))
- {
- case RPC_FC_RP:
- case RPC_FC_C_CSTRING:
- case RPC_FC_C_WSTRING:
- case RPC_FC_FP:
- case RPC_FC_OP:
- case RPC_FC_UP:
- return 1;
- }
-
- return 0;
+ return v->ptr_level || is_ptr(v->type);
}
int cant_be_null(var_t *v)
@@ -213,7 +199,7 @@ static void proxy_check_pointers( var_t
{
END_OF_LIST(arg);
while (arg) {
- if (is_pointer(arg) && cant_be_null(arg)) {
+ if (is_var_ptr(arg) && cant_be_null(arg)) {
print_proxy( "if(!%s)\n", arg->name );
indent++;
print_proxy( "RpcRaiseException(RPC_X_NULL_REF_POINTER);\n");
diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c
index b91ca28..adf9870 100644
--- a/tools/widl/typelib.c
+++ b/tools/widl/typelib.c
@@ -73,6 +73,17 @@ type_t *alias(type_t *t, const char *nam
return a;
}
+int is_ptr(type_t *t)
+{
+ unsigned char c = t->type;
+ return c == RPC_FC_RP
+ || c == RPC_FC_UP
+ || c == RPC_FC_FP
+ || c == RPC_FC_OP
+ || c == RPC_FC_C_CSTRING
+ || c == RPC_FC_C_WSTRING;
+}
+
/* List of oleauto types that should be recognized by name.
* (most of) these seem to be intrinsic types in mktyplib. */
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 1c919ce..54c67e2 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -297,7 +297,8 @@ type_t *alias(type_t *t, const char *nam
/* Get the actual type field for a type (chase down typedef references). */
unsigned char ref_type(const type_t *type);
-int is_pointer(var_t *v);
+int is_ptr(type_t *t);
+int is_var_ptr(var_t *v);
int cant_be_null(var_t *v);
#endif
More information about the wine-cvs
mailing list