ReactOS 0.4.16-dev-91-g764881a
typegen.h File Reference
#include <stdarg.h>
Include dependency graph for typegen.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef int(* type_pred_t) (const type_t *)
 

Enumerations

enum  pass { PASS_IN , PASS_OUT , PASS_RETURN }
 
enum  remoting_phase { PHASE_BUFFERSIZE , PHASE_MARSHAL , PHASE_UNMARSHAL , PHASE_FREE }
 
enum  typegen_detect_flags { TDT_ALL_TYPES = 1 << 0 , TDT_IGNORE_STRINGS = 1 << 1 , TDT_IGNORE_RANGES = 1 << 2 }
 
enum  typegen_type {
  TGT_INVALID , TGT_USER_TYPE , TGT_CTXT_HANDLE , TGT_CTXT_HANDLE_POINTER ,
  TGT_STRING , TGT_POINTER , TGT_ARRAY , TGT_IFACE_POINTER ,
  TGT_BASIC , TGT_ENUM , TGT_STRUCT , TGT_UNION ,
  TGT_RANGE
}
 

Functions

void write_formatstringsdecl (FILE *f, int indent, const statement_list_t *stmts, type_pred_t pred)
 
void write_procformatstring (FILE *file, const statement_list_t *stmts, type_pred_t pred)
 
void write_typeformatstring (FILE *file, const statement_list_t *stmts, type_pred_t pred)
 
void write_procformatstring_offsets (FILE *file, const type_t *iface)
 
void print_phase_basetype (FILE *file, int indent, const char *local_var_prefix, enum remoting_phase phase, enum pass pass, const var_t *var, const char *varname)
 
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)
 
void write_remoting_arguments (FILE *file, int indent, const var_t *func, const char *local_var_prefix, enum pass pass, enum remoting_phase phase)
 
unsigned int get_size_procformatstring_func (const type_t *iface, const var_t *func)
 
unsigned int get_size_procformatstring (const statement_list_t *stmts, type_pred_t pred)
 
unsigned int get_size_typeformatstring (const statement_list_t *stmts, type_pred_t pred)
 
void assign_stub_out_args (FILE *file, int indent, const var_t *func, const char *local_var_prefix)
 
void declare_stub_args (FILE *file, int indent, const var_t *func)
 
void write_func_param_struct (FILE *file, const type_t *iface, const type_t *func, const char *var_decl, int add_retval)
 
void write_pointer_checks (FILE *file, int indent, const var_t *func)
 
int write_expr_eval_routines (FILE *file, const char *iface)
 
void write_expr_eval_routine_list (FILE *file, const char *iface)
 
void write_user_quad_list (FILE *file)
 
void write_endpoints (FILE *f, const char *prefix, const str_list_t *list)
 
void write_client_call_routine (FILE *file, const type_t *iface, const var_t *func, const char *prefix, unsigned int proc_offset)
 
void write_exceptions (FILE *file)
 
unsigned int type_memsize (const type_t *t)
 
int decl_indirect (const type_t *t)
 
int is_interpreted_func (const type_t *iface, const var_t *func)
 
void write_parameters_init (FILE *file, int indent, const var_t *func, const char *local_var_prefix)
 
void print (FILE *file, int indent, const char *format, va_list ap)
 
expr_tget_size_is_expr (const type_t *t, const char *name)
 
int is_full_pointer_function (const var_t *func)
 
void write_full_pointer_init (FILE *file, int indent, const var_t *func, int is_server)
 
void write_full_pointer_free (FILE *file, int indent, const var_t *func)
 
unsigned char get_basic_fc (const type_t *type)
 
unsigned char get_pointer_fc (const type_t *type, const attr_list_t *attrs, int toplevel_param)
 
unsigned char get_struct_fc (const type_t *type)
 
enum typegen_type typegen_detect_type (const type_t *type, const attr_list_t *attrs, unsigned int flags)
 
unsigned int type_memsize_and_alignment (const type_t *t, unsigned int *align)
 

Typedef Documentation

◆ type_pred_t

typedef int(* type_pred_t) (const type_t *)

Definition at line 63 of file typegen.h.

Enumeration Type Documentation

◆ pass

Enumerator
PASS_IN 
PASS_OUT 
PASS_RETURN 

Definition at line 24 of file typegen.h.

25{
26 PASS_IN,
29};
@ PASS_RETURN
Definition: typegen.h:28
@ PASS_OUT
Definition: typegen.h:27
@ PASS_IN
Definition: typegen.h:26

◆ remoting_phase

Enumerator
PHASE_BUFFERSIZE 
PHASE_MARSHAL 
PHASE_UNMARSHAL 
PHASE_FREE 

Definition at line 31 of file typegen.h.

32{
37};
@ PHASE_MARSHAL
Definition: typegen.h:34
@ PHASE_BUFFERSIZE
Definition: typegen.h:33
@ PHASE_FREE
Definition: typegen.h:36
@ PHASE_UNMARSHAL
Definition: typegen.h:35

◆ typegen_detect_flags

Enumerator
TDT_ALL_TYPES 
TDT_IGNORE_STRINGS 
TDT_IGNORE_RANGES 

Definition at line 39 of file typegen.h.

40{
41 TDT_ALL_TYPES = 1 << 0,
42 TDT_IGNORE_STRINGS = 1 << 1,
43 TDT_IGNORE_RANGES = 1 << 2,
44};
@ TDT_IGNORE_STRINGS
Definition: typegen.h:42
@ TDT_ALL_TYPES
Definition: typegen.h:41
@ TDT_IGNORE_RANGES
Definition: typegen.h:43

◆ typegen_type

Enumerator
TGT_INVALID 
TGT_USER_TYPE 
TGT_CTXT_HANDLE 
TGT_CTXT_HANDLE_POINTER 
TGT_STRING 
TGT_POINTER 
TGT_ARRAY 
TGT_IFACE_POINTER 
TGT_BASIC 
TGT_ENUM 
TGT_STRUCT 
TGT_UNION 
TGT_RANGE 

Definition at line 46 of file typegen.h.

47{
61};
@ TGT_INVALID
Definition: typegen.h:48
@ TGT_USER_TYPE
Definition: typegen.h:49
@ TGT_POINTER
Definition: typegen.h:53
@ TGT_UNION
Definition: typegen.h:59
@ TGT_STRUCT
Definition: typegen.h:58
@ TGT_ARRAY
Definition: typegen.h:54
@ TGT_CTXT_HANDLE_POINTER
Definition: typegen.h:51
@ TGT_ENUM
Definition: typegen.h:57
@ TGT_CTXT_HANDLE
Definition: typegen.h:50
@ TGT_RANGE
Definition: typegen.h:60
@ TGT_STRING
Definition: typegen.h:52
@ TGT_BASIC
Definition: typegen.h:56
@ TGT_IFACE_POINTER
Definition: typegen.h:55

Function Documentation

◆ assign_stub_out_args()

void assign_stub_out_args ( FILE file,
int  indent,
const var_t func,
const char local_var_prefix 
)

Definition at line 4676 of file typegen.c.

