ReactOS 0.4.16-dev-1946-g52006dd
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_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 4922 of file typegen.c.

4923{
4924 int in_attr, out_attr;
4925 int i = 0, sep = 0;
4926 const var_t *var;
4927 type_t *ref;
4928
4929 if (!type_function_get_args(func->declspec.type))
4930 return;
4931
4932 LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry )
4933 {
4934 in_attr = is_attr(var->attrs, ATTR_IN);
4935 out_attr = is_attr(var->attrs, ATTR_OUT);
4936 if (!out_attr && !in_attr)
4937 in_attr = 1;
4938
4939 if (!in_attr)
4940 {
4941 print_file(file, indent, "%s%s", local_var_prefix, var->name);
4942
4943 switch (typegen_detect_type(var->declspec.type, var->attrs, TDT_IGNORE_STRINGS))
4944 {
4946 fprintf(file, " = NdrContextHandleInitialize(\n");
4947 print_file(file, indent + 1, "&__frame->_StubMsg,\n");
4948 print_file(file, indent + 1, "(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%d]);\n",
4949 var->typestring_offset);
4950 break;
4951 case TGT_ARRAY:
4952 if (type_array_has_conformance(var->declspec.type))
4953 {
4954 unsigned int size;
4955 type_t *type;
4956
4957 fprintf(file, " = NdrAllocate(&__frame->_StubMsg, ");
4958 for (type = var->declspec.type;
4961 {
4963 TRUE, NULL, NULL, local_var_prefix);
4964 fprintf(file, " * ");
4965 }
4967 fprintf(file, "%u);\n", size);
4968
4969 print_file(file, indent, "memset(%s%s, 0, ", local_var_prefix, var->name);
4970 for (type = var->declspec.type;
4973 {
4975 TRUE, NULL, NULL, local_var_prefix);
4976 fprintf(file, " * ");
4977 }
4979 fprintf(file, "%u);\n", size);
4980 }
4981 else
4982 fprintf(file, " = &%s_W%u;\n", local_var_prefix, i++);
4983 break;
4984 case TGT_POINTER:
4985 fprintf(file, " = &%s_W%u;\n", local_var_prefix, i);
4986 ref = type_pointer_get_ref_type(var->declspec.type);
4988 {
4989 case TGT_BASIC:
4990 case TGT_ENUM:
4991 case TGT_POINTER:
4992 case TGT_RANGE:
4993 case TGT_IFACE_POINTER:
4994 print_file(file, indent, "%s_W%u = 0;\n", local_var_prefix, i);
4995 break;
4996 case TGT_USER_TYPE:
4997 print_file(file, indent, "memset(&%s_W%u, 0, sizeof(%s_W%u));\n",
4998 local_var_prefix, i, local_var_prefix, i);
4999 break;
5000 case TGT_ARRAY:
5002 {
5003 print_file(file, indent, "%s_W%u = 0;\n", local_var_prefix, i);
5004 break;
5005 }
5007 /* fall through */
5008 case TGT_STRUCT:
5009 case TGT_UNION:
5010 if (type_has_pointers(ref, var->attrs))
5011 print_file(file, indent, "memset(&%s_W%u, 0, sizeof(%s_W%u));\n",
5012 local_var_prefix, i, local_var_prefix, i);
5013 break;
5014 case TGT_CTXT_HANDLE:
5016 case TGT_INVALID:
5017 case TGT_STRING:
5018 /* not initialised */
5019 break;
5020 }
5021 i++;
5022 break;
5023 default:
5024 break;
5025 }
5026
5027 sep = 1;
5028 }
5029 }
5030 if (sep)
5031 fprintf(file, "\n");
5032}
#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:680
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum func
Definition: glext.h:6028
GLsizeiptr size
Definition: glext.h:5919
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
_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 attr_type)
Definition: attribute.c:45
static int is_array(const type_t *t)
Definition: header.h:60
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:324
unsigned int type_memsize(const type_t *t)
Definition: typegen.c:2238
static void print_file(FILE *file, int indent, const char *format,...) __attribute__((format(printf
Definition: typegen.c:976
static int type_has_pointers(const type_t *type, const attr_list_t *attrs)
Definition: typegen.c:745
static int type_array_is_decl_as_ptr(const type_t *type)
Definition: typetree.h:350
static int type_array_has_conformance(const type_t *type)
Definition: typetree.h:289
static type_t * type_array_get_element_type(const type_t *type)
Definition: typetree.h:345
static expr_t * type_array_get_conformance(const type_t *type)
Definition: typetree.h:310
static type_t * type_pointer_get_ref_type(const type_t *type)
Definition: typetree.h:424
static var_list_t * type_function_get_args(const type_t *type)
Definition: typetree.h:139
@ ATTR_IN
Definition: widltypes.h:131
@ ATTR_OUT
Definition: widltypes.h:151

Referenced by gen_stub(), and write_function_stub().

◆ decl_indirect()

int decl_indirect ( const type_t t)

Definition at line 1053 of file typegen.c.

1054{
1055 if (is_user_type(t))
1056 return TRUE;
1057 return (type_get_type(t) != TYPE_BASIC &&
1061}
GLdouble GLdouble t
Definition: gl.h:2047
static int is_user_type(const type_t *t)
Definition: typegen.c:319
static enum type_type type_get_type(const type_t *type)
Definition: typetree.h:113
@ TYPE_ENUM
Definition: widltypes.h:480
@ TYPE_BASIC
Definition: widltypes.h:479
@ TYPE_POINTER
Definition: widltypes.h:489
@ TYPE_ARRAY
Definition: widltypes.h:490

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 4856 of file typegen.c.

4857{
4858 int in_attr, out_attr;
4859 int i = 0;
4860 var_t *var = type_function_get_retval(func->declspec.type);
4861
4862 /* declare return value */
4863 if (!is_void(var->declspec.type))
4864 {
4865 if (is_context_handle(var->declspec.type))
4866 print_file(file, indent, "NDR_SCONTEXT %s;\n", var->name);
4867 else
4868 {
4869 print_file(file, indent, "%s", "");
4870 write_type_decl(file, &var->declspec, var->name);
4871 fprintf(file, ";\n");
4872 }
4873 }
4874
4875 if (!type_function_get_args(func->declspec.type))
4876 return;
4877
4879 {
4880 in_attr = is_attr(var->attrs, ATTR_IN);
4881 out_attr = is_attr(var->attrs, ATTR_OUT);
4882 if (!out_attr && !in_attr)
4883 in_attr = 1;
4884
4885 if (is_context_handle(var->declspec.type))
4886 print_file(file, indent, "NDR_SCONTEXT %s;\n", var->name);
4887 else
4888 {
4889 if (!in_attr && !is_conformant_array(var->declspec.type))
4890 {
4891 const decl_spec_t *type_to_print;
4892 char name[16];
4893 print_file(file, indent, "%s", "");
4894 if (type_get_type(var->declspec.type) == TYPE_ARRAY &&
4895 !type_array_is_decl_as_ptr(var->declspec.type))
4896 type_to_print = &var->declspec;
4897 else
4898 type_to_print = type_pointer_get_ref(var->declspec.type);
4899 snprintf(name, sizeof(name), "_W%u", i++);
4900 write_type_decl(file, type_to_print, name);
4901 fprintf(file, ";\n");
4902 }
4903
4904 print_file(file, indent, "%s", "");
4905 write_type_decl_left(file, &var->declspec);
4906 fprintf(file, " ");
4907 if (type_get_type(var->declspec.type) == TYPE_ARRAY &&
4908 !type_array_is_decl_as_ptr(var->declspec.type)) {
4909 fprintf(file, "(*%s)", var->name);
4910 } else
4911 fprintf(file, "%s", var->name);
4912 write_type_right(file, var->declspec.type, FALSE);
4913 fprintf(file, ";\n");
4914
4915 if (decl_indirect(var->declspec.type))
4916 print_file(file, indent, "void *_p_%s;\n", var->name);
4917 }
4918 }
4919}
#define FALSE
Definition: types.h:117
void write_type_right(FILE *h, type_t *t, int is_field)
Definition: header.c:476
void write_type_decl_left(FILE *f, const decl_spec_t *ds)
Definition: header.c:593
void write_type_decl(FILE *f, const decl_spec_t *t, const char *name)
Definition: header.c:588
static int is_context_handle(const type_t *type)
Definition: header.h:101
static int is_void(const type_t *t)
Definition: header.h:70
static int is_conformant_array(const type_t *t)
Definition: header.h:80
Definition: name.c:39
int decl_indirect(const type_t *t)
Definition: typegen.c:1053
static var_t * type_function_get_retval(const type_t *type)
Definition: typetree.h:146
static const decl_spec_t * type_pointer_get_ref(const type_t *type)
Definition: typetree.h:417
#define snprintf
Definition: wintirpc.h:48

Referenced by gen_stub(), and write_function_stub().

◆ get_basic_fc()

unsigned char get_basic_fc ( const type_t type)

Definition at line 195 of file typegen.c.

196{
198 switch (type_basic_get_type(type))
199 {
200 case TYPE_BASIC_INT8: return (sign <= 0 ? FC_SMALL : FC_USMALL);
201 case TYPE_BASIC_INT16: return (sign <= 0 ? FC_SHORT : FC_USHORT);
202 case TYPE_BASIC_INT32:
203 case TYPE_BASIC_LONG: return (sign <= 0 ? FC_LONG : FC_ULONG);
204 case TYPE_BASIC_INT64: return FC_HYPER;
205 case TYPE_BASIC_INT: return (sign <= 0 ? FC_LONG : FC_ULONG);
206 case TYPE_BASIC_INT3264: return (sign <= 0 ? FC_INT3264 : FC_UINT3264);
207 case TYPE_BASIC_BYTE: return FC_BYTE;
208 case TYPE_BASIC_CHAR: return FC_CHAR;
209 case TYPE_BASIC_WCHAR: return FC_WCHAR;
210 case TYPE_BASIC_HYPER: return FC_HYPER;
211 case TYPE_BASIC_FLOAT: return FC_FLOAT;
212 case TYPE_BASIC_DOUBLE: return FC_DOUBLE;
215 }
216 return 0;
217}
#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:125
static enum type_basic_type type_basic_get_type(const type_t *type)
Definition: typetree.h:118
@ TYPE_BASIC_DOUBLE
Definition: widltypes.h:308
@ TYPE_BASIC_INT32
Definition: widltypes.h:298
@ TYPE_BASIC_ERROR_STATUS_T
Definition: widltypes.h:309
@ TYPE_BASIC_CHAR
Definition: widltypes.h:303
@ TYPE_BASIC_WCHAR
Definition: widltypes.h:306
@ TYPE_BASIC_INT16
Definition: widltypes.h:297
@ TYPE_BASIC_HYPER
Definition: widltypes.h:304
@ TYPE_BASIC_HANDLE
Definition: widltypes.h:310
@ TYPE_BASIC_INT8
Definition: widltypes.h:296
@ TYPE_BASIC_INT3264
Definition: widltypes.h:301
@ TYPE_BASIC_LONG
Definition: widltypes.h:302
@ TYPE_BASIC_INT64
Definition: widltypes.h:299
@ TYPE_BASIC_BYTE
Definition: widltypes.h:305
@ TYPE_BASIC_INT
Definition: widltypes.h:300
@ TYPE_BASIC_FLOAT
Definition: widltypes.h:307

Referenced by get_correlation_type(), get_parameter_fc(), get_required_buffer_size_type(), print_phase_basetype(), type_buffer_alignment(), type_memsize_and_alignment(), write_branch_type(), write_range_tfs(), write_simple_pointer(), write_string_tfs(), write_union_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 4350 of file typegen.c.

4351{
4352 expr_t *x = NULL;
4353
4357 {
4358 if (!x)
4360 else
4361 error("%s: multidimensional conformant"
4362 " arrays not supported at the top level\n",
4363 name);
4364 }
4365
4366 return x;
4367}
@ 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:360

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 4843 of file typegen.c.

4844{
4845 unsigned int size = 1;
4847 return size;
4848}
static void get_size_procformatstring_iface(type_t *iface, FILE *file, int indent, unsigned int *size)
Definition: typegen.c:4832
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:1733

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 4825 of file typegen.c.

4826{
4827 unsigned int offset = 0;
4828 write_procformatstring_func( NULL, 0, iface, func, &offset, 0 );
4829 return offset;
4830}
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:1694

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 4850 of file typegen.c.

4851{
4853 return process_tfs(NULL, stmts, pred);
4854}
static unsigned int process_tfs(FILE *file, const statement_list_t *stmts, type_pred_t pred)
Definition: typegen.c:3995
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 520 of file typegen.c.

521{
522 int has_pointer = 0;
523 int has_conformance = 0;
524 int has_variance = 0;
525 var_t *field;
527
529
530 if (get_padding(fields))
531 return FC_BOGUS_STRUCT;
532
534 {
535 type_t *t = field->declspec.type;
537
539
541 {
542 if (is_string_type(field->attrs, field->declspec.type))
543 {
545 has_conformance = 1;
546 has_variance = 1;
547 continue;
548 }
549
551 return FC_BOGUS_STRUCT;
552
554 {
555 has_conformance = 1;
556 if (list_next(fields, &field->entry))
557 error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n",
558 field->name);
559 }
561 has_variance = 1;
562
565 }
566
567 switch (typegen_type)
568 {
569 case TGT_USER_TYPE:
571 return FC_BOGUS_STRUCT;
572 case TGT_BASIC:
574 return FC_BOGUS_STRUCT;
575 break;
576 case TGT_ENUM:
577 if (get_enum_fc(t) == FC_ENUM16)
578 return FC_BOGUS_STRUCT;
579 break;
580 case TGT_POINTER:
581 case TGT_ARRAY:
582 if (get_pointer_fc(t, field->attrs, TRUE, FALSE) == FC_RP || pointer_size != 4)
583 return FC_BOGUS_STRUCT;
584 has_pointer = 1;
585 break;
586 case TGT_UNION:
587 return FC_BOGUS_STRUCT;
588 case TGT_STRUCT:
589 {
590 unsigned char fc = get_struct_fc(t);
591 switch (fc)
592 {
593 case FC_STRUCT:
594 break;
595 case FC_CVSTRUCT:
596 has_conformance = 1;
597 has_variance = 1;
598 has_pointer = 1;
599 break;
600
601 case FC_CPSTRUCT:
602 has_conformance = 1;
603 if (list_next( fields, &field->entry ))
604 error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n",
605 field->name);
606 has_pointer = 1;
607 break;
608
609 case FC_CSTRUCT:
610 has_conformance = 1;
611 if (list_next( fields, &field->entry ))
612 error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n",
613 field->name);
614 break;
615
616 case FC_PSTRUCT:
617 has_pointer = 1;
618 break;
619
620 default:
621 error_loc("Unknown struct member %s with type (0x%02x)\n", field->name, fc);
622 /* fallthru - treat it as complex */
623
624 /* as soon as we see one of these these members, it's bogus... */
625 case FC_BOGUS_STRUCT:
626 return FC_BOGUS_STRUCT;
627 }
628 break;
629 }
630 case TGT_RANGE:
631 return FC_BOGUS_STRUCT;
632 case TGT_STRING:
633 /* shouldn't get here because of TDT_IGNORE_STRINGS above. fall through */
634 case TGT_INVALID:
635 case TGT_CTXT_HANDLE:
637 /* checking after parsing should mean that we don't get here. if we do,
638 * it's a checker bug */
639 assert(0);
640 }
641 }
642
643 if( has_variance )
644 {
645 if ( has_conformance )
646 return FC_CVSTRUCT;
647 else
648 return FC_BOGUS_STRUCT;
649 }
650 if( has_conformance && has_pointer )
651 return FC_CPSTRUCT;
652 if( has_conformance )
653 return FC_CSTRUCT;
654 if( has_pointer )
655 return FC_PSTRUCT;
656 return FC_STRUCT;
657}
PFOR_CONTEXT fc
Definition: for.c:57
Definition: list.h:37
#define assert(x)
Definition: debug.h:53
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_RP
Definition: ndrtypes.h:152
@ 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
static int is_string_type(const attr_list_t *attrs, const type_t *type)
Definition: header.h:95
#define error_loc(...)
Definition: utils.h:29
Definition: parser.c:44
static unsigned char get_pointer_fc(const type_t *type, const attr_list_t *attrs, int toplevel_attrs, int toplevel_param)
Definition: typegen.c:248
unsigned char get_struct_fc(const type_t *type)
Definition: typegen.c:520
static int get_padding(const var_list_t *fields)
Definition: typegen.c:401
static unsigned char get_enum_fc(const type_t *type)
Definition: typegen.c:291
typegen_type
Definition: typegen.h:47
static var_list_t * type_struct_get_fields(const type_t *type)
Definition: typetree.h:132
static int type_array_has_variance(const type_t *type)
Definition: typetree.h:296
unsigned int pointer_size
Definition: widl.c:147

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 2343 of file typegen.c.

2344{
2345 const var_t *var;
2347 return TRUE;
2348 if (!type_function_get_args(func->declspec.type))
2349 return FALSE;
2350 LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry )
2351 if (type_has_full_pointer( var->declspec.type, var->attrs, TRUE, TRUE ))
2352 return TRUE;
2353 return FALSE;
2354}
attr_list_t * attrs
Definition: widltypes.h:503
static int type_has_full_pointer(const type_t *type, const attr_list_t *attrs, int toplevel_attrs, int toplevel_param)
Definition: typegen.c:900
static type_t * type_function_get_rettype(const type_t *type)
Definition: typetree.h:158

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

◆ is_interpreted_func()

int is_interpreted_func ( const type_t iface,
const var_t func 
)

Definition at line 1352 of file typegen.c.

1353{
1354 const char *str;
1355 const type_t *ret_type = type_function_get_rettype( func->declspec.type );
1356
1357 if (type_get_type( ret_type ) == TYPE_BASIC)
1358 {
1359 switch (type_basic_get_type( ret_type ))
1360 {
1361 case TYPE_BASIC_INT64:
1362 case TYPE_BASIC_HYPER:
1363 /* return value must fit in a long_ptr */
1364 if (pointer_size < 8) return 0;
1365 break;
1366 case TYPE_BASIC_FLOAT:
1367 case TYPE_BASIC_DOUBLE:
1368 /* floating point values can't be returned */
1369 return 0;
1370 default:
1371 break;
1372 }
1373 }
1374 if ((str = get_attrp( func->attrs, ATTR_OPTIMIZE ))) return !strcmp( str, "i" );
1375 if ((str = get_attrp( iface->attrs, ATTR_OPTIMIZE ))) return !strcmp( str, "i" );
1376 return interpreted_mode;
1377}
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 attr_type)
Definition: attribute.c:87
int interpreted_mode
Definition: widl.c:112
@ ATTR_OPTIMIZE
Definition: widltypes.h:149

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 984 of file typegen.c.

