From fa4b053e1b708fcf7e7cfa47f6f99e79a38fbfdd Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=B6tz=20Lindenmaier?= Date: Tue, 28 Sep 2004 07:56:06 +0000 Subject: [PATCH] interface for configuration added (Michael) [r3971] --- ir/tr/type_identify.c | 6 +++--- ir/tr/type_identify.h | 20 +++++++++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ir/tr/type_identify.c b/ir/tr/type_identify.c index 499fcec5a..7b4525444 100644 --- a/ir/tr/type_identify.c +++ b/ir/tr/type_identify.c @@ -116,9 +116,9 @@ type *mature_type_free_entities(type *tp) { } /* initialize this module */ -void init_type_identify(compare_types_func_t *cmp, hash_types_func_t *hash) { - compare_types_func = cmp ? cmp : compare_strict; - hash_types_func = hash ? hash : hash_name; +void init_type_identify(type_identify_if_t *ti_if) { + compare_types_func = ti_if && ti_if->cmp ? ti_if->cmp : compare_strict; + hash_types_func = ti_if && ti_if->hash ? ti_if->hash : hash_name; type_table = new_pset (compare_types_func, 8); } diff --git a/ir/tr/type_identify.h b/ir/tr/type_identify.h index c4a4be395..17518b50c 100644 --- a/ir/tr/type_identify.h +++ b/ir/tr/type_identify.h @@ -111,14 +111,24 @@ type * mature_type_free(type *tp); */ type * mature_type_free_entities(type *tp); +/** + * The interface type for the type identify module; + */ +typedef struct _type_identify_if_t { + compare_types_func_t *cmp; /**< The function that should be used to compare two types. + If NULL, compare_strict() will be used. */ + hash_types_func_t *hash; /**< The function that should be used to calculate a hash + value of a type. If NULL, hash_name() will be used. */ +} type_identify_if_t; + /** * Initialise the type identifier module. * - * @param cmp The function that should be used to compare two types. - * If NULL, compare_strict() will be used. - * @param hash The function that should be used to calculate a hash - * value of a type. If NULL, hash_name() will be used. + * @param ti_if The interface functions for this module. + * + * If the parameter ti_if is NULL, the default functions compare_strict() and + * hash_name() will be used. */ -void init_type_identify(compare_types_func_t *cmp, hash_types_func_t *hash); +void init_type_identify(type_identify_if_t *ti_if); # endif /* _TYPE_IDENTIFY_H_ */ -- 2.20.1