From 297aa7b45c3bd88aea2799f6810c8c85bc998f56 Mon Sep 17 00:00:00 2001 From: Marc Cromme Date: Mon, 29 Oct 2007 10:22:22 +0000 Subject: [PATCH] renamed ICU chain functions to the following names relation the operation to the actually processed token int icu_chain_token_number(struct icu_chain * chain); const char * icu_chain_token_display(struct icu_chain * chain); const char * icu_chain_token_norm(struct icu_chain * chain); const char * icu_chain_token_sortkey(struct icu_chain * chain); --- include/yaz/icu_I18N.h | 12 +++++++---- src/icu_I18N.c | 10 +++++----- test/tst_icu_I18N.c | 52 ++++++++++++++++++++++++------------------------ util/yaz-icu.c | 10 +++++----- 4 files changed, 44 insertions(+), 40 deletions(-) diff --git a/include/yaz/icu_I18N.h b/include/yaz/icu_I18N.h index f69714c..61dbf70 100644 --- a/include/yaz/icu_I18N.h +++ b/include/yaz/icu_I18N.h @@ -271,13 +271,17 @@ int icu_chain_assign_cstr(struct icu_chain * chain, int icu_chain_next_token(struct icu_chain * chain, UErrorCode *status); -int icu_chain_get_token_count(struct icu_chain * chain); +int icu_chain_token_number(struct icu_chain * chain); -const char * icu_chain_get_display(struct icu_chain * chain); +/*int icu_chain_token_start(struct icu_chain * chain); */ -const char * icu_chain_get_norm(struct icu_chain * chain); +/*int icu_chain_token_end(struct icu_chain * chain); */ -const char * icu_chain_get_sort(struct icu_chain * chain); +const char * icu_chain_token_display(struct icu_chain * chain); + +const char * icu_chain_token_norm(struct icu_chain * chain); + +const char * icu_chain_token_sortkey(struct icu_chain * chain); const UCollator * icu_chain_get_coll(struct icu_chain * chain); diff --git a/src/icu_I18N.c b/src/icu_I18N.c index efc3cfc..a4aa244 100644 --- a/src/icu_I18N.c +++ b/src/icu_I18N.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: icu_I18N.c,v 1.8 2007-10-25 10:04:32 marc Exp $ + * $Id: icu_I18N.c,v 1.9 2007-10-29 10:22:23 marc Exp $ */ #if HAVE_CONFIG_H @@ -1191,7 +1191,7 @@ int icu_chain_next_token(struct icu_chain * chain, return 0; } -int icu_chain_get_token_count(struct icu_chain * chain) +int icu_chain_token_number(struct icu_chain * chain) { if (!chain) return 0; @@ -1200,7 +1200,7 @@ int icu_chain_get_token_count(struct icu_chain * chain) } -const char * icu_chain_get_display(struct icu_chain * chain) +const char * icu_chain_token_display(struct icu_chain * chain) { if (chain->display8) return icu_buf_utf8_to_cstr(chain->display8); @@ -1208,7 +1208,7 @@ const char * icu_chain_get_display(struct icu_chain * chain) return 0; } -const char * icu_chain_get_norm(struct icu_chain * chain) +const char * icu_chain_token_norm(struct icu_chain * chain) { if (!chain->steps) return chain->src8cstr; @@ -1219,7 +1219,7 @@ const char * icu_chain_get_norm(struct icu_chain * chain) return 0; } -const char * icu_chain_get_sort(struct icu_chain * chain) +const char * icu_chain_token_sortkey(struct icu_chain * chain) { if (chain->sort8) return icu_buf_utf8_to_cstr(chain->sort8); diff --git a/test/tst_icu_I18N.c b/test/tst_icu_I18N.c index a00e15c..07aab52 100644 --- a/test/tst_icu_I18N.c +++ b/test/tst_icu_I18N.c @@ -1,4 +1,4 @@ -/* $Id: tst_icu_I18N.c,v 1.9 2007-10-25 10:04:33 marc Exp $ +/* $Id: tst_icu_I18N.c,v 1.10 2007-10-29 10:22:23 marc Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -519,12 +519,12 @@ void test_icu_I18N_chain(int argc, char **argv) while (icu_chain_next_token(chain, &status)){ ; // printf("%d '%s' '%s'\n", - // icu_chain_get_token_count(chain), - // icu_chain_get_norm(chain), - // icu_chain_get_display(chain)); + // icu_chain_token_number(chain), + // icu_chain_token_norm(chain), + // icu_chain_token_display(chain)); } - YAZ_CHECK_EQ(icu_chain_get_token_count(chain), 7); + YAZ_CHECK_EQ(icu_chain_token_number(chain), 7); YAZ_CHECK(icu_chain_assign_cstr(chain, "what is this?", &status)); @@ -532,13 +532,13 @@ void test_icu_I18N_chain(int argc, char **argv) while (icu_chain_next_token(chain, &status)){ ; //printf("%d '%s' '%s'\n", - // icu_chain_get_token_count(chain), - // icu_chain_get_norm(chain), - // icu_chain_get_display(chain)); + // icu_chain_token_number(chain), + // icu_chain_token_norm(chain), + // icu_chain_token_display(chain)); } - YAZ_CHECK_EQ(icu_chain_get_token_count(chain), 3); + YAZ_CHECK_EQ(icu_chain_token_number(chain), 3); icu_chain_destroy(chain); } @@ -578,27 +578,27 @@ void test_bug_1140(void) while (icu_chain_next_token(chain, &status)){ ; //printf("%d '%s' '%s'\n", - // icu_chain_get_token_count(chain), - // icu_chain_get_norm(chain), - // icu_chain_get_display(chain)); + // icu_chain_token_number(chain), + // icu_chain_token_norm(chain), + // icu_chain_token_display(chain)); } - YAZ_CHECK_EQ(icu_chain_get_token_count(chain), 7); + YAZ_CHECK_EQ(icu_chain_token_number(chain), 7); YAZ_CHECK(icu_chain_assign_cstr(chain, "what is this?", &status)); while (icu_chain_next_token(chain, &status)){ ; //printf("%d '%s' '%s'\n", - // icu_chain_get_token_count(chain), - // icu_chain_get_norm(chain), - // icu_chain_get_display(chain)); + // icu_chain_token_number(chain), + // icu_chain_token_norm(chain), + // icu_chain_token_display(chain)); } /* we expect 'what' 'is' 'this', i.e. 3 tokens */ - YAZ_CHECK_EQ(icu_chain_get_token_count(chain), 3); + YAZ_CHECK_EQ(icu_chain_token_number(chain), 3); icu_chain_destroy(chain); } @@ -631,12 +631,12 @@ void test_chain_empty_token(void) while (icu_chain_next_token(chain, &status)){ ; //printf("%d '%s' '%s'\n", - // icu_chain_get_token_count(chain), - // icu_chain_get_norm(chain), - // icu_chain_get_display(chain)); + // icu_chain_token_number(chain), + // icu_chain_token_norm(chain), + // icu_chain_token_display(chain)); } - YAZ_CHECK_EQ(icu_chain_get_token_count(chain), 8); + YAZ_CHECK_EQ(icu_chain_token_number(chain), 8); icu_chain_destroy(chain); } @@ -668,14 +668,14 @@ void test_chain_empty_chain(void) while (icu_chain_next_token(chain, &status)){ ; //printf("%d '%s' '%s'\n", - // icu_chain_get_token_count(chain), - // icu_chain_get_norm(chain), - // icu_chain_get_display(chain)); + // icu_chain_token_number(chain), + // icu_chain_token_norm(chain), + // icu_chain_token_display(chain)); } - YAZ_CHECK_EQ(icu_chain_get_token_count(chain), 1); + YAZ_CHECK_EQ(icu_chain_token_number(chain), 1); - dest8 = icu_chain_get_norm(chain); + dest8 = icu_chain_token_norm(chain); YAZ_CHECK_EQ(strcmp(src8, dest8), 0); diff --git a/util/yaz-icu.c b/util/yaz-icu.c index 92da87e..d2ef11f 100644 --- a/util/yaz-icu.c +++ b/util/yaz-icu.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: yaz-icu.c,v 1.5 2007-10-25 08:40:06 marc Exp $ + * $Id: yaz-icu.c,v 1.6 2007-10-29 10:22:23 marc Exp $ */ #if HAVE_CONFIG_H @@ -482,14 +482,14 @@ static void process_text_file(const struct config_t *p_config) " norm=\"%s\" display=\"%s\"/>\n", token_count, line_count, - icu_chain_get_norm(config.chain), - icu_chain_get_display(config.chain)); + icu_chain_token_norm(config.chain), + icu_chain_token_display(config.chain)); else fprintf(config.outfile, "%lu %lu '%s' '%s'\n", token_count, line_count, - icu_chain_get_norm(config.chain), - icu_chain_get_display(config.chain)); + icu_chain_token_norm(config.chain), + icu_chain_token_display(config.chain)); } } -- 1.7.10.4