Module: wine Branch: refs/heads/master Commit: fce01e6920e2d7878d1b1017af95565272e721d9 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=fce01e6920e2d7878d1b1017...
Author: Robert Shearman rob@codeweavers.com Date: Tue Jan 24 11:06:32 2006 +0100
widl: Simplify write_typeformatstring_type. Simplify handling of types in write_typeformatstring_type by only writing non-pointer types out when ptr_level is 0. Add stubs for functions that will write out the type format string for strings and arrays.
---
tools/widl/typegen.c | 43 ++++++++++++++++++++++++++++++++++--------- 1 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 65aadf5..0c8a3b0 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -211,6 +211,21 @@ void write_procformatstring(FILE *file, print_file(file, indent, "\n"); }
+static size_t write_string_tfs(FILE *file, const attr_t *attr, + const type_t *type, const expr_t *array, + const char *name) +{ + error("write_string_tfs: Unimplemented. name: %s\n", name); + return 0; +} + +static size_t write_array_tfs(FILE *file, const attr_t *attr, + const type_t *type, const expr_t *array, + const char *name) +{ + error("write_array_tfs: Unimplemented. name: %s\n", name); + return 0; +}
static size_t write_typeformatstring_var(FILE *file, int indent, const var_t *var) @@ -220,19 +235,29 @@ static size_t write_typeformatstring_var
while (TRUE) { - if (ptr_level == 0 && type_has_ref(type)) + if (ptr_level == 0) { - type = type->ref; - continue; - } + /* follow reference if the type has one */ + if (type_has_ref(type)) + { + type = type->ref; + /* FIXME: get new ptr_level from type */ + continue; + }
- /* basic types don't need a type format string */ - if (ptr_level == 0 && !var->array && is_base_type(type->type)) - return 0; + /* basic types don't need a type format string */ + if (!var->array && is_base_type(type->type)) + return 0; + + if (is_attr(var->attrs, ATTR_STRING)) + return write_string_tfs(file, var->attrs, type, var->array, var->name);
- if ((ptr_level == 1 && !type_has_ref(type)) || - (ptr_level == 0 && var->array && !NEXT_LINK(var->array))) + if (var->array) + return write_array_tfs(file, var->attrs, type, var->array, var->name); + } + else if (ptr_level == 1 && !type_has_ref(type)) { + /* special case for pointers to base types */ switch (type->type) { #define CASE_BASETYPE(fctype) \