Rob Shearman : widl: iid_is should take expressions, not just identifiers.

Alexandre Julliard julliard at winehq.org
Mon Dec 10 08:54:31 CST 2007


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

Author: Rob Shearman <rob at codeweavers.com>
Date:   Mon Dec 10 13:30:48 2007 +0000

widl: iid_is should take expressions, not just identifiers.

---

 tools/widl/parser.y  |    2 +-
 tools/widl/proxy.c   |   12 ++++++++----
 tools/widl/typegen.c |   26 ++++++++++++++------------
 3 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index ffeca26..0a8af54 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -470,7 +470,7 @@ attribute:					{ $$ = NULL; }
 	| tHIDDEN				{ $$ = make_attr(ATTR_HIDDEN); }
 	| tID '(' expr_const ')'		{ $$ = make_attrp(ATTR_ID, $3); }
 	| tIDEMPOTENT				{ $$ = make_attr(ATTR_IDEMPOTENT); }
-	| tIIDIS '(' ident ')'			{ $$ = make_attrp(ATTR_IIDIS, $3); }
+	| tIIDIS '(' expr ')'			{ $$ = make_attrp(ATTR_IIDIS, $3); }
 	| tIMMEDIATEBIND			{ $$ = make_attr(ATTR_IMMEDIATEBIND); }
 	| tIMPLICITHANDLE '(' tHANDLET aIDENTIFIER ')'	{ $$ = make_attrp(ATTR_IMPLICIT_HANDLE, $4); }
 	| tIN					{ $$ = make_attr(ATTR_IN); }
diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c
index 8a81885..c940474 100644
--- a/tools/widl/proxy.c
+++ b/tools/widl/proxy.c
@@ -188,7 +188,7 @@ static void proxy_check_pointers( const var_list_t *args )
 static void free_variable( const var_t *arg )
 {
   unsigned int type_offset = arg->type->typestring_offset;
-  var_t *constraint;
+  expr_t *iid;
   type_t *type = arg->type;
   expr_t *size = get_size_is_expr(type, arg->name);
 
@@ -219,9 +219,13 @@ static void free_variable( const var_t *arg )
 
   case RPC_FC_FP:
   case RPC_FC_IP:
-    constraint = get_attrp( arg->attrs, ATTR_IIDIS );
-    if( constraint )
-      print_proxy( "_StubMsg.MaxCount = (unsigned long) ( %s );\n",constraint->name);
+    iid = get_attrp( arg->attrs, ATTR_IIDIS );
+    if( iid )
+    {
+      print_proxy( "_StubMsg.MaxCount = (unsigned long) " );
+      write_expr(proxy, iid, 1);
+      print_proxy( ";\n\n" );
+    }
     print_proxy( "NdrClearOutParameters( &_StubMsg, ");
     fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset );
     fprintf(proxy, "(void*)%s );\n", arg->name );
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 1988f36..5043bd5 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -1972,20 +1972,14 @@ static size_t write_ip_tfs(FILE *file, const attr_list_t *attrs, type_t *type,
 {
     size_t i;
     size_t start_offset = *typeformat_offset;
-    const var_t *iid = get_attrp(attrs, ATTR_IIDIS);
+    expr_t *iid = get_attrp(attrs, ATTR_IIDIS);
 
     if (iid)
     {
-        expr_t expr;
-
-        expr.type = EXPR_IDENTIFIER;
-        expr.ref  = NULL;
-        expr.u.sval = iid->name;
-        expr.is_const = FALSE;
         print_file(file, 2, "0x2f,  /* FC_IP */\n");
         print_file(file, 2, "0x5c,  /* FC_PAD */\n");
         *typeformat_offset
-            += write_conf_or_var_desc(file, NULL, 0, type, &expr) + 2;
+            += write_conf_or_var_desc(file, NULL, 0, type, iid) + 2;
     }
     else
     {
@@ -2839,9 +2833,13 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func,
                 }
                 else
                 {
-                    const var_t *iid;
+                    expr_t *iid;
                     if ((iid = get_attrp( var->attrs, ATTR_IIDIS )))
-                        print_file( file, indent, "_StubMsg.MaxCount = (unsigned long)%s;\n", iid->name );
+                    {
+                        print_file( file, indent, "_StubMsg.MaxCount = (unsigned long) " );
+                        write_expr( file, iid, 1 );
+                        fprintf( file, ";\n\n" );
+                    }
                     print_phase_function(file, indent, "Pointer", phase, var, start_offset);
                 }
                 break;
@@ -2862,11 +2860,15 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func,
             }
             else
             {
-                const var_t *iid;
+                expr_t *iid;
                 expr_t *sx = get_size_is_expr(type, var->name);
 
                 if ((iid = get_attrp( var->attrs, ATTR_IIDIS )))
-                    print_file( file, indent, "_StubMsg.MaxCount = (unsigned long)%s;\n", iid->name );
+                {
+                    print_file( file, indent, "_StubMsg.MaxCount = (unsigned long) " );
+                    write_expr( file, iid, 1 );
+                    fprintf( file, ";\n\n" );
+                }
                 else if (sx)
                 {
                     print_file(file, indent, "_StubMsg.MaxCount = (unsigned long) ");




More information about the wine-cvs mailing list