985{
986 if (file)
987 {
988 if (format[0] != '\n')
989 while (0 < indent--)
990 fprintf(file, " ");
991 vfprintf(file, format, va);
992 }
993}
_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 4225 of file typegen.c.

4228{
4229 type_t *type = var->declspec.type;
4230 unsigned int alignment = 0;
4231
4232 /* no work to do for other phases, buffer sizing is done elsewhere */
4233 if (phase != PHASE_MARSHAL && phase != PHASE_UNMARSHAL)
4234 return;
4235
4236 if (type_get_type(type) == TYPE_ENUM ||
4239 pointer_size != 4))
4240 {
4241 unsigned char fc;
4242
4244 fc = get_enum_fc(type);
4245 else
4246 fc = get_basic_fc(type);
4247
4248 if (phase == PHASE_MARSHAL)
4249 print_file(file, indent, "NdrSimpleTypeMarshall(\n");
4250 else
4251 print_file(file, indent, "NdrSimpleTypeUnmarshall(\n");
4252 print_file(file, indent+1, "&__frame->_StubMsg,\n");
4253 print_file(file, indent+1, "(unsigned char *)&%s%s,\n",
4254 local_var_prefix,
4255 var->name);
4256 print_file(file, indent+1, "0x%02x /* %s */);\n", fc, string_of_type(fc));
4257 }
4258 else
4259 {
4260 const decl_spec_t *ref = is_ptr(type) ? type_pointer_get_ref(type) : &var->declspec;
4261
4262 switch (get_basic_fc(ref->type))
4263 {
4264 case FC_BYTE:
4265 case FC_CHAR:
4266 case FC_SMALL:
4267 case FC_USMALL:
4268 alignment = 1;
4269 break;
4270
4271 case FC_WCHAR:
4272 case FC_USHORT:
4273 case FC_SHORT:
4274 alignment = 2;
4275 break;
4276
4277 case FC_ULONG:
4278 case FC_LONG:
4279 case FC_FLOAT:
4280 case FC_ERROR_STATUS_T:
4281 /* pointer_size must be 4 if we got here in these two cases */
4282 case FC_INT3264:
4283 case FC_UINT3264:
4284 alignment = 4;
4285 break;
4286
4287 case FC_HYPER:
4288 case FC_DOUBLE:
4289 alignment = 8;
4290 break;
4291
4292 case FC_IGNORE:
4293 case FC_BIND_PRIMITIVE:
4294 /* no marshalling needed */
4295 return;
4296
4297 default:
4298 error("print_phase_basetype: Unsupported type: %s (0x%02x, ptr_level: 0)\n",
4299 var->name, get_basic_fc(ref->type));
4300 }
4301
4302 if (phase == PHASE_MARSHAL && alignment > 1)
4303 print_file(file, indent, "MIDL_memset(__frame->_StubMsg.Buffer, 0, (0x%x - (ULONG_PTR)__frame->_StubMsg.Buffer) & 0x%x);\n", alignment, alignment - 1);
4304 print_file(file, indent, "__frame->_StubMsg.Buffer = (unsigned char *)(((ULONG_PTR)__frame->_StubMsg.Buffer + %u) & ~0x%x);\n",
4305 alignment - 1, alignment - 1);
4306
4307 if (phase == PHASE_MARSHAL)
4308 {
4309 print_file(file, indent, "*(");
4311 if (is_ptr(type))
4312 fprintf(file, " *)__frame->_StubMsg.Buffer = *");
4313 else
4314 fprintf(file, " *)__frame->_StubMsg.Buffer = ");
4315 fprintf(file, "%s%s", local_var_prefix, varname);
4316 fprintf(file, ";\n");
4317 }
4318 else if (phase == PHASE_UNMARSHAL)
4319 {
4320 print_file(file, indent, "if (__frame->_StubMsg.Buffer + sizeof(");
4322 fprintf(file, ") > __frame->_StubMsg.BufferEnd)\n");
4323 print_file(file, indent, "{\n");
4324 print_file(file, indent + 1, "RpcRaiseException(RPC_X_BAD_STUB_DATA);\n");
4325 print_file(file, indent, "}\n");
4326 print_file(file, indent, "%s%s%s",
4327 (pass == PASS_IN || pass == PASS_RETURN) ? "" : "*",
4328 local_var_prefix, varname);
4329 if (pass == PASS_IN && is_ptr(type))
4330 fprintf(file, " = (");
4331 else
4332 fprintf(file, " = *(");
4334 fprintf(file, " *)__frame->_StubMsg.Buffer;\n");
4335 }
4336
4337 print_file(file, indent, "__frame->_StubMsg.Buffer += sizeof(");
4339 fprintf(file, ");\n");
4340 }
4341}
_Check_return_ _Ret_maybenull_ _In_ size_t alignment
Definition: align.cpp:48
@ FC_IGNORE
Definition: ndrtypes.h:149
static int is_ptr(const type_t *t)
Definition: header.h:55
static const char * string_of_type(unsigned char type)
Definition: typegen.c:105
unsigned char get_basic_fc(const type_t *type)
Definition: typegen.c:195
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 2124 of file typegen.c.

