Author: ekohl
Date: Sat Aug 18 18:37:39 2012
New Revision: 57098

URL: http://svn.reactos.org/svn/reactos?rev=57098&view=rev
Log:
[WIDL]
Sync WIDL to Wine 1.5.11. Part 2 of 2.

Modified:
    trunk/reactos/media/doc/README.WINE
    trunk/reactos/tools/widl/header.c
    trunk/reactos/tools/widl/server.c
    trunk/reactos/tools/widl/typegen.c

Modified: trunk/reactos/media/doc/README.WINE
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=57098&r1=57097&r2=57098&view=diff
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Aug 18 18:37:39 2012
@@ -22,7 +22,7 @@
 The following build tools are shared with Wine.
 
 reactos/tools/unicode             # Synced to Wine-1.5.4
-reactos/tools/widl                # Synced to Wine-1.3.26
+reactos/tools/widl                # Synced to Wine-1.5.11
 reactos/tools/wpp                 # Synced to Wine-1.3.26
 
 The following libraries are shared with Wine.

Modified: trunk/reactos/tools/widl/header.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/header.c?rev=57098&r1=57097&r2=57098&view=diff
==============================================================================
--- trunk/reactos/tools/widl/header.c [iso-8859-1] (original)
+++ trunk/reactos/tools/widl/header.c [iso-8859-1] Sat Aug 18 18:37:39 2012
@@ -816,6 +816,28 @@
   return get_attrp(a, ATTR_CALLAS);
 }
 
+static int is_inherited_method(const type_t *iface, const var_t *func)
+{
+  while ((iface = type_iface_get_inherit(iface)))
+  {
+    const statement_t *stmt;
+    STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface))
+    {
+      const var_t *funccmp = stmt->u.var;
+
+      if (!is_callas(func->attrs))
+      {
+         char inherit_name[256];
+         /* compare full name including property prefix */
+         strcpy(inherit_name, get_name(funccmp));
+         if (!strcmp(inherit_name, get_name(func))) return 1;
+      }
+    }
+  }
+
+  return 0;
+}
+
 static void write_method_macro(FILE *header, const type_t *iface, const char 
*name)
 {
   const statement_t *stmt;
@@ -834,7 +856,7 @@
       first_iface = 0;
     }
 
-    if (!is_callas(func->attrs)) {
+    if (!is_callas(func->attrs) && !is_inherited_method(iface, func)) {
       const var_t *arg;
 
       fprintf(header, "#define %s_%s(This", name, get_name(func));
@@ -876,6 +898,13 @@
         else fprintf(h, ",");
     }
     write_type_decl(h, arg->type, arg->name);
+    if (method == 2) {
+        const expr_t *expr = get_attrp(arg->attrs, ATTR_DEFAULTVALUE);
+        if (expr) {
+            fprintf(h, " = ");
+            write_expr( h, expr, 0, 1, NULL, NULL, "" );
+        }
+    }
     count++;
   }
   if (do_indent) indentation--;
@@ -902,6 +931,43 @@
   }
 }
 
