diff --git a/tools/widl/parser.h b/tools/widl/parser.h index 5baf655c64e..c46364aee41 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 8399b400b4f..68ef0cbbfd5 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 aIDENTIFIER @@ -247,7 +248,8 @@ static void check_all_user_types(ifref_list_t *ifaces); %type m_expr expr expr_const %type m_exprs /* exprs expr_list */ expr_list_const %type array array_list -%type inherit interface interfacehdr interfacedef interfacedec +%type interfacehdr +%type inherit interface interfacedef interfacedec %type dispinterface dispinterfacehdr dispinterfacedef %type module modulehdr moduledef %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 7afeef6ffd8..5341720f3c3 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 5dc634c8b0d..a7e8d59a4a4 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);