projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Updated various routines to handle missing explain schema.
[idzebra-moved-to-github.git]
/
util
/
charmap.c
diff --git
a/util/charmap.c
b/util/charmap.c
index
7104cd3
..
5b5b81e
100644
(file)
--- a/
util/charmap.c
+++ b/
util/charmap.c
@@
-1,10
+1,16
@@
/*
/*
- * Copyright (C) 1996-1997, Index Data I/S
+ * Copyright (C) 1996-1998, Index Data
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: charmap.c,v $
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: charmap.c,v $
- * Revision 1.13 1997-10-27 14:33:06 adam
+ * Revision 1.15 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.14 1998/10/13 20:09:18 adam
+ * Changed call to readconf_line.
+ *
+ * Revision 1.13 1997/10/27 14:33:06 adam
* Moved towards generic character mapping depending on "structure"
* field in abstract syntax file. Fixed a few memory leaks. Fixed
* bug with negative integers when doing searches with relational
* Moved towards generic character mapping depending on "structure"
* field in abstract syntax file. Fixed a few memory leaks. Fixed
* bug with negative integers when doing searches with relational
@@
-109,7
+115,7
@@
static chr_t_entry *set_map_string(chr_t_entry *root, NMEM nmem,
{
if (!root)
{
{
if (!root)
{
- root = nmem_malloc(nmem, sizeof(*root));
+ root = (chr_t_entry *) nmem_malloc(nmem, sizeof(*root));
root->children = 0;
root->target = 0;
}
root->children = 0;
root->target = 0;
}
@@
-127,7
+133,8
@@
static chr_t_entry *set_map_string(chr_t_entry *root, NMEM nmem,
{
int i;
{
int i;
- root->children = nmem_malloc(nmem, sizeof(chr_t_entry*) * 256);
+ root->children = (chr_t_entry **)
+ nmem_malloc(nmem, sizeof(chr_t_entry*) * 256);
for (i = 0; i < 256; i++)
root->children[i] = 0;
}
for (i = 0; i < 256; i++)
root->children[i] = 0;
}
@@
-238,7
+245,7
@@
static unsigned char prim(char **s)
*/
static void fun_addentry(const char *s, void *data, int num)
{
*/
static void fun_addentry(const char *s, void *data, int num)
{
- chrmaptab tab = data;
+ chrmaptab tab = (chrmaptab) data;
char tmp[2];
tmp[0] = num; tmp[1] = '\0';
char tmp[2];
tmp[0] = num; tmp[1] = '\0';
@@
-253,7
+260,7
@@
static void fun_addentry(const char *s, void *data, int num)
*/
static void fun_addspace(const char *s, void *data, int num)
{
*/
static void fun_addspace(const char *s, void *data, int num)
{
- chrmaptab tab = data;
+ chrmaptab tab = (chrmaptab) data;
tab->input = set_map_string(tab->input, tab->nmem, s, strlen(s),
(char*) CHR_SPACE);
}
tab->input = set_map_string(tab->input, tab->nmem, s, strlen(s),
(char*) CHR_SPACE);
}
@@
-263,7
+270,7
@@
static void fun_addspace(const char *s, void *data, int num)
*/
static void fun_mkstring(const char *s, void *data, int num)
{
*/
static void fun_mkstring(const char *s, void *data, int num)
{
- chrwork *arg = data;
+ chrwork *arg = (chrwork *) data;
const char **res, *p = s;
res = chr_map_input(arg->map, &s, strlen(s));
const char **res, *p = s;
res = chr_map_input(arg->map, &s, strlen(s));
@@
-278,14
+285,15
@@
static void fun_mkstring(const char *s, void *data, int num)
*/
static void fun_addmap(const char *s, void *data, int num)
{
*/
static void fun_addmap(const char *s, void *data, int num)
{
- chrwork *arg = data;
+ chrwork *arg = (chrwork *) data;
assert(arg->map->input);
set_map_string(arg->map->input, arg->map->nmem, s, strlen(s), arg->string);
}
assert(arg->map->input);
set_map_string(arg->map->input, arg->map->nmem, s, strlen(s), arg->string);
}
-static int scan_string(char *s, void (*fun)(const char *c, void *data, int num),
- void *data, int *num)
+static int scan_string(char *s,
+ void (*fun)(const char *c, void *data, int num),
+ void *data, int *num)
{
unsigned char c, str[1024], begin, end, *p;
{
unsigned char c, str[1024], begin, end, *p;
@@
-346,6
+354,7
@@
chrmaptab chrmaptab_create(const char *tabpath, const char *name, int map_only)
FILE *f;
char line[512], *argv[50];
chrmaptab res;
FILE *f;
char line[512], *argv[50];
chrmaptab res;
+ int lineno = 0;
int argc, num = (int) *CHR_BASE, i;
if (!(f = yaz_path_fopen(tabpath, name, "r")))
int argc, num = (int) *CHR_BASE, i;
if (!(f = yaz_path_fopen(tabpath, name, "r")))
@@
-353,21
+362,24
@@
chrmaptab chrmaptab_create(const char *tabpath, const char *name, int map_only)
logf(LOG_WARN|LOG_ERRNO, "%s", name);
return 0;
}
logf(LOG_WARN|LOG_ERRNO, "%s", name);
return 0;
}
- res = xmalloc(sizeof(*res));
+ res = (chrmaptab) xmalloc(sizeof(*res));
res->nmem = nmem_create ();
res->nmem = nmem_create ();
- res->tmp_buf = nmem_malloc (res->nmem, sizeof(*res->tmp_buf) * 100);
- res->input = nmem_malloc(res->nmem, sizeof(*res->input));
+ res->tmp_buf = (char **)
+ nmem_malloc (res->nmem, sizeof(*res->tmp_buf) * 100);
+ res->input = (chr_t_entry *) nmem_malloc(res->nmem, sizeof(*res->input));
res->input->target = (unsigned char*) CHR_UNKNOWN;
res->input->equiv = 0;
res->input->target = (unsigned char*) CHR_UNKNOWN;
res->input->equiv = 0;
- res->input->children = nmem_malloc(res->nmem, sizeof(res->input) * 256);
+ res->input->children = (chr_t_entry **)
+ nmem_malloc(res->nmem, sizeof(res->input) * 256);
for (i = 0; i < 256; i++)
{
for (i = 0; i < 256; i++)
{
- res->input->children[i] = nmem_malloc(res->nmem, sizeof(*res->input));
+ res->input->children[i] = (chr_t_entry *)
+ nmem_malloc(res->nmem, sizeof(*res->input));
res->input->children[i]->children = 0;
if (map_only)
{
res->input->children[i]->children = 0;
if (map_only)
{
- res->input->children[i]->target = nmem_malloc (res->nmem,
- 2 * sizeof(char));
+ res->input->children[i]->target = (unsigned char *)
+ nmem_malloc (res->nmem, 2 * sizeof(char));
res->input->children[i]->target[0] = i;
res->input->children[i]->target[1] = 0;
}
res->input->children[i]->target[0] = i;
res->input->children[i]->target[1] = 0;
}
@@
-382,7
+394,7
@@
chrmaptab chrmaptab_create(const char *tabpath, const char *name, int map_only)
res->output[(int) *CHR_UNKNOWN] = (unsigned char*) "@";
res->base_uppercase = 0;
res->output[(int) *CHR_UNKNOWN] = (unsigned char*) "@";
res->base_uppercase = 0;
- while ((argc = readconf_line(f, line, 512, argv, 50)))
+ while ((argc = readconf_line(f, &lineno, line, 512, argv, 50)))
if (!map_only && !yaz_matchstr(argv[0], "lowercase"))
{
if (argc != 2)
if (!map_only && !yaz_matchstr(argv[0], "lowercase"))
{
if (argc != 2)