/*
- * 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 $
- * 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
{
if (!root)
{
- root = nmem_malloc(nmem, sizeof(*root));
+ root = (chr_t_entry *) nmem_malloc(nmem, sizeof(*root));
root->children = 0;
root->target = 0;
}
{
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;
}
*/
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';
*/
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);
}
*/
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));
*/
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);
}
-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;
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")))
logf(LOG_WARN|LOG_ERRNO, "%s", name);
return 0;
}
- res = xmalloc(sizeof(*res));
+ res = (chrmaptab) xmalloc(sizeof(*res));
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->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++)
{
- 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]->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->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)