4677{
4678 int in_attr, out_attr;
4679 int i = 0, sep = 0;
4680 const var_t *var;
4681 type_t *ref;
4682
4683 if (!type_get_function_args(func->type))
4684 return;
4685
4687 {
4688 in_attr = is_attr(var->attrs, ATTR_IN);
4689 out_attr = is_attr(var->attrs, ATTR_OUT);
4690 if (!out_attr && !in_attr)
4691 in_attr = 1;
4692
4693 if (!in_attr)
4694 {
4695 print_file(file, indent, "%s%s", local_var_prefix, var->name);
4696
4697 switch (typegen_detect_type(var->type, var->attrs, TDT_IGNORE_STRINGS))
4698 {
4700 fprintf(file, " = NdrContextHandleInitialize(\n");
4701 print_file(file, indent + 1, "&__frame->_StubMsg,\n");
4702 print_file(file, indent + 1, "(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%d]);\n",
4703 var->typestring_offset);
4704 break;
4705 case TGT_ARRAY:
4707 {
4708 unsigned int size;
4709 type_t *type;
4710
4711 fprintf(file, " = NdrAllocate(&__frame->_StubMsg, ");
4712 for (type = var->type;
4715 {
4717 TRUE, NULL, NULL, local_var_prefix);
4718 fprintf(file, " * ");
4719 }
4721 fprintf(file, "%u);\n", size);
4722
4723 print_file(file, indent, "memset(%s%s, 0, ", local_var_prefix, var->name);
4724 for (type = var->type;
4727 {
4729 TRUE, NULL, NULL, local_var_prefix);
4730 fprintf(file, " * ");
4731 }
4733 fprintf(file, "%u);\n", size);
4734 }
4735 else
4736 fprintf(file, " = &%s_W%u;\n", local_var_prefix, i++);
4737 break;
4738 case TGT_POINTER:
4739 fprintf(file, " = &%s_W%u;\n", local_var_prefix, i);
4740 ref = type_pointer_get_ref(var->type);
4742 {
4743 case TGT_BASIC:
4744 case TGT_ENUM:
4745 case TGT_POINTER:
4746 case TGT_RANGE:
4747 case TGT_IFACE_POINTER:
4748 print_file(file, indent, "%s_W%u = 0;\n", local_var_prefix, i);
4749 break;
4750 case TGT_USER_TYPE:
4751 print_file(file, indent, "memset(&%s_W%u, 0, sizeof(%s_W%u));\n",
4752 local_var_prefix, i, local_var_prefix, i);
4753 break;
4754 case TGT_ARRAY:
4756 {
4757 print_file(file, indent, "%s_W%u = 0;\n", local_var_prefix, i);
4758 break;
4759 }
4761 /* fall through */
4762 case TGT_STRUCT:
4763 case TGT_UNION:
4765 print_file(file, indent, "memset(&%s_W%u, 0, sizeof(%s_W%u));\n",
4766 local_var_prefix, i, local_var_prefix, i);
4767 break;
4768 case TGT_CTXT_HANDLE:
4770 case TGT_INVALID:
4771 case TGT_STRING:
4772 /* not initialised */
4773 break;
4774 }
4775 i++;
4776 break;
4777 default:
4778 break;
4779 }
4780
4781 sep = 1;
4782 }
4783 }
4784 if (sep)
4785 fprintf(file, "\n");
4786}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
static const WCHAR indent[]
Definition: object.c:1156
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
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLenum func
Definition: glext.h:6028
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_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,...)
uint32_t entry
Definition: isohybrid.c:63
const char * var
Definition: shader.c:5666
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99
Definition: fci.c:127
Definition: send.c:48
enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *attrs, unsigned int flags)
Definition: typegen.c:329
unsigned int type_memsize(const type_t *t)
Definition: typegen.c:1975
static void print_file(FILE *file, int indent, const char *format,...) __attribute__((format(printf
Definition: typegen.c:871
static int type_has_pointers(const type_t *type)
Definition: typegen.c:703
static int type_array_is_decl_as_ptr(const type_t *type)
Definition: typetree.h:260
static int type_array_has_conformance(const type_t *type)
Definition: typetree.h:218
static expr_t * type_array_get_conformance(const type_t *type)
Definition: typetree.h:239
static type_t * type_array_get_element(const type_t *type)
Definition: typetree.h:253
static type_t * type_pointer_get_ref(const type_t *type)
Definition: typetree.h:292
@ ATTR_IN
Definition: widltypes.h:118
@ ATTR_OUT
Definition: widltypes.h:138
static var_list_t * type_get_function_args(const type_t *func_type)
Definition: widltypes.h:585

Referenced by gen_stub(), and write_function_stub().

◆ decl_indirect()

int decl_indirect ( const type_t t)

Definition at line 948 of file typegen.c.

949{
950 if (is_user_type(t))
951 return TRUE;
952 return (type_get_type(t) != TYPE_BASIC &&
956}
GLdouble GLdouble t
Definition: gl.h:2047
static int is_user_type(const type_t *t)
Definition: typegen.c:324
static enum type_type type_get_type(const type_t *type)
Definition: typetree.h:68
@ TYPE_ENUM
Definition: widltypes.h:404
@ TYPE_BASIC
Definition: widltypes.h:403
@ TYPE_POINTER
Definition: widltypes.h:413
@ TYPE_ARRAY
Definition: widltypes.h:414

Referenced by declare_stub_args(), gen_proxy(), print_phase_function(), write_function_stub(), and write_var_init().

◆ declare_stub_args()

void declare_stub_args ( FILE file,
int  indent,
const var_t func 
)

Definition at line 4615 of file typegen.c.

4616{
4617 int in_attr, out_attr;
4618 int i = 0;
4619 const var_t *var = type_function_get_retval(func->type);
4620
4621 /* declare return value */
4622 if (!is_void(var->type))
4623 {
4624 print_file(file, indent, "%s", "");
4625 write_type_decl(file, var->type, var->name);
4626 fprintf(file, ";\n");
4627 }
4628
4629 if (!type_get_function_args(func->type))
4630 return;
4631
4633 {
4634 in_attr = is_attr(var->attrs, ATTR_IN);
4635 out_attr = is_attr(var->attrs, ATTR_OUT);
4636 if (!out_attr && !in_attr)
4637 in_attr = 1;
4638
4639 if (is_context_handle(var->type))
4640 print_file(file, indent, "NDR_SCONTEXT %s;\n", var->name);
4641 else
4642 {
4643 if (!in_attr && !is_conformant_array(var->type))
4644 {
4645 type_t *type_to_print;
4646 char name[16];
4647 print_file(file, indent, "%s", "");
4648 if (type_get_type(var->type) == TYPE_ARRAY &&
4650 type_to_print = var->type;
4651 else
4652 type_to_print = type_pointer_get_ref(var->type);
4653 sprintf(name, "_W%u", i++);
4654 write_type_decl(file, type_to_print, name);
4655 fprintf(file, ";\n");
4656 }
4657
4658 print_file(file, indent, "%s", "");
4660 fprintf(file, " ");
4661 if (type_get_type(var->type) == TYPE_ARRAY &&
4663 fprintf(file, "(*%s)", var->name);
4664 } else
4665 fprintf(file, "%s", var->name);
4666 write_type_right(file, var->type, FALSE);
4667 fprintf(file, ";\n");
4668
4669 if (decl_indirect(var->type))
4670 print_file(file, indent, "void *_p_%s;\n", var->name);
4671 }
4672 }
4673}
#define FALSE
Definition: types.h:117
static int is_context_handle(const type_t *type)
Definition: header.h:100
static int is_void(const type_t *t)
Definition: header.h:69
static int is_conformant_array(const type_t *t)
Definition: header.h:79
#define sprintf(buf, format,...)
Definition: sprintf.c:55
void write_type_right(FILE *h, type_t *t, int is_field)
Definition: header.c:437
void write_type_decl_left(FILE *f, type_t *t)
Definition: header.c:566
void write_type_decl(FILE *f, type_t *t, const char *name)
Definition: header.c:561
Definition: name.c:39
int decl_indirect(const type_t *t)
Definition: typegen.c:948
static var_t * type_function_get_retval(const type_t *type)
Definition: typetree.h:101

Referenced by gen_stub(), and write_function_stub().

◆ get_basic_fc()

unsigned char get_basic_fc ( const type_t type)

Definition at line 204 of file typegen.c.

205{
207 switch (type_basic_get_type(type))
208 {
209 case TYPE_BASIC_INT8: return (sign <= 0 ? FC_SMALL : FC_USMALL);
210 case TYPE_BASIC_INT16: return (sign <= 0 ? FC_SHORT : FC_USHORT);
211 case TYPE_BASIC_INT32:
212 case TYPE_BASIC_LONG: return (sign <= 0 ? FC_LONG : FC_ULONG);
213 case TYPE_BASIC_INT64: return FC_HYPER;
214 case TYPE_BASIC_INT: return (sign <= 0 ? FC_LONG : FC_ULONG);
215 case TYPE_BASIC_INT3264: return (sign <= 0 ? FC_INT3264 : FC_UINT3264);
216 case TYPE_BASIC_BYTE: return FC_BYTE;
217 case TYPE_BASIC_CHAR: return FC_CHAR;
218 case TYPE_BASIC_WCHAR: return FC_WCHAR;
219 case TYPE_BASIC_HYPER: return FC_HYPER;
220 case TYPE_BASIC_FLOAT: return FC_FLOAT;
221 case TYPE_BASIC_DOUBLE: return FC_DOUBLE;
224 }
225 return 0;
226}
#define sign(x)
Definition: mapdesc.cc:613
@ FC_BIND_PRIMITIVE
Definition: ndrtypes.h:194
@ FC_USMALL
Definition: ndrtypes.h:138
@ FC_INT3264
Definition: ndrtypes.h:268
@ FC_SMALL
Definition: ndrtypes.h:137
@ FC_DOUBLE
Definition: ndrtypes.h:146
@ FC_USHORT
Definition: ndrtypes.h:141
@ FC_ERROR_STATUS_T
Definition: ndrtypes.h:150
@ FC_LONG
Definition: ndrtypes.h:142
@ FC_CHAR
Definition: ndrtypes.h:136
@ FC_HYPER
Definition: ndrtypes.h:145
@ FC_ULONG
Definition: ndrtypes.h:143
@ FC_FLOAT
Definition: ndrtypes.h:144
@ FC_BYTE
Definition: ndrtypes.h:135
@ FC_UINT3264
Definition: ndrtypes.h:269
@ FC_SHORT
Definition: ndrtypes.h:140
@ FC_WCHAR
Definition: ndrtypes.h:139
static int type_basic_get_sign(const type_t *type)
Definition: typetree.h:80
static enum type_basic_type type_basic_get_type(const type_t *type)
Definition: typetree.h:73
@ TYPE_BASIC_DOUBLE
Definition: widltypes.h:275
@ TYPE_BASIC_INT32
Definition: widltypes.h:265
@ TYPE_BASIC_ERROR_STATUS_T
Definition: widltypes.h:276
@ TYPE_BASIC_CHAR
Definition: widltypes.h:270
@ TYPE_BASIC_WCHAR
Definition: widltypes.h:273
@ TYPE_BASIC_INT16
Definition: widltypes.h:264
@ TYPE_BASIC_HYPER
Definition: widltypes.h:271
@ TYPE_BASIC_HANDLE
Definition: widltypes.h:277
@ TYPE_BASIC_INT8
Definition: widltypes.h:263
@ TYPE_BASIC_INT3264
Definition: widltypes.h:268
@ TYPE_BASIC_LONG
Definition: widltypes.h:269
@ TYPE_BASIC_INT64
Definition: widltypes.h:266
@ TYPE_BASIC_BYTE
Definition: widltypes.h:272
@ TYPE_BASIC_INT
Definition: widltypes.h:267
@ TYPE_BASIC_FLOAT
Definition: widltypes.h:274

Referenced by get_parameter_fc(), get_required_buffer_size_type(), print_phase_basetype(), type_buffer_alignment(), type_memsize_and_alignment(), write_branch_type(), write_conf_or_var_desc(), write_range_tfs(), write_simple_pointer(), write_string_tfs(), write_union_tfs(), and write_user_tfs().

◆ get_pointer_fc()

unsigned char get_pointer_fc ( const type_t type,
const attr_list_t attrs,
int  toplevel_param 
)

Definition at line 258 of file typegen.c.

259{
260 const type_t *t;
261 int pointer_type;
262
264
265 pointer_type = get_attrv(attrs, ATTR_POINTERTYPE);
266 if (pointer_type)
267 return pointer_type;
268
270 {
271 pointer_type = get_attrv(t->attrs, ATTR_POINTERTYPE);
272 if (pointer_type)
273 return pointer_type;
274 }
275
276 if (toplevel_param)
277 return FC_RP;
278 else if (is_ptr(type))
280 else
282}
#define assert(x)
Definition: debug.h:53
static int is_ptr(const type_t *t)
Definition: header.h:59
@ FC_RP
Definition: ndrtypes.h:152
unsigned int get_attrv(const attr_list_t *list, enum attr_type t)
Definition: header.c:115
static unsigned char type_pointer_get_default_fc(const type_t *type)
Definition: typetree.h:299
static unsigned char type_array_get_ptr_default_fc(const type_t *type)
Definition: typetree.h:267
static type_t * type_alias_get_aliasee(const type_t *type)
Definition: typetree.h:279
static int type_is_alias(const type_t *type)
Definition: typetree.h:274
@ ATTR_POINTERTYPE
Definition: widltypes.h:142

Referenced by cant_be_null(), get_array_fc(), get_parameter_fc(), get_pointer_fc_context(), get_required_buffer_size_type(), get_struct_fc(), type_has_full_pointer(), write_contexthandle_tfs(), write_remoting_arg(), write_type_tfs(), and write_user_tfs().

◆ get_size_is_expr()

expr_t * get_size_is_expr ( const type_t t,
const char name 
)

Definition at line 4110 of file typegen.c.

4111{
4112 expr_t *x = NULL;
4113
4114 for ( ; is_array(t); t = type_array_get_element(t))
4117 {
4118 if (!x)
4120 else
4121 error("%s: multidimensional conformant"
4122 " arrays not supported at the top level\n",
4123 name);
4124 }
4125
4126 return x;
4127}
@ EXPR_VOID
Definition: parser.h:231
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define error(str)
Definition: mkdosfs.c:1605
enum expr_type type
Definition: widltypes.h:308

Referenced by write_remoting_arg().

◆ get_size_procformatstring()

unsigned int get_size_procformatstring ( const statement_list_t stmts,
type_pred_t  pred 
)

Definition at line 4602 of file typegen.c.

4603{
4604 unsigned int size = 1;
4606 return size;
4607}
static void get_size_procformatstring_iface(type_t *iface, FILE *file, int indent, unsigned int *size)
Definition: typegen.c:4591
static void for_each_iface(const statement_list_t *stmts, void(*proc)(type_t *iface, FILE *file, int indent, unsigned int *offset), type_pred_t pred, FILE *file, int indent, unsigned int *offset)
Definition: typegen.c:1480

Referenced by write_formatstringsdecl().

◆ get_size_procformatstring_func()

unsigned int get_size_procformatstring_func ( const type_t iface,
const var_t func 
)

Definition at line 4584 of file typegen.c.

4585{
4586 unsigned int offset = 0;
4587 write_procformatstring_func( NULL, 0, iface, func, &offset, 0 );
4588 return offset;
4589}
GLintptr offset
Definition: glext.h:5920
static void write_procformatstring_func(FILE *file, int indent, const type_t *iface, const var_t *func, unsigned int *offset, unsigned short num_proc)
Definition: typegen.c:1425

Referenced by get_size_procformatstring_iface(), write_function_stubs(), and write_proxy().

◆ get_size_typeformatstring()

unsigned int get_size_typeformatstring ( const statement_list_t stmts,
type_pred_t  pred 
)

Definition at line 4609 of file typegen.c.

4610{
4612 return process_tfs(NULL, stmts, pred);
4613}
static unsigned int process_tfs(FILE *file, const statement_list_t *stmts, type_pred_t pred)
Definition: typegen.c:3753
void set_all_tfswrite(int val)

Referenced by write_formatstringsdecl().

◆ get_struct_fc()

unsigned char get_struct_fc ( const type_t type)

Definition at line 478 of file typegen.c.

479{
480 int has_pointer = 0;
481 int has_conformance = 0;
482 int has_variance = 0;
483 var_t *field;
485
487
488 if (get_padding(fields))
489 return FC_BOGUS_STRUCT;
490
492 {
493 type_t *t = field->type;
495
497
499 {
500 if (is_string_type(field->attrs, field->type))
501 {
503 has_conformance = 1;
504 has_variance = 1;
505 continue;
506 }
507
509 return FC_BOGUS_STRUCT;
510
512 {
513 has_conformance = 1;
514 if (list_next(fields, &field->entry))
515 error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n",
516 field->name);
517 }
519 has_variance = 1;
520
523 }
524
525 switch (typegen_type)
526 {
527 case TGT_USER_TYPE:
529 return FC_BOGUS_STRUCT;
530 case TGT_BASIC:
532 return FC_BOGUS_STRUCT;
533 break;
534 case TGT_ENUM:
535 if (get_enum_fc(t) == FC_ENUM16)
536 return FC_BOGUS_STRUCT;
537 break;
538 case TGT_POINTER:
539 case TGT_ARRAY:
540 if (get_pointer_fc(t, field->attrs, FALSE) == FC_RP || pointer_size != 4)
541 return FC_BOGUS_STRUCT;
542 has_pointer = 1;
543 break;
544 case TGT_UNION:
545 return FC_BOGUS_STRUCT;
546 case TGT_STRUCT:
547 {
548 unsigned char fc = get_struct_fc(t);
549 switch (fc)
550 {
551 case FC_STRUCT:
552 break;
553 case FC_CVSTRUCT:
554 has_conformance = 1;
555 has_variance = 1;
556 has_pointer = 1;
557 break;
558
559 case FC_CPSTRUCT:
560 has_conformance = 1;
561 if (list_next( fields, &field->entry ))
562 error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n",
563 field->name);
564 has_pointer = 1;
565 break;
566
567 case FC_CSTRUCT:
568 has_conformance = 1;
569 if (list_next( fields, &field->entry ))
570 error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n",
571 field->name);
572 break;
573
574 case FC_PSTRUCT:
575 has_pointer = 1;
576 break;
577
578 default:
579 error_loc("Unknown struct member %s with type (0x%02x)\n", field->name, fc);
580 /* fallthru - treat it as complex */
581
582 /* as soon as we see one of these these members, it's bogus... */
583 case FC_BOGUS_STRUCT:
584 return FC_BOGUS_STRUCT;
585 }
586 break;
587 }
588 case TGT_RANGE:
589 return FC_BOGUS_STRUCT;
590 case TGT_STRING:
591 /* shouldn't get here because of TDT_IGNORE_STRINGS above. fall through */
592 case TGT_INVALID:
593 case TGT_CTXT_HANDLE:
595 /* checking after parsing should mean that we don't get here. if we do,
596 * it's a checker bug */
597 assert(0);
598 }
599 }
600
601 if( has_variance )
602 {
603 if ( has_conformance )
604 return FC_CVSTRUCT;
605 else
606 return FC_BOGUS_STRUCT;
607 }
608 if( has_conformance && has_pointer )
609 return FC_CPSTRUCT;
610 if( has_conformance )
611 return FC_CSTRUCT;
612 if( has_pointer )
613 return FC_PSTRUCT;
614 return FC_STRUCT;
615}
PFOR_CONTEXT fc
Definition: for.c:57
Definition: list.h:37
static int is_string_type(const attr_list_t *attrs, const type_t *type)
Definition: header.h:94
const char * fields[10]
Definition: parser.c:313
@ FC_STRUCT
Definition: ndrtypes.h:157
@ FC_BOGUS_STRUCT
Definition: ndrtypes.h:162
@ FC_CPSTRUCT
Definition: ndrtypes.h:160
@ FC_ENUM16
Definition: ndrtypes.h:147
@ FC_CVSTRUCT
Definition: ndrtypes.h:161
@ FC_PSTRUCT
Definition: ndrtypes.h:158
@ FC_CSTRUCT
Definition: ndrtypes.h:159
__WINE_SERVER_LIST_INLINE struct list * list_next(const struct list *list, const struct list *elem)
Definition: list.h:115
void error_loc(const char *s,...)
Definition: utils.c:69
Definition: parser.c:44
unsigned char get_pointer_fc(const type_t *type, const attr_list_t *attrs, int toplevel_param)
Definition: typegen.c:258
unsigned char get_struct_fc(const type_t *type)
Definition: typegen.c:478
static int get_padding(const var_list_t *fields)
Definition: typegen.c:396
static unsigned char get_enum_fc(const type_t *type)
Definition: typegen.c:296
typegen_type
Definition: typegen.h:47
static var_list_t * type_struct_get_fields(const type_t *type)
Definition: typetree.h:87
static int type_array_has_variance(const type_t *type)
Definition: typetree.h:225
unsigned int pointer_size
Definition: widl.c:158

Referenced by get_array_fc(), get_parameter_fc(), get_required_buffer_size_type(), get_struct_fc(), is_non_complex_struct(), user_type_has_variable_size(), write_pointer_description(), write_remoting_arg(), and write_struct_tfs().

◆ is_full_pointer_function()

int is_full_pointer_function ( const var_t func)

Definition at line 2075 of file typegen.c.

2076{
2077 const var_t *var;
2079 return TRUE;
2080 if (!type_get_function_args(func->type))
2081 return FALSE;
2083 if (type_has_full_pointer( var->type, var->attrs, TRUE ))
2084 return TRUE;
2085 return FALSE;
2086}
attr_list_t * attrs
Definition: widltypes.h:422
static int type_has_full_pointer(const type_t *type, const attr_list_t *attrs, int toplevel_param)
Definition: typegen.c:750
static type_t * type_function_get_rettype(const type_t *type)
Definition: typetree.h:108

Referenced by gen_proxy(), gen_stub(), write_function_stub(), and write_proc_func_header().

◆ is_interpreted_func()

int is_interpreted_func ( const type_t iface,
const var_t func 
)

Definition at line 1240 of file typegen.c.

1241{
1242 const char *str;
1243 const var_t *var;
1244 const var_list_t *args = type_get_function_args( func->type );
1245 const type_t *ret_type = type_function_get_rettype( func->type );
1246
1247 if (type_get_type( ret_type ) == TYPE_BASIC)
1248 {
1249 switch (type_basic_get_type( ret_type ))
1250 {
1251 case TYPE_BASIC_INT64:
1252 case TYPE_BASIC_HYPER:
1253 /* return value must fit in a long_ptr */
1254 if (pointer_size < 8) return 0;
1255 break;
1256 case TYPE_BASIC_FLOAT:
1257 case TYPE_BASIC_DOUBLE:
1258 /* floating point values can't be returned */
1259 return 0;
1260 default:
1261 break;
1262 }
1263 }
1264 if (get_stub_mode() != MODE_Oif && args)
1265 {
1267 switch (type_get_type( var->type ))
1268 {
1269 case TYPE_BASIC:
1270 switch (type_basic_get_type( var->type ))
1271 {
1272 /* floating point arguments are not supported in Oi mode */
1273 case TYPE_BASIC_FLOAT: return 0;
1274 case TYPE_BASIC_DOUBLE: return 0;
1275 default: break;
1276 }
1277 break;
1278 /* unions passed by value are not supported in Oi mode */
1279 case TYPE_UNION: return 0;
1280 case TYPE_ENCAPSULATED_UNION: return 0;
1281 default: break;
1282 }
1283 }
1284
1285 if ((str = get_attrp( func->attrs, ATTR_OPTIMIZE ))) return !strcmp( str, "i" );
1286 if ((str = get_attrp( iface->attrs, ATTR_OPTIMIZE ))) return !strcmp( str, "i" );
1287 return (get_stub_mode() != MODE_Os);
1288}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
const WCHAR * str
void * get_attrp(const attr_list_t *list, enum attr_type t)
Definition: header.c:107
Definition: match.c:390
enum stub_mode get_stub_mode(void)
Definition: widl.c:211
@ MODE_Os
Definition: widl.h:87
@ MODE_Oif
Definition: widl.h:89
@ TYPE_UNION
Definition: widltypes.h:407
@ TYPE_ENCAPSULATED_UNION
Definition: widltypes.h:406
@ ATTR_OPTIMIZE
Definition: widltypes.h:136

Referenced by gen_proxy(), gen_stub(), need_inline_stubs(), need_proxy_and_inline_stubs(), write_conf_or_var_desc(), write_dispatchtable(), write_function_stub(), write_nonsimple_pointer(), write_procformatstring_func(), write_proxy(), write_proxy_methods(), write_simple_pointer(), write_stub_methods(), and write_thunk_methods().

◆ print()

void print ( FILE file,
int  indent,
const char format,
va_list  ap 
)

Definition at line 879 of file typegen.c.

880{
881 if (file)
882 {
883 if (format[0] != '\n')
884 while (0 < indent--)
885 fprintf(file, " ");
886 vfprintf(file, format, va);
887 }
888}
_Check_return_opt_ _CRTIMP int __cdecl vfprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
Definition: format.c:58

Referenced by print_file().

◆ print_phase_basetype()

void print_phase_basetype ( FILE file,
int  indent,
const char local_var_prefix,
enum remoting_phase  phase,
enum pass  pass,
const var_t var,
const char varname 
)

Definition at line 3986 of file typegen.c.

3989{
3990 type_t *type = var->type;
3991 unsigned int alignment = 0;
3992
3993 /* no work to do for other phases, buffer sizing is done elsewhere */
3994 if (phase != PHASE_MARSHAL && phase != PHASE_UNMARSHAL)
3995 return;
3996
3997 if (type_get_type(type) == TYPE_ENUM ||
4000 pointer_size != 4))
4001 {
4002 unsigned char fc;
4003
4005 fc = get_enum_fc(type);
4006 else
4007 fc = get_basic_fc(type);
4008
4009 if (phase == PHASE_MARSHAL)
4010 print_file(file, indent, "NdrSimpleTypeMarshall(\n");
4011 else
4012 print_file(file, indent, "NdrSimpleTypeUnmarshall(\n");
4013 print_file(file, indent+1, "&__frame->_StubMsg,\n");
4014 print_file(file, indent+1, "(unsigned char *)&%s%s,\n",
4015 local_var_prefix,
4016 var->name);
4017 print_file(file, indent+1, "0x%02x /* %s */);\n", fc, string_of_type(fc));
4018 }
4019 else
4020 {
4022 switch (get_basic_fc(ref))
4023 {
4024 case FC_BYTE:
4025 case FC_CHAR:
4026 case FC_SMALL:
4027 case FC_USMALL:
4028 alignment = 1;
4029 break;
4030
4031 case FC_WCHAR:
4032 case FC_USHORT:
4033 case FC_SHORT:
4034 alignment = 2;
4035 break;
4036
4037 case FC_ULONG:
4038 case FC_LONG:
4039 case FC_FLOAT:
4040 case FC_ERROR_STATUS_T:
4041 /* pointer_size must be 4 if we got here in these two cases */
4042 case FC_INT3264:
4043 case FC_UINT3264:
4044 alignment = 4;
4045 break;
4046
4047 case FC_HYPER:
4048 case FC_DOUBLE:
4049 alignment = 8;
4050 break;
4051
4052 case FC_IGNORE:
4053 case FC_BIND_PRIMITIVE:
4054 /* no marshalling needed */
4055 return;
4056
4057 default:
4058 error("print_phase_basetype: Unsupported type: %s (0x%02x, ptr_level: 0)\n",
4059 var->name, get_basic_fc(ref));
4060 }
4061
4062 if (phase == PHASE_MARSHAL && alignment > 1)
4063 print_file(file, indent, "MIDL_memset(__frame->_StubMsg.Buffer, 0, (0x%x - (ULONG_PTR)__frame->_StubMsg.Buffer) & 0x%x);\n", alignment, alignment - 1);
4064 print_file(file, indent, "__frame->_StubMsg.Buffer = (unsigned char *)(((ULONG_PTR)__frame->_StubMsg.Buffer + %u) & ~0x%x);\n",
4065 alignment - 1, alignment - 1);
4066
4067 if (phase == PHASE_MARSHAL)
4068 {
4069 print_file(file, indent, "*(");
4071 if (is_ptr(type))
4072 fprintf(file, " *)__frame->_StubMsg.Buffer = *");
4073 else
4074 fprintf(file, " *)__frame->_StubMsg.Buffer = ");
4075 fprintf(file, "%s%s", local_var_prefix, varname);
4076 fprintf(file, ";\n");
4077 }
4078 else if (phase == PHASE_UNMARSHAL)
4079 {
4080 print_file(file, indent, "if (__frame->_StubMsg.Buffer + sizeof(");
4082 fprintf(file, ") > __frame->_StubMsg.BufferEnd)\n");
4083 print_file(file, indent, "{\n");
4084 print_file(file, indent + 1, "RpcRaiseException(RPC_X_BAD_STUB_DATA);\n");
4085 print_file(file, indent, "}\n");
4086 print_file(file, indent, "%s%s%s",
4087 (pass == PASS_IN || pass == PASS_RETURN) ? "" : "*",
4088 local_var_prefix, varname);
4089 if (pass == PASS_IN && is_ptr(type))
4090 fprintf(file, " = (");
4091 else
4092 fprintf(file, " = *(");
4094 fprintf(file, " *)__frame->_StubMsg.Buffer;\n");
4095 }
4096
4097 print_file(file, indent, "__frame->_StubMsg.Buffer += sizeof(");
4099 fprintf(file, ");\n");
4100 }
4101}
@ FC_IGNORE
Definition: ndrtypes.h:149
static const char * string_of_type(unsigned char type)
Definition: typegen.c:101
unsigned char get_basic_fc(const type_t *type)
Definition: typegen.c:204
pass
Definition: typegen.h:25

Referenced by write_remoting_arg().

◆ type_memsize()

◆ type_memsize_and_alignment()

unsigned int type_memsize_and_alignment ( const type_t t,
unsigned int align 
)

Definition at line 1866 of file typegen.c.

1867{
1868 unsigned int size = 0;
1869
1870 switch (type_get_type(t))
1871 {
1872 case TYPE_BASIC:
1873 switch (get_basic_fc(t))
1874 {
1875 case FC_BYTE:
1876 case FC_CHAR:
1877 case FC_USMALL:
1878 case FC_SMALL:
1879 size = 1;
1880 if (size > *align) *align = size;
1881 break;
1882 case FC_WCHAR:
1883 case FC_USHORT:
1884 case FC_SHORT:
1885 size = 2;
1886 if (size > *align) *align = size;
1887 break;
1888 case FC_ULONG:
1889 case FC_LONG:
1890 case FC_ERROR_STATUS_T:
1891 case FC_FLOAT:
1892 size = 4;
1893 if (size > *align) *align = size;
1894 break;
1895 case FC_HYPER:
1896 case FC_DOUBLE:
1897 size = 8;
1898 if (size > *align) *align = size;
1899 break;
1900 case FC_INT3264:
1901 case FC_UINT3264:
1902 case FC_BIND_PRIMITIVE:
1905 if (size > *align) *align = size;
1906 break;
1907 default:
1908 error("type_memsize: Unknown type 0x%x\n", get_basic_fc(t));
1909 size = 0;
1910 }
1911 break;
1912 case TYPE_ENUM:
1913 switch (get_enum_fc(t))
1914 {
1915 case FC_ENUM16:
1916 case FC_ENUM32:
1917 size = 4;
1918 if (size > *align) *align = size;
1919 break;
1920 default:
1921 error("type_memsize: Unknown enum type\n");
1922 size = 0;
1923 }
1924 break;
1925 case TYPE_STRUCT:
1927 break;
1930 break;
1931 case TYPE_UNION:
1933 break;
1934 case TYPE_POINTER:
1935 case TYPE_INTERFACE:
1938 if (size > *align) *align = size;
1939 break;
1940 case TYPE_ARRAY:
1942 {
1944 {
1946 size = 0;
1947 }
1948 else
1951 }
1952 else /* declared as a pointer */
1953 {
1956 if (size > *align) *align = size;
1957 }
1958 break;
1959 case TYPE_ALIAS:
1960 case TYPE_VOID:
1961 case TYPE_COCLASS:
1962 case TYPE_MODULE:
1963 case TYPE_FUNCTION:
1964 case TYPE_BITFIELD:
1965 /* these types should not be encountered here due to language
1966 * restrictions (interface, void, coclass, module), logical
1967 * restrictions (alias - due to type_get_type call above) or
1968 * checking restrictions (function, bitfield). */
1969 assert(0);
1970 }
1971
1972 return size;
1973}
@ FC_ENUM32
Definition: ndrtypes.h:148
static unsigned int fields_memsize(const var_list_t *fields, unsigned int *align)
Definition: typegen.c:1823
static unsigned int union_memsize(const var_list_t *fields, unsigned int *pmaxa)
Definition: typegen.c:1846
static var_list_t * type_union_get_cases(const type_t *type)
Definition: typetree.h:134
static var_list_t * type_encapsulated_union_get_fields(const type_t *type)
Definition: typetree.h:127
static unsigned int type_array_get_dim(const type_t *type)
Definition: typetree.h:232
@ TYPE_BITFIELD
Definition: widltypes.h:415
@ TYPE_ALIAS
Definition: widltypes.h:408
@ TYPE_VOID
Definition: widltypes.h:402
@ TYPE_COCLASS
Definition: widltypes.h:410
@ TYPE_STRUCT
Definition: widltypes.h:405
@ TYPE_MODULE
Definition: widltypes.h:409
@ TYPE_INTERFACE
Definition: widltypes.h:412
@ TYPE_FUNCTION
Definition: widltypes.h:411

Referenced by add_typedef_typeinfo(), add_var_desc(), field_memsize(), fields_memsize(), get_padding(), type_memsize(), type_memsize_and_alignment(), union_memsize(), write_fixed_array_pointer_descriptions(), write_func_param_struct(), write_no_repeat_pointer_descriptions(), write_pointer_description_offsets(), write_struct_members(), write_union_tfs(), and write_varying_array_pointer_descriptions().

◆ typegen_detect_type()

enum typegen_type typegen_detect_type ( const type_t type,
const attr_list_t attrs,
unsigned int  flags 
)

Definition at line 329 of file typegen.c.

330{
331 if (is_user_type(type))
332 return TGT_USER_TYPE;
333
335 return TGT_CTXT_HANDLE;
336
337 if (!(flags & TDT_IGNORE_STRINGS) && is_string_type(attrs, type))
338 return TGT_STRING;
339
340 switch (type_get_type(type))
341 {
342 case TYPE_BASIC:
343 if (!(flags & TDT_IGNORE_RANGES) &&
345 return TGT_RANGE;
346 return TGT_BASIC;
347 case TYPE_ENUM:
348 if (!(flags & TDT_IGNORE_RANGES) &&
350 return TGT_RANGE;
351 return TGT_ENUM;
352 case TYPE_POINTER:
355 return TGT_IFACE_POINTER;
358 else
359 return TGT_POINTER;
360 case TYPE_STRUCT:
361 return TGT_STRUCT;
363 case TYPE_UNION:
364 return TGT_UNION;
365 case TYPE_ARRAY:
366 return TGT_ARRAY;
367 case TYPE_FUNCTION:
368 case TYPE_COCLASS:
369 case TYPE_INTERFACE:
370 case TYPE_MODULE:
371 case TYPE_VOID:
372 case TYPE_ALIAS:
373 case TYPE_BITFIELD:
374 break;
375 }
376 return TGT_INVALID;
377}
GLbitfield flags
Definition: glext.h:7161
int is_aliaschain_attr(const type_t *type, enum attr_type attr)
Definition: header.c:86
@ ATTR_CONTEXTHANDLE
Definition: widltypes.h:85
@ ATTR_RANGE
Definition: widltypes.h:149
@ ATTR_IIDIS
Definition: widltypes.h:115

Referenced by assign_stub_out_args(), cant_be_null(), free_variable(), get_array_fc(), get_parameter_fc(), get_required_buffer_size_type(), get_stack_size(), get_struct_fc(), is_embedded_complex(), type_has_full_pointer(), type_has_pointers(), write_nonsimple_pointer(), write_parameter_conf_or_var_exprs(), write_pointer_tfs(), write_remoting_arg(), write_struct_tfs(), and write_type_tfs().

◆ write_client_call_routine()

void write_client_call_routine ( FILE file,
const type_t iface,
const var_t func,
const char prefix,
unsigned int  proc_offset 
)

Definition at line 4974 of file typegen.c.

4976{
4977 type_t *rettype = type_function_get_rettype( func->type );
4978 int has_ret = !is_void( rettype );
4979 const var_list_t *args = type_get_function_args( func->type );
4980 const var_t *arg;
4981 int len, needs_params = 0;
4982
4983 /* we need a param structure if we have more than one arg */
4984 if (pointer_size == 4 && args) needs_params = is_object( iface ) || list_count( args ) > 1;
4985
4986 print_file( file, 0, "{\n");
4987 if (needs_params)
4988 {
4989 if (has_ret) print_file( file, 1, "%s", "CLIENT_CALL_RETURN _RetVal;\n" );
4990 write_func_param_struct( file, iface, func->type, "__params", FALSE );
4991 if (is_object( iface )) print_file( file, 1, "__params.This = This;\n" );
4992 if (args)
4994 print_file( file, 1, "__params.%s = %s;\n", arg->name, arg->name );
4995 }
4996 else if (has_ret) print_file( file, 1, "%s", "CLIENT_CALL_RETURN _RetVal;\n\n" );
4997
4998 len = fprintf( file, " %s%s( ",
4999 has_ret ? "_RetVal = " : "",
5000 get_stub_mode() == MODE_Oif ? "NdrClientCall2" : "NdrClientCall" );
5001 fprintf( file, "&%s_StubDesc,", prefix );
5002 fprintf( file, "\n%*s&__MIDL_ProcFormatString.Format[%u]", len, "", proc_offset );
5003 if (needs_params)
5004 {
5005 fprintf( file, ",\n%*s&__params", len, "" );
5006 }
5007 else if (pointer_size == 8)
5008 {
5009 if (is_object( iface )) fprintf( file, ",\n%*sThis", len, "" );
5010 if (args)
5012 fprintf( file, ",\n%*s%s", len, "", arg->name );
5013 }
5014 else
5015 {
5016 if (is_object( iface )) fprintf( file, ",\n%*s&This", len, "" );
5017 else if (args)
5018 {
5019 arg = LIST_ENTRY( list_head(args), const var_t, entry );
5020 fprintf( file, ",\n%*s&%s", len, "", arg->name );
5021 }
5022 }
5023 fprintf( file, " );\n" );
5024 if (has_ret)
5025 {
5026 print_file( file, 1, "return (" );
5027 write_type_decl_left(file, rettype);
5028 fprintf( file, ")%s;\n", pointer_size == 8 ? "_RetVal.Simple" : "*(LONG_PTR *)&_RetVal" );
5029 }
5030 print_file( file, 0, "}\n\n");
5031}
GLenum GLsizei len
Definition: glext.h:6722
__WINE_SERVER_LIST_INLINE unsigned int list_count(const struct list *list)
Definition: list.h:155
int is_object(const type_t *iface)
Definition: header.c:928
Definition: list.h:15
#define LIST_ENTRY(type)
Definition: queue.h:175
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 * arg
Definition: msvc.h:10

Referenced by gen_proxy(), and write_function_stub().

◆ write_endpoints()

void write_endpoints ( FILE f,
const char prefix,
const str_list_t list 
)

Definition at line 4940 of file typegen.c.

4941{
4942 const struct str_list_entry_t *endpoint;
4943 const char *p;
4944
4945 /* this should be an array of RPC_PROTSEQ_ENDPOINT but we want const strings */
4946 print_file( f, 0, "static const unsigned char * const %s__RpcProtseqEndpoint[][2] =\n{\n", prefix );
4948 {
4949 print_file( f, 1, "{ (const unsigned char *)\"" );
4950 for (p = endpoint->str; *p && *p != ':'; p++)
4951 {
4952 if (*p == '"' || *p == '\\') fputc( '\\', f );
4953 fputc( *p, f );
4954 }
4955 if (!*p) goto error;
4956 if (p[1] != '[') goto error;
4957
4958 fprintf( f, "\", (const unsigned char *)\"" );
4959 for (p += 2; *p && *p != ']'; p++)
4960 {
4961 if (*p == '"' || *p == '\\') fputc( '\\', f );
4962 fputc( *p, f );
4963 }
4964 if (*p != ']') goto error;
4965 fprintf( f, "\" },\n" );
4966 }
4967 print_file( f, 0, "};\n\n" );
4968 return;
4969
4970error:
4971 error("Invalid endpoint syntax '%s'\n", endpoint->str);
4972}
GLfloat f
Definition: glext.h:7540
GLfloat GLfloat p
Definition: glext.h:8902
_Check_return_opt_ _CRTIMP int __cdecl fputc(_In_ int _Ch, _Inout_ FILE *_File)
Definition: nis.h:10
Definition: widltypes.h:292

Referenced by write_clientinterfacedecl(), and write_serverinterfacedecl().

◆ write_exceptions()

void write_exceptions ( FILE file)

Definition at line 5033 of file typegen.c.

5034{
5035 fprintf( file, "#ifndef USE_COMPILER_EXCEPTIONS\n");
5036 fprintf( file, "\n");
5037 fprintf( file, "#include \"wine/exception.h\"\n");
5038 fprintf( file, "#undef RpcTryExcept\n");
5039 fprintf( file, "#undef RpcExcept\n");
5040 fprintf( file, "#undef RpcEndExcept\n");
5041 fprintf( file, "#undef RpcTryFinally\n");
5042 fprintf( file, "#undef RpcFinally\n");
5043 fprintf( file, "#undef RpcEndFinally\n");
5044 fprintf( file, "#undef RpcExceptionCode\n");
5045 fprintf( file, "#undef RpcAbnormalTermination\n");
5046 fprintf( file, "\n");
5047 fprintf( file, "struct __exception_frame;\n");
5048 fprintf( file, "typedef int (*__filter_func)(struct __exception_frame *);\n");
5049 fprintf( file, "typedef void (*__finally_func)(struct __exception_frame *);\n");
5050 fprintf( file, "\n");
5051 fprintf( file, "#define __DECL_EXCEPTION_FRAME \\\n");
5052 fprintf( file, " EXCEPTION_REGISTRATION_RECORD frame; \\\n");
5053 fprintf( file, " __filter_func filter; \\\n");
5054 fprintf( file, " __finally_func finally; \\\n");
5055 fprintf( file, " sigjmp_buf jmp; \\\n");
5056 fprintf( file, " DWORD code; \\\n");
5057 fprintf( file, " unsigned char abnormal_termination; \\\n");
5058 fprintf( file, " unsigned char filter_level; \\\n");
5059 fprintf( file, " unsigned char finally_level;\n");
5060 fprintf( file, "\n");
5061 fprintf( file, "struct __exception_frame\n{\n");
5062 fprintf( file, " __DECL_EXCEPTION_FRAME\n");
5063 fprintf( file, "};\n");
5064 fprintf( file, "\n");
5065 fprintf( file, "static inline void __widl_unwind_target(void)\n" );
5066 fprintf( file, "{\n");
5067 fprintf( file, " struct __exception_frame *exc_frame = (struct __exception_frame *)__wine_get_frame();\n" );
5068 fprintf( file, " if (exc_frame->finally_level > exc_frame->filter_level)\n" );
5069 fprintf( file, " {\n");
5070 fprintf( file, " exc_frame->abnormal_termination = 1;\n");
5071 fprintf( file, " exc_frame->finally( exc_frame );\n");
5072 fprintf( file, " __wine_pop_frame( &exc_frame->frame );\n");
5073 fprintf( file, " }\n");
5074 fprintf( file, " exc_frame->filter_level = 0;\n");
5075 fprintf( file, " siglongjmp( exc_frame->jmp, 1 );\n");
5076 fprintf( file, "}\n");
5077 fprintf( file, "\n");
5078 fprintf( file, "static DWORD __widl_exception_handler( EXCEPTION_RECORD *record,\n");
5079 fprintf( file, " EXCEPTION_REGISTRATION_RECORD *frame,\n");
5080 fprintf( file, " CONTEXT *context,\n");
5081 fprintf( file, " EXCEPTION_REGISTRATION_RECORD **pdispatcher )\n");
5082 fprintf( file, "{\n");
5083 fprintf( file, " struct __exception_frame *exc_frame = (struct __exception_frame *)frame;\n");
5084 fprintf( file, "\n");
5085 fprintf( file, " if (record->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND | EH_NESTED_CALL))\n");
5086 fprintf( file, " {\n" );
5087 fprintf( file, " if (exc_frame->finally_level && (record->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND)))\n");
5088 fprintf( file, " {\n" );
5089 fprintf( file, " exc_frame->abnormal_termination = 1;\n");
5090 fprintf( file, " exc_frame->finally( exc_frame );\n");
5091 fprintf( file, " }\n" );
5092 fprintf( file, " return ExceptionContinueSearch;\n");
5093 fprintf( file, " }\n" );
5094 fprintf( file, " exc_frame->code = record->ExceptionCode;\n");
5095 fprintf( file, " if (exc_frame->filter_level && exc_frame->filter( exc_frame ) == EXCEPTION_EXECUTE_HANDLER)\n" );
5096 fprintf( file, " __wine_rtl_unwind( frame, record, __widl_unwind_target );\n");
5097 fprintf( file, " return ExceptionContinueSearch;\n");
5098 fprintf( file, "}\n");
5099 fprintf( file, "\n");
5100 fprintf( file, "#define RpcTryExcept \\\n");
5101 fprintf( file, " if (!sigsetjmp( __frame->jmp, 0 )) \\\n");
5102 fprintf( file, " { \\\n");
5103 fprintf( file, " if (!__frame->finally_level) \\\n" );
5104 fprintf( file, " __wine_push_frame( &__frame->frame ); \\\n");
5105 fprintf( file, " __frame->filter_level = __frame->finally_level + 1;\n" );
5106 fprintf( file, "\n");
5107 fprintf( file, "#define RpcExcept(expr) \\\n");
5108 fprintf( file, " if (!__frame->finally_level) \\\n" );
5109 fprintf( file, " __wine_pop_frame( &__frame->frame ); \\\n");
5110 fprintf( file, " __frame->filter_level = 0; \\\n" );
5111 fprintf( file, " } \\\n");
5112 fprintf( file, " else \\\n");
5113 fprintf( file, "\n");
5114 fprintf( file, "#define RpcEndExcept\n");
5115 fprintf( file, "\n");
5116 fprintf( file, "#define RpcExceptionCode() (__frame->code)\n");
5117 fprintf( file, "\n");
5118 fprintf( file, "#define RpcTryFinally \\\n");
5119 fprintf( file, " if (!__frame->filter_level) \\\n");
5120 fprintf( file, " __wine_push_frame( &__frame->frame ); \\\n");
5121 fprintf( file, " __frame->finally_level = __frame->filter_level + 1;\n");
5122 fprintf( file, "\n");
5123 fprintf( file, "#define RpcFinally \\\n");
5124 fprintf( file, " if (!__frame->filter_level) \\\n");
5125 fprintf( file, " __wine_pop_frame( &__frame->frame ); \\\n");
5126 fprintf( file, " __frame->finally_level = 0;\n");
5127 fprintf( file, "\n");
5128 fprintf( file, "#define RpcEndFinally\n");
5129 fprintf( file, "\n");
5130 fprintf( file, "#define RpcAbnormalTermination() (__frame->abnormal_termination)\n");
5131 fprintf( file, "\n");
5132 fprintf( file, "#define RpcExceptionInit(filter_func,finally_func) \\\n");
5133 fprintf( file, " do { \\\n");
5134 fprintf( file, " __frame->frame.Handler = __widl_exception_handler; \\\n");
5135 fprintf( file, " __frame->filter = (__filter_func)(filter_func); \\\n" );
5136 fprintf( file, " __frame->finally = (__finally_func)(finally_func); \\\n");
5137 fprintf( file, " __frame->abnormal_termination = 0; \\\n");
5138 fprintf( file, " __frame->filter_level = 0; \\\n");
5139 fprintf( file, " __frame->finally_level = 0; \\\n");
5140 fprintf( file, " } while (0)\n");
5141 fprintf( file, "\n");
5142 fprintf( file, "#else /* USE_COMPILER_EXCEPTIONS */\n");
5143 fprintf( file, "\n");
5144 fprintf( file, "#define RpcExceptionInit(filter_func,finally_func) \\\n");
5145 fprintf( file, " do { (void)(filter_func); } while(0)\n");
5146 fprintf( file, "\n");
5147 fprintf( file, "#define __DECL_EXCEPTION_FRAME \\\n");
5148 fprintf( file, " DWORD code;\n");
5149 fprintf( file, "\n");
5150 fprintf( file, "#endif /* USE_COMPILER_EXCEPTIONS */\n");
5151}

Referenced by write_client_routines(), write_proxy_routines(), and write_server_routines().

◆ write_expr_eval_routine_list()

void write_expr_eval_routine_list ( FILE file,
const char iface 
)

Definition at line 4896 of file typegen.c.

4897{
4898 struct expr_eval_routine *eval;
4899 struct expr_eval_routine *cursor;
4900 unsigned short callback_offset = 0;
4901
4902 fprintf(file, "static const EXPR_EVAL ExprEvalRoutines[] =\n");
4903 fprintf(file, "{\n");
4904
4906 {
4907 print_file(file, 1, "%s_%sExprEval_%04u,\n",
4908 eval->iface ? eval->iface->name : iface, eval->name, callback_offset);
4909 callback_offset++;
4910 list_remove(&eval->entry);
4911 free(eval->name);
4912 free(eval);
4913 }
4914
4915 fprintf(file, "};\n\n");
4916}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
#define free
Definition: debug_ros.c:5
const char cursor[]
Definition: icontest.c:13
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
const char * name
Definition: widltypes.h:419
struct list entry
Definition: typegen.c:56
const type_t * iface
Definition: typegen.c:57
static struct list expr_eval_routines
Definition: typegen.c:53

Referenced by write_client_routines(), write_proxy_routines(), and write_server_routines().

◆ write_expr_eval_routines()

int write_expr_eval_routines ( FILE file,
const char iface 
)

Definition at line 4857 of file typegen.c.

4858{
4859 static const char *var_name = "pS";
4860 static const char *var_name_expr = "pS->";
4861 int result = 0;
4862 struct expr_eval_routine *eval;
4863 unsigned short callback_offset = 0;
4864
4866 {
4867 const char *name = eval->name;
4868 result = 1;
4869
4870 print_file(file, 0, "static void __RPC_USER %s_%sExprEval_%04u(PMIDL_STUB_MESSAGE pStubMsg)\n",
4871 eval->iface ? eval->iface->name : iface, name, callback_offset);
4872 print_file(file, 0, "{\n");
4873 if (type_get_type( eval->cont_type ) == TYPE_FUNCTION)
4874 {
4876 "*pS = (struct _PARAM_STRUCT *)pStubMsg->StackTop", FALSE );
4877 }
4878 else
4879 {
4880 print_file(file, 1, "%s", "");
4882 fprintf(file, " *%s = (", var_name);
4884 fprintf(file, " *)(pStubMsg->StackTop - %u);\n", eval->baseoff);
4885 }
4886 print_file(file, 1, "pStubMsg->Offset = 0;\n"); /* FIXME */
4887 print_file(file, 1, "pStubMsg->MaxCount = (ULONG_PTR)");
4888 write_expr(file, eval->expr, 1, 1, var_name_expr, eval->cont_type, "");
4889 fprintf(file, ";\n");
4890 print_file(file, 0, "}\n\n");
4891 callback_offset++;
4892 }
4893 return result;
4894}
GLuint64EXT * result
Definition: glext.h:11304
void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly)
Definition: header.c:297
unsigned int baseoff
Definition: typegen.c:60
const type_t * cont_type
Definition: typegen.c:58
const expr_t * expr
Definition: typegen.c:61
@ NAME_DEFAULT
Definition: typetree.h:28

Referenced by write_client_routines(), write_proxy_routines(), and write_server_routines().

◆ write_formatstringsdecl()

void write_formatstringsdecl ( FILE f,
int  indent,
const statement_list_t stmts,
type_pred_t  pred 
)

Definition at line 929 of file typegen.c.

930{
932
933 print_file(f, indent, "#define TYPE_FORMAT_STRING_SIZE %d\n",
934 get_size_typeformatstring(stmts, pred));
935
936 print_file(f, indent, "#define PROC_FORMAT_STRING_SIZE %d\n",
937 get_size_procformatstring(stmts, pred));
938
939 fprintf(f, "\n");
940 write_formatdesc(f, indent, "TYPE");
941 write_formatdesc(f, indent, "PROC");
942 fprintf(f, "\n");
943 print_file(f, indent, "static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;\n");
944 print_file(f, indent, "static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;\n");
945 print_file(f, indent, "\n");
946}
unsigned int get_size_typeformatstring(const statement_list_t *stmts, type_pred_t pred)
Definition: typegen.c:4609
static void write_formatdesc(FILE *f, int indent, const char *str)
Definition: typegen.c:919
unsigned int get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred)
Definition: typegen.c:4602
void clear_all_offsets(void)

