ReactOS  0.4.12-dev-432-g3463b2d
client.c File Reference
#include "config.h"
#include "wine/port.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "widl.h"
#include "utils.h"
#include "parser.h"
#include "header.h"
#include "widltypes.h"
#include "typegen.h"
#include "expr.h"
Include dependency graph for client.c:

Go to the source code of this file.

Functions

static void print_client (const char *format,...) __attribute__((format(printf
 
static void write_client_func_decl (const type_t *iface, const var_t *func)
 
static void write_function_stub (const type_t *iface, const var_t *func, int method_count, unsigned int proc_offset)
 
static void write_function_stubs (type_t *iface, unsigned int *proc_offset)
 
static void write_stubdescdecl (type_t *iface)
 
static void write_stubdescriptor (type_t *iface, int expr_eval_routines)
 
static void write_clientinterfacedecl (type_t *iface)
 
static void write_implicithandledecl (type_t *iface)
 
static void init_client (void)
 
static void write_client_ifaces (const statement_list_t *stmts, int expr_eval_routines, unsigned int *proc_offset)
 
static void write_generic_handle_routine_list (void)
 
static void write_client_routines (const statement_list_t *stmts)
 
void write_client (const statement_list_t *stmts)
 

Variables

static FILEclient
 
static int indent = 0
 

Function Documentation

◆ init_client()

static void init_client ( void  )
static

Definition at line 416 of file client.c.

417 {
418  if (client) return;
419  if (!(client = fopen(client_name, "w")))
420  error("Could not open %s for output\n", client_name);
421 
422  print_client("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
423  print_client("#include <string.h>\n");
424  print_client( "\n");
425  print_client("#include \"%s\"\n", header_name);
426  print_client( "\n");
427  print_client( "#ifndef DECLSPEC_HIDDEN\n");
428  print_client( "#define DECLSPEC_HIDDEN\n");
429  print_client( "#endif\n");
430  print_client( "\n");
431 }
#define error(str)
Definition: mkdosfs.c:1605
#define PACKAGE_VERSION
Definition: config.h:835
char * header_name
Definition: widl.c:126
static FILE * client
Definition: client.c:41
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
static void print_client(const char *format,...) __attribute__((format(printf
Definition: client.c:45
char * client_name
Definition: widl.c:133
char * input_name
Definition: parser.yy.c:772

Referenced by write_client().

◆ print_client()

static void static void print_client ( const char format,
  ... 
)
static

Definition at line 45 of file client.c.

46 {
47  va_list va;
48  va_start(va, format);
49  print(client, indent, format, va);
50  va_end(va);
51 }
static int indent
Definition: client.c:42
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
static FILE * client
Definition: client.c:41
static void print(LPPRINTDLGW pd, LPWSTR wszFileName)
Definition: print.c:440
#define va_start(ap, A)
Definition: acmsvcex.h:91

Referenced by init_client(), write_client_func_decl(), write_client_ifaces(), write_client_routines(), write_clientinterfacedecl(), write_function_stub(), write_function_stubs(), write_generic_handle_routine_list(), write_stubdescdecl(), and write_stubdescriptor().

◆ write_client()

void write_client ( const statement_list_t stmts)

Definition at line 520 of file client.c.

521 {
522  if (!do_client)
523  return;
524  if (do_everything && !need_stub_files(stmts))
525  return;
526 
527  init_client();
528  if (!client)
529  return;
530 
531  if (do_win32 && do_win64)
532  {
533  fprintf(client, "#ifndef _WIN64\n\n");
534  pointer_size = 4;
535  write_client_routines( stmts );
536  fprintf(client, "\n#else /* _WIN64 */\n\n");
537  pointer_size = 8;
538  write_client_routines( stmts );
539  fprintf(client, "\n#endif /* _WIN64 */\n");
540  }
541  else if (do_win32)
542  {
543  pointer_size = 4;
544  write_client_routines( stmts );
545  }
546  else if (do_win64)
547  {
548  pointer_size = 8;
549  write_client_routines( stmts );
550  }
551 
552  fclose(client);
553 }
static void init_client(void)
Definition: client.c:416
int do_client
Definition: widl.c:109
static void write_client_routines(const statement_list_t *stmts)
Definition: client.c:494
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
int do_win64
Definition: widl.c:117
static FILE * client
Definition: client.c:41
int need_stub_files(const statement_list_t *stmts)
Definition: proxy.c:841
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
unsigned int pointer_size
Definition: widl.c:148
int do_win32
Definition: widl.c:116
int do_everything
Definition: widl.c:103

Referenced by yyparse().

◆ write_client_func_decl()

static void write_client_func_decl ( const type_t iface,
const var_t func 
)
static

Definition at line 53 of file client.c.

54 {
55  const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV);
57  type_t *rettype = type_function_get_rettype(func->type);
58 
59  if (!callconv) callconv = "__cdecl";
60  write_type_decl_left(client, rettype);
61  fprintf(client, " %s ", callconv);
62  fprintf(client, "%s%s(\n", prefix_client, get_name(func));
63  indent++;
64  if (args)
65  write_args(client, args, iface->name, 0, TRUE);
66  else
67  print_client("void");
68  fprintf(client, ")\n");
69  indent--;
70 }
GLenum func
Definition: glext.h:6028
static var_list_t * type_get_function_args(const type_t *func_type)
Definition: widltypes.h:584
#define TRUE
Definition: types.h:120
void * get_attrp(const attr_list_t *list, enum attr_type t)
Definition: header.c:107
const char * prefix_client
Definition: widl.c:141
static int indent
Definition: client.c:42
Definition: match.c:390
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
int get_name(unsigned char **pos, uint32_t *remaining, const char **out_name)
Definition: util.c:55
void write_args(FILE *h, const var_list_t *args, const char *name, int method, int do_indent)
Definition: header.c:987
void write_type_decl_left(FILE *f, type_t *t)
Definition: header.c:536
static FILE * client
Definition: client.c:41
const char * name
Definition: widltypes.h:416
Definition: _list.h:228
static void print_client(const char *format,...) __attribute__((format(printf
Definition: client.c:45
static type_t * type_function_get_rettype(const type_t *type)
Definition: typetree.h:108

Referenced by write_function_stub().

◆ write_client_ifaces()

static void write_client_ifaces ( const statement_list_t stmts,
int  expr_eval_routines,
unsigned int proc_offset 
)
static

Definition at line 434 of file client.c.

435 {
436  const statement_t *stmt;
437  if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
438  {
439  if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE)
440  {
441  int has_func = 0;
442  const statement_t *stmt2;
443  type_t *iface = stmt->u.type;
444  if (!need_stub(iface))
445  return;
446 
447  fprintf(client, "/*****************************************************************************\n");
448  fprintf(client, " * %s interface\n", iface->name);
449  fprintf(client, " */\n");
450  fprintf(client, "\n");
451 
453  {
454  has_func = 1;
455  break;
456  }
457 
458  if (has_func)
459  {
461 
463  write_stubdescdecl(iface);
464  write_function_stubs(iface, proc_offset);
465 
466  print_client("#if !defined(__RPC_WIN%u__)\n", pointer_size == 8 ? 64 : 32);
467  print_client("#error Invalid build platform for this stub.\n");
468  print_client("#endif\n");
469 
470  fprintf(client, "\n");
472  }
473  }
474  }
475 }
#define STATEMENTS_FOR_EACH_FUNC(stmt, stmts)
Definition: widltypes.h:596
static struct list expr_eval_routines
Definition: typegen.c:53
static void write_stubdescriptor(type_t *iface, int expr_eval_routines)
Definition: client.c:315
uint8_t entry
Definition: isohybrid.c:63
static void write_stubdescdecl(type_t *iface)
Definition: client.c:308
union _statement_t::@4015 u
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static void write_clientinterfacedecl(type_t *iface)
Definition: client.c:361
statement_type_t type
Definition: parser.h:124
static enum type_type type_get_type(const type_t *type)
Definition: typetree.h:68
static FILE * client
Definition: client.c:41
static void write_implicithandledecl(type_t *iface)
Definition: client.c:404
const char * name
Definition: widltypes.h:416
unsigned int pointer_size
Definition: widl.c:148
int need_stub(const type_t *iface)
Definition: proxy.c:795
static void print_client(const char *format,...) __attribute__((format(printf
Definition: client.c:45
static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
Definition: client.c:290
static statement_list_t * type_iface_get_stmts(const type_t *type)
Definition: typetree.h:151

Referenced by write_client_routines().

◆ write_client_routines()

static void write_client_routines ( const statement_list_t stmts)
static

Definition at line 494 of file client.c.

495 {
496  unsigned int proc_offset = 0;
497  int expr_eval_routines;
498 
499  if (need_inline_stubs_file( stmts ))
500  {
502  print_client( "\n");
503  }
504 
507  if (expr_eval_routines)
511 
512  write_client_ifaces(stmts, expr_eval_routines, &proc_offset);
513 
514  fprintf(client, "\n");
515 
518 }
static struct list expr_eval_routines
Definition: typegen.c:53
void write_typeformatstring(FILE *file, const statement_list_t *stmts, type_pred_t pred)
Definition: typegen.c:3678
void write_user_quad_list(FILE *file)
Definition: typegen.c:4844
static int indent
Definition: client.c:42
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
int need_inline_stubs_file(const statement_list_t *stmts)
Definition: proxy.c:846
void write_procformatstring(FILE *file, const statement_list_t *stmts, type_pred_t pred)
Definition: typegen.c:1491
static void write_client_ifaces(const statement_list_t *stmts, int expr_eval_routines, unsigned int *proc_offset)
Definition: client.c:434
int write_expr_eval_routines(FILE *file, const char *iface)
Definition: typegen.c:4783
static FILE * client
Definition: client.c:41
void write_formatstringsdecl(FILE *f, int indent, const statement_list_t *stmts, type_pred_t pred)
Definition: typegen.c:928
char * client_token
Definition: widl.c:134
int need_stub(const type_t *iface)
Definition: proxy.c:795
static void print_client(const char *format,...) __attribute__((format(printf
Definition: client.c:45
static void write_generic_handle_routine_list(void)
Definition: client.c:477
void write_expr_eval_routine_list(FILE *file, const char *iface)
Definition: typegen.c:4822
void write_exceptions(FILE *file)
Definition: typegen.c:4959

Referenced by write_client().

◆ write_clientinterfacedecl()

static void write_clientinterfacedecl ( type_t iface)
static

Definition at line 361 of file client.c.

362 {
363  unsigned int ver = get_attrv(iface->attrs, ATTR_VERSION);
364  const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID);
365  const str_list_t *endpoints = get_attrp(iface->attrs, ATTR_ENDPOINT);
366 
367  if (endpoints) write_endpoints( client, iface->name, endpoints );
368 
369  print_client("static const RPC_CLIENT_INTERFACE %s___RpcClientInterface =\n", iface->name );
370  print_client("{\n");
371  indent++;
372  print_client("sizeof(RPC_CLIENT_INTERFACE),\n");
373  print_client("{{0x%08x,0x%04x,0x%04x,{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x}},{%d,%d}},\n",
374  uuid->Data1, uuid->Data2, uuid->Data3, uuid->Data4[0], uuid->Data4[1],
375  uuid->Data4[2], uuid->Data4[3], uuid->Data4[4], uuid->Data4[5], uuid->Data4[6],
376  uuid->Data4[7], MAJORVERSION(ver), MINORVERSION(ver));
377  print_client("{{0x8a885d04,0x1ceb,0x11c9,{0x9f,0xe8,0x08,0x00,0x2b,0x10,0x48,0x60}},{2,0}},\n"); /* FIXME */
378  print_client("0,\n");
379  if (endpoints)
380  {
381  print_client("%u,\n", list_count(endpoints));
382  print_client("(PRPC_PROTSEQ_ENDPOINT)%s__RpcProtseqEndpoint,\n", iface->name);
383  }
384  else
385  {
386  print_client("0,\n");
387  print_client("0,\n");
388  }
389  print_client("0,\n");
390  print_client("0,\n");
391  print_client("0,\n");
392  indent--;
393  print_client("};\n");
394  if (old_names)
395  print_client("RPC_IF_HANDLE %s_ClientIfHandle DECLSPEC_HIDDEN = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n",
396  iface->name, iface->name);
397  else
398  print_client("RPC_IF_HANDLE %s%s_v%d_%d_c_ifspec DECLSPEC_HIDDEN = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n",
399  prefix_client, iface->name, MAJORVERSION(ver), MINORVERSION(ver), iface->name);
400  fprintf(client, "\n");
401 }
void * get_attrp(const attr_list_t *list, enum attr_type t)
Definition: header.c:107
unsigned int get_attrv(const attr_list_t *list, enum attr_type t)
Definition: header.c:115
const char * prefix_client
Definition: widl.c:141
void write_endpoints(FILE *f, const char *prefix, const str_list_t *list)
Definition: typegen.c:4866
static int indent
Definition: client.c:42
__WINE_SERVER_LIST_INLINE unsigned int list_count(const struct list *list)
Definition: list.h:155
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
attr_list_t * attrs
Definition: widltypes.h:419
static FILE * client
Definition: client.c:41
const char * name
Definition: widltypes.h:416
Definition: _list.h:228
static void print_client(const char *format,...) __attribute__((format(printf
Definition: client.c:45
Definition: msctf.idl:510
int old_names
Definition: widl.c:115
#define MAJORVERSION(version)
Definition: utils.h:75
#define MINORVERSION(version)
Definition: utils.h:76

Referenced by write_client_ifaces().

◆ write_function_stub()

static void write_function_stub ( const type_t iface,
const var_t func,
int  method_count,
unsigned int  proc_offset 
)
static

Definition at line 72 of file client.c.

74 {
75  unsigned char explicit_fc, implicit_fc;
76  int has_full_pointer = is_full_pointer_function(func);
77  var_t *retval = type_function_get_retval(func->type);
78  const var_t *handle_var = get_func_handle_var( iface, func, &explicit_fc, &implicit_fc );
79  int has_ret = !is_void(retval->type);
80 
81  if (is_interpreted_func( iface, func ))
82  {
83  write_client_func_decl( iface, func );
84  write_client_call_routine( client, iface, func, iface->name, proc_offset );
85  return;
86  }
87 
88  print_client( "struct __frame_%s%s\n{\n", prefix_client, get_name(func) );
89  indent++;
90  print_client( "__DECL_EXCEPTION_FRAME\n" );
91  print_client("MIDL_STUB_MESSAGE _StubMsg;\n");
92  if (handle_var)
93  {
94  if (explicit_fc == RPC_FC_BIND_GENERIC)
95  print_client("%s %s;\n",
96  get_explicit_generic_handle_type(handle_var)->name, handle_var->name );
97  print_client("RPC_BINDING_HANDLE _Handle;\n");
98  }
99 
100  if (has_ret && decl_indirect(retval->type))
101  {
102  print_client("void *_p_%s;\n", retval->name);
103  }
104  indent--;
105  print_client( "};\n\n" );
106 
107  print_client( "static void __finally_%s%s(", prefix_client, get_name(func) );
108  print_client( " struct __frame_%s%s *__frame )\n{\n", prefix_client, get_name(func) );
109  indent++;
110 
111  if (has_full_pointer)
113 
114  print_client("NdrFreeBuffer(&__frame->_StubMsg);\n");
115 
116  if (explicit_fc == RPC_FC_BIND_GENERIC)
117  {
118  fprintf(client, "\n");
119  print_client("if (__frame->_Handle)\n");
120  indent++;
121  print_client("%s_unbind(__frame->%s, __frame->_Handle);\n",
122  get_explicit_generic_handle_type(handle_var)->name, handle_var->name);
123  indent--;
124  }
125  indent--;
126  print_client( "}\n\n" );
127 
128  write_client_func_decl( iface, func );
129 
130  /* write the functions body */
131  fprintf(client, "{\n");
132  indent++;
133  print_client( "struct __frame_%s%s __f, * const __frame = &__f;\n", prefix_client, get_name(func) );
134 
135  /* declare return value */
136  if (has_ret)
137  {
138  print_client("%s", "");
139  write_type_decl(client, retval->type, retval->name);
140  fprintf(client, ";\n");
141  }
142  print_client("RPC_MESSAGE _RpcMessage;\n");
143 
144  if (handle_var)
145  {
146  print_client( "__frame->_Handle = 0;\n" );
147  if (explicit_fc == RPC_FC_BIND_GENERIC)
148  print_client("__frame->%s = %s;\n", handle_var->name, handle_var->name );
149  }
150  if (has_ret && decl_indirect(retval->type))
151  {
152  print_client("__frame->_p_%s = &%s;\n", retval->name, retval->name);
153  }
154  fprintf(client, "\n");
155 
156  print_client( "RpcExceptionInit( 0, __finally_%s%s );\n", prefix_client, get_name(func) );
157 
158  if (has_full_pointer)
160 
161  /* check pointers */
163 
164  print_client("RpcTryFinally\n");
165  print_client("{\n");
166  indent++;
167 
168  print_client("NdrClientInitializeNew(&_RpcMessage, &__frame->_StubMsg, &%s_StubDesc, %d);\n",
169  iface->name, method_count);
170 
171  if (is_attr(func->attrs, ATTR_IDEMPOTENT) || is_attr(func->attrs, ATTR_BROADCAST))
172  {
173  print_client("_RpcMessage.RpcFlags = ( RPC_NCA_FLAGS_DEFAULT ");
174  if (is_attr(func->attrs, ATTR_IDEMPOTENT))
175  fprintf(client, "| RPC_NCA_FLAGS_IDEMPOTENT ");
176  if (is_attr(func->attrs, ATTR_BROADCAST))
177  fprintf(client, "| RPC_NCA_FLAGS_BROADCAST ");
178  fprintf(client, ");\n\n");
179  }
180 
181  switch (explicit_fc)
182  {
184  print_client("__frame->_Handle = %s;\n", handle_var->name);
185  fprintf(client, "\n");
186  break;
187  case RPC_FC_BIND_GENERIC:
188  print_client("__frame->_Handle = %s_bind(%s);\n",
189  get_explicit_generic_handle_type(handle_var)->name, handle_var->name);
190  fprintf(client, "\n");
191  break;
192  case RPC_FC_BIND_CONTEXT:
193  {
194  /* if the context_handle attribute appears in the chain of types
195  * without pointers being followed, then the context handle must
196  * be direct, otherwise it is a pointer */
197  int is_ch_ptr = !is_aliaschain_attr(handle_var->type, ATTR_CONTEXTHANDLE);
198  print_client("if (%s%s != 0)\n", is_ch_ptr ? "*" : "", handle_var->name);
199  indent++;
200  print_client("__frame->_Handle = NDRCContextBinding(%s%s);\n",
201  is_ch_ptr ? "*" : "", handle_var->name);
202  indent--;
203  if (is_attr(handle_var->attrs, ATTR_IN) && !is_attr(handle_var->attrs, ATTR_OUT))
204  {
205  print_client("else\n");
206  indent++;
207  print_client("RpcRaiseException(RPC_X_SS_IN_NULL_CONTEXT);\n");
208  indent--;
209  }
210  fprintf(client, "\n");
211  break;
212  }
213  case 0: /* implicit handle */
214  if (handle_var)
215  {
216  print_client("__frame->_Handle = %s;\n", handle_var->name);
217  fprintf(client, "\n");
218  }
219  break;
220  }
221 
223 
224  print_client("NdrGetBuffer(&__frame->_StubMsg, __frame->_StubMsg.BufferLength, ");
225  if (handle_var)
226  fprintf(client, "__frame->_Handle);\n\n");
227  else
228  fprintf(client,"%s__MIDL_AutoBindHandle);\n\n", iface->name);
229 
230  /* marshal arguments */
232 
233  /* send/receive message */
234  /* print_client("NdrNsSendReceive(\n"); */
235  /* print_client("(unsigned char *)__frame->_StubMsg.Buffer,\n"); */
236  /* print_client("(RPC_BINDING_HANDLE *) &%s__MIDL_AutoBindHandle);\n", iface->name); */
237  print_client("NdrSendReceive(&__frame->_StubMsg, __frame->_StubMsg.Buffer);\n\n");
238 
239  print_client("__frame->_StubMsg.BufferStart = _RpcMessage.Buffer;\n");
240  print_client("__frame->_StubMsg.BufferEnd = __frame->_StubMsg.BufferStart + _RpcMessage.BufferLength;\n");
241 
243  {
244  fprintf(client, "\n");
245 
246  print_client("if ((_RpcMessage.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n");
247  indent++;
248  print_client("NdrConvert(&__frame->_StubMsg, (PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n",
249  proc_offset);
250  indent--;
251  }
252 
253  /* unmarshall arguments */
254  fprintf(client, "\n");
256 
257  /* unmarshal return value */
258  if (has_ret)
259  {
260  if (decl_indirect(retval->type))
261  print_client("MIDL_memset(&%s, 0, sizeof(%s));\n", retval->name, retval->name);
262  else if (is_ptr(retval->type) || is_array(retval->type))
263  print_client("%s = 0;\n", retval->name);
265  }
266 
267  indent--;
268  print_client("}\n");
269  print_client("RpcFinally\n");
270  print_client("{\n");
271  indent++;
272  print_client( "__finally_%s%s( __frame );\n", prefix_client, get_name(func) );
273  indent--;
274  print_client("}\n");
275  print_client("RpcEndFinally\n");
276 
277 
278  /* emit return code */
279  if (has_ret)
280  {
281  fprintf(client, "\n");
282  print_client("return %s;\n", retval->name);
283  }
284 
285  indent--;
286  fprintf(client, "}\n");
287  fprintf(client, "\n");
288 }
GLenum func
Definition: glext.h:6028
const char * prefix_client
Definition: widl.c:141
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:4900
int is_interpreted_func(const type_t *iface, const var_t *func)
Definition: typegen.c:1239
#define RPC_FC_BIND_PRIMITIVE
Definition: rpcfc.h:84
const type_t * get_explicit_generic_handle_type(const var_t *var)
Definition: header.c:784
#define RPC_FC_BIND_CONTEXT
Definition: rpcfc.h:81
static int indent
Definition: client.c:42
void write_full_pointer_free(FILE *file, int indent, const var_t *func)
Definition: typegen.c:2073
static var_t * type_function_get_retval(const type_t *type)
Definition: typetree.h:101
const var_t * get_func_handle_var(const type_t *iface, const var_t *func, unsigned char *explicit_fc, unsigned char *implicit_fc)
Definition: header.c:796
int is_full_pointer_function(const var_t *func)
Definition: typegen.c:2053
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
int has_out_arg_or_return(const var_t *func)
Definition: header.c:837
static int is_ptr(const type_t *t)
Definition: header.h:58
void write_full_pointer_init(FILE *file, int indent, const var_t *func, int is_server)
Definition: typegen.c:2066
int get_name(unsigned char **pos, uint32_t *remaining, const char **out_name)
Definition: util.c:55
static int is_array(const type_t *t)
Definition: header.h:63
void write_type_decl(FILE *f, type_t *t, const char *name)
Definition: header.c:531
int decl_indirect(const type_t *t)
Definition: typegen.c:947
int is_aliaschain_attr(const type_t *type, enum attr_type attr)
Definition: header.c:86
#define RPC_FC_BIND_GENERIC
Definition: rpcfc.h:83
type_t * type
Definition: widltypes.h:450
attr_list_t * attrs
Definition: widltypes.h:451
static FILE * client
Definition: client.c:41
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:4476
const char * name
Definition: widltypes.h:416
char * name
Definition: widltypes.h:449
static void print_client(const char *format,...) __attribute__((format(printf
Definition: client.c:45
static void write_client_func_decl(const type_t *iface, const var_t *func)
Definition: client.c:53
void write_pointer_checks(FILE *file, int indent, const var_t *func)
Definition: typegen.c:4771
Definition: name.c:36
static int is_void(const type_t *t)
Definition: header.h:68
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99

Referenced by write_function_stubs().

◆ write_function_stubs()

static void write_function_stubs ( type_t iface,
unsigned int proc_offset 
)
static

Definition at line 290 of file client.c.

291 {
292  const statement_t *stmt;
294  int method_count = 0;
295 
296  if (!implicit_handle)
297  print_client("static RPC_BINDING_HANDLE %s__MIDL_AutoBindHandle;\n\n", iface->name);
298 
300  {
301  const var_t *func = stmt->u.var;
302  write_function_stub( iface, func, method_count++, *proc_offset );
303  *proc_offset += get_size_procformatstring_func( iface, func );
304  }
305 }
#define STATEMENTS_FOR_EACH_FUNC(stmt, stmts)
Definition: widltypes.h:596
GLenum func
Definition: glext.h:6028
void * get_attrp(const attr_list_t *list, enum attr_type t)
Definition: header.c:107
var_t * var
Definition: widltypes.h:537
union _statement_t::@4015 u
unsigned int get_size_procformatstring_func(const type_t *iface, const var_t *func)
Definition: typegen.c:4501
attr_list_t * attrs
Definition: widltypes.h:419
const char * name
Definition: widltypes.h:416
static void write_function_stub(const type_t *iface, const var_t *func, int method_count, unsigned int proc_offset)
Definition: client.c:72
static void print_client(const char *format,...) __attribute__((format(printf
Definition: client.c:45
implicit_handle(handle_t hBinding)] interface browser
Definition: browser.idl:136
static statement_list_t * type_iface_get_stmts(const type_t *type)
Definition: typetree.h:151

Referenced by write_client_ifaces().

◆ write_generic_handle_routine_list()

static void write_generic_handle_routine_list ( void  )
static

Definition at line 477 of file client.c.

478 {
479  generic_handle_t *gh;
480 
481  if (list_empty( &generic_handle_list )) return;
482  print_client( "static const GENERIC_BINDING_ROUTINE_PAIR BindingRoutines[] =\n" );
483  print_client( "{\n" );
484  indent++;
486  {
487  print_client( "{ (GENERIC_BINDING_ROUTINE)%s_bind, (GENERIC_UNBIND_ROUTINE)%s_unbind },\n",
488  gh->name, gh->name );
489  }
490  indent--;
491  print_client( "};\n\n" );
492 }
generic_handle_list_t generic_handle_list
Definition: header.c:44
uint8_t entry
Definition: isohybrid.c:63
static int indent
Definition: client.c:42
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
static void print_client(const char *format,...) __attribute__((format(printf
Definition: client.c:45
const char * name
Definition: widltypes.h:521

Referenced by write_client_routines().

◆ write_implicithandledecl()

static void write_implicithandledecl ( type_t iface)
static

Definition at line 404 of file client.c.

405 {
407 
408  if (implicit_handle)
409  {
411  fprintf(client, ";\n\n");
412  }
413 }
void * get_attrp(const attr_list_t *list, enum attr_type t)
Definition: header.c:107
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
void write_type_decl(FILE *f, type_t *t, const char *name)
Definition: header.c:531
attr_list_t * attrs
Definition: widltypes.h:419
static FILE * client
Definition: client.c:41
implicit_handle(handle_t hBinding)] interface browser
Definition: browser.idl:136

Referenced by write_client_ifaces().

◆ write_stubdescdecl()

static void write_stubdescdecl ( type_t iface)
static

Definition at line 308 of file client.c.

309 {
310  print_client("static const MIDL_STUB_DESC %s_StubDesc;\n", iface->name);
311  fprintf(client, "\n");
312 }
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static FILE * client
Definition: client.c:41
const char * name
Definition: widltypes.h:416
static void print_client(const char *format,...) __attribute__((format(printf
Definition: client.c:45

Referenced by write_client_ifaces().

◆ write_stubdescriptor()

static void write_stubdescriptor ( type_t iface,
int  expr_eval_routines 
)
static

Definition at line 315 of file client.c.

316 {
318 
319  print_client("static const MIDL_STUB_DESC %s_StubDesc =\n", iface->name);
320  print_client("{\n");
321  indent++;
322  print_client("(void *)& %s___RpcClientInterface,\n", iface->name);
323  print_client("MIDL_user_allocate,\n");
324  print_client("MIDL_user_free,\n");
325  print_client("{\n");
326  indent++;
327  if (implicit_handle)
328  print_client("&%s,\n", implicit_handle->name);
329  else
330  print_client("&%s__MIDL_AutoBindHandle,\n", iface->name);
331  indent--;
332  print_client("},\n");
333  print_client("0,\n");
335  print_client("BindingRoutines,\n");
336  else
337  print_client("0,\n");
338  if (expr_eval_routines)
339  print_client("ExprEvalRoutines,\n");
340  else
341  print_client("0,\n");
342  print_client("0,\n");
343  print_client("__MIDL_TypeFormatString.Format,\n");
344  print_client("1, /* -error bounds_check flag */\n");
345  print_client("0x%x, /* Ndr library version */\n", get_stub_mode() == MODE_Oif ? 0x50002 : 0x10001);
346  print_client("0,\n");
347  print_client("0x50100a4, /* MIDL Version 5.1.164 */\n");
348  print_client("0,\n");
349  print_client("%s,\n", list_empty(&user_type_list) ? "0" : "UserMarshalRoutines");
350  print_client("0, /* notify & notify_flag routine table */\n");
351  print_client("1, /* Flags */\n");
352  print_client("0, /* Reserved3 */\n");
353  print_client("0, /* Reserved4 */\n");
354  print_client("0 /* Reserved5 */\n");
355  indent--;
356  print_client("};\n");
357  fprintf(client, "\n");
358 }
static struct list expr_eval_routines
Definition: typegen.c:53
void * get_attrp(const attr_list_t *list, enum attr_type t)
Definition: header.c:107
enum stub_mode get_stub_mode(void)
Definition: widl.c:197
generic_handle_list_t generic_handle_list
Definition: header.c:44
static int indent
Definition: client.c:42
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
attr_list_t * attrs
Definition: widltypes.h:419
static FILE * client
Definition: client.c:41
const char * name
Definition: widltypes.h:416
user_type_list_t user_type_list
Definition: header.c:42
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
static void print_client(const char *format,...) __attribute__((format(printf
Definition: client.c:45
implicit_handle(handle_t hBinding)] interface browser
Definition: browser.idl:136
Definition: widl.h:83

Referenced by write_client_ifaces().

Variable Documentation

◆ client

FILE* client
static

Definition at line 41 of file client.c.

Referenced by __rpcb_findaddr_timed(), AcceptConnections(), BUTTON_WindowProc(), ButtonWndProc_common(), CB_Paint(), CC_PaintLumBar(), CC_PrepareColorGraph(), cl_addr_compare(), cl_exid_compare(), client_name_cache(), client_server(), client_state_add(), client_state_remove(), client_supports_pnfs(), clnt_raw_create(), COMBOEX_Create(), create_client_object(), create_configuration(), create_overlapped_pipe(), create_pipe_pair(), create_rpcsec_auth_client(), dde_server_wndproc(), DefMDIChildProcA(), DefMDIChildProcW(), delegation_find(), delegation_remove(), delegation_return(), delegation_truncate(), file_layout_read_thread(), file_layout_recall_all(), file_layout_recall_file(), file_layout_recall_fsid(), file_layout_write_thread(), FileOpenDlgProc95(), get_client_disp_property(), get_client_for_netaddr(), get_client_info(), getclnthandle(), handle_mount(), IFileDialog2_fnAdvise(), IFileDialog2_fnUnadvise(), init_client(), init_explorerbrowser(), INTERNET_InternetOpenUrlW(), is_dst_name_opened(), local_rpcb(), marshal_STGMEDIUM(), marshal_WdtpInterfacePointer(), mdi_child_wnd_proc(), mdi_child_wnd_proc_1(), MDI_ChildActivate(), MDI_ChildGetMinMaxInfo(), MDICascade(), MDIDestroyChild(), MDITile(), MMDevEnum_RegisterEndpointNotificationCallback(), MMDevEnum_UnregisterEndpointNotificationCallback(), mmTaskCreate(), MonitorChildThread(), MONTHCAL_GetDayFromPos(), MONTHCAL_UpdateSize(), nfs41_abs_path_compare(), nfs41_client_create(), nfs41_client_delegation_free(), nfs41_client_delegation_recovery(), nfs41_client_delegation_return_lru(), nfs41_client_free(), nfs41_client_renew(), nfs41_client_state_revoked(), nfs41_delegate_open(), nfs41_delegation_getattr(), nfs41_delegation_granted(), nfs41_delegation_recall(), nfs41_delegation_return(), nfs41_recover_client_state(), nfs41_recovery_finish(), nfs41_recovery_start_or_wait(), nfs41_root_mount_addrs(), nfs41_root_session(), nfs41_rpc_clnt_create(), nfs41_session_create(), OleControl_OnAmbientPropertyChange(), OleObject_Close(), OleObject_DoVerb(), OnBPPChanged(), PersistMoniker_Load(), pmap_getmaps(), pmap_getport(), pnfs_client_init(), pnfs_file_layout_recall(), print_client(), ReadFromPipeThread(), referral_resolve(), root_client_create(), rpc_reconnect(), rpcb_getmaps(), rpcb_gettime(), rpcb_set(), rpcb_taddr2uaddr(), rpcb_uaddr2taddr(), rpcb_unset(), rpcrt4_conn_tcp_handoff(), RunShell(), send_null(), session_alloc(), set_format(), ShowColorSpectrum(), TerminateShell(), test_authentication(), test_completion(), test_file_info(), test_layered_window(), test_NamedPipeHandleState(), test_overlapped_transport(), test_ReadFile(), test_readfileex_pending(), test_security_info(), test_TransmitFile(), test_TxDraw(), testAuth(), testInitializeSecurityContextFlags(), testSignSeal(), TOOLBAR_Size(), update_exchangeid_res(), update_server(), UserLogin(), UserLoginThread(), WDML_EventProc(), WDML_RemoveServer(), write_client(), write_client_func_decl(), write_client_ifaces(), write_client_routines(), write_clientinterfacedecl(), write_function_stub(), write_implicithandledecl(), write_stubdescdecl(), write_stubdescriptor(), and WriteToPipeThread().

◆ indent