Module: wine Branch: master Commit: 5483ea9e87e00361a09ed65997162b87c1f1d3d3 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5483ea9e87e00361a09ed65997...
Author: Rob Shearman rob@codeweavers.com Date: Fri Apr 11 11:01:36 2008 +0100
widl: Support non-default calling conventions for object methods.
---
tools/widl/header.c | 12 +++++++++--- tools/widl/proxy.c | 4 +++- 2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/tools/widl/header.c b/tools/widl/header.c index a568bb4..03e5a50 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -729,10 +729,12 @@ static void write_cpp_method_def(const type_t *iface) { var_t *def = cur->def; if (!is_callas(def->attrs)) { + const char *callconv = get_attrp(def->type->attrs, ATTR_CALLCONV); + if (!callconv) callconv = ""; indent(header, 0); fprintf(header, "virtual "); write_type_decl_left(header, get_func_return_type(cur)); - fprintf(header, " STDMETHODCALLTYPE "); + fprintf(header, " %s ", callconv); write_name(header, def); fprintf(header, "(\n"); write_args(header, cur->args, iface->name, 2, TRUE); @@ -755,9 +757,11 @@ static void do_write_c_method_def(const type_t *iface, const char *name) { const var_t *def = cur->def; if (!is_callas(def->attrs)) { + const char *callconv = get_attrp(def->type->attrs, ATTR_CALLCONV); + if (!callconv) callconv = ""; indent(header, 0); write_type_decl_left(header, get_func_return_type(cur)); - fprintf(header, " (STDMETHODCALLTYPE *"); + fprintf(header, " (%s *", callconv); write_name(header, def); fprintf(header, ")(\n"); write_args(header, cur->args, name, 1, TRUE); @@ -787,9 +791,11 @@ static void write_method_proto(const type_t *iface) const var_t *def = cur->def;
if (!is_local(def->attrs)) { + const char *callconv = get_attrp(def->type->attrs, ATTR_CALLCONV); + if (!callconv) callconv = ""; /* proxy prototype */ write_type_decl_left(header, get_func_return_type(cur)); - fprintf(header, " CALLBACK %s_", iface->name); + fprintf(header, " %s %s_", callconv, iface->name); write_name(header, def); fprintf(header, "_Proxy(\n"); write_args(header, cur->args, iface->name, 1, TRUE); diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c index a9710b2..e0864f8 100644 --- a/tools/widl/proxy.c +++ b/tools/widl/proxy.c @@ -253,10 +253,12 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx, var_t *def = cur->def; int has_ret = !is_void(get_func_return_type(cur)); int has_full_pointer = is_full_pointer_function(cur); + const char *callconv = get_attrp(def->type->attrs, ATTR_CALLCONV); + if (!callconv) callconv = "";
indent = 0; write_type_decl_left(proxy, get_func_return_type(cur)); - print_proxy( " STDMETHODCALLTYPE %s_", iface->name); + print_proxy( " %s %s_", callconv, iface->name); write_name(proxy, def); print_proxy( "_Proxy(\n"); write_args(proxy, cur->args, iface->name, 1, TRUE);