X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fyaz-icu.c;h=dd972493866f57b166c76aa57e9e7b2eebc8a5cd;hb=fffad7b88b5fcc5ce744151034d1df379919d6d6;hp=d929229c1415a704245fa345baeadf85023e7bd3;hpb=c168c38b0beb83bca23c72d9203cc796a374bfac;p=yaz-moved-to-github.git
diff --git a/util/yaz-icu.c b/util/yaz-icu.c
index d929229..dd97249 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.2 2007-10-22 17:32:08 adam Exp $
+ * $Id: yaz-icu.c,v 1.8 2007-11-07 09:50:24 adam Exp $
*/
#if HAVE_CONFIG_H
@@ -55,10 +55,7 @@ void print_option_error(const struct config_t *p_config)
" \n"
" \n"
" \n"
- " \n"
" \n"
- " \n"
- " \n"
"\n"
);
exit(1);
@@ -428,6 +425,7 @@ static void process_text_file(const struct config_t *p_config)
xmlDoc *doc = xmlParseFile(config.conffile);
xmlNode *xml_node = xmlDocGetRootElement(doc);
+ xmlChar *xml_locale = xmlGetProp(xml_node, (xmlChar *) "locale");
long unsigned int token_count = 0;
long unsigned int line_count = 0;
@@ -441,8 +439,14 @@ static void process_text_file(const struct config_t *p_config)
exit (1);
}
+ if (!xml_locale || !strlen((const char *) xml_locale))
+ return;
- config.chain = icu_chain_xml_config(xml_node, &status);
+ config.chain = icu_chain_xml_config(xml_node, (const char *) xml_locale, 0,
+ &status);
+
+ xmlFree(xml_locale);
+
if (config.chain && U_SUCCESS(status))
success = 1;
@@ -452,6 +456,8 @@ static void process_text_file(const struct config_t *p_config)
exit (1);
}
+
+
if (p_config->xmloutput)
fprintf(config.outfile,
"\n"
@@ -475,14 +481,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));
}
}