+static void write_inline_wrappers(FILE *header, const type_t *iface, const 
char *name)
+{
+  const statement_t *stmt;
+  int first_iface = 1;
+
+  if (type_iface_get_inherit(iface))
+    write_inline_wrappers(header, type_iface_get_inherit(iface), name);
+
+  STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface))
+  {
+    const var_t *func = stmt->u.var;
+
+    if (first_iface)
+    {
+      fprintf(header, "/*** %s methods ***/\n", iface->name);
+      first_iface = 0;
+    }
+
+    if (!is_callas(func->attrs) && !is_inherited_method(iface, func)) {
+      const var_t *arg;
+
+      fprintf(header, "static FORCEINLINE ");
+      write_type_decl_left(header, type_function_get_rettype(func->type));
+      fprintf(header, " %s_%s(", name, get_name(func));
+      write_args(header, type_get_function_args(func->type), name, 1, FALSE);
+      fprintf(header, ") {\n");
+      fprintf(header, "    %s", is_void(type_function_get_rettype(func->type)) 
? "" : "return ");
+      fprintf(header, "This->lpVtbl->%s(This", get_name(func));
+      if (type_get_function_args(func->type))
+          LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), const 
var_t, entry )
+              fprintf(header, ",%s", arg->name);
+      fprintf(header, ");\n");
+      fprintf(header, "}\n");
+    }
+  }
+}
+
 static void do_write_c_method_def(FILE *header, const type_t *iface, const 
char *name)
 {
   const statement_t *stmt;
@@ -923,7 +989,10 @@
       if (!callconv) callconv = "STDMETHODCALLTYPE";
       indent(header, 0);
       write_type_decl_left(header, type_function_get_rettype(func->type));
-      fprintf(header, " (%s *%s)(\n", callconv, get_name(func));
+      if (is_inherited_method(iface, func))
+        fprintf(header, " (%s *%s_%s)(\n", callconv, iface->name, func->name);
+      else
+        fprintf(header, " (%s *%s)(\n", callconv, get_name(func));
       write_args(header, type_get_function_args(func->type), name, 1, TRUE);
       fprintf(header, ");\n");
       fprintf(header, "\n");
@@ -1150,8 +1219,11 @@
   fprintf(header, "#ifdef COBJMACROS\n");
   /* dispinterfaces don't have real functions, so don't write macros for them,
    * only for the interface this interface inherits from, i.e. IDispatch */
+  fprintf(header, "#ifndef WIDL_C_INLINE_WRAPPERS\n");
   write_method_macro(header, dispinterface ? type_iface_get_inherit(iface) : 
iface, iface->name);
-  fprintf(header, "#endif\n");
+  fprintf(header, "#else\n");
+  write_inline_wrappers(header, dispinterface ? type_iface_get_inherit(iface) 
: iface, iface->name);
+  fprintf(header, "#endif\n");  fprintf(header, "#endif\n");
   fprintf(header, "\n");
   fprintf(header, "#endif\n");
   fprintf(header, "\n");

Modified: trunk/reactos/tools/widl/server.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/server.c?rev=57098&r1=57097&r2=57098&view=diff
==============================================================================
--- trunk/reactos/tools/widl/server.c [iso-8859-1] (original)
+++ trunk/reactos/tools/widl/server.c [iso-8859-1] Sat Aug 18 18:37:39 2012
@@ -175,11 +175,10 @@
                 /* if the context_handle attribute appears in the chain of 
types
                  * without pointers being followed, then the context handle 
must
                  * be direct, otherwise it is a pointer */
-                int is_ch_ptr = is_aliaschain_attr(var->type, 
ATTR_CONTEXTHANDLE) ? FALSE : TRUE;
+                const char *ch_ptr = is_aliaschain_attr(var->type, 
ATTR_CONTEXTHANDLE) ? "*" : "";
                 print_server("(");
                 write_type_decl_left(server, var->type);
-                fprintf(server, ")%sNDRSContextValue(__frame->%s)",
-                        is_ch_ptr ? "" : "*", var->name);
+                fprintf(server, ")%sNDRSContextValue(__frame->%s)", ch_ptr, 
var->name);
             }
             else
             {

Modified: trunk/reactos/tools/widl/typegen.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/typegen.c?rev=57098&r1=57097&r2=57098&view=diff
==============================================================================
--- trunk/reactos/tools/widl/typegen.c [iso-8859-1] (original)
+++ trunk/reactos/tools/widl/typegen.c [iso-8859-1] Sat Aug 18 18:37:39 2012
@@ -4147,10 +4147,11 @@
                 /* if the context_handle attribute appears in the chain of 
types
                  * without pointers being followed, then the context handle 
must
                  * be direct, otherwise it is a pointer */
-                int is_ch_ptr = is_aliaschain_attr(type, ATTR_CONTEXTHANDLE) ? 
FALSE : TRUE;
+                const char *ch_ptr = is_aliaschain_attr(type, 
ATTR_CONTEXTHANDLE) ? "" : "*";
                 print_file(file, indent, "NdrClientContextMarshall(\n");
                 print_file(file, indent + 1, "&__frame->_StubMsg,\n");
-                print_file(file, indent + 1, "(NDR_CCONTEXT)%s%s%s,\n", 
is_ch_ptr ? "*" : "", local_var_prefix, var->name);
+                print_file(file, indent + 1, "(NDR_CCONTEXT)%s%s%s,\n", 
ch_ptr, local_var_prefix,
+                           var->name);
                 print_file(file, indent + 1, "%s);\n", in_attr && out_attr ? 
"1" : "0");
             }
             else


Reply via email to