widl patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Feel free to recompile the .idl files after applying this patch... it's
not necessary, but sooner or later someone is going to try what I'm
currently trying... to compile MIDL-generated proxy/stub code with Wine
headers.

Log:
Ove Kaaven <ovek@transgaming.com>
Declare user-marshaller prototypes for types declared with [wire_marshal].
Define __WIDL__ preprocessor macro, so Wine-specific IDL can be enclosed
in #ifdef __WIDL__. Fixed a file output bug.

Index: tools/widl/header.c
===================================================================
RCS file: /cvsroot/rewind/rewind/tools/widl/header.c,v
retrieving revision 1.8
diff -u -r1.8 header.c
--- tools/widl/header.c	17 Dec 2002 21:29:48 -0000	1.8
+++ tools/widl/header.c	8 Jan 2003 18:10:35 -0000
@@ -30,6 +30,33 @@
   if (delta > 0) indentation += delta;
 }
 
+int is_attr(attr_t *a, enum attr_type t)
+{
+  while (a) {
+    if (a->type == t) return 1;
+    a = NEXT_LINK(a);
+  }
+  return 0;
+}
+
+void *get_attrp(attr_t *a, enum attr_type t)
+{
+  while (a) {
+    if (a->type == t) return a->u.pval;
+    a = NEXT_LINK(a);
+  }
+  return NULL;
+}
+
+DWORD get_attrv(attr_t *a, enum attr_type t)
+{
+  while (a) {
+    if (a->type == t) return a->u.ival;
+    a = NEXT_LINK(a);
+  }
+  return 0;
+}
+
 int is_void(type_t *t, var_t *v)
 {
   if (v && v->ptr_level) return 0;
@@ -244,7 +271,9 @@
 void write_typedef(type_t *type, var_t *names)
 {
   char *tname = names->tname;
+  var_t *lname;
   while (NEXT_LINK(names)) names = NEXT_LINK(names);
+  lname = names;
   fprintf(header, "typedef ");
   write_type(header, type, NULL, tname);
   fprintf(header, " ");
@@ -254,7 +283,23 @@
       fprintf(header, ", ");
     names = PREV_LINK(names);
   }
-  fprintf(header, ";\n\n");
+  fprintf(header, ";\n");
+
+  if (get_attrp(type->attrs, ATTR_WIREMARSHAL)) {
+    names = lname;
+    while (names) {
+      char *name = get_name(names);
+      fprintf(header, "unsigned long   __RPC_USER %s_UserSize     (unsigned long *, unsigned long,   %s *);\n", name, name);
+      fprintf(header, "unsigned char * __RPC_USER %s_UserMarshal  (unsigned long *, unsigned char *, %s *);\n", name, name);
+      fprintf(header, "unsigned char * __RPC_USER %s_UserUnmarshal(unsigned long *, unsigned char *, %s *);\n", name, name);
+      fprintf(header, "void            __RPC_USER %s_UserFree     (unsigned long *, %s *);\n", name, name);
+      if (PREV_LINK(names))
+        fprintf(header, ", ");
+      names = PREV_LINK(names);
+    }
+  }
+
+  fprintf(header, "\n");
 }
 
 static void do_write_expr(FILE *h, expr_t *e, int p)
@@ -346,33 +391,6 @@
 
 /********** INTERFACES **********/
 
-int is_attr(attr_t *a, enum attr_type t)
-{
-  while (a) {
-    if (a->type == t) return 1;
-    a = NEXT_LINK(a);
-  }
-  return 0;
-}
-
-void *get_attrp(attr_t *a, enum attr_type t)
-{
-  while (a) {
-    if (a->type == t) return a->u.pval;
-    a = NEXT_LINK(a);
-  }
-  return NULL;
-}
-
-DWORD get_attrv(attr_t *a, enum attr_type t)
-{
-  while (a) {
-    if (a->type == t) return a->u.ival;
-    a = NEXT_LINK(a);
-  }
-  return 0;
-}
-
 int is_object(attr_t *a)
 {
   return is_attr(a, ATTR_OBJECT);
@@ -509,10 +527,10 @@
       else fprintf(h, "    ");
     }
     write_type(h, arg->type, arg, arg->tname);
-    if (method && use_icom && arg->array) fprintf(header, "*"); /* as write_icom_method_def */
+    if (method && use_icom && arg->array) fprintf(h, "*"); /* as write_icom_method_def */
     fprintf(h, " ");
     write_name(h, arg);
-    if (!(method && use_icom)) write_array(header, arg->array, 0);
+    if (!(method && use_icom)) write_array(h, arg->array, 0);
     arg = PREV_LINK(arg);
     count++;
   }
@@ -540,12 +558,12 @@
   }
 }
 
-static void write_c_method_def(type_t *iface,char *name)
+static void do_write_c_method_def(type_t *iface, char *name)
 {
   func_t *cur = iface->funcs;
   while (NEXT_LINK(cur)) cur = NEXT_LINK(cur);
 
-  if (iface->ref) write_c_method_def(iface->ref,name);
+  if (iface->ref) do_write_c_method_def(iface->ref, name);
   indent(0);
   fprintf(header, "/*** %s methods ***/\n", iface->name);
   while (cur) {
@@ -564,6 +582,11 @@
   }
 }
 
+static void write_c_method_def(type_t *iface)
+{
+  do_write_c_method_def(iface, iface->name);
+}
+
 static void write_method_proto(type_t *iface)
 {
   func_t *cur = iface->funcs;
@@ -708,7 +731,7 @@
     indentation++;
     fprintf(header, "    ICOM_MSVTABLE_COMPAT_FIELDS\n");
     fprintf(header, "\n");
-    write_c_method_def(iface,iface->name);
+    write_c_method_def(iface);
     indentation--;
     fprintf(header, "};\n");
     fprintf(header, "\n");
Index: tools/widl/widl.c
===================================================================
RCS file: /cvsroot/rewind/rewind/tools/widl/widl.c,v
retrieving revision 1.5
diff -u -r1.5 widl.c
--- tools/widl/widl.c	15 Dec 2002 14:11:58 -0000	1.5
+++ tools/widl/widl.c	8 Jan 2003 18:10:35 -0000
@@ -193,6 +193,8 @@
     strcat(proxy_name, "_p.c");
   }
 
+  add_cmdline_define("__WIDL__");
+
   atexit(rm_tempfile);
   if (!no_preprocess) {
     chat("Starting preprocess");



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux