ReactOS 0.4.16-dev-1948-gd260c1d
typetree.h File Reference
#include "widltypes.h"
#include <assert.h>
#include <stdio.h>
#include "utils.h"
Include dependency graph for typetree.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  name_type { NAME_DEFAULT , NAME_C }
 

Functions

type_tfind_parameterized_type (type_t *type, typeref_list_t *params)
 
type_ttype_new_function (var_list_t *args)
 
type_ttype_new_pointer (type_t *ref)
 
type_ttype_new_alias (const decl_spec_t *t, const char *name)
 
type_ttype_module_declare (char *name)
 
type_ttype_new_array (const char *name, const decl_spec_t *element, int declptr, unsigned int dim, expr_t *size_is, expr_t *length_is)
 
type_ttype_new_basic (enum type_basic_type basic_type)
 
type_ttype_new_int (enum type_basic_type basic_type, int sign)
 
type_ttype_new_void (void)
 
type_ttype_coclass_declare (char *name)
 
type_ttype_new_enum (const char *name, struct namespace *namespace, int defined, var_list_t *enums, const struct location *where)
 
type_ttype_new_struct (char *name, struct namespace *namespace, int defined, var_list_t *fields, const struct location *where)
 
type_ttype_new_nonencapsulated_union (const char *name, struct namespace *namespace, int defined, var_list_t *fields, const struct location *where)
 
type_ttype_new_encapsulated_union (char *name, var_t *switch_field, var_t *union_field, var_list_t *cases, const struct location *where)
 
type_ttype_new_bitfield (type_t *field_type, const expr_t *bits)
 
type_ttype_runtimeclass_declare (char *name, struct namespace *namespace)
 
type_ttype_interface_declare (char *name, struct namespace *namespace)
 
type_ttype_interface_define (type_t *iface, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts, typeref_list_t *requires, const struct location *where)
 
type_ttype_dispinterface_declare (char *name)
 
type_ttype_dispinterface_define (type_t *iface, attr_list_t *attrs, var_list_t *props, var_list_t *methods, const struct location *where)
 
type_ttype_dispinterface_define_from_iface (type_t *dispiface, attr_list_t *attrs, type_t *iface, const struct location *where)
 
type_ttype_module_define (type_t *module, attr_list_t *attrs, statement_list_t *stmts, const struct location *where)
 
type_ttype_coclass_define (type_t *coclass, attr_list_t *attrs, typeref_list_t *ifaces, const struct location *where)
 
type_ttype_runtimeclass_define (type_t *runtimeclass, attr_list_t *attrs, typeref_list_t *ifaces, const struct location *where)
 
type_ttype_apicontract_declare (char *name, struct namespace *namespace)
 
type_ttype_apicontract_define (type_t *apicontract, attr_list_t *attrs, const struct location *where)
 
type_ttype_delegate_declare (char *name, struct namespace *namespace)
 
type_ttype_delegate_define (type_t *delegate, attr_list_t *attrs, statement_list_t *stmts, const struct location *where)
 
type_ttype_parameterized_interface_declare (char *name, struct namespace *namespace, typeref_list_t *params)
 
type_ttype_parameterized_interface_define (type_t *type, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts, typeref_list_t *requires, const struct location *where)
 
type_ttype_parameterized_delegate_declare (char *name, struct namespace *namespace, typeref_list_t *params)
 
type_ttype_parameterized_delegate_define (type_t *type, attr_list_t *attrs, statement_list_t *stmts, const struct location *where)
 
type_ttype_parameterized_type_specialize_partial (type_t *type, typeref_list_t *params)
 
type_ttype_parameterized_type_specialize_declare (type_t *type, typeref_list_t *params)
 
type_ttype_parameterized_type_specialize_define (type_t *type)
 
int type_is_equal (const type_t *type1, const type_t *type2)
 
const chartype_get_decl_name (const type_t *type, enum name_type name_type)
 
const chartype_get_name (const type_t *type, enum name_type name_type)
 
chargen_name (void)
 
typeref_tmake_typeref (type_t *type)
 
typeref_list_tappend_typeref (typeref_list_t *list, typeref_t *ref)
 
type_tduptype (type_t *t, int dupname)
 
static type_ttype_get_real_type (const type_t *type)
 
static type_ttype_parameterized_type_get_real_type (const type_t *type)
 
static enum type_type type_get_type (const type_t *type)
 
static enum type_basic_type type_basic_get_type (const type_t *type)
 
static int type_basic_get_sign (const type_t *type)
 
static var_list_ttype_struct_get_fields (const type_t *type)
 
static var_list_ttype_function_get_args (const type_t *type)
 
static var_ttype_function_get_retval (const type_t *type)
 
static const decl_spec_ttype_function_get_ret (const type_t *type)
 
static type_ttype_function_get_rettype (const type_t *type)
 
static var_list_ttype_enum_get_values (const type_t *type)
 
static var_ttype_union_get_switch_value (const type_t *type)
 
static var_list_ttype_encapsulated_union_get_fields (const type_t *type)
 
static var_list_ttype_union_get_cases (const type_t *type)
 
static statement_list_ttype_iface_get_stmts (const type_t *type)
 
static type_ttype_iface_get_inherit (const type_t *type)
 
static typeref_list_ttype_iface_get_requires (const type_t *type)
 
static type_ttype_iface_get_async_iface (const type_t *type)
 
static var_list_ttype_dispiface_get_props (const type_t *type)
 
static var_list_ttype_dispiface_get_methods (const type_t *type)
 
static type_ttype_dispiface_get_inherit (const type_t *type)
 
static int type_is_defined (const type_t *type)
 
static int type_is_complete (const type_t *type)
 
static int type_array_has_conformance (const type_t *type)
 
static int type_array_has_variance (const type_t *type)
 
static unsigned int type_array_get_dim (const type_t *type)
 
static expr_ttype_array_get_conformance (const type_t *type)
 
static expr_ttype_array_get_variance (const type_t *type)
 
static unsigned short type_array_get_ptr_tfsoff (const type_t *type)
 
static void type_array_set_ptr_tfsoff (type_t *type, unsigned short ptr_tfsoff)
 
static const decl_spec_ttype_array_get_element (const type_t *type)
 
static type_ttype_array_get_element_type (const type_t *type)
 
static int type_array_is_decl_as_ptr (const type_t *type)
 
static int type_is_alias (const type_t *type)
 
static int type_is_ptr (const type_t *type)
 
static const decl_spec_ttype_alias_get_aliasee (const type_t *type)
 
static type_ttype_alias_get_aliasee_type (const type_t *type)
 
static typeref_list_ttype_coclass_get_ifaces (const type_t *type)
 
static typeref_list_ttype_runtimeclass_get_ifaces (const type_t *type)
 
static type_ttype_runtimeclass_get_default_iface (const type_t *type, int check)
 
static type_ttype_delegate_get_iface (const type_t *type)
 
