renamed ICU chain functions to the following names relation the operation
authorMarc Cromme <marc@indexdata.dk>
Mon, 29 Oct 2007 10:22:22 +0000 (10:22 +0000)
committerMarc Cromme <marc@indexdata.dk>
Mon, 29 Oct 2007 10:22:22 +0000 (10:22 +0000)
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
src/icu_I18N.c
test/tst_icu_I18N.c
util/yaz-icu.c

index f69714c..61dbf70 100644 (file)
@@ -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);
 
index efc3cfc..a4aa244 100644 (file)
@@ -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);
index a00e15c..07aab52 100644 (file)
@@ -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);
     
 
index 92da87e..d2ef11f 100644 (file)
@@ -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));
             }
         }