ReactOS 0.4.15-dev-7788-g1ad9096
proxy.c
Go to the documentation of this file.
1/*
2 * IDL Compiler
3 *
4 * Copyright 2002 Ove Kaaven
5 * Copyright 2004 Mike McCormack
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22#include "config.h"
23#include "wine/port.h"
24
25#include <stdio.h>
26#include <stdlib.h>
27#ifdef HAVE_UNISTD_H
28# include <unistd.h>
29#endif
30#include <string.h>
31#include <ctype.h>
32
33#include "widl.h"
34#include "utils.h"
35#include "parser.h"
36#include "header.h"
37#include "typegen.h"
38#include "expr.h"
39
40static FILE* proxy;
41static int indent = 0;
42
43static void print_proxy( const char *format, ... ) __attribute__((format (printf, 1, 2)));
44static void print_proxy( const char *format, ... )
45{
46 va_list va;
47 va_start( va, format );
48 print( proxy, indent, format, va );
49 va_end( va );
50}
51
52static void write_stubdescproto(void)
53{
54 print_proxy( "static const MIDL_STUB_DESC Object_StubDesc;\n");
55 print_proxy( "\n");
56}
57
59{
60 print_proxy( "static const MIDL_STUB_DESC Object_StubDesc =\n{\n");
61 indent++;
62 print_proxy( "0,\n");
63 print_proxy( "NdrOleAllocate,\n");
64 print_proxy( "NdrOleFree,\n");
65 print_proxy( "{0}, 0, 0, %s, 0,\n", expr_eval_routines ? "ExprEvalRoutines" : "0");
66 print_proxy( "__MIDL_TypeFormatString.Format,\n");
67 print_proxy( "1, /* -error bounds_check flag */\n");
68 print_proxy( "0x%x, /* Ndr library version */\n", get_stub_mode() == MODE_Oif ? 0x50002 : 0x10001);
69 print_proxy( "0,\n");
70 print_proxy( "0x50100a4, /* MIDL Version 5.1.164 */\n");
71 print_proxy( "0,\n");
72 print_proxy("%s,\n", list_empty(&user_type_list) ? "0" : "UserMarshalRoutines");
73 print_proxy( "0, /* notify & notify_flag routine table */\n");
74 print_proxy( "1, /* Flags */\n");
75 print_proxy( "0, /* Reserved3 */\n");
76 print_proxy( "0, /* Reserved4 */\n");
77 print_proxy( "0 /* Reserved5 */\n");
78 indent--;
79 print_proxy( "};\n");
80 print_proxy( "\n");
81}
82
83static void init_proxy(const statement_list_t *stmts)
84{
85 if (proxy) return;
86 if(!(proxy = fopen(proxy_name, "w")))
87 error("Could not open %s for output\n", proxy_name);
88 print_proxy( "/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
89 print_proxy( "\n");
90 print_proxy( "#define __midl_proxy\n\n");
91
92 print_proxy( "#ifdef __REACTOS__\n");
93 print_proxy( "#define WIN32_NO_STATUS\n");
94 print_proxy( "#define WIN32_LEAN_AND_MEAN\n");
95 print_proxy( "#endif\n\n");
96
97 print_proxy( "#include \"objbase.h\"\n");
98 print_proxy( "\n");
99 print_proxy( "#ifndef DECLSPEC_HIDDEN\n");
100 print_proxy( "#define DECLSPEC_HIDDEN\n");
101 print_proxy( "#endif\n");
102 print_proxy( "\n");
103}
104
105static void clear_output_vars( const var_list_t *args )
106{
107 const var_t *arg;
108
109 if (!args) return;
111 {
112 if (is_attr(arg->attrs, ATTR_IN)) continue;
113 if (!is_attr(arg->attrs, ATTR_OUT)) continue;
114 if (is_ptr(arg->type))
115 {
116 if (type_get_type(type_pointer_get_ref(arg->type)) == TYPE_BASIC) continue;
117 if (type_get_type(type_pointer_get_ref(arg->type)) == TYPE_ENUM) continue;
118 }
119 print_proxy( "if (%s) MIDL_memset( %s, 0, ", arg->name, arg->name );
120 if (is_array(arg->type) && type_array_has_conformance(arg->type))
121 {
123 fprintf( proxy, " * " );
124 }
125 fprintf( proxy, "sizeof( *%s ));\n", arg->name );
126 }
127}
128
129static int need_delegation(const type_t *iface)
130{
131 const type_t *parent = type_iface_get_inherit( iface );
132 return parent && type_iface_get_inherit(parent) && (parent->ignore || is_local( parent->attrs ));
133}
134
135static int get_delegation_indirect(const type_t *iface, const type_t ** delegate_to)
136{
137 const type_t * cur_iface;
138 for (cur_iface = iface; cur_iface != NULL; cur_iface = type_iface_get_inherit(cur_iface))
139 if (need_delegation(cur_iface))
140 {
141 if(delegate_to)
142 *delegate_to = type_iface_get_inherit(cur_iface);
143 return 1;
144 }
145 return 0;
146}
147
148static int need_delegation_indirect(const type_t *iface)
149{
150 return get_delegation_indirect(iface, NULL);
151}
152
153static void free_variable( const var_t *arg, const char *local_var_prefix )
154{
155 unsigned int type_offset = arg->typestring_offset;
156 type_t *type = arg->type;
157
159
161 {
162 case TGT_ENUM:
163 case TGT_BASIC:
164 break;
165
166 case TGT_STRUCT:
168 print_proxy("/* FIXME: %s code for %s struct type 0x%x missing */\n", __FUNCTION__, arg->name, get_struct_fc(type) );
169 break;
170
172 case TGT_POINTER:
173 case TGT_ARRAY:
174 print_proxy( "NdrClearOutParameters( &__frame->_StubMsg, ");
175 fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset );
176 fprintf(proxy, "(void *)%s );\n", arg->name );
177 break;
178
179 default:
180 print_proxy("/* FIXME: %s code for %s type %d missing */\n", __FUNCTION__, arg->name, type_get_type(type) );
181 }
182}
183
184static void proxy_free_variables( var_list_t *args, const char *local_var_prefix )
185{
186 const var_t *arg;
187
188 if (!args) return;
190 if (is_attr(arg->attrs, ATTR_OUT))
191 {
192 free_variable( arg, local_var_prefix );
193 fprintf(proxy, "\n");
194 }
195}
196
197static void gen_proxy(type_t *iface, const var_t *func, int idx,
198 unsigned int proc_offset)
199{
200 var_t *retval = type_function_get_retval(func->type);
201 int has_ret = !is_void(retval->type);
202 int has_full_pointer = is_full_pointer_function(func);
203 const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV);
205 if (!callconv) callconv = "STDMETHODCALLTYPE";
206
207 indent = 0;
208 if (is_interpreted_func( iface, func ))
209 {
210 if (get_stub_mode() == MODE_Oif && !is_callas( func->attrs )) return;
212 print_proxy( " %s %s_%s_Proxy(\n", callconv, iface->name, get_name(func));
213 write_args(proxy, args, iface->name, 1, TRUE);
214 print_proxy( ")\n");
215 write_client_call_routine( proxy, iface, func, "Object", proc_offset );
216 return;
217 }
218 print_proxy( "static void __finally_%s_%s_Proxy( struct __proxy_frame *__frame )\n",
219 iface->name, get_name(func) );
220 print_proxy( "{\n");
221 indent++;
222 if (has_full_pointer) write_full_pointer_free(proxy, indent, func);
223 print_proxy( "NdrProxyFreeBuffer( __frame->This, &__frame->_StubMsg );\n" );
224 indent--;
225 print_proxy( "}\n");
226 print_proxy( "\n");
227
229 print_proxy( " %s %s_%s_Proxy(\n", callconv, iface->name, get_name(func));
230 write_args(proxy, args, iface->name, 1, TRUE);
231 print_proxy( ")\n");
232 print_proxy( "{\n");
233 indent ++;
234 print_proxy( "struct __proxy_frame __f, * const __frame = &__f;\n" );
235 /* local variables */
236 if (has_ret) {
237 print_proxy( "%s", "" );
238 write_type_decl(proxy, retval->type, retval->name);
239 fprintf( proxy, ";\n" );
240 }
241 print_proxy( "RPC_MESSAGE _RpcMessage;\n" );
242 if (has_ret) {
243 if (decl_indirect(retval->type))
244 print_proxy("void *_p_%s = &%s;\n", retval->name, retval->name);
245 }
246 print_proxy( "\n");
247
248 print_proxy( "RpcExceptionInit( __proxy_filter, __finally_%s_%s_Proxy );\n", iface->name, get_name(func) );
249 print_proxy( "__frame->This = This;\n" );
250
251 if (has_full_pointer)
253
254 /* FIXME: trace */
256
257 print_proxy( "RpcTryExcept\n" );
258 print_proxy( "{\n" );
259 indent++;
260 print_proxy( "NdrProxyInitialize(This, &_RpcMessage, &__frame->_StubMsg, &Object_StubDesc, %d);\n", idx);
262
263 print_proxy( "RpcTryFinally\n" );
264 print_proxy( "{\n" );
265 indent++;
266
268
269 print_proxy( "NdrProxyGetBuffer(This, &__frame->_StubMsg);\n" );
270
272
273 print_proxy( "NdrProxySendReceive(This, &__frame->_StubMsg);\n" );
274 fprintf(proxy, "\n");
275 print_proxy( "__frame->_StubMsg.BufferStart = _RpcMessage.Buffer;\n" );
276 print_proxy( "__frame->_StubMsg.BufferEnd = __frame->_StubMsg.BufferStart + _RpcMessage.BufferLength;\n\n" );
277
278 print_proxy("if ((_RpcMessage.DataRepresentation & 0xffff) != NDR_LOCAL_DATA_REPRESENTATION)\n");
279 indent++;
280 print_proxy("NdrConvert( &__frame->_StubMsg, &__MIDL_ProcFormatString.Format[%u]);\n", proc_offset );
281 indent--;
282 fprintf(proxy, "\n");
283
285
286 if (has_ret)
287 {
288 if (decl_indirect(retval->type))
289 print_proxy("MIDL_memset(&%s, 0, sizeof(%s));\n", retval->name, retval->name);
290 else if (is_ptr(retval->type) || is_array(retval->type))
291 print_proxy("%s = 0;\n", retval->name);
293 }
294
295 indent--;
296 print_proxy( "}\n");
297 print_proxy( "RpcFinally\n" );
298 print_proxy( "{\n" );
299 indent++;
300 print_proxy( "__finally_%s_%s_Proxy( __frame );\n", iface->name, get_name(func) );
301 indent--;
302 print_proxy( "}\n");
303 print_proxy( "RpcEndFinally\n" );
304 indent--;
305 print_proxy( "}\n" );
306 print_proxy( "RpcExcept(__frame->_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)\n" );
307 print_proxy( "{\n" );
308 if (has_ret) {
309 indent++;
311 print_proxy( "_RetVal = NdrProxyErrorHandler(RpcExceptionCode());\n" );
312 indent--;
313 }
314 print_proxy( "}\n" );
315 print_proxy( "RpcEndExcept\n" );
316
317 if (has_ret) {
318 print_proxy( "return _RetVal;\n" );
319 }
320 indent--;
321 print_proxy( "}\n");
322 print_proxy( "\n");
323}
324
325static void gen_stub(type_t *iface, const var_t *func, const char *cas,
326 unsigned int proc_offset)
327{
328 const var_t *arg;
329 int has_ret = !is_void(type_function_get_rettype(func->type));
330 int has_full_pointer = is_full_pointer_function(func);
331
332 if (is_interpreted_func( iface, func )) return;
333
334 indent = 0;
335 print_proxy( "struct __frame_%s_%s_Stub\n{\n", iface->name, get_name(func));
336 indent++;
337 print_proxy( "__DECL_EXCEPTION_FRAME\n" );
338 print_proxy( "MIDL_STUB_MESSAGE _StubMsg;\n");
339 print_proxy( "%s * _This;\n", iface->name );
341 indent--;
342 print_proxy( "};\n\n" );
343
344 print_proxy( "static void __finally_%s_%s_Stub(", iface->name, get_name(func) );
345 print_proxy( " struct __frame_%s_%s_Stub *__frame )\n{\n", iface->name, get_name(func) );
346 indent++;
348 if (has_full_pointer)
350 indent--;
351 print_proxy( "}\n\n" );
352
353 print_proxy( "void __RPC_STUB %s_%s_Stub(\n", iface->name, get_name(func));
354 indent++;
355 print_proxy( "IRpcStubBuffer* This,\n");
356 print_proxy( "IRpcChannelBuffer *_pRpcChannelBuffer,\n");
357 print_proxy( "PRPC_MESSAGE _pRpcMessage,\n");
358 print_proxy( "DWORD* _pdwStubPhase)\n");
359 indent--;
360 print_proxy( "{\n");
361 indent++;
362 print_proxy( "struct __frame_%s_%s_Stub __f, * const __frame = &__f;\n\n",
363 iface->name, get_name(func) );
364
365 print_proxy("__frame->_This = (%s*)((CStdStubBuffer*)This)->pvServerObject;\n\n", iface->name);
366
367 /* FIXME: trace */
368
369 print_proxy("NdrStubInitialize(_pRpcMessage, &__frame->_StubMsg, &Object_StubDesc, _pRpcChannelBuffer);\n");
370 fprintf(proxy, "\n");
371 print_proxy( "RpcExceptionInit( 0, __finally_%s_%s_Stub );\n", iface->name, get_name(func) );
372
373 write_parameters_init(proxy, indent, func, "__frame->");
374
375 print_proxy("RpcTryFinally\n");
376 print_proxy("{\n");
377 indent++;
378 if (has_full_pointer)
380 print_proxy("if ((_pRpcMessage->DataRepresentation & 0xffff) != NDR_LOCAL_DATA_REPRESENTATION)\n");
381 indent++;
382 print_proxy("NdrConvert( &__frame->_StubMsg, &__MIDL_ProcFormatString.Format[%u]);\n", proc_offset );
383 indent--;
384 fprintf(proxy, "\n");
385
387 fprintf(proxy, "\n");
388
389 assign_stub_out_args( proxy, indent, func, "__frame->" );
390
391 print_proxy("*_pdwStubPhase = STUB_CALL_SERVER;\n");
392 fprintf(proxy, "\n");
393 print_proxy( "%s", has_ret ? "__frame->_RetVal = " : "" );
394 if (cas) fprintf(proxy, "%s_%s_Stub", iface->name, cas);
395 else fprintf(proxy, "__frame->_This->lpVtbl->%s", get_name(func));
396 fprintf(proxy, "(__frame->_This");
397
398 if (type_get_function_args(func->type))
399 {
401 fprintf(proxy, ", %s__frame->%s", is_array(arg->type) && !type_array_is_decl_as_ptr(arg->type) ? "*" :"" , arg->name);
402 }
403 fprintf(proxy, ");\n");
404 fprintf(proxy, "\n");
405 print_proxy("*_pdwStubPhase = STUB_MARSHAL;\n");
406 fprintf(proxy, "\n");
407
409
412
413 print_proxy("NdrStubGetBuffer(This, _pRpcChannelBuffer, &__frame->_StubMsg);\n");
414
416 fprintf(proxy, "\n");
417
418 /* marshall the return value */
421
422 indent--;
423 print_proxy("}\n");
424 print_proxy("RpcFinally\n");
425 print_proxy("{\n");
426 indent++;
427 print_proxy( "__finally_%s_%s_Stub( __frame );\n", iface->name, get_name(func) );
428 indent--;
429 print_proxy("}\n");
430 print_proxy("RpcEndFinally\n");
431
432 print_proxy("_pRpcMessage->BufferLength = __frame->_StubMsg.Buffer - (unsigned char *)_pRpcMessage->Buffer;\n");
433 indent--;
434
435 print_proxy("}\n");
436 print_proxy("\n");
437}
438
439static void gen_stub_thunk( type_t *iface, const var_t *func, unsigned int proc_offset )
440{
441 int has_ret = !is_void( type_function_get_rettype( func->type ));
442 const var_t *arg, *callas = is_callas( func->attrs );
443 const var_list_t *args = type_get_function_args( func->type );
444
445 indent = 0;
446 print_proxy( "void __RPC_API %s_%s_Thunk( PMIDL_STUB_MESSAGE pStubMsg )\n",
447 iface->name, get_name(func) );
448 print_proxy( "{\n");
449 indent++;
450 write_func_param_struct( proxy, iface, func->type,
451 "*pParamStruct = (struct _PARAM_STRUCT *)pStubMsg->StackTop", has_ret );
452 print_proxy( "%s%s_%s_Stub( pParamStruct->This",
453 has_ret ? "pParamStruct->_RetVal = " : "", iface->name, callas->name );
454 indent++;
455 if (args) LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
456 {
457 fprintf( proxy, ",\n%*spParamStruct->%s", 4 * indent, "", arg->name );
458 }
459 fprintf( proxy, " );\n" );
460 indent--;
461 indent--;
462 print_proxy( "}\n\n");
463}
464
465int count_methods(const type_t *iface)
466{
467 const statement_t *stmt;
468 int count = 0;
469
470 if (type_iface_get_inherit(iface))
472
474 const var_t *func = stmt->u.var;
475 if (!is_callas(func->attrs)) count++;
476 }
477 return count;
478}
479
480static const statement_t * get_callas_source(const type_t * iface, const var_t * def)
481{
482 const statement_t * source;
484 const var_t * cas = is_callas(source->u.var->attrs );
485 if (cas && !strcmp(def->name, cas->name))
486 return source;
487 }
488 return NULL;
489}
490
491#ifdef __REACTOS__ /* r57019 / c3be8a3 */
492static int write_proxy_procformatstring_offsets( const type_t *iface, int skip )
493#else
494static void write_proxy_procformatstring_offsets( const type_t *iface, int skip )
495#endif
496{
497 const statement_t *stmt;
498 int i = 0;
499
500 if (type_iface_get_inherit(iface))
502 else
503 return 0;
504
506 {
507 const var_t *func = stmt->u.var;
508 int missing = 0;
509
510 if (is_callas(func->attrs)) continue;
511 if (is_local(func->attrs))
512 {
513 const statement_t * callas_source = get_callas_source(iface, func);
514 if (!callas_source)
515 missing = 1;
516 else
517 func = callas_source->u.var;
518 }
519 if (skip || missing)
520 print_proxy( "(unsigned short)-1, /* %s::%s */\n", iface->name, get_name(func));
521 else
522 print_proxy( "%u, /* %s::%s */\n", func->procstring_offset, iface->name, get_name(func));
523 i++;
524 }
525#ifdef __REACTOS__ /* r57019 / c3be8a3 */
526 return i;
527#endif
528}
529
530static int write_proxy_methods(type_t *iface, int skip)
531{
532 const statement_t *stmt;
533 int i = 0;
534
535 if (type_iface_get_inherit(iface))
537 need_delegation(iface));
539 const var_t *func = stmt->u.var;
540 if (!is_callas(func->attrs)) {
541 if (skip || (is_local(func->attrs) && !get_callas_source(iface, func)))
542 print_proxy( "0, /* %s::%s */\n", iface->name, get_name(func));
543 else if (is_interpreted_func( iface, func ) &&
544 !is_local( func->attrs ) &&
546 print_proxy( "(void *)-1, /* %s::%s */\n", iface->name, get_name(func));
547 else
548 print_proxy( "%s_%s_Proxy,\n", iface->name, get_name(func));
549 i++;
550 }
551 }
552 return i;
553}
554
555static int write_stub_methods(type_t *iface, int skip)
556{
557 const statement_t *stmt;
558 int i = 0;
559
560 if (type_iface_get_inherit(iface))
562 else
563 return i; /* skip IUnknown */
564
566 const var_t *func = stmt->u.var;
567 if (!is_callas(func->attrs)) {
568 int missing = 0;
569 const char * fname = get_name(func);
570 if(is_local(func->attrs)) {
571 const statement_t * callas_source = get_callas_source(iface, func);
572 if(!callas_source)
573 missing = 1;
574 else
575 fname = get_name(callas_source->u.var);
576 }
577 if (i) fprintf(proxy,",\n");
578 if (skip || missing) print_proxy("STUB_FORWARDING_FUNCTION");
579 else if (is_interpreted_func( iface, func ))
580 print_proxy( "(PRPC_STUB_FUNCTION)%s", get_stub_mode() == MODE_Oif ? "NdrStubCall2" : "NdrStubCall" );
581 else print_proxy( "%s_%s_Stub", iface->name, fname);
582 i++;
583 }
584 }
585 return i;
586}
587
588static void write_thunk_methods( type_t *iface, int skip )
589{
590 const statement_t *stmt;
591
592 if (type_iface_get_inherit( iface ))
594 else
595 return; /* skip IUnknown */
596
598 {
599 var_t *func = stmt->u.var;
600 const statement_t * callas_source = NULL;
601
602 if (is_callas(func->attrs)) continue;
603 if (is_local(func->attrs)) callas_source = get_callas_source(iface, func);
604
605 if (!skip && callas_source && is_interpreted_func( iface, func ))
606 print_proxy( "%s_%s_Thunk,\n", iface->name, get_name(callas_source->u.var) );
607 else
608 print_proxy( "0, /* %s::%s */\n", iface->name, get_name(func) );
609 }
610}
611
612static void write_proxy(type_t *iface, unsigned int *proc_offset)
613{
614 int count;
615 const statement_t *stmt;
616 int first_func = 1;
617 int needs_stub_thunks = 0;
618 int needs_inline_stubs = need_inline_stubs( iface ) || need_delegation( iface );
619
621 var_t *func = stmt->u.var;
622 if (first_func) {
623 fprintf(proxy, "/*****************************************************************************\n");
624 fprintf(proxy, " * %s interface\n", iface->name);
625 fprintf(proxy, " */\n");
626 first_func = 0;
627 }
628 if (!is_local(func->attrs)) {
629 const var_t *cas = is_callas(func->attrs);
630 const char *cname = cas ? cas->name : NULL;
631 int idx = func->type->details.function->idx;
632 if (cname) {
633 const statement_t *stmt2;
635 const var_t *m = stmt2->u.var;
636 if (!strcmp(m->name, cname))
637 {
638 idx = m->type->details.function->idx;
639 break;
640 }
641 }
642 }
643 func->procstring_offset = *proc_offset;
644 gen_proxy(iface, func, idx, *proc_offset);
645 gen_stub(iface, func, cname, *proc_offset);
646 if (cas && is_interpreted_func( iface, func ))
647 {
648 needs_stub_thunks = 1;
649 gen_stub_thunk(iface, func, *proc_offset);
650 }
651 *proc_offset += get_size_procformatstring_func( iface, func );
652 }
653 }
654
655 count = count_methods(iface);
656
657 print_proxy( "static const unsigned short %s_FormatStringOffsetTable[] =\n", iface->name );
658 print_proxy( "{\n" );
659 indent++;
660#ifdef __REACTOS__ /* r57019 / c3be8a3 */
661 if (write_proxy_procformatstring_offsets( iface, 0 ) == 0)
662 {
663 print_proxy( "0\n" );
664 }
665#else
667#endif
668 indent--;
669 print_proxy( "};\n\n" );
670
671 /* proxy info */
672 if (get_stub_mode() == MODE_Oif)
673 {
674 print_proxy( "static const MIDL_STUBLESS_PROXY_INFO %s_ProxyInfo =\n", iface->name );
675 print_proxy( "{\n" );
676 indent++;
677 print_proxy( "&Object_StubDesc,\n" );
678 print_proxy( "__MIDL_ProcFormatString.Format,\n" );
679 print_proxy( "&%s_FormatStringOffsetTable[-3],\n", iface->name );
680 print_proxy( "0,\n" );
681 print_proxy( "0,\n" );
682 print_proxy( "0\n" );
683 indent--;
684 print_proxy( "};\n\n" );
685 }
686
687 /* proxy vtable */
688 print_proxy( "static %sCINTERFACE_PROXY_VTABLE(%d) _%sProxyVtbl =\n",
689 (get_stub_mode() != MODE_Os || need_delegation_indirect(iface)) ? "" : "const ",
690 count, iface->name);
691 print_proxy( "{\n");
692 indent++;
693 print_proxy( "{\n");
694 indent++;
695 if (get_stub_mode() == MODE_Oif) print_proxy( "&%s_ProxyInfo,\n", iface->name );
696 print_proxy( "&IID_%s,\n", iface->name);
697 indent--;
698 print_proxy( "},\n");
699 print_proxy( "{\n");
700 indent++;
702 indent--;
703 print_proxy( "}\n");
704 indent--;
705 print_proxy( "};\n\n");
706
707 /* stub thunk table */
708 if (needs_stub_thunks)
709 {
710 print_proxy( "static const STUB_THUNK %s_StubThunkTable[] =\n", iface->name);
711 print_proxy( "{\n");
712 indent++;
713 write_thunk_methods( iface, 0 );
714 indent--;
715 print_proxy( "};\n\n");
716 }
717
718 /* server info */
719 print_proxy( "static const MIDL_SERVER_INFO %s_ServerInfo =\n", iface->name );
720 print_proxy( "{\n" );
721 indent++;
722 print_proxy( "&Object_StubDesc,\n" );
723 print_proxy( "0,\n" );
724 print_proxy( "__MIDL_ProcFormatString.Format,\n" );
725 print_proxy( "&%s_FormatStringOffsetTable[-3],\n", iface->name );
726 if (needs_stub_thunks)
727 print_proxy( "&%s_StubThunkTable[-3],\n", iface->name );
728 else
729 print_proxy( "0,\n" );
730 print_proxy( "0,\n" );
731 print_proxy( "0,\n" );
732 print_proxy( "0\n" );
733 indent--;
734 print_proxy( "};\n\n" );
735
736 /* stub vtable */
737 if (needs_inline_stubs)
738 {
739 print_proxy( "static const PRPC_STUB_FUNCTION %s_table[] =\n", iface->name);
740 print_proxy( "{\n");
741 indent++;
742#ifdef __REACTOS__ /* r57019 / c3be8a3 */
743 if (write_stub_methods(iface, FALSE) == 0)
744 {
745 fprintf(proxy, "0");
746 }
747#else
749#endif
750 fprintf(proxy, "\n");
751 indent--;
752 fprintf(proxy, "};\n\n");
753 }
754 print_proxy( "static %sCInterfaceStubVtbl _%sStubVtbl =\n",
755 need_delegation_indirect(iface) ? "" : "const ", iface->name);
756 print_proxy( "{\n");
757 indent++;
758 print_proxy( "{\n");
759 indent++;
760 print_proxy( "&IID_%s,\n", iface->name);
761 print_proxy( "&%s_ServerInfo,\n", iface->name );
762 print_proxy( "%d,\n", count);
763 if (needs_inline_stubs) print_proxy( "&%s_table[-3]\n", iface->name );
764 else print_proxy( "0\n" );
765 indent--;
766 print_proxy( "},\n");
767 print_proxy( "{\n");
768 indent++;
769 print_proxy( "%s_%s\n",
770 iface->details.iface->async_iface == iface ? "CStdAsyncStubBuffer" : "CStdStubBuffer",
771 need_delegation_indirect(iface) ? "DELEGATING_METHODS" : "METHODS");
772 indent--;
773 print_proxy( "}\n");
774 indent--;
775 print_proxy( "};\n");
776 print_proxy( "\n");
777}
778
779static int does_any_iface(const statement_list_t *stmts, type_pred_t pred)
780{
781 const statement_t *stmt;
782
783 if (stmts)
784 LIST_FOR_EACH_ENTRY(stmt, stmts, const statement_t, entry)
785 {
786 if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE)
787 {
788 if (pred(stmt->u.type))
789 return TRUE;
790 }
791 }
792
793 return FALSE;
794}
795
796int need_proxy(const type_t *iface)
797{
798 if (!is_object( iface )) return 0;
799 if (is_local( iface->attrs )) return 0;
800 if (is_attr( iface->attrs, ATTR_DISPINTERFACE )) return 0;
801 return 1;
802}
803
804int need_stub(const type_t *iface)
805{
806 return !is_object(iface) && !is_local(iface->attrs);
807}
808
810{
811 return does_any_iface(stmts, need_proxy);
812}
813
815{
816 return does_any_iface(stmts, need_delegation);
817}
818
819int need_inline_stubs(const type_t *iface)
820{
821 const statement_t *stmt;
822
823 if (get_stub_mode() == MODE_Os) return 1;
824
826 {
827 const var_t *func = stmt->u.var;
828 if (is_local( func->attrs )) continue;
829 if (!is_interpreted_func( iface, func )) return 1;
830 }
831 return 0;
832}
833
834static int need_proxy_and_inline_stubs(const type_t *iface)
835{
836 const statement_t *stmt;
837
838 if (!need_proxy( iface )) return 0;
839 if (get_stub_mode() == MODE_Os) return 1;
840
842 {
843 const var_t *func = stmt->u.var;
844 if (is_local( func->attrs )) continue;
845 if (!is_interpreted_func( iface, func )) return 1;
846 }
847 return 0;
848}
849
851{
852 return does_any_iface(stmts, need_stub);
853}
854
856{
857 return does_any_iface(stmts, need_inline_stubs);
858}
859
860static void write_proxy_stmts(const statement_list_t *stmts, unsigned int *proc_offset)
861{
862 const statement_t *stmt;
863 if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
864 {
865 if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE)
866 {
867 type_t *iface = stmt->u.type;
868 if (need_proxy(iface))
869 {
870 write_proxy(iface, proc_offset);
871 if (iface->details.iface->async_iface)
872 write_proxy(iface->details.iface->async_iface, proc_offset);
873 }
874 }
875 }
876}
877
878static int cmp_iid( const void *ptr1, const void *ptr2 )
879{
880 const type_t * const *iface1 = ptr1;
881 const type_t * const *iface2 = ptr2;
882 const UUID *uuid1 = get_attrp( (*iface1)->attrs, ATTR_UUID );
883 const UUID *uuid2 = get_attrp( (*iface2)->attrs, ATTR_UUID );
884 return memcmp( uuid1, uuid2, sizeof(UUID) );
885}
886
887static void build_iface_list( const statement_list_t *stmts, type_t **ifaces[], int *count )
888{
889 const statement_t *stmt;
890
891 if (!stmts) return;
892 LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
893 {
894 if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE)
895 {
896 type_t *iface = stmt->u.type;
897 if (type_iface_get_inherit(iface) && need_proxy(iface))
898 {
899 *ifaces = xrealloc( *ifaces, (*count + 1) * sizeof(**ifaces) );
900 (*ifaces)[(*count)++] = iface;
901 if (iface->details.iface->async_iface)
902 {
903 iface = iface->details.iface->async_iface;
904 *ifaces = xrealloc( *ifaces, (*count + 1) * sizeof(**ifaces) );
905 (*ifaces)[(*count)++] = iface;
906 }
907 }
908 }
909 }
910}
911
912static type_t **sort_interfaces( const statement_list_t *stmts, int *count )
913{
914 type_t **ifaces = NULL;
915
916 *count = 0;
917 build_iface_list( stmts, &ifaces, count );
918 qsort( ifaces, *count, sizeof(*ifaces), cmp_iid );
919 return ifaces;
920}
921
922static void write_proxy_routines(const statement_list_t *stmts)
923{
925 unsigned int proc_offset = 0;
926 char *file_id = proxy_token;
927 int i, count, have_baseiid = 0;
928 unsigned int table_version;
929 type_t **interfaces;
930 const type_t * delegate_to;
931
932 print_proxy( "#ifndef __REDQ_RPCPROXY_H_VERSION__\n");
933 print_proxy( "#define __REQUIRED_RPCPROXY_H_VERSION__ %u\n", get_stub_mode() == MODE_Oif ? 475 : 440);
934 print_proxy( "#endif\n");
935 print_proxy( "\n");
936 if (get_stub_mode() == MODE_Oif) print_proxy( "#define USE_STUBLESS_PROXY\n");
937 print_proxy( "#include \"rpcproxy.h\"\n");
938 print_proxy( "#ifndef __RPCPROXY_H_VERSION__\n");
939 print_proxy( "#error This code needs a newer version of rpcproxy.h\n");
940 print_proxy( "#endif /* __RPCPROXY_H_VERSION__ */\n");
941 print_proxy( "\n");
942 print_proxy( "#include \"%s\"\n", header_name);
943 print_proxy( "\n");
944
946 {
948 print_proxy( "\n");
949 print_proxy( "struct __proxy_frame\n");
950 print_proxy( "{\n");
951 print_proxy( " __DECL_EXCEPTION_FRAME\n");
952 print_proxy( " MIDL_STUB_MESSAGE _StubMsg;\n");
953 print_proxy( " void *This;\n");
954 print_proxy( "};\n");
955 print_proxy( "\n");
956 print_proxy("static int __proxy_filter( struct __proxy_frame *__frame )\n");
957 print_proxy( "{\n");
958 print_proxy( " return (__frame->_StubMsg.dwStubPhase != PROXY_SENDRECEIVE);\n");
959 print_proxy( "}\n");
960 print_proxy( "\n");
961 }
962
965 write_proxy_stmts(stmts, &proc_offset);
966
972
973 print_proxy( "#if !defined(__RPC_WIN%u__)\n", pointer_size == 8 ? 64 : 32);
974 print_proxy( "#error Invalid build platform for this proxy.\n");
975 print_proxy( "#endif\n");
976 print_proxy( "\n");
979
980 interfaces = sort_interfaces(stmts, &count);
981 fprintf(proxy, "static const CInterfaceProxyVtbl* const _%s_ProxyVtblList[] =\n", file_id);
982 fprintf(proxy, "{\n");
983 for (i = 0; i < count; i++)
984 fprintf(proxy, " (const CInterfaceProxyVtbl*)&_%sProxyVtbl,\n", interfaces[i]->name);
985 fprintf(proxy, " 0\n");
986 fprintf(proxy, "};\n");
987 fprintf(proxy, "\n");
988
989 fprintf(proxy, "static const CInterfaceStubVtbl* const _%s_StubVtblList[] =\n", file_id);
990 fprintf(proxy, "{\n");
991 for (i = 0; i < count; i++)
992 fprintf(proxy, " &_%sStubVtbl,\n", interfaces[i]->name);
993 fprintf(proxy, " 0\n");
994 fprintf(proxy, "};\n");
995 fprintf(proxy, "\n");
996
997 fprintf(proxy, "static PCInterfaceName const _%s_InterfaceNamesList[] =\n", file_id);
998 fprintf(proxy, "{\n");
999 for (i = 0; i < count; i++)
1000 fprintf(proxy, " \"%s\",\n", interfaces[i]->name);
1001 fprintf(proxy, " 0\n");
1002 fprintf(proxy, "};\n");
1003 fprintf(proxy, "\n");
1004
1005 for (i = 0; i < count; i++)
1006 if ((have_baseiid = get_delegation_indirect( interfaces[i], NULL ))) break;
1007
1008 if (have_baseiid)
1009 {
1010 fprintf(proxy, "static const IID * _%s_BaseIIDList[] =\n", file_id);
1011 fprintf(proxy, "{\n");
1012 for (i = 0; i < count; i++)
1013 {
1014 if (get_delegation_indirect(interfaces[i], &delegate_to))
1015 fprintf( proxy, " &IID_%s, /* %s */\n", delegate_to->name, interfaces[i]->name );
1016 else
1017 fprintf( proxy, " 0,\n" );
1018 }
1019 fprintf(proxy, " 0\n");
1020 fprintf(proxy, "};\n");
1021 fprintf(proxy, "\n");
1022 }
1023
1024 fprintf(proxy, "static int __stdcall _%s_IID_Lookup(const IID* pIID, int* pIndex)\n", file_id);
1025 fprintf(proxy, "{\n");
1026 fprintf(proxy, " int low = 0, high = %d;\n", count - 1);
1027 fprintf(proxy, "\n");
1028 fprintf(proxy, " while (low <= high)\n");
1029 fprintf(proxy, " {\n");
1030 fprintf(proxy, " int pos = (low + high) / 2;\n");
1031 fprintf(proxy, " int res = IID_GENERIC_CHECK_IID(_%s, pIID, pos);\n", file_id);
1032 fprintf(proxy, " if (!res) { *pIndex = pos; return 1; }\n");
1033 fprintf(proxy, " if (res > 0) low = pos + 1;\n");
1034 fprintf(proxy, " else high = pos - 1;\n");
1035 fprintf(proxy, " }\n");
1036 fprintf(proxy, " return 0;\n");
1037 fprintf(proxy, "}\n");
1038 fprintf(proxy, "\n");
1039
1040 table_version = get_stub_mode() == MODE_Oif ? 2 : 1;
1041 for (i = 0; i < count; i++)
1042 {
1043 if (interfaces[i]->details.iface->async_iface != interfaces[i]) continue;
1044 if (table_version != 6)
1045 {
1046 fprintf(proxy, "static const IID *_AsyncInterfaceTable[] =\n");
1047 fprintf(proxy, "{\n");
1048 table_version = 6;
1049 }
1050 fprintf(proxy, " &IID_%s,\n", interfaces[i]->name);
1051 fprintf(proxy, " (IID*)(LONG_PTR)-1,\n");
1052 }
1053 if (table_version == 6)
1054 {
1055 fprintf(proxy, " 0\n");
1056 fprintf(proxy, "};\n");
1057 fprintf(proxy, "\n");
1058 }
1059
1060 fprintf(proxy, "const ExtendedProxyFileInfo %s_ProxyFileInfo DECLSPEC_HIDDEN =\n", file_id);
1061 fprintf(proxy, "{\n");
1062 fprintf(proxy, " (const PCInterfaceProxyVtblList*)_%s_ProxyVtblList,\n", file_id);
1063 fprintf(proxy, " (const PCInterfaceStubVtblList*)_%s_StubVtblList,\n", file_id);
1064 fprintf(proxy, " _%s_InterfaceNamesList,\n", file_id);
1065 if (have_baseiid) fprintf(proxy, " _%s_BaseIIDList,\n", file_id);
1066 else fprintf(proxy, " 0,\n");
1067 fprintf(proxy, " _%s_IID_Lookup,\n", file_id);
1068 fprintf(proxy, " %d,\n", count);
1069 fprintf(proxy, " %u,\n", table_version);
1070 fprintf(proxy, " %s,\n", table_version == 6 ? "_AsyncInterfaceTable" : "0");
1071 fprintf(proxy, " 0,\n");
1072 fprintf(proxy, " 0,\n");
1073 fprintf(proxy, " 0\n");
1074 fprintf(proxy, "};\n");
1075}
1076
1078{
1079 if (!do_proxies) return;
1080 if (do_everything && !need_proxy_file(stmts)) return;
1081
1082 init_proxy(stmts);
1083 if(!proxy) return;
1084
1085 write_proxy_routines( stmts );
1086 fclose(proxy);
1087}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define skip(...)
Definition: atltest.h:64
void * xrealloc(void *oldmem, size_t size)
Definition: uimain.c:736
static void print(LPPRINTDLGW pd, LPWSTR wszFileName)
Definition: print.c:438
static int list_empty(struct list_entry *head)
Definition: list.h:58
int get_name(unsigned char **pos, uint32_t *remaining, const char **out_name)
Definition: util.c:55
Definition: list.h:37
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int idx
Definition: utils.c:41
r parent
Definition: btrfs.c:3010
#define __FUNCTION__
Definition: types.h:116
void write_expr(FILE *h, const expr_t *e, int brackets, int toplevel, const char *toplevel_prefix, const type_t *cont_type, const char *local_var_prefix)
Definition: expr.c:691
#define printf
Definition: freeldr.h:93
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLenum func
Definition: glext.h:6028
const GLfloat * m
Definition: glext.h:10848
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static int is_void(const type_t *t)
Definition: header.h:69
static int is_ptr(const type_t *t)
Definition: header.h:59
static int is_array(const type_t *t)
Definition: header.h:64
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
uint32_t entry
Definition: isohybrid.c:63
#define error(str)
Definition: mkdosfs.c:1605
#define PACKAGE_VERSION
Definition: config.h:835
int details
Definition: msacm.c:1366
static unsigned char get_struct_fc(ITypeInfo *typeinfo, TYPEATTR *attr)
Definition: ndr_typelib.c:308
@ FC_STRUCT
Definition: ndrtypes.h:157
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
int is_local(const attr_list_t *a)
Definition: header.c:938
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99
void write_args(FILE *h, const var_list_t *args, const char *name, int method, int do_indent)
Definition: header.c:1058
void write_type_decl_left(FILE *f, type_t *t)
Definition: header.c:566
const var_t * is_callas(const attr_list_t *a)
Definition: header.c:943
void write_type_decl(FILE *f, type_t *t, const char *name)
Definition: header.c:561
void * get_attrp(const attr_list_t *list, enum attr_type t)
Definition: header.c:107
user_type_list_t user_type_list
Definition: header.c:42
int is_object(const type_t *iface)
Definition: header.c:928
int need_stub_files(const statement_list_t *stmts)
Definition: proxy.c:850
static int write_stub_methods(type_t *iface, int skip)
Definition: proxy.c:555
static void write_thunk_methods(type_t *iface, int skip)
Definition: proxy.c:588
static void build_iface_list(const statement_list_t *stmts, type_t **ifaces[], int *count)
Definition: proxy.c:887
static void write_proxy_stmts(const statement_list_t *stmts, unsigned int *proc_offset)
Definition: proxy.c:860
static int need_proxy_and_inline_stubs(const type_t *iface)
Definition: proxy.c:834
int need_proxy(const type_t *iface)
Definition: proxy.c:796
static int need_delegation_indirect(const type_t *iface)
Definition: proxy.c:148
static void gen_stub(type_t *iface, const var_t *func, const char *cas, unsigned int proc_offset)
Definition: proxy.c:325
static void gen_stub_thunk(type_t *iface, const var_t *func, unsigned int proc_offset)
Definition: proxy.c:439
static int does_any_iface(const statement_list_t *stmts, type_pred_t pred)
Definition: proxy.c:779
int need_inline_stubs(const type_t *iface)
Definition: proxy.c:819
static type_t ** sort_interfaces(const statement_list_t *stmts, int *count)
Definition: proxy.c:912
int need_proxy_delegation(const statement_list_t *stmts)
Definition: proxy.c:814
int need_inline_stubs_file(const statement_list_t *stmts)
Definition: proxy.c:855
static int need_delegation(const type_t *iface)
Definition: proxy.c:129
static void write_proxy_routines(const statement_list_t *stmts)
Definition: proxy.c:922
static void write_proxy(type_t *iface, unsigned int *proc_offset)
Definition: proxy.c:612
static int write_proxy_methods(type_t *iface, int skip)
Definition: proxy.c:530
static void write_stubdescproto(void)
Definition: proxy.c:52
static int indent
Definition: proxy.c:41
static void write_proxy_procformatstring_offsets(const type_t *iface, int skip)
Definition: proxy.c:494
static void print_proxy(const char *format,...) __attribute__((format(printf
Definition: proxy.c:44
int need_proxy_file(const statement_list_t *stmts)
Definition: proxy.c:809
static int get_delegation_indirect(const type_t *iface, const type_t **delegate_to)
Definition: proxy.c:135
static void gen_proxy(type_t *iface, const var_t *func, int idx, unsigned int proc_offset)
Definition: proxy.c:197
int count_methods(const type_t *iface)
Definition: proxy.c:465
void write_proxies(const statement_list_t *stmts)
Definition: proxy.c:1077
static void free_variable(const var_t *arg, const char *local_var_prefix)
Definition: proxy.c:153
static FILE * proxy
Definition: proxy.c:40
static void proxy_free_variables(var_list_t *args, const char *local_var_prefix)
Definition: proxy.c:184
static void write_stubdesc(int expr_eval_routines)
Definition: proxy.c:58
static void init_proxy(const statement_list_t *stmts)
Definition: proxy.c:83
int need_stub(const type_t *iface)
Definition: proxy.c:804
static void clear_output_vars(const var_list_t *args)
Definition: proxy.c:105
static const statement_t * get_callas_source(const type_t *iface, const var_t *def)
Definition: proxy.c:480
static int cmp_iid(const void *ptr1, const void *ptr2)
Definition: proxy.c:878
void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
statement_type_t type
Definition: parser.h:124
union _statement_t::@5025 u
var_t * var
Definition: widltypes.h:539
attr_list_t * attrs
Definition: widltypes.h:422
union _type_t::@5024 details
struct iface_details * iface
Definition: widltypes.h:428
const char * name
Definition: widltypes.h:419
type_t * type
Definition: widltypes.h:453
char * name
Definition: widltypes.h:452
Definition: match.c:390
Definition: name.c:39
void write_pointer_checks(FILE *file, int indent, const var_t *func)
Definition: typegen.c:4845
void declare_stub_args(FILE *file, int indent, const var_t *func)
Definition: typegen.c:4615
enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *attrs, unsigned int flags)
Definition: typegen.c:329
void write_procformatstring(FILE *file, const statement_list_t *stmts, type_pred_t pred)
Definition: typegen.c:1513
void write_parameters_init(FILE *file, int indent, const var_t *func, const char *local_var_prefix)
Definition: typegen.c:903
static struct list expr_eval_routines
Definition: typegen.c:53
void write_user_quad_list(FILE *file)
Definition: typegen.c:4918
void write_full_pointer_init(FILE *file, int indent, const var_t *func, int is_server)
Definition: typegen.c:2088
void write_func_param_struct(FILE *file, const type_t *iface, const type_t *func, const char *var_decl, int add_retval)
Definition: typegen.c:4789
void write_expr_eval_routine_list(FILE *file, const char *iface)
Definition: typegen.c:4896
int decl_indirect(const type_t *t)
Definition: typegen.c:948
void write_typeformatstring(FILE *file, const statement_list_t *stmts, type_pred_t pred)
Definition: typegen.c:3761
void write_exceptions(FILE *file)
Definition: typegen.c:5033
void write_remoting_arguments(FILE *file, int indent, const var_t *func, const char *local_var_prefix, enum pass pass, enum remoting_phase phase)
Definition: typegen.c:4559
int is_full_pointer_function(const var_t *func)
Definition: typegen.c:2075
unsigned int get_size_procformatstring_func(const type_t *iface, const var_t *func)
Definition: typegen.c:4584
void write_client_call_routine(FILE *file, const type_t *iface, const var_t *func, const char *prefix, unsigned int proc_offset)
Definition: typegen.c:4974
int is_interpreted_func(const type_t *iface, const var_t *func)
Definition: typegen.c:1240
int write_expr_eval_routines(FILE *file, const char *iface)
Definition: typegen.c:4857
void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char *local_var_prefix, enum remoting_phase phase, const var_t *var, int valid_variance)
Definition: typegen.c:4129
void write_full_pointer_free(FILE *file, int indent, const var_t *func)
Definition: typegen.c:2095
void write_formatstringsdecl(FILE *f, int indent, const statement_list_t *stmts, type_pred_t pred)
Definition: typegen.c:929
void assign_stub_out_args(FILE *file, int indent, const var_t *func, const char *local_var_prefix)
Definition: typegen.c:4676
@ PASS_RETURN
Definition: typegen.h:28
@ PASS_OUT
Definition: typegen.h:27
@ PASS_IN
Definition: typegen.h:26
int(* type_pred_t)(const type_t *)
Definition: typegen.h:63
@ PHASE_MARSHAL
Definition: typegen.h:34
@ PHASE_BUFFERSIZE
Definition: typegen.h:33
@ PHASE_FREE
Definition: typegen.h:36
@ PHASE_UNMARSHAL
Definition: typegen.h:35
@ TDT_IGNORE_STRINGS
Definition: typegen.h:42
@ TGT_POINTER
Definition: typegen.h:53
@ TGT_STRUCT
Definition: typegen.h:58
@ TGT_ARRAY
Definition: typegen.h:54
@ TGT_ENUM
Definition: typegen.h:57
@ TGT_BASIC
Definition: typegen.h:56
@ TGT_IFACE_POINTER
Definition: typegen.h:55
static int type_array_is_decl_as_ptr(const type_t *type)
Definition: typetree.h:260
static enum type_type type_get_type(const type_t *type)
Definition: typetree.h:68
static type_t * type_function_get_rettype(const type_t *type)
Definition: typetree.h:108
static int type_array_has_conformance(const type_t *type)
Definition: typetree.h:218
static var_t * type_function_get_retval(const type_t *type)
Definition: typetree.h:101
static expr_t * type_array_get_conformance(const type_t *type)
Definition: typetree.h:239
static type_t * type_iface_get_inherit(const type_t *type)
Definition: typetree.h:158
static statement_list_t * type_iface_get_stmts(const type_t *type)
Definition: typetree.h:151
static type_t * type_pointer_get_ref(const type_t *type)
Definition: typetree.h:292
unsigned int pointer_size
Definition: widl.c:158
int do_everything
Definition: widl.c:114
char * proxy_name
Definition: widl.c:141
int do_proxies
Definition: widl.c:119
char * proxy_token
Definition: widl.c:142
enum stub_mode get_stub_mode(void)
Definition: widl.c:211
char * header_name
Definition: widl.c:136
char * input_name
Definition: widl.c:133
@ MODE_Os
Definition: widl.h:87
@ MODE_Oif
Definition: widl.h:89
@ TYPE_ENUM
Definition: widltypes.h:404
@ TYPE_BASIC
Definition: widltypes.h:403
@ TYPE_INTERFACE
Definition: widltypes.h:412
@ ATTR_IN
Definition: widltypes.h:118
@ ATTR_UUID
Definition: widltypes.h:166
@ ATTR_OUT
Definition: widltypes.h:138
@ ATTR_CALLCONV
Definition: widltypes.h:80
@ ATTR_DISPINTERFACE
Definition: widltypes.h:94
@ STMT_TYPE
Definition: widltypes.h:242
static var_list_t * type_get_function_args(const type_t *func_type)
Definition: widltypes.h:585
#define STATEMENTS_FOR_EACH_FUNC(stmt, stmts)
Definition: widltypes.h:597
void * arg
Definition: msvc.h:10
#define const
Definition: zconf.h:233