static const decl_spec_ttype_pointer_get_ref (const type_t *type)
 
static type_ttype_pointer_get_ref_type (const type_t *type)
 
static type_ttype_pointer_get_root_type (type_t *type)
 
static type_ttype_bitfield_get_field (const type_t *type)
 
static const expr_ttype_bitfield_get_bits (const type_t *type)
 

Enumeration Type Documentation

◆ name_type

Enumerator
NAME_DEFAULT 
NAME_C 

Definition at line 30 of file typetree.h.

30 {
32 NAME_C
33};
@ NAME_C
Definition: typetree.h:32
@ NAME_DEFAULT
Definition: typetree.h:31

Function Documentation

◆ append_typeref()

typeref_list_t * append_typeref ( typeref_list_t list,
typeref_t ref 
)

◆ duptype()

type_t * duptype ( type_t t,
int  dupname 
)

Definition at line 37 of file typetree.c.

38{
39 type_t *d = alloc_type();
40
41 *d = *t;
42 if (dupname && t->name)
43 d->name = xstrdup(t->name);
44
45 return d;
46}
char * xstrdup(const char *s)
Definition: uimain.c:768
GLdouble GLdouble t
Definition: gl.h:2047
#define d
Definition: ke_i.h:81
char * name
Definition: compiler.c:66
type_t * alloc_type(void)

Referenced by replace_type_parameters_in_type(), type_parameterized_type_specialize_declare(), and type_parameterized_type_specialize_partial().

◆ find_parameterized_type()

type_t * find_parameterized_type ( type_t type,
typeref_list_t params 
)

◆ gen_name()

◆ make_typeref()

typeref_t * make_typeref ( type_t type)

◆ type_alias_get_aliasee()

static const decl_spec_t * type_alias_get_aliasee ( const type_t type)
inlinestatic

Definition at line 367 of file typetree.h.

368{
370 return &type->details.alias.aliasee;
371}
#define assert(x)
Definition: debug.h:53
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static int type_is_alias(const type_t *type)
Definition: typetree.h:357

Referenced by write_typedef().

◆ type_alias_get_aliasee_type()

◆ type_apicontract_declare()

type_t * type_apicontract_declare ( char name,
struct namespace namespace 
)

Definition at line 887 of file typetree.c.

888{
889 type_t *type = get_type(TYPE_APICONTRACT, name, namespace, 0);
891 error_loc( "apicontract %s previously not declared a apicontract at %s:%d\n", type->name,
892 type->where.input_name, type->where.first_line );
893 return type;
894}
struct hlsl_type * get_type(struct hlsl_scope *scope, const char *name, BOOL recursive) DECLSPEC_HIDDEN
Definition: utils.c:841
#define error_loc(...)
Definition: utils.h:29
Definition: name.c:39
@ TYPE_APICONTRACT
Definition: widltypes.h:492
static enum type_type type_get_type_detect_alias(const type_t *type)
Definition: widltypes.h:679

◆ type_apicontract_define()

type_t * type_apicontract_define ( type_t apicontract,
attr_list_t attrs,
const struct location where 
)

Definition at line 896 of file typetree.c.

897{
898 apicontract->attrs = check_apicontract_attrs(apicontract->name, attrs);
899 define_type(apicontract, where);
900 return apicontract;
901}
attr_list_t * check_apicontract_attrs(const char *name, attr_list_t *attrs)
Definition: attribute.c:337
attr_list_t * attrs
Definition: widltypes.h:503
const char * name
Definition: widltypes.h:500
static void define_type(type_t *type, const struct location *where)
Definition: typetree.c:536

◆ type_array_get_conformance()

static expr_t * type_array_get_conformance ( const type_t type)
inlinestatic

Definition at line 310 of file typetree.h.

311{
314 return type->details.array.size_is;
315}
static enum type_type type_get_type(const type_t *type)
Definition: typetree.h:113
static type_t * type_get_real_type(const type_t *type)
Definition: typetree.h:97
@ TYPE_ARRAY
Definition: widltypes.h:490

Referenced by assign_stub_out_args(), clear_output_vars(), get_array_fc(), get_size_is_expr(), write_array_tfs(), write_parameter_conf_or_var_exprs(), and write_string_tfs().

◆ type_array_get_dim()

◆ type_array_get_element()

static const decl_spec_t * type_array_get_element ( const type_t type)
inlinestatic

Definition at line 338 of file typetree.h.

339{
342 return &type->details.array.elem;
343}

Referenced by type_array_get_element_type(), and write_type_left().

◆ type_array_get_element_type()

◆ type_array_get_ptr_tfsoff()

static unsigned short type_array_get_ptr_tfsoff ( const type_t type)
inlinestatic

Definition at line 324 of file typetree.h.

325{
328 return type->details.array.ptr_tfsoff;
329}

Referenced by get_parameter_fc(), write_old_procformatstring_type(), and write_remoting_arg().

◆ type_array_get_variance()

static expr_t * type_array_get_variance ( const type_t type)
inlinestatic

Definition at line 317 of file typetree.h.

318{
321 return type->details.array.length_is;
322}

Referenced by write_array_tfs(), and write_parameter_conf_or_var_exprs().

◆ type_array_has_conformance()

static int type_array_has_conformance ( const type_t type)
inlinestatic

◆ type_array_has_variance()

static int type_array_has_variance ( const type_t type)
inlinestatic

◆ type_array_is_decl_as_ptr()

◆ type_array_set_ptr_tfsoff()

static void type_array_set_ptr_tfsoff ( type_t type,
unsigned short  ptr_tfsoff 
)
inlinestatic

Definition at line 331 of file typetree.h.

332{
335 type->details.array.ptr_tfsoff = ptr_tfsoff;
336}

Referenced by write_type_tfs().

◆ type_basic_get_sign()

static int type_basic_get_sign ( const type_t type)
inlinestatic

Definition at line 125 of file typetree.h.

126{
129 return type->details.basic.sign;
130}
@ TYPE_BASIC
Definition: widltypes.h:479

Referenced by append_type_signature(), get_basic_fc(), get_type_vt(), is_signed_integer_type(), and write_type_left().

◆ type_basic_get_type()

◆ type_bitfield_get_bits()

static const expr_t * type_bitfield_get_bits ( const type_t type)
inlinestatic

Definition at line 442 of file typetree.h.

443{
446 return type->details.bitfield.bits;
447}
@ TYPE_BITFIELD
Definition: widltypes.h:491

Referenced by write_type_right().

◆ type_bitfield_get_field()

static type_t * type_bitfield_get_field ( const type_t type)
inlinestatic

Definition at line 435 of file typetree.h.

436{
439 return type->details.bitfield.field;
440}

Referenced by write_type_left().

◆ type_coclass_declare()

type_t * type_coclass_declare ( char name)

Definition at line 823 of file typetree.c.

