widl: Add a -O option to specify stub style.

This commit is contained in:
Alexandre Julliard 2011-06-01 21:00:56 +02:00
parent 2db27725bf
commit 6ae510050b
4 changed files with 26 additions and 3 deletions

View File

@ -962,7 +962,7 @@ int is_interpreted_func( const type_t *iface, const var_t *func )
if ((str = get_attrp( func->attrs, ATTR_OPTIMIZE ))) return !strcmp( str, "i" ); if ((str = get_attrp( func->attrs, ATTR_OPTIMIZE ))) return !strcmp( str, "i" );
if ((str = get_attrp( iface->attrs, ATTR_OPTIMIZE ))) return !strcmp( str, "i" ); if ((str = get_attrp( iface->attrs, ATTR_OPTIMIZE ))) return !strcmp( str, "i" );
return 0; return (stub_mode != MODE_Os);
} }
static void write_procformatstring_func( FILE *file, int indent, static void write_procformatstring_func( FILE *file, int indent,

View File

@ -46,7 +46,6 @@
/* future options to reserve characters for: */ /* future options to reserve characters for: */
/* A = ACF input filename */ /* A = ACF input filename */
/* J = do not search standard include path */ /* J = do not search standard include path */
/* O = generate interpreted stubs */
/* w = select win16/win32 output (?) */ /* w = select win16/win32 output (?) */
static const char usage[] = static const char usage[] =
@ -65,6 +64,7 @@ static const char usage[] =
" -N Do not preprocess input\n" " -N Do not preprocess input\n"
" --oldnames Use old naming conventions\n" " --oldnames Use old naming conventions\n"
" -o, --output=NAME Set the output file name\n" " -o, --output=NAME Set the output file name\n"
" -Otype Type of stubs to generate (-Os, -Oi, -Oif)\n"
" -p Generate proxy\n" " -p Generate proxy\n"
" --prefix-all=p Prefix names of client stubs / server functions with 'p'\n" " --prefix-all=p Prefix names of client stubs / server functions with 'p'\n"
" --prefix-client=p Prefix names of client stubs with 'p'\n" " --prefix-client=p Prefix names of client stubs with 'p'\n"
@ -111,6 +111,7 @@ int do_win32 = 1;
int do_win64 = 1; int do_win64 = 1;
int win32_packing = 8; int win32_packing = 8;
int win64_packing = 8; int win64_packing = 8;
enum stub_mode stub_mode = MODE_Os;
char *input_name; char *input_name;
char *header_name; char *header_name;
@ -156,7 +157,7 @@ enum {
}; };
static const char short_options[] = static const char short_options[] =
"b:cC:d:D:EhH:I:m:No:pP:rsS:tT:uU:VW"; "b:cC:d:D:EhH:I:m:No:O:pP:rsS:tT:uU:VW";
static const struct option long_options[] = { static const struct option long_options[] = {
{ "dlldata", 1, NULL, DLLDATA_OPTION }, { "dlldata", 1, NULL, DLLDATA_OPTION },
{ "dlldata-only", 0, NULL, DLLDATA_ONLY_OPTION }, { "dlldata-only", 0, NULL, DLLDATA_ONLY_OPTION },
@ -582,6 +583,14 @@ int main(int argc,char *argv[])
case 'o': case 'o':
output_name = xstrdup(optarg); output_name = xstrdup(optarg);
break; break;
case 'O':
if (!strcmp( optarg, "s" )) stub_mode = MODE_Os;
else if (!strcmp( optarg, "i" )) stub_mode = MODE_Oi;
else if (!strcmp( optarg, "ic" )) stub_mode = MODE_Oif;
else if (!strcmp( optarg, "if" )) stub_mode = MODE_Oif;
else if (!strcmp( optarg, "icf" )) stub_mode = MODE_Oif;
else error( "Invalid argument '-O%s'\n", optarg );
break;
case 'p': case 'p':
do_everything = 0; do_everything = 0;
do_proxies = 1; do_proxies = 1;

View File

@ -72,6 +72,14 @@ extern time_t now;
extern int line_number; extern int line_number;
extern int char_number; extern int char_number;
enum stub_mode
{
MODE_Os, /* inline stubs */
MODE_Oi, /* old-style interpreted stubs */
MODE_Oif /* new-style fully interpreted stubs */
};
extern enum stub_mode stub_mode;
extern void write_header(const statement_list_t *stmts); extern void write_header(const statement_list_t *stmts);
extern void write_id_data(const statement_list_t *stmts); extern void write_id_data(const statement_list_t *stmts);
extern void write_proxies(const statement_list_t *stmts); extern void write_proxies(const statement_list_t *stmts);

View File

@ -59,6 +59,12 @@ Generate a UUID file. The default output filename is \fIinfile\fB_i.c\fR.
.B Proxy/stub generation options: .B Proxy/stub generation options:
.IP "\fB-c\fR" .IP "\fB-c\fR"
Generate a client stub file. The default output filename is \fIinfile\fB_c.c\fR. Generate a client stub file. The default output filename is \fIinfile\fB_c.c\fR.
.IP "\fB-Os\fR"
Generate inline stubs.
.IP "\fB-Oi\fR"
Generate old-style interpreted stubs.
.IP "\fB-Oif, -Oic, -Oicf\fR"
Generate new-style fully interpreted stubs.
.IP "\fB-p\fR" .IP "\fB-p\fR"
Generate a proxy. The default output filename is \fIinfile\fB_p.c\fR. Generate a proxy. The default output filename is \fIinfile\fB_p.c\fR.
.IP "\fB--prefix-all=\fIprefix\fR" .IP "\fB--prefix-all=\fIprefix\fR"