ReactOS 0.4.15-dev-8102-g108db8f
header.h File Reference
#include "typetree.h"
Include dependency graph for header.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int is_ptrchain_attr (const var_t *var, enum attr_type t)
 
int is_aliaschain_attr (const type_t *var, enum attr_type t)
 
int is_attr (const attr_list_t *list, enum attr_type t)
 
voidget_attrp (const attr_list_t *list, enum attr_type t)
 
unsigned int get_attrv (const attr_list_t *list, enum attr_type t)
 
const charget_name (const var_t *v)
 
void write_type_left (FILE *h, type_t *t, enum name_type name_type, int declonly)
 
void write_type_right (FILE *h, type_t *t, int is_field)
 
void write_type_decl (FILE *f, type_t *t, const char *name)
 
void write_type_decl_left (FILE *f, type_t *t)
 
unsigned int get_context_handle_offset (const type_t *type)
 
unsigned int get_generic_handle_offset (const type_t *type)
 
int needs_space_after (type_t *t)
 
int is_object (const type_t *iface)
 
int is_local (const attr_list_t *list)
 
int count_methods (const type_t *iface)
 
int need_stub (const type_t *iface)
 
int need_proxy (const type_t *iface)
 
int need_inline_stubs (const type_t *iface)
 
int need_stub_files (const statement_list_t *stmts)
 
int need_proxy_file (const statement_list_t *stmts)
 
int need_proxy_delegation (const statement_list_t *stmts)
 
int need_inline_stubs_file (const statement_list_t *stmts)
 
const var_tis_callas (const attr_list_t *list)
 
void write_args (FILE *h, const var_list_t *arg, const char *name, int obj, int do_indent)
 
const type_tget_explicit_generic_handle_type (const var_t *var)
 
const var_tget_func_handle_var (const type_t *iface, const var_t *func, unsigned char *explicit_fc, unsigned char *implicit_fc)
 
int has_out_arg_or_return (const var_t *func)
 
int is_const_decl (const var_t *var)
 
void write_serialize_functions (FILE *file, const type_t *type, const type_t *iface)
 
static int is_ptr (const type_t *t)
 
static int is_array (const type_t *t)
 
static int is_void (const type_t *t)
 
static int is_declptr (const type_t *t)
 
static int is_conformant_array (const type_t *t)
 
static int last_ptr (const type_t *type)
 
static int last_array (const type_t *type)
 
static int is_string_type (const attr_list_t *attrs, const type_t *type)
 
static int is_context_handle (const type_t *type)
 

Function Documentation

◆ count_methods()

int count_methods ( const type_t iface)

Definition at line 465 of file proxy.c.

466{
467 const statement_t *stmt;
468 int count = 0;
469
470 if (type_iface_get_inherit(iface))
472
474 const var_t *func = stmt->u.var;
475 if (!is_callas(func->attrs)) count++;
476 }
477 return count;
478}
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum func
Definition: glext.h:6028
const var_t * is_callas(const attr_list_t *a)
Definition: header.c:943
int count_methods(const type_t *iface)
Definition: proxy.c:465
union _statement_t::@5034 u
var_t * var
Definition: widltypes.h:539
static type_t * type_iface_get_inherit(const type_t *type)
Definition: typetree.h:158
static statement_list_t * type_iface_get_stmts(const type_t *type)
Definition: typetree.h:151
#define STATEMENTS_FOR_EACH_FUNC(stmt, stmts)
Definition: widltypes.h:597

Referenced by count_methods(), write_iface_procformatstring(), write_interface(), and write_proxy().

◆ get_attrp()

void * get_attrp ( const attr_list_t list,
enum attr_type  t 
)

◆ get_attrv()

◆ get_context_handle_offset()

unsigned int get_context_handle_offset ( const type_t type)

Definition at line 598 of file header.c.

