Dan Hipschman : widl: Fold class_t into type_t.

Alexandre Julliard julliard at wine.codeweavers.com
Sat Jul 29 05:22:18 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: c67b19b4f4bd463eedfbd4de77b846f9efb8a040
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=c67b19b4f4bd463eedfbd4de77b846f9efb8a040

Author: Dan Hipschman <dsh at linux.ucla.edu>
Date:   Fri Jul 28 13:43:00 2006 -0700

widl: Fold class_t into type_t.

---

 tools/widl/header.c     |    6 +++---
 tools/widl/header.h     |    4 ++--
 tools/widl/parser.y     |   12 +++++-------
 tools/widl/typelib.c    |    2 +-
 tools/widl/typelib.h    |    2 +-
 tools/widl/widltypes.h  |   17 ++++-------------
 tools/widl/write_msft.c |    2 +-
 7 files changed, 17 insertions(+), 28 deletions(-)

diff --git a/tools/widl/header.c b/tools/widl/header.c
index 4cd599b..c807691 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -855,7 +855,7 @@ static void write_dispiface_guid(const t
   write_guid("DIID", iface->name, uuid);
 }
 
-static void write_coclass_guid(class_t *cocl)
+static void write_coclass_guid(type_t *cocl)
 {
   const UUID *uuid = get_attrp(cocl->attrs, ATTR_UUID);
   write_guid("CLSID", cocl->name, uuid);
@@ -1006,7 +1006,7 @@ void write_dispinterface(type_t *iface)
   fprintf(header,"#endif  /* __%s_DISPINTERFACE_DEFINED__ */\n\n", iface->name);
 }
 
-void write_coclass(class_t *cocl)
+void write_coclass(type_t *cocl)
 {
   fprintf(header, "/*****************************************************************************\n");
   fprintf(header, " * %s coclass\n", cocl->name);
@@ -1015,7 +1015,7 @@ void write_coclass(class_t *cocl)
   fprintf(header, "\n");
 }
 
