Rob Shearman : widl: Move duptype and alias to parser.y.
Alexandre Julliard
julliard at winehq.org
Tue Jan 6 08:23:15 CST 2009
Module: wine
Branch: master
Commit: 8b326c4ff850b4b73f47a45b3efafb870ecd6e03
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8b326c4ff850b4b73f47a45b3efafb870ecd6e03
Author: Rob Shearman <robertshearman at gmail.com>
Date: Mon Jan 5 23:33:52 2009 +0000
widl: Move duptype and alias to parser.y.
Make duptype static and rename alias to type_new_alias.
---
tools/widl/parser.y | 4 ++--
tools/widl/typelib.c | 25 -------------------------
tools/widl/typetree.c | 25 +++++++++++++++++++++++++
tools/widl/typetree.h | 4 ++++
tools/widl/widltypes.h | 3 ---
5 files changed, 31 insertions(+), 30 deletions(-)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index e88d093..5a42263 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -785,7 +785,7 @@ base_type: tBYTE { $$ = make_builtin($<str>1); }
case RPC_FC_HYPER:
if ($$->name[0] == 'h') /* hyper, as opposed to __int64 */
{
- $$ = alias($$, "MIDL_uhyper");
+ $$ = type_new_alias($$, "MIDL_uhyper");
$$->sign = 0;
}
break;
@@ -1876,7 +1876,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
/* set the attributes to allow set_type to do some checks on them */
name->attrs = attrs;
set_type(name, decl_spec, decl, 0);
- cur = alias(name->type, name->name);
+ cur = type_new_alias(name->type, name->name);
cur->attrs = attrs;
if (is_incomplete(cur))
diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c
index 17eaaf0..e0ef86e 100644
--- a/tools/widl/typelib.c
+++ b/tools/widl/typelib.c
@@ -49,31 +49,6 @@
static typelib_t *typelib;
-type_t *duptype(type_t *t, int dupname)
-{
- type_t *d = alloc_type();
-
- *d = *t;
- if (dupname && t->name)
- d->name = xstrdup(t->name);
-
- d->orig = t;
- return d;
-}
-
-type_t *alias(type_t *t, const char *name)
-{
- type_t *a = duptype(t, 0);
-
- a->name = xstrdup(name);
- a->kind = TKIND_ALIAS;
- a->attrs = NULL;
- a->declarray = FALSE;
- init_loc_info(&a->loc_info);
-
- return a;
-}
-
int is_ptr(const type_t *t)
{
unsigned char c = t->type;
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index c6def4b..67c6f8b 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -29,6 +29,17 @@
#include "typetree.h"
#include "header.h"
+type_t *duptype(type_t *t, int dupname)
+{
+ type_t *d = alloc_type();
+
+ *d = *t;
+ if (dupname && t->name)
+ d->name = xstrdup(t->name);
+
+ return d;
+}
+
type_t *type_new_function(var_list_t *args)
{
type_t *t = make_type(RPC_FC_FUNCTION, NULL);
@@ -45,6 +56,20 @@ type_t *type_new_pointer(type_t *ref, attr_list_t *attrs)
return t;
}
+type_t *type_new_alias(type_t *t, const char *name)
+{
+ type_t *a = duptype(t, 0);
+
+ a->name = xstrdup(name);
+ a->kind = TKIND_ALIAS;
+ a->attrs = NULL;
+ a->declarray = FALSE;
+ a->orig = t;
+ init_loc_info(&a->loc_info);
+
+ return a;
+}
+
static int compute_method_indexes(type_t *iface)
{
int idx;
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index d4fdf19..24a15ea 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -26,11 +26,15 @@
type_t *type_new_function(var_list_t *args);
type_t *type_new_pointer(type_t *ref, attr_list_t *attrs);
+type_t *type_new_alias(type_t *t, const char *name);
void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts);
void type_dispinterface_define(type_t *iface, var_list_t *props, func_list_t *methods);
void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
void type_module_define(type_t *module, statement_list_t *stmts);
+/* FIXME: shouldn't need to export this */
+type_t *duptype(type_t *t, int dupname);
+
static inline var_list_t *type_struct_get_fields(const type_t *type)
{
assert(is_struct(type->type));
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 2bfa641..3f06452 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -436,9 +436,6 @@ type_t *alloc_type(void);
void set_all_tfswrite(int val);
void clear_all_offsets(void);
-type_t *duptype(type_t *t, int dupname);
-type_t *alias(type_t *t, const char *name);
-
int is_ptr(const type_t *t);
int is_array(const type_t *t);
int is_var_ptr(const var_t *v);
More information about the wine-cvs
mailing list