On 2/25/21 2:34 PM, Jacek Caban wrote:
Hi Rémi,
On 22.02.2021 10:02, Rémi Bernon wrote:
+static void write_widl_using_method_macros(FILE *header, const type_t *iface, const type_t *top_iface) +{ + const statement_t *stmt; + const char *name = top_iface->short_name ? top_iface->short_name : top_iface->name;
+ if (type_iface_get_inherit(iface)) write_widl_using_method_macros(header, type_iface_get_inherit(iface), top_iface);
+ STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface)) + { + const var_t *func = stmt->u.var; + const char *func_name;
+ if (is_override_method(iface, top_iface, func)) continue; + if (is_callas(func->attrs)) continue;
+ func_name = get_name(func); + fprintf(header, "#define %s_%s %s_%s\n", name, func_name, top_iface->c_name, func_name); + } +}
+static char *format_widl_using_macro(const type_t *type) +{ + char *name = format_namespace(type->namespace, "WIDL_USING_", "_", "", NULL); + int i = strlen(name); + if (i) name[i - 1] = 0; /* remove trailing underscore */
Not a big deal, but maybe the helper should take care of that instead? For example NULL suffix could case the separator not to be appended.
Sure.
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h index 81646cae1d1..bedba40d903 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -504,6 +504,7 @@ struct _type_t { const char *c_name; const char *signature; const char *qualified_name; + const char *short_name; unsigned int typestring_offset; unsigned int ptrdesc; /* used for complex structs */ int typelib_idx;
Do you expect it to use useful outside void write_widl_using_macros()? It looks like something specific to that, so maybe we could just generate it there, when needed.
I'm not sure if we can do that easily there, as we don't have anymore the knowledge of which type was parameterized and which not. I'll probably keep it like this.
Thanks,
Jacek
Rémi Bernon rbernon@codeweavers.com