2125{
2126 unsigned int size = 0;
2127
2128 switch (type_get_type(t))
2129 {
2130 case TYPE_BASIC:
2131 switch (get_basic_fc(t))
2132 {
2133 case FC_BYTE:
2134 case FC_CHAR:
2135 case FC_USMALL:
2136 case FC_SMALL:
2137 size = 1;
2138 if (size > *align) *align = size;
2139 break;
2140 case FC_WCHAR:
2141 case FC_USHORT:
2142 case FC_SHORT:
2143 size = 2;
2144 if (size > *align) *align = size;
2145 break;
2146 case FC_ULONG:
2147 case FC_LONG:
2148 case FC_ERROR_STATUS_T:
2149 case FC_FLOAT:
2150 size = 4;
2151 if (size > *align) *align = size;
2152 break;
2153 case FC_HYPER:
2154 case FC_DOUBLE:
2155 size = 8;
2156 if (size > *align) *align = size;
2157 break;
2158 case FC_INT3264:
2159 case FC_UINT3264:
2160 case FC_BIND_PRIMITIVE:
2163 if (size > *align) *align = size;
2164 break;
2165 default:
2166 error("type_memsize: Unknown type 0x%x\n", get_basic_fc(t));
2167 size = 0;
2168 }
2169 break;
2170 case TYPE_ENUM:
2171 switch (get_enum_fc(t))
2172 {
2173 case FC_ENUM16:
2174 case FC_ENUM32:
2175 size = 4;
2176 if (size > *align) *align = size;
2177 break;
2178 default:
2179 error("type_memsize: Unknown enum type\n");
2180 size = 0;
2181 }
2182 break;
2183 case TYPE_STRUCT:
2185 break;
2188 break;
2189 case TYPE_UNION:
2191 break;
2192 case TYPE_POINTER:
2193 case TYPE_INTERFACE:
2196 if (size > *align) *align = size;
2197 break;
2198 case TYPE_ARRAY:
2200 {
2202 {
2204 size = 0;
2205 }
2206 else
2209 }
2210 else /* declared as a pointer */
2211 {
2214 if (size > *align) *align = size;
2215 }
2216 break;
2217 case TYPE_ALIAS:
2218 case TYPE_VOID:
2219 case TYPE_COCLASS:
2220 case TYPE_MODULE:
2221 case TYPE_FUNCTION:
2222 case TYPE_BITFIELD:
2223 case TYPE_APICONTRACT:
2224 case TYPE_RUNTIMECLASS:
2226 case TYPE_PARAMETER:
2227 case TYPE_DELEGATE:
2228 /* these types should not be encountered here due to language
2229 * restrictions (interface, void, coclass, module), logical
2230 * restrictions (alias - due to type_get_type call above) or
2231 * checking restrictions (function, bitfield). */
2232 assert(0);
2233 }
2234
2235 return size;
2236}
@ FC_ENUM32
Definition: ndrtypes.h:148
static unsigned int fields_memsize(const var_list_t *fields, unsigned int *align)
Definition: typegen.c:2081
static unsigned int union_memsize(const var_list_t *fields, unsigned int *pmaxa)
Definition: typegen.c:2104
static var_list_t * type_union_get_cases(const type_t *type)
Definition: typetree.h:184
static var_list_t * type_encapsulated_union_get_fields(const type_t *type)
Definition: typetree.h:177
static unsigned int type_array_get_dim(const type_t *type)
Definition: typetree.h:303
@ TYPE_PARAMETER
Definition: widltypes.h:495
@ TYPE_BITFIELD
Definition: widltypes.h:491
@ TYPE_UNION
Definition: widltypes.h:483
@ TYPE_ALIAS
Definition: widltypes.h:484
@ TYPE_PARAMETERIZED_TYPE
Definition: widltypes.h:494
@ TYPE_VOID
Definition: widltypes.h:478
@ TYPE_ENCAPSULATED_UNION
Definition: widltypes.h:482
@ TYPE_COCLASS
Definition: widltypes.h:486
@ TYPE_STRUCT
Definition: widltypes.h:481
@ TYPE_MODULE
Definition: widltypes.h:485
@ TYPE_DELEGATE
Definition: widltypes.h:496
@ TYPE_RUNTIMECLASS
Definition: widltypes.h:493
@ TYPE_INTERFACE
Definition: widltypes.h:488
@ TYPE_FUNCTION
Definition: widltypes.h:487
@ TYPE_APICONTRACT
Definition: widltypes.h:492

Referenced by add_typedef_typeinfo(), add_var_desc(), field_memsize(), fields_memsize(), get_padding(), get_stack_size(), 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 324 of file typegen.c.