599{
601 unsigned int index = 0;
602
603 while (!is_attr( type->attrs, ATTR_CONTEXTHANDLE ))
604 {
606 else if (is_ptr( type )) type = type_pointer_get_ref( type );
607 else error( "internal error: %s is not a context handle\n", type->name );
608 }
610 {
611 if (!strcmp( type->name, ch->name )) return index;
612 index++;
613 }
614 error( "internal error: %s is not registered as a context handle\n", type->name );
615 return index;
616}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define index(s, c)
Definition: various.h:29
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint index
Definition: glext.h:6031
static int is_ptr(const type_t *t)
Definition: header.h:59
#define error(str)
Definition: mkdosfs.c:1605
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99
const char * name
Definition: widltypes.h:523
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
static type_t * type_pointer_get_ref(const type_t *type)
Definition: typetree.h:292
@ ATTR_CONTEXTHANDLE
Definition: widltypes.h:85

Referenced by write_contexthandle_tfs(), and write_proc_func_header().

◆ get_explicit_generic_handle_type()

const type_t * get_explicit_generic_handle_type ( const var_t var)

Definition at line 855 of file header.c.

856{
857 const type_t *t;
858 for (t = var->type;
859 is_ptr(t) || type_is_alias(t);
862 is_attr(t->attrs, ATTR_HANDLE))
863 return t;
864 return NULL;
865}
return
Definition: dirsup.c:529
if(dx< 0)
Definition: linetemp.h:194
const char * var
Definition: shader.c:5666
static enum type_basic_type type_basic_get_type(const type_t *type)
Definition: typetree.h:73
@ TYPE_BASIC
Definition: widltypes.h:403
@ ATTR_HANDLE
Definition: widltypes.h:105
static enum type_type type_get_type_detect_alias(const type_t *type)
Definition: widltypes.h:590
@ TYPE_BASIC_HANDLE
Definition: widltypes.h:277

Referenced by get_func_handle_var(), and write_function_stub().

◆ get_func_handle_var()

const var_t * get_func_handle_var ( const type_t iface,
const var_t func,
unsigned char explicit_fc,
unsigned char implicit_fc 
)

Definition at line 867 of file header.c.

869{
870 const var_t *var;
871 const var_list_t *args = type_get_function_args( func->type );
872
873 *explicit_fc = *implicit_fc = 0;
874 if (args) LIST_FOR_EACH_ENTRY( var, args, const var_t, entry )
875 {
876 if (!is_attr( var->attrs, ATTR_IN ) && is_attr( var->attrs, ATTR_OUT )) continue;
878 {
879 *explicit_fc = FC_BIND_PRIMITIVE;
880 return var;
881 }
883 {
884 *explicit_fc = FC_BIND_GENERIC;
885 return var;
886 }
887 if (is_context_handle( var->type ))
888 {
889 *explicit_fc = FC_BIND_CONTEXT;
890 return var;
891 }
892 }
893
894 if ((var = get_attrp( iface->attrs, ATTR_IMPLICIT_HANDLE )))
895 {
896 if (type_get_type( var->type ) == TYPE_BASIC &&
898 *implicit_fc = FC_BIND_PRIMITIVE;
899 else
900 *implicit_fc = FC_BIND_GENERIC;
901 return var;
902 }
903
904 *implicit_fc = FC_AUTO_HANDLE;
905 return NULL;
906}
static int is_context_handle(const type_t *type)
Definition: header.h:100
@ FC_BIND_PRIMITIVE
Definition: ndrtypes.h:194
@ FC_BIND_GENERIC
Definition: ndrtypes.h:193
@ FC_AUTO_HANDLE
Definition: ndrtypes.h:195
@ FC_BIND_CONTEXT
Definition: ndrtypes.h:191
void * get_attrp(const attr_list_t *list, enum attr_type t)
Definition: header.c:107
const type_t * get_explicit_generic_handle_type(const var_t *var)
Definition: header.c:855
attr_list_t * attrs
Definition: widltypes.h:422
Definition: match.c:390
static enum type_type type_get_type(const type_t *type)
Definition: typetree.h:68
@ ATTR_IN
Definition: widltypes.h:118
@ ATTR_IMPLICIT_HANDLE
Definition: widltypes.h:117
@ 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 write_function_stub(), write_proc_func_header(), and write_procformatstring_func().

◆ get_generic_handle_offset()

unsigned int get_generic_handle_offset ( const type_t type)

Definition at line 618 of file header.c.

619{
621 unsigned int index = 0;
622
623 while (!is_attr( type->attrs, ATTR_HANDLE ))
624 {
626 else if (is_ptr( type )) type = type_pointer_get_ref( type );
627 else error( "internal error: %s is not a generic handle\n", type->name );
628 }
630 {
631 if (!strcmp( type->name, gh->name )) return index;
632 index++;
633 }
634 error( "internal error: %s is not registered as a generic handle\n", type->name );
635 return index;
636}
generic_handle_list_t generic_handle_list
Definition: header.c:44

Referenced by write_proc_func_header().

◆ get_name()

const char * get_name ( const var_t v)

Definition at line 181 of file header.c.

182{
183 static char buffer[256];
184
185 if (is_attr( v->attrs, ATTR_PROPGET ))
186 strcpy( buffer, "get_" );
187 else if (is_attr( v->attrs, ATTR_PROPPUT ))
188 strcpy( buffer, "put_" );
189 else if (is_attr( v->attrs, ATTR_PROPPUTREF ))
190 strcpy( buffer, "putref_" );
191 else
192 buffer[0] = 0;
193 strcat( buffer, v->name );
194 return buffer;
195}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
const GLdouble * v
Definition: gl.h:2040
GLuint buffer
Definition: glext.h:5915
@ ATTR_PROPPUT
Definition: widltypes.h:145
@ ATTR_PROPPUTREF
Definition: widltypes.h:146
@ ATTR_PROPGET
Definition: widltypes.h:144

Referenced by do_write_c_method_def(), get_vtbl_entry_name(), is_inherited_method(), is_override_method(), write_cpp_method_def(), write_enums(), write_function_proto(), write_inline_wrappers(), write_locals(), write_method_macro(), and write_method_proto().

◆ has_out_arg_or_return()

int has_out_arg_or_return ( const var_t func)

Definition at line 908 of file header.c.

909{
910 const var_t *var;
911
913 return 1;
914
915 if (!type_get_function_args(func->type))
916 return 0;
917
919 if (is_attr(var->attrs, ATTR_OUT))
920 return 1;
921
922 return 0;
923}
static int is_void(const type_t *t)
Definition: header.h:69
static type_t * type_function_get_rettype(const type_t *type)
Definition: typetree.h:108

Referenced by write_function_stub().

◆ is_aliaschain_attr()

int is_aliaschain_attr ( const type_t var,
enum attr_type  t 
)

Definition at line 86 of file header.c.

87{
88 const type_t *t = type;
89 for (;;)
90 {
91 if (is_attr(t->attrs, attr))
92 return 1;
93 else if (type_is_alias(t))
95 else return 0;
96 }
97}

Referenced by get_enum_fc(), is_string_type(), typegen_detect_type(), write_function_stub(), and write_remoting_arg().

◆ is_array()

◆ is_attr()

◆ is_callas()

◆ is_conformant_array()

◆ is_const_decl()

int is_const_decl ( const var_t var)

Definition at line 801 of file header.c.

802{
803 const type_t *t;
804 /* strangely, MIDL accepts a const attribute on any pointer in the
805 * declaration to mean that data isn't being instantiated. this appears
806 * to be a bug, but there is no benefit to being incompatible with MIDL,
807 * so we'll do the same thing */
808 for (t = var->type; ; )
809 {
810 if (is_attr(t->attrs, ATTR_CONST))
811 return TRUE;
812 else if (is_ptr(t))
814 else break;
815 }
816 return FALSE;
817}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
@ ATTR_CONST
Definition: widltypes.h:84

Referenced by write_declaration().

◆ is_context_handle()

static int is_context_handle ( const type_t type)
inlinestatic

Definition at line 100 of file header.h.

101{
102 const type_t *t;
103 for (t = type;
104 is_ptr(t) || type_is_alias(t);
106 if (is_attr(t->attrs, ATTR_CONTEXTHANDLE))
107 return 1;
108 return 0;
109}
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99

Referenced by declare_stub_args(), get_func_handle_var(), and write_function_stub().

◆ is_declptr()

static int is_declptr ( const type_t t)
inlinestatic

Definition at line 74 of file header.h.

75{
77}
static int type_array_is_decl_as_ptr(const type_t *type)
Definition: typetree.h:260

Referenced by get_parameter_fc(), last_ptr(), write_nonsimple_pointer(), write_remoting_arg(), and write_string_tfs().

◆ is_local()

◆ is_object()

int is_object ( const type_t iface)

Definition at line 928 of file header.c.

929{
930 const attr_t *attr;
931 if (type_is_defined(iface) && type_iface_get_inherit(iface))
932 return 1;
933 if (iface->attrs) LIST_FOR_EACH_ENTRY( attr, iface->attrs, const attr_t, entry )
934 if (attr->type == ATTR_OBJECT || attr->type == ATTR_ODL) return 1;
935 return 0;
936}
static int type_is_defined(const type_t *type)
Definition: typetree.h:186
@ ATTR_OBJECT
Definition: widltypes.h:133
@ ATTR_ODL
Definition: widltypes.h:134

Referenced by get_pointer_fc_context(), need_proxy(), need_stub(), write_client_call_routine(), write_conf_or_var_desc(), write_forward_decls(), write_func_param_struct(), write_header_stmts(), write_id_data_stmts(), write_interface(), write_locals(), write_proc_func_header(), write_procformatstring_func(), and write_typelib_interface().

◆ is_ptr()

◆ is_ptrchain_attr()

int is_ptrchain_attr ( const var_t var,
enum attr_type  t 
)

Definition at line 66 of file header.c.

67{
68 if (is_attr(var->attrs, t))
69 return 1;
70 else
71 {
72 type_t *type = var->type;
73 for (;;)
74 {
75 if (is_attr(type->attrs, t))
76 return 1;
77 else if (type_is_alias(type))
79 else if (is_ptr(type))
81 else return 0;
82 }
83 }
84}

Referenced by get_required_buffer_size().

◆ is_string_type()

static int is_string_type ( const attr_list_t attrs,
const type_t type 
)
inlinestatic

Definition at line 94 of file header.h.

95{
97 && (last_ptr(type) || last_array(type)));
98}
static int last_ptr(const type_t *type)
Definition: header.h:84
int is_aliaschain_attr(const type_t *var, enum attr_type t)
Definition: header.c:86
static int last_array(const type_t *type)
Definition: header.h:89
@ ATTR_STRING
Definition: widltypes.h:158

Referenced by builtin_vt(), get_parameter_fc(), get_required_buffer_size(), get_required_buffer_size_type(), get_struct_fc(), typegen_detect_type(), write_array_element_type(), write_array_tfs(), write_pointer_description_offsets(), write_simple_pointer(), write_struct_tfs(), and write_type_tfs().

◆ is_void()

◆ last_array()

static int last_array ( const type_t type)
inlinestatic

Definition at line 89 of file header.h.

90{
92}
static type_t * type_array_get_element(const type_t *type)
Definition: typetree.h:253

Referenced by is_string_type().

◆ last_ptr()

static int last_ptr ( const type_t type)
inlinestatic

Definition at line 84 of file header.h.

85{
87}
static int is_declptr(const type_t *t)
Definition: header.h:74

Referenced by is_string_type().

◆ need_inline_stubs()

int need_inline_stubs ( const type_t iface)

Definition at line 819 of file proxy.c.

820{
821 const statement_t *stmt;
822
823 if (get_stub_mode() == MODE_Os) return 1;
824
826 {
827 const var_t *func = stmt->u.var;
828 if (is_local( func->attrs )) continue;
829 if (!is_interpreted_func( iface, func )) return 1;
830 }
831 return 0;
832}
int is_local(const attr_list_t *a)
Definition: header.c:938
int is_interpreted_func(const type_t *iface, const var_t *func)
Definition: typegen.c:1240
enum stub_mode get_stub_mode(void)
Definition: widl.c:211
@ MODE_Os
Definition: widl.h:87

Referenced by need_inline_stubs_file(), and write_proxy().

◆ need_inline_stubs_file()

int need_inline_stubs_file ( const statement_list_t stmts)

Definition at line 855 of file proxy.c.

856{
857 return does_any_iface(stmts, need_inline_stubs);
858}
static int does_any_iface(const statement_list_t *stmts, type_pred_t pred)
Definition: proxy.c:779
int need_inline_stubs(const type_t *iface)
Definition: proxy.c:819

Referenced by write_client_routines(), and write_server_routines().

◆ need_proxy()

int need_proxy ( const type_t iface)

Definition at line 796 of file proxy.c.

797{
798 if (!is_object( iface )) return 0;
799 if (is_local( iface->attrs )) return 0;
800 if (is_attr( iface->attrs, ATTR_DISPINTERFACE )) return 0;
801 return 1;
802}
int is_object(const type_t *iface)
Definition: header.c:928
@ ATTR_DISPINTERFACE
Definition: widltypes.h:94

Referenced by build_iface_list(), need_proxy_and_inline_stubs(), need_proxy_file(), write_proxy_routines(), and write_proxy_stmts().

◆ need_proxy_delegation()

int need_proxy_delegation ( const statement_list_t stmts)

Definition at line 814 of file proxy.c.

815{
816 return does_any_iface(stmts, need_delegation);
817}
static int need_delegation(const type_t *iface)
Definition: proxy.c:129

Referenced by write_dlldata().

◆ need_proxy_file()

int need_proxy_file ( const statement_list_t stmts)

Definition at line 809 of file proxy.c.

810{
811 return does_any_iface(stmts, need_proxy);
812}
int need_proxy(const type_t *iface)
Definition: proxy.c:796

Referenced by write_dlldata(), write_proxies(), and write_regscript().

◆ need_stub()

int need_stub ( const type_t iface)

Definition at line 804 of file proxy.c.

805{
806 return !is_object(iface) && !is_local(iface->attrs);
807}

Referenced by need_stub_files(), write_client_ifaces(), write_client_routines(), write_server_routines(), and write_server_stmts().

◆ need_stub_files()

int need_stub_files ( const statement_list_t stmts)

Definition at line 850 of file proxy.c.

851{
852 return does_any_iface(stmts, need_stub);
853}
int need_stub(const type_t *iface)
Definition: proxy.c:804

Referenced by write_client(), and write_server().

◆ needs_space_after()

int needs_space_after ( type_t t)

Definition at line 282 of file header.c.

283{
284 return (type_is_alias(t) ||
285 (!is_ptr(t) && (!is_array(t) || !type_array_is_decl_as_ptr(t) || t->name)));
286}

Referenced by write_func_param_struct(), write_pointer_left(), and write_type_v().

◆ write_args()

void write_args ( FILE h,
const var_list_t arg,
const char name,
int  obj,
int  do_indent 
)

Definition at line 1058 of file header.c.

1059{
1060 const var_t *arg;
1061 int count = 0;
1062
1063 if (do_indent)
1064 {
1065 indentation++;
1066 indent(h, 0);
1067 }
1068 if (method == 1) {
1069 fprintf(h, "%s* This", name);
1070 count++;
1071 }
1072 if (args) LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry ) {
1073 if (count) {
1074 if (do_indent)
1075 {
1076 fprintf(h, ",\n");
1077 indent(h, 0);
1078 }
1079 else fprintf(h, ",");
1080 }
1081 write_type_decl(h, arg->type, arg->name);
1082 if (method == 2) {
1083 const expr_t *expr = get_attrp(arg->attrs, ATTR_DEFAULTVALUE);
1084 if (expr) {
1085 const var_t *tail_arg;
1086
1087 /* Output default value only if all following arguments also have default value. */
1088 LIST_FOR_EACH_ENTRY_REV( tail_arg, args, const var_t, entry ) {
1089 if(tail_arg == arg) {
1090 expr_t bstr;
1091
1092 /* Fixup the expression type for a BSTR like midl does. */
1093 if (get_type_vt(arg->type) == VT_BSTR && expr->type == EXPR_STRLIT)
1094 {
1095 bstr = *expr;
1096 bstr.type = EXPR_WSTRLIT;
1097 expr = &bstr;
1098 }
1099
1100 fprintf(h, " = ");
1101 write_expr( h, expr, 0, 1, NULL, NULL, "" );
1102 break;
1103 }
1104 if(!get_attrp(tail_arg->attrs, ATTR_DEFAULTVALUE))
1105 break;
1106 }
1107 }
1108 }
1109 count++;
1110 }
1111 if (do_indent) indentation--;
1112}
static const WCHAR indent[]
Definition: object.c:1156
@ VT_BSTR
Definition: compat.h:2303
method
Definition: dragdrop.c:54
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
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define LIST_FOR_EACH_ENTRY_REV(elem, list, type, field)
Definition: list.h:222
static int indentation
Definition: header.c:40
void write_type_decl(FILE *f, type_t *t, const char *name)
Definition: header.c:561
unsigned short get_type_vt(type_t *t)
Definition: typelib.c:129
enum expr_type type
Definition: widltypes.h:308
attr_list_t * attrs
Definition: widltypes.h:454
Definition: query.h:87
int type
Definition: query.h:88
Definition: name.c:39
@ EXPR_WSTRLIT
Definition: widltypes.h:212
@ EXPR_STRLIT
Definition: widltypes.h:211
@ ATTR_DEFAULTVALUE
Definition: widltypes.h:91
void * arg
Definition: msvc.h:10

