ReactOS  0.4.13-dev-242-g611e6d7
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 }
#define STATEMENTS_FOR_EACH_FUNC(stmt, stmts)
Definition: widltypes.h:596
GLenum func
Definition: glext.h:6028
var_t * var
Definition: widltypes.h:538
GLuint GLuint GLsizei count
Definition: gl.h:1545
int count_methods(const type_t *iface)
Definition: proxy.c:465
static type_t * type_iface_get_inherit(const type_t *type)
Definition: typetree.h:158
const var_t * is_callas(const attr_list_t *a)
Definition: header.c:943
union _statement_t::@4022 u
static statement_list_t * type_iface_get_stmts(const type_t *type)
Definition: typetree.h:151

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

◆ get_attrp()

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

Definition at line 107 of file header.c.

108 {
109  const attr_t *attr;
110  if (list) LIST_FOR_EACH_ENTRY( attr, list, const attr_t, entry )
111  if (attr->type == t) return attr->u.pval;
112  return NULL;
113 }
GLdouble GLdouble t
Definition: gl.h:2047
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
smooth NULL
Definition: ftsmooth.c:416
Definition: cookie.c:170
__u8 attr
Definition: mkdosfs.c:359
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228

Referenced by add_typeinfo_block(), check_field_common(), cmp_iid(), declare_var(), do_write_c_method_def(), gen_proxy(), get_aliaschain_attrp(), get_func_handle_var(), get_user_type(), is_callas(), is_interpreted_func(), output_typelib_regscript(), reg_typedefs(), save_all_changes(), set_doc_string(), set_guid(), set_help_context(), set_help_file_name(), set_help_string_context(), set_help_string_dll(), set_lcid(), write_args(), write_client_func_decl(), write_clientinterfacedecl(), write_coclass(), write_com_interface_end(), write_cpp_method_def(), write_descriptors(), write_function_proto(), write_function_stubs(), write_id_data_stmts(), write_implicithandledecl(), write_interface(), write_ip_tfs(), write_library(), write_method_proto(), write_parameter_conf_or_var_exprs(), write_progid(), write_remoting_arg(), write_rpc_interface_start(), write_serverinterfacedecl(), write_stubdescriptor(), write_type_tfs(), write_type_v(), write_typelib_interface(), and write_union_tfs().

◆ get_attrv()

unsigned int get_attrv ( const attr_list_t list,
enum attr_type  t 
)

Definition at line 115 of file header.c.

116 {
117  const attr_t *attr;
118  if (list) LIST_FOR_EACH_ENTRY( attr, list, const attr_t, entry )
119  if (attr->type == t) return attr->u.ival;
120  return 0;
121 }
GLdouble GLdouble t
Definition: gl.h:2047
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
Definition: cookie.c:170
__u8 attr
Definition: mkdosfs.c:359
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228

Referenced by declare_var(), get_coclass_threading(), get_pointer_fc(), init_typeinfo(), output_typelib_regscript(), set_version(), write_array_tfs(), write_clientinterfacedecl(), write_coclass(), write_dispatchtable(), write_rpc_interface_start(), write_serverinterfacedecl(), write_typelib_interface(), and yyparse().

◆ get_context_handle_offset()

unsigned int get_context_handle_offset ( const type_t type)

Definition at line 598 of file header.c.

599 {
600  context_handle_t *ch;
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 }
#define error(str)
Definition: mkdosfs.c:1605
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static type_t * type_pointer_get_ref(const type_t *type)
Definition: typetree.h:292
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
static int is_ptr(const type_t *t)
Definition: header.h:59
static int type_is_alias(const type_t *type)
Definition: typetree.h:274
GLuint index
Definition: glext.h:6031
#define index(s, c)
Definition: various.h:29
uint32_t entry
Definition: isohybrid.c:63
const char * name
Definition: widltypes.h:522
static type_t * type_alias_get_aliasee(const type_t *type)
Definition: typetree.h:279
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99

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
GLdouble GLdouble t
Definition: gl.h:2047
static enum type_basic_type type_basic_get_type(const type_t *type)
Definition: typetree.h:73
static type_t * type_pointer_get_ref(const type_t *type)
Definition: typetree.h:292
static int is_ptr(const type_t *t)
Definition: header.h:59
static int type_is_alias(const type_t *type)
Definition: typetree.h:274
smooth NULL
Definition: ftsmooth.c:416
if(!(yy_init))
Definition: macro.lex.yy.c:714
type_t * type
Definition: widltypes.h:452
static enum type_type type_get_type_detect_alias(const type_t *type)
Definition: widltypes.h:589
static type_t * type_alias_get_aliasee(const type_t *type)
Definition: typetree.h:279
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99

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 }
GLenum func
Definition: glext.h:6028
static var_list_t * type_get_function_args(const type_t *func_type)
Definition: widltypes.h:584
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
static enum type_basic_type type_basic_get_type(const type_t *type)
Definition: typetree.h:73
Definition: match.c:390
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
smooth NULL
Definition: ftsmooth.c:416
static enum type_type type_get_type(const type_t *type)
Definition: typetree.h:68
type_t * type
Definition: widltypes.h:452
attr_list_t * attrs
Definition: widltypes.h:421
attr_list_t * attrs
Definition: widltypes.h:453
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
static int is_context_handle(const type_t *type)
Definition: header.h:100
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99