824{
827 error_loc( "coclass %s previously not declared a coclass at %s:%d\n", type->name,
828 type->where.input_name, type->where.first_line );
829 return type;
830}
@ TYPE_COCLASS
Definition: widltypes.h:486

◆ type_coclass_define()

type_t * type_coclass_define ( type_t coclass,
attr_list_t attrs,
typeref_list_t ifaces,
const struct location where 
)

Definition at line 832 of file typetree.c.

834{
835 coclass->attrs = check_coclass_attrs(coclass->name, attrs);
836 coclass->details.coclass.ifaces = ifaces;
837 define_type(coclass, where);
838 return coclass;
839}
attr_list_t * check_coclass_attrs(const char *name, attr_list_t *attrs)
Definition: attribute.c:350
union _type_t::@5357 details
struct coclass_details coclass
Definition: widltypes.h:512

◆ type_coclass_get_ifaces()

static typeref_list_t * type_coclass_get_ifaces ( const type_t type)
inlinestatic

Definition at line 379 of file typetree.h.

380{
383 return type->details.coclass.ifaces;
384}

Referenced by add_coclass_typeinfo().

◆ type_delegate_declare()

type_t * type_delegate_declare ( char name,
struct namespace namespace 
)

Definition at line 915 of file typetree.c.

916{
917 type_t *type = get_type(TYPE_DELEGATE, name, namespace, 0);
919 error_loc( "delegate %s previously not declared a delegate at %s:%d\n", type->name,
920 type->where.input_name, type->where.first_line );
921 return type;
922}
@ TYPE_DELEGATE
Definition: widltypes.h:496

◆ type_delegate_define()

type_t * type_delegate_define ( type_t delegate,
attr_list_t attrs,
statement_list_t stmts,
const struct location where 
)

Definition at line 924 of file typetree.c.

926{
927 type_t *iface;
928
929 delegate->attrs = check_interface_attrs(delegate->name, attrs);
930
931 iface = make_type(TYPE_INTERFACE);
932 iface->attrs = delegate->attrs;
933 iface->details.iface = xmalloc(sizeof(*iface->details.iface));
934 iface->details.iface->disp_props = NULL;
935 iface->details.iface->disp_methods = NULL;
936 iface->details.iface->stmts = stmts;
937 iface->details.iface->inherit = find_type("IUnknown", NULL, 0);
938 if (!iface->details.iface->inherit) error_loc("IUnknown is undefined\n");
939 iface->details.iface->disp_inherit = NULL;
940 iface->details.iface->async_iface = NULL;
941 iface->details.iface->requires = NULL;
942 define_type(iface, where);
943 iface->defined = TRUE;
945
946 delegate->details.delegate.iface = iface;
947 define_type(delegate, where);
949
950 return delegate;
951}
void * xmalloc(int size)
Definition: uimain.c:747
#define TRUE
Definition: types.h:120
attr_list_t * check_interface_attrs(const char *name, attr_list_t *attrs)
Definition: attribute.c:428
struct delegate_details delegate
Definition: widltypes.h:519
struct iface_details * iface
Definition: widltypes.h:509
unsigned int defined
Definition: widltypes.h:532
static unsigned int compute_method_indexes(type_t *iface)
Definition: typetree.c:707
static void compute_delegate_iface_names(type_t *delegate, type_t *type, typeref_list_t *params)
Definition: typetree.c:903
type_t * make_type(enum type_type type)
Definition: typetree.c:48
@ TYPE_INTERFACE
Definition: widltypes.h:488
type_t * find_type(const char *name, struct namespace *namespace, int t)

◆ type_delegate_get_iface()

static type_t * type_delegate_get_iface ( const type_t type)
inlinestatic

◆ type_dispiface_get_inherit()

static type_t * type_dispiface_get_inherit ( const type_t type)
inlinestatic

Definition at line 243 of file typetree.h.

244{
247 return type->details.iface->disp_inherit;
248}

Referenced by add_dispinterface_typeinfo().

◆ type_dispiface_get_methods()

static var_list_t * type_dispiface_get_methods ( const type_t type)
inlinestatic

Definition at line 236 of file typetree.h.

237{
240 return type->details.iface->disp_methods;
241}

Referenced by add_dispinterface_typeinfo().

◆ type_dispiface_get_props()

static var_list_t * type_dispiface_get_props ( const type_t type)
inlinestatic

Definition at line 229 of file typetree.h.

230{
233 return type->details.iface->disp_props;
234}

Referenced by add_dispinterface_typeinfo().

◆ type_dispinterface_declare()

type_t * type_dispinterface_declare ( char name)

Definition at line 759 of file typetree.c.

760{
763 error_loc( "dispinterface %s previously not declared a dispinterface at %s:%d\n",
764 type->name, type->where.input_name, type->where.first_line );
765 return type;
766}

◆ type_dispinterface_define()

type_t * type_dispinterface_define ( type_t iface,
attr_list_t attrs,
var_list_t props,
var_list_t methods,
const struct location where 
)

Definition at line 768 of file typetree.c.

770{
771 iface->attrs = check_dispiface_attrs(iface->name, attrs);
772 iface->details.iface = xmalloc(sizeof(*iface->details.iface));
773 iface->details.iface->disp_props = props;
774 iface->details.iface->disp_methods = methods;
775 iface->details.iface->stmts = NULL;
776 iface->details.iface->inherit = find_type("IDispatch", NULL, 0);
777 if (!iface->details.iface->inherit) error_loc("IDispatch is undefined\n");
778 iface->details.iface->disp_inherit = NULL;
779 iface->details.iface->async_iface = NULL;
780 iface->details.iface->requires = NULL;
781 define_type(iface, where);
783 return iface;
784}
attr_list_t * check_dispiface_attrs(const char *name, attr_list_t *attrs)
Definition: attribute.c:363
static const WCHAR props[]
Definition: wbemdisp.c:288

◆ type_dispinterface_define_from_iface()

type_t * type_dispinterface_define_from_iface ( type_t dispiface,
attr_list_t attrs,
type_t iface,
const struct location where 
)

Definition at line 786 of file typetree.c.

788{
789 dispiface->attrs = check_dispiface_attrs(dispiface->name, attrs);
790 dispiface->details.iface = xmalloc(sizeof(*dispiface->details.iface));
791 dispiface->details.iface->disp_props = NULL;
792 dispiface->details.iface->disp_methods = NULL;
793 dispiface->details.iface->stmts = NULL;
794 dispiface->details.iface->inherit = find_type("IDispatch", NULL, 0);
795 if (!dispiface->details.iface->inherit) error_loc("IDispatch is undefined\n");
796 dispiface->details.iface->disp_inherit = iface;
797 dispiface->details.iface->async_iface = NULL;
798 dispiface->details.iface->requires = NULL;
799 define_type(dispiface, where);
800 compute_method_indexes(dispiface);
801 return dispiface;
802}

◆ type_encapsulated_union_get_fields()

