widl: Implement 'oldnames' option.

This commit is contained in:
Eric Kohl 2006-04-22 21:52:51 +02:00 committed by Alexandre Julliard
parent b64154882c
commit 2c7270e388
6 changed files with 42 additions and 8 deletions

View File

@ -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");
}

View File

@ -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);

View File

@ -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");
}

View File

@ -31,6 +31,9 @@
#include <assert.h>
#include <ctype.h>
#include <signal.h>
#ifdef HAVE_GETOPT_H
# include <getopt.h>
#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;

View File

@ -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;

View File

@ -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