325{
326 if (is_user_type(type))
327 return TGT_USER_TYPE;
328
330 return TGT_CTXT_HANDLE;
331
332 if (!(flags & TDT_IGNORE_STRINGS) && is_string_type(attrs, type))
333 return TGT_STRING;
334
335 switch (type_get_type(type))
336 {
337 case TYPE_BASIC:
338 if (!(flags & TDT_IGNORE_RANGES) &&
340 return TGT_RANGE;
341 return TGT_BASIC;
342 case TYPE_ENUM:
343 if (!(flags & TDT_IGNORE_RANGES) &&
345 return TGT_RANGE;
346 return TGT_ENUM;
347 case TYPE_POINTER:
352 return TGT_IFACE_POINTER;
355 else
356 return TGT_POINTER;
357 case TYPE_STRUCT:
358 return TGT_STRUCT;
360 case TYPE_UNION:
361 return TGT_UNION;
362 case TYPE_ARRAY:
363 return TGT_ARRAY;
364 case TYPE_FUNCTION:
365 case TYPE_COCLASS:
366 case TYPE_INTERFACE:
367 case TYPE_MODULE:
368 case TYPE_VOID:
369 case TYPE_ALIAS:
370 case TYPE_BITFIELD:
372 case TYPE_DELEGATE:
373 break;
374 case TYPE_APICONTRACT:
376 case TYPE_PARAMETER:
377 /* not supposed to be here */
378 assert(0);
379 break;
380 }
381 return TGT_INVALID;
382}
GLbitfield flags
Definition: glext.h:7161
int is_aliaschain_attr(const type_t *type, enum attr_type attr_type)
Definition: attribute.c:67
@ ATTR_CONTEXTHANDLE
Definition: widltypes.h:89
@ ATTR_RANGE
Definition: widltypes.h:164
@ ATTR_IIDIS
Definition: widltypes.h:128

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_recurse(), 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 5218 of file typegen.c.

5220{
5221 const decl_spec_t *rettype = type_function_get_ret( func->declspec.type );
5222 int has_ret = !is_void( rettype->type );
5223 const var_list_t *args = type_function_get_args( func->declspec.type );
5224 const var_t *arg;
5225 int len, needs_params = 0;
5226
5227 /* we need a param structure if we have more than one arg */
5228 if (target.cpu == CPU_i386 && args) needs_params = is_object( iface ) || list_count( args ) > 1;
5229
5230 print_file( file, 0, "{\n");
5231 if (needs_params)
5232 {
5233 if (has_ret) print_file( file, 1, "%s", "CLIENT_CALL_RETURN _RetVal;\n" );
5234 write_func_param_struct( file, iface, func->declspec.type, "__params", FALSE );
5235 if (is_object( iface )) print_file( file, 1, "__params.This = This;\n" );
5236 if (args)
5238 print_file( file, 1, "__params.%s = %s;\n", arg->name, arg->name );
5239 }
5240 else if (has_ret) print_file( file, 1, "%s", "CLIENT_CALL_RETURN _RetVal;\n\n" );
5241
5242 len = fprintf( file, " %s%s( ",
5243 has_ret ? "_RetVal = " : "",
5244 interpreted_mode ? "NdrClientCall2" : "NdrClientCall" );
5245 fprintf( file, "&%s_StubDesc,", prefix );
5246 fprintf( file, "\n%*s&__MIDL_ProcFormatString.Format[%u]", len, "", proc_offset );
5247 if (needs_params)
5248 {
5249 fprintf( file, ",\n%*s&__params", len, "" );
5250 }
5251 else if (target.cpu != CPU_i386)
5252 {
5253 if (is_object( iface )) fprintf( file, ",\n%*sThis", len, "" );
5254 if (args)
5256 fprintf( file, ",\n%*s%s", len, "", arg->name );
5257 }
5258 else
5259 {
5260 if (is_object( iface )) fprintf( file, ",\n%*s&This", len, "" );
5261 else if (args)
5262 {
5263 arg = LIST_ENTRY( list_head(args), const var_t, entry );
5264 fprintf( file, ",\n%*s&%s", len, "", arg->name );
5265 }
5266 }
5267 fprintf( file, " );\n" );
5268 if (has_ret)
5269 {
5270 print_file( file, 1, "return (" );
5271 write_type_decl_left(file, rettype);
5272 fprintf( file, ")%s;\n", target.cpu != CPU_i386 ? "_RetVal.Simple" : "*(LONG_PTR *)&_RetVal" );
5273 }
5274 print_file( file, 0, "}\n\n");
5275}
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:972
type_t * type
Definition: widltypes.h:334
Definition: match.c:390
Definition: list.h:15
Definition: tools.h:99
enum target::@5352 cpu
#define LIST_ENTRY(type)
Definition: queue.h:175
Character const *const prefix
Definition: tempnam.cpp:195
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:5035
static const decl_spec_t * type_function_get_ret(const type_t *type)
Definition: typetree.h:153
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 5184 of file typegen.c.

5185{
5186 const struct str_list_entry_t *endpoint;
5187 const char *p;
5188
5189 /* this should be an array of RPC_PROTSEQ_ENDPOINT but we want const strings */
5190 print_file( f, 0, "static const unsigned char * const %s__RpcProtseqEndpoint[][2] =\n{\n", prefix );
5192 {
5193 print_file( f, 1, "{ (const unsigned char *)\"" );
5194 for (p = endpoint->str; *p && *p != ':'; p++)
5195 {
5196 if (*p == '"' || *p == '\\') fputc( '\\', f );
5197 fputc( *p, f );
5198 }
5199 if (!*p) goto error;
5200 if (p[1] != '[') goto error;
5201
5202 fprintf( f, "\", (const unsigned char *)\"" );
5203 for (p += 2; *p && *p != ']'; p++)
5204 {
5205 if (*p == '"' || *p == '\\') fputc( '\\', f );
5206 fputc( *p, f );
5207 }
5208 if (*p != ']') goto error;
5209 fprintf( f, "\" },\n" );
5210 }
5211 print_file( f, 0, "};\n\n" );
5212 return;
5213
5214error:
5215 error("Invalid endpoint syntax '%s'\n", endpoint->str);
5216}
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:327

Referenced by write_clientinterfacedecl(), and write_serverinterfacedecl().

◆ write_exceptions()

void write_exceptions ( FILE file)

Definition at line 5277 of file typegen.c.

5278{
5279 fprintf( file, "#ifndef USE_COMPILER_EXCEPTIONS\n");
5280 fprintf( file, "\n");
5281 fprintf( file, "#include \"wine/exception.h\"\n");
5282 fprintf( file, "#undef RpcTryExcept\n");
5283 fprintf( file, "#undef RpcExcept\n");
5284 fprintf( file, "#undef RpcEndExcept\n");
5285 fprintf( file, "#undef RpcTryFinally\n");
5286 fprintf( file, "#undef RpcFinally\n");
5287 fprintf( file, "#undef RpcEndFinally\n");
5288 fprintf( file, "#undef RpcExceptionCode\n");
5289 fprintf( file, "#undef RpcAbnormalTermination\n");
5290 fprintf( file, "\n");
5291 fprintf( file, "struct __exception_frame;\n");
5292 fprintf( file, "typedef int (*__filter_func)(struct __exception_frame *);\n");
5293 fprintf( file, "typedef void (*__finally_func)(struct __exception_frame *);\n");
5294 fprintf( file, "\n");
5295 fprintf( file, "#define __DECL_EXCEPTION_FRAME \\\n");
5296 fprintf( file, " EXCEPTION_REGISTRATION_RECORD frame; \\\n");
5297 fprintf( file, " __filter_func filter; \\\n");
5298 fprintf( file, " __finally_func finally; \\\n");
5299 fprintf( file, " __wine_jmp_buf jmp; \\\n");
5300 fprintf( file, " DWORD code; \\\n");
5301 fprintf( file, " unsigned char abnormal_termination; \\\n");
5302 fprintf( file, " unsigned char filter_level; \\\n");
5303 fprintf( file, " unsigned char finally_level;\n");
5304 fprintf( file, "\n");
5305 fprintf( file, "struct __exception_frame\n{\n");
5306 fprintf( file, " __DECL_EXCEPTION_FRAME\n");
5307 fprintf( file, "};\n");
5308 fprintf( file, "\n");
5309 fprintf( file, "static inline void __widl_unwind_target(void)\n" );
5310 fprintf( file, "{\n");
5311 fprintf( file, " struct __exception_frame *exc_frame = (struct __exception_frame *)__wine_get_frame();\n" );
5312 fprintf( file, " if (exc_frame->finally_level > exc_frame->filter_level)\n" );
5313 fprintf( file, " {\n");
5314 fprintf( file, " exc_frame->abnormal_termination = 1;\n");
5315 fprintf( file, " exc_frame->finally( exc_frame );\n");
5316 fprintf( file, " __wine_pop_frame( &exc_frame->frame );\n");
5317 fprintf( file, " }\n");
5318 fprintf( file, " exc_frame->filter_level = 0;\n");
5319 fprintf( file, " __wine_longjmp( &exc_frame->jmp, 1 );\n");
5320 fprintf( file, "}\n");
5321 fprintf( file, "\n");
5322 fprintf( file, "static DWORD __cdecl __widl_exception_handler( EXCEPTION_RECORD *record,\n");
5323 fprintf( file, " EXCEPTION_REGISTRATION_RECORD *frame,\n");
5324 fprintf( file, " CONTEXT *context,\n");
5325 fprintf( file, " EXCEPTION_REGISTRATION_RECORD **pdispatcher )\n");
5326 fprintf( file, "{\n");
5327 fprintf( file, " struct __exception_frame *exc_frame = (struct __exception_frame *)frame;\n");
5328 fprintf( file, "\n");
5329 fprintf( file, " if (record->ExceptionFlags & (EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND | EXCEPTION_NESTED_CALL))\n");
5330 fprintf( file, " {\n" );
5331 fprintf( file, " if (exc_frame->finally_level && (record->ExceptionFlags & (EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND)))\n");
5332 fprintf( file, " {\n" );
5333 fprintf( file, " exc_frame->abnormal_termination = 1;\n");
5334 fprintf( file, " exc_frame->finally( exc_frame );\n");
5335 fprintf( file, " }\n" );
5336 fprintf( file, " return ExceptionContinueSearch;\n");
5337 fprintf( file, " }\n" );
5338 fprintf( file, " exc_frame->code = record->ExceptionCode;\n");
5339 fprintf( file, " if (exc_frame->filter_level && exc_frame->filter( exc_frame ) == EXCEPTION_EXECUTE_HANDLER)\n" );
5340 fprintf( file, " __wine_rtl_unwind( frame, record, __widl_unwind_target );\n");
5341 fprintf( file, " return ExceptionContinueSearch;\n");
5342 fprintf( file, "}\n");
5343 fprintf( file, "\n");
5344 fprintf( file, "#define RpcTryExcept \\\n");
5345 fprintf( file, " if (!__wine_setjmpex( &__frame->jmp, &__frame->frame )) \\\n");
5346 fprintf( file, " { \\\n");
5347 fprintf( file, " if (!__frame->finally_level) \\\n" );
5348 fprintf( file, " __wine_push_frame( &__frame->frame ); \\\n");
5349 fprintf( file, " __frame->filter_level = __frame->finally_level + 1;\n" );
5350 fprintf( file, "\n");
5351 fprintf( file, "#define RpcExcept(expr) \\\n");
5352 fprintf( file, " if (!__frame->finally_level) \\\n" );
5353 fprintf( file, " __wine_pop_frame( &__frame->frame ); \\\n");
5354 fprintf( file, " __frame->filter_level = 0; \\\n" );
5355 fprintf( file, " } \\\n");
5356 fprintf( file, " else \\\n");
5357 fprintf( file, "\n");
5358 fprintf( file, "#define RpcEndExcept\n");
5359 fprintf( file, "\n");
5360 fprintf( file, "#define RpcExceptionCode() (__frame->code)\n");
5361 fprintf( file, "\n");
5362 fprintf( file, "#define RpcTryFinally \\\n");
5363 fprintf( file, " if (!__frame->filter_level) \\\n");
5364 fprintf( file, " __wine_push_frame( &__frame->frame ); \\\n");
5365 fprintf( file, " __frame->finally_level = __frame->filter_level + 1;\n");
5366 fprintf( file, "\n");
5367 fprintf( file, "#define RpcFinally \\\n");
5368 fprintf( file, " if (!__frame->filter_level) \\\n");
5369 fprintf( file, " __wine_pop_frame( &__frame->frame ); \\\n");
5370 fprintf( file, " __frame->finally_level = 0;\n");
5371 fprintf( file, "\n");
5372 fprintf( file, "#define RpcEndFinally\n");
5373 fprintf( file, "\n");
5374 fprintf( file, "#define RpcAbnormalTermination() (__frame->abnormal_termination)\n");
5375 fprintf( file, "\n");
5376 fprintf( file, "#define RpcExceptionInit(filter_func,finally_func) \\\n");
5377 fprintf( file, " do { \\\n");
5378 fprintf( file, " __frame->frame.Handler = __widl_exception_handler; \\\n");
5379 fprintf( file, " __frame->filter = (__filter_func)(filter_func); \\\n" );
5380 fprintf( file, " __frame->finally = (__finally_func)(finally_func); \\\n");
5381 fprintf( file, " __frame->abnormal_termination = 0; \\\n");
5382 fprintf( file, " __frame->filter_level = 0; \\\n");
5383 fprintf( file, " __frame->finally_level = 0; \\\n");
5384 fprintf( file, " } while (0)\n");
5385 fprintf( file, "\n");
5386 fprintf( file, "#else /* USE_COMPILER_EXCEPTIONS */\n");
5387 fprintf( file, "\n");
5388 fprintf( file, "#define RpcExceptionInit(filter_func,finally_func) \\\n");
5389 fprintf( file, " do { (void)(filter_func); } while(0)\n");
5390 fprintf( file, "\n");
5391 fprintf( file, "#define __DECL_EXCEPTION_FRAME \\\n");
5392 fprintf( file, " DWORD code;\n");
5393 fprintf( file, "\n");
5394 fprintf( file, "#endif /* USE_COMPILER_EXCEPTIONS */\n");
5395}

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 5140 of file typegen.c.

5141{
5142 struct expr_eval_routine *eval;
5143 struct expr_eval_routine *cursor;
5144 unsigned short callback_offset = 0;
5145
5146 fprintf(file, "static const EXPR_EVAL ExprEvalRoutines[] =\n");
5147 fprintf(file, "{\n");
5148
5150 {
5151 print_file(file, 1, "%s_%sExprEval_%04u,\n",
5152 eval->iface ? eval->iface->name : iface, eval->name, callback_offset);
5153 callback_offset++;
5154 list_remove(&eval->entry);
5155 free(eval->name);
5156 free(eval);
5157 }
5158
5159 fprintf(file, "};\n\n");
5160}
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:500
struct list entry
Definition: typegen.c:53
const type_t * iface
Definition: typegen.c:54
static struct list expr_eval_routines
Definition: typegen.c:50

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 5100 of file typegen.c.

5101{
5102 static const char *var_name = "pS";
5103 static const char *var_name_expr = "pS->";
5104 int result = 0;
5105 struct expr_eval_routine *eval;
5106 unsigned short callback_offset = 0;
5107
5109 {
5110 const char *name = eval->name;
5111 result = 1;
5112
5113 print_file(file, 0, "static void __RPC_USER %s_%sExprEval_%04u(PMIDL_STUB_MESSAGE pStubMsg)\n",
5114 eval->iface ? eval->iface->name : iface, name, callback_offset);
5115 print_file(file, 0, "{\n");
5116 if (type_get_type( eval->cont_type ) == TYPE_FUNCTION)
5117 {
5119 "*pS = (struct _PARAM_STRUCT *)pStubMsg->StackTop", FALSE );
5120 }
5121 else
5122 {
5123 decl_spec_t ds = {.type = (type_t *)eval->cont_type};
5124 print_file(file, 1, "%s", "");
5126 fprintf(file, " *%s = (", var_name);
5128 fprintf(file, " *)(pStubMsg->StackTop - %u);\n", eval->baseoff);
5129 }
5130 print_file(file, 1, "pStubMsg->Offset = 0;\n"); /* FIXME */
5131 print_file(file, 1, "pStubMsg->MaxCount = (ULONG_PTR)");
5132 write_expr(file, eval->expr, 1, 1, var_name_expr, eval->cont_type, "");
5133 fprintf(file, ";\n");
5134 print_file(file, 0, "}\n\n");
5135 callback_offset++;
5136 }
5137 return result;
5138}
GLuint64EXT * result
Definition: glext.h:11304
#define ds
Definition: i386-dis.c:443
void write_type_left(FILE *h, const decl_spec_t *ds, enum name_type name_type, bool define, int write_callconv)
Definition: header.c:282
unsigned int baseoff
Definition: typegen.c:57
const type_t * cont_type
Definition: typegen.c:55
const expr_t * expr
Definition: typegen.c:58
@ NAME_DEFAULT
Definition: typetree.h:31

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 1034 of file typegen.c.

1035{
1037
1038 print_file(f, indent, "#define TYPE_FORMAT_STRING_SIZE %d\n",
1039 get_size_typeformatstring(stmts, pred));
1040
1041 print_file(f, indent, "#define PROC_FORMAT_STRING_SIZE %d\n",
1042 get_size_procformatstring(stmts, pred));
1043
1044 fprintf(f, "\n");
1045 write_formatdesc(f, indent, "TYPE");
1046 write_formatdesc(f, indent, "PROC");
1047 fprintf(f, "\n");
1048 print_file(f, indent, "static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;\n");
1049 print_file(f, indent, "static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;\n");
1050 print_file(f, indent, "\n");
1051}
unsigned int get_size_typeformatstring(const statement_list_t *stmts, type_pred_t pred)
Definition: typegen.c:4850
static void write_formatdesc(FILE *f, int indent, const char *str)
Definition: typegen.c:1024
unsigned int get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred)
Definition: typegen.c:4843
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 2363 of file typegen.c.

