widl: Little cleanup using new write_header_autogen()

Elrond elrond+winehq.org at samba-tng.org
Thu Aug 10 10:36:58 CDT 2006


Add a new write_header_autogen() function, which creates
the common "This file is autogenerated" header.
Use it everywhere.

This fixes inconsistent headers.
---
 tools/widl/client.c |    2 +-
 tools/widl/header.c |    6 ++++++
 tools/widl/header.h |    1 +
 tools/widl/proxy.c  |    3 ++-
 tools/widl/server.c |    2 +-
 tools/widl/widl.c   |    5 ++---
 6 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/tools/widl/client.c b/tools/widl/client.c
index 6f8773e..2f53d9d 100644
--- a/tools/widl/client.c
+++ b/tools/widl/client.c
@@ -451,7 +451,7 @@ static void init_client(void)
     if (!(client = fopen(client_name, "w")))
         error("Could not open %s for output\n", client_name);
 
-    print_client("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", WIDL_FULLVERSION, input_name);
+    write_header_autogen(client);
     print_client("#include <string.h>\n");
     print_client("#ifdef _ALPHA_\n");
     print_client("#include <stdarg.h>\n");
diff --git a/tools/widl/header.c b/tools/widl/header.c
index 6344fb3..1145ca0 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -80,6 +80,12 @@ int is_void(const type_t *t, const var_t
   return 0;
 }
 
+void write_header_autogen(FILE *f)
+{
+  fprintf(f, "/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n",
+        WIDL_FULLVERSION, input_name);
+}
+
 void write_guid(FILE *f, const char *guid_prefix, const char *name, const UUID *uuid)
 {
   if (!uuid) return;
diff --git a/tools/widl/header.h b/tools/widl/header.h
index 6358d98..0308746 100644
--- a/tools/widl/header.h
+++ b/tools/widl/header.h
@@ -48,6 +48,7 @@ extern const var_t* get_explicit_handle_
 extern int has_out_arg_or_return(const func_t *func);
 extern void write_guid(FILE *f, const char *guid_prefix, const char *name,
                        const UUID *uuid);
+extern void write_header_autogen(FILE *f);
 
 static inline int is_string_type(const attr_t *attrs, int ptr_level, const expr_t *array)
 {
diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c
index 1710cdc..127b8fe 100644
--- a/tools/widl/proxy.c
+++ b/tools/widl/proxy.c
@@ -147,7 +147,8 @@ static void init_proxy(void)
   if (proxy) return;
   if(!(proxy = fopen(proxy_name, "w")))
     error("Could not open %s for output\n", proxy_name);
-  print_proxy( "/*** Autogenerated by WIDL %s - Do not edit ***/\n", WIDL_FULLVERSION);
+
+  write_header_autogen(proxy);
   print_proxy( "\n");
   print_proxy( "#ifndef __REDQ_RPCPROXY_H_VERSION__\n");
   print_proxy( "#define __REQUIRED_RPCPROXY_H_VERSION__ 440\n");
diff --git a/tools/widl/server.c b/tools/widl/server.c
index 72d5ae7..49e7d94 100644
--- a/tools/widl/server.c
+++ b/tools/widl/server.c
@@ -587,7 +587,7 @@ static void init_server(void)
     if (!(server = fopen(server_name, "w")))
         error("Could not open %s for output\n", server_name);
 
-    print_server("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", WIDL_FULLVERSION, input_name);
+    write_header_autogen(server);
     print_server("#include <string.h>\n");
     fprintf(server, "\n");
     print_server("#include \"%s\"\n", header_name);
diff --git a/tools/widl/widl.c b/tools/widl/widl.c
index aac1d5e..f14b08f 100644
--- a/tools/widl/widl.c
+++ b/tools/widl/widl.c
@@ -349,7 +349,7 @@ #endif
       fprintf(stderr, "Could not open %s for output\n", header_name);
       return 1;
     }
-    fprintf(header, "/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
+    write_header_autogen(header);
     fprintf(header, "#include <rpc.h>\n" );
     fprintf(header, "#include <rpcndr.h>\n\n" );
     fprintf(header, "#ifndef __WIDL_%s\n", header_token);
@@ -368,8 +368,7 @@ #endif
       return 1;
     }
 
-    fprintf(idfile, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION);
-    fprintf(idfile, "from %s - Do not edit ***/\n\n", input_name);
+    write_header_autogen(idfile);
     fprintf(idfile, "#include <rpc.h>\n");
     fprintf(idfile, "#include <rpcndr.h>\n\n");
     fprintf(idfile, "#define INITGUID\n");
-- 
1.4.1



More information about the wine-patches mailing list