Referenced by do_write_c_method_def(), gen_proxy(), nfs41_write(), write_client_func_decl(), write_cpp_method_def(), write_function_proto(), write_inline_wrappers(), write_locals(), write_method_proto(), and write_type_v().

◆ write_serialize_functions()

void write_serialize_functions ( FILE file,
const type_t type,
const type_t iface 
)

Definition at line 338 of file client.c.

339{
340 if (is_attr(type->attrs, ATTR_ENCODE))
341 {
342 write_serialize_function(file, type, iface, "AlignSize", "SIZE_T");
343 write_serialize_function(file, type, iface, "Encode", NULL);
344 }
345 if (is_attr(type->attrs, ATTR_DECODE))
346 {
347 write_serialize_function(file, type, iface, "Decode", NULL);
348 write_serialize_function(file, type, iface, "Free", NULL);
349 }
350}
static void write_serialize_function(FILE *file, const type_t *type, const type_t *iface, const char *func_name, const char *ret_type)
Definition: client.c:290
Definition: fci.c:127
@ ATTR_DECODE
Definition: widltypes.h:87
@ ATTR_ENCODE
Definition: widltypes.h:99

Referenced by write_function_stubs(), and write_serialize_function_decl().

◆ write_type_decl()

void write_type_decl ( FILE f,
type_t t,
const char name 
)

