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

This commit is contained in:
Alexandre Julliard 2010-10-16 13:51:50 +02:00
parent 63d5217fd6
commit a638c663b5
1 changed files with 33 additions and 45 deletions

View File

@ -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))
{
@ -919,6 +907,24 @@ static void write_procformatstring_stmts(FILE *file, int indent, const statement
*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)
write_procformatstring_stmts(file, indent, stmt->u.lib->stmts, pred, offset);
@ -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)