static var_list_t * type_encapsulated_union_get_fields ( const type_t type)
inlinestatic

Definition at line 177 of file typetree.h.

178{
181 return type->details.structure->fields;
182}
@ TYPE_ENCAPSULATED_UNION
Definition: widltypes.h:482

Referenced by add_structure_typeinfo(), type_buffer_alignment(), type_memsize_and_alignment(), and write_type_left().

◆ type_enum_get_values()

static var_list_t * type_enum_get_values ( const type_t type)
inlinestatic

Definition at line 163 of file typetree.h.

164{
167 return type->details.enumeration->enums;
168}
@ TYPE_ENUM
Definition: widltypes.h:480

Referenced by add_enum_typeinfo(), check_for_additional_prototype_types(), and write_type_left().

◆ type_function_get_args()

◆ type_function_get_ret()

static const decl_spec_t * type_function_get_ret ( const type_t type)
inlinestatic

◆ type_function_get_rettype()

◆ type_function_get_retval()

◆ type_get_decl_name()

const char * type_get_decl_name ( const type_t type,
enum name_type  name_type 
)

Definition at line 88 of file typetree.c.

89{
90 switch(name_type) {
91 case NAME_DEFAULT:
92 return type->name;
93 case NAME_C:
94 return type->c_name ? type->c_name : type->name;
95 }
96
97 assert(0);
98 return NULL;
99}
name_type
Definition: typetree.h:30

Referenced by write_type_left().

◆ type_get_name()

const char * type_get_name ( const type_t type,
enum name_type  name_type 
)

Definition at line 101 of file typetree.c.

102{
103 switch(name_type) {
104 case NAME_DEFAULT:
105 return type->qualified_name ? type->qualified_name : type->name;
106 case NAME_C:
107 return type->c_name ? type->c_name : type->name;
108 }
109
110 assert(0);
111 return NULL;
112}

Referenced by write_type_left().

◆ type_get_real_type()

◆ type_get_type()

static enum type_type type_get_type ( const type_t type)
inlinestatic

Definition at line 113 of file typetree.h.

Referenced by add_structure_typeinfo(), add_type_typeinfo(), build_iface_list(), builtin_vt(), check_for_additional_prototype_types(), check_interface_attrs(), clear_output_vars(), decl_indirect(), declare_stub_args(), does_any_iface(), dump_type(), encode_type(), fill_params_array(), find_array_or_string_in_struct(), find_identifier(), find_ps_factory(), for_each_iface(), for_each_serializable(), free_variable(), get_correlation_type(), get_enum_fc(), get_func_handle_var(), get_type_vt(), is_aggregate_return(), is_array(), is_declptr(), is_float_type(), is_func(), is_integer_type(), is_interpreted_func(), is_non_complex_struct(), is_object(), is_ptr(), is_signed_integer_type(), is_valid_bitfield_type(), is_valid_member_operand(), is_void(), print_phase_basetype(), type_array_get_conformance(), type_array_get_dim(), type_array_get_element(), type_array_get_ptr_tfsoff(), type_array_get_variance(), type_array_has_conformance(), type_array_has_variance(), type_array_is_decl_as_ptr(), type_array_set_ptr_tfsoff(), type_basic_get_sign(), type_basic_get_type(), type_bitfield_get_bits(), type_bitfield_get_field(), type_buffer_alignment(), type_coclass_get_ifaces(), type_delegate_get_iface(), type_dispiface_get_inherit(), type_dispiface_get_methods(), type_dispiface_get_props(), type_encapsulated_union_get_fields(), type_enum_get_values(), type_function_get_args(), type_function_get_retval(), type_iface_get_async_iface(), type_iface_get_inherit(), type_iface_get_requires(), type_iface_get_stmts(), type_memsize_and_alignment(), type_new_function(), type_pointer_get_ref(), type_runtimeclass_get_ifaces(), type_struct_get_fields(), type_union_get_cases(), type_union_get_switch_value(), typegen_detect_type(), user_type_has_variable_size(), write_array_element_type(), write_base_type(), write_branch_type(), write_client_ifaces(), write_coclasses(), write_conf_or_var_desc(), write_default_value(), write_descriptors(), write_expr_eval_routines(), write_fixed_array_pointer_descriptions(), write_forward_decls(), write_header_stmts(), write_id_data_stmts(), write_imports(), write_interfaces(), write_local_stubs_stmts(), write_locals(), write_member_type(), write_old_procformatstring_type(), write_parameter_conf_or_var_exprs(), write_parameterized_implementation(), write_parameterized_type_forward(), write_pointer_description(), write_pointer_description_offsets(), write_proc_func_interp(), write_progids(), write_proxy_stmts(), write_range_tfs(), write_remoting_arg(), write_runtimeclasses_registry(), write_server_stmts(), write_simple_pointer(), write_string_tfs(), write_type_left(), write_type_right(), write_union_tfs(), write_user_tfs(), write_var_desc(), and write_varying_array_pointer_descriptions().

◆ type_iface_get_async_iface()

static type_t * type_iface_get_async_iface ( const type_t type)
inlinestatic

◆ type_iface_get_inherit()

◆ type_iface_get_requires()

static typeref_list_t * type_iface_get_requires ( const type_t type)
inlinestatic

Definition at line 215 of file typetree.h.

216{
219 return type->details.iface->requires;
220}

Referenced by type_runtimeclass_define().

◆ type_iface_get_stmts()

◆ type_interface_declare()

type_t * type_interface_declare ( char name,
struct namespace namespace 
)

Definition at line 730 of file typetree.c.

731{
732 type_t *type = get_type(TYPE_INTERFACE, name, namespace, 0);
734 error_loc( "interface %s previously not declared an interface at %s:%d\n", type->name,
735 type->where.input_name, type->where.first_line );
736 return type;
737}

◆ type_interface_define()

type_t * type_interface_define ( type_t iface,
attr_list_t attrs,
type_t inherit,
statement_list_t stmts,
typeref_list_t requires,
const struct location where 
)

Definition at line 739 of file typetree.c.

741{
742 if (iface == inherit)
743 error_loc("interface %s can't inherit from itself\n",
744 iface->name);
745 iface->attrs = check_interface_attrs(iface->name, attrs);
746 iface->details.iface = xmalloc(sizeof(*iface->details.iface));
747 iface->details.iface->disp_props = NULL;
748 iface->details.iface->disp_methods = NULL;
749 iface->details.iface->stmts = stmts;
750 iface->details.iface->inherit = inherit;
751 iface->details.iface->disp_inherit = NULL;
752 iface->details.iface->async_iface = NULL;
753 iface->details.iface->requires = requires;
754 define_type(iface, where);
756 return iface;
757}

◆ type_is_alias()

◆ type_is_complete()

static int type_is_complete ( const type_t type)
inlinestatic

Definition at line 255 of file typetree.h.

