From: Richard Pospesel richard@torproject.org
Signed-off-by: Richard Pospesel richard@torproject.org Signed-off-by: Zebediah Figura z.figura12@gmail.com --- tools/widl/client.c | 2 +- tools/widl/header.c | 36 ++++++++++++++++---------------- tools/widl/proxy.c | 12 +++++------ tools/widl/server.c | 6 +++--- tools/widl/typegen.c | 46 ++++++++++++++++++++--------------------- tools/widl/widltypes.h | 5 ----- tools/widl/write_msft.c | 12 +++++------ 7 files changed, 57 insertions(+), 62 deletions(-)
diff --git a/tools/widl/client.c b/tools/widl/client.c index 0ab2fc60b2..3c0a0711b9 100644 --- a/tools/widl/client.c +++ b/tools/widl/client.c @@ -53,7 +53,7 @@ static void print_client( const char *format, ... ) static void write_client_func_decl( const type_t *iface, const var_t *func ) { const char *callconv = get_attrp(func->declspec.type->attrs, ATTR_CALLCONV); - const var_list_t *args = type_get_function_args(func->declspec.type); + const var_list_t *args = type_function_get_args(func->declspec.type); type_t *rettype = type_function_get_rettype(func->declspec.type);
if (!callconv) callconv = "__cdecl"; diff --git a/tools/widl/header.c b/tools/widl/header.c index 8c07564751..a862a72b52 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -863,7 +863,7 @@ const var_t *get_func_handle_var( const type_t *iface, const var_t *func, unsigned char *explicit_fc, unsigned char *implicit_fc ) { const var_t *var; - const var_list_t *args = type_get_function_args( func->declspec.type ); + const var_list_t *args = type_function_get_args( func->declspec.type );
*explicit_fc = *implicit_fc = 0; if (args) LIST_FOR_EACH_ENTRY( var, args, const var_t, entry ) @@ -907,10 +907,10 @@ int has_out_arg_or_return(const var_t *func) if (!is_void(type_function_get_rettype(func->declspec.type))) return 1;
- if (!type_get_function_args(func->declspec.type)) + if (!type_function_get_args(func->declspec.type)) return 0;
- LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry ) + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry ) if (is_attr(var->attrs, ATTR_OUT)) return 1;
@@ -1030,8 +1030,8 @@ static void write_method_macro(FILE *header, const type_t *iface, const type_t * const var_t *arg;
fprintf(header, "#define %s_%s(This", name, get_name(func)); - if (type_get_function_args(func->declspec.type)) - LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->declspec.type), const var_t, entry ) + if (type_function_get_args(func->declspec.type)) + LIST_FOR_EACH_ENTRY( arg, type_function_get_args(func->declspec.type), const var_t, entry ) fprintf(header, ",%s", arg->name); fprintf(header, ") ");
@@ -1042,8 +1042,8 @@ static void write_method_macro(FILE *header, const type_t *iface, const type_t * }
fprintf(header, "(This)->lpVtbl->%s(This", get_vtbl_entry_name(iface, func)); - if (type_get_function_args(func->declspec.type)) - LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->declspec.type), const var_t, entry ) + if (type_function_get_args(func->declspec.type)) + LIST_FOR_EACH_ENTRY( arg, type_function_get_args(func->declspec.type), const var_t, entry ) fprintf(header, ",%s", arg->name); fprintf(header, ")\n"); } @@ -1115,7 +1115,7 @@ static void write_cpp_method_def(FILE *header, const type_t *iface) const var_t *func = stmt->u.var; if (!is_callas(func->attrs)) { const char *callconv = get_attrp(func->declspec.type->attrs, ATTR_CALLCONV); - const var_list_t *args = type_get_function_args(func->declspec.type); + const var_list_t *args = type_function_get_args(func->declspec.type); const var_t *arg;
if (!callconv) callconv = "STDMETHODCALLTYPE"; @@ -1203,7 +1203,7 @@ static void write_inline_wrappers(FILE *header, const type_t *iface, const type_ fprintf(header, "static FORCEINLINE "); write_type_decl_left(header, type_function_get_rettype(func->declspec.type)); fprintf(header, " %s_%s(", name, get_name(func)); - write_args(header, type_get_function_args(func->declspec.type), name, 1, FALSE); + write_args(header, type_function_get_args(func->declspec.type), name, 1, FALSE); fprintf(header, ") {\n"); ++indentation; if (!is_aggregate_return(func)) { @@ -1218,8 +1218,8 @@ static void write_inline_wrappers(FILE *header, const type_t *iface, const type_ indent(header, 0); fprintf(header, "return *This->lpVtbl->%s(This,&__ret", get_vtbl_entry_name(iface, func)); } - if (type_get_function_args(func->declspec.type)) - LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->declspec.type), const var_t, entry ) + if (type_function_get_args(func->declspec.type)) + LIST_FOR_EACH_ENTRY( arg, type_function_get_args(func->declspec.type), const var_t, entry ) fprintf(header, ",%s", arg->name); fprintf(header, ");\n"); --indentation; @@ -1265,9 +1265,9 @@ static void do_write_c_method_def(FILE *header, const type_t *iface, const char fprintf(header, " *__ret"); } --indentation; - if (type_get_function_args(func->declspec.type)) { + if (type_function_get_args(func->declspec.type)) { fprintf(header, ",\n"); - write_args(header, type_get_function_args(func->declspec.type), name, 0, TRUE); + write_args(header, type_function_get_args(func->declspec.type), name, 0, TRUE); } fprintf(header, ");\n"); fprintf(header, "\n"); @@ -1299,7 +1299,7 @@ static void write_method_proto(FILE *header, const type_t *iface) /* proxy prototype */ write_type_decl_left(header, type_function_get_rettype(func->declspec.type)); fprintf(header, " %s %s_%s_Proxy(\n", callconv, iface->name, get_name(func)); - write_args(header, type_get_function_args(func->declspec.type), iface->name, 1, TRUE); + write_args(header, type_function_get_args(func->declspec.type), iface->name, 1, TRUE); fprintf(header, ");\n"); /* stub prototype */ fprintf(header, "void __RPC_STUB %s_%s_Stub(\n", iface->name, get_name(func)); @@ -1334,7 +1334,7 @@ static void write_locals(FILE *fp, const type_t *iface, int body) /* proxy prototype - use local prototype */ write_type_decl_left(fp, type_function_get_rettype(m->declspec.type)); fprintf(fp, " CALLBACK %s_%s_Proxy(\n", iface->name, get_name(m)); - write_args(fp, type_get_function_args(m->declspec.type), iface->name, 1, TRUE); + write_args(fp, type_function_get_args(m->declspec.type), iface->name, 1, TRUE); fprintf(fp, ")"); if (body) { type_t *rt = type_function_get_rettype(m->declspec.type); @@ -1356,7 +1356,7 @@ static void write_locals(FILE *fp, const type_t *iface, int body) /* stub prototype - use remotable prototype */ write_type_decl_left(fp, type_function_get_rettype(func->declspec.type)); fprintf(fp, " __RPC_STUB %s_%s_Stub(\n", iface->name, get_name(m)); - write_args(fp, type_get_function_args(func->declspec.type), iface->name, 1, TRUE); + write_args(fp, type_function_get_args(func->declspec.type), iface->name, 1, TRUE); fprintf(fp, ")"); if (body) /* Remotable methods must all return HRESULTs. */ @@ -1409,8 +1409,8 @@ static void write_function_proto(FILE *header, const type_t *iface, const var_t write_type_decl_left(header, type_function_get_rettype(fun->declspec.type)); fprintf(header, " %s ", callconv); fprintf(header, "%s%s(\n", prefix, get_name(fun)); - if (type_get_function_args(fun->declspec.type)) - write_args(header, type_get_function_args(fun->declspec.type), iface->name, 0, TRUE); + if (type_function_get_args(fun->declspec.type)) + write_args(header, type_function_get_args(fun->declspec.type), iface->name, 0, TRUE); else fprintf(header, " void"); fprintf(header, ");\n\n"); diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c index 45e25826d7..6f19ff15df 100644 --- a/tools/widl/proxy.c +++ b/tools/widl/proxy.c @@ -195,7 +195,7 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx, int has_ret = !is_void(retval->declspec.type); int has_full_pointer = is_full_pointer_function(func); const char *callconv = get_attrp(func->declspec.type->attrs, ATTR_CALLCONV); - const var_list_t *args = type_get_function_args(func->declspec.type); + const var_list_t *args = type_function_get_args(func->declspec.type); if (!callconv) callconv = "STDMETHODCALLTYPE";
indent = 0; @@ -246,7 +246,7 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx, write_full_pointer_init(proxy, indent, func, FALSE);
/* FIXME: trace */ - clear_output_vars( type_get_function_args(func->declspec.type) ); + clear_output_vars( type_function_get_args(func->declspec.type) );
print_proxy( "RpcTryExcept\n" ); print_proxy( "{\n" ); @@ -301,7 +301,7 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx, print_proxy( "{\n" ); if (has_ret) { indent++; - proxy_free_variables( type_get_function_args(func->declspec.type), "" ); + proxy_free_variables( type_function_get_args(func->declspec.type), "" ); print_proxy( "_RetVal = NdrProxyErrorHandler(RpcExceptionCode());\n" ); indent--; } @@ -389,9 +389,9 @@ static void gen_stub(type_t *iface, const var_t *func, const char *cas, else fprintf(proxy, "__frame->_This->lpVtbl->%s", get_name(func)); fprintf(proxy, "(__frame->_This");
- if (type_get_function_args(func->declspec.type)) + if (type_function_get_args(func->declspec.type)) { - LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->declspec.type), const var_t, entry ) + LIST_FOR_EACH_ENTRY( arg, type_function_get_args(func->declspec.type), const var_t, entry ) fprintf(proxy, ", %s__frame->%s", is_array(arg->declspec.type) && !type_array_is_decl_as_ptr(arg->declspec.type) ? "*" :"" , arg->name); } fprintf(proxy, ");\n"); @@ -434,7 +434,7 @@ static void gen_stub_thunk( type_t *iface, const var_t *func, unsigned int proc_ { int has_ret = !is_void( type_function_get_rettype( func->declspec.type )); const var_t *arg, *callas = is_callas( func->attrs ); - const var_list_t *args = type_get_function_args( func->declspec.type ); + const var_list_t *args = type_function_get_args( func->declspec.type );
indent = 0; print_proxy( "void __RPC_API %s_%s_Thunk( PMIDL_STUB_MESSAGE pStubMsg )\n", diff --git a/tools/widl/server.c b/tools/widl/server.c index 156cd3c2f9..1ab305950a 100644 --- a/tools/widl/server.c +++ b/tools/widl/server.c @@ -121,7 +121,7 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned if (has_full_pointer) write_full_pointer_init(server, indent, func, TRUE);
- if (type_get_function_args(func->declspec.type)) + if (type_function_get_args(func->declspec.type)) { print_server("if ((_pRpcMessage->DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n"); indent++; @@ -166,13 +166,13 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned print_server("%s", is_void(ret_type) ? "" : "__frame->_RetVal = "); fprintf(server, "%s%s", prefix_server, get_name(func));
- if (type_get_function_args(func->declspec.type)) + if (type_function_get_args(func->declspec.type)) { int first_arg = 1;
fprintf(server, "(\n"); indent++; - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry ) + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry ) { if (first_arg) first_arg = 0; diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index f901f83d1e..86611aed68 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -912,10 +912,10 @@ void write_parameters_init(FILE *file, int indent, const var_t *func, const char if (!is_void(var->declspec.type)) write_var_init(file, indent, var->declspec.type, var->name, local_var_prefix);
- if (!type_get_function_args(func->declspec.type)) + if (!type_function_get_args(func->declspec.type)) return;
- LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry ) + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry ) write_var_init(file, indent, var->declspec.type, var->name, local_var_prefix);
fprintf(file, "\n"); @@ -1128,7 +1128,7 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned static unsigned char get_func_oi2_flags( const var_t *func ) { const var_t *var; - var_list_t *args = type_get_function_args( func->declspec.type ); + var_list_t *args = type_function_get_args( func->declspec.type ); var_t *retval = type_function_get_retval( func->declspec.type ); unsigned char oi2_flags = 0x40; /* HasExtensions */ unsigned short flags; @@ -1254,7 +1254,7 @@ int is_interpreted_func( const type_t *iface, const var_t *func ) { const char *str; const var_t *var; - const var_list_t *args = type_get_function_args( func->declspec.type ); + const var_list_t *args = type_function_get_args( func->declspec.type ); const type_t *ret_type = type_function_get_rettype( func->declspec.type );
if (type_get_type( ret_type ) == TYPE_BASIC) @@ -1305,7 +1305,7 @@ static void write_proc_func_header( FILE *file, int indent, const type_t *iface, unsigned short num_proc ) { var_t *var; - var_list_t *args = type_get_function_args( func->declspec.type ); + var_list_t *args = type_function_get_args( func->declspec.type ); unsigned char explicit_fc, implicit_fc; unsigned char handle_flags; const var_t *handle_var = get_func_handle_var( iface, func, &explicit_fc, &implicit_fc ); @@ -1445,10 +1445,10 @@ static void write_procformatstring_func( FILE *file, int indent, const type_t *i if (is_interpreted) write_proc_func_header( file, indent, iface, func, offset, num_proc );
/* emit argument data */ - if (type_get_function_args(func->declspec.type)) + if (type_function_get_args(func->declspec.type)) { const var_t *var; - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry ) + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry ) { print_file( file, 0, "/* %u (parameter %s) */\n", *offset, var->name ); if (is_new_style) @@ -1669,7 +1669,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
if (type_get_type(cont_type) == TYPE_FUNCTION) { - var_list_t *args = type_get_function_args( cont_type ); + var_list_t *args = type_function_get_args( cont_type );
if (is_object( iface )) offset += pointer_size; if (args) LIST_FOR_EACH_ENTRY( var, args, const var_t, entry ) @@ -2079,9 +2079,9 @@ int is_full_pointer_function(const var_t *func) const var_t *var; if (type_has_full_pointer(type_function_get_rettype(func->declspec.type), func->attrs, TRUE)) return TRUE; - if (!type_get_function_args(func->declspec.type)) + if (!type_function_get_args(func->declspec.type)) return FALSE; - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry ) + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry ) if (type_has_full_pointer( var->declspec.type, var->attrs, TRUE )) return TRUE; return FALSE; @@ -3711,8 +3711,8 @@ static void process_tfs_iface(type_t *iface, FILE *file, int indent, unsigned in var->typestring_offset = write_type_tfs( file, var->attrs, var->declspec.type, func->name, TYPE_CONTEXT_RETVAL, offset);
- if (type_get_function_args(func->declspec.type)) - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), var_t, entry ) + if (type_function_get_args(func->declspec.type)) + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), var_t, entry ) var->typestring_offset = write_type_tfs( file, var->attrs, var->declspec.type, var->name, TYPE_CONTEXT_TOPLEVELPARAM, offset ); break; @@ -3911,9 +3911,9 @@ static unsigned int get_function_buffer_size( const var_t *func, enum pass pass const var_t *var; unsigned int total_size = 0, alignment;
- if (type_get_function_args(func->declspec.type)) + if (type_function_get_args(func->declspec.type)) { - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry ) + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry ) { total_size += get_required_buffer_size(var, &alignment, pass); total_size += alignment; @@ -4561,9 +4561,9 @@ void write_remoting_arguments(FILE *file, int indent, const var_t *func, const c else { const var_t *var; - if (!type_get_function_args(func->declspec.type)) + if (!type_function_get_args(func->declspec.type)) return; - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry ) + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry ) write_remoting_arg( file, indent, func, local_var_prefix, pass, phase, var ); } } @@ -4619,10 +4619,10 @@ void declare_stub_args( FILE *file, int indent, const var_t *func ) } }
- if (!type_get_function_args(func->declspec.type)) + if (!type_function_get_args(func->declspec.type)) return;
- LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry ) + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry ) { in_attr = is_attr(var->attrs, ATTR_IN); out_attr = is_attr(var->attrs, ATTR_OUT); @@ -4673,10 +4673,10 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char const var_t *var; type_t *ref;
- if (!type_get_function_args(func->declspec.type)) + if (!type_function_get_args(func->declspec.type)) return;
- LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry ) + LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry ) { in_attr = is_attr(var->attrs, ATTR_IN); out_attr = is_attr(var->attrs, ATTR_OUT); @@ -4783,7 +4783,7 @@ void write_func_param_struct( FILE *file, const type_t *iface, const type_t *fun const char *var_decl, int add_retval ) { var_t *retval = type_function_get_retval( func ); - const var_list_t *args = type_get_function_args( func ); + const var_list_t *args = type_function_get_args( func ); const var_t *arg; int needs_packing; unsigned int align = 0; @@ -4833,7 +4833,7 @@ void write_func_param_struct( FILE *file, const type_t *iface, const type_t *fun
void write_pointer_checks( FILE *file, int indent, const var_t *func ) { - const var_list_t *args = type_get_function_args( func->declspec.type ); + const var_list_t *args = type_function_get_args( func->declspec.type ); const var_t *var;
if (!args) return; @@ -4965,7 +4965,7 @@ void write_client_call_routine( FILE *file, const type_t *iface, const var_t *fu { type_t *rettype = type_function_get_rettype( func->declspec.type ); int has_ret = !is_void( rettype ); - const var_list_t *args = type_get_function_args( func->declspec.type ); + const var_list_t *args = type_function_get_args( func->declspec.type ); const var_t *arg; int len, needs_params = 0;
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h index bd727f70b6..729d712a27 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -589,11 +589,6 @@ void init_loc_info(loc_info_t *);
char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix);
-static inline var_list_t *type_get_function_args(const type_t *func_type) -{ - return func_type->details.function->args; -} - static inline enum type_type type_get_type_detect_alias(const type_t *type) { if (type->is_alias) diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c index 9a3edf7291..98fa7ddadf 100644 --- a/tools/widl/write_msft.c +++ b/tools/widl/write_msft.c @@ -1301,8 +1301,8 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index) return S_FALSE; }
- if (type_get_function_args(func->declspec.type)) - LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->declspec.type), var_t, entry ) + if (type_function_get_args(func->declspec.type)) + LIST_FOR_EACH_ENTRY( arg, type_function_get_args(func->declspec.type), var_t, entry ) { num_params++; if (arg->attrs) LIST_FOR_EACH_ENTRY( attr, arg->attrs, const attr_t, entry ) { @@ -1471,10 +1471,10 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index) warning("unknown number of optional attrs\n"); }
- if (type_get_function_args(func->declspec.type)) + if (type_function_get_args(func->declspec.type)) { i = 0; - LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->declspec.type), var_t, entry ) + LIST_FOR_EACH_ENTRY( arg, type_function_get_args(func->declspec.type), var_t, entry ) { int paramflags = 0; int *paramdata = typedata + 6 + extra_attr + (num_defaults ? num_params : 0) + i * 3; @@ -1572,10 +1572,10 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index) if(typeinfo->typekind == TKIND_MODULE) namedata[9] |= 0x20;
- if (type_get_function_args(func->declspec.type)) + if (type_function_get_args(func->declspec.type)) { i = 0; - LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->declspec.type), var_t, entry ) + LIST_FOR_EACH_ENTRY( arg, type_function_get_args(func->declspec.type), var_t, entry ) { /* don't give the last arg of a [propput*] func a name */ if(i != num_params - 1 || (invokekind != 0x4 /* INVOKE_PROPERTYPUT */ && invokekind != 0x8 /* INVOKE_PROPERTYPUTREF */))