Alexandre Julliard : widl: Output a list of binding routines in client files.

Alexandre Julliard julliard at winehq.org
Fri May 27 11:03:39 CDT 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri May 27 12:07:29 2011 +0200

widl: Output a list of binding routines in client files.

---

 tools/widl/client.c    |   23 ++++++++++++++++++++++-
 tools/widl/header.c    |    4 +---
 tools/widl/widltypes.h |    3 +++
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/tools/widl/client.c b/tools/widl/client.c
index b5ac0ae..aec379c 100644
--- a/tools/widl/client.c
+++ b/tools/widl/client.c
@@ -351,7 +351,10 @@ static void write_stubdescriptor(type_t *iface, int expr_eval_routines)
     indent--;
     print_client("},\n");
     print_client("0,\n");
-    print_client("0,\n");
+    if (!list_empty( &generic_handle_list ))
+        print_client("BindingRoutines,\n");
+    else
+        print_client("0,\n");
     if (expr_eval_routines)
         print_client("ExprEvalRoutines,\n");
     else
@@ -496,6 +499,23 @@ static void write_client_ifaces(const statement_list_t *stmts, int expr_eval_rou
     }
 }
 
+static void write_generic_handle_routine_list(void)
+{
+    generic_handle_t *gh;
+
+    if (list_empty( &generic_handle_list )) return;
+    print_client( "static const GENERIC_BINDING_ROUTINE_PAIR BindingRoutines[] =\n" );
+    print_client( "{\n" );
+    indent++;
+    LIST_FOR_EACH_ENTRY( gh, &generic_handle_list, generic_handle_t, entry )
+    {
+        print_client( "{ (GENERIC_BINDING_ROUTINE)%s_bind, (GENERIC_UNBIND_ROUTINE)%s_unbind },\n",
+                      gh->name, gh->name );
+    }
+    indent--;
+    print_client( "};\n\n" );
+}
+
 static void write_client_routines(const statement_list_t *stmts)
 {
     unsigned int proc_offset = 0;
@@ -508,6 +528,7 @@ static void write_client_routines(const statement_list_t *stmts)
     expr_eval_routines = write_expr_eval_routines(client, client_token);
     if (expr_eval_routines)
         write_expr_eval_routine_list(client, client_token);
+    write_generic_handle_routine_list();
     write_user_quad_list(client);
 
     write_client_ifaces(stmts, expr_eval_routines, &proc_offset);
diff --git a/tools/widl/header.c b/tools/widl/header.c
index e0322c6..9df03cc 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -36,13 +36,11 @@
 #include "expr.h"
 #include "typetree.h"
 
-typedef struct _user_type_t generic_handle_t;
-
 static int indentation = 0;
 static int is_object_interface = 0;
 user_type_list_t user_type_list = LIST_INIT(user_type_list);
 static context_handle_list_t context_handle_list = LIST_INIT(context_handle_list);
-static struct list generic_handle_list = LIST_INIT(generic_handle_list);
+generic_handle_list_t generic_handle_list = LIST_INIT(generic_handle_list);
 
 static void write_type_def_or_decl(FILE *f, type_t *t, int field, const char *name);
 
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 295ad70..1f3c275 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -48,6 +48,7 @@ typedef struct _importinfo_t importinfo_t;
 typedef struct _typelib_t typelib_t;
 typedef struct _user_type_t user_type_t;
 typedef struct _user_type_t context_handle_t;
+typedef struct _user_type_t generic_handle_t;
 typedef struct _type_list_t type_list_t;
 typedef struct _statement_t statement_t;
 
@@ -60,6 +61,7 @@ typedef struct list ifref_list_t;
 typedef struct list array_dims_t;
 typedef struct list user_type_list_t;
 typedef struct list context_handle_list_t;
+typedef struct list generic_handle_list_t;
 typedef struct list statement_list_t;
 
 enum attr_type
@@ -530,6 +532,7 @@ typedef enum {
 
 extern syskind_t typelib_kind;
 extern user_type_list_t user_type_list;
+extern generic_handle_list_t generic_handle_list;
 void check_for_additional_prototype_types(const var_list_t *list);
 
 void init_types(void);




More information about the wine-cvs mailing list