Alexandre Julliard : widl: Output some comments for proc format strings.

Alexandre Julliard julliard at winehq.org
Fri Oct 22 12:30:43 CDT 2010


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sat Oct 16 12:37:39 2010 +0200

widl: Output some comments for proc format strings.

---

 tools/widl/typegen.c |   32 +++++++++++++++++++++-----------
 tools/widl/typegen.h |    1 -
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 717e2c8..fdc0989 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -823,7 +823,6 @@ int decl_indirect(const type_t *t)
 }
 
 static unsigned int write_procformatstring_type(FILE *file, int indent,
-                                                const char *name,
                                                 const type_t *type,
                                                 const attr_list_t *attrs,
                                                 int is_return)
@@ -873,13 +872,15 @@ static unsigned int write_procformatstring_type(FILE *file, int indent,
             print_file(file, indent, "0x4d,    /* FC_IN_PARAM */\n");
 
         print_file(file, indent, "0x01,\n");
-        print_file(file, indent, "NdrFcShort(0x%hx),\n", (unsigned short)type->typestring_offset);
+        print_file(file, indent, "NdrFcShort(0x%x),	/* type offset = %u */\n",
+                   type->typestring_offset, type->typestring_offset);
         size = 4; /* includes param type prefix */
     }
     return size;
 }
 
-static void write_procformatstring_stmts(FILE *file, int indent, const statement_list_t *stmts, type_pred_t pred)
+static void write_procformatstring_stmts(FILE *file, int indent, const statement_list_t *stmts,
+                                         type_pred_t pred, unsigned int *offset)
 {
     const statement_t *stmt;
     if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
@@ -898,27 +899,36 @@ static void write_procformatstring_stmts(FILE *file, int indent, const statement
                 {
                     const var_t *var;
                     LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
-                        write_procformatstring_type(file, indent, var->name, var->type, var->attrs, FALSE);
+                    {
+                        print_file( file, 0, "/* %u (parameter %s) */\n", *offset, var->name );
+                        *offset += write_procformatstring_type(file, indent, var->type, var->attrs, FALSE);
+                    }
                 }
 
                 /* emit return value data */
                 if (is_void(type_function_get_rettype(func->type)))
                 {
+                    print_file( file, 0, "/* %u (void) */\n", *offset );
                     print_file(file, indent, "0x5b,    /* FC_END */\n");
                     print_file(file, indent, "0x5c,    /* FC_PAD */\n");
+                    *offset += 2;
                 }
                 else
-                    write_procformatstring_type(file, indent, "return value", type_function_get_rettype(func->type), NULL, TRUE);
+                {
+                    print_file( file, 0, "/* %u (return value) */\n", *offset );
+                    *offset += write_procformatstring_type(file, indent, type_function_get_rettype(func->type), NULL, TRUE);
+                }
             }
         }
         else if (stmt->type == STMT_LIBRARY)
-            write_procformatstring_stmts(file, indent, stmt->u.lib->stmts, pred);
+            write_procformatstring_stmts(file, indent, stmt->u.lib->stmts, pred, offset);
     }
 }
 
 void write_procformatstring(FILE *file, const statement_list_t *stmts, type_pred_t pred)
 {
     int indent = 0;
+    unsigned int offset = 0;
 
     print_file(file, indent, "static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =\n");
     print_file(file, indent, "{\n");
@@ -927,7 +937,7 @@ void write_procformatstring(FILE *file, const statement_list_t *stmts, type_pred
     print_file(file, indent, "{\n");
     indent++;
 
-    write_procformatstring_stmts(file, indent, stmts, pred);
+    write_procformatstring_stmts(file, indent, stmts, pred, &offset);
 
     print_file(file, indent, "0x0\n");
     indent--;
@@ -3857,9 +3867,9 @@ void write_remoting_arguments(FILE *file, int indent, const var_t *func, const c
 }
 
 
-unsigned int get_size_procformatstring_type(const char *name, const type_t *type, const attr_list_t *attrs)
+static unsigned int get_size_procformatstring_type(const type_t *type, const attr_list_t *attrs)
 {
-    return write_procformatstring_type(NULL, 0, name, type, attrs, FALSE);
+    return write_procformatstring_type(NULL, 0, type, attrs, FALSE);
 }
 
 
@@ -3871,13 +3881,13 @@ unsigned int get_size_procformatstring_func(const var_t *func)
     /* argument list size */
     if (type_get_function_args(func->type))
         LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
-            size += get_size_procformatstring_type(var->name, var->type, var->attrs);
+            size += get_size_procformatstring_type(var->type, var->attrs);
 
     /* return value size */
     if (is_void(type_function_get_rettype(func->type)))
         size += 2; /* FC_END and FC_PAD */
     else
-        size += get_size_procformatstring_type("return value", type_function_get_rettype(func->type), NULL);
+        size += get_size_procformatstring_type(type_function_get_rettype(func->type), NULL);
 
     return size;
 }
diff --git a/tools/widl/typegen.h b/tools/widl/typegen.h
index 57a914a..e519ee0 100644
--- a/tools/widl/typegen.h
+++ b/tools/widl/typegen.h
@@ -69,7 +69,6 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
                           enum pass pass, const var_t *var, const char *varname);
 void write_remoting_arguments(FILE *file, int indent, const var_t *func, const char *local_var_prefix,
                               enum pass pass, enum remoting_phase phase);
-unsigned int get_size_procformatstring_type(const char *name, const type_t *type, const attr_list_t *attrs);
 unsigned int get_size_procformatstring_func(const var_t *func);
 unsigned int get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred);
 unsigned int get_size_typeformatstring(const statement_list_t *stmts, type_pred_t pred);




More information about the wine-cvs mailing list