Referenced by add_explicit_handle_if_necessary(), write_function_stub(), and write_proc_func_header().

◆ get_generic_handle_offset()

unsigned int get_generic_handle_offset ( const type_t type)

Definition at line 618 of file header.c.

619 {
620  generic_handle_t *gh;
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 }
#define error(str)
Definition: mkdosfs.c:1605
generic_handle_list_t generic_handle_list
Definition: header.c:44
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static type_t * type_pointer_get_ref(const type_t *type)
Definition: typetree.h:292
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
static int is_ptr(const type_t *t)
Definition: header.h:59
static int type_is_alias(const type_t *type)
Definition: typetree.h:274
GLuint index
Definition: glext.h:6031
#define index(s, c)
Definition: various.h:29
uint32_t entry
Definition: isohybrid.c:63
const char * name
Definition: widltypes.h:522
static type_t * type_alias_get_aliasee(const type_t *type)
Definition: typetree.h:279
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99

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
GLuint buffer
Definition: glext.h:5915
const GLdouble * v
Definition: gl.h:2040
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99

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 }
GLenum func
Definition: glext.h:6028
static var_list_t * type_get_function_args(const type_t *func_type)
Definition: widltypes.h:584
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
attr_list_t * attrs
Definition: widltypes.h:453
uint32_t entry
Definition: isohybrid.c:63
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
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99

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 }
GLdouble GLdouble t
Definition: gl.h:2047
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static int type_is_alias(const type_t *type)
Definition: typetree.h:274
Definition: cookie.c:170
static type_t * type_alias_get_aliasee(const type_t *type)
Definition: typetree.h:279
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99

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

◆ is_array()

◆ is_attr()

int is_attr ( const attr_list_t list,
enum attr_type  t 
)

Definition at line 99 of file header.c.

100 {
101  const attr_t *attr;
102  if (list) LIST_FOR_EACH_ENTRY( attr, list, const attr_t, entry )
103  if (attr->type == t) return 1;
104  return 0;
105 }
GLdouble GLdouble t
Definition: gl.h:2047
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
Definition: cookie.c:170
__u8 attr
Definition: mkdosfs.c:359
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228

Referenced by add_entry(), add_interface_typeinfo(), assign_stub_out_args(), check_async_uuid(), check_field_common(), check_for_additional_prototype_types(), check_functions(), check_remoting_args(), clear_output_vars(), declare_stub_args(), declare_var(), encode_type(), for_each_serializable(), get_aliaschain_attrp(), get_context_handle_offset(), get_context_handle_type_name(), get_contexthandle_flags(), get_explicit_generic_handle_type(), get_func_handle_var(), get_generic_handle_offset(), get_name(), get_parameter_fc(), get_pointer_fc_context(), get_required_buffer_size(), get_rpc_flags(), get_type_vt(), has_out_arg_or_return(), is_aliaschain_attr(), is_const_decl(), is_context_handle(), is_local(), is_ptrchain_attr(), is_string_type(), need_proxy(), output_typelib_regscript(), process_tfs_iface(), proxy_free_variables(), reg_typedefs(), typegen_detect_type(), write_client_ifaces(), write_com_interface_end(), write_com_interface_start(), write_descriptors(), write_forward_decls(), write_function_stub(), write_header_stmts(), write_id_data_stmts(), write_member_type(), write_nonsimple_pointer(), write_old_procformatstring_type(), write_proc_func_header(), write_remoting_arg(), write_serialize_functions(), write_simple_pointer(), write_type_left(), write_type_v(), write_typelib_interface(), write_union_tfs(), and yyparse().

◆ 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
GLdouble GLdouble t
Definition: gl.h:2047
static type_t * type_pointer_get_ref(const type_t *type)
Definition: typetree.h:292
static int is_ptr(const type_t *t)
Definition: header.h:59
type_t * type
Definition: widltypes.h:452
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99