2364{
2365 print_file(file, indent, "NdrFullPointerXlatFree(__frame->_StubMsg.FullPtrXlatTables);\n");
2366 fprintf(file, "\n");
2367}

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 2356 of file typegen.c.

2357{
2358 print_file(file, indent, "__frame->_StubMsg.FullPtrXlatTables = NdrFullPointerXlatInit(0,%s);\n",
2359 is_server ? "XLAT_SERVER" : "XLAT_CLIENT");
2360 fprintf(file, "\n");
2361}

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 5035 of file typegen.c.

5037{
5040 const var_t *arg;
5041 int needs_packing;
5042 unsigned int align = 0;
5043
5044 if (args)
5046 if (!is_array( arg->declspec.type )) type_memsize_and_alignment( arg->declspec.type, &align );
5047
5048 needs_packing = (align > pointer_size);
5049
5050 if (needs_packing) print_file( file, 0, "#include <pshpack%u.h>\n", pointer_size );
5051 print_file(file, 1, "struct _PARAM_STRUCT\n" );
5052 print_file(file, 1, "{\n" );
5053 if (is_object( iface )) print_file(file, 2, "%s *This;\n", iface->name );
5054
5055 if (args) LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
5056 {
5057 print_file(file, 2, "%s", "");
5058 write_type_left( file, &arg->declspec, NAME_DEFAULT, false, TRUE );
5059 if (needs_space_after( arg->declspec.type )) fputc( ' ', file );
5060 if (is_array( arg->declspec.type ) && !type_array_is_decl_as_ptr( arg->declspec.type )) fputc( '*', file );
5061
5062 /* FIXME: should check for large args being passed by pointer */
5063 align = 0;
5064 if (is_array( arg->declspec.type ) || is_ptr( arg->declspec.type )) align = pointer_size;
5065 else type_memsize_and_alignment( arg->declspec.type, &align );
5066
5067 if (align < pointer_size)
5068 fprintf( file, "DECLSPEC_ALIGN(%u) ", pointer_size );
5069 fprintf( file, "%s;\n", arg->name );
5070 }
5071 if (add_retval && !is_void( retval->declspec.type ))
5072 {
5073 print_file(file, 2, "%s", "");
5074 write_type_left( file, &retval->declspec, NAME_DEFAULT, false, TRUE );
5075 if (needs_space_after( retval->declspec.type )) fputc( ' ', file );
5076 if (!is_array( retval->declspec.type ) && !is_ptr( retval->declspec.type ) &&
5077 type_memsize( retval->declspec.type ) != pointer_size)
5078 {
5079 fprintf( file, "DECLSPEC_ALIGN(%u) ", pointer_size );
5080 }
5081 fprintf( file, "%s;\n", retval->name );
5082 }
5083 print_file(file, 1, "} %s;\n", var_decl );
5084 if (needs_packing) print_file( file, 0, "#include <poppack.h>\n" );
5085 print_file( file, 0, "\n" );
5086}
int needs_space_after(type_t *t)
Definition: header.c:252
int retval
Definition: wcstombs.cpp:91

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 4369 of file typegen.c.

