widl: Output some comments for proc format strings.

oldstable
Alexandre Julliard 2010-10-16 12:37:39 +02:00
parent 226e963429
commit 63d5217fd6
2 changed files with 21 additions and 12 deletions

View File

@ -823,7 +823,6 @@ int decl_indirect(const type_t *t)
}
static unsigned int write_procformatstring_type(FILE *file, int indent,
const char *name,
const type_t *type,
const attr_list_t *attrs,
int is_return)
@ -873,13 +872,15 @@ static unsigned int write_procformatstring_type(FILE *file, int indent,
print_file(file, indent, "0x4d, /* FC_IN_PARAM */\n");
print_file(file, indent, "0x01,\n");
print_file(file, indent, "NdrFcShort(0x%hx),\n", (unsigned short)type->typestring_offset);
print_file(file, indent, "NdrFcShort(0x%x), /* type offset = %u */\n",
type->typestring_offset, type->typestring_offset);
size = 4; /* includes param type prefix */
}
return size;
}
static void write_procformatstring_stmts(FILE *file, int indent, const statement_list_t *stmts, type_pred_t pred)
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 )
@ -898,27 +899,36 @@ static void write_procformatstring_stmts(FILE *file, int indent, const statement
{
const var_t *var;
LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
write_procformatstring_type(file, indent, var->name, var->type, var->attrs, FALSE);
{
print_file( file, 0, "/* %u (parameter %s) */\n", *offset, var->name );
*offset += write_procformatstring_type(file, indent, var->type, var->attrs, FALSE);
}
}
/* emit return value data */
if (is_void(type_function_get_rettype(func->type)))
{
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;
}
else
write_procformatstring_type(file, indent, "return value", type_function_get_rettype(func->type), NULL, TRUE);
{
print_file( file, 0, "/* %u (return value) */\n", *offset );
*offset += write_procformatstring_type(file, indent, type_function_get_rettype(func->type), NULL, TRUE);
}
}
}
else if (stmt->type == STMT_LIBRARY)
write_procformatstring_stmts(file, indent, stmt->u.lib->stmts, pred);
write_procformatstring_stmts(file, indent, stmt->u.lib->stmts, pred, offset);
}
}
void write_procformatstring(FILE *file, const statement_list_t *stmts, type_pred_t pred)
{
int indent = 0;
unsigned int offset = 0;
print_file(file, indent, "static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =\n");
print_file(file, indent, "{\n");
@ -927,7 +937,7 @@ void write_procformatstring(FILE *file, const statement_list_t *stmts, type_pred
print_file(file, indent, "{\n");
indent++;
write_procformatstring_stmts(file, indent, stmts, pred);
write_procformatstring_stmts(file, indent, stmts, pred, &offset);
print_file(file, indent, "0x0\n");
indent--;
@ -3857,9 +3867,9 @@ void write_remoting_arguments(FILE *file, int indent, const var_t *func, const c
}
unsigned int get_size_procformatstring_type(const char *name, const type_t *type, const attr_list_t *attrs)
static unsigned int get_size_procformatstring_type(const type_t *type, const attr_list_t *attrs)
{
return write_procformatstring_type(NULL, 0, name, type, attrs, FALSE);
return write_procformatstring_type(NULL, 0, type, attrs, FALSE);
}
@ -3871,13 +3881,13 @@ unsigned int get_size_procformatstring_func(const var_t *func)
/* 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->name, var->type, var->attrs);
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("return value", type_function_get_rettype(func->type), NULL);
size += get_size_procformatstring_type(type_function_get_rettype(func->type), NULL);
return size;
}

View File

@ -69,7 +69,6 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
enum pass pass, const var_t *var, const char *varname);
void write_remoting_arguments(FILE *file, int indent, const var_t *func, const char *local_var_prefix,
enum pass pass, enum remoting_phase phase);
unsigned int get_size_procformatstring_type(const char *name, const type_t *type, const attr_list_t *attrs);
unsigned int get_size_procformatstring_func(const var_t *func);
unsigned int get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred);
unsigned int get_size_typeformatstring(const statement_list_t *stmts, type_pred_t pred);