Definition at line 561 of file header.c.

562{
564}
GLfloat f
Definition: glext.h:7540
static void write_type_v(FILE *h, type_t *t, int is_field, int declonly, const char *name)
Definition: header.c:488

Referenced by declare_stub_args(), gen_proxy(), print_phase_basetype(), print_start_tfs_comment(), write_args(), write_expr(), write_func_param_struct(), write_function_stub(), write_implicithandledecl(), write_locals(), write_remoting_arg(), and write_rpc_interface_start().

◆ write_type_decl_left()

void write_type_decl_left ( FILE f,
type_t t 
)

Definition at line 566 of file header.c.

567{
569}
void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly)
Definition: header.c:297
@ NAME_DEFAULT
Definition: typetree.h:28

Referenced by declare_stub_args(), do_write_c_method_def(), gen_proxy(), write_client_call_routine(), write_client_func_decl(), write_cpp_method_def(), write_function_proto(), write_function_stub(), write_inline_wrappers(), write_locals(), and write_method_proto().

◆ write_type_left()

void write_type_left ( FILE h,
type_t t,
enum name_type  name_type,
int  declonly 
)

Definition at line 297 of file header.c.

298{
299 const char *name;
300
301 if (!h) return;
302
304
305 if (is_attr(t->attrs, ATTR_CONST) &&
306 (type_is_alias(t) || !is_ptr(t)))
307 fprintf(h, "const ");
308
309 if (type_is_alias(t)) fprintf(h, "%s", t->name);
310 else {
311 switch (type_get_type_detect_alias(t)) {
312 case TYPE_ENUM:
313 if (!declonly && t->defined && !t->written) {
314 if (name) fprintf(h, "enum %s {\n", name);
315 else fprintf(h, "enum {\n");
316 t->written = TRUE;
317 indentation++;
319 indent(h, -1);
320 fprintf(h, "}");
321 }
322 else fprintf(h, "enum %s", name ? name : "");
323 break;
324 case TYPE_STRUCT:
326 if (!declonly && t->defined && !t->written) {
327 if (name) fprintf(h, "struct %s {\n", name);
328 else fprintf(h, "struct {\n");
329 t->written = TRUE;
330 indentation++;
333 else
335 indent(h, -1);
336 fprintf(h, "}");
337 }
338 else fprintf(h, "struct %s", name ? name : "");
339 break;
340 case TYPE_UNION:
341 if (!declonly && t->defined && !t->written) {
342 if (t->name) fprintf(h, "union %s {\n", t->name);
343 else fprintf(h, "union {\n");
344 t->written = TRUE;
345 indentation++;
347 indent(h, -1);
348 fprintf(h, "}");
349 }
350 else fprintf(h, "union %s", t->name ? t->name : "");
351 break;
352 case TYPE_POINTER:
353 {
356 if (is_attr(t->attrs, ATTR_CONST)) fprintf(h, "const ");
357 break;
358 }
359 case TYPE_ARRAY:
360 if (t->name && type_array_is_decl_as_ptr(t))
361 fprintf(h, "%s", t->name);
362 else
363 {
367 }
368 break;
369 case TYPE_BASIC:
374 {
375 if (type_basic_get_sign(t) < 0) fprintf(h, "signed ");
376 else if (type_basic_get_sign(t) > 0) fprintf(h, "unsigned ");
377 }
378 switch (type_basic_get_type(t))
379 {
380 case TYPE_BASIC_INT8: fprintf(h, "small"); break;
381 case TYPE_BASIC_INT16: fprintf(h, "short"); break;
382 case TYPE_BASIC_INT: fprintf(h, "int"); break;
383 case TYPE_BASIC_INT3264: fprintf(h, "__int3264"); break;
384 case TYPE_BASIC_BYTE: fprintf(h, "byte"); break;
385 case TYPE_BASIC_CHAR: fprintf(h, "char"); break;
386 case TYPE_BASIC_WCHAR: fprintf(h, "wchar_t"); break;
387 case TYPE_BASIC_FLOAT: fprintf(h, "float"); break;
388 case TYPE_BASIC_DOUBLE: fprintf(h, "double"); break;
389 case TYPE_BASIC_ERROR_STATUS_T: fprintf(h, "error_status_t"); break;
390 case TYPE_BASIC_HANDLE: fprintf(h, "handle_t"); break;
391 case TYPE_BASIC_INT32:
392 if (type_basic_get_sign(t) > 0)
393 fprintf(h, "UINT32");
394 else
395 fprintf(h, "INT32");
396 break;
397 case TYPE_BASIC_LONG:
398 if (type_basic_get_sign(t) > 0)
399 fprintf(h, "ULONG");
400 else
401 fprintf(h, "LONG");
402 break;
403 case TYPE_BASIC_INT64:
404 if (type_basic_get_sign(t) > 0)
405 fprintf(h, "UINT64");
406 else
407 fprintf(h, "INT64");
408 break;
409 case TYPE_BASIC_HYPER:
410 if (type_basic_get_sign(t) > 0)
411 fprintf(h, "MIDL_uhyper");
412 else
413 fprintf(h, "hyper");
414 break;
415 }
416 break;
417 case TYPE_INTERFACE:
418 case TYPE_MODULE:
419 case TYPE_COCLASS:
420 fprintf(h, "%s", t->name);
421 break;
422 case TYPE_VOID:
423 fprintf(h, "void");
424 break;
425 case TYPE_BITFIELD:
427 break;
428 case TYPE_ALIAS:
429 case TYPE_FUNCTION:
430 /* handled elsewhere */
431 assert(0);
432 break;
433 }
434 }
435}
#define assert(x)
Definition: debug.h:53
static void write_pointer_left(FILE *h, type_t *ref)
Definition: header.c:288
static void write_fields(FILE *h, var_list_t *fields)
Definition: header.c:197
static void write_enums(FILE *h, var_list_t *enums, const char *enum_name)
Definition: header.c:260
char * name
Definition: compiler.c:66
const char * type_get_name(const type_t *type, enum name_type name_type)
Definition: typetree.c:81
static int type_basic_get_sign(const type_t *type)
Definition: typetree.h:80
static var_list_t * type_union_get_cases(const type_t *type)
Definition: typetree.h:134
static type_t * type_bitfield_get_field(const type_t *type)
Definition: typetree.h:306
name_type
Definition: typetree.h:27
static var_list_t * type_struct_get_fields(const type_t *type)
Definition: typetree.h:87
static var_list_t * type_encapsulated_union_get_fields(const type_t *type)
Definition: typetree.h:127
static var_list_t * type_enum_get_values(const type_t *type)
Definition: typetree.h:113
@ TYPE_ENUM
Definition: widltypes.h:404
@ TYPE_BITFIELD
Definition: widltypes.h:415
@ TYPE_UNION
Definition: widltypes.h:407
@ TYPE_ALIAS
Definition: widltypes.h:408
@ TYPE_ENCAPSULATED_UNION
Definition: widltypes.h:406
@ 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
static int is_global_namespace(const struct namespace *namespace)
Definition: widltypes.h:614
@ 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_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 write_expr_eval_routines(), write_func_param_struct(), write_type_decl_left(), write_type_definition(), write_type_left(), and write_type_v().

