From e466394be4f19efb3cc3853c6f86b36a795eceb1 Mon Sep 17 00:00:00 2001 From: tomo Date: Wed, 27 Jul 2005 18:25:25 +0000 Subject: [PATCH] (concord_ds_set_object_failure): Renamed from `concord_ds_set_object_nil'. (concord_genre_get_feature_0): New function. (concord_genre_get_feature): New implementation; use `concord_genre_get_feature_0'; support feature alias. --- concord.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/concord.c b/concord.c index c08f10c..7fc75a3 100644 --- a/concord.c +++ b/concord.c @@ -57,6 +57,9 @@ int concord_close_feature (CONCORD_Feature feature); CONCORD_INDEX concord_genre_open_index (CONCORD_Genre genre, const unsigned char* index); +CONCORD_Feature +concord_genre_get_feature_0 (CONCORD_Genre genre, const unsigned char* name); + int concord_close_index (CONCORD_INDEX table); @@ -140,7 +143,7 @@ concord_ds_location (CONCORD_DS ds) } int -concord_ds_set_object_nil (CONCORD_DS ds, CONCORD_Object object_nil) +concord_ds_set_object_failure (CONCORD_DS ds, CONCORD_Object object_nil) { ds->object_nil = object_nil; return 0; @@ -447,7 +450,7 @@ concord_genre_foreach_feature_name (CONCORD_Genre genre, } CONCORD_Feature -concord_genre_get_feature (CONCORD_Genre genre, const unsigned char* name) +concord_genre_get_feature_0 (CONCORD_Genre genre, const unsigned char* name) { CONCORD_Feature feature; @@ -467,6 +470,37 @@ concord_genre_get_feature (CONCORD_Genre genre, const unsigned char* name) return feature; } +CONCORD_Feature +concord_genre_get_feature (CONCORD_Genre genre, const unsigned char* name) +{ + CONCORD_Genre g_feature + = concord_ds_get_genre (genre->ds, "feature"); + + if (g_feature != NULL) + { + CONCORD_Feature p_true_name + = concord_genre_get_feature_0 (g_feature, "true-name"); + + if (g_feature != NULL) + { + CONCORD_String_Tank s_true_name; + int status + = concord_obj_get_feature_value_string (name, + p_true_name, + &s_true_name); + if (status == 0) + { + unsigned char* t_name = alloca (s_true_name.size + 1); + + strncpy (t_name, s_true_name.data, s_true_name.size); + t_name[s_true_name.size] = '\0'; + return concord_genre_get_feature_0 (genre, t_name); + } + } + } + return concord_genre_get_feature_0 (genre, name); +} + CONCORD_INDEX concord_genre_get_index (CONCORD_Genre genre, const unsigned char* name) { -- 1.7.10.4