Commit 53e54833 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

widl: Introduce for_each_iface helper and use it in write_procformatstring.

parent 069d7b02
...@@ -1465,27 +1465,34 @@ static void write_procformatstring_func( FILE *file, int indent, const type_t *i ...@@ -1465,27 +1465,34 @@ static void write_procformatstring_func( FILE *file, int indent, const type_t *i
} }
} }
static void write_procformatstring_stmts(FILE *file, int indent, const statement_list_t *stmts, static void for_each_iface(const statement_list_t *stmts,
type_pred_t pred, unsigned int *offset) void (*proc)(type_t *iface, FILE *file, int indent, unsigned int *offset),
type_pred_t pred, FILE *file, int indent, unsigned int *offset)
{ {
const statement_t *stmt; const statement_t *stmt;
type_t *iface;
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry ) if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
{ {
if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE) if (stmt->type != STMT_TYPE || type_get_type(stmt->u.type) != TYPE_INTERFACE)
{ continue;
const statement_t *stmt_func; iface = stmt->u.type;
const type_t *iface = stmt->u.type; if (!pred(iface)) continue;
const type_t *parent = type_iface_get_inherit( iface ); proc(iface, file, indent, offset);
int count = parent ? count_methods( parent ) : 0; }
}
if (!pred(iface)) continue; static void write_iface_procformatstring(type_t *iface, FILE *file, int indent, unsigned int *offset)
STATEMENTS_FOR_EACH_FUNC(stmt_func, type_iface_get_stmts(iface)) {
{ const statement_t *stmt;
var_t *func = stmt_func->u.var; const type_t *parent = type_iface_get_inherit( iface );
if (is_local(func->attrs)) continue; int count = parent ? count_methods( parent ) : 0;
write_procformatstring_func( file, indent, iface, func, offset, count++ );
} STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface))
} {
var_t *func = stmt->u.var;
if (is_local(func->attrs)) continue;
write_procformatstring_func( file, indent, iface, func, offset, count++ );
} }
} }
...@@ -1501,7 +1508,7 @@ void write_procformatstring(FILE *file, const statement_list_t *stmts, type_pred ...@@ -1501,7 +1508,7 @@ void write_procformatstring(FILE *file, const statement_list_t *stmts, type_pred
print_file(file, indent, "{\n"); print_file(file, indent, "{\n");
indent++; indent++;
write_procformatstring_stmts(file, indent, stmts, pred, &offset); for_each_iface(stmts, write_iface_procformatstring, pred, file, indent, &offset);
print_file(file, indent, "0x0\n"); print_file(file, indent, "0x0\n");
indent--; indent--;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment