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

Alexandre Julliard julliard at winehq.org
Thu Jun 2 11:22:58 CDT 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Jun  1 21:00:56 2011 +0200

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

---

 tools/widl/typegen.c   |    2 +-
 tools/widl/widl.c      |   13 +++++++++++--
 tools/widl/widl.h      |    8 ++++++++
 tools/widl/widl.man.in |    6 ++++++
 4 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 6dcdf36..50a047d 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -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( iface->attrs, ATTR_OPTIMIZE ))) return !strcmp( str, "i" );
-    return 0;
+    return (stub_mode != MODE_Os);
 }
 
 static void write_procformatstring_func( FILE *file, int indent,
diff --git a/tools/widl/widl.c b/tools/widl/widl.c
index 5046d65..62c1008 100644
--- a/tools/widl/widl.c
+++ b/tools/widl/widl.c
@@ -46,7 +46,6 @@
 /* future options to reserve characters for: */
 /* A = ACF input filename */
 /* J = do not search standard include path */
-/* O = generate interpreted stubs */
 /* w = select win16/win32 output (?) */
 
 static const char usage[] =
@@ -65,6 +64,7 @@ static const char usage[] =
 "   -N                 Do not preprocess input\n"
 "   --oldnames         Use old naming conventions\n"
 "   -o, --output=NAME  Set the output file name\n"
+"   -Otype             Type of stubs to generate (-Os, -Oi, -Oif)\n"
 "   -p                 Generate proxy\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"
@@ -111,6 +111,7 @@ int do_win32 = 1;
 int do_win64 = 1;
 int win32_packing = 8;
 int win64_packing = 8;
+enum stub_mode stub_mode = MODE_Os;
 
 char *input_name;
 char *header_name;
@@ -156,7 +157,7 @@ enum {
 };
 
 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[] = {
     { "dlldata", 1, NULL, DLLDATA_OPTION },
     { "dlldata-only", 0, NULL, DLLDATA_ONLY_OPTION },
@@ -582,6 +583,14 @@ int main(int argc,char *argv[])
     case 'o':
       output_name = xstrdup(optarg);
       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':
       do_everything = 0;
       do_proxies = 1;
diff --git a/tools/widl/widl.h b/tools/widl/widl.h
index fcd479d..a793bfc 100644
--- a/tools/widl/widl.h
+++ b/tools/widl/widl.h
@@ -72,6 +72,14 @@ extern time_t now;
 extern int line_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_id_data(const statement_list_t *stmts);
 extern void write_proxies(const statement_list_t *stmts);
diff --git a/tools/widl/widl.man.in b/tools/widl/widl.man.in
index 3bbc1cf..4988ee9 100644
--- a/tools/widl/widl.man.in
+++ b/tools/widl/widl.man.in
@@ -59,6 +59,12 @@ Generate a UUID file. The default output filename is \fIinfile\fB_i.c\fR.
 .B Proxy/stub generation options:
 .IP "\fB-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"
 Generate a proxy. The default output filename is \fIinfile\fB_p.c\fR.
 .IP "\fB--prefix-all=\fIprefix\fR"




More information about the wine-cvs mailing list