256{
258 {
259 case TYPE_FUNCTION:
260 return (type->details.function != NULL);
261 case TYPE_INTERFACE:
262 return (type->details.iface != NULL);
263 case TYPE_ENUM:
264 return (type->details.enumeration != NULL);
265 case TYPE_UNION:
267 case TYPE_STRUCT:
268 return (type->details.structure != NULL);
269 case TYPE_VOID:
270 case TYPE_BASIC:
271 case TYPE_ALIAS:
272 case TYPE_MODULE:
273 case TYPE_COCLASS:
274 case TYPE_POINTER:
275 case TYPE_ARRAY:
276 case TYPE_BITFIELD:
278 case TYPE_DELEGATE:
279 return TRUE;
280 case TYPE_APICONTRACT:
282 case TYPE_PARAMETER:
283 assert(0);
284 break;
285 }
286 return FALSE;
287}
#define FALSE
Definition: types.h:117
@ TYPE_PARAMETER
Definition: widltypes.h:495
@ TYPE_UNION
Definition: widltypes.h:483
@ TYPE_PARAMETERIZED_TYPE
Definition: widltypes.h:494
@ TYPE_POINTER
Definition: widltypes.h:489
@ TYPE_VOID
Definition: widltypes.h:478
@ TYPE_STRUCT
Definition: widltypes.h:481
@ TYPE_MODULE
Definition: widltypes.h:485
@ TYPE_RUNTIMECLASS
Definition: widltypes.h:493

Referenced by check_for_additional_prototype_types().

◆ type_is_defined()

static int type_is_defined ( const type_t type)
inlinestatic

Definition at line 250 of file typetree.h.

251{
252 return type->defined;
253}

Referenced by is_object().

◆ type_is_equal()

int type_is_equal ( const type_t type1,
const type_t type2 
)

Definition at line 1319 of file typetree.c.

1320{
1321 if (type1 == type2)
1322 return TRUE;
1324 return FALSE;
1325 if (type1->namespace != type2->namespace)
1326 return FALSE;
1327
1328 if (type1->name && type2->name)
1329 return !strcmp(type1->name, type2->name);
1330 else if ((!type1->name && type2->name) || (type1->name && !type2->name))
1331 return FALSE;
1332
1333 /* FIXME: do deep inspection of types to determine if they are equal */
1334
1335 return FALSE;
1336}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by type_runtimeclass_define().

◆ type_is_ptr()

static int type_is_ptr ( const type_t type)
inlinestatic

Definition at line 362 of file typetree.h.

363{
364 return type->type_type == TYPE_POINTER;
365}

Referenced by is_ptrchain_attr().

◆ type_module_declare()

type_t * type_module_declare ( char name)

Definition at line 804 of file typetree.c.

805{
808 error_loc( "module %s previously not declared a module at %s:%d\n", type->name,
809 type->where.input_name, type->where.first_line );
810 return type;
811}

◆ type_module_define()

type_t * type_module_define ( type_t module,
attr_list_t attrs,
statement_list_t stmts,
const struct location where 
)

Definition at line 813 of file typetree.c.

815{
816 module->attrs = check_module_attrs(module->name, attrs);
817 module->details.module = xmalloc(sizeof(*module->details.module));
818 module->details.module->stmts = stmts;
819 define_type(module, where);
820 return module;
821}
attr_list_t * check_module_attrs(const char *name, attr_list_t *attrs)
Definition: attribute.c:464
IMAGEHLP_MODULEW64 module

◆ type_new_alias()

type_t * type_new_alias ( const decl_spec_t t,
const char name 
)

Definition at line 477 of file typetree.c.

478{
480
481 a->name = xstrdup(name);
482 a->attrs = NULL;
483 a->details.alias.aliasee = *t;
484 init_location( &a->where, NULL, NULL );
485
486 return a;
487}
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define a
Definition: ke_i.h:78
void init_location(struct location *copy, const struct location *begin, const struct location *end)

◆ type_new_array()

type_t * type_new_array ( const char name,
const decl_spec_t element,
int  declptr,
unsigned int  dim,
expr_t size_is,
expr_t length_is 
)

Definition at line 489 of file typetree.c.

491{
493 if (name) t->name = xstrdup(name);
494 t->details.array.declptr = declptr;
495 t->details.array.length_is = length_is;
496 if (size_is)
497 t->details.array.size_is = size_is;
498 else
499 t->details.array.dim = dim;
500 if (element)
501 t->details.array.elem = *element;
502 return t;
503}

◆ type_new_basic()

type_t * type_new_basic ( enum type_basic_type  basic_type)

Definition at line 505 of file typetree.c.

506{
508 t->details.basic.type = basic_type;
509 t->details.basic.sign = 0;
510 return t;
511}

Referenced by resolve_expression(), and type_new_int().

◆ type_new_bitfield()

type_t * type_new_bitfield ( type_t field_type,
const expr_t bits 
)

Definition at line 689 of file typetree.c.

690{
691 type_t *t;
692
694 error_loc("bit-field has invalid type\n");
695
696 if (bits->cval < 0)
697 error_loc("negative width for bit-field\n");
698
699 /* FIXME: validate bits->cval <= memsize(field) * 8 */
700
702 t->details.bitfield.field = field;
703 t->details.bitfield.bits = bits;
704 return t;
705}
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
#define bits
Definition: infblock.c:15
Definition: parser.c:44
static int is_valid_bitfield_type(const type_t *type)
Definition: typetree.c:656

◆ type_new_encapsulated_union()

type_t * type_new_encapsulated_union ( char name,
var_t switch_field,
var_t union_field,
var_list_t cases,
const struct location where 
)

Definition at line 627 of file typetree.c.

629{
630 type_t *t = NULL;
631
632 if (name)
634
635 if (!t)
636 {
638 t->name = name;
639 if (name)
641 }
642 t->type_type = TYPE_ENCAPSULATED_UNION;
643
644 if (!union_field)
645 union_field = make_var(xstrdup("tagged_union"));
646 union_field->declspec.type = type_new_nonencapsulated_union(gen_name(), NULL, TRUE, cases, where);
647
648 t->details.structure = xmalloc(sizeof(*t->details.structure));
649 t->details.structure->fields = append_var(NULL, switch_field);
650 t->details.structure->fields = append_var(t->details.structure->fields, union_field);
651 define_type(t, where);
652
653 return t;
654}
type_t * type_new_nonencapsulated_union(const char *name, struct namespace *namespace, int defined, var_list_t *fields, const struct location *where)
Definition: typetree.c:600
char * gen_name(void)
var_list_t * append_var(var_list_t *list, var_t *var)
#define tsUNION
Definition: widltypes.h:664
type_t * reg_type(type_t *type, const char *name, struct namespace *namespace, int t)
var_t * make_var(char *name)

◆ type_new_enum()

type_t * type_new_enum ( const char name,
struct namespace namespace,
int  defined,
var_list_t enums,
const struct location where 
)

