From 2c7270e388e8e3ea6448fc98c5ee31e7dbc6ed7e Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 22 Apr 2006 21:52:51 +0200 Subject: [PATCH] widl: Implement 'oldnames' option. --- tools/widl/client.c | 8 ++++++-- tools/widl/header.c | 12 ++++++++++-- tools/widl/server.c | 8 ++++++-- tools/widl/widl.c | 19 +++++++++++++++++-- tools/widl/widl.h | 1 + tools/widl/widl.man.in | 2 ++ 6 files changed, 42 insertions(+), 8 deletions(-) diff --git a/tools/widl/client.c b/tools/widl/client.c index ea40d5eb67f..6c00693cbcd 100644 --- a/tools/widl/client.c +++ b/tools/widl/client.c @@ -402,8 +402,12 @@ static void write_clientinterfacedecl(type_t *iface) print_client("0,\n"); indent--; print_client("};\n"); - print_client("RPC_IF_HANDLE %s_v%d_%d_c_ifspec = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n", - iface->name, LOWORD(ver), HIWORD(ver), iface->name); + if (old_names) + print_client("RPC_IF_HANDLE %s_ClientIfHandle = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n", + iface->name, iface->name); + else + print_client("RPC_IF_HANDLE %s_v%d_%d_c_ifspec = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n", + iface->name, LOWORD(ver), HIWORD(ver), iface->name); fprintf(client, "\n"); } diff --git a/tools/widl/header.c b/tools/widl/header.c index c4f3a266080..0f391042221 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -934,8 +934,16 @@ static void write_rpc_interface(const type_t *iface) { write_iface_guid(iface); if (var) fprintf(header, "extern handle_t %s;\n", var); - fprintf(header, "extern RPC_IF_HANDLE %s_v%d_%d_c_ifspec;\n", iface->name, LOWORD(ver), HIWORD(ver)); - fprintf(header, "extern RPC_IF_HANDLE %s_v%d_%d_s_ifspec;\n", iface->name, LOWORD(ver), HIWORD(ver)); + if (old_names) + { + fprintf(header, "extern RPC_IF_HANDLE %s_ClientIfHandle;\n", iface->name); + fprintf(header, "extern RPC_IF_HANDLE %s_ServerIfHandle;\n", iface->name); + } + else + { + fprintf(header, "extern RPC_IF_HANDLE %s_v%d_%d_c_ifspec;\n", iface->name, LOWORD(ver), HIWORD(ver)); + fprintf(header, "extern RPC_IF_HANDLE %s_v%d_%d_s_ifspec;\n", iface->name, LOWORD(ver), HIWORD(ver)); + } write_function_proto(iface); } fprintf(header,"\n#endif /* __%s_INTERFACE_DEFINED__ */\n\n", iface->name); diff --git a/tools/widl/server.c b/tools/widl/server.c index fc9051d092f..f02c1462155 100644 --- a/tools/widl/server.c +++ b/tools/widl/server.c @@ -548,8 +548,12 @@ static void write_serverinterfacedecl(type_t *iface) print_server("0,\n"); indent--; print_server("};\n"); - print_server("RPC_IF_HANDLE %s_v%d_%d_s_ifspec = (RPC_IF_HANDLE)& %s___RpcServerInterface;\n", - iface->name, LOWORD(ver), HIWORD(ver), iface->name); + if (old_names) + print_server("RPC_IF_HANDLE %s_ServerIfHandle = (RPC_IF_HANDLE)& %s___RpcServerInterface;\n", + iface->name, iface->name); + else + print_server("RPC_IF_HANDLE %s_v%d_%d_s_ifspec = (RPC_IF_HANDLE)& %s___RpcServerInterface;\n", + iface->name, LOWORD(ver), HIWORD(ver), iface->name); fprintf(server, "\n"); } diff --git a/tools/widl/widl.c b/tools/widl/widl.c index 765fe06f421..f26f40de00b 100644 --- a/tools/widl/widl.c +++ b/tools/widl/widl.c @@ -31,6 +31,9 @@ #include #include #include +#ifdef HAVE_GETOPT_H +# include +#endif #include "widl.h" #include "utils.h" @@ -58,6 +61,7 @@ static char usage[] = " -H file Name of header file (default is infile.h)\n" " -I path Set include search dir to path (multiple -I allowed)\n" " -N Do not preprocess input\n" +" --oldnames Use old naming conventions\n" " -p Generate proxy\n" " -P file Name of proxy file (default is infile_p.c)\n" " -s Generate server stub\n" @@ -91,6 +95,7 @@ int do_proxies = 0; int do_client = 0; int do_server = 0; int no_preprocess = 0; +int old_names = 0; char *input_name; char *header_name; @@ -111,7 +116,13 @@ FILE *proxy; time_t now; -int getopt (int argc, char *const *argv, const char *optstring); +static const char *short_options = + "cC:d:D:EhH:I:NpP:sS:tT:VW"; +static struct option long_options[] = { + { "oldnames", 0, 0, 1 }, + { 0, 0, 0, 0 } +}; + static void rm_tempfile(void); static void segvhandler(int sig); @@ -147,13 +158,17 @@ int main(int argc,char *argv[]) extern int optind; int optc; int ret = 0; + int opti = 0; signal(SIGSEGV, segvhandler); now = time(NULL); - while((optc = getopt(argc, argv, "cC:d:D:EhH:I:NpP:sS:tT:VW")) != EOF) { + while((optc = getopt_long(argc, argv, short_options, long_options, &opti)) != EOF) { switch(optc) { + case 1: + old_names = 1; + break; case 'c': do_everything = 0; do_client = 1; diff --git a/tools/widl/widl.h b/tools/widl/widl.h index 5b303c35369..db8b95cc396 100644 --- a/tools/widl/widl.h +++ b/tools/widl/widl.h @@ -43,6 +43,7 @@ extern int do_typelib; extern int do_proxies; extern int do_client; extern int do_server; +extern int old_names; extern char *input_name; extern char *header_name; diff --git a/tools/widl/widl.man.in b/tools/widl/widl.man.in index 98684671435..267f1fecc44 100644 --- a/tools/widl/widl.man.in +++ b/tools/widl/widl.man.in @@ -24,6 +24,8 @@ Generate header files. .IP "\fB-H \fIfile\fR" Name of header file to generate. The default header filename is infile.h. +.IP "\fB--oldnames\fR" +Use old naming conventions. .PP .B Type library options: .IP \fB-t\fR