widl: Export a function to compute the proc format string size for a function.
This commit is contained in:
parent
6655071a3f
commit
6dd5afd723
@ -270,15 +270,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
|||||||
fprintf(server, "\n");
|
fprintf(server, "\n");
|
||||||
|
|
||||||
/* update proc_offset */
|
/* update proc_offset */
|
||||||
if (func->args)
|
*proc_offset += get_size_procformatstring_func( func );
|
||||||
{
|
|
||||||
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 */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
size_t get_size_typeformatstring_var(const var_t *var)
|
||||||
{
|
{
|
||||||
unsigned int type_offset = 0;
|
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;
|
const ifref_t *iface;
|
||||||
size_t size = 1;
|
size_t size = 1;
|
||||||
const func_t *func;
|
const func_t *func;
|
||||||
const var_t *var;
|
|
||||||
|
|
||||||
if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, const ifref_t, entry )
|
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;
|
continue;
|
||||||
|
|
||||||
if (iface->iface->funcs)
|
if (iface->iface->funcs)
|
||||||
{
|
|
||||||
LIST_FOR_EACH_ENTRY( func, iface->iface->funcs, const func_t, entry )
|
LIST_FOR_EACH_ENTRY( func, iface->iface->funcs, const func_t, entry )
|
||||||
{
|
if (!is_local(func->def->attrs))
|
||||||
/* argument list size */
|
size += get_size_procformatstring_func( func );
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
@ -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 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);
|
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_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_typeformatstring_var(const var_t *var);
|
||||||
size_t get_size_procformatstring(const ifref_list_t *ifaces, int for_objects);
|
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);
|
size_t get_size_typeformatstring(const ifref_list_t *ifaces, int for_objects);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user