projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
memcached: use facets in key for result set
[yaz-moved-to-github.git]
/
util
/
yaz-icu.c
diff --git
a/util/yaz-icu.c
b/util/yaz-icu.c
index
048e45e
..
8cb5143
100644
(file)
--- a/
util/yaz-icu.c
+++ b/
util/yaz-icu.c
@@
-1,5
+1,5
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2013 Index Data
+ * Copyright (C) Index Data
* See the file LICENSE for details.
*/
* See the file LICENSE for details.
*/
@@
-33,6
+33,7
@@
struct config_t {
char print[1024];
int xmloutput;
int sortoutput;
char print[1024];
int xmloutput;
int sortoutput;
+ int org_output;
yaz_icu_chain_t chain;
FILE * infile;
FILE * outfile;
yaz_icu_chain_t chain;
FILE * infile;
FILE * outfile;
@@
-45,6
+46,7
@@
void print_option_error(const struct config_t *p_config)
" -c file XML configuration\n"
" -p a|c|l|t Print ICU info \n"
" -s Show sort normalization key\n"
" -c file XML configuration\n"
" -p a|c|l|t Print ICU info \n"
" -s Show sort normalization key\n"
+ " -o Show org positions\n"
" -x XML output instread of text\n"
"\n"
"Examples:\n"
" -x XML output instread of text\n"
"\n"
"Examples:\n"
@@
-77,10
+79,11
@@
void read_params(int argc, char **argv, struct config_t *p_config)
p_config->chain = 0;
p_config->infile = 0;
p_config->outfile = stdout;
p_config->chain = 0;
p_config->infile = 0;
p_config->outfile = stdout;
+ p_config->org_output = 0;
/* set up command line parameters */
/* set up command line parameters */
- while ((ret = options("c:p:xs", argv, argc, &arg)) != -2)
+ while ((ret = options("c:op:sx", argv, argc, &arg)) != -2)
{
switch (ret)
{
{
switch (ret)
{
@@
-96,6
+99,9
@@
void read_params(int argc, char **argv, struct config_t *p_config)
case 'x':
p_config->xmloutput = 1;
break;
case 'x':
p_config->xmloutput = 1;
break;
+ case 'o':
+ p_config->org_output = 1;
+ break;
case 0:
if (p_config->infile)
{
case 0:
if (p_config->infile)
{
@@
-448,8
+454,6
@@
static void process_text_file(struct config_t *p_config)
{
printf("Could not set up ICU chain from config file '%s' \n",
p_config->conffile);
{
printf("Could not set up ICU chain from config file '%s' \n",
p_config->conffile);
- if (!U_SUCCESS(status))
- printf("ICU Error: %d %s\n", status, u_errorName(status));
exit(1);
}
exit(1);
}
@@
-473,7
+477,10
@@
static void process_text_file(struct config_t *p_config)
success = 0;
else
{
success = 0;
else
{
+ size_t start, len;
const char *sortkey = icu_chain_token_sortkey(p_config->chain);
const char *sortkey = icu_chain_token_sortkey(p_config->chain);
+
+ icu_chain_get_org_info(p_config->chain, &start, &len);
wrbuf_rewind(sw);
wrbuf_puts_escaped(sw, sortkey);
token_count++;
wrbuf_rewind(sw);
wrbuf_puts_escaped(sw, sortkey);
token_count++;
@@
-513,6
+520,11
@@
static void process_text_file(struct config_t *p_config)
{
fprintf(p_config->outfile, " '%s'", wrbuf_cstr(sw));
}
{
fprintf(p_config->outfile, " '%s'", wrbuf_cstr(sw));
}
+ if (p_config->org_output)
+ {
+ fprintf(p_config->outfile, " %ld+%ld",
+ (long) start, (long) len);
+ }
fprintf(p_config->outfile, "\n");
}
}
fprintf(p_config->outfile, "\n");
}
}