Referenced by write_client_routines(), write_proxy_routines(), and write_server_routines().

◆ write_full_pointer_free()

void write_full_pointer_free ( FILE file,
int  indent,
const var_t func 
)

Definition at line 2095 of file typegen.c.

2096{
2097 print_file(file, indent, "NdrFullPointerXlatFree(__frame->_StubMsg.FullPtrXlatTables);\n");
2098 fprintf(file, "\n");
2099}

Referenced by gen_proxy(), gen_stub(), and write_function_stub().

◆ write_full_pointer_init()

void write_full_pointer_init ( FILE file,
int  indent,
const var_t func,
int  is_server 
)

Definition at line 2088 of file typegen.c.

2089{
2090 print_file(file, indent, "__frame->_StubMsg.FullPtrXlatTables = NdrFullPointerXlatInit(0,%s);\n",
2091 is_server ? "XLAT_SERVER" : "XLAT_CLIENT");
2092 fprintf(file, "\n");
2093}

Referenced by gen_proxy(), gen_stub(), and write_function_stub().

◆ write_func_param_struct()

void write_func_param_struct ( FILE file,
const type_t iface,
const type_t func,
const char var_decl,
int  add_retval 
)

Definition at line 4789 of file typegen.c.

4791{
4792 var_t *retval = type_function_get_retval( func );
4794 const var_t *arg;
4795 int needs_packing;
4796 unsigned int align = 0;
4797
4798 if (args)
4800 if (!is_array( arg->type )) type_memsize_and_alignment( arg->type, &align );
4801
4802 needs_packing = (align > pointer_size);
4803
4804 if (needs_packing) print_file( file, 0, "#include <pshpack%u.h>\n", pointer_size );
4805 print_file(file, 1, "struct _PARAM_STRUCT\n" );
4806 print_file(file, 1, "{\n" );
4807 if (is_object( iface )) print_file(file, 2, "%s *This;\n", iface->name );
4808
4809 if (args) LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
4810 {
4811 print_file(file, 2, "%s", "");
4813 if (needs_space_after( arg->type )) fputc( ' ', file );
4814 if (is_array( arg->type ) && !type_array_is_decl_as_ptr( arg->type )) fputc( '*', file );
4815
4816 /* FIXME: should check for large args being passed by pointer */
4817 align = 0;
4818 if (is_array( arg->type ) || is_ptr( arg->type )) align = pointer_size;
4819 else type_memsize_and_alignment( arg->type, &align );
4820
4821 if (align >= pointer_size)
4822 fprintf( file, "%s;\n", arg->name );
4823 else
4824#ifdef __REACTOS__
4825 fprintf( file, "DECLSPEC_ALIGN(%u) %s;\n", pointer_size, arg->name );
4826#else
4827 fprintf( file, "%s DECLSPEC_ALIGN(%u);\n", arg->name, pointer_size );
4828#endif
4829 }
4830 if (add_retval && !is_void( retval->type ))
4831 {
4832 print_file(file, 2, "%s", "");
4833 write_type_decl( file, retval->type, retval->name );
4834 if (is_array( retval->type ) || is_ptr( retval->type ) ||
4835 type_memsize( retval->type ) == pointer_size)
4836 fprintf( file, ";\n" );
4837 else
4838 fprintf( file, " DECLSPEC_ALIGN(%u);\n", pointer_size );
4839 }
4840 print_file(file, 1, "} %s;\n", var_decl );
4841 if (needs_packing) print_file( file, 0, "#include <poppack.h>\n" );
4842 print_file( file, 0, "\n" );
4843}
int needs_space_after(type_t *t)
Definition: header.c:282
type_t * type
Definition: widltypes.h:453
char * name
Definition: widltypes.h:452