◆ write_type_right()

void write_type_right ( FILE h,
type_t t,
int  is_field 
)

Definition at line 437 of file header.c.

438{
439 if (!h) return;
440 if (type_is_alias(t)) return;
441
442 switch (type_get_type(t))
443 {
444 case TYPE_ARRAY:
445 {
448 {
450 fprintf(h, ")");
451 }
452 else
453 {
455 fprintf(h, "[%s]", is_field ? "1" : "");
456 else
457 fprintf(h, "[%u]", type_array_get_dim(t));
458 }
460 break;
461 }
462 case TYPE_POINTER:
463 {
466 fprintf(h, ")");
468 break;
469 }
470 case TYPE_BITFIELD:
472 break;
473 case TYPE_VOID:
474 case TYPE_BASIC:
475 case TYPE_ENUM:
476 case TYPE_STRUCT:
478 case TYPE_UNION:
479 case TYPE_ALIAS:
480 case TYPE_MODULE:
481 case TYPE_COCLASS:
482 case TYPE_FUNCTION:
483 case TYPE_INTERFACE:
484 break;
485 }
486}
static int is_conformant_array(const type_t *t)
Definition: header.h:79
static size_t elem
Definition: string.c:68
void write_type_right(FILE *h, type_t *t, int is_field)
Definition: header.c:437
Definition: send.c:48
static const expr_t * type_bitfield_get_bits(const type_t *type)
Definition: typetree.h:313
static unsigned int type_array_get_dim(const type_t *type)
Definition: typetree.h:232

Referenced by declare_stub_args(), write_type_right(), and write_type_v().