--- tools/widl/header.c | 24 ++++++++++++++++++++++++ tools/widl/header.h | 2 ++ tools/widl/typegen.c | 24 ------------------------ tools/widl/typegen.h | 1 - 4 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/tools/widl/header.c b/tools/widl/header.c index a3d2250..da42e95 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -119,6 +119,30 @@ int is_conformant_array(const type_t *t) return is_array(t) && type_array_has_conformance(t); }
+type_t *get_user_type(const type_t *t, const char **pname) +{ + for (;;) + { + type_t *ut = get_attrp(t->attrs, ATTR_WIREMARSHAL); + if (ut) + { + if (pname) + *pname = t->name; + return ut; + } + + if (type_is_alias(t)) + t = t->orig; + else + return 0; + } +} + +int is_user_type(const type_t *t) +{ + return get_user_type(t, NULL) != NULL; +} + void write_guid(FILE *f, const char *guid_prefix, const char *name, const UUID *uuid) { if (!uuid) return; diff --git a/tools/widl/header.h b/tools/widl/header.h index 89583e1..3f0eec1 100644 --- a/tools/widl/header.h +++ b/tools/widl/header.h @@ -32,6 +32,8 @@ extern int is_void(const type_t *t); extern int is_conformant_array(const type_t *t); extern int is_declptr(const type_t *t); extern type_t * get_deref_type(const type_t * t); +extern int is_user_type(const type_t *t); +extern type_t *get_user_type(const type_t *t, const char **pname); extern const char* get_name(const var_t *v); extern void write_type_left(FILE *h, type_t *t, int declonly); extern void write_type_right(FILE *h, type_t *t, int is_field); diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 9256bba..a7b7d0f 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -502,30 +502,6 @@ static void guard_rec(type_t *type) type->typestring_offset = 1; }
-static type_t *get_user_type(const type_t *t, const char **pname) -{ - for (;;) - { - type_t *ut = get_attrp(t->attrs, ATTR_WIREMARSHAL); - if (ut) - { - if (pname) - *pname = t->name; - return ut; - } - - if (type_is_alias(t)) - t = t->orig; - else - return 0; - } -} - -int is_user_type(const type_t *t) -{ - return get_user_type(t, NULL) != NULL; -} - static int is_embedded_complex(const type_t *type) { unsigned char tc = type->type; diff --git a/tools/widl/typegen.h b/tools/widl/typegen.h index b2c48df..f790d49 100644 --- a/tools/widl/typegen.h +++ b/tools/widl/typegen.h @@ -61,7 +61,6 @@ int decl_indirect(const type_t *t); void write_parameters_init(FILE *file, int indent, const var_t *func, const char *local_var_prefix); void print(FILE *file, int indent, const char *format, va_list ap); int get_padding(const var_list_t *fields); -int is_user_type(const type_t *t); expr_t *get_size_is_expr(const type_t *t, const char *name); int is_full_pointer_function(const var_t *func); void write_full_pointer_init(FILE *file, int indent, const var_t *func, int is_server);
2009/1/10 Michael Karcher wine@mkarcher.dialup.fu-berlin.de:
tools/widl/header.c | 24 ++++++++++++++++++++++++ tools/widl/header.h | 2 ++ tools/widl/typegen.c | 24 ------------------------ tools/widl/typegen.h | 1 - 4 files changed, 26 insertions(+), 25 deletions(-)
Although there are a lot of helper functions implemented in header.c & header.h, we shouldn't add any more. Ideally, there should be another file for these types of helper functions used for both .c and .h generation, but typegen.c is as good as any at the moment. It would be better just to move last_ptr and is_string_type into typegen.c/typegen.h, since that is where they are most used.