Jacek Caban : widl: Define PROXY_DELEGATION in dlldata.c when needed.

Alexandre Julliard julliard at winehq.org
Thu Nov 1 14:42:58 CDT 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Nov  1 12:27:32 2012 +0100

widl: Define PROXY_DELEGATION in dlldata.c when needed.

---

 tools/widl/header.h |    1 +
 tools/widl/proxy.c  |    7 ++++++-
 tools/widl/widl.c   |   14 +++++++++++---
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/tools/widl/header.h b/tools/widl/header.h
index 6d056db..bf5f426 100644
--- a/tools/widl/header.h
+++ b/tools/widl/header.h
@@ -47,6 +47,7 @@ extern int need_proxy(const type_t *iface);
 extern int need_inline_stubs(const type_t *iface);
 extern int need_stub_files(const statement_list_t *stmts);
 extern int need_proxy_file(const statement_list_t *stmts);
+extern int need_proxy_delegation(const statement_list_t *stmts);
 extern int need_inline_stubs_file(const statement_list_t *stmts);
 extern const var_t *is_callas(const attr_list_t *list);
 extern void write_args(FILE *h, const var_list_t *arg, const char *name, int obj, int do_indent);
diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c
index e0690e4..0c0d7ce 100644
--- a/tools/widl/proxy.c
+++ b/tools/widl/proxy.c
@@ -778,7 +778,12 @@ int need_stub(const type_t *iface)
 
 int need_proxy_file(const statement_list_t *stmts)
 {
-  return does_any_iface(stmts, need_proxy);
+    return does_any_iface(stmts, need_proxy);
+}
+
+int need_proxy_delegation(const statement_list_t *stmts)
+{
+    return does_any_iface(stmts, need_delegation);
 }
 
 int need_inline_stubs(const type_t *iface)
diff --git a/tools/widl/widl.c b/tools/widl/widl.c
index fc3d0d9..8186b77 100644
--- a/tools/widl/widl.c
+++ b/tools/widl/widl.c
@@ -340,7 +340,7 @@ static void free_filename_nodes(struct list *list)
   }
 }
 
-static void write_dlldata_list(struct list *filenames)
+static void write_dlldata_list(struct list *filenames, int define_proxy_delegation)
 {
   FILE *dlldata;
   filename_node_t *node;
@@ -351,6 +351,8 @@ static void write_dlldata_list(struct list *filenames)
 
   fprintf(dlldata, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION);
   fprintf(dlldata, "- Do not edit ***/\n\n");
+  if (define_proxy_delegation)
+      fprintf(dlldata, "#define PROXY_DELEGATION\n");
   fprintf(dlldata, "#include <objbase.h>\n");
   fprintf(dlldata, "#include <rpcproxy.h>\n\n");
   start_cplusplus_guard(dlldata);
@@ -380,15 +382,19 @@ static char *eat_space(char *s)
 void write_dlldata(const statement_list_t *stmts)
 {
   struct list filenames = LIST_INIT(filenames);
+  int define_proxy_delegation = 0;
   filename_node_t *node;
   FILE *dlldata;
 
   if (!do_dlldata || !need_proxy_file(stmts))
     return;
 
+  define_proxy_delegation = need_proxy_delegation(stmts);
+
   dlldata = fopen(dlldata_name, "r");
   if (dlldata) {
     static char marker[] = "REFERENCE_PROXY_FILE";
+    static const char delegation_define[] = "#define PROXY_DELEGATION";
     char *line = NULL;
     size_t len = 0;
 
@@ -409,6 +415,8 @@ void write_dlldata(const statement_list_t *stmts)
         *end = '\0';
         if (start < end)
           add_filename_node(&filenames, start);
+      }else if (!define_proxy_delegation && strncmp(start, delegation_define, sizeof(delegation_define)-1)) {
+          define_proxy_delegation = 1;
       }
     }
 
@@ -427,7 +435,7 @@ void write_dlldata(const statement_list_t *stmts)
     }
 
   add_filename_node(&filenames, proxy_token);
-  write_dlldata_list(&filenames);
+  write_dlldata_list(&filenames, define_proxy_delegation);
   free_filename_nodes(&filenames);
 }
 
@@ -676,7 +684,7 @@ int main(int argc,char *argv[])
       for ( ; optind < argc; ++optind)
         add_filename_node(&filenames, argv[optind]);
 
-      write_dlldata_list(&filenames);
+      write_dlldata_list(&filenames, 0 /* FIXME */ );
       free_filename_nodes(&filenames);
       return 0;
     }




More information about the wine-cvs mailing list