Dan Hipschman : widl: Implement pointer_default functionality.

Alexandre Julliard julliard at winehq.org
Tue Oct 9 13:37:40 CDT 2007


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

Author: Dan Hipschman <dsh at linux.ucla.edu>
Date:   Mon Oct  8 16:46:23 2007 -0700

widl: Implement pointer_default functionality.

---

 tools/widl/parser.h    |    6 ++++++
 tools/widl/parser.y    |   23 +++++++++++++++--------
 tools/widl/typelib.c   |    4 ++++
 tools/widl/widltypes.h |    2 ++
 4 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/tools/widl/parser.h b/tools/widl/parser.h
index 5baf655..c46364a 100644
--- a/tools/widl/parser.h
+++ b/tools/widl/parser.h
@@ -21,6 +21,12 @@
 #ifndef __WIDL_PARSER_H
 #define __WIDL_PARSER_H
 
+typedef struct
+{
+  type_t *interface;
+  unsigned char old_pointer_default;
+} interface_info_t;
+
 int parser_parse(void);
 
 extern FILE *parser_in;
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 8399b40..68ef0cb 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -155,6 +155,7 @@ static void check_all_user_types(ifref_list_t *ifaces);
 	UUID *uuid;
 	unsigned int num;
 	double dbl;
+	interface_info_t ifinfo;
 }
 
 %token <str> aIDENTIFIER
@@ -247,7 +248,8 @@ static void check_all_user_types(ifref_list_t *ifaces);
 %type <expr> m_expr expr expr_const
 %type <expr_list> m_exprs /* exprs expr_list */ expr_list_const
 %type <array_dims> array array_list
-%type <type> inherit interface interfacehdr interfacedef interfacedec
+%type <ifinfo> interfacehdr
+%type <type> inherit interface interfacedef interfacedec
 %type <type> dispinterface dispinterfacehdr dispinterfacedef
 %type <type> module modulehdr moduledef
 %type <type> base_type int_std
@@ -795,32 +797,37 @@ interface: tINTERFACE aIDENTIFIER		{ $$ = get_type(RPC_FC_IP, $2, 0); $$->kind =
 	|  tINTERFACE aKNOWNTYPE		{ $$ = get_type(RPC_FC_IP, $2, 0); $$->kind = TKIND_INTERFACE; }
 	;
 
-interfacehdr: attributes interface		{ $$ = $2;
-						  if ($$->defined) yyerror("multiple definition error");
-						  $$->attrs = $1;
-						  $$->defined = TRUE;
-						  if (!parse_only && do_header) write_forward($$);
+interfacehdr: attributes interface		{ $$.interface = $2;
+						  $$.old_pointer_default = pointer_default;
+						  if (is_attr($1, ATTR_POINTERDEFAULT))
+						    pointer_default = get_attrv($1, ATTR_POINTERDEFAULT);
+						  if ($2->defined) yyerror("multiple definition error");
+						  $2->attrs = $1;
+						  $2->defined = TRUE;
+						  if (!parse_only && do_header) write_forward($2);
 						}
 	;
 
 interfacedef: interfacehdr inherit
-	  '{' int_statements '}'		{ $$ = $1;
+	  '{' int_statements '}'		{ $$ = $1.interface;
 						  $$->ref = $2;
 						  $$->funcs = $4;
 						  compute_method_indexes($$);
 						  if (!parse_only && do_header) write_interface($$);
 						  if (!parse_only && do_idfile) write_iid($$);
+						  pointer_default = $1.old_pointer_default;
 						}
 /* MIDL is able to import the definition of a base class from inside the
  * definition of a derived class, I'll try to support it with this rule */
 	| interfacehdr ':' aIDENTIFIER
-	  '{' import int_statements '}'		{ $$ = $1;
+	  '{' import int_statements '}'		{ $$ = $1.interface;
 						  $$->ref = find_type2($3, 0);
 						  if (!$$->ref) yyerror("base class '%s' not found in import", $3);
 						  $$->funcs = $6;
 						  compute_method_indexes($$);
 						  if (!parse_only && do_header) write_interface($$);
 						  if (!parse_only && do_idfile) write_iid($$);
+						  pointer_default = $1.old_pointer_default;
 						}
 	| dispinterfacedef			{ $$ = $1; }
 	;
diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c
index 7afeef6..5341720 100644
--- a/tools/widl/typelib.c
+++ b/tools/widl/typelib.c
@@ -252,6 +252,9 @@ void start_typelib(char *name, attr_list_t *attrs)
     typelib->attrs = attrs;
     list_init( &typelib->entries );
     list_init( &typelib->importlibs );
+
+    if (is_attr(attrs, ATTR_POINTERDEFAULT))
+        pointer_default = get_attrv(attrs, ATTR_POINTERDEFAULT);
 }
 
 void end_typelib(void)
@@ -260,6 +263,7 @@ void end_typelib(void)
     if (!typelib) return;
 
     create_msft_typelib(typelib);
+    pointer_default = RPC_FC_UP;
     return;
 }
 
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 5dc634c..a7e8d59 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -307,6 +307,8 @@ struct _user_type_t {
     const char *name;
 };
 
+extern unsigned char pointer_default;
+
 extern user_type_list_t user_type_list;
 void check_for_user_types_and_context_handles(const var_list_t *list);
 




More information about the wine-cvs mailing list