Referenced by gen_stub_thunk(), write_client_call_routine(), and write_expr_eval_routines().

◆ write_parameter_conf_or_var_exprs()

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 at line 4129 of file typegen.c.

4131{
4132 const type_t *type = var->type;
4133 /* get fundamental type for the argument */
4134 for (;;)
4135 {
4137 {
4138 case TGT_ARRAY:
4140 {
4143 {
4144 print_file(file, indent, "__frame->_StubMsg.MaxCount = (ULONG_PTR)");
4145 write_expr(file, type_array_get_conformance(type), 1, 1, NULL, NULL, local_var_prefix);
4146 fprintf(file, ";\n\n");
4147 }
4149 {
4150 print_file(file, indent, "__frame->_StubMsg.Offset = 0;\n"); /* FIXME */
4151 if (valid_variance)
4152 {
4153 print_file(file, indent, "__frame->_StubMsg.ActualCount = (ULONG_PTR)");
4154 write_expr(file, type_array_get_variance(type), 1, 1, NULL, NULL, local_var_prefix);
4155 fprintf(file, ";\n\n");
4156 }
4157 else
4158 print_file(file, indent, "__frame->_StubMsg.ActualCount = __frame->_StubMsg.MaxCount;\n\n");
4159 }
4160 }
4161 break;
4162 case TGT_UNION:
4163 if (type_get_type(type) == TYPE_UNION &&
4165 {
4166 print_file(file, indent, "__frame->_StubMsg.MaxCount = (ULONG_PTR)");
4167 write_expr(file, get_attrp(var->attrs, ATTR_SWITCHIS), 1, 1, NULL, NULL, local_var_prefix);
4168 fprintf(file, ";\n\n");
4169 }
4170 break;
4171 case TGT_IFACE_POINTER:
4172 {
4173 expr_t *iid;
4174
4175 if (is_conformance_needed_for_phase(phase) && (iid = get_attrp( var->attrs, ATTR_IIDIS )))
4176 {
4177 print_file( file, indent, "__frame->_StubMsg.MaxCount = (ULONG_PTR) " );
4178 write_expr( file, iid, 1, 1, NULL, NULL, local_var_prefix );
4179 fprintf( file, ";\n\n" );
4180 }
4181 break;
4182 }
4183 case TGT_POINTER:
4185 continue;
4186 case TGT_INVALID:
4187 case TGT_USER_TYPE:
4188 case TGT_CTXT_HANDLE:
4190 case TGT_STRING:
4191 case TGT_BASIC:
4192 case TGT_ENUM:
4193 case TGT_STRUCT:
4194 case TGT_RANGE:
4195 break;
4196 }
4197 break;
4198 }
4199}
static int is_conformance_needed_for_phase(enum remoting_phase phase)
Definition: typegen.c:4105
static expr_t * type_array_get_variance(const type_t *type)
Definition: typetree.h:246
@ ATTR_SWITCHIS
Definition: widltypes.h:159

Referenced by free_variable(), and write_remoting_arg().

◆ write_parameters_init()

void write_parameters_init ( FILE file,
int  indent,
const var_t func,
const char local_var_prefix 
)

Definition at line 903 of file typegen.c.

904{
905 const var_t *var = type_function_get_retval(func->type);
906
907 if (!is_void(var->type))
908 write_var_init(file, indent, var->type, var->name, local_var_prefix);
909
910 if (!type_get_function_args(func->type))
911 return;
912
914 write_var_init(file, indent, var->type, var->name, local_var_prefix);
915
916 fprintf(file, "\n");
917}
static void write_var_init(FILE *file, int indent, const type_t *t, const char *n, const char *local_var_prefix)
Definition: typegen.c:891

Referenced by gen_stub(), and write_function_stub().

◆ write_pointer_checks()

void write_pointer_checks ( FILE file,
int  indent,
const var_t func 
)

Definition at line 4845 of file typegen.c.

4846{
4847 const var_list_t *args = type_get_function_args( func->type );
4848 const var_t *var;
4849
4850 if (!args) return;
4851
4853 if (cant_be_null( var ))
4854 print_file( file, indent, "if (!%s) RpcRaiseException(RPC_X_NULL_REF_POINTER);\n", var->name );
4855}
static int cant_be_null(const var_t *v)
Definition: typegen.c:379

Referenced by gen_proxy(), and write_function_stub().

◆ write_procformatstring()

void write_procformatstring ( FILE file,
const statement_list_t stmts,
type_pred_t  pred 
)

Definition at line 1513 of file typegen.c.

1514{
1515 int indent = 0;
1516 unsigned int offset = 0;
1517
1518 print_file(file, indent, "static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =\n");
1519 print_file(file, indent, "{\n");
1520 indent++;
1521 print_file(file, indent, "0,\n");
1522 print_file(file, indent, "{\n");
1523 indent++;
1524
1526
1527 print_file(file, indent, "0x0\n");
1528 indent--;
1529 print_file(file, indent, "}\n");
1530 indent--;
1531 print_file(file, indent, "};\n");
1532 print_file(file, indent, "\n");
1533}
static void write_iface_procformatstring(type_t *iface, FILE *file, int indent, unsigned int *offset)
Definition: typegen.c:1499

Referenced by write_client_routines(), write_proxy_routines(), and write_server_routines().

◆ write_procformatstring_offsets()

void write_procformatstring_offsets ( FILE file,
const type_t iface 
)

Definition at line 1535 of file typegen.c.

1536{
1537 const statement_t *stmt;
1538 int indent = 0;
1539
1540 print_file( file, indent, "static const unsigned short %s_FormatStringOffsetTable[] =\n",
1541 iface->name );
1542 print_file( file, indent, "{\n" );
1543 indent++;
1545 {
1546 var_t *func = stmt->u.var;
1547 if (is_local( func->attrs )) continue;
1548 print_file( file, indent, "%u, /* %s */\n", func->procstring_offset, func->name );
1549 }
1550 indent--;
1551 print_file( file, indent, "};\n\n" );
1552}
int is_local(const attr_list_t *a)
Definition: header.c:938
var_t * var
Definition: widltypes.h:539
union _statement_t::@5026 u
static statement_list_t * type_iface_get_stmts(const type_t *type)
Definition: typetree.h:151
#define STATEMENTS_FOR_EACH_FUNC(stmt, stmts)
Definition: widltypes.h:597

Referenced by write_server_stmts().

◆ write_remoting_arguments()

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 at line 4559 of file typegen.c.

4561{
4562 if (phase == PHASE_BUFFERSIZE && pass != PASS_RETURN)
4563 {
4564 unsigned int size = get_function_buffer_size( func, pass );
4565 print_file(file, indent, "__frame->_StubMsg.BufferLength = %u;\n", size);
4566 }
4567
4568 if (pass == PASS_RETURN)
4569 {
4570 write_remoting_arg( file, indent, func, local_var_prefix, pass, phase,
4572 }
4573 else
4574 {
4575 const var_t *var;
4576 if (!type_get_function_args(func->type))
4577 return;
4579 write_remoting_arg( file, indent, func, local_var_prefix, pass, phase, var );
4580 }
4581}
static void write_remoting_arg(FILE *file, int indent, const var_t *func, const char *local_var_prefix, enum pass pass, enum remoting_phase phase, const var_t *var)
Definition: typegen.c:4201
static unsigned int get_function_buffer_size(const var_t *func, enum pass pass)

Referenced by gen_proxy(), gen_stub(), and write_function_stub().

◆ write_typeformatstring()

void write_typeformatstring ( FILE file,
const statement_list_t stmts,
type_pred_t  pred 
)

Definition at line 3761 of file typegen.c.

3762{
3763 int indent = 0;
3764
3765 print_file(file, indent, "static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =\n");
3766 print_file(file, indent, "{\n");
3767 indent++;
3768 print_file(file, indent, "0,\n");
3769 print_file(file, indent, "{\n");
3770 indent++;
3771 print_file(file, indent, "NdrFcShort(0x0),\n");
3772
3774 process_tfs(file, stmts, pred);
3775
3776 print_file(file, indent, "0x0\n");
3777 indent--;
3778 print_file(file, indent, "}\n");
3779 indent--;
3780 print_file(file, indent, "};\n");
3781 print_file(file, indent, "\n");
3782}

Referenced by write_client_routines(), write_proxy_routines(), and write_server_routines().

◆ write_user_quad_list()

void write_user_quad_list ( FILE file)

Definition at line 4918 of file typegen.c.

4919{
4920 user_type_t *ut;
4921
4923 return;
4924
4925 fprintf(file, "static const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[] =\n");
4926 fprintf(file, "{\n");
4928 {
4929 const char *sep = &ut->entry == list_tail(&user_type_list) ? "" : ",";
4930 print_file(file, 1, "{\n");
4931 print_file(file, 2, "(USER_MARSHAL_SIZING_ROUTINE)%s_UserSize,\n", ut->name);
4932 print_file(file, 2, "(USER_MARSHAL_MARSHALLING_ROUTINE)%s_UserMarshal,\n", ut->name);
4933 print_file(file, 2, "(USER_MARSHAL_UNMARSHALLING_ROUTINE)%s_UserUnmarshal,\n", ut->name);
4934 print_file(file, 2, "(USER_MARSHAL_FREEING_ROUTINE)%s_UserFree\n", ut->name);
4935 print_file(file, 1, "}%s\n", sep);
4936 }
4937 fprintf(file, "};\n\n");
4938}
static int list_empty(struct list_entry *head)
Definition: list.h:58
__WINE_SERVER_LIST_INLINE struct list * list_tail(const struct list *list)
Definition: list.h:137
user_type_list_t user_type_list
Definition: header.c:42
struct list entry
Definition: widltypes.h:522
const char * name
Definition: widltypes.h:523

Referenced by write_client_routines(), write_proxy_routines(), and write_server_routines().