Sync to wine-1.1.0:
[reactos.git] / reactos / tools / widl / widl_ros.diff
1 --- client.c 2008-09-27 21:56:02.000000000 +0200
2 +++ client.c 2008-09-27 20:49:05.000000000 +0200
3 @@ -113,7 +113,7 @@
4 }
5 if (explicit_handle)
6 {
7 - if (!explicit_handle_var || !explicit_generic_handle_var || !context_handle_var)
8 + if (!explicit_handle_var && !explicit_generic_handle_var && !context_handle_var)
9 {
10 error("%s() does not define an explicit binding handle!\n", def->name);
11 return;
12 --- hash.c 2008-09-27 21:56:02.000000000 +0200
13 +++ hash.c 2008-09-22 00:14:35.703125000 +0200
14 @@ -21,9 +21,7 @@
15 #include <stdio.h>
16 #include <stdarg.h>
17
18 -#include "windef.h"
19 -#include "winbase.h"
20 -#include "winnls.h"
21 +#include <host/nls.h>
22
23 #include "hash.h"
24
25 @@ -535,6 +533,7 @@
26 case LANG_SWEDISH: case LANG_SYRIAC: case LANG_TAMIL:
27 case LANG_TATAR: case LANG_TELUGU: case LANG_THAI:
28 case LANG_UKRAINIAN: case LANG_URDU: case LANG_UZBEK:
29 +#ifndef __REACTOS__
30 case LANG_VIETNAMESE: case LANG_GAELIC: case LANG_MALTESE:
31 case LANG_TAJIK: case LANG_ROMANSH: case LANG_IRISH:
32 case LANG_SAMI: case LANG_UPPER_SORBIAN: case LANG_SUTU:
33 @@ -542,6 +541,12 @@
34 case LANG_XHOSA: case LANG_ZULU: case LANG_ESPERANTO:
35 case LANG_WALON: case LANG_CORNISH: case LANG_WELSH:
36 case LANG_BRETON:
37 +#else
38 + case LANG_VIETNAMESE: case LANG_MALTESE: case LANG_IRISH:
39 + case LANG_SAMI: case LANG_UPPER_SORBIAN: case LANG_TSWANA:
40 + case LANG_XHOSA: case LANG_ZULU: case LANG_WELSH:
41 + case LANG_BRETON:
42 +#endif
43 nOffset = 16;
44 pnLookup = Lookup_16;
45 break;
46 --- header.c 2008-09-27 21:56:02.000000000 +0200
47 +++ header.c 2008-09-27 20:49:05.000000000 +0200
48 @@ -891,6 +891,8 @@
49 const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
50 int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
51 const var_t* explicit_handle_var;
52 + const var_t* explicit_generic_handle_var = NULL;
53 + const var_t* context_handle_var = NULL;
54 const func_t *cur;
55 int prefixes_differ = strcmp(prefix_client, prefix_server);
56
57 @@ -901,8 +903,14 @@
58
59 /* check for a defined binding handle */
60 explicit_handle_var = get_explicit_handle_var(cur);
61 + if (!explicit_handle_var)
62 + {
63 + explicit_generic_handle_var = get_explicit_generic_handle_var(cur);
64 + if (!explicit_generic_handle_var)
65 + context_handle_var = get_context_handle_var(cur);
66 + }
67 if (explicit_handle) {
68 - if (!explicit_handle_var) {
69 + if (!explicit_handle_var && !explicit_generic_handle_var && !context_handle_var) {
70 error("%s() does not define an explicit binding handle!\n", def->name);
71 return;
72 }
73 --- header.h 2008-09-27 21:56:02.000000000 +0200
74 +++ header.h 2008-09-23 21:14:50.781250000 +0200
75 @@ -66,6 +66,7 @@
76 extern const var_t* get_explicit_handle_var(const func_t* func);
77 extern const type_t* get_explicit_generic_handle_type(const var_t* var);
78 extern const var_t* get_explicit_generic_handle_var(const func_t* func);
79 +extern const var_t* get_context_handle_var(const func_t* func);
80 extern int has_out_arg_or_return(const func_t *func);
81 extern void write_guid(FILE *f, const char *guid_prefix, const char *name,
82 const UUID *uuid);
83 @@ -88,11 +89,19 @@
84
85 static inline int is_context_handle(const type_t *type)
86 {
87 - const type_t *t;
88 - for (t = type; is_ptr(t); t = t->ref)
89 - if (is_attr(t->attrs, ATTR_CONTEXTHANDLE))
90 + if (is_attr(type->attrs, ATTR_CONTEXTHANDLE))
91 + return 1;
92 +
93 + for (;;)
94 + {
95 + if (is_attr(type->attrs, ATTR_CONTEXTHANDLE))
96 return 1;
97 - return 0;
98 + else if (type->kind == TKIND_ALIAS)
99 + type = type->orig;
100 + else if (is_ptr(type))
101 + type = type->ref;
102 + else return 0;
103 + }
104 }
105
106 #endif
107 --- proxy.c 2008-09-27 21:56:02.000000000 +0200
108 +++ proxy.c 2008-09-27 20:49:05.000000000 +0200
109 @@ -463,41 +463,45 @@
110 print_proxy("\n");
111 }
112
113 -static int write_proxy_methods(type_t *iface)
114 +static int write_proxy_methods(type_t *iface, int skip)
115 {
116 const func_t *cur;
117 int i = 0;
118
119 - if (iface->ref) i = write_proxy_methods(iface->ref);
120 + if (iface->ref) i = write_proxy_methods(iface->ref, iface->ref->ref != NULL);
121 if (iface->funcs) LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) {
122 var_t *def = cur->def;
123 if (!is_callas(def->attrs)) {
124 if (i) fprintf(proxy, ",\n");
125 - print_proxy( "%s_", iface->name);
126 + print_proxy( "%s%s_", skip ? "0\t/* " : "", iface->name);
127 write_name(proxy, def);
128 - fprintf(proxy, "_Proxy");
129 + fprintf(proxy, "_Proxy%s", skip ? " */" : "");
130 i++;
131 }
132 }
133 return i;
134 }
135
136 -static int write_stub_methods(type_t *iface)
137 +static int write_stub_methods(type_t *iface, int skip)
138 {
139 const func_t *cur;
140 int i = 0;
141
142 - if (iface->ref) i = write_stub_methods(iface->ref);
143 + if (iface->ref) i = write_stub_methods(iface->ref, TRUE);
144 else return i; /* skip IUnknown */
145
146 if (iface->funcs) LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) {
147 var_t *def = cur->def;
148 if (!is_local(def->attrs)) {
149 - if (i) fprintf(proxy,",\n");
150 - print_proxy( "%s_", iface->name);
151 - write_name(proxy, def);
152 - fprintf(proxy, "_Stub");
153 - i++;
154 + if (skip)
155 + print_proxy("STUB_FORWARDING_FUNCTION,\n");
156 + else {
157 + if (i) fprintf(proxy,",\n");
158 + print_proxy( "%s_", iface->name);
159 + write_name(proxy, def);
160 + fprintf(proxy, "_Stub");
161 + i++;
162 + }
163 }
164 }
165 return i;
166 @@ -551,7 +555,7 @@
167 print_proxy( "},\n");
168 print_proxy( "{\n");
169 indent++;
170 - write_proxy_methods(iface);
171 + write_proxy_methods(iface, FALSE);
172 fprintf(proxy, "\n");
173 indent--;
174 print_proxy( "}\n");
175 @@ -563,7 +567,7 @@
176 print_proxy( "static const PRPC_STUB_FUNCTION %s_table[] =\n", iface->name);
177 print_proxy( "{\n");
178 indent++;
179 - stubs = write_stub_methods(iface);
180 + stubs = write_stub_methods(iface, FALSE);
181 fprintf(proxy, "\n");
182 indent--;
183 fprintf(proxy, "};\n");
184 --- server.c 2008-09-27 21:56:02.000000000 +0200
185 +++ server.c 2008-09-27 20:49:05.000000000 +0200
186 @@ -60,13 +60,21 @@
187 LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry )
188 {
189 const var_t *def = func->def;
190 + const var_t* context_handle_var = NULL;
191 + const var_t* explicit_generic_handle_var = NULL;
192 int has_full_pointer = is_full_pointer_function(func);
193
194 /* check for a defined binding handle */
195 explicit_handle_var = get_explicit_handle_var(func);
196 + if (!explicit_handle_var)
197 + {
198 + explicit_generic_handle_var = get_explicit_generic_handle_var(func);
199 + if (!explicit_generic_handle_var)
200 + context_handle_var = get_context_handle_var(func);
201 + }
202 if (explicit_handle)
203 {
204 - if (!explicit_handle_var)
205 + if (!explicit_handle_var && !explicit_generic_handle_var && !context_handle_var)
206 {
207 error("%s() does not define an explicit binding handle!\n", def->name);
208 return;
209 @@ -399,6 +407,7 @@
210 print_server("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
211 print_server("#include <string.h>\n");
212 fprintf(server, "\n");
213 + print_server("#define _SEH_NO_NATIVE_NLG\n");
214 print_server("#include \"%s\"\n", header_name);
215 fprintf(server, "\n");
216 }
217 --- typelib.c 2008-09-27 21:56:02.000000000 +0200
218 +++ typelib.c 2008-09-27 20:49:05.000000000 +0200
219 @@ -35,8 +35,7 @@
220 #define NONAMELESSUNION
221 #define NONAMELESSSTRUCT
222
223 -#include "windef.h"
224 -#include "winbase.h"
225 +#include <host/typedefs.h>
226
227 #include "widl.h"
228 #include "utils.h"
229 @@ -360,10 +359,10 @@
230
231 file_name = wpp_find_include(importlib->name, NULL);
232 if(file_name) {
233 - fd = open(file_name, O_RDONLY);
234 + fd = open(file_name, O_RDONLY | O_BINARY);
235 free(file_name);
236 }else {
237 - fd = open(importlib->name, O_RDONLY);
238 + fd = open(importlib->name, O_RDONLY | O_BINARY);
239 }
240
241 if(fd < 0)
242 --- typelib_struct.h 2008-09-27 21:56:02.000000000 +0200
243 +++ typelib_struct.h 2008-09-22 00:14:35.703125000 +0200
244 @@ -302,7 +302,7 @@
245 *
246 */
247
248 -#include "pshpack1.h"
249 +#include <host/pshpack1.h>
250
251 typedef struct {
252 /*00*/ DWORD SLTG_magic; /* 0x47544c53 == "SLTG" */
253 @@ -599,7 +599,7 @@
254 WORD typeofarray
255 */
256
257 -#include "poppack.h"
258 +#include <host/poppack.h>
259
260 /*---------------------------END--------------------------------------------*/
261 #endif
262 --- widl.c 2008-09-27 21:56:02.000000000 +0200
263 +++ widl.c 2008-09-27 20:49:05.000000000 +0200
264 @@ -174,7 +174,7 @@
265 token = xstrdup(name);
266 for (i=0; token[i]; i++) {
267 if (!isalnum(token[i])) token[i] = '_';
268 - else token[i] = toupper(token[i]);
269 + else token[i] = tolower(token[i]);
270 }
271 return token;
272 }
273 @@ -561,8 +561,8 @@
274 fprintf(header, "/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
275 fprintf(header, "#include <rpc.h>\n" );
276 fprintf(header, "#include <rpcndr.h>\n\n" );
277 - fprintf(header, "#ifndef __WIDL_%s\n", header_token);
278 - fprintf(header, "#define __WIDL_%s\n", header_token);
279 + fprintf(header, "#ifndef __%s__\n", header_token);
280 + fprintf(header, "#define __%s__\n", header_token);
281 start_cplusplus_guard(header);
282 }
283
284 @@ -607,7 +607,7 @@
285 fprintf(header, "/* End additional prototypes */\n");
286 fprintf(header, "\n");
287 end_cplusplus_guard(header);
288 - fprintf(header, "#endif /* __WIDL_%s */\n", header_token);
289 + fprintf(header, "#endif /* __%s__ */\n", header_token);
290 fclose(header);
291 }
292
293 --- widltypes.h 2008-09-27 21:56:02.000000000 +0200
294 +++ widltypes.h 2008-09-26 19:42:52.859375000 +0200
295 @@ -21,6 +21,13 @@
296 #ifndef __WIDL_WIDLTYPES_H
297 #define __WIDL_WIDLTYPES_H
298
299 +#define S_OK 0
300 +#define S_FALSE 1
301 +#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
302 +#define TYPE_E_IOERROR ((HRESULT)0x80028CA2L)
303 +
304 +#define max(a, b) ((a) > (b) ? a : b)
305 +
306 #include <stdarg.h>
307 #include "guiddef.h"
308 #include "wine/rpcfc.h"
309 @@ -31,7 +38,9 @@
310 typedef GUID UUID;
311 #endif
312
313 +#ifndef TRUE
314 #define TRUE 1
315 +#endif
316 #define FALSE 0
317
318 #define RPC_FC_FUNCTION 0xfe
319 --- write_msft.c 2008-09-27 21:56:02.000000000 +0200
320 +++ write_msft.c 2008-09-27 20:49:05.000000000 +0200
321 @@ -40,10 +40,8 @@
322 #define NONAMELESSUNION
323 #define NONAMELESSSTRUCT
324
325 -#include "winerror.h"
326 -#include "windef.h"
327 -#include "winbase.h"
328 -#include "winnls.h"
329 +#include <host/typedefs.h>
330 +#include <host/nls.h>
331
332 #include "widltypes.h"
333 #include "typelib.h"