Definition at line 546 of file typetree.c.

548{
549 type_t *t = NULL;
550
551 if (name)
552 t = find_type(name, namespace,tsENUM);
553
554 if (!t)
555 {
557 t->name = name;
558 t->namespace = namespace;
559 if (name)
560 reg_type(t, name, namespace, tsENUM);
561 }
562
563 if (defined)
564 {
565 t->details.enumeration = xmalloc(sizeof(*t->details.enumeration));
566 t->details.enumeration->enums = enums;
567 define_type(t, where);
568 }
569
570 return t;
571}
static const struct encodedInt enums[]
Definition: encode.c:361
#define tsENUM
Definition: widltypes.h:662

◆ type_new_function()

type_t * type_new_function ( var_list_t args)

Definition at line 420 of file typetree.c.

421{
422 var_t *arg;
423 type_t *t;
424 unsigned int i = 0;
425
426 if (args)
427 {
429 if (list_count(args) == 1 && !arg->name && arg->declspec.type && type_get_type(arg->declspec.type) == TYPE_VOID)
430 {
431 list_remove(&arg->entry);
432 free(arg);
433 free(args);
434 args = NULL;
435 }
436 }
438 {
439 if (arg->declspec.type && type_get_type(arg->declspec.type) == TYPE_VOID)
440 error_loc("argument '%s' has void type\n", arg->name);
441 if (!arg->name)
442 {
443 if (i > 26 * 26)
444 error_loc("too many unnamed arguments\n");
445 else
446 {
447 int unique;
448 do
449 {
450 char name[3];
451 name[0] = i > 26 ? 'a' + i / 26 : 'a' + i;
452 name[1] = i > 26 ? 'a' + i % 26 : 0;
453 name[2] = 0;
455 if (unique)
456 arg->name = xstrdup(name);
457 i++;
458 } while (!unique);
459 }
460 }
461 }
462
464 t->details.function = xmalloc(sizeof(*t->details.function));
465 t->details.function->args = args;
466 t->details.function->retval = make_var(xstrdup("_RetVal"));
467 return t;
468}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
#define free
Definition: debug_ros.c:5
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
uint32_t entry
Definition: isohybrid.c:63
__WINE_SERVER_LIST_INLINE unsigned int list_count(const struct list *list)
Definition: list.h:155
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define args
Definition: format.c:66
Definition: match.c:390
Definition: list.h:15
#define LIST_ENTRY(type)
Definition: queue.h:175
static const var_t * find_arg(const var_list_t *args, const char *name)
Definition: typetree.c:75
void * arg
Definition: msvc.h:10

◆ type_new_int()

type_t * type_new_int ( enum type_basic_type  basic_type,
int  sign 
)

Definition at line 513 of file typetree.c.

514{
515 static type_t *int_types[TYPE_BASIC_INT_MAX+1][3];
516
517 assert(basic_type <= TYPE_BASIC_INT_MAX);
518
519 /* map sign { -1, 0, 1 } -> { 0, 1, 2 } */
520 if (!int_types[basic_type][sign + 1])
521 {
522 int_types[basic_type][sign + 1] = type_new_basic(basic_type);
523 int_types[basic_type][sign + 1]->details.basic.sign = sign;
524 }
525 return int_types[basic_type][sign + 1];
526}
#define sign(x)
Definition: mapdesc.cc:613
struct basic_details basic
Definition: widltypes.h:513
type_t * type_new_basic(enum type_basic_type basic_type)
Definition: typetree.c:505
#define TYPE_BASIC_INT_MAX
Definition: widltypes.h:315

Referenced by resolve_expression().

◆ type_new_nonencapsulated_union()

type_t * type_new_nonencapsulated_union ( const char name,
struct namespace namespace,
int  defined,
var_list_t fields,
const struct location where 
)

Definition at line 600 of file typetree.c.

602{
603 type_t *t = NULL;
604
605 if (name)
606 t = find_type(name, namespace, tsUNION);
607
608 if (!t)
609 {
611 t->name = name;
612 t->namespace = namespace;
613 if (name)
614 reg_type(t, name, namespace, tsUNION);
615 }
616
617 if (!t->defined && defined)
618 {
619 t->details.structure = xmalloc(sizeof(*t->details.structure));
620 t->details.structure->fields = fields;
621 define_type(t, where);
622 }
623
624 return t;
625}
const char * fields[10]
Definition: parser.c:313

Referenced by type_new_encapsulated_union().

◆ type_new_pointer()

type_t * type_new_pointer ( type_t ref)

Definition at line 470 of file typetree.c.

471{
473 t->details.pointer.ref.type = ref;
474 return t;
475}
Definition: send.c:48

Referenced by resolve_expression().

◆ type_new_struct()

type_t * type_new_struct ( char name,
struct namespace namespace,
int  defined,
var_list_t fields,
const struct location where 
)

Definition at line 573 of file typetree.c.

575{
576 type_t *t = NULL;
577
578 if (name)
579 t = find_type(name, namespace, tsSTRUCT);
580
581 if (!t)
582 {
584 t->name = name;
585 t->namespace = namespace;
586 if (name)
587 reg_type(t, name, namespace, tsSTRUCT);
588 }
589
590 if (defined)
591 {
592 t->details.structure = xmalloc(sizeof(*t->details.structure));
593 t->details.structure->fields = fields;
594 define_type(t, where);
595 }
596
597 return t;
598}
#define tsSTRUCT
Definition: widltypes.h:663

◆ type_new_void()

type_t * type_new_void ( void  )

Definition at line 528 of file typetree.c.

529{
530 static type_t *void_type = NULL;
531 if (!void_type)
532 void_type = make_type(TYPE_VOID);
533 return void_type;
534}

◆ type_parameterized_delegate_declare()

type_t * type_parameterized_delegate_declare ( char name,
struct namespace namespace,
typeref_list_t params 
)

Definition at line 992 of file typetree.c.

993{
996 error_loc( "pdelegate %s previously not declared a pdelegate at %s:%d\n", type->name,
997 type->where.input_name, type->where.first_line );
998 type->details.parameterized.type = make_type(TYPE_DELEGATE);
999 type->details.parameterized.params = params;
1000 return type;
1001}
GLenum const GLfloat * params
Definition: glext.h:5645

◆ type_parameterized_delegate_define()

type_t * type_parameterized_delegate_define ( type_t type,
attr_list_t attrs,
statement_list_t stmts,
const struct location where 
)

Definition at line 1003 of file typetree.c.

