widl: Export a function to compute the proc format string size for a function.

This commit is contained in:
Alexandre Julliard 2007-01-24 20:05:22 +01:00
parent 6655071a3f
commit 6dd5afd723
3 changed files with 23 additions and 25 deletions

View File

@ -270,15 +270,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
fprintf(server, "\n");
/* update proc_offset */
if (func->args)
{
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
*proc_offset += get_size_procformatstring_var(var);
}
if (!is_void(def->type, NULL))
*proc_offset += get_size_procformatstring_var(def);
else
*proc_offset += 2; /* FC_END and FC_PAD */
*proc_offset += get_size_procformatstring_func( func );
}
}

View File

@ -1971,6 +1971,25 @@ size_t get_size_procformatstring_var(const var_t *var)
}
size_t get_size_procformatstring_func(const func_t *func)
{
const var_t *var;
size_t size = 0;
/* argument list size */
if (func->args)
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
size += get_size_procformatstring_var(var);
/* return value size */
if (is_void(func->def->type, NULL))
size += 2; /* FC_END and FC_PAD */
else
size += get_size_procformatstring_var(func->def);
return size;
}
size_t get_size_typeformatstring_var(const var_t *var)
{
unsigned int type_offset = 0;
@ -1983,7 +2002,6 @@ size_t get_size_procformatstring(const ifref_list_t *ifaces, int for_objects)
const ifref_t *iface;
size_t size = 1;
const func_t *func;
const var_t *var;
if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, const ifref_t, entry )
{
@ -1991,22 +2009,9 @@ size_t get_size_procformatstring(const ifref_list_t *ifaces, int for_objects)
continue;
if (iface->iface->funcs)
{
LIST_FOR_EACH_ENTRY( func, iface->iface->funcs, const func_t, entry )
{
/* argument list size */
if (func->args)
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
size += get_size_procformatstring_var(var);
var = func->def;
/* return value size */
if (is_void(var->type, NULL))
size += 2;
else
size += get_size_procformatstring_var(var);
}
}
if (!is_local(func->def->attrs))
size += get_size_procformatstring_func( func );
}
return size;
}

View File

@ -42,6 +42,7 @@ size_t get_type_memsize(const type_t *type);
void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, enum pass pass, const var_t *var, const char *varname);
void write_remoting_arguments(FILE *file, int indent, const func_t *func, unsigned int *type_offset, enum pass pass, enum remoting_phase phase);
size_t get_size_procformatstring_var(const var_t *var);
size_t get_size_procformatstring_func(const func_t *func);
size_t get_size_typeformatstring_var(const var_t *var);
size_t get_size_procformatstring(const ifref_list_t *ifaces, int for_objects);
size_t get_size_typeformatstring(const ifref_list_t *ifaces, int for_objects);