4371{
4372 const type_t *type = var->declspec.type;
4373 /* get fundamental type for the argument */
4374 for (;;)
4375 {
4377 {
4378 case TGT_ARRAY:
4380 {
4383 {
4384 print_file(file, indent, "__frame->_StubMsg.MaxCount = (ULONG_PTR)");
4385 write_expr(file, type_array_get_conformance(type), 1, 1, NULL, NULL, local_var_prefix);
4386 fprintf(file, ";\n\n");
4387 }
4389 {
4390 print_file(file, indent, "__frame->_StubMsg.Offset = 0;\n"); /* FIXME */
4391 if (valid_variance)
4392 {
4393 print_file(file, indent, "__frame->_StubMsg.ActualCount = (ULONG_PTR)");
4394 write_expr(file, type_array_get_variance(type), 1, 1, NULL, NULL, local_var_prefix);
4395 fprintf(file, ";\n\n");
4396 }
4397 else
4398 print_file(file, indent, "__frame->_StubMsg.ActualCount = __frame->_StubMsg.MaxCount;\n\n");
4399 }
4400 }
4401 break;
4402 case TGT_UNION:
4403 if (type_get_type(type) == TYPE_UNION &&
4405 {
4406 print_file(file, indent, "__frame->_StubMsg.MaxCount = (ULONG_PTR)");
4407 write_expr(file, get_attrp(var->attrs, ATTR_SWITCHIS), 1, 1, NULL, NULL, local_var_prefix);
4408 fprintf(file, ";\n\n");
4409 }
4410 break;
4411 case TGT_IFACE_POINTER:
4412 {
4413 expr_t *iid;
4414
4415 if (is_conformance_needed_for_phase(phase) && (iid = get_attrp( var->attrs, ATTR_IIDIS )))
4416 {
4417 print_file( file, indent, "__frame->_StubMsg.MaxCount = (ULONG_PTR) " );
4418 write_expr( file, iid, 1, 1, NULL, NULL, local_var_prefix );
4419 fprintf( file, ";\n\n" );
4420 }
4421 break;
4422 }
4423 case TGT_POINTER:
4425 continue;
4426 case TGT_INVALID:
4427 case TGT_USER_TYPE:
4428 case TGT_CTXT_HANDLE:
4430 case TGT_STRING:
4431 case TGT_BASIC:
4432 case TGT_ENUM:
4433 case TGT_STRUCT:
4434 case TGT_RANGE:
4435 break;
4436 }
4437 break;
4438 }
4439}
static int is_conformance_needed_for_phase(enum remoting_phase phase)
Definition: typegen.c:4345
static expr_t * type_array_get_variance(const type_t *type)
Definition: typetree.h:317
@ ATTR_SWITCHIS
Definition: widltypes.h:175

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 1008 of file typegen.c.

1009{
1010 const var_t *var = type_function_get_retval(func->declspec.type);
1011
1012 if (!is_void(var->declspec.type))
1013 write_var_init(file, indent, var->declspec.type, var->name, local_var_prefix);
1014
1015 if (!type_function_get_args(func->declspec.type))
1016 return;
1017
1018 LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry )
1019 write_var_init(file, indent, var->declspec.type, var->name, local_var_prefix);
1020
1021 fprintf(file, "\n");
1022}
static void write_var_init(FILE *file, int indent, const type_t *t, const char *n, const char *local_var_prefix)
Definition: typegen.c:996

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 5088 of file typegen.c.