1005{
1006 type_t *iface, *delegate;
1007
1008 type->attrs = check_interface_attrs(type->name, attrs);
1009
1010 delegate = type->details.parameterized.type;
1011 delegate->attrs = type->attrs;
1012 delegate->details.delegate.iface = make_type(TYPE_INTERFACE);
1013
1014 iface = delegate->details.delegate.iface;
1015 iface->details.iface = xmalloc(sizeof(*iface->details.iface));
1016 iface->details.iface->disp_props = NULL;
1017 iface->details.iface->disp_methods = NULL;
1018 iface->details.iface->stmts = stmts;
1019 iface->details.iface->inherit = find_type("IUnknown", NULL, 0);
1020 if (!iface->details.iface->inherit) error_loc("IUnknown is undefined\n");
1021 iface->details.iface->disp_inherit = NULL;
1022 iface->details.iface->async_iface = NULL;
1023 iface->details.iface->requires = NULL;
1024
1025 delegate->name = type->name;
1026 compute_delegate_iface_names(delegate, type, type->details.parameterized.params);
1027
1028 define_type(type, where);
1029 return type;
1030}
struct parameterized_details parameterized
Definition: widltypes.h:518

◆ type_parameterized_interface_declare()

type_t * type_parameterized_interface_declare ( char name,
struct namespace namespace,
typeref_list_t params 
)

Definition at line 953 of file typetree.c.

954{
957 error_loc( "pinterface %s previously not declared a pinterface at %s:%d\n", type->name,
958 type->where.input_name, type->where.first_line );
959 type->details.parameterized.type = make_type(TYPE_INTERFACE);
960 type->details.parameterized.params = params;
961 return type;
962}

◆ type_parameterized_interface_define()

type_t * type_parameterized_interface_define ( type_t type,
attr_list_t attrs,
type_t inherit,
statement_list_t stmts,
typeref_list_t requires,
const struct location where 
)

Definition at line 964 of file typetree.c.

966{
967 type_t *iface;
968
969 /* The parameterized type UUID is actually a PIID that is then used as a seed to generate
970 * a new type GUID with the rules described in:
971 * https://docs.microsoft.com/en-us/uwp/winrt-cref/winrt-type-system#parameterized-types
972 * TODO: store type signatures for generated interfaces, and generate their GUIDs
973 */
974 type->attrs = check_interface_attrs(type->name, attrs);
975
976 iface = type->details.parameterized.type;
977 iface->details.iface = xmalloc(sizeof(*iface->details.iface));
978 iface->details.iface->disp_props = NULL;
979 iface->details.iface->disp_methods = NULL;
980 iface->details.iface->stmts = stmts;
981 iface->details.iface->inherit = inherit;
982 iface->details.iface->disp_inherit = NULL;
983 iface->details.iface->async_iface = NULL;
984 iface->details.iface->requires = requires;
985
986 iface->name = type->name;
987
988 define_type(type, where);
989 return type;
990}

◆ type_parameterized_type_get_real_type()

static type_t * type_parameterized_type_get_real_type ( const type_t type)
inlinestatic

Definition at line 105 of file typetree.h.

106{
107 if (type->type_type == TYPE_PARAMETERIZED_TYPE)
108 return type_parameterized_type_get_real_type(type->details.parameterized.type);
109 else
110 return (type_t *)type;
111}
static type_t * type_parameterized_type_get_real_type(const type_t *type)
Definition: typetree.h:105

Referenced by type_parameterized_type_get_real_type(), and write_type_left().

◆ type_parameterized_type_specialize_declare()

type_t * type_parameterized_type_specialize_declare ( type_t type,
typeref_list_t params 
)

Definition at line 1222 of file typetree.c.

1223{
1224 type_t *tmpl = type->details.parameterized.type;
1225 type_t *new_type = duptype(tmpl, 0);
1226
1227 new_type->namespace = type->namespace;
1229 reg_type(new_type, new_type->name, new_type->namespace, 0);
1230 new_type->c_name = format_parameterized_type_c_name(type, params, "", "_C");
1232 new_type->param_name = format_parameterized_type_c_name(type, params, "", "__C");
1233
1234 if (new_type->type_type == TYPE_DELEGATE)
1235 {
1236 new_type->details.delegate.iface = duptype(tmpl->details.delegate.iface, 0);
1238 new_type->details.delegate.iface->short_name = format_parameterized_type_short_name(type, params, "I");
1239 }
1240
1241 return new_type;
1242}
const char * param_name
Definition: widltypes.h:525
const char * c_name
Definition: widltypes.h:521
const char * short_name
Definition: widltypes.h:526
enum type_type type_type
Definition: widltypes.h:502
static char * format_parameterized_type_c_name(type_t *type, typeref_list_t *params, const char *prefix, const char *separator)
Definition: typetree.c:313
static char * format_parameterized_type_short_name(type_t *type, typeref_list_t *params, const char *prefix)
Definition: typetree.c:371
char * format_parameterized_type_name(type_t *type, typeref_list_t *params)
Definition: typetree.c:287
type_t * duptype(type_t *t, int dupname)
Definition: typetree.c:37

◆ type_parameterized_type_specialize_define()

type_t * type_parameterized_type_specialize_define ( type_t type)

Definition at line 1282 of file typetree.c.

1283{
1284 type_t *tmpl = type->details.parameterized.type;
1285 typeref_list_t *orig = tmpl->details.parameterized.params;
1286 typeref_list_t *repl = type->details.parameterized.params;
1287 type_t *iface = find_parameterized_type(tmpl, repl);
1288
1291 error_loc( "cannot define non-parameterized type %s, declared at %s:%d\n", type->name,
1292 type->where.input_name, type->where.first_line );
1293
1296 type_parameterized_interface_specialize(tmpl->details.parameterized.type, iface, orig, repl);
1299 type_parameterized_delegate_specialize(tmpl->details.parameterized.type, iface, orig, repl);
1300 else
1301 error_loc("pinterface/pdelegate %s previously not declared a pinterface/pdelegate at %s:%d\n",
1302 iface->name, iface->where.input_name, iface->where.first_line);
1303
1306 iface->defined = TRUE;
1307 if (iface->type_type == TYPE_DELEGATE)
1308 {
1309 iface = iface->details.delegate.iface;
1312 iface->defined = TRUE;
1313 }
1316 return iface;
1317}
Definition: list.h:37
struct location where
Definition: widltypes.h:530
const char * impl_name
Definition: widltypes.h:524
const char * signature
Definition: widltypes.h:522
static void type_parameterized_interface_specialize(type_t *tmpl, type_t *iface, typeref_list_t *orig, typeref_list_t *repl)
Definition: typetree.c:1204
static char * format_parameterized_type_signature(type_t *type, typeref_list_t *params)
Definition: typetree.c:347
static void compute_interface_signature_uuid(type_t *iface)
Definition: typetree.c:1244
static char * format_parameterized_type_impl_name(type_t *type, typeref_list_t *params, const char *prefix)
Definition: typetree.c:388
static void type_parameterized_delegate_specialize(type_t *tmpl, type_t *delegate, typeref_list_t *orig, typeref_list_t *repl)
Definition: typetree.c:1217
type_t * find_parameterized_type(type_t *type, typeref_list_t *params)

◆ type_parameterized_type_specialize_partial()