-void write_coclass_forward(class_t *cocl)
+void write_coclass_forward(type_t *cocl)
 {
   fprintf(header, "#ifndef __%s_FWD_DEFINED__\n", cocl->name);
   fprintf(header, "#define __%s_FWD_DEFINED__\n", cocl->name);
diff --git a/tools/widl/header.h b/tools/widl/header.h
index b0aa82e..5863f3b 100644
--- a/tools/widl/header.h
+++ b/tools/widl/header.h
@@ -36,8 +36,8 @@ extern void write_array(FILE *h, const e
 extern void write_forward(type_t *iface);
 extern void write_interface(type_t *iface);
 extern void write_dispinterface(type_t *iface);
-extern void write_coclass(class_t *iface);
-extern void write_coclass_forward(class_t *iface);
+extern void write_coclass(type_t *cocl);
+extern void write_coclass_forward(type_t *cocl);
 extern void write_typedef(type_t *type, const var_t *names);
 extern void write_expr(FILE *h, const expr_t *e, int brackets);
 extern void write_constdef(const var_t *v);
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 1790985..2755597 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -82,7 +82,7 @@ static void set_type(var_t *v, typeref_t
 static ifref_t *make_ifref(type_t *iface);
 static var_t *make_var(char *name);
 static func_t *make_func(var_t *def, var_t *args);
-static class_t *make_class(char *name);
+static type_t *make_class(char *name);
 static type_t *make_safearray(void);
 
 static type_t *reg_type(type_t *type, const char *name, int t);
@@ -114,7 +114,6 @@ static type_t std_uhyper = { "MIDL_uhype
 	var_t *var;
 	func_t *func;
 	ifref_t *ifref;
-	class_t *clas;
 	char *str;
 	UUID *uuid;
 	unsigned int num;
@@ -219,7 +218,7 @@ static type_t std_uhyper = { "MIDL_uhype
 %type <var> dispint_props
 %type <func> funcdef int_statements
 %type <func> dispint_meths
-%type <clas> coclass coclasshdr coclassdef
+%type <type> coclass coclasshdr coclassdef
 %type <num> pointer_type version
 %type <str> libraryhdr
 
@@ -1056,6 +1055,7 @@ static type_t *make_type(unsigned char t
   t->attrs = NULL;
   t->funcs = NULL;
   t->fields = NULL;
+  t->ifaces = NULL;
   t->ignore = parse_only;
   t->is_const = FALSE;
   t->sign = 0;
@@ -1139,12 +1139,10 @@ static func_t *make_func(var_t *def, var
   return f;
 }
 
-static class_t *make_class(char *name)
+static type_t *make_class(char *name)
 {
-  class_t *c = xmalloc(sizeof(class_t));
+  type_t *c = make_type(0, NULL);
   c->name = name;
-  c->attrs = NULL;
-  c->ifaces = NULL;
   INIT_LINK(c);
   return c;
 }
diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c
index be0d010..5ff101b 100644
--- a/tools/widl/typelib.c
+++ b/tools/widl/typelib.c
@@ -221,7 +221,7 @@ void add_interface(type_t *iface)
     typelib->entry = entry;
 }
 
-void add_coclass(class_t *cls)
+void add_coclass(type_t *cls)
 {
     typelib_entry_t *entry;
 
diff --git a/tools/widl/typelib.h b/tools/widl/typelib.h
index 094105b..9fb5bdd 100644
--- a/tools/widl/typelib.h
+++ b/tools/widl/typelib.h
@@ -25,7 +25,7 @@ extern int in_typelib;
 extern void start_typelib(char *name, attr_t *attrs);
 extern void end_typelib(void);
 extern void add_interface(type_t *iface);
-extern void add_coclass(class_t *cls);
+extern void add_coclass(type_t *cls);
 extern void add_module(type_t *module);
 extern void add_struct(type_t *structure);
 extern void add_enum(type_t *enumeration);
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 508284e..84a2fc2 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -40,7 +40,6 @@ typedef struct _typeref_t typeref_t;
 typedef struct _var_t var_t;
 typedef struct _func_t func_t;
 typedef struct _ifref_t ifref_t;
-typedef struct _class_t class_t;
 typedef struct _typelib_entry_t typelib_entry_t;
 typedef struct _importlib_t importlib_t;
 typedef struct _importinfo_t importinfo_t;
@@ -203,8 +202,9 @@ struct _type_t {
   unsigned char type;
   struct _type_t *ref;
   const attr_t *attrs;
-  func_t *funcs;
-  var_t *fields;
+  func_t *funcs;                  /* interfaces and modules */
+  var_t *fields;                  /* interfaces, structures and enumerations */
+  ifref_t *ifaces;                /* coclasses */
   int ignore, is_const, sign;
   int defined, written, user_types_registered;
   int typelib_idx;
@@ -249,19 +249,10 @@ struct _ifref_t {
   DECL_LINK(ifref_t);
 };
 
-struct _class_t {
-  char *name;
-  attr_t *attrs;
-  ifref_t *ifaces;
-
-  /* parser-internal */
-  DECL_LINK(class_t);
-};
-
 struct _typelib_entry_t {
     enum type_kind kind;
     union {
-        class_t *class;
+        type_t *class;
         type_t *interface;
         type_t *module;
         type_t *structure;
diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index bc28345..f712f4e 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -2061,7 +2061,7 @@ static void add_typedef_typeinfo(msft_ty
     msft_typeinfo->typeinfo->typekind |= (alignment << 11 | alignment << 6);
 }
 
-static void add_coclass_typeinfo(msft_typelib_t *typelib, class_t *cls)
+static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls)
 {
     msft_typeinfo_t *msft_typeinfo;
     ifref_t *iref;




More information about the wine-cvs mailing list