Commit a638c663 authored by Alexandre Julliard's avatar Alexandre Julliard

widl: Add a separate function to write the proc format string for a function.

parent 63d5217f
......@@ -879,21 +879,9 @@ static unsigned int write_procformatstring_type(FILE *file, int indent,
return size;
}
static void write_procformatstring_stmts(FILE *file, int indent, const statement_list_t *stmts,
type_pred_t pred, unsigned int *offset)
static void write_procformatstring_func( FILE *file, int indent,
const var_t *func, unsigned int *offset )
{
const statement_t *stmt;
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)
{
const statement_t *stmt_func;
if (!pred(stmt->u.type))
continue;
STATEMENTS_FOR_EACH_FUNC(stmt_func, type_iface_get_stmts(stmt->u.type))
{
const var_t *func = stmt_func->u.var;
if (is_local(func->attrs)) continue;
/* emit argument data */
if (type_get_function_args(func->type))
{
......@@ -908,7 +896,7 @@ static void write_procformatstring_stmts(FILE *file, int indent, const statement
/* emit return value data */
if (is_void(type_function_get_rettype(func->type)))
{
print_file( file, 0, "/* %u (void) */\n", *offset );
print_file(file, 0, "/* %u (void) */\n", *offset);
print_file(file, indent, "0x5b, /* FC_END */\n");
print_file(file, indent, "0x5c, /* FC_PAD */\n");
*offset += 2;
......@@ -918,6 +906,24 @@ static void write_procformatstring_stmts(FILE *file, int indent, const statement
print_file( file, 0, "/* %u (return value) */\n", *offset );
*offset += write_procformatstring_type(file, indent, type_function_get_rettype(func->type), NULL, TRUE);
}
}
static void write_procformatstring_stmts(FILE *file, int indent, const statement_list_t *stmts,
type_pred_t pred, unsigned int *offset)
{
const statement_t *stmt;
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)
{
const statement_t *stmt_func;
if (!pred(stmt->u.type))
continue;
STATEMENTS_FOR_EACH_FUNC(stmt_func, type_iface_get_stmts(stmt->u.type))
{
const var_t *func = stmt_func->u.var;
if (is_local(func->attrs)) continue;
write_procformatstring_func( file, indent, func, offset );
}
}
else if (stmt->type == STMT_LIBRARY)
......@@ -3867,29 +3873,11 @@ void write_remoting_arguments(FILE *file, int indent, const var_t *func, const c
}
static unsigned int get_size_procformatstring_type(const type_t *type, const attr_list_t *attrs)
{
return write_procformatstring_type(NULL, 0, type, attrs, FALSE);
}
unsigned int get_size_procformatstring_func(const var_t *func)
{
const var_t *var;
unsigned int size = 0;
/* argument list size */
if (type_get_function_args(func->type))
LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
size += get_size_procformatstring_type(var->type, var->attrs);
/* return value size */
if (is_void(type_function_get_rettype(func->type)))
size += 2; /* FC_END and FC_PAD */
else
size += get_size_procformatstring_type(type_function_get_rettype(func->type), NULL);
return size;
unsigned int offset = 0;
write_procformatstring_func( NULL, 0, func, &offset );
return offset;
}
unsigned int get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred)
......
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