xref: /reactos/sdk/tools/widl/widl_ros.diff (revision 8a978a17)
1diff -pudN e:\wine-patched\tools\widl/hash.c e:\reactos-sync-clean\tools\widl/hash.c
2--- e:\wine-patched\tools\widl/hash.c	2015-02-22 13:23:48 +0100
3+++ e:\reactos-sync-clean\tools\widl/hash.c	2013-10-15 20:06:18 +0100
4@@ -21,9 +21,7 @@
5 #include <stdio.h>
6 #include <stdarg.h>
7
8-#include "windef.h"
9-#include "winbase.h"
10-#include "winnls.h"
11+#include <nls.h>
12
13 #include "widltypes.h"
14 #include "hash.h"
15@@ -539,10 +537,10 @@ unsigned int lhash_val_of_name_sys( sysk
16   case LANG_VIETNAMESE: case LANG_MALTESE:    case LANG_IRISH:
17   case LANG_SAMI:       case LANG_UPPER_SORBIAN: case LANG_TSWANA:
18   case LANG_XHOSA:      case LANG_ZULU:       case LANG_WELSH:
19-  case LANG_BRETON:     case LANG_SCOTTISH_GAELIC: case LANG_NEUTRAL:
20+  case LANG_BRETON:     case LANG_NEUTRAL:
21 /* some languages not in all windows versions or ReactOS */
22-#ifdef LANG_MANX_GAELIC
23-  case LANG_MANX_GAELIC:
24+#ifdef LANG_GAELIC
25+  case LANG_GAELIC:
26 #endif
27 #ifdef LANG_TAJIK
28   case LANG_TAJIK:
29diff -pudN e:\wine-patched\tools\widl/header.c e:\reactos-sync-clean\tools\widl/header.c
30--- e:\wine-patched\tools\widl/header.c	2015-10-30 18:41:54 +0100
31+++ e:\reactos-sync-clean\tools\widl/header.c	2015-11-16 20:04:15 +0100
32@@ -1068,7 +1068,7 @@ static void write_inline_wrappers(FILE *
33     if (!is_callas(func->attrs)) {
34       const var_t *arg;
35
36-      fprintf(header, "static FORCEINLINE ");
37+      fprintf(header, "FORCEINLINE ");
38       write_type_decl_left(header, type_function_get_rettype(func->type));
39       fprintf(header, " %s_%s(", name, get_name(func));
40       write_args(header, type_get_function_args(func->type), name, 1, FALSE);
41@@ -1103,6 +1103,15 @@ static void do_write_c_method_def(FILE *
42
43   if (type_iface_get_inherit(iface))
44     do_write_c_method_def(header, type_iface_get_inherit(iface), name);
45+  else if (type_iface_get_stmts(iface) == NULL)
46+  {
47+    fprintf(header, "#ifndef __cplusplus\n");
48+    indent(header, 0);
49+    fprintf(header, "char dummy;\n");
50+    fprintf(header, "#endif\n");
51+    fprintf(header, "\n");
52+    return;
53+  }
54
55   STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface))
56   {
57@@ -1640,6 +1649,10 @@ void write_header(const statement_list_t
58   fprintf(header, "#define __REQUIRED_RPCNDR_H_VERSION__ 475\n");
59   fprintf(header, "#endif\n\n");
60
61+  fprintf(header, "#ifdef __REACTOS__\n");
62+  fprintf(header, "#define WIN32_LEAN_AND_MEAN\n");
63+  fprintf(header, "#endif\n\n");
64+
65   fprintf(header, "#include <rpc.h>\n" );
66   fprintf(header, "#include <rpcndr.h>\n\n" );
67
68diff -pudN e:\wine-patched\tools\widl/parser.y e:\reactos-sync-clean\tools\widl/parser.y
69--- e:\wine-patched\tools\widl/parser.y	2015-11-15 19:23:32 +0100
70+++ e:\reactos-sync-clean\tools\widl/parser.y	2015-11-16 20:04:15 +0100
71@@ -1899,6 +1899,14 @@ static type_t *reg_typedefs(decl_spec_t
72         type->attrs = attrs;
73   }
74
75+#ifdef __REACTOS__
76+  /* Append the SWITCHTYPE attribute to a non-encapsulated union if it does not already have it.  */
77+  if (type_get_type_detect_alias(type) == TYPE_UNION &&
78+      is_attr(attrs, ATTR_SWITCHTYPE) &&
79+      !is_attr(type->attrs, ATTR_SWITCHTYPE))
80+    type->attrs = append_attr(type->attrs, make_attrp(ATTR_SWITCHTYPE, get_attrp(attrs, ATTR_SWITCHTYPE)));
81+#endif
82+
83   LIST_FOR_EACH_ENTRY( decl, decls, const declarator_t, entry )
84   {
85
86diff -pudN e:\wine-patched\tools\widl/proxy.c e:\reactos-sync-clean\tools\widl/proxy.c
87--- e:\wine-patched\tools\widl/proxy.c	2015-02-22 13:23:48 +0100
88+++ e:\reactos-sync-clean\tools\widl/proxy.c	2015-11-16 20:04:15 +0100
89@@ -87,7 +87,13 @@ static void init_proxy(const statement_l
90     error("Could not open %s for output\n", proxy_name);
91   print_proxy( "/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
92   print_proxy( "\n");
93-  print_proxy( "#define __midl_proxy\n");
94+  print_proxy( "#define __midl_proxy\n\n");
95+
96+  print_proxy( "#ifdef __REACTOS__\n");
97+  print_proxy( "#define WIN32_NO_STATUS\n");
98+  print_proxy( "#define WIN32_LEAN_AND_MEAN\n");
99+  print_proxy( "#endif\n\n");
100+
101   print_proxy( "#include \"objbase.h\"\n");
102   print_proxy( "\n");
103   print_proxy( "#ifndef DECLSPEC_HIDDEN\n");
104@@ -476,14 +482,15 @@ static const statement_t * get_callas_so
105   return NULL;
106 }
107
108-static void write_proxy_procformatstring_offsets( const type_t *iface, int skip )
109+static int write_proxy_procformatstring_offsets( const type_t *iface, int skip )
110 {
111     const statement_t *stmt;
112+    int i = 0;
113
114     if (type_iface_get_inherit(iface))
115-        write_proxy_procformatstring_offsets( type_iface_get_inherit(iface), need_delegation(iface));
116+        i = write_proxy_procformatstring_offsets( type_iface_get_inherit(iface), need_delegation(iface));
117     else
118-        return;
119+        return 0;
120
121     STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) )
122     {
123@@ -503,7 +510,9 @@ static void write_proxy_procformatstring
124             print_proxy( "(unsigned short)-1,  /* %s::%s */\n", iface->name, get_name(func));
125         else
126             print_proxy( "%u,  /* %s::%s */\n", func->procstring_offset, iface->name, get_name(func));
127+        i++;
128     }
129+    return i;
130 }
131
132 static int write_proxy_methods(type_t *iface, int skip)
133@@ -636,7 +645,10 @@ static void write_proxy(type_t *iface, u
134   print_proxy( "static const unsigned short %s_FormatStringOffsetTable[] =\n", iface->name );
135   print_proxy( "{\n" );
136   indent++;
137-  write_proxy_procformatstring_offsets( iface, 0 );
138+  if (write_proxy_procformatstring_offsets( iface, 0 ) == 0)
139+  {
140+      print_proxy( "0\n" );
141+  }
142   indent--;
143   print_proxy( "};\n\n" );
144
145@@ -710,7 +722,10 @@ static void write_proxy(type_t *iface, u
146       print_proxy( "static const PRPC_STUB_FUNCTION %s_table[] =\n", iface->name);
147       print_proxy( "{\n");
148       indent++;
149-      write_stub_methods(iface, FALSE);
150+      if (write_stub_methods(iface, FALSE) == 0)
151+      {
152+          fprintf(proxy, "0");
153+      }
154       fprintf(proxy, "\n");
155       indent--;
156       fprintf(proxy, "};\n\n");
157diff -pudN e:\wine-patched\tools\widl/typegen.c e:\reactos-sync-clean\tools\widl/typegen.c
158--- e:\wine-patched\tools\widl/typegen.c	2015-10-30 18:41:54 +0100
159+++ e:\reactos-sync-clean\tools\widl/typegen.c	2015-11-16 20:04:16 +0100
160@@ -4747,7 +4747,7 @@ void write_func_param_struct( FILE *file
161         if (align >= pointer_size)
162             fprintf( file, "%s;\n", arg->name );
163         else
164-            fprintf( file, "%s DECLSPEC_ALIGN(%u);\n", arg->name, pointer_size );
165+            fprintf( file, "DECLSPEC_ALIGN(%u) %s;\n", pointer_size, arg->name );
166     }
167     if (add_retval && !is_void( retval->type ))
168     {
169diff -pudN e:\wine-patched\tools\widl/typelib.c e:\reactos-sync-clean\tools\widl/typelib.c
170--- e:\wine-patched\tools\widl/typelib.c	2015-10-30 18:41:54 +0100
171+++ e:\reactos-sync-clean\tools\widl/typelib.c	2015-11-16 20:04:16 +0100
172@@ -32,9 +32,7 @@
173 #include <string.h>
174 #include <ctype.h>
175
176-#include "windef.h"
177-#include "winbase.h"
178-
179+#include <typedefs.h>
180 #include "widl.h"
181 #include "utils.h"
182 #include "parser.h"
183diff -pudN e:\wine-patched\tools\widl/widl.c e:\reactos-sync-clean\tools\widl/widl.c
184--- e:\wine-patched\tools\widl/widl.c	2015-10-30 18:41:54 +0100
185+++ e:\reactos-sync-clean\tools\widl/widl.c	2015-11-16 20:04:16 +0100
186@@ -364,6 +364,12 @@ static void write_dlldata_list(struct li
187   fprintf(dlldata, "- Do not edit ***/\n\n");
188   if (define_proxy_delegation)
189       fprintf(dlldata, "#define PROXY_DELEGATION\n");
190+
191+  fprintf(dlldata, "#ifdef __REACTOS__\n");
192+  fprintf(dlldata, "#define WIN32_NO_STATUS\n");
193+  fprintf(dlldata, "#define WIN32_LEAN_AND_MEAN\n");
194+  fprintf(dlldata, "#endif\n\n");
195+
196   fprintf(dlldata, "#include <objbase.h>\n");
197   fprintf(dlldata, "#include <rpcproxy.h>\n\n");
198   start_cplusplus_guard(dlldata);
199@@ -504,6 +510,12 @@ void write_id_data(const statement_list_
200
201   fprintf(idfile, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION);
202   fprintf(idfile, "from %s - Do not edit ***/\n\n", input_idl_name);
203+
204+  fprintf(idfile, "#ifdef __REACTOS__\n");
205+  fprintf(idfile, "#define WIN32_NO_STATUS\n");
206+  fprintf(idfile, "#define WIN32_LEAN_AND_MEAN\n");
207+  fprintf(idfile, "#endif\n\n");
208+
209   fprintf(idfile, "#include <rpc.h>\n");
210   fprintf(idfile, "#include <rpcndr.h>\n\n");
211
212diff -pudN e:\wine-patched\tools\widl/widltypes.h e:\reactos-sync-clean\tools\widl/widltypes.h
213--- e:\wine-patched\tools\widl/widltypes.h	2015-10-30 18:41:54 +0100
214+++ e:\reactos-sync-clean\tools\widl/widltypes.h	2015-11-16 20:04:16 +0100
215@@ -21,6 +21,15 @@
216 #ifndef __WIDL_WIDLTYPES_H
217 #define __WIDL_WIDLTYPES_H
218
219+#define S_OK           0
220+#define S_FALSE        1
221+#define E_OUTOFMEMORY  ((HRESULT)0x8007000EL)
222+#define TYPE_E_IOERROR ((HRESULT)0x80028CA2L)
223+
224+#ifndef max
225+#define max(a, b) ((a) > (b) ? a : b)
226+#endif
227+
228 #include <stdarg.h>
229 #include <assert.h>
230 #include "guiddef.h"
231diff -pudN e:\wine-patched\tools\widl/write_msft.c e:\reactos-sync-clean\tools\widl/write_msft.c
232--- e:\wine-patched\tools\widl/write_msft.c	2015-11-15 19:23:32 +0100
233+++ e:\reactos-sync-clean\tools\widl/write_msft.c	2015-11-16 20:04:16 +0100
234@@ -39,10 +39,8 @@
235
236 #define NONAMELESSUNION
237
238-#include "winerror.h"
239-#include "windef.h"
240-#include "winbase.h"
241-#include "winnls.h"
242+#include <typedefs.h>
243+#include <nls.h>
244
245 #include "widl.h"
246 #include "typelib.h"
247