5089{
5090 const var_list_t *args = type_function_get_args( func->declspec.type );
5091 const var_t *var;
5092
5093 if (!args) return;
5094
5096 if (cant_be_null( var ))
5097 print_file( file, indent, "if (!%s) RpcRaiseException(RPC_X_NULL_REF_POINTER);\n", var->name );
5098}
static int cant_be_null(const var_t *v)
Definition: typegen.c:384

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 1770 of file typegen.c.

1771{
1772 int indent = 0;
1773 unsigned int offset = 0;
1774
1775 print_file(file, indent, "static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =\n");
1776 print_file(file, indent, "{\n");
1777 indent++;
1778 print_file(file, indent, "0,\n");
1779 print_file(file, indent, "{\n");
1780 indent++;
1781
1783
1784 print_file(file, indent, "0x0\n");
1785 indent--;
1786 print_file(file, indent, "}\n");
1787 indent--;
1788 print_file(file, indent, "};\n");
1789 print_file(file, indent, "\n");
1790}
static void write_iface_procformatstring(type_t *iface, FILE *file, int indent, unsigned int *offset)
Definition: typegen.c:1752

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 1792 of file typegen.c.

1793{
1794 const statement_t *stmt;
1795 int indent = 0;
1796
1797 print_file( file, indent, "static const unsigned short %s_FormatStringOffsetTable[] =\n",
1798 iface->name );
1799 print_file( file, indent, "{\n" );
1800 indent++;
1802 {
1803 var_t *func = stmt->u.var;
1804 if (is_local( func->attrs )) continue;
1805 print_file( file, indent, "%u, /* %s */\n", func->procstring_offset, func->name );
1806 }
1807 indent--;
1808 print_file( file, indent, "};\n\n" );
1809}
int is_local(const attr_list_t *a)
Definition: header.c:982
var_t * var
Definition: widltypes.h:631
union _statement_t::@5358 u
static statement_list_t * type_iface_get_stmts(const type_t *type)
Definition: typetree.h:201
#define STATEMENTS_FOR_EACH_FUNC(stmt, stmts)
Definition: widltypes.h:684

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 4800 of file typegen.c.

4802{
4803 if (phase == PHASE_BUFFERSIZE && pass != PASS_RETURN)
4804 {
4805 unsigned int size = get_function_buffer_size( func, pass );
4806 print_file(file, indent, "__frame->_StubMsg.BufferLength = %u;\n", size);
4807 }
4808
4809 if (pass == PASS_RETURN)
4810 {
4811 write_remoting_arg( file, indent, func, local_var_prefix, pass, phase,
4812 type_function_get_retval(func->declspec.type) );
4813 }
4814 else
4815 {
4816 const var_t *var;
4817 if (!type_function_get_args(func->declspec.type))
4818 return;
4819 LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry )
4820 write_remoting_arg( file, indent, func, local_var_prefix, pass, phase, var );
4821 }
4822}
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:4441
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 4003 of file typegen.c.

4004{
4005 int indent = 0;
4006
4007 print_file(file, indent, "static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =\n");
4008 print_file(file, indent, "{\n");
4009 indent++;
4010 print_file(file, indent, "0,\n");
4011 print_file(file, indent, "{\n");
4012 indent++;
4013 print_file(file, indent, "NdrFcShort(0x0),\n");
4014
4016 process_tfs(file, stmts, pred);
4017
4018 print_file(file, indent, "0x0\n");
4019 indent--;
4020 print_file(file, indent, "}\n");
4021 indent--;
4022 print_file(file, indent, "};\n");
4023 print_file(file, indent, "\n");
4024}

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 5162 of file typegen.c.

5163{
5164 user_type_t *ut;
5165
5167 return;
5168
5169 fprintf(file, "static const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[] =\n");
5170 fprintf(file, "{\n");
5172 {
5173 const char *sep = &ut->entry == list_tail(&user_type_list) ? "" : ",";
5174 print_file(file, 1, "{\n");
5175 print_file(file, 2, "(USER_MARSHAL_SIZING_ROUTINE)%s_UserSize,\n", ut->name);
5176 print_file(file, 2, "(USER_MARSHAL_MARSHALLING_ROUTINE)%s_UserMarshal,\n", ut->name);
5177 print_file(file, 2, "(USER_MARSHAL_UNMARSHALLING_ROUTINE)%s_UserUnmarshal,\n", ut->name);
5178 print_file(file, 2, "(USER_MARSHAL_FREEING_ROUTINE)%s_UserFree\n", ut->name);
5179 print_file(file, 1, "}%s\n", sep);
5180 }
5181 fprintf(file, "};\n\n");
5182}
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:39
struct list entry
Definition: widltypes.h:620
const char * name
Definition: widltypes.h:621

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