Referenced by make_statement_declaration(), and 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 }
return
Definition: dirsup.c:529
GLdouble GLdouble t
Definition: gl.h:2047
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static type_t * type_pointer_get_ref(const type_t *type)
Definition: typetree.h:292
static int is_ptr(const type_t *t)
Definition: header.h:59
static int type_is_alias(const type_t *type)
Definition: typetree.h:274
if(!(yy_init))
Definition: macro.lex.yy.c:714
static type_t * type_alias_get_aliasee(const type_t *type)
Definition: typetree.h:279
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 }
GLdouble GLdouble t
Definition: gl.h:2047
static int is_ptr(const type_t *t)
Definition: header.h:59
static enum type_type type_get_type(const type_t *type)
Definition: typetree.h:68
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
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
attr_list_t * attrs
Definition: widltypes.h:421
Definition: cookie.c:170
static type_t * type_iface_get_inherit(const type_t *type)
Definition: typetree.h:158
__u8 attr
Definition: mkdosfs.c:359
uint32_t entry
Definition: isohybrid.c:63

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 }
GLdouble GLdouble t
Definition: gl.h:2047
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static type_t * type_pointer_get_ref(const type_t *type)
Definition: typetree.h:292
static int is_ptr(const type_t *t)
Definition: header.h:59
static int type_is_alias(const type_t *type)
Definition: typetree.h:274
type_t * type
Definition: widltypes.h:452
attr_list_t * attrs
Definition: widltypes.h:453
static type_t * type_alias_get_aliasee(const type_t *type)
Definition: typetree.h:279
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99

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 }
int is_aliaschain_attr(const type_t *var, enum attr_type t)
Definition: header.c:86
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static int last_array(const type_t *type)
Definition: header.h:89
static int last_ptr(const type_t *type)
Definition: header.h:84
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99

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
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static int is_array(const type_t *t)
Definition: header.h:64

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 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static type_t * type_pointer_get_ref(const type_t *type)
Definition: typetree.h:292
static int is_declptr(const type_t *t)
Definition: header.h:74
static int is_ptr(const type_t *t)
Definition: header.h:59

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 }
#define STATEMENTS_FOR_EACH_FUNC(stmt, stmts)
Definition: widltypes.h:596
GLenum func
Definition: glext.h:6028
int is_interpreted_func(const type_t *iface, const var_t *func)
Definition: typegen.c:1240
var_t * var
Definition: widltypes.h:538
enum stub_mode get_stub_mode(void)
Definition: widl.c:211
int is_local(const attr_list_t *a)
Definition: header.c:938
Definition: widl.h:87
union _statement_t::@4022 u
static statement_list_t * type_iface_get_stmts(const type_t *type)
Definition: typetree.h:151

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 }
int need_inline_stubs(const type_t *iface)
Definition: proxy.c:819
static int does_any_iface(const statement_list_t *stmts, type_pred_t pred)
Definition: proxy.c:779

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_local(const attr_list_t *a)
Definition: header.c:938
attr_list_t * attrs
Definition: widltypes.h:421
int is_object(const type_t *iface)
Definition: header.c:928
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99

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
static int does_any_iface(const statement_list_t *stmts, type_pred_t pred)
Definition: proxy.c:779

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
static int does_any_iface(const statement_list_t *stmts, type_pred_t pred)
Definition: proxy.c:779

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 }
int is_local(const attr_list_t *a)
Definition: header.c:938
attr_list_t * attrs
Definition: widltypes.h:421
int is_object(const type_t *iface)
Definition: header.c:928

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
static int does_any_iface(const statement_list_t *stmts, type_pred_t pred)
Definition: proxy.c:779

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 }
GLdouble GLdouble t
Definition: gl.h:2047
static int is_ptr(const type_t *t)
Definition: header.h:59
static int type_is_alias(const type_t *type)
Definition: typetree.h:274
static int is_array(const type_t *t)
Definition: header.h:64
static int type_array_is_decl_as_ptr(const type_t *type)
Definition: typetree.h:260

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 }
LOCAL int expr(arg_t *ap, int *altp)
Definition: match.c:512
void * get_attrp(const attr_list_t *list, enum attr_type t)
Definition: header.c:107
static void indent(FILE *h, int delta)
Definition: header.c:48
enum expr_type type
Definition: widltypes.h:307
GLuint GLuint GLsizei count
Definition: gl.h:1545
static int indentation
Definition: header.c:40
void * arg
Definition: msvc.h:12
Definition: match.c:390
Definition: query.h:86
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
int type
Definition: query.h:88
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
void write_type_decl(FILE *f, type_t *t, const char *name)
Definition: header.c:561
attr_list_t * attrs
Definition: widltypes.h:453
method
Definition: dragdrop.c:53
uint32_t entry
Definition: isohybrid.c:63
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
#define LIST_FOR_EACH_ENTRY_REV(elem, list, type, field)
Definition: list.h:222
Definition: name.c:36
unsigned short get_type_vt(type_t *t)
Definition: typelib.c:129

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 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
smooth NULL
Definition: ftsmooth.c:416
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
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99
Definition: fci.c:126

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 {
563  write_type_v(f, t, FALSE, TRUE, name);
564 }
#define TRUE
Definition: types.h:120
GLdouble GLdouble t
Definition: gl.h:2047
GLfloat f
Definition: glext.h:7540
Definition: name.c:36
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 }
#define TRUE
Definition: types.h:120
void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly)
Definition: header.c:297
GLdouble GLdouble t
Definition: gl.h:2047
GLfloat f
Definition: glext.h:7540

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++;
318  write_enums(h, type_enum_get_values(t), is_global_namespace(t->namespace) ? NULL : t->name);
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++;
331  if (type_get_type(t) != TYPE_STRUCT)
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 }
static int is_global_namespace(const struct namespace *namespace)
Definition: widltypes.h:613
#define TRUE
Definition: types.h:120
static void indent(FILE *h, int delta)
Definition: header.c:48
static var_list_t * type_struct_get_fields(const type_t *type)
Definition: typetree.h:87
static void write_pointer_left(FILE *h, type_t *ref)
Definition: header.c:288
static type_t * type_array_get_element(const type_t *type)
Definition: typetree.h:253
void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly)
Definition: header.c:297
static var_list_t * type_union_get_cases(const type_t *type)
Definition: typetree.h:134
GLdouble GLdouble t
Definition: gl.h:2047
static int indentation
Definition: header.c:40
#define assert(x)
Definition: debug.h:53
name_type
Definition: typetree.h:27
static enum type_basic_type type_basic_get_type(const type_t *type)
Definition: typetree.h:73
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
static type_t * type_pointer_get_ref(const type_t *type)
Definition: typetree.h:292
static var_list_t * type_encapsulated_union_get_fields(const type_t *type)
Definition: typetree.h:127
const char * type_get_name(const type_t *type, enum name_type name_type)
Definition: typetree.c:81
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static int is_ptr(const type_t *t)
Definition: header.h:59
static int type_is_alias(const type_t *type)
Definition: typetree.h:274
smooth NULL
Definition: ftsmooth.c:416
static var_list_t * type_enum_get_values(const type_t *type)
Definition: typetree.h:113
static type_t * type_bitfield_get_field(const type_t *type)
Definition: typetree.h:306
static enum type_type type_get_type(const type_t *type)
Definition: typetree.h:68
static void write_enums(FILE *h, var_list_t *enums, const char *enum_name)
Definition: header.c:260
static enum type_type type_get_type_detect_alias(const type_t *type)
Definition: widltypes.h:589
Definition: name.c:36
static int type_basic_get_sign(const type_t *type)
Definition: typetree.h:80
static int type_array_is_decl_as_ptr(const type_t *type)
Definition: typetree.h:260
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99
static void write_fields(FILE *h, var_list_t *fields)
Definition: header.c:197
GLuint const GLchar * name
Definition: glext.h:6031

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  {
454  if (is_conformant_array(t))
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:
471  fprintf(h, " : %u", type_bitfield_get_bits(t)->cval);
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 unsigned int type_array_get_dim(const type_t *type)
Definition: typetree.h:232
static type_t * type_array_get_element(const type_t *type)
Definition: typetree.h:253
GLdouble GLdouble t
Definition: gl.h:2047
Definition: send.c:47
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
static type_t * type_pointer_get_ref(const type_t *type)
Definition: typetree.h:292
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static size_t elem
Definition: string.c:68
static int type_is_alias(const type_t *type)
Definition: typetree.h:274
static int is_array(const type_t *t)
Definition: header.h:64
static int is_conformant_array(const type_t *t)
Definition: header.h:79
static enum type_type type_get_type(const type_t *type)
Definition: typetree.h:68
void write_type_right(FILE *h, type_t *t, int is_field)
Definition: header.c:437
static const expr_t * type_bitfield_get_bits(const type_t *type)
Definition: typetree.h:313
static int type_array_is_decl_as_ptr(const type_t *type)
Definition: typetree.h:260

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