Rob Shearman : widl: Move creation of module type into a separate function, type_new_module and give it a special FC type.

Alexandre Julliard julliard at winehq.org
Tue Jan 6 08:23:16 CST 2009


Module: wine
Branch: master
Commit: 64520ecdc7465d7fa970fb258f222d41b6d158ca
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=64520ecdc7465d7fa970fb258f222d41b6d158ca

Author: Rob Shearman <robertshearman at gmail.com>
Date:   Mon Jan  5 23:34:08 2009 +0000

widl: Move creation of module type into a separate function, type_new_module and give it a special FC type.

---

 tools/widl/parser.y    |    4 ++--
 tools/widl/typelib.c   |    3 ++-
 tools/widl/typetree.c  |    9 +++++++++
 tools/widl/typetree.h  |    1 +
 tools/widl/widltypes.h |    1 +
 5 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 5a42263..bc252e8 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -918,8 +918,8 @@ interfacedec:
 	| dispinterface ';'			{ $$ = $1; }
 	;
 
-module:   tMODULE aIDENTIFIER			{ $$ = make_type(0, NULL); $$->name = $2; $$->kind = TKIND_MODULE; }
-	| tMODULE aKNOWNTYPE			{ $$ = make_type(0, NULL); $$->name = $2; $$->kind = TKIND_MODULE; }
+module:   tMODULE aIDENTIFIER			{ $$ = type_new_module($2); }
+	| tMODULE aKNOWNTYPE			{ $$ = type_new_module($2); }
 	;
 
 modulehdr: attributes module			{ $$ = $2;
diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c
index e0ef86e..979d3c7 100644
--- a/tools/widl/typelib.c
+++ b/tools/widl/typelib.c
@@ -209,9 +209,10 @@ unsigned short get_type_vt(type_t *t)
   case RPC_FC_CVSTRUCT:
   case RPC_FC_BOGUS_STRUCT:
   case RPC_FC_COCLASS:
+  case RPC_FC_MODULE:
     return VT_USERDEFINED;
   case 0:
-    return t->kind == TKIND_PRIMITIVE ? VT_VOID : VT_USERDEFINED;
+    return VT_VOID;
   default:
     error("get_type_vt: unknown type: 0x%02x\n", t->type);
   }
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 67c6f8b..47ad1f5 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -70,6 +70,15 @@ type_t *type_new_alias(type_t *t, const char *name)
   return a;
 }
 
+type_t *type_new_module(char *name)
+{
+    type_t *type = make_type(RPC_FC_MODULE, NULL);
+    type->name = name;
+    type->kind = TKIND_MODULE;
+    /* FIXME: register type to detect multiple definitions */
+    return type;
+}
+
 static int compute_method_indexes(type_t *iface)
 {
     int idx;
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index 24a15ea..a0f819a 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -27,6 +27,7 @@
 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);
+type_t *type_new_module(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);
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 3f06452..7a55ee7 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -35,6 +35,7 @@ typedef GUID UUID;
 #define TRUE 1
 #define FALSE 0
 
+#define RPC_FC_MODULE   0xfc
 #define RPC_FC_COCLASS  0xfd
 #define RPC_FC_FUNCTION 0xfe
 




More information about the wine-cvs mailing list