type_t * type_parameterized_type_specialize_partial ( type_t type,
typeref_list_t params 
)

Definition at line 1032 of file typetree.c.

1033{
1034 type_t *new_type = duptype(type, 0);
1035 new_type->details.parameterized.type = type;
1036 new_type->details.parameterized.params = params;
1037 return new_type;
1038}

◆ type_pointer_get_ref()

static const decl_spec_t * type_pointer_get_ref ( const type_t type)
inlinestatic

Definition at line 417 of file typetree.h.

418{
421 return &type->details.pointer.ref;
422}

Referenced by declare_stub_args(), is_const_decl(), print_phase_basetype(), type_pointer_get_ref_type(), and write_type_left().

◆ type_pointer_get_ref_type()

◆ type_pointer_get_root_type()

static type_t * type_pointer_get_root_type ( type_t type)
inlinestatic

Definition at line 429 of file typetree.h.

430{
431 for (; type && type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) {}
432 return type;
433}
static type_t * type_pointer_get_ref_type(const type_t *type)
Definition: typetree.h:424

Referenced by format_parameterized_type_c_name(), format_parameterized_type_impl_name(), format_parameterized_type_name(), format_parameterized_type_short_name(), and write_typedef().

◆ type_runtimeclass_declare()

type_t * type_runtimeclass_declare ( char name,
struct namespace namespace 
)

Definition at line 841 of file typetree.c.

842{
843 type_t *type = get_type(TYPE_RUNTIMECLASS, name, namespace, 0);
845 error_loc( "runtimeclass %s previously not declared a runtimeclass at %s:%d\n", type->name,
846 type->where.input_name, type->where.first_line );
847 return type;
848}

◆ type_runtimeclass_define()

type_t * type_runtimeclass_define ( type_t runtimeclass,
attr_list_t attrs,
typeref_list_t ifaces,
const struct location where 
)

Definition at line 850 of file typetree.c.

852{
853 typeref_t *ref, *required, *tmp;
854 typeref_list_t *requires;
855
856 runtimeclass->attrs = check_runtimeclass_attrs(runtimeclass->name, attrs);
857 runtimeclass->details.runtimeclass.ifaces = ifaces;
858 define_type(runtimeclass, where);
859 if (!type_runtimeclass_get_default_iface(runtimeclass, FALSE) &&
860 !get_attrp(runtimeclass->attrs, ATTR_STATIC))
861 error_loc("runtimeclass %s must have a default interface or static factory\n", runtimeclass->name);
862
863 if (ifaces) LIST_FOR_EACH_ENTRY(ref, ifaces, typeref_t, entry)
864 {
865 /* FIXME: this should probably not be allowed, here or in coclass, */
866 /* but for now there's too many places in Wine IDL where it is to */
867 /* even print a warning. */
868 if (!(ref->type->defined)) continue;
869 if (!(requires = type_iface_get_requires(ref->type))) continue;
870 LIST_FOR_EACH_ENTRY(required, requires, typeref_t, entry)
871 {
872 int found = 0;
873
874 LIST_FOR_EACH_ENTRY(tmp, ifaces, typeref_t, entry)
875 if ((found = type_is_equal(tmp->type, required->type))) break;
876
877 if (!found)
878 error_loc("interface '%s' also requires interface '%s', "
879 "but runtimeclass '%s' does not implement it.\n",
880 ref->type->name, required->type->name, runtimeclass->name);
881 }
882 }
883
884 return runtimeclass;
885}
void * get_attrp(const attr_list_t *list, enum attr_type attr_type)
Definition: attribute.c:87
attr_list_t * check_runtimeclass_attrs(const char *name, attr_list_t *attrs)
Definition: attribute.c:477
struct runtimeclass_details runtimeclass
Definition: widltypes.h:517
type_t * type
Definition: widltypes.h:571
char name[1]
Definition: send.c:52
int type_is_equal(const type_t *type1, const type_t *type2)
Definition: typetree.c:1319
static type_t * type_runtimeclass_get_default_iface(const type_t *type, int check)
Definition: typetree.h:393
static typeref_list_t * type_iface_get_requires(const type_t *type)
Definition: typetree.h:215
@ ATTR_STATIC
Definition: widltypes.h:172

◆ type_runtimeclass_get_default_iface()

static type_t * type_runtimeclass_get_default_iface ( const type_t type,
int  check 
)
inlinestatic

Definition at line 393 of file typetree.h.

394{
396 typeref_t *ref;
397
398 if (ifaces) LIST_FOR_EACH_ENTRY(ref, ifaces, typeref_t, entry)
399 if (is_attr(ref->attrs, ATTR_DEFAULT))
400 return ref->type;
401
402 if (!check) return NULL;
403 error_at( &type->where, "runtimeclass %s needs a default interface\n", type->name );
404
405#ifdef __REACTOS__
406 return NULL;
407#endif
408}
#define check(expected, result)
Definition: dplayx.c:32
int is_attr(const attr_list_t *list, enum attr_type attr_type)
Definition: attribute.c:45
void error_at(const struct location *where, const char *s,...)
Definition: utils.c:35
static typeref_list_t * type_runtimeclass_get_ifaces(const type_t *type)
Definition: typetree.h:386
@ ATTR_DEFAULT
Definition: widltypes.h:95

Referenced by append_type_signature(), format_parameterized_type_impl_name(), type_runtimeclass_define(), and write_type_left().

◆ type_runtimeclass_get_ifaces()

static typeref_list_t * type_runtimeclass_get_ifaces ( const type_t type)
inlinestatic

Definition at line 386 of file typetree.h.

387{
390 return type->details.runtimeclass.ifaces;
391}

Referenced by type_runtimeclass_get_default_iface().

◆ type_struct_get_fields()

◆ type_union_get_cases()

static var_list_t * type_union_get_cases ( const type_t type)
inlinestatic

Definition at line 184 of file typetree.h.

185{
186 enum type_type type_type;
187
190
193 {
194 const var_t *uv = LIST_ENTRY(list_tail(type->details.structure->fields), const var_t, entry);
195 return uv->declspec.type->details.structure->fields;
196 }
197 else
198 return type->details.structure->fields;
199}
__WINE_SERVER_LIST_INLINE struct list * list_tail(const struct list *list)
Definition: list.h:137
struct struct_details * structure
Definition: widltypes.h:506
type_type
Definition: widltypes.h:477

Referenced by add_union_typeinfo(), check_for_additional_prototype_types(), find_identifier(), type_buffer_alignment(), type_has_full_pointer_recurse(), type_has_pointers(), type_memsize_and_alignment(), write_type_left(), and write_union_tfs().

◆ type_union_get_switch_value()

static var_t * type_union_get_switch_value ( const type_t type)
inlinestatic

Definition at line 170 of file typetree.h.

171{
174 return LIST_ENTRY(list_head(type->details.structure->fields), var_t, entry);
175}

Referenced by write_union_tfs().