-/* $Id: bfile.c,v 1.36 2004-08-04 08:35:22 adam Exp $
+/* $Id: bfile.c,v 1.37 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
{
if (spec)
{
- yaz_log (LOG_LOG, "enabling cache spec=%s", spec);
+ yaz_log (YLOG_LOG, "enabling cache spec=%s", spec);
if (!bfs->commit_area)
bfs->commit_area = mf_init ("shadow", spec, bfs->base);
if (bfs->commit_area)
8);
strcpy (bfs->cache_fname, bfs->commit_area->dirs->name);
strcat (bfs->cache_fname, "/cache");
- yaz_log (LOG_LOG, "cache_fname = %s", bfs->cache_fname);
+ yaz_log (YLOG_LOG, "cache_fname = %s", bfs->cache_fname);
}
}
else
outf = open_cache (bfs, "ab");
if (!outf)
{
- logf (LOG_FATAL|LOG_ERRNO, "open %s", bfs->cache_fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "open %s", bfs->cache_fname);
exit (1);
}
fprintf (outf, "%s %d\n", name, block_size);
}
if (!tmp->mf)
{
- logf (LOG_FATAL, "mf_open failed for %s", name);
+ yaz_log (YLOG_FATAL, "mf_open failed for %s", name);
xfree (tmp);
return 0;
}
assert (bfs->commit_area);
if (!(inf = open_cache (bfs, "rb")))
{
- logf (LOG_LOG, "No commit file");
+ yaz_log (YLOG_LOG, "No commit file");
return ;
}
while (fscanf (inf, "%s %d", path, &block_size) == 2)
-/* $Id: cfile.c,v 1.30 2004-08-06 12:55:01 adam Exp $
+/* $Id: cfile.c,v 1.31 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
int hash_bytes;
cf->rmf = mf;
- logf (LOG_DEBUG, "cf: open %s %s", cf->rmf->name, wflag ? "rdwr" : "rd");
+ yaz_log (YLOG_DEBUG, "cf: open %s %s", cf->rmf->name, wflag ? "rdwr" : "rd");
sprintf (path, "%s-b", fname);
if (!(cf->block_mf = mf_open (area, path, block_size, wflag)))
{
- logf (LOG_FATAL|LOG_ERRNO, "Failed to open %s", path);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "Failed to open %s", path);
exit (1);
}
sprintf (path, "%s-i", fname);
if (!(cf->hash_mf = mf_open (area, path, HASH_BSIZE, wflag)))
{
- logf (LOG_FATAL|LOG_ERRNO, "Failed to open %s", path);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "Failed to open %s", path);
exit (1);
}
assert (firstp);
p = alloc_bucket (cf, block_no, hno);
if (!mf_read (cf->hash_mf, block_no, 0, 0, &p->ph))
{
- logf (LOG_FATAL|LOG_ERRNO, "read get_bucket");
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "read get_bucket");
exit (1);
}
assert (p->ph.this_bucket == block_no);
{
if (hb->ph.this_bucket == block_no)
{
- logf (LOG_FATAL, "Found hash bucket on other chain (1)");
+ yaz_log (YLOG_FATAL, "Found hash bucket on other chain (1)");
abort ();
}
for (i = 0; i<HASH_BUCKET && hb->ph.vno[i]; i++)
if (hb->ph.no[i] == no)
{
- logf (LOG_FATAL, "Found hash bucket on other chain (2)");
+ yaz_log (YLOG_FATAL, "Found hash bucket on other chain (2)");
abort ();
}
}
int j;
zint i;
- logf (LOG_DEBUG, "cf: Moving to flat shadow: %s", cf->rmf->name);
- logf (LOG_DEBUG, "cf: hits=%d miss=%d bucket_in_memory=" ZINT_FORMAT " total="
+ yaz_log (YLOG_DEBUG, "cf: Moving to flat shadow: %s", cf->rmf->name);
+ yaz_log (YLOG_DEBUG, "cf: hits=%d miss=%d bucket_in_memory=" ZINT_FORMAT " total="
ZINT_FORMAT,
cf->no_hits, cf->no_miss, cf->bucket_in_memory,
cf->head.next_bucket - cf->head.first_bucket);
{
if (!mf_read (cf->hash_mf, i, 0, 0, &p->ph))
{
- logf (LOG_FATAL|LOG_ERRNO, "read bucket moveto flat");
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "read bucket moveto flat");
exit (1);
}
for (j = 0; j < HASH_BUCKET && p->ph.vno[j]; j++)
{
if (hb->ph.this_bucket == *bucketpp)
{
- logf (LOG_FATAL, "Found hash bucket on other chain");
+ yaz_log (YLOG_FATAL, "Found hash bucket on other chain");
abort ();
}
}
zebra_mutex_unlock (&cf->mutex);
if (!mf_read (cf->block_mf, block, offset, nbytes, buf))
{
- logf (LOG_FATAL|LOG_ERRNO, "cf_read no=" ZINT_FORMAT " block=" ZINT_FORMAT, no, block);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "cf_read no=" ZINT_FORMAT " block=" ZINT_FORMAT, no, block);
exit (1);
}
return 1;
zebra_mutex_unlock (&cf->mutex);
if (mf_write (cf->block_mf, block, offset, nbytes, buf))
{
- logf (LOG_FATAL|LOG_ERRNO, "cf_write no=" ZINT_FORMAT
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "cf_write no=" ZINT_FORMAT
" block=" ZINT_FORMAT, no, block);
exit (1);
}
int cf_close (CFile cf)
{
- logf (LOG_DEBUG, "cf: close hits=%d miss=%d bucket_in_memory=" ZINT_FORMAT
+ yaz_log (YLOG_DEBUG, "cf: close hits=%d miss=%d bucket_in_memory=" ZINT_FORMAT
" total=" ZINT_FORMAT,
cf->no_hits, cf->no_miss, cf->bucket_in_memory,
cf->head.next_bucket - cf->head.first_bucket);
-/* $Id: commit.c,v 1.20 2004-09-13 08:43:28 adam Exp $
+/* $Id: commit.c,v 1.21 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
{
if (cf->bucket_in_memory)
{
- logf (LOG_FATAL, "Cannot unlink potential dirty cache");
+ yaz_log (YLOG_FATAL, "Cannot unlink potential dirty cache");
exit (1);
}
cf->head.state = 0;
if (!mf_read (m_p->cf->block_mf, m_p->map[i].from, 0, 0,
m_p->buf + i * m_p->cf->head.block_size))
{
- logf (LOG_FATAL, "read commit block at position %d",
+ yaz_log (YLOG_FATAL, "read commit block at position %d",
m_p->map[i].from);
exit (1);
}
{
if (!mf_read (cf->hash_mf, bucket_no, 0, 0, p))
{
- logf (LOG_FATAL, "read commit hash");
+ yaz_log (YLOG_FATAL, "read commit hash");
exit (1);
}
for (i = 0; i<HASH_BUCKET && p->vno[i]; i++)
#else
if (!mf_read (cf->block_mf, p->vno[i], 0, 0, cf->iobuf))
{
- logf (LOG_FATAL, "read commit block");
+ yaz_log (YLOG_FATAL, "read commit block");
exit (1);
}
mf_write (cf->rmf, p->no[i], 0, 0, cf->iobuf);
if (!mf_read (cf->hash_mf, hno, 0, 0, fp) &&
hno != cf->head.flat_bucket-1)
{
- logf (LOG_FATAL, "read index block hno=" ZINT_FORMAT
+ yaz_log (YLOG_FATAL, "read index block hno=" ZINT_FORMAT
" (" ZINT_FORMAT "-" ZINT_FORMAT ") commit",
hno, cf->head.next_bucket, cf->head.flat_bucket-1);
}
#else
if (!mf_read (cf->block_mf, fp[i], 0, 0, cf->iobuf))
{
- logf (LOG_FATAL, "read data block hno=" ZINT_FORMAT " (" ZINT_FORMAT "-" ZINT_FORMAT ") "
+ yaz_log (YLOG_FATAL, "read data block hno=" ZINT_FORMAT " (" ZINT_FORMAT "-" ZINT_FORMAT ") "
"i=%d commit block at " ZINT_FORMAT " (->" ZINT_FORMAT")",
hno, cf->head.next_bucket, cf->head.flat_bucket-1,
i, fp[i], vno);
if (cf->bucket_in_memory)
{
- logf (LOG_FATAL, "Cannot commit potential dirty cache");
+ yaz_log (YLOG_FATAL, "Cannot commit potential dirty cache");
exit (1);
}
if (cf->head.state == 1)
-/* $Id: mfile.c,v 1.55 2004-08-06 12:55:01 adam Exp $
+/* $Id: mfile.c,v 1.56 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
Index Data Aps
dirname[i] = '\0';
if (*ad++ != ':')
{
- logf (LOG_WARN, "Missing colon after path: %s", ad0);
+ yaz_log (YLOG_WARN, "Missing colon after path: %s", ad0);
return -1;
}
if (i == 0)
{
- logf (LOG_WARN, "Empty path: %s", ad0);
+ yaz_log (YLOG_WARN, "Empty path: %s", ad0);
return -1;
}
while (*ad == ' ' || *ad == '\t')
size = 0;
if (*ad < '0' || *ad > '9')
{
- logf (LOG_FATAL, "Missing size after path: %s", ad0);
+ yaz_log (YLOG_FATAL, "Missing size after path: %s", ad0);
return -1;
}
size = 0;
case 'M': case 'm': multi = 1048576; break;
case 'G': case 'g': multi = 1073741824; break;
case '\0':
- logf (LOG_FATAL, "Missing unit: %s", ad0);
+ yaz_log (YLOG_FATAL, "Missing unit: %s", ad0);
return -1;
default:
- logf (LOG_FATAL, "Illegal unit: %c in %s", *ad, ad0);
+ yaz_log (YLOG_FATAL, "Illegal unit: %c in %s", *ad, ad0);
return -1;
}
ad++;
{
if (!mf->wr && errno == ENOENT && off == 0)
return -2;
- logf (LOG_WARN|LOG_ERRNO, "Failed to open %s", mf->files[c].path);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "Failed to open %s", mf->files[c].path);
return -1;
}
}
if (mfile_seek(mf->files[c].fd, ps * (mfile_off_t) mf->blocksize + offset,
SEEK_SET) < 0)
{
- logf (LOG_WARN|LOG_ERRNO, "Failed to seek in %s", mf->files[c].path);
- logf(LOG_WARN, "pos=" ZINT_FORMAT " off=" ZINT_FORMAT " blocksize=%d offset=%d",
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "Failed to seek in %s", mf->files[c].path);
+ yaz_log(YLOG_WARN, "pos=" ZINT_FORMAT " off=" ZINT_FORMAT " blocksize=%d offset=%d",
pos, off, mf->blocksize, offset);
return -1;
}
int fd, number;
char metaname[FILENAME_MAX+1], tmpnam[FILENAME_MAX+1];
- logf (LOG_DEBUG, "mf_init(%s)", name);
+ yaz_log (YLOG_DEBUG, "mf_init(%s)", name);
strcpy(ma->name, name);
ma->mfiles = 0;
ma->dirs = 0;
if (scan_areadef(ma, spec, base) < 0)
{
- logf (LOG_WARN, "Failed to access description of '%s'", name);
+ yaz_log (YLOG_WARN, "Failed to access description of '%s'", name);
return 0;
}
/* look at each directory */
{
if (!(dd = opendir(dirp->name)))
{
- logf (LOG_WARN|LOG_ERRNO, "Failed to open directory %s",
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "Failed to open directory %s",
dirp->name);
return 0;
}
/* get size */
if ((fd = open(part_f->path, O_BINARY|O_RDONLY)) < 0)
{
- logf (LOG_FATAL|LOG_ERRNO, "Failed to access %s",
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "Failed to access %s",
dent->d_name);
return 0;
}
if ((part_f->bytes = mfile_seek(fd, 0, SEEK_END)) < 0)
{
- logf (LOG_FATAL|LOG_ERRNO, "Failed to seek in %s",
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "Failed to seek in %s",
dent->d_name);
return 0;
}
}
for (meta_f = ma->mfiles; meta_f; meta_f = meta_f->next)
{
- logf (LOG_DEBUG, "mf_init: %s consists of %d part(s)", meta_f->name,
+ yaz_log (YLOG_DEBUG, "mf_init: %s consists of %d part(s)", meta_f->name,
meta_f->no_files);
qsort(meta_f->files, meta_f->no_files, sizeof(part_file),
cmp_part_file);
char tmp[FILENAME_MAX+1];
mf_dir *dp;
- logf(LOG_DEBUG, "mf_open(%s bs=%d, %s)", name, block_size,
+ yaz_log(YLOG_DEBUG, "mf_open(%s bs=%d, %s)", name, block_size,
wflag ? "RW" : "RDONLY");
assert (ma);
for (mnew = ma->mfiles; mnew; mnew = mnew->next)
mnew->min_bytes_creat; dp = dp->next);
if (!dp)
{
- logf (LOG_FATAL, "Insufficient space for new mfile.");
+ yaz_log (YLOG_FATAL, "Insufficient space for new mfile.");
return 0;
}
mnew->files[0].dir = dp;
{
int i;
- logf (LOG_DEBUG, "mf_close(%s)", mf->name);
+ yaz_log (YLOG_DEBUG, "mf_close(%s)", mf->name);
assert(mf->open);
for (i = 0; i < mf->no_files; i++)
{
}
else
{
- yaz_log (LOG_FATAL, "mf_read %s internal error", mf->name);
+ yaz_log (YLOG_FATAL, "mf_read %s internal error", mf->name);
exit(1);
}
}
toread = nbytes ? nbytes : mf->blocksize;
if ((rd = read(mf->files[mf->cur_file].fd, buf, toread)) < 0)
{
- logf (LOG_FATAL|LOG_ERRNO, "mf_read: Read failed (%s)",
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "mf_read: Read failed (%s)",
mf->files[mf->cur_file].path);
exit(1);
}
zebra_mutex_lock (&mf->mutex);
if ((ps = file_position(mf, no, offset)) < 0)
{
- yaz_log (LOG_FATAL, "mf_write %s internal error (1)", mf->name);
+ yaz_log (YLOG_FATAL, "mf_write %s internal error (1)", mf->name);
exit(1);
}
/* file needs to grow */
if ((nblocks = (int) (mf->files[mf->cur_file].dir->avail_bytes /
mf->blocksize)) > 0)
{
- logf (LOG_DEBUG, "Capping off file %s at pos " ZINT_FORMAT,
+ yaz_log (YLOG_DEBUG, "Capping off file %s at pos " ZINT_FORMAT,
mf->files[mf->cur_file].path, nblocks);
if ((ps = file_position(mf,
(mf->cur_file ? mf->files[mf->cur_file-1].top : 0) +
mf->files[mf->cur_file].blocks + nblocks - 1, 0)) < 0)
{
- yaz_log (LOG_FATAL, "mf_write %s internal error (2)",
+ yaz_log (YLOG_FATAL, "mf_write %s internal error (2)",
mf->name);
exit(1);
}
- logf (LOG_DEBUG, "ps = " ZINT_FORMAT, ps);
+ yaz_log (YLOG_DEBUG, "ps = " ZINT_FORMAT, ps);
if (write(mf->files[mf->cur_file].fd, &dummych, 1) < 1)
{
- logf (LOG_ERRNO|LOG_FATAL, "mf_write %s internal error (3)",
+ yaz_log (YLOG_ERRNO|YLOG_FATAL, "mf_write %s internal error (3)",
mf->name);
exit(1);
}
mf->blocksize;
}
/* get other bit */
- logf (LOG_DEBUG, "Creating new file.");
+ yaz_log (YLOG_DEBUG, "Creating new file.");
for (dp = mf->ma->dirs; dp && dp->max_bytes >= 0 &&
dp->avail_bytes < needed; dp = dp->next);
if (!dp)
{
- logf (LOG_FATAL, "Cannot allocate more space for %s",
+ yaz_log (YLOG_FATAL, "Cannot allocate more space for %s",
mf->name);
exit(1);
}
/* open new file and position at beginning */
if ((ps = file_position(mf, no, offset)) < 0)
{
- yaz_log (LOG_FATAL, "mf_write %s internal error (4)",
+ yaz_log (YLOG_FATAL, "mf_write %s internal error (4)",
mf->name);
exit(1);
}
towrite = nbytes ? nbytes : mf->blocksize;
if (write(mf->files[mf->cur_file].fd, buf, towrite) < towrite)
{
- logf (LOG_FATAL|LOG_ERRNO, "Write failed for file %s part %d",
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "Write failed for file %s part %d",
mf->name, mf->cur_file);
exit(1);
}
dnl Zebra, Index Data Aps, 1995-2004
-dnl $Id: configure.in,v 1.104 2004-11-09 12:02:36 adam Exp $
+dnl $Id: configure.in,v 1.105 2004-11-19 10:26:52 heikki Exp $
dnl
AC_INIT(include/idzebra/version.h)
AM_INIT_AUTOMAKE(idzebra,1.4.0)
test/rusmarc/Makefile test/cddb/Makefile test/malxml/Makefile
test/config/Makefile test/sort2/Makefile
test/xelm/Makefile
- test/dmoz/Makefile test/xpath/Makefile test/sort/Makefile test/zsh/Makefile
+ test/dmoz/Makefile test/sort/Makefile test/zsh/Makefile
test/marcxml/Makefile test/charmap/Makefile test/codec/Makefile
examples/Makefile examples/gils/Makefile examples/zthes/Makefile
idzebra.spec
-/* $Id: d1_absyn.c,v 1.14 2004-09-30 18:31:14 adam Exp $
+/* $Id: d1_absyn.c,v 1.15 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#include <string.h>
#include <yaz/oid.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <idzebra/data1.h>
#include <zebra_xpath.h>
#include <d1_absyn.h>
{
data1_xpelement *xpe = abs->xp_elements;
while (xpe) {
- logf (LOG_DEBUG,"Destroy xp element %s",xpe->xpath_expr);
+ yaz_log (YLOG_DEBUG,"Destroy xp element %s",xpe->xpath_expr);
if (xpe->dfa) { dfa_delete (&xpe->dfa); }
xpe = xpe->next;
}
*cp = '\0';
}
if (!attset)
- yaz_log (LOG_WARN|LOG_ERRNO, "Couldn't load attribute set %s", name);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "Couldn't load attribute set %s", name);
else
{
data1_attset_cache p = (data1_attset_cache)
if (sub_e)
e->children = sub_e->elements;
else
- yaz_log (LOG_WARN, "Unresolved reference to sub-elements %s",
+ yaz_log (YLOG_WARN, "Unresolved reference to sub-elements %s",
e->sub_name);
}
}
if (!abs) { sprintf (p, ".*"); p+=2; }
sprintf (p, "$"); p++;
r = nmem_strdup (data1_nmem_get (dh), res);
- yaz_log(LOG_DEBUG,"Got regexp: %s",r);
+ yaz_log(YLOG_DEBUG,"Got regexp: %s",r);
return (r);
}
if (i == 0)
{
if (*cp)
- yaz_log(LOG_WARN,
+ yaz_log(YLOG_WARN,
"%s:%d: Syntax error in termlistspec '%s'",
file, lineno, cp);
break;
if (!((*tp)->att = data1_getattbyname(dh, res->attset,
attname))) {
if ((!xpelement) || (*attname != '!')) {
- yaz_log(LOG_WARN,
+ yaz_log(YLOG_WARN,
"%s:%d: Couldn't find att '%s' in attset",
file, lineno, attname);
return -1;
if (!(f = data1_path_fopen(dh, file, "r")))
{
- yaz_log(LOG_WARN|LOG_ERRNO, "Couldn't open %s", file);
+ yaz_log(YLOG_WARN|YLOG_ERRNO, "Couldn't open %s", file);
if (file_must_exist)
return 0;
}
if (argc < 4)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args to elm", file, lineno);
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args to elm", file, lineno);
continue;
}
path = argv[1];
}
if (i > level+1)
{
- yaz_log(LOG_WARN, "%s:%d: Bad level increase", file, lineno);
+ yaz_log(YLOG_WARN, "%s:%d: Bad level increase", file, lineno);
fclose(f);
return 0;
}
{
if (!res->tagset)
{
- yaz_log(LOG_WARN, "%s:%d: No tagset loaded", file, lineno);
+ yaz_log(YLOG_WARN, "%s:%d: No tagset loaded", file, lineno);
fclose(f);
return 0;
}
if (!(new_element->tag = data1_gettagbynum (dh, res->tagset,
type, value)))
{
- yaz_log(LOG_WARN, "%s:%d: Couldn't find tag %s in tagset",
+ yaz_log(YLOG_WARN, "%s:%d: Couldn't find tag %s in tagset",
file, lineno, p);
fclose(f);
return 0;
}
else
{
- yaz_log(LOG_WARN, "%s:%d: Bad element", file, lineno);
+ yaz_log(YLOG_WARN, "%s:%d: Bad element", file, lineno);
fclose(f);
return 0;
}
if (argc < 3)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args to xelm", file, lineno);
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args to xelm", file, lineno);
continue;
}
xpath_expr = argv[1];
regexp = mk_xpath_regexp(dh, xpath_expr);
i = dfa_parse (dfa, ®exp);
if (i || *regexp) {
- yaz_log(LOG_WARN, "%s:%d: Bad xpath to xelm", file, lineno);
+ yaz_log(YLOG_WARN, "%s:%d: Bad xpath to xelm", file, lineno);
dfa_delete (&dfa);
continue;
}
if (argc < 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args to section",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args to section",
file, lineno);
continue;
}
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args to 'xpath' directive",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args to 'xpath' directive",
file, lineno);
continue;
}
res->enable_xpath_indexing = 0;
else
{
- yaz_log(LOG_WARN, "%s:%d: Expecting disable/enable "
+ yaz_log(YLOG_WARN, "%s:%d: Expecting disable/enable "
"after 'xpath' directive", file, lineno);
}
}
data1_termlist **tp = &all;
if (all)
{
- yaz_log(LOG_WARN, "%s:%d: Too many 'all' directives - ignored",
+ yaz_log(YLOG_WARN, "%s:%d: Too many 'all' directives - ignored",
file, lineno);
continue;
}
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args to 'all' directive",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args to 'all' directive",
file, lineno);
continue;
}
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args to name directive",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args to name directive",
file, lineno);
continue;
}
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args to reference",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args to reference",
file, lineno);
continue;
}
name = argv[1];
if ((res->reference = oid_getvalbyname(name)) == VAL_NONE)
{
- yaz_log(LOG_WARN, "%s:%d: Unknown tagset ref '%s'",
+ yaz_log(YLOG_WARN, "%s:%d: Unknown tagset ref '%s'",
file, lineno, name);
continue;
}
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args to attset",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args to attset",
file, lineno);
continue;
}
name = argv[1];
if (!(attset = data1_get_attset (dh, name)))
{
- yaz_log(LOG_WARN, "%s:%d: Couldn't find attset %s",
+ yaz_log(YLOG_WARN, "%s:%d: Couldn't find attset %s",
file, lineno, name);
continue;
}
int type = 0;
if (argc < 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args to tagset",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args to tagset",
file, lineno);
continue;
}
*tagset_childp = data1_read_tagset (dh, name, type);
if (!(*tagset_childp))
{
- yaz_log(LOG_WARN, "%s:%d: Couldn't load tagset %s",
+ yaz_log(YLOG_WARN, "%s:%d: Couldn't load tagset %s",
file, lineno, name);
continue;
}
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args in varset",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args in varset",
file, lineno);
continue;
}
name = argv[1];
if (!(res->varset = data1_read_varset (dh, name)))
{
- yaz_log(LOG_WARN, "%s:%d: Couldn't load Varset %s",
+ yaz_log(YLOG_WARN, "%s:%d: Couldn't load Varset %s",
file, lineno, name);
continue;
}
if (argc != 3)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args in esetname",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args in esetname",
file, lineno);
continue;
}
(*esetpp)->spec = 0;
else if (!((*esetpp)->spec = data1_read_espec1 (dh, fname)))
{
- yaz_log(LOG_WARN, "%s:%d: Espec-1 read failed for %s",
+ yaz_log(YLOG_WARN, "%s:%d: Espec-1 read failed for %s",
file, lineno, fname);
continue;
}
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args for maptab",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args for maptab",
file, lineno);
continue;
}
name = argv[1];
if (!(*maptabp = data1_read_maptab (dh, name)))
{
- yaz_log(LOG_WARN, "%s:%d: Couldn't load maptab %s",
+ yaz_log(YLOG_WARN, "%s:%d: Couldn't load maptab %s",
file, lineno, name);
continue;
}
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # or args for marc",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # or args for marc",
file, lineno);
continue;
}
name = argv[1];
if (!(*marcp = data1_read_marctab (dh, name)))
{
- yaz_log(LOG_WARN, "%s:%d: Couldn't read marctab %s",
+ yaz_log(YLOG_WARN, "%s:%d: Couldn't read marctab %s",
file, lineno, name);
continue;
}
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # or args for encoding",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # or args for encoding",
file, lineno);
continue;
}
{
if (argc != 3)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # or args for systag",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # or args for systag",
file, lineno);
continue;
}
}
else
{
- yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'", file,
+ yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'", file,
lineno, cmd);
continue;
}
fix_element_ref (dh, res, cur_elements->elements);
}
*systagsp = 0;
- yaz_log(LOG_DEBUG, "%s: data1_read_absyn end", file);
+ yaz_log(YLOG_DEBUG, "%s: data1_read_absyn end", file);
return res;
}
-/* $Id: d1_attset.c,v 1.4 2004-09-28 10:43:37 adam Exp $
+/* $Id: d1_attset.c,v 1.5 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#include <assert.h>
#include <stdlib.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <idzebra/data1.h>
data1_att *data1_getattbyname(data1_handle dh, data1_attset *s, char *name)
if (argc < 3)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args to att", file, lineno);
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args to att", file, lineno);
continue;
}
num = atoi (argv[1]);
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args to name", file, lineno);
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args to name", file, lineno);
continue;
}
}
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args to reference",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args to reference",
file, lineno);
continue;
}
name = argv[1];
if ((res->reference = oid_getvalbyname(name)) == VAL_NONE)
{
- yaz_log(LOG_WARN, "%s:%d: Unknown reference oid '%s'",
+ yaz_log(YLOG_WARN, "%s:%d: Unknown reference oid '%s'",
file, lineno, name);
fclose(f);
return 0;
}
else if (!strcmp(cmd, "ordinal"))
{
- yaz_log (LOG_WARN, "%s:%d: Directive ordinal ignored",
+ yaz_log (YLOG_WARN, "%s:%d: Directive ordinal ignored",
file, lineno);
}
else if (!strcmp(cmd, "include"))
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args to include",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args to include",
file, lineno);
continue;
}
if (!(attset = data1_get_attset (dh, name)))
{
- yaz_log(LOG_WARN, "%s:%d: Include of attset %s failed",
+ yaz_log(YLOG_WARN, "%s:%d: Include of attset %s failed",
file, lineno, name);
continue;
}
else
{
- yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'",
+ yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'",
file, lineno, cmd);
}
}
-/* $Id: d1_doespec.c,v 1.3 2004-09-28 10:15:03 adam Exp $
+/* $Id: d1_doespec.c,v 1.4 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#include <assert.h>
#include <yaz/oid.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <yaz/proto.h>
#include <idzebra/data1.h>
counter++;
if (occur && occur->which == Z_Occurrences_last)
{
- yaz_log(LOG_WARN, "Can't do occurrences=last (yet)");
+ yaz_log(YLOG_WARN, "Can't do occurrences=last (yet)");
return 0;
}
if (!occur || occur->which == Z_Occurrences_all ||
-/* $Id: d1_espec.c,v 1.4 2004-10-05 12:23:25 adam Exp $
+/* $Id: d1_espec.c,v 1.5 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#include <yaz/odr.h>
#include <yaz/proto.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <idzebra/data1.h>
static Z_Variant *read_variant(int argc, char **argv, NMEM nmem,
if (sscanf(argv[i], "(%d,%d,%511[^)])", &zclass, &type, value) < 3)
{
- yaz_log(LOG_WARN, "%s:%d: Syntax error in variant component '%s'",
+ yaz_log(YLOG_WARN, "%s:%d: Syntax error in variant component '%s'",
file, lineno, argv[i]);
return 0;
}
if (!d1_isdigit(*occ))
{
- yaz_log(LOG_WARN, "%s:%d: Bad occurrences-spec %s",
+ yaz_log(YLOG_WARN, "%s:%d: Bad occurrences-spec %s",
file, lineno, occ);
return 0;
}
if (!(f = data1_path_fopen(dh, file, "r")))
{
- yaz_log(LOG_WARN|LOG_ERRNO, "%s", file);
+ yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", file);
return 0;
}
if (!nnames)
{
- yaz_log(LOG_WARN, "%s:%d: Empty elementsetnames directive",
+ yaz_log(YLOG_WARN, "%s:%d: Empty elementsetnames directive",
file, lineno);
continue;
}
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args for %s",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args for %s",
file, lineno, argv[0]);
continue;
}
if (!(res->defaultVariantSetId =
odr_getoidbystr_nmem(nmem, argv[1])))
{
- yaz_log(LOG_WARN, "%s:%d: Bad defaultvariantsetid",
+ yaz_log(YLOG_WARN, "%s:%d: Bad defaultvariantsetid",
file, lineno);
continue;
}
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args for %s",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args for %s",
file, lineno, argv[0]);
continue;
}
if (!(res->defaultVariantRequest =
read_variant(argc-1, argv+1, nmem, file, lineno)))
{
- yaz_log(LOG_WARN, "%s:%d: Bad defaultvariantrequest",
+ yaz_log(YLOG_WARN, "%s:%d: Bad defaultvariantrequest",
file, lineno);
continue;
}
}
if (argc < 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args for %s",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args for %s",
file, lineno, argv[0]);
continue;
}
tagunit = read_tagunit(path, nmem, file, lineno);
if (!tagunit)
{
- yaz_log (LOG_WARN, "%s%d: Bad tag unit at %s",
+ yaz_log (YLOG_WARN, "%s%d: Bad tag unit at %s",
file, lineno, path);
break;
}
read_variant(argc-3, argv+3, nmem, file, lineno);
}
else
- yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'",
+ yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'",
file, lineno, argv[0]);
fclose (f);
return res;
-/* $Id: d1_expout.c,v 1.3 2004-09-28 10:15:03 adam Exp $
+/* $Id: d1_expout.c,v 1.4 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#include <string.h>
#include <stdlib.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <yaz/proto.h>
#include <idzebra/data1.h>
return 0;
if (!c->u.tag.element)
{
- yaz_log(LOG_WARN, "Tag %s is local", c->u.tag.tag);
+ yaz_log(YLOG_WARN, "Tag %s is local", c->u.tag.tag);
return 0;
}
if (c->u.tag.element->tag->which != DATA1T_numeric)
{
- yaz_log(LOG_WARN, "Tag %s is not numeric", c->u.tag.tag);
+ yaz_log(YLOG_WARN, "Tag %s is not numeric", c->u.tag.tag);
return 0;
}
if (eh->select && !c->u.tag.node_selected)
assert(n->which == DATA1N_root);
if (strcmp(n->u.root.type, "explain"))
{
- yaz_log(LOG_WARN, "Attempt to convert a non-Explain record");
+ yaz_log(YLOG_WARN, "Attempt to convert a non-Explain record");
return 0;
}
for (n = n->child; n; n = n->next)
return res;
}
}
- yaz_log(LOG_WARN, "No category in Explain record");
+ yaz_log(YLOG_WARN, "No category in Explain record");
return 0;
}
-/* $Id: d1_grs.c,v 1.4 2004-09-28 10:15:03 adam Exp $
+/* $Id: d1_grs.c,v 1.5 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#include <stdlib.h>
#include <yaz/proto.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <d1_absyn.h>
#define D1_VARIANTARRAY 20 /* fixed max length on sup'd variant-list. Lazy me */
odr_strdup(o, p->u.variant.value);
break;
default:
- yaz_log(LOG_WARN, "Unable to handle value for variant %s",
+ yaz_log(YLOG_WARN, "Unable to handle value for variant %s",
p->u.variant.type->name);
return 0;
}
D1_VARIANTARRAY);
else if (m->num_supportedVariants >= D1_VARIANTARRAY)
{
- yaz_log(LOG_WARN, "Too many variants (D1_VARIANTARRAY==%d)",
+ yaz_log(YLOG_WARN, "Too many variants (D1_VARIANTARRAY==%d)",
D1_VARIANTARRAY);
return -1;
}
*len += oid_oidlen(res->u.oid) * sizeof(int);
break;
default:
- yaz_log(LOG_WARN, "Can't handle datatype.");
+ yaz_log(YLOG_WARN, "Can't handle datatype.");
return 0;
}
}
}
else
{
- yaz_log(LOG_WARN, "Bad data.");
+ yaz_log(YLOG_WARN, "Bad data.");
return 0;
}
data1_gettagbyname (dh, n->root->u.root.absyn->tagset,
"wellKnown")))
{
- yaz_log(LOG_WARN, "Unable to locate tag for 'wellKnown'");
+ yaz_log(YLOG_WARN, "Unable to locate tag for 'wellKnown'");
wellknown_tag = odr_malloc(o, sizeof(*wellknown_tag));
wellknown_tag->which = DATA1T_numeric;
wellknown_tag->value.numeric = 19;
-/* $Id: d1_handle.c,v 1.4 2004-09-28 10:15:03 adam Exp $
+/* $Id: d1_handle.c,v 1.5 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#include <stdio.h>
#include <stdlib.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <idzebra/data1.h>
struct data1_handle_info {
char **data1_get_read_buf (data1_handle dp, int **lenp)
{
*lenp = &dp->read_len;
- yaz_log (LOG_DEBUG, "data1_get_read_buf lenp=%u", **lenp);
+ yaz_log (YLOG_DEBUG, "data1_get_read_buf lenp=%u", **lenp);
return &dp->read_buf;
}
char **data1_get_map_buf (data1_handle dp, int **lenp)
{
*lenp = &dp->map_len;
- yaz_log (LOG_DEBUG, "data1_get_map_buf lenp=%u", **lenp);
+ yaz_log (YLOG_DEBUG, "data1_get_map_buf lenp=%u", **lenp);
return &dp->map_buf;
}
-/* $Id: d1_if.c,v 1.3 2004-09-28 10:15:03 adam Exp $
+/* $Id: d1_if.c,v 1.4 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#include <string.h>
#include <idzebra/data1.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <string.h>
}
else
{
- yaz_log(LOG_WARN,"Attempting to lookup data for tagpath: Child node is not a data node");
+ yaz_log(YLOG_WARN,"Attempting to lookup data for tagpath: Child node is not a data node");
}
}
else
{
- yaz_log(LOG_WARN,"Found a node matching the tagpath, but it has no child data nodes");
+ yaz_log(YLOG_WARN,"Found a node matching the tagpath, but it has no child data nodes");
}
}
else
{
- yaz_log(LOG_WARN,"Unable to lookup a node on the specified tag path");
+ yaz_log(YLOG_WARN,"Unable to lookup a node on the specified tag path");
}
return "";
}
else
{
- yaz_log(LOG_FATAL,"Node does not end with a ]");
+ yaz_log(YLOG_FATAL,"Node does not end with a ]");
/* Fatal Error */
return(NULL);
}
}
- yaz_log(LOG_DEBUG,"search node for child like [%d,%d,%s,%d]",iTagType,iTagValue,StringTagVal,iOccurences);
+ yaz_log(YLOG_DEBUG,"search node for child like [%d,%d,%s,%d]",iTagType,iTagValue,StringTagVal,iOccurences);
/* OK.. We have extracted tagtype, Value and Occurence, see if we can find a node */
}
else /* Attempt to match real element */
{
- yaz_log(LOG_WARN,"Non string tag matching not yet implemented");
+ yaz_log(YLOG_WARN,"Non string tag matching not yet implemented");
}
}
current_child = current_child->next;
-/* $Id: d1_map.c,v 1.5 2004-09-28 10:43:37 adam Exp $
+/* $Id: d1_map.c,v 1.6 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#include <string.h>
#include <yaz/oid.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <yaz/readconf.h>
#include <yaz/tpath.h>
#include <d1_absyn.h>
if (!(f = data1_path_fopen(dh, file, "r")))
{
- yaz_log(LOG_WARN|LOG_ERRNO, "%s", file);
+ yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", file);
return 0;
}
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # args for targetref",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # args for targetref",
file, lineno);
continue;
}
if ((res->target_absyn_ref = oid_getvalbyname(argv[1]))
== VAL_NONE)
{
- yaz_log(LOG_WARN, "%s:%d: Unknown reference '%s'",
+ yaz_log(YLOG_WARN, "%s:%d: Unknown reference '%s'",
file, lineno, argv[1]);
continue;
}
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # args for targetname",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # args for targetname",
file, lineno);
continue;
}
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # args for name", file, lineno);
+ yaz_log(YLOG_WARN, "%s:%d: Bad # args for name", file, lineno);
continue;
}
res->name = (char *)nmem_malloc(mem, strlen(argv[1])+1);
if (argc < 3)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # of args for map",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # of args for map",
file, lineno);
continue;
}
if ((np = sscanf(path, "(%d,%511[^)]):%511[^/]", &type, valstr,
parm)) < 2)
{
- yaz_log(LOG_WARN, "%s:%d: Syntax error in map "
+ yaz_log(YLOG_WARN, "%s:%d: Syntax error in map "
"directive: %s", file, lineno, argv[2]);
fclose(f);
return 0;
mapp = &(*mapp)->next;
}
else
- yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'",
+ yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'",
file, lineno, argv[0]);
fclose(f);
res->u.root.type = map->target_absyn_name;
if (!(res->u.root.absyn = data1_get_absyn(dh, map->target_absyn_name)))
{
- yaz_log(LOG_WARN, "%s: Failed to load target absyn '%s'",
+ yaz_log(YLOG_WARN, "%s: Failed to load target absyn '%s'",
map->name, map->target_absyn_name);
}
if (data1_is_xmlmode(dh))
-/* $Id: d1_marc.c,v 1.7 2004-09-28 10:15:03 adam Exp $
+/* $Id: d1_marc.c,v 1.8 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
Index Data Aps
#include <string.h>
#include <yaz/oid.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <yaz/marcdisp.h>
#include <yaz/readconf.h>
#include <yaz/xmalloc.h>
if (!(f = data1_path_fopen(dh, file, "r")))
{
- yaz_log(LOG_WARN|LOG_ERRNO, "%s", file);
+ yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", file);
return 0;
}
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d:Missing arg for %s", file, lineno,
+ yaz_log(YLOG_WARN, "%s:%d:Missing arg for %s", file, lineno,
*argv);
continue;
}
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno,
+ yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno,
*argv);
continue;
}
if ((res->reference = oid_getvalbyname(argv[1])) == VAL_NONE)
{
- yaz_log(LOG_WARN, "%s:%d: Unknown tagset reference '%s'",
+ yaz_log(YLOG_WARN, "%s:%d: Unknown tagset reference '%s'",
file, lineno, argv[1]);
continue;
}
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno,
+ yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno,
*argv);
continue;
}
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno,
+ yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno,
*argv);
continue;
}
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno,
+ yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno,
*argv);
continue;
}
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno,
+ yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno,
*argv);
continue;
}
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno,
+ yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno,
*argv);
continue;
}
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno,
+ yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno,
*argv);
continue;
}
res->force_identifier_length = atoi(argv[1]);
}
else
- yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'", file, lineno,
+ yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'", file, lineno,
*argv);
fclose(f);
#if 0
data1_pr_tree(dh, n, stdout);
#endif
- yaz_log (LOG_DEBUG, "nodetomarc");
+ yaz_log (YLOG_DEBUG, "nodetomarc");
memcpy (leader+5, p->record_status, 1);
memcpy (leader+6, p->implementation_codes, 4);
}
}
else if (subf->which != DATA1N_tag)
- yaz_log(LOG_WARN, "Malformed fields for marc output.");
+ yaz_log(YLOG_WARN, "Malformed fields for marc output.");
else
identifier = subf->u.tag.tag;
op[data_p] = ISO2709_IDFS;
-/* $Id: d1_prtree.c,v 1.4 2004-09-28 10:15:03 adam Exp $
+/* $Id: d1_prtree.c,v 1.5 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
Index Data Aps
02111-1307, USA.
*/
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <idzebra/data1.h>
static void pr_string (FILE *out, const char *str, int len)
-/* $Id: d1_read.c,v 1.10 2004-09-28 10:15:03 adam Exp $
+/* $Id: d1_read.c,v 1.11 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#include <yaz/xmalloc.h>
#include <yaz/yaz-util.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <d1_absyn.h>
data1_node *data1_get_root_tag (data1_handle dh, data1_node *n)
r->u.preprocess.attributes = 0;
break;
default:
- logf (LOG_WARN, "data_mk_node_type. bad type = %d\n", type);
+ yaz_log (YLOG_WARN, "data_mk_node_type. bad type = %d\n", type);
}
}
data1_node *res;
if (!absyn)
{
- yaz_log(LOG_WARN, "Unable to acquire abstract syntax " "for '%s'",
+ yaz_log(YLOG_WARN, "Unable to acquire abstract syntax " "for '%s'",
name);
/* It's now OK for a record not to have an absyn */
}
}
if (amp || c != '>')
{
- yaz_log(LOG_WARN, "d1: %d: Malformed tag", line);
+ yaz_log(YLOG_WARN, "d1: %d: Malformed tag", line);
return 0;
}
else
}
if (i != level)
{
- yaz_log (LOG_WARN, "%d: no begin tag for %s",
+ yaz_log (YLOG_WARN, "%d: no begin tag for %s",
line, tag);
break;
}
if (sscanf(args, "%s %s %n", tclass, type, &val_offset) != 2)
{
- yaz_log(LOG_WARN, "Malformed variant triple at '%s'", tag);
+ yaz_log(YLOG_WARN, "Malformed variant triple at '%s'", tag);
continue;
}
if (!(tp =
-/* $Id: d1_sumout.c,v 1.3 2004-09-28 10:15:03 adam Exp $
+/* $Id: d1_sumout.c,v 1.4 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#include <string.h>
#include <stdlib.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <yaz/proto.h>
#include <idzebra/data1.h>
assert(n->which == DATA1N_root);
if (strcmp(n->u.root.type, "summary"))
{
- yaz_log(LOG_WARN, "Attempt to convert a non-summary record");
+ yaz_log(YLOG_WARN, "Attempt to convert a non-summary record");
return 0;
}
{
if (c->which != DATA1N_tag || !c->u.tag.element)
{
- yaz_log(LOG_WARN, "Malformed element in Summary record");
+ yaz_log(YLOG_WARN, "Malformed element in Summary record");
return 0;
}
if (select && !c->u.tag.node_selected)
case 16: res->abstract = f_string(c, o); break;
case 17: abort(); /* TODO */
default:
- yaz_log(LOG_WARN, "Unknown element in Summary record.");
+ yaz_log(YLOG_WARN, "Unknown element in Summary record.");
}
}
return res;
-/* $Id: d1_tagset.c,v 1.3 2004-09-28 10:15:03 adam Exp $
+/* $Id: d1_tagset.c,v 1.4 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#include <stdlib.h>
#include <string.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <idzebra/data1.h>
/*
if (!(f = data1_path_fopen(dh, file, "r")))
{
- yaz_log(LOG_WARN|LOG_ERRNO, "%s", file);
+ yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", file);
return 0;
}
res = data1_empty_tagset (dh);
if (argc != 4)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # args to tag", file, lineno);
+ yaz_log(YLOG_WARN, "%s:%d: Bad # args to tag", file, lineno);
continue;
}
value = atoi(argv[1]);
if (!(rr->kind = data1_maptype(dh, type)))
{
- yaz_log(LOG_WARN, "%s:%d: Unknown datatype %s",
+ yaz_log(YLOG_WARN, "%s:%d: Unknown datatype %s",
file, lineno, type);
fclose(f);
return 0;
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # args to name", file, lineno);
+ yaz_log(YLOG_WARN, "%s:%d: Bad # args to name", file, lineno);
continue;
}
res->name = nmem_strdup(mem, argv[1]);
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # args to reference",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # args to reference",
file, lineno);
continue;
}
name = argv[1];
if ((res->reference = oid_getvalbyname(name)) == VAL_NONE)
{
- yaz_log(LOG_WARN, "%s:%d: Unknown tagset ref '%s'",
+ yaz_log(YLOG_WARN, "%s:%d: Unknown tagset ref '%s'",
file, lineno, name);
continue;
}
{
if (argc != 2)
{
- yaz_log (LOG_WARN, "%s:%d: Bad # args to type", file, lineno);
+ yaz_log (YLOG_WARN, "%s:%d: Bad # args to type", file, lineno);
continue;
}
if (!res->type)
if (argc < 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # args to include",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # args to include",
file, lineno);
continue;
}
*childp = data1_read_tagset (dh, name, type);
if (!(*childp))
{
- yaz_log(LOG_WARN, "%s:%d: Inclusion failed for tagset %s",
+ yaz_log(YLOG_WARN, "%s:%d: Inclusion failed for tagset %s",
file, lineno, name);
continue;
}
}
else
{
- yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'",
+ yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'",
file, lineno, cmd);
}
}
-/* $Id: d1_varset.c,v 1.3 2004-09-28 10:15:03 adam Exp $
+/* $Id: d1_varset.c,v 1.4 2004-11-19 10:26:53 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#include <stdlib.h>
#include <yaz/oid.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <d1_absyn.h>
data1_vartype *data1_getvartypebyct (data1_handle dh, data1_varset *set,
for (t = c->types; t; t = t->next)
if (!data1_matchstr(t->name, type))
return t;
- yaz_log(LOG_WARN, "Unknown variant type %s in class %s",
+ yaz_log(YLOG_WARN, "Unknown variant type %s in class %s",
type, zclass);
return 0;
}
- yaz_log(LOG_WARN, "Unknown variant class %s", zclass);
+ yaz_log(YLOG_WARN, "Unknown variant class %s", zclass);
return 0;
}
if (!(f = data1_path_fopen(dh, file, "r")))
{
- yaz_log(LOG_WARN|LOG_ERRNO, "%s", file);
+ yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", file);
return 0;
}
while ((argc = readconf_line(f, &lineno, line, 512, argv, 50)))
if (argc != 3)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # or args to class",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # or args to class",
file, lineno);
continue;
}
if (!typep)
{
- yaz_log(LOG_WARN, "%s:%d: Directive class must precede type",
+ yaz_log(YLOG_WARN, "%s:%d: Directive class must precede type",
file, lineno);
continue;
}
if (argc != 4)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # or args to type",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # or args to type",
file, lineno);
continue;
}
r->type = atoi(argv[1]);
if (!(r->datatype = data1_maptype (dh, argv[3])))
{
- yaz_log(LOG_WARN, "%s:%d: Unknown datatype '%s'",
+ yaz_log(YLOG_WARN, "%s:%d: Unknown datatype '%s'",
file, lineno, argv[3]);
fclose(f);
return 0;
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # args for name",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # args for name",
file, lineno);
continue;
}
{
if (argc != 2)
{
- yaz_log(LOG_WARN, "%s:%d: Bad # args for reference",
+ yaz_log(YLOG_WARN, "%s:%d: Bad # args for reference",
file, lineno);
continue;
}
if ((res->reference = oid_getvalbyname(argv[1])) == VAL_NONE)
{
- yaz_log(LOG_WARN, "%s:%d: Unknown reference '%s'",
+ yaz_log(YLOG_WARN, "%s:%d: Unknown reference '%s'",
file, lineno, argv[1]);
continue;
}
}
else
- yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'",
+ yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'",
file, lineno, argv[0]);
fclose(f);
-/* $Id: dfa.c,v 1.30 2003-06-18 21:32:44 adam Exp $
+/* $Id: dfa.c,v 1.31 2004-11-19 10:26:54 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
Index Data Aps
parse_info->expr_ptr = (const unsigned char *) cp0;
parse_info->look_ch = ((unsigned char **) mapto)[i][0];
- logf (LOG_DEBUG, "map from %c to %d", parse_info->expr_ptr[-1], parse_info->look_ch);
+ yaz_log (YLOG_DEBUG, "map from %c to %d", parse_info->expr_ptr[-1], parse_info->look_ch);
return L_CHAR;
}
-/* $Id: grepper.c,v 1.10 2002-08-02 19:26:55 adam Exp $
+/* $Id: grepper.c,v 1.11 2004-11-19 10:26:54 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
inf = fopen (fname, "r");
if (!inf)
{
- logf (LOG_FATAL|LOG_ERRNO, "cannot open `%s'", fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "cannot open `%s'", fname);
exit (1);
}
}
}
else
{
- logf (LOG_FATAL, "Unknown option '-%s'", arg);
+ yaz_log (YLOG_FATAL, "Unknown option '-%s'", arg);
exit (1);
}
}
-/* $Id: imalloc.c,v 1.9 2002-08-02 19:26:55 adam Exp $
+/* $Id: imalloc.c,v 1.10 2004-11-19 10:26:54 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
size_t words = (4*sizeof(unsigned) -1 + size)/sizeof(unsigned);
char *p = (char *)xmalloc( words*sizeof(unsigned) );
if( !p )
- logf (LOG_FATAL, "No memory: imalloc(%u); c/f %d/%d; %ld/%ld",
+ yaz_log (YLOG_FATAL, "No memory: imalloc(%u); c/f %d/%d; %ld/%ld",
size, alloc_calls, free_calls, alloc, max_alloc );
*((unsigned *)p) = size;
((unsigned *)p)[1] = MAG1;
#else
void *p = (void *)xmalloc( size );
if( !p )
- logf (LOG_FATAL, "Out of memory (imalloc)" );
+ yaz_log (YLOG_FATAL, "Out of memory (imalloc)" );
return p;
#endif
}
unsigned words = (4*sizeof(unsigned) -1 + size)/sizeof(unsigned);
char *p = (char *) xcalloc( words*sizeof(unsigned), 1 );
if( !p )
- logf (LOG_FATAL, "No memory: icalloc(%u); c/f %d/%d; %ld/%ld",
+ yaz_log (YLOG_FATAL, "No memory: icalloc(%u); c/f %d/%d; %ld/%ld",
size, alloc_calls, free_calls, alloc, max_alloc );
((unsigned *)p)[0] = size;
((unsigned *)p)[1] = MAG1;
#else
void *p = (void *) xcalloc( size, 1 );
if( !p )
- logf (LOG_FATAL, "Out of memory (icalloc)" );
+ yaz_log (YLOG_FATAL, "Out of memory (icalloc)" );
return p;
#endif
}
++free_calls;
size = (-2)[(unsigned *) p];
if( (-1)[(unsigned *) p] != MAG1 )
- logf (LOG_FATAL,"Internal: ifree(%u) magic 1 corrupted", size );
+ yaz_log (YLOG_FATAL,"Internal: ifree(%u) magic 1 corrupted", size );
if( size[(unsigned char *) p] != MAG2 )
- logf (LOG_FATAL,"Internal: ifree(%u) magic 2 corrupted", size );
+ yaz_log (YLOG_FATAL,"Internal: ifree(%u) magic 2 corrupted", size );
if( (size+1)[(unsigned char *) p] != MAG3 )
- logf (LOG_FATAL,"Internal: ifree(%u) magic 3 corrupted", size );
+ yaz_log (YLOG_FATAL,"Internal: ifree(%u) magic 3 corrupted", size );
alloc -= size;
if( alloc < 0L )
- logf (LOG_FATAL,"Internal: ifree(%u) negative alloc.", size );
+ yaz_log (YLOG_FATAL,"Internal: ifree(%u) negative alloc.", size );
xfree( (unsigned *) p-2 );
#else
xfree (p);
-/* $Id: dcompact.c,v 1.9 2004-09-09 09:07:12 adam Exp $
+/* $Id: dcompact.c,v 1.10 2004-11-19 10:26:54 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#include <string.h>
#include <stdio.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <dict.h>
static void dict_copy_page(Dict dict, char *to_p, char *from_p, int *map)
void *buf;
int size;
#if 0
- logf (LOG_LOG, "map[%d] = %d", i, map[i]);
+ yaz_log (YLOG_LOG, "map[%d] = %d", i, map[i]);
#endif
dict_bf_readp (dict_from->dbf, i, &buf);
size = ((DICT_size(buf)+sizeof(short)-1)/sizeof(short) +
no_dir += DICT_nodir(buf);
}
#if 0
- logf (LOG_LOG, "map[%d] = %d", i, map[i]);
- logf (LOG_LOG, "nodir = %d", no_dir);
+ yaz_log (YLOG_LOG, "map[%d] = %d", i, map[i]);
+ yaz_log (YLOG_LOG, "nodir = %d", no_dir);
#endif
dict_to->head.root = map[1];
dict_to->head.last = map[i];
void *old_p, *new_p;
dict_bf_readp (dict_from->dbf, i, &old_p);
- logf (LOG_LOG, "dict_bf_newp no=%d size=%d", map[i],
+ yaz_log (YLOG_LOG, "dict_bf_newp no=%d size=%d", map[i],
map[i+1] - map[i]);
dict_bf_newp (dict_to->dbf, map[i], &new_p, map[i+1] - map[i]);
-/* $Id: dictext.c,v 1.9 2002-08-02 19:26:55 adam Exp $
+/* $Id: dictext.c,v 1.10 2004-11-19 10:26:55 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
inputfile = arg;
else
{
- logf (LOG_FATAL, "too many files specified\n");
+ yaz_log (YLOG_FATAL, "too many files specified\n");
exit (1);
}
}
use8 = 1;
else
{
- logf (LOG_FATAL, "Unknown option '-%s'", arg);
+ yaz_log (YLOG_FATAL, "Unknown option '-%s'", arg);
exit (1);
}
}
ipf = fopen (inputfile, "r");
if (!ipf)
{
- logf (LOG_FATAL|LOG_ERRNO, "cannot open '%s'", inputfile);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "cannot open '%s'", inputfile);
exit (1);
}
}
-/* $Id: dicttest.c,v 1.29 2004-09-09 09:07:12 adam Exp $
+/* $Id: dicttest.c,v 1.30 2004-11-19 10:26:55 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
name = arg;
else
{
- logf (LOG_FATAL, "too many files specified\n");
+ yaz_log (YLOG_FATAL, "too many files specified\n");
exit (1);
}
}
}
else
{
- logf (LOG_FATAL, "Unknown option '-%s'", arg);
+ yaz_log (YLOG_FATAL, "Unknown option '-%s'", arg);
exit (1);
}
}
if (!config || !name)
{
- logf (LOG_FATAL, "no config and/or dictionary specified");
+ yaz_log (YLOG_FATAL, "no config and/or dictionary specified");
exit (1);
}
my_resource = res_open (config, 0, 0);
if (!my_resource)
{
- logf (LOG_FATAL, "cannot open resource `%s'", config);
+ yaz_log (YLOG_FATAL, "cannot open resource `%s'", config);
exit (1);
}
bfs = bfs_create (res_get(my_resource, "register"), 0);
if (!bfs)
{
- logf (LOG_FATAL, "bfs_create fail");
+ yaz_log (YLOG_FATAL, "bfs_create fail");
exit (1);
}
dict = dict_open (bfs, name, cache, rw, 0, 4096);
if (!dict)
{
- logf (LOG_FATAL, "dict_open fail of `%s'", name);
+ yaz_log (YLOG_FATAL, "dict_open fail of `%s'", name);
exit (1);
}
if (inputfile)
if (!(ipf = fopen(inputfile, "r")))
{
- logf (LOG_FATAL|LOG_ERRNO, "cannot open %s", inputfile);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "cannot open %s", inputfile);
exit (1);
}
case 1:
no_of_change++;
if (unique)
- logf (LOG_LOG, "%s change\n", ipf_ptr);
+ yaz_log (YLOG_LOG, "%s change\n", ipf_ptr);
break;
case 2:
if (unique)
- logf (LOG_LOG, "%s duplicate\n", ipf_ptr);
+ yaz_log (YLOG_LOG, "%s duplicate\n", ipf_ptr);
no_of_same++;
break;
}
}
if (rw && delete_term)
{
- logf (LOG_LOG, "dict_delete_subtree %s", delete_term);
+ yaz_log (YLOG_LOG, "dict_delete_subtree %s", delete_term);
dict_delete_subtree (dict, delete_term, 0, 0);
}
if (grep_pattern)
{
if (range < 0)
range = 0;
- logf (LOG_LOG, "Grepping '%s'", grep_pattern);
+ yaz_log (YLOG_LOG, "Grepping '%s'", grep_pattern);
dict_lookup_grep (dict, grep_pattern, range, NULL, &max_pos,
srange, grep_handler);
}
if (rw)
{
- logf (LOG_LOG, "Iterations.... %d", no_of_iterations);
+ yaz_log (YLOG_LOG, "Iterations.... %d", no_of_iterations);
if (do_delete)
{
- logf (LOG_LOG, "No of deleted. %d", no_of_deleted);
- logf (LOG_LOG, "No not found.. %d", no_not_found);
+ yaz_log (YLOG_LOG, "No of deleted. %d", no_of_deleted);
+ yaz_log (YLOG_LOG, "No not found.. %d", no_not_found);
}
else
{
- logf (LOG_LOG, "No of new..... %d", no_of_new);
- logf (LOG_LOG, "No of change.. %d", no_of_change);
+ yaz_log (YLOG_LOG, "No of new..... %d", no_of_new);
+ yaz_log (YLOG_LOG, "No of change.. %d", no_of_change);
}
}
else
{
- logf (LOG_LOG, "Lookups....... %d", no_of_iterations);
- logf (LOG_LOG, "No of hits.... %d", no_of_hits);
- logf (LOG_LOG, "No of misses.. %d", no_of_misses);
+ yaz_log (YLOG_LOG, "Lookups....... %d", no_of_iterations);
+ yaz_log (YLOG_LOG, "No of hits.... %d", no_of_hits);
+ yaz_log (YLOG_LOG, "No of misses.. %d", no_of_misses);
}
if (scan_the_thing)
{
int before = 1000000;
int after = 1000000;
- logf (LOG_LOG, "dict_scan");
+ yaz_log (YLOG_LOG, "dict_scan");
term_dict[0] = 1;
term_dict[1] = 0;
dict_scan (dict, term_dict, &before, &after, 0, scan_handler);
-/* $Id: drdwr.c,v 1.13 2002-08-02 19:26:55 adam Exp $
+/* $Id: drdwr.c,v 1.14 2004-11-19 10:26:55 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
bf_write (bf->bf, effective_block, effective_offset,
p->nbytes, p->data);
#if 0
- logf (LOG_LOG, "bf_write no=%d offset=%d size=%d",
+ yaz_log (YLOG_LOG, "bf_write no=%d offset=%d size=%d",
effective_block, effective_offset,
p->nbytes);
#endif
else
{
#if 0
- logf (LOG_LOG, "bf_write1 no=%d offset=%d size=%d",
+ yaz_log (YLOG_LOG, "bf_write1 no=%d offset=%d size=%d",
effective_block, effective_offset,
remain);
#endif
bf_write (bf->bf, effective_block, effective_offset,
remain, p->data);
#if 0
- logf (LOG_LOG, "bf_write2 no=%d offset=%d size=%d",
+ yaz_log (YLOG_LOG, "bf_write2 no=%d offset=%d size=%d",
effective_block+1, 0, p->nbytes - remain);
#endif
bf_write (bf->bf, effective_block+1, 0,
-/* $Id: insert.c,v 1.22 2002-08-02 19:26:55 adam Exp $
+/* $Id: insert.c,v 1.23 2004-11-19 10:26:55 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
}
if (split_page (dict, ptr, p))
{
- logf (LOG_FATAL, "Unable to split page %d\n", ptr);
+ yaz_log (YLOG_FATAL, "Unable to split page %d\n", ptr);
abort ();
}
return dict_ins (dict, str-1, ptr, userlen, userinfo);
-/* $Id: lookgrep.c,v 1.26 2002-09-18 21:01:15 adam Exp $
+/* $Id: lookgrep.c,v 1.27 2004-11-19 10:26:55 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
dfa_verbose = 1;
#endif
- logf (LOG_DEBUG, "dict_lookup_grep range=%d", range);
+ yaz_log (YLOG_DEBUG, "dict_lookup_grep range=%d", range);
for (i = 0; pattern[i]; i++)
{
- logf (LOG_DEBUG, " %3d %c", pattern[i],
+ yaz_log (YLOG_DEBUG, " %3d %c", pattern[i],
(pattern[i] > ' ' && pattern[i] < 127) ? pattern[i] : '?');
}
i = dfa_parse (dfa, &this_pattern);
if (i || *this_pattern)
{
- yaz_log (LOG_WARN, "dfa_parse fail=%d", i);
+ yaz_log (YLOG_WARN, "dfa_parse fail=%d", i);
dfa_delete (&dfa);
return -1;
}
dfa, max_pos, init_pos);
else
i = 0;
- logf (LOG_DEBUG, "max_pos = %d", *max_pos);
+ yaz_log (YLOG_DEBUG, "max_pos = %d", *max_pos);
dfa_delete (&dfa);
xfree (Rj);
rm_MatchContext (&mc);
-/* $Id: open.c,v 1.20 2004-09-09 09:07:12 adam Exp $
+/* $Id: open.c,v 1.21 2004-11-19 10:26:55 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
page_size = DICT_DEFAULT_PAGESIZE;
if (page_size < 2048)
{
- logf (LOG_WARN, "Page size for dict %s %d<2048. Set to 2048",
+ yaz_log (YLOG_WARN, "Page size for dict %s %d<2048. Set to 2048",
name, page_size);
page_size = 2048;
}
if(!dict->dbf)
{
- logf (LOG_WARN, "Cannot open `%s'", name);
+ yaz_log (YLOG_WARN, "Cannot open `%s'", name);
xfree (dict);
return NULL;
}
memcpy (&dict->head, head_buf, sizeof(dict->head));
if (strcmp (dict->head.magic_str, DICT_MAGIC))
{
- logf (LOG_WARN, "Bad magic of `%s'", name);
+ yaz_log (YLOG_WARN, "Bad magic of `%s'", name);
exit (1);
}
if (dict->head.page_size != page_size)
{
- logf (LOG_WARN, "Page size for existing dict %s is %d. Current is %d",
+ yaz_log (YLOG_WARN, "Page size for existing dict %s is %d. Current is %d",
name, dict->head.page_size, page_size);
}
}
-/* $Id: scan.c,v 1.15 2002-08-02 19:26:55 adam Exp $
+/* $Id: scan.c,v 1.16 2004-11-19 10:26:55 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
{
int i;
- logf (LOG_DEBUG, "dict_scan");
+ yaz_log (YLOG_DEBUG, "dict_scan");
for (i = 0; str[i]; i++)
{
- logf (LOG_DEBUG, " %3d %c", str[i],
+ yaz_log (YLOG_DEBUG, " %3d %c", str[i],
(str[i] > ' ' && str[i] < 127) ? str[i] : '?');
}
if (!dict->head.root)
-/* $Id: dict.h,v 1.33 2004-09-09 09:07:12 adam Exp $
+/* $Id: dict.h,v 1.34 2004-11-19 10:26:55 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#define DICT_H
#include <bfile.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#ifdef __cplusplus
extern "C" {
-/* $Id: zebrautl.h,v 1.9 2004-08-25 09:23:36 adam Exp $
+/* $Id: zebrautl.h,v 1.10 2004-11-19 10:26:55 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#include <idzebra/res.h>
#include <idzebra/version.h>
+/* check that we don't have all too old yaz */
+#ifndef YLOG_ERRNO
+#error Need a modern yaz with ylog.h
+#endif
+
YAZ_BEGIN_CDECL
zint atoi_zn (const char *buf, zint len);
YAZ_END_CDECL
-/* $Id: apitest.c,v 1.17 2004-08-25 09:23:36 adam Exp $
+/* $Id: apitest.c,v 1.18 2004-11-19 10:26:56 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#include <stdio.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <yaz/pquery.h>
#include <idzebra/api.h>
/* bad query? */
if (!query)
{
- logf (LOG_WARN, "bad query %s\n", argv[argno]);
+ yaz_log (YLOG_WARN, "bad query %s\n", argv[argno]);
odr_reset (odr_input);
continue;
}
-/* $Id: attribute.c,v 1.16 2004-08-25 09:23:36 adam Exp $
+/* $Id: attribute.c,v 1.17 2004-11-19 10:26:56 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#include <stdio.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <idzebra/res.h>
#include <zebrautl.h>
#include "index.h"
-/* $Id: dir.c,v 1.28 2003-01-13 22:37:12 adam Exp $
+/* $Id: dir.c,v 1.29 2004-11-19 10:26:56 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
*full_rep = '\0';
strcat (full_rep, rep);
- logf (LOG_DEBUG, "dir_open %s", full_rep);
+ yaz_log (YLOG_DEBUG, "dir_open %s", full_rep);
if (!(dir = opendir(full_rep)))
{
- logf (LOG_WARN|LOG_ERRNO, "opendir %s", rep);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "opendir %s", rep);
if (errno != ENOENT && errno != EACCES)
exit (1);
return NULL;
}
entry[idx].name = NULL;
closedir (dir);
- logf (LOG_DEBUG, "dir_close");
+ yaz_log (YLOG_DEBUG, "dir_close");
return entry;
}
-/* $Id: dirs.c,v 1.20 2004-08-04 08:35:23 adam Exp $
+/* $Id: dirs.c,v 1.21 2004-11-19 10:26:56 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
struct dirs_info *p;
int before = 0, after;
- logf (LOG_DEBUG, "dirs_open %s", rep);
+ yaz_log (YLOG_DEBUG, "dirs_open %s", rep);
p = (struct dirs_info *) xmalloc (sizeof (*p));
p->dict = dict;
p->rw = rw;
after = p->no_max = 100;
p->entries = (struct dirs_entry *)
xmalloc (sizeof(*p->entries) * (p->no_max));
- logf (LOG_DEBUG, "dirs_open first scan");
+ yaz_log (YLOG_DEBUG, "dirs_open first scan");
dict_scan (p->dict, p->nextpath, &before, &after, p, dirs_client_proc);
return p;
}
if (p->no_read < p->no_cur)
{
- logf (LOG_DEBUG, "dirs_read %d. returns %s", p->no_read,
+ yaz_log (YLOG_DEBUG, "dirs_read %d. returns %s", p->no_read,
(p->entries + p->no_read)->path);
return p->last_entry = p->entries + (p->no_read++);
}
}
p->no_read = 1;
p->nextpath_deleted = 0;
- logf (LOG_DEBUG, "dirs_read rescan %s", p->nextpath);
+ yaz_log (YLOG_DEBUG, "dirs_read rescan %s", p->nextpath);
dict_scan (p->dict, p->nextpath, &before, &after, p, dirs_client_proc);
if (p->no_read <= p->no_cur)
return p->last_entry = p->entries;
char path[DIRS_MAX_PATH];
sprintf (path, "%s%s", p->prefix, src);
- logf (LOG_DEBUG, "dirs_mkdir %s", path);
+ yaz_log (YLOG_DEBUG, "dirs_mkdir %s", path);
if (p->rw)
dict_insert (p->dict, path, sizeof(mtime), &mtime);
}
char path[DIRS_MAX_PATH];
sprintf (path, "%s%s", p->prefix, src);
- logf (LOG_DEBUG, "dirs_rmdir %s", path);
+ yaz_log (YLOG_DEBUG, "dirs_rmdir %s", path);
if (p->rw)
dict_delete (p->dict, path);
}
char info[16];
sprintf (path, "%s%s", p->prefix, src);
- logf (LOG_DEBUG, "dirs_add %s", path);
+ yaz_log (YLOG_DEBUG, "dirs_add %s", path);
memcpy (info, &sysno, sizeof(sysno));
memcpy (info+sizeof(sysno), &mtime, sizeof(mtime));
if (p->rw)
char path[DIRS_MAX_PATH];
sprintf (path, "%s%s", p->prefix, src);
- logf (LOG_DEBUG, "dirs_del %s", path);
+ yaz_log (YLOG_DEBUG, "dirs_del %s", path);
if (p->rw)
{
if (!strcmp(path, p->nextpath))
-/* $Id: extract.c,v 1.165 2004-10-04 09:27:48 adam Exp $
+/* $Id: extract.c,v 1.166 2004-11-19 10:26:56 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
++zh->records_processed;
if (!(zh->records_processed % 1000))
{
- logf (LOG_LOG, "Records: "ZINT_FORMAT" i/u/d "
+ yaz_log (YLOG_LOG, "Records: "ZINT_FORMAT" i/u/d "
ZINT_FORMAT"/"ZINT_FORMAT"/"ZINT_FORMAT,
zh->records_processed, zh->records_inserted, zh->records_updated,
zh->records_deleted);
}
else
{
- logf (LOG_WARN, "Missing ) in match criteria %s in group %s",
+ yaz_log (YLOG_WARN, "Missing ) in match criteria %s in group %s",
spec, zh->m_group ? zh->m_group : "none");
return NULL;
}
}
if (first)
{
- logf (LOG_WARN, "Record didn't contain match"
+ yaz_log (YLOG_WARN, "Record didn't contain match"
" fields in (%s,%s)", attset_str, attname_str);
return NULL;
}
}
else
{
- logf (LOG_WARN, "Syntax error in match criteria %s in group %s",
+ yaz_log (YLOG_WARN, "Syntax error in match criteria %s in group %s",
spec, zh->m_group ? zh->m_group : "none");
return NULL;
}
}
if (dst == dstBuf)
{
- logf (LOG_WARN, "No match criteria for record %s in group %s",
+ yaz_log (YLOG_WARN, "No match criteria for record %s in group %s",
fname, zh->m_group ? zh->m_group : "none");
return NULL;
}
recType_byName (zh->reg->recTypes, zh->res, zh->m_record_type,
&clientData)))
{
- logf (LOG_WARN, "No such record type: %s", zh->m_record_type);
+ yaz_log (YLOG_WARN, "No such record type: %s", zh->m_record_type);
return 0;
}
if (zh->m_flag_rw &&
zh->records_processed < zh->m_file_verbose_limit)
{
- logf (LOG_WARN, "fail %s %s " PRINTF_OFF_T, zh->m_record_type,
+ yaz_log (YLOG_WARN, "fail %s %s " PRINTF_OFF_T, zh->m_record_type,
fname, recordOffset);
}
return 0;
if (zh->m_flag_rw &&
zh->records_processed < zh->m_file_verbose_limit)
{
- logf (LOG_WARN, "no filter for %s %s "
+ yaz_log (YLOG_WARN, "no filter for %s %s "
PRINTF_OFF_T, zh->m_record_type,
fname, recordOffset);
}
return 1;
if (zh->records_processed < zh->m_file_verbose_limit)
- logf (LOG_WARN, "empty %s %s " PRINTF_OFF_T, zh->m_record_type,
+ yaz_log (YLOG_WARN, "empty %s %s " PRINTF_OFF_T, zh->m_record_type,
fname, recordOffset);
return 1;
}
}
else
{
- logf (LOG_WARN, "Bad match criteria");
+ yaz_log (YLOG_WARN, "Bad match criteria");
return 0;
}
}
/* new record */
if (deleteFlag)
{
- logf (LOG_LOG, "delete %s %s " PRINTF_OFF_T, zh->m_record_type,
+ yaz_log (YLOG_LOG, "delete %s %s " PRINTF_OFF_T, zh->m_record_type,
fname, recordOffset);
- logf (LOG_WARN, "cannot delete record above (seems new)");
+ yaz_log (YLOG_WARN, "cannot delete record above (seems new)");
return 1;
}
if (zh->records_processed < zh->m_file_verbose_limit)
- logf (LOG_LOG, "add %s %s " PRINTF_OFF_T, zh->m_record_type,
+ yaz_log (YLOG_LOG, "add %s %s " PRINTF_OFF_T, zh->m_record_type,
fname, recordOffset);
rec = rec_new (zh->reg->records);
if (!force_update && recordAttr->runNumber ==
zebraExplain_runNumberIncrement (zh->reg->zei, 0))
{
- yaz_log (LOG_LOG, "run number = %d", recordAttr->runNumber);
- yaz_log (LOG_LOG, "skipped %s %s " PRINTF_OFF_T,
+ yaz_log (YLOG_LOG, "run number = %d", recordAttr->runNumber);
+ yaz_log (YLOG_LOG, "skipped %s %s " PRINTF_OFF_T,
zh->m_record_type, fname, recordOffset);
extract_flushSortKeys (zh, *sysno, -1, &zh->reg->sortKeys);
rec_rm (&rec);
/* record going to be deleted */
if (!delkeys.buf_used)
{
- logf (LOG_LOG, "delete %s %s " PRINTF_OFF_T,
+ yaz_log (YLOG_LOG, "delete %s %s " PRINTF_OFF_T,
zh->m_record_type, fname, recordOffset);
- logf (LOG_WARN, "cannot delete file above, storeKeys false");
+ yaz_log (YLOG_WARN, "cannot delete file above, storeKeys false");
}
else
{
if (zh->records_processed < zh->m_file_verbose_limit)
- logf (LOG_LOG, "delete %s %s " PRINTF_OFF_T,
+ yaz_log (YLOG_LOG, "delete %s %s " PRINTF_OFF_T,
zh->m_record_type, fname, recordOffset);
zh->records_deleted++;
if (matchStr)
/* record going to be updated */
if (!delkeys.buf_used)
{
- logf (LOG_LOG, "update %s %s " PRINTF_OFF_T,
+ yaz_log (YLOG_LOG, "update %s %s " PRINTF_OFF_T,
zh->m_record_type, fname, recordOffset);
- logf (LOG_WARN, "cannot update file above, storeKeys false");
+ yaz_log (YLOG_WARN, "cannot update file above, storeKeys false");
}
else
{
if (zh->records_processed < zh->m_file_verbose_limit)
- logf (LOG_LOG, "update %s %s " PRINTF_OFF_T,
+ yaz_log (YLOG_LOG, "update %s %s " PRINTF_OFF_T,
zh->m_record_type, fname, recordOffset);
extract_flushSortKeys (zh, *sysno, 1, &zh->reg->sortKeys);
extract_flushRecordKeys (zh, *sysno, 1, &zh->reg->keys);
xmalloc (recordAttr->recordSize);
if (lseek (fi->fd, recordOffset, SEEK_SET) < 0)
{
- logf (LOG_ERRNO|LOG_FATAL, "seek to " PRINTF_OFF_T " in %s",
+ yaz_log (YLOG_ERRNO|YLOG_FATAL, "seek to " PRINTF_OFF_T " in %s",
recordOffset, fname);
exit (1);
}
if (read (fi->fd, rec->info[recInfo_storeData], recordAttr->recordSize)
< recordAttr->recordSize)
{
- logf (LOG_ERRNO|LOG_FATAL, "read %d bytes of %s",
+ yaz_log (YLOG_ERRNO|YLOG_FATAL, "read %d bytes of %s",
recordAttr->recordSize, fname);
exit (1);
}
else
sprintf (gprefix, "%s.", zh->m_group);
- logf (LOG_DEBUG, "fileExtract %s", fname);
+ yaz_log (YLOG_DEBUG, "fileExtract %s", fname);
/* determine file extension */
*ext = '\0';
if (!zh->m_record_type)
{
if (zh->records_processed < zh->m_file_verbose_limit)
- logf (LOG_LOG, "? %s", fname);
+ yaz_log (YLOG_LOG, "? %s", fname);
return 0;
}
/* determine match criteria */
if ((fd = open (full_rep, O_BINARY|O_RDONLY)) == -1)
{
- logf (LOG_WARN|LOG_ERRNO, "open %s", full_rep);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "open %s", full_rep);
zh->m_record_type = original_record_type;
return 0;
}
}
if (recordType && *recordType) {
- logf (LOG_DEBUG, "Record type explicitly specified: %s", recordType);
+ yaz_log (YLOG_DEBUG, "Record type explicitly specified: %s", recordType);
recType = recType_byName (zh->reg->recTypes, zh->res, recordType,
&clientData);
} else {
if (!(zh->m_record_type)) {
- logf (LOG_WARN, "No such record type defined");
+ yaz_log (YLOG_WARN, "No such record type defined");
return 0;
}
- logf (LOG_DEBUG, "Get record type from rgroup: %s",zh->m_record_type);
+ yaz_log (YLOG_DEBUG, "Get record type from rgroup: %s",zh->m_record_type);
recType = recType_byName (zh->reg->recTypes, zh->res,
zh->m_record_type, &clientData);
recordType = zh->m_record_type;
}
if (!recType) {
- logf (LOG_WARN, "No such record type: %s", zh->m_record_type);
+ yaz_log (YLOG_WARN, "No such record type: %s", zh->m_record_type);
return 0;
}
else if (r == RECCTRL_EXTRACT_ERROR_GENERIC)
{
/* error occured during extraction ... */
- yaz_log (LOG_WARN, "extract error: generic");
+ yaz_log (YLOG_WARN, "extract error: generic");
return 0;
}
else if (r == RECCTRL_EXTRACT_ERROR_NO_SUCH_FILTER)
{
/* error occured during extraction ... */
- yaz_log (LOG_WARN, "extract error: no such filter");
+ yaz_log (YLOG_WARN, "extract error: no such filter");
return 0;
}
if (zh->reg->keys.buf_used == 0)
is probably empty - unless flagShowRecords is in use */
if (test_mode)
return 1;
- logf (LOG_WARN, "No keys generated for record");
- logf (LOG_WARN, " The file is probably empty");
+ yaz_log (YLOG_WARN, "No keys generated for record");
+ yaz_log (YLOG_WARN, " The file is probably empty");
return 1;
}
/* match criteria */
zh->m_record_id);
if (!matchStr)
{
- logf (LOG_WARN, "Bad match criteria (recordID)");
+ yaz_log (YLOG_WARN, "Bad match criteria (recordID)");
return 1;
}
}
/* new record */
if (delete_flag)
{
- logf (LOG_LOG, "delete %s %s %ld", recordType,
+ yaz_log (YLOG_LOG, "delete %s %s %ld", recordType,
pr_fname, (long) recordOffset);
- logf (LOG_WARN, "cannot delete record above (seems new)");
+ yaz_log (YLOG_WARN, "cannot delete record above (seems new)");
return 1;
}
- logf (LOG_LOG, "add %s %s %ld", recordType, pr_fname,
+ yaz_log (YLOG_LOG, "add %s %s %ld", recordType, pr_fname,
(long) recordOffset);
rec = rec_new (zh->reg->records);
struct sortKeys sortKeys;
if (!allow_update) {
- logf (LOG_LOG, "skipped %s %s %ld",
+ yaz_log (YLOG_LOG, "skipped %s %s %ld",
recordType, pr_fname, (long) recordOffset);
logRecord(zh);
return -1;
if (recordAttr->runNumber ==
zebraExplain_runNumberIncrement (zh->reg->zei, 0))
{
- logf (LOG_LOG, "skipped %s %s %ld", recordType,
+ yaz_log (YLOG_LOG, "skipped %s %s %ld", recordType,
pr_fname, (long) recordOffset);
extract_flushSortKeys (zh, *sysno, -1, &zh->reg->sortKeys);
rec_rm (&rec);
/* record going to be deleted */
if (!delkeys.buf_used)
{
- logf (LOG_LOG, "delete %s %s %ld", recordType,
+ yaz_log (YLOG_LOG, "delete %s %s %ld", recordType,
pr_fname, (long) recordOffset);
- logf (LOG_WARN, "cannot delete file above, storeKeys false");
+ yaz_log (YLOG_WARN, "cannot delete file above, storeKeys false");
}
else
{
- logf (LOG_LOG, "delete %s %s %ld", recordType,
+ yaz_log (YLOG_LOG, "delete %s %s %ld", recordType,
pr_fname, (long) recordOffset);
zh->records_deleted++;
if (matchStr)
/* record going to be updated */
if (!delkeys.buf_used)
{
- logf (LOG_LOG, "update %s %s %ld", recordType,
+ yaz_log (YLOG_LOG, "update %s %s %ld", recordType,
pr_fname, (long) recordOffset);
- logf (LOG_WARN, "cannot update file above, storeKeys false");
+ yaz_log (YLOG_WARN, "cannot update file above, storeKeys false");
}
else
{
- logf (LOG_LOG, "update %s %s %ld", recordType,
+ yaz_log (YLOG_LOG, "update %s %s %ld", recordType,
pr_fname, (long) recordOffset);
extract_flushSortKeys (zh, *sysno, 1, &zh->reg->sortKeys);
extract_flushRecordKeys (zh, *sysno, 1, &zh->reg->keys);
int mem= 1024*1024* atoi( res_get_def( zh->res, "memmax", "8"));
if (mem <= 0)
{
- logf(LOG_WARN, "Invalid memory setting, using default 8 MB");
+ yaz_log(YLOG_WARN, "Invalid memory setting, using default 8 MB");
mem= 1024*1024*8;
}
/* FIXME: That "8" should be in a default settings include */
#endif
if (!zh->reg->key_buf || ptr_i <= 0)
{
- logf (LOG_DEBUG, " nothing to flush section=%d buf=%p i=%d",
+ yaz_log (YLOG_DEBUG, " nothing to flush section=%d buf=%p i=%d",
zh->reg->key_file_no, zh->reg->key_buf, ptr_i);
- logf (LOG_DEBUG, " buf=%p ",
+ yaz_log (YLOG_DEBUG, " buf=%p ",
zh->reg->key_buf);
- logf (LOG_DEBUG, " ptr=%d ",zh->reg->ptr_i);
- logf (LOG_DEBUG, " reg=%p ",zh->reg);
+ yaz_log (YLOG_DEBUG, " ptr=%d ",zh->reg->ptr_i);
+ yaz_log (YLOG_DEBUG, " reg=%p ",zh->reg);
return;
}
(zh->reg->key_file_no)++;
- logf (LOG_LOG, "sorting section %d", (zh->reg->key_file_no));
- logf (LOG_DEBUG, " sort_buff at %p n=%d",
+ yaz_log (YLOG_LOG, "sorting section %d", (zh->reg->key_file_no));
+ yaz_log (YLOG_DEBUG, " sort_buff at %p n=%d",
zh->reg->key_buf + zh->reg->ptr_top - ptr_i,ptr_i);
#if !SORT_EXTRA
qsort (zh->reg->key_buf + zh->reg->ptr_top - ptr_i, ptr_i,
temp_policy=toupper(res_get_def(zh->res,"tempfiles","auto")[0]);
if (temp_policy != 'Y' && temp_policy != 'N' && temp_policy != 'A') {
- logf (LOG_WARN, "Illegal tempfiles setting '%c'. using 'Auto' ",
+ yaz_log (YLOG_WARN, "Illegal tempfiles setting '%c'. using 'Auto' ",
temp_policy);
temp_policy='A';
}
if (!(outf = fopen (out_fname, "wb")))
{
- logf (LOG_FATAL|LOG_ERRNO, "fopen %s", out_fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "fopen %s", out_fname);
exit (1);
}
- logf (LOG_LOG, "writing section %d", zh->reg->key_file_no);
+ yaz_log (YLOG_LOG, "writing section %d", zh->reg->key_file_no);
prevcp = cp = (zh->reg->key_buf)[zh->reg->ptr_top - ptr_i];
encode_key_init (&encode_info);
if (!(outf = fopen (out_fname, "wb")))
{
- logf (LOG_FATAL|LOG_ERRNO, "fopen %s", out_fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "fopen %s", out_fname);
exit (1);
}
- logf (LOG_LOG, "writing section %d", key_file_no);
+ yaz_log (YLOG_LOG, "writing section %d", key_file_no);
i = ptr_i;
prevcp = key_buf[ptr_top-i];
while (1)
{
key_y_len = strlen(prevcp)+1;
#if 0
- logf (LOG_LOG, "key_y_len: %2d %02x %02x %s",
+ yaz_log (YLOG_LOG, "key_y_len: %2d %02x %02x %s",
key_y_len, prevcp[0], prevcp[1], 2+prevcp);
#endif
qsort (key_buf + ptr_top-ptr_i, ptr_i - i,
#endif
if (fclose (outf))
{
- logf (LOG_FATAL|LOG_ERRNO, "fclose %s", out_fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "fclose %s", out_fname);
exit (1);
}
- logf (LOG_LOG, "finished section %d", zh->reg->key_file_no);
+ yaz_log (YLOG_LOG, "finished section %d", zh->reg->key_file_no);
zh->reg->ptr_i = 0;
zh->reg->key_buf_used = 0;
}
#if 0
/* just for debugging .. */
- yaz_log(LOG_LOG, "set=%d use=%d seqno=%d", p->attrSet, p->attrUse,
+ yaz_log(YLOG_LOG, "set=%d use=%d seqno=%d", p->attrSet, p->attrUse,
p->seqno);
#endif
int i = 0, remain = p->length;
int first; /* first position */
-yaz_log(LOG_DEBUG, "Complete field, w='%.*s'", p->length, p->string);
+yaz_log(YLOG_DEBUG, "Complete field, w='%.*s'", p->length, p->string);
if (remain > 0)
map = zebra_maps_input (p->zebra_maps, p->reg_type, &b, remain, 1);
{
if (i >= IT_MAX_WORD)
break;
- yaz_log(LOG_DEBUG, "Adding string to index '%d'", **map);
+ yaz_log(YLOG_DEBUG, "Adding string to index '%d'", **map);
while (i < IT_MAX_WORD && *cp)
buf[i++] = *(cp++);
}
{
WRBUF wrbuf;
#if 0
- yaz_log (LOG_LOG, "token_add "
+ yaz_log (YLOG_LOG, "token_add "
"reg_type=%c attrSet=%d attrUse=%d seqno=%d s=%.*s",
p->reg_type, p->attrSet, p->attrUse, p->seqno, p->length,
p->string);
*bp0 = (*k * 128) + bp - bp0 - 1; /* length and insert/delete combined */
if (fwrite (i->buf, bp - i->buf, 1, outf) != 1)
{
- logf (LOG_FATAL|LOG_ERRNO, "fwrite");
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "fwrite");
exit (1);
}
}
i->cmd = i->prevcmd;
if (fwrite (i->buf, bp - i->buf, 1, outf) != 1)
{
- logf (LOG_FATAL|LOG_ERRNO, "fwrite");
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "fwrite");
exit (1);
}
i->keylen=0; /* ok, it's written, forget it */
i->cmd = i->prevcmd;
if (fwrite (i->buf, bp - i->buf, 1, outf) != 1)
{
- logf (LOG_FATAL|LOG_ERRNO, "fwrite");
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "fwrite");
exit (1);
}
i->keylen=0; /* ok, it's written, forget it */
-/* $Id: invstat.c,v 1.41 2004-09-15 08:13:51 adam Exp $
+/* $Id: invstat.c,v 1.42 2004-11-19 10:26:57 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
*to++ = *res++;
}
*to = '\0';
- /* yaz_log (LOG_LOG, "%s", keybuf); */
+ /* yaz_log (YLOG_LOG, "%s", keybuf); */
printf("%10" ZINT_FORMAT0 " %s %d.%d - %d.%d\n", count, keybuf,
firstsys,firstseq, lastsys,lastseq);
}
-/* $Id: kcompare.c,v 1.53 2004-11-04 11:47:23 heikki Exp $
+/* $Id: kcompare.c,v 1.54 2004-11-19 10:26:57 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
strcat(formstr, ".");
sprintf(formstr + strlen(formstr), ZINT_FORMAT, key.mem[i]);
}
- logf (logmask, "%s %s", formstr, txt);
+ yaz_log (logmask, "%s %s", formstr, txt);
}
else
- logf(logmask, " (null) %s",txt);
+ yaz_log(logmask, " (null) %s",txt);
}
void key_logdump (int logmask, const void *p)
-/* $Id: kdump.c,v 1.26 2004-09-15 08:13:51 adam Exp $
+/* $Id: kdump.c,v 1.27 2004-11-19 10:26:57 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
{
if (!(res = res_open (arg, 0, 0)))
{
- logf(LOG_FATAL, "Failed to open resource file %s", arg);
+ yaz_log(YLOG_FATAL, "Failed to open resource file %s", arg);
exit (1);
}
}
else
{
- logf (LOG_FATAL, "Unknown option '-%s'", arg);
+ yaz_log (YLOG_FATAL, "Unknown option '-%s'", arg);
exit (1);
}
}
zm = zebra_maps_open (res, 0);
if (!(inf = fopen (key_fname, "r")))
{
- logf (LOG_FATAL|LOG_ERRNO, "fopen %s", key_fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "fopen %s", key_fname);
exit (1);
}
printf ("t rg op sysno seqno txt\n");
zebra_maps_close (zm);
if (fclose (inf))
{
- logf (LOG_FATAL|LOG_ERRNO, "fclose %s", key_fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "fclose %s", key_fname);
exit (1);
}
exit (0);
-/* $Id: kinput.c,v 1.62 2004-09-15 08:13:51 adam Exp $
+/* $Id: kinput.c,v 1.63 2004-11-19 10:26:57 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
f->buf_size = 0;
if (fd == -1)
{
- logf (LOG_WARN|LOG_ERRNO, "cannot open %s", fname);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "cannot open %s", fname);
return ;
}
if (!f->length)
{
if ((f->length = lseek (fd, 0L, SEEK_END)) == (off_t) -1)
{
- logf (LOG_WARN|LOG_ERRNO, "cannot seek %s", fname);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "cannot seek %s", fname);
close (fd);
return ;
}
}
if (lseek (fd, f->offset, SEEK_SET) == -1)
{
- logf (LOG_WARN|LOG_ERRNO, "cannot seek %s", fname);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "cannot seek %s", fname);
close(fd);
return ;
}
}
if (r == -1)
{
- logf (LOG_WARN|LOG_ERRNO, "read of %s", fname);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "read of %s", fname);
close (fd);
return;
}
void key_heap_destroy (struct heap_info *hi, int nkeys)
{
int i;
- yaz_log (LOG_DEBUG, "key_heap_destroy");
- yaz_log (LOG_DEBUG, "key_heap_destroy nk=%d",nkeys);
+ yaz_log (YLOG_DEBUG, "key_heap_destroy");
+ yaz_log (YLOG_DEBUG, "key_heap_destroy nk=%d",nkeys);
if (!hi->zh)
for (i = 0; i<=nkeys; i++)
xfree (hi->info.buf[i]);
return 0;
--(zh->reg->ptr_i);
cp=(zh->reg->key_buf)[zh->reg->ptr_top - ptr_i];
- logf (LOG_DEBUG, " raw: i=%ld top=%ld cp=%p", (long) ptr_i,
+ yaz_log (YLOG_DEBUG, " raw: i=%ld top=%ld cp=%p", (long) ptr_i,
(long) zh->reg->ptr_top, cp);
strcpy(name, cp);
memcpy(key, cp+strlen(name)+1, KEY_SIZE);
*to++ = *res++;
}
*to = '\0';
- yaz_log (LOG_LOG, "%s", keybuf);
+ yaz_log (YLOG_LOG, "%s", keybuf);
}
#endif
}
else
{
- logf (LOG_FATAL, "isams doesn't support this kind of update");
+ yaz_log (YLOG_FATAL, "isams doesn't support this kind of update");
break;
}
}
remaining = (time_t) ((now - p->startTime)*
((double) p->totalBytes/p->totalOffset - 1.0));
if (remaining <= 130)
- logf (LOG_LOG, "Merge %2.1f%% completed; %ld seconds remaining",
+ yaz_log (YLOG_LOG, "Merge %2.1f%% completed; %ld seconds remaining",
(100.0*p->totalOffset) / p->totalBytes, (long) remaining);
else
- logf (LOG_LOG, "Merge %2.1f%% completed; %ld minutes remaining",
+ yaz_log (YLOG_LOG, "Merge %2.1f%% completed; %ld minutes remaining",
(100.0*p->totalOffset) / p->totalBytes, (long) remaining/60);
}
p->totalOffset += keyp->buf_size;
int nkeys = zh->reg->key_file_no;
int usefile;
- logf (LOG_DEBUG, " index_merge called with nk=%d b=%p",
+ yaz_log (YLOG_DEBUG, " index_merge called with nk=%d b=%p",
nkeys, zh->reg->key_buf);
if ( (nkeys==0) && (zh->reg->key_buf==0) )
return; /* nothing to merge - probably flush after end-trans */
}
if (hi->no_iterations)
{ /* do not log if nothing happened */
- logf (LOG_LOG, "Iterations . . .%7d", hi->no_iterations);
- logf (LOG_LOG, "Distinct words .%7d", hi->no_diffs);
- logf (LOG_LOG, "Updates. . . . .%7d", hi->no_updates);
- logf (LOG_LOG, "Deletions. . . .%7d", hi->no_deletions);
- logf (LOG_LOG, "Insertions . . .%7d", hi->no_insertions);
+ yaz_log (YLOG_LOG, "Iterations . . .%7d", hi->no_iterations);
+ yaz_log (YLOG_LOG, "Distinct words .%7d", hi->no_diffs);
+ yaz_log (YLOG_LOG, "Updates. . . . .%7d", hi->no_updates);
+ yaz_log (YLOG_LOG, "Deletions. . . .%7d", hi->no_deletions);
+ yaz_log (YLOG_LOG, "Insertions . . .%7d", hi->no_insertions);
}
zh->reg->key_file_no = 0;
-/* $Id: lockidx.c,v 1.22 2002-08-02 19:26:55 adam Exp $
+/* $Id: lockidx.c,v 1.23 2004-11-19 10:26:58 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
server_lock_cmt = zebra_lock_create (path, 1);
if (!server_lock_cmt)
{
- logf (LOG_WARN|LOG_ERRNO, "cannot create lock %s", path);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "cannot create lock %s", path);
return -1;
}
}
server_lock_org = zebra_lock_create (path, 1);
if (!server_lock_org)
{
- logf (LOG_WARN|LOG_ERRNO, "cannot create lock %s", path);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "cannot create lock %s", path);
return -1;
}
}
#ifndef WIN32
if (errno != EWOULDBLOCK)
{
- logf (LOG_FATAL|LOG_ERRNO, "flock");
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "flock");
exit (1);
}
#endif
if (commitPhase)
- logf (LOG_LOG, "Waiting for lock cmt");
+ yaz_log (YLOG_LOG, "Waiting for lock cmt");
else
- logf (LOG_LOG, "Waiting for lock org");
+ yaz_log (YLOG_LOG, "Waiting for lock org");
if (zebra_lock (h) == -1)
{
- logf (LOG_FATAL, "flock");
+ yaz_log (YLOG_FATAL, "flock");
exit (1);
}
}
r = write (fd, str, l);
if (r != l)
{
- logf (LOG_FATAL|LOG_ERRNO, "write lock file");
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "write lock file");
exit (1);
}
zebra_lock_prefix (zh->service->res, path);
#ifdef WIN32
zebra_lock_destroy (server_lock_main);
if (unlink (path) && errno != ENOENT)
- logf (LOG_WARN|LOG_ERRNO, "unlink %s failed", path);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "unlink %s failed", path);
#else
if (unlink (path) && errno != ENOENT)
- logf (LOG_WARN|LOG_ERRNO, "unlink %s failed", path);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "unlink %s failed", path);
zebra_lock_destroy (server_lock_main);
#endif
server_lock_main = 0;
server_lock_main = zebra_lock_create (path, 1);
if (!server_lock_main)
{
- logf (LOG_FATAL, "couldn't obtain indexer lock");
+ yaz_log (YLOG_FATAL, "couldn't obtain indexer lock");
exit (1);
}
if (zebra_lock_nb (server_lock_main) == -1)
{
#ifdef WIN32
- logf (LOG_LOG, "waiting for other index process");
+ yaz_log (YLOG_LOG, "waiting for other index process");
zebra_lock (server_lock_main);
zebra_unlock (server_lock_main);
zebra_lock_destroy (server_lock_main);
#else
if (errno == EWOULDBLOCK)
{
- logf (LOG_LOG, "waiting for other index process");
+ yaz_log (YLOG_LOG, "waiting for other index process");
zebra_lock (server_lock_main);
zebra_unlock (server_lock_main);
zebra_lock_destroy (server_lock_main);
}
else
{
- logf (LOG_FATAL|LOG_ERRNO, "flock %s", path);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "flock %s", path);
exit (1);
}
#endif
{
int fd = zebra_lock_fd (server_lock_main);
- logf (LOG_WARN, "unlocked %s", path);
+ yaz_log (YLOG_WARN, "unlocked %s", path);
r = read (fd, buf, 256);
if (r == 0)
{
- logf (LOG_WARN, "zero length %s", path);
+ yaz_log (YLOG_WARN, "zero length %s", path);
zebra_lock_destroy (server_lock_main);
unlink (path);
continue;
}
else if (r == -1)
{
- logf (LOG_FATAL|LOG_ERRNO, "read %s", path);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "read %s", path);
exit (1);
}
if (*buf == 'r')
{
- logf (LOG_WARN, "previous transaction didn't"
+ yaz_log (YLOG_WARN, "previous transaction didn't"
" reach commit");
zebra_lock_destroy (server_lock_main);
bf_commitClean (bfs, rval);
}
else if (*buf == 'd')
{
- logf (LOG_WARN, "commit file wan't deleted after commit");
+ yaz_log (YLOG_WARN, "commit file wan't deleted after commit");
zebra_lock_destroy (server_lock_main);
bf_commitClean (bfs, rval);
unlink (path);
}
else if (*buf == 'w')
{
- logf (LOG_WARN,
+ yaz_log (YLOG_WARN,
"The lock file indicates that your index is");
- logf (LOG_WARN, "inconsistent. Perhaps the indexer");
- logf (LOG_WARN, "terminated abnormally in the previous");
- logf (LOG_WARN, "run. You can try to proceed by");
- logf (LOG_WARN, "deleting the file %s", path);
+ yaz_log (YLOG_WARN, "inconsistent. Perhaps the indexer");
+ yaz_log (YLOG_WARN, "terminated abnormally in the previous");
+ yaz_log (YLOG_WARN, "run. You can try to proceed by");
+ yaz_log (YLOG_WARN, "deleting the file %s", path);
exit (1);
}
else if (*buf == 'c')
zebra_lock_destroy (server_lock_main);
continue;
}
- logf (LOG_FATAL, "previous transaction didn't"
+ yaz_log (YLOG_FATAL, "previous transaction didn't"
" finish commit. Commit now!");
exit (1);
}
else
{
- logf (LOG_FATAL, "unknown id 0x%02x in %s", *buf,
+ yaz_log (YLOG_FATAL, "unknown id 0x%02x in %s", *buf,
path);
exit (1);
}
-/* $Id: locksrv.c,v 1.17 2002-08-02 19:26:55 adam Exp $
+/* $Id: locksrv.c,v 1.18 2004-11-19 10:26:58 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
zi->server_path_prefix = (char *) xmalloc (strlen(path_prefix)+1);
strcpy (zi->server_path_prefix, path_prefix);
- logf (LOG_DEBUG, "Locking system initialized");
+ yaz_log (YLOG_DEBUG, "Locking system initialized");
return 0;
}
xfree (zi->server_path_prefix);
zebra_lock_destroy (zi->server_lock_cmt);
zebra_lock_destroy (zi->server_lock_org);
- logf (LOG_DEBUG, "Locking system destroyed");
+ yaz_log (YLOG_DEBUG, "Locking system destroyed");
return 0;
}
strcat (path, FNAME_COMMIT_LOCK);
if (!(zi->server_lock_cmt = zebra_lock_create (path, 0)))
{
- logf (LOG_FATAL|LOG_ERRNO, "create %s", path);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "create %s", path);
return -1;
}
assert (zi->server_lock_org == NULL);
strcat (path, FNAME_ORG_LOCK);
if (!(zi->server_lock_org = zebra_lock_create (path, 0)))
{
- logf (LOG_FATAL|LOG_ERRNO, "create %s", path);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "create %s", path);
return -1;
}
}
if (commitPhase)
{
- logf (LOG_DEBUG, "Server locks org");
+ yaz_log (YLOG_DEBUG, "Server locks org");
zebra_lock (zi->server_lock_org);
}
else
{
- logf (LOG_DEBUG, "Server locks cmt");
+ yaz_log (YLOG_DEBUG, "Server locks cmt");
zebra_lock (zi->server_lock_cmt);
}
return 0;
{
if (zi->server_lock_org == NULL)
return;
- logf (LOG_DEBUG, "Server unlocks org");
+ yaz_log (YLOG_DEBUG, "Server unlocks org");
zebra_unlock (zi->server_lock_org);
- logf (LOG_DEBUG, "Server unlocks cmt");
+ yaz_log (YLOG_DEBUG, "Server unlocks cmt");
zebra_unlock (zi->server_lock_cmt);
}
-/* $Id: lockutil.c,v 1.18 2004-01-22 11:27:21 adam Exp $
+/* $Id: lockutil.c,v 1.19 2004-11-19 10:26:59 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
if (h->fd == -1)
{
if (h->excl_flag <= 1)
- logf (LOG_WARN|LOG_ERRNO, "open %s", fname);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "open %s", fname);
xfree (h);
h = 0;
}
-/* $Id: main.c,v 1.117 2004-09-28 20:09:13 adam Exp $
+/* $Id: main.c,v 1.118 2004-11-19 10:27:00 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#include <sys/times.h>
#endif
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <yaz/options.h>
#include <idzebra/api.h>
if (!zs)
{
const char *config = configName ? configName : "zebra.cfg";
- logf (LOG_LOG, "Zebra version %s %s",
+ yaz_log (YLOG_LOG, "Zebra version %s %s",
ZEBRAVER, ZEBRADATE);
zs = zebra_start_res (config, 0, res);
if (!zs)
{
- yaz_log (LOG_FATAL, "Cannot read config %s", config);
+ yaz_log (YLOG_FATAL, "Cannot read config %s", config);
exit (1);
}
zh = zebra_open (zs);
if (zebra_select_database (zh, database))
{
- logf(LOG_FATAL, "Could not select database %s errCode=%d",
+ yaz_log(YLOG_FATAL, "Could not select database %s errCode=%d",
database, zebra_errCode(zh) );
exit (1);
}
}
else
{
- logf (LOG_FATAL, "unknown command: %s", arg);
+ yaz_log (YLOG_FATAL, "unknown command: %s", arg);
exit (1);
}
}
else if (ret == 'L')
res_set(res, "followLinks", "0");
else
- logf (LOG_WARN, "unknown option '-%s'", arg);
+ yaz_log (YLOG_WARN, "unknown option '-%s'", arg);
} /* while arg */
if (trans_started)
usec = (end_time.tv_sec - start_time.tv_sec) * 1000000.0 +
end_time.tv_usec - start_time.tv_usec;
times(&tms2);
- yaz_log (LOG_LOG, "zebraidx times: %5.2f %5.2f %5.2f",
+ yaz_log (YLOG_LOG, "zebraidx times: %5.2f %5.2f %5.2f",
usec / 1000000,
(double) (tms2.tms_utime - tms1.tms_utime)/100,
(double) (tms2.tms_stime - tms1.tms_stime)/100);
-/* $Id: recindex.c,v 1.38 2004-09-26 20:19:44 adam Exp $
+/* $Id: recindex.c,v 1.39 2004-11-19 10:27:03 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
r = bf_write (p->index_BFile, 0, 0, sizeof(p->head), &p->head);
if (r)
{
- logf (LOG_FATAL|LOG_ERRNO, "write head of %s", p->index_fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "write head of %s", p->index_fname);
exit (1);
}
}
r = bf_read (p->index_BFile, 2+pos/RIDX_CHUNK, 0, itemsize - sz1, buf + sz1);
if (r != 1 && !ignoreError)
{
- logf (LOG_FATAL|LOG_ERRNO, "read in %s at pos %ld",
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "read in %s at pos %ld",
p->index_fname, (long) pos);
exit (1);
}
first ? sizeof(block_and_ref) : sizeof(zint),
block_and_ref) != 1)
{
- logf (LOG_FATAL|LOG_ERRNO, "read in rec_del_single");
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "read in rec_del_single");
exit (1);
}
if (first)
if (bf_write (p->data_BFile[dst_type], freeblock, 0,
sizeof(block_and_ref), block_and_ref))
{
- logf (LOG_FATAL|LOG_ERRNO, "write in rec_del_single");
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "write in rec_del_single");
exit (1);
}
return;
if (bf_write (p->data_BFile[dst_type], freeblock, 0, sizeof(freeblock),
&p->head.block_free[dst_type]))
{
- logf (LOG_FATAL|LOG_ERRNO, "write in rec_del_single");
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "write in rec_del_single");
exit (1);
}
p->head.block_free[dst_type] = freeblock;
block_free, 0, sizeof(*p->head.block_free),
&p->head.block_free[dst_type]) != 1)
{
- logf (LOG_FATAL|LOG_ERRNO, "read in %s at free block " ZINT_FORMAT,
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "read in %s at free block " ZINT_FORMAT,
p->data_fname[dst_type], block_free);
exit (1);
}
p->index_BFile = bf_open (bfs, p->index_fname, RIDX_CHUNK, rw);
if (p->index_BFile == NULL)
{
- logf (LOG_FATAL|LOG_ERRNO, "open %s", p->index_fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "open %s", p->index_fname);
exit (1);
}
r = bf_read (p->index_BFile, 0, 0, 0, p->tmp_buf);
memcpy (&p->head, p->tmp_buf, sizeof(p->head));
if (memcmp (p->head.magic, REC_HEAD_MAGIC, sizeof(p->head.magic)))
{
- logf (LOG_FATAL, "file %s has bad format", p->index_fname);
+ yaz_log (YLOG_FATAL, "file %s has bad format", p->index_fname);
exit (1);
}
version = atoi (p->head.version);
if (version != REC_VERSION)
{
- logf (LOG_FATAL, "file %s is version %d, but version"
+ yaz_log (YLOG_FATAL, "file %s is version %d, but version"
" %d is required", p->index_fname, version, REC_VERSION);
exit (1);
}
p->head.block_size[i],
rw)))
{
- logf (LOG_FATAL|LOG_ERRNO, "bf_open %s", p->data_fname[i]);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "bf_open %s", p->data_fname[i]);
exit (1);
}
}
&csize, out_buf, out_offset, 1, 0, 30);
if (i != BZ_OK)
{
- logf (LOG_WARN, "bzBuffToBuffCompress error code=%d", i);
+ yaz_log (YLOG_WARN, "bzBuffToBuffCompress error code=%d", i);
csize = 0;
}
- logf (LOG_LOG, "compress %4d %5d %5d", ref_count, out_offset,
+ yaz_log (YLOG_LOG, "compress %4d %5d %5d", ref_count, out_offset,
csize);
#endif
break;
i = bzBuffToBuffDecompress
#endif
(bz_buf, &bz_size, in_buf, in_size, 0, 0);
- logf (LOG_LOG, "decompress %5d %5d", in_size, bz_size);
+ yaz_log (YLOG_LOG, "decompress %5d %5d", in_size, bz_size);
if (i == BZ_OK)
break;
- logf (LOG_LOG, "failed");
+ yaz_log (YLOG_LOG, "failed");
xfree (bz_buf);
bz_size *= 2;
}
in_buf = bz_buf;
in_size = bz_size;
#else
- logf (LOG_FATAL, "cannot decompress record(s) in BZIP2 format");
+ yaz_log (YLOG_FATAL, "cannot decompress record(s) in BZIP2 format");
exit (1);
#endif
break;
-/* $Id: recstat.c,v 1.11 2004-08-16 12:09:43 heikki Exp $
+/* $Id: recstat.c,v 1.12 2004-11-19 10:27:03 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
int i;
zint total_bytes = 0;
- logf (LOG_LOG,
+ yaz_log (YLOG_LOG,
"Total records %8" ZINT_FORMAT0,
records->head.no_records);
for (i = 0; i< REC_BLOCK_TYPES; i++)
{
- logf (LOG_LOG, "Record blocks of size "ZINT_FORMAT,
+ yaz_log (YLOG_LOG, "Record blocks of size "ZINT_FORMAT,
records->head.block_size[i]);
- logf (LOG_LOG,
+ yaz_log (YLOG_LOG,
" Used/Total/Bytes used "
ZINT_FORMAT "/" ZINT_FORMAT "/" ZINT_FORMAT,
records->head.block_used[i], records->head.block_last[i]-1,
total_bytes +=
records->head.block_used[i] * records->head.block_size[i];
}
- logf (LOG_LOG,
+ yaz_log (YLOG_LOG,
"Total size of record index in bytes %8" ZINT_FORMAT0,
records->head.total_bytes);
- logf (LOG_LOG,
+ yaz_log (YLOG_LOG,
"Total size with overhead %8" ZINT_FORMAT0,
total_bytes);
}
-/* $Id: retrieve.c,v 1.25 2004-09-27 10:44:49 adam Exp $
+/* $Id: retrieve.c,v 1.26 2004-11-19 10:27:03 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
rec = rec_get (zh->reg->records, sysno);
if (!rec)
{
- logf (LOG_DEBUG, "rec_get fail on sysno=" ZINT_FORMAT, sysno);
+ yaz_log (YLOG_DEBUG, "rec_get fail on sysno=" ZINT_FORMAT, sysno);
*basenamep = 0;
return 14;
}
if (!(rt = recType_byName (zh->reg->recTypes, zh->res,
file_type, &clientData)))
{
- logf (LOG_WARN, "Retrieve: Cannot handle type %s", file_type);
+ yaz_log (YLOG_WARN, "Retrieve: Cannot handle type %s", file_type);
return 14;
}
- logf (LOG_DEBUG, "retrieve localno=" ZINT_FORMAT " score=%d", sysno,score);
+ yaz_log (YLOG_DEBUG, "retrieve localno=" ZINT_FORMAT " score=%d", sysno,score);
retrieveCtrl.fh = &fc;
fc.fd = -1;
retrieveCtrl.fname = fname;
fc.record_int_len = rec->size[recInfo_storeData];
fc.record_int_buf = rec->info[recInfo_storeData];
fc.record_int_pos = 0;
- logf (LOG_DEBUG, "Internal retrieve. %d bytes", fc.record_int_len);
+ yaz_log (YLOG_DEBUG, "Internal retrieve. %d bytes", fc.record_int_len);
if (raw_mode)
{
*output_format = VAL_SUTRS;
if ((fc.fd = open (full_rep, O_BINARY|O_RDONLY)) == -1)
{
- logf (LOG_WARN|LOG_ERRNO, "Retrieve fail; missing file: %s",
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "Retrieve fail; missing file: %s",
full_rep);
rec_rm (&rec);
return 14;
-/* $Id: sortidx.c,v 1.9 2004-08-04 08:35:23 adam Exp $
+/* $Id: sortidx.c,v 1.10 2004-11-19 10:27:03 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#include <string.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <bfile.h>
#include <sortidx.h>
sf->type = type;
sf->bf = NULL;
sprintf (fname, "sort%d", type);
- logf (LOG_DEBUG, "sort idx %s wr=%d", fname, si->write_flag);
+ yaz_log (YLOG_DEBUG, "sort idx %s wr=%d", fname, si->write_flag);
sf->bf = bf_open (si->bfs, fname, SORT_IDX_BLOCKSIZE, si->write_flag);
if (!sf->bf)
{
-/* $Id: trav.c,v 1.45 2004-09-09 09:07:12 adam Exp $
+/* $Id: trav.c,v 1.46 2004-11-19 10:27:03 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
e = dir_open (rep, zh->path_reg, zh->m_follow_links);
if (!e)
return;
- yaz_log (LOG_LOG, "dir %s", rep);
+ yaz_log (YLOG_LOG, "dir %s", rep);
if (rep[rep_len-1] != '/')
rep[rep_len] = '/';
else
sprintf (tmppath, "%s%s", base, src);
e_src = dir_open (tmppath, zh->path_reg, zh->m_follow_links);
- yaz_log (LOG_LOG, "dir %s", tmppath);
+ yaz_log (YLOG_LOG, "dir %s", tmppath);
#if 0
if (!dst || repComp (dst->path, src, src_len))
{
if (e_src[i_src].name)
{
- yaz_log (LOG_DEBUG, "dst=%s src=%s", dst->path + src_len,
+ yaz_log (YLOG_DEBUG, "dst=%s src=%s", dst->path + src_len,
e_src[i_src].name);
sd = strcmp (dst->path + src_len, e_src[i_src].name);
}
sd = 1;
else
break;
- yaz_log (LOG_DEBUG, "trav sd=%d", sd);
+ yaz_log (YLOG_DEBUG, "trav sd=%d", sd);
if (sd == 0)
{
{
dirs_add (di, src, dst->sysno, e_src[i_src].mtime);
}
- yaz_log (LOG_DEBUG, "old: %s", ctime (&dst->mtime));
- yaz_log (LOG_DEBUG, "new: %s", ctime (&e_src[i_src].mtime));
+ yaz_log (YLOG_DEBUG, "old: %s", ctime (&dst->mtime));
+ yaz_log (YLOG_DEBUG, "new: %s", ctime (&e_src[i_src].mtime));
}
dst = dirs_read (di);
break;
case dirs_dir:
fileUpdateR (zh, di, dst, base, src, level+1);
dst = dirs_last (di);
- yaz_log (LOG_DEBUG, "last is %s", dst ? dst->path : "null");
+ yaz_log (YLOG_DEBUG, "last is %s", dst ? dst->path : "null");
break;
default:
dst = dirs_read (di);
if (!(dict = dict_open_res (zh->reg->bfs, FMATCH_DICT, 50, 0, 0, zh->res)))
{
- yaz_log (LOG_FATAL, "dict_open fail of %s", FMATCH_DICT);
+ yaz_log (YLOG_FATAL, "dict_open fail of %s", FMATCH_DICT);
return;
}
di = dirs_open (dict, src, zh->m_flag_rw);
while ( (dst = dirs_read (di)) )
- yaz_log (LOG_LOG, "%s", dst->path);
+ yaz_log (YLOG_LOG, "%s", dst->path);
dirs_free (&di);
dict_close (dict);
}
if (ret == -1)
{
- yaz_log (LOG_WARN|LOG_ERRNO, "Cannot access path %s", src);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "Cannot access path %s", src);
}
else if (S_ISREG(sbuf.st_mode))
{
}
else
{
- yaz_log (LOG_WARN, "Skipping path %s", src);
+ yaz_log (YLOG_WARN, "Skipping path %s", src);
}
}
strcpy (src, path);
if (ret == -1)
- yaz_log (LOG_WARN|LOG_ERRNO, "Cannot access path %s", src);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "Cannot access path %s", src);
else if (S_ISREG(sbuf.st_mode))
fileExtract (zh, NULL, src, deleteFlag);
else if (S_ISDIR(sbuf.st_mode))
repositoryExtractR (zh, deleteFlag, src, 0);
else
- yaz_log (LOG_WARN, "Skipping path %s", src);
+ yaz_log (YLOG_WARN, "Skipping path %s", src);
}
static void repositoryExtractG (ZebraHandle zh, const char *path,
if (!(dict = dict_open_res (zh->reg->bfs, FMATCH_DICT, 50,
zh->m_flag_rw, 0, zh->res)))
{
- yaz_log (LOG_FATAL, "dict_open fail of %s", FMATCH_DICT);
+ yaz_log (YLOG_FATAL, "dict_open fail of %s", FMATCH_DICT);
return ;
}
if (!strcmp(path, "") || !strcmp(path, "-"))
-/* $Id: trunc.c,v 1.48 2004-11-03 16:04:45 heikki Exp $
+/* $Id: trunc.c,v 1.49 2004-11-19 10:27:03 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
xfree (ispt);
}
else
- logf (LOG_WARN, "Unknown isam set in rset_trunc_r");
+ yaz_log (YLOG_WARN, "Unknown isam set in rset_trunc_r");
rset_close (result_rsfd);
return result;
const struct key_control *kctrl, int scope)
{
TERMID termid;
- logf (LOG_DEBUG, "rset_trunc no=%d", no);
+ yaz_log (YLOG_DEBUG, "rset_trunc no=%d", no);
if (no < 1)
return rsnull_create (rset_nmem,kctrl);
termid=rset_term_create(term, length, flags, term_type,rset_nmem);
}
else
{
- logf (LOG_WARN, "Unknown isam set in rset_trunc");
+ yaz_log (YLOG_WARN, "Unknown isam set in rset_trunc");
return rsnull_create (rset_nmem, kctrl);
}
return rset_trunc_r (zi, term, length, flags, isam_p, 0, no, 100,
-/* $Id: zebraapi.c,v 1.139 2004-10-29 11:23:52 heikki Exp $
+/* $Id: zebraapi.c,v 1.140 2004-11-19 10:27:03 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#define ASSERTZHRES assert(zh && zh->service && zh->res)
#define ASSERTZS assert(zs)
-#define LOG_API LOG_APP2
+static int log_level=0;
+static int log_level_initialized=0;
static Res zebra_open_res (ZebraHandle zh);
static void zebra_close_res (ZebraHandle zh);
{
const char *dir ;
ASSERTZS;
- yaz_log(LOG_API,"zebra_chdir");
+ yaz_log(log_level,"zebra_chdir");
dir = res_get (zs->global_res, "chdir");
if (!dir)
return;
- logf (LOG_DEBUG, "chdir %s", dir);
+ yaz_log (YLOG_DEBUG, "chdir %s", dir);
#ifdef WIN32
_chdir(dir);
#else
static void zebra_flush_reg (ZebraHandle zh)
{
ASSERTZH;
- yaz_log(LOG_API,"zebra_flush_reg");
+ yaz_log(log_level,"zebra_flush_reg");
zh->errCode=0;
zebraExplain_flush (zh->reg->zei, zh);
{
ZebraHandle zh;
const char *default_encoding;
- yaz_log(LOG_API,"zebra_open");
+ if (!log_level_initialized)
+ {
+ log_level=yaz_log_module_level("zebraapi");
+ log_level_initialized=1;
+ }
+
+ yaz_log(log_level,"zebra_open");
if (!zs)
return 0;
zh = (ZebraHandle) xmalloc (sizeof(*zh));
- yaz_log (LOG_DEBUG, "zebra_open zs=%p returns %p", zs, zh);
+ yaz_log (YLOG_DEBUG, "zebra_open zs=%p returns %p", zs, zh);
zh->service = zs;
zh->reg = 0; /* no register attached yet */
zh->iconv_to_utf8 =
yaz_iconv_open ("UTF-8", default_encoding);
if (zh->iconv_to_utf8 == 0)
- yaz_log (LOG_WARN, "iconv: %s to UTF-8 unsupported",
+ yaz_log (YLOG_WARN, "iconv: %s to UTF-8 unsupported",
default_encoding);
zh->iconv_from_utf8 =
yaz_iconv_open (default_encoding, "UTF-8");
if (zh->iconv_to_utf8 == 0)
- yaz_log (LOG_WARN, "iconv: UTF-8 to %s unsupported",
+ yaz_log (YLOG_WARN, "iconv: UTF-8 to %s unsupported",
default_encoding);
zebra_mutex_cond_lock (&zs->session_lock);
{
Res res;
- yaz_log(LOG_API,"zebra_start %s",configName);
+ if (!log_level_initialized)
+ {
+ log_level=yaz_log_module_level("zebraapi");
+ log_level_initialized=1;
+ }
+
+ yaz_log(log_level,"zebra_start %s",configName);
assert(configName);
if ((res = res_open (configName, def_res, over_res)))
{
ZebraService zh = xmalloc (sizeof(*zh));
- yaz_log (LOG_DEBUG, "Read resources `%s'", configName);
+ yaz_log (YLOG_DEBUG, "Read resources `%s'", configName);
zh->global_res = res;
zh->configName = xstrdup(configName);
{
zh->passwd_db = passwd_db_open ();
if (!zh->passwd_db)
- logf (LOG_WARN|LOG_ERRNO, "passwd_db_open failed");
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "passwd_db_open failed");
else
passwd_db_file (zh->passwd_db,
res_get (zh->global_res, "passwd"));
if (v)
{
page_size = atoi(v);
- yaz_log(LOG_LOG, "Using custom dictionary page size %d for %s",
+ yaz_log(YLOG_LOG, "Using custom dictionary page size %d for %s",
page_size, name);
}
return dict_open(bfs, name, cache, rw, compact_flag, page_size);
assert (res);
- yaz_log (LOG_DEBUG, "zebra_register_open rw=%d useshadow=%d p=%p n=%s rp=%s",
+ yaz_log (YLOG_DEBUG, "zebra_register_open rw=%d useshadow=%d p=%p n=%s rp=%s",
rw, useshadow, reg, name, reg_path ? reg_path : "(none)");
reg->dh = data1_createx (DATA1_FLAG_XML);
getcwd(cwd, sizeof(cwd)-1);
profilePath = res_get_def(res, "profilePath", DEFAULT_PROFILE_PATH);
- yaz_log(LOG_DEBUG, "profilePath=%s cwd=%s", profilePath, cwd);
+ yaz_log(YLOG_DEBUG, "profilePath=%s cwd=%s", profilePath, cwd);
data1_set_tabpath (reg->dh, profilePath);
data1_set_tabroot (reg->dh, reg_path);
if (!(reg->records = rec_open (reg->bfs, rw, record_compression)))
{
- logf (LOG_WARN, "rec_open");
+ yaz_log (YLOG_WARN, "rec_open");
return 0;
}
if (rw)
}
if (!(reg->dict = dict_open_res (reg->bfs, FNAME_DICT, 40, rw, 0, res)))
{
- logf (LOG_WARN, "dict_open");
+ yaz_log (YLOG_WARN, "dict_open");
return 0;
}
if (!(reg->sortIdx = sortIdx_open (reg->bfs, rw)))
{
- logf (LOG_WARN, "sortIdx_open");
+ yaz_log (YLOG_WARN, "sortIdx_open");
return 0;
}
if (res_get_match (res, "isam", "s", ISAM_DEFAULT))
if (!(reg->isams = isams_open (reg->bfs, FNAME_ISAMS, rw,
key_isams_m(res, &isams_m))))
{
- logf (LOG_WARN, "isams_open");
+ yaz_log (YLOG_WARN, "isams_open");
return 0;
}
}
if (!(reg->isamc = isc_open (reg->bfs, FNAME_ISAMC,
rw, key_isamc_m(res, &isamc_m))))
{
- logf (LOG_WARN, "isc_open");
+ yaz_log (YLOG_WARN, "isc_open");
return 0;
}
}
if (!(reg->isamb = isamb_open (reg->bfs, "isamb",
rw, key_isamc_m(res, &isamc_m), 0)))
{
- logf (LOG_WARN, "isamb_open");
+ yaz_log (YLOG_WARN, "isamb_open");
return 0;
}
}
if (!(reg->isamb = isamb_open (reg->bfs, "isamb",
rw, key_isamc_m(res, &isamc_m), 1)))
{
- logf (LOG_WARN, "isamb_open");
+ yaz_log (YLOG_WARN, "isamb_open");
return 0;
}
}
if (!(reg->isamb = isamb_open (reg->bfs, "isamb",
rw, key_isamc_m(res, &isamc_m), -1)))
{
- logf (LOG_WARN, "isamb_open");
+ yaz_log (YLOG_WARN, "isamb_open");
return 0;
}
}
explain_extract);
if (!reg->zei)
{
- logf (LOG_WARN, "Cannot obtain EXPLAIN information");
+ yaz_log (YLOG_WARN, "Cannot obtain EXPLAIN information");
return 0;
}
reg->active = 2;
- yaz_log (LOG_DEBUG, "zebra_register_open ok p=%p", reg);
+ yaz_log (YLOG_DEBUG, "zebra_register_open ok p=%p", reg);
return reg;
}
int zebra_admin_shutdown (ZebraHandle zh)
{
ASSERTZH;
- yaz_log(LOG_API,"zebra_admin_shutdown");
+ yaz_log(log_level,"zebra_admin_shutdown");
zh->errCode=0;
zebra_mutex_cond_lock (&zh->service->session_lock);
{
ZebraService zs;
ASSERTZH;
- yaz_log(LOG_API,"zebra_admin_start");
+ yaz_log(log_level,"zebra_admin_start");
zh->errCode=0;
zs = zh->service;
zebra_mutex_cond_lock (&zs->session_lock);
{
ASSERTZS;
assert(reg);
- yaz_log(LOG_DEBUG, "zebra_register_close p=%p", reg);
+ yaz_log(YLOG_DEBUG, "zebra_register_close p=%p", reg);
reg->stop_flag = 0;
zebra_chdir (zs);
if (reg->records)
{
if (!zs)
return 0;
- yaz_log (LOG_API, "zebra_stop");
+ yaz_log (log_level, "zebra_stop");
while (zs->sessions)
{
struct zebra_session **sp;
int i;
- yaz_log(LOG_API,"zebra_close");
+ yaz_log(log_level,"zebra_close");
if (!zh)
return 0;
ASSERTZH;
zh->errCode=0;
zs = zh->service;
- yaz_log (LOG_DEBUG, "zebra_close zh=%p", zh);
+ yaz_log (YLOG_DEBUG, "zebra_close zh=%p", zh);
resultSetDestroy (zh, -1, 0, 0);
if (zh->reg)
}
else
{
- yaz_log (LOG_WARN, "no register root specified");
+ yaz_log (YLOG_WARN, "no register root specified");
return 0; /* no path for register - fail! */
}
return res;
struct map_baseinfo *p = &info;
int i;
ASSERTZH;
- yaz_log(LOG_API,"map_basenames ");
+ yaz_log(log_level,"map_basenames ");
assert(stream);
zh->errCode=0;
*num_bases = info.new_num_bases;
*basenames = info.new_basenames;
for (i = 0; i<*num_bases; i++)
- logf (LOG_DEBUG, "base %s", (*basenames)[i]);
+ yaz_log (YLOG_DEBUG, "base %s", (*basenames)[i]);
}
int zebra_select_database (ZebraHandle zh, const char *basename)
{
ASSERTZH;
- yaz_log(LOG_API,"zebra_select_database %s",basename);
+ yaz_log(log_level,"zebra_select_database %s",basename);
assert(basename);
zh->errCode=0;
return zebra_select_databases (zh, 1, &basename);
ASSERTZH;
assert(basenames);
- yaz_log(LOG_API,"zebra_select_databases n=%d [0]=%s",
+ yaz_log(log_level,"zebra_select_databases n=%d [0]=%s",
num_bases,basenames[0]);
zh->errCode=0;
assert(query);
assert(hits);
assert(setname);
- yaz_log(LOG_API,"zebra_search_rpn");
+ yaz_log(log_level,"zebra_search_rpn");
zh->errCode=0;
zh->hits = 0;
*hits = 0;
while (i--) maxhits *= 10;
}
if (zh->hits > maxhits) { /* too large for yaz to handle */
- logf(LOG_DEBUG,"limiting hits to "ZINT_FORMAT, maxhits);
+ yaz_log(YLOG_DEBUG,"limiting hits to "ZINT_FORMAT, maxhits);
*hits=maxhits;
}
else
assert(recs);
assert(num_recs>0);
- yaz_log(LOG_API,"zebra_records_retrieve n=%d",num_recs);
+ yaz_log(log_level,"zebra_records_retrieve n=%d",num_recs);
zh->errCode=0;
if (!zh->res)
poset = zebraPosSetCreate (zh, setname, num_recs, pos_array);
if (!poset)
{
- logf (LOG_DEBUG, "zebraPosSetCreate error");
+ yaz_log (YLOG_DEBUG, "zebraPosSetCreate error");
zh->errCode = 30;
zh->errString = nmem_strdup (stream->mem, setname);
ret = -1;
assert(num_entries);
assert(is_partial);
assert(entries);
- yaz_log(LOG_API,"zebra_scan");
+ yaz_log(log_level,"zebra_scan");
zh->errCode=0;
if (zebra_begin_read (zh))
{
assert(input_setnames);
assert(sort_sequence);
assert(sort_status);
- yaz_log(LOG_API,"zebra_sort");
+ yaz_log(log_level,"zebra_sort");
zh->errCode=0;
if (zebra_begin_read (zh))
return 1;
assert(num_setnames>0);
assert(setnames);
assert(statuses);
- yaz_log(LOG_API,"zebra_deleleResultSet n=%d",num_setnames);
+ yaz_log(log_level,"zebra_deleleResultSet n=%d",num_setnames);
zh->errCode=0;
if (zebra_begin_read(zh))
return Z_DeleteStatus_systemProblemAtTarget;
{
if (zh)
{
- yaz_log(LOG_API,"zebra_errCode: %d",zh->errCode);
+ yaz_log(log_level,"zebra_errCode: %d",zh->errCode);
return zh->errCode;
}
- yaz_log(LOG_API,"zebra_errCode: o");
+ yaz_log(log_level,"zebra_errCode: o");
return 0;
}
const char *e="";
if (zh)
e= diagbib1_str (zh->errCode);
- yaz_log(LOG_API,"zebra_errString: %s",e);
+ yaz_log(log_level,"zebra_errString: %s",e);
return e;
}
char *a="";
if (zh)
a= zh->errString;
- yaz_log(LOG_API,"zebra_errAdd: %s",a);
+ yaz_log(log_level,"zebra_errAdd: %s",a);
return a;
}
const char *record_type)
{
ASSERTZH;
- yaz_log(LOG_API,"zebra_admin_import_begin db=%s rt=%s",
+ yaz_log(log_level,"zebra_admin_import_begin db=%s rt=%s",
database, record_type);
zh->errCode=0;
if (zebra_select_database(zh, database))
int zebra_admin_import_end (ZebraHandle zh)
{
ASSERTZH;
- yaz_log(LOG_API,"zebra_admin_import_end");
+ yaz_log(log_level,"zebra_admin_import_end");
zh->errCode=0;
zebra_end_trans (zh);
return 0;
SYSNO sysno;
int i;
ASSERTZH;
- yaz_log(LOG_API,"zebra_admin_import_segment");
+ yaz_log(log_level,"zebra_admin_import_segment");
zh->errCode=0;
for (i = 0; i<segment->num_segmentRecords; i++)
{
assert(action>0 && action <=4);
assert(rec_buf);
- yaz_log(LOG_API,"zebra_admin_exchange_record ac=%d", action);
+ yaz_log(log_level,"zebra_admin_exchange_record ac=%d", action);
zh->errCode=0;
if (!recid_buf || recid_len <= 0 || recid_len >= sizeof(recid_z))
{
int ret = 0;
ASSERTZH;
- yaz_log(LOG_API,"zebra_drop_database");
+ yaz_log(log_level,"zebra_drop_database");
zh->errCode = 0;
if (zebra_select_database (zh, database))
}
else
{
- yaz_log(LOG_WARN, "drop database only supported for isam:b");
+ yaz_log(YLOG_WARN, "drop database only supported for isam:b");
ret = -1;
}
zebra_end_trans (zh);
int zebra_create_database (ZebraHandle zh, const char *database)
{
ASSERTZH;
- yaz_log(LOG_API,"zebra_create_database %s",database);
+ yaz_log(log_level,"zebra_create_database %s",database);
assert(database);
zh->errCode=0;
ASSERTZH;
assert(input_str);
assert(output_str);
- yaz_log(LOG_API,"zebra_string_norm ");
+ yaz_log(log_level,"zebra_string_norm ");
zh->errCode=0;
if (!zh->reg->zebra_maps)
return -1;
long p = getpid();
FILE *f;
ASSERTZH;
- yaz_log(LOG_API,"zebra_set_state v=%d seq=%d", val, seqno);
+ yaz_log(log_level,"zebra_set_state v=%d seq=%d", val, seqno);
zh->errCode=0;
sprintf (state_fname, "state.%s.LCK", zh->reg_name);
fname = zebra_mk_fname (res_get(zh->res, "lockDir"), state_fname);
f = fopen (fname, "w");
- yaz_log (LOG_DEBUG, "zebra_set_state: %c %d %ld", val, seqno, p);
+ yaz_log (YLOG_DEBUG, "zebra_set_state: %c %d %ld", val, seqno, p);
fprintf (f, "%c %d %ld\n", val, seqno, p);
fclose (f);
xfree (fname);
FILE *f;
ASSERTZH;
- yaz_log(LOG_API,"zebra_get_state ");
+ yaz_log(log_level,"zebra_get_state ");
zh->errCode=0;
sprintf (state_fname, "state.%s.LCK", zh->reg_name);
fname = zebra_mk_fname (res_get(zh->res, "lockDir"), state_fname);
return -1;
}
ASSERTZHRES;
- yaz_log(LOG_API,"zebra_begin_trans rw=%d",rw);
+ yaz_log(log_level,"zebra_begin_trans rw=%d",rw);
if (zh->user_perm)
{
zebra_get_state (zh, &val, &seqno);
if (val == 'c')
{
- yaz_log (LOG_WARN, "previous transaction didn't finish commit");
+ yaz_log (YLOG_WARN, "previous transaction didn't finish commit");
zebra_unlock (zh->lock_shadow);
zebra_unlock (zh->lock_normal);
zebra_commit (zh);
{
BFiles bfs = bfs_create (res_get (zh->res, "shadow"),
zh->path_reg);
- yaz_log (LOG_WARN, "previous transaction didn't reach commit");
+ yaz_log (YLOG_WARN, "previous transaction didn't reach commit");
bf_commitClean (bfs, rval);
bfs_destroy (bfs);
}
else
{
- yaz_log (LOG_WARN, "your previous transaction didn't finish");
+ yaz_log (YLOG_WARN, "your previous transaction didn't finish");
}
}
break;
}
if (pass == 2)
{
- yaz_log (LOG_FATAL, "zebra_begin_trans couldn't finish commit");
+ yaz_log (YLOG_FATAL, "zebra_begin_trans couldn't finish commit");
abort();
return -1;
}
zh->errCode = 2;
zh->errString = "zebra_begin_trans: cannot open register";
- yaz_log(LOG_FATAL, zh->errString);
+ yaz_log(YLOG_FATAL, zh->errString);
return -1;
}
}
dirty = 1;
else if (seqno != zh->reg->seqno)
{
- yaz_log (LOG_DEBUG, "reopen seqno cur/old %d/%d",
+ yaz_log (YLOG_DEBUG, "reopen seqno cur/old %d/%d",
seqno, zh->reg->seqno);
dirty = 1;
}
else if (zh->reg->last_val != val)
{
- yaz_log (LOG_DEBUG, "reopen last cur/old %d/%d",
+ yaz_log (YLOG_DEBUG, "reopen last cur/old %d/%d",
val, zh->reg->last_val);
dirty = 1;
}
{
ZebraTransactionStatus dummy;
ASSERTZH;
- yaz_log(LOG_API,"zebra_end_trans");
+ yaz_log(log_level,"zebra_end_trans");
return zebra_end_transaction(zh, &dummy);
}
ASSERTZH;
assert(status);
- yaz_log(LOG_API,"zebra_end_transaction");
+ yaz_log(log_level,"zebra_end_transaction");
status->processed = 0;
status->inserted = 0;
zh->trans_no--;
zh->trans_w_no = 0;
- yaz_log (LOG_DEBUG, "zebra_end_trans");
+ yaz_log (YLOG_DEBUG, "zebra_end_trans");
rval = res_get (zh->res, "shadow");
zebraExplain_runNumberIncrement (zh->reg->zei, 1);
zebra_register_close (zh->service, zh->reg);
zh->reg = 0;
- yaz_log (LOG_LOG, "Records: "ZINT_FORMAT" i/u/d "
+ yaz_log (YLOG_LOG, "Records: "ZINT_FORMAT" i/u/d "
ZINT_FORMAT"/"ZINT_FORMAT"/"ZINT_FORMAT,
zh->records_processed, zh->records_inserted,
zh->records_updated, zh->records_deleted);
if (val != 'd')
{
BFiles bfs = bfs_create (rval, zh->path_reg);
- yaz_log (LOG_DEBUG, "deleting shadow val=%c", val);
+ yaz_log (YLOG_DEBUG, "deleting shadow val=%c", val);
bf_commitClean (bfs, rval);
bfs_destroy (bfs);
}
}
#if HAVE_SYS_TIMES_H
times (&zh->tms2);
- logf (LOG_LOG, "user/system: %ld/%ld",
+ yaz_log (YLOG_LOG, "user/system: %ld/%ld",
(long) (zh->tms2.tms_utime - zh->tms1.tms_utime),
(long) (zh->tms2.tms_stime - zh->tms1.tms_stime));
ASSERTZH;
assert(path);
zh->errCode=0;
- logf (LOG_API, "updating %s", path);
+ yaz_log (log_level, "updating %s", path);
repositoryUpdate (zh, path);
return zh->errCode;
}
ASSERTZH;
assert(path);
zh->errCode=0;
- logf (LOG_API, "deleting %s", path);
+ yaz_log (log_level, "deleting %s", path);
repositoryDelete (zh, path);
return zh->errCode;
}
{
ASSERTZH;
assert(path);
- yaz_log(LOG_API,"zebra_repository_show");
+ yaz_log(log_level,"zebra_repository_show");
zh->errCode=0;
repositoryShow (zh, path);
return zh->errCode;
rval = res_get (zh->res, "shadow");
if (!rval)
{
- logf (LOG_WARN, "Cannot perform commit");
- logf (LOG_WARN, "No shadow area defined");
+ yaz_log (YLOG_WARN, "Cannot perform commit");
+ yaz_log (YLOG_WARN, "No shadow area defined");
return 0;
}
{
zebra_set_state (zh, 'c', seqno);
- logf (LOG_DEBUG, "commit start");
+ yaz_log (YLOG_DEBUG, "commit start");
bf_commitExec (bfs);
#ifndef WIN32
sync ();
#endif
}
- logf (LOG_DEBUG, "commit clean");
+ yaz_log (YLOG_DEBUG, "commit clean");
bf_commitClean (bfs, rval);
seqno++;
zebra_set_state (zh, 'o', seqno);
}
else
{
- logf (LOG_LOG, "nothing to commit");
+ yaz_log (YLOG_LOG, "nothing to commit");
}
bfs_destroy (bfs);
int zebra_clean (ZebraHandle zh)
{
ASSERTZH;
- yaz_log(LOG_API,"zebra_clean");
+ yaz_log(log_level,"zebra_clean");
return zebra_commit_ex(zh, 1);
}
int zebra_commit (ZebraHandle zh)
{
ASSERTZH;
- yaz_log(LOG_API,"zebra_commit");
+ yaz_log(log_level,"zebra_commit");
return zebra_commit_ex(zh, 0);
}
const char *rval;
BFiles bfs = 0;
ASSERTZH;
- yaz_log(LOG_API,"zebra_init");
+ yaz_log(log_level,"zebra_init");
zh->errCode=0;
if (!zh->res)
{
BFiles bfs;
ASSERTZH;
- yaz_log(LOG_API,"zebra_compact");
+ yaz_log(log_level,"zebra_compact");
zh->errCode=0;
if (!zh->res)
{
int zebra_result (ZebraHandle zh, int *code, char **addinfo)
{
ASSERTZH;
- yaz_log(LOG_API,"zebra_result");
+ yaz_log(log_level,"zebra_result");
*code = zh->errCode;
*addinfo = zh->errString;
return 0;
int zebra_shadow_enable (ZebraHandle zh, int value)
{
ASSERTZH;
- yaz_log(LOG_API,"zebra_shadow_enable");
+ yaz_log(log_level,"zebra_shadow_enable");
zh->errCode=0;
zh->shadow_enable = value;
return 0;
{
ASSERTZH;
assert(encoding);
- yaz_log(LOG_API,"zebra_record_encoding");
+ yaz_log(log_level,"zebra_record_encoding");
zh->errCode=0;
xfree (zh->record_encoding);
zh->record_encoding = xstrdup (encoding);
- logf(LOG_DEBUG, "Reset record encoding: %s", encoding);
+ yaz_log(YLOG_DEBUG, "Reset record encoding: %s", encoding);
zh->iconv_to_utf8 =
yaz_iconv_open ("UTF-8", encoding);
if (zh->iconv_to_utf8 == 0)
- yaz_log (LOG_WARN, "iconv: %s to UTF-8 unsupported", encoding);
+ yaz_log (YLOG_WARN, "iconv: %s to UTF-8 unsupported", encoding);
zh->iconv_from_utf8 =
yaz_iconv_open (encoding, "UTF-8");
if (zh->iconv_to_utf8 == 0)
- yaz_log (LOG_WARN, "iconv: UTF-8 to %s unsupported", encoding);
+ yaz_log (YLOG_WARN, "iconv: UTF-8 to %s unsupported", encoding);
return 0;
}
ASSERTZH;
assert(name);
assert(value);
- yaz_log(LOG_API,"zebra_set_resource %s:%s",name,value);
+ yaz_log(log_level,"zebra_set_resource %s:%s",name,value);
zh->errCode=0;
res_set(zh->res, name, value);
return 0;
assert(defaultvalue);
v= res_get_def( zh->res, name, (char *)defaultvalue);
zh->errCode=0;
- yaz_log(LOG_API,"zebra_get_resource %s:%s",name,v);
+ yaz_log(log_level,"zebra_get_resource %s:%s",name,v);
return v;
}
int zebra_trans_no (ZebraHandle zh)
{
ASSERTZH;
- yaz_log(LOG_API,"zebra_trans_no");
+ yaz_log(log_level,"zebra_trans_no");
return zh->trans_no;
}
int zebra_get_shadow_enable (ZebraHandle zh)
{
ASSERTZH;
- yaz_log(LOG_API,"zebra_get_shadow_enable");
+ yaz_log(log_level,"zebra_get_shadow_enable");
return (zh->shadow_enable);
}
int zebra_set_shadow_enable (ZebraHandle zh, int value)
{
ASSERTZH;
- yaz_log(LOG_API,"zebra_set_shadow_enable %d",value);
+ yaz_log(log_level,"zebra_set_shadow_enable %d",value);
zh->shadow_enable = value;
return 0;
}
assert(comp);
assert(recs);
assert(num_recs>0);
- yaz_log(LOG_API,"api_records_retrieve s=%s n=%d",setname,num_recs);
+ yaz_log(log_level,"api_records_retrieve s=%s n=%d",setname,num_recs);
if (!zh->res)
{
poset = zebraPosSetCreate (zh, setname, num_recs, pos_array);
if (!poset)
{
- logf (LOG_DEBUG, "zebraPosSetCreate error");
+ yaz_log (YLOG_DEBUG, "zebraPosSetCreate error");
zh->errCode = 30;
zh->errString = nmem_strdup (stream->mem, setname);
}
ASSERTZH;
assert(sysno);
assert(buf);
- yaz_log(LOG_API, "zebra_insert_record sysno=" ZINT_FORMAT, *sysno);
+ yaz_log(log_level, "zebra_insert_record sysno=" ZINT_FORMAT, *sysno);
if (buf_size < 1) buf_size = strlen(buf);
assert(sysno);
assert(buf);
- yaz_log(LOG_API, "zebra_update_record sysno=" ZINT_FORMAT, *sysno);
+ yaz_log(log_level, "zebra_update_record sysno=" ZINT_FORMAT, *sysno);
if (buf_size < 1) buf_size = strlen(buf);
ASSERTZH;
assert(sysno);
assert(buf);
- yaz_log(LOG_API, "zebra_delete_record sysno=" ZINT_FORMAT, *sysno);
+ yaz_log(log_level, "zebra_delete_record sysno=" ZINT_FORMAT, *sysno);
if (buf_size < 1) buf_size = strlen(buf);
assert(pqf_query);
assert(setname);
- yaz_log(LOG_API,"zebra_search_PQF s=%s q=%s",setname, pqf_query);
+ yaz_log(log_level,"zebra_search_PQF s=%s q=%s",setname, pqf_query);
query = p_query_rpn (odr, PROTO_Z3950, pqf_query);
if (!query)
- yaz_log (LOG_WARN, "bad query %s\n", pqf_query);
+ yaz_log (YLOG_WARN, "bad query %s\n", pqf_query);
else
res=zebra_search_RPN (zh, odr, query, setname, &hits);
odr_destroy(odr);
- yaz_log(LOG_API,"Hits: %d",hits);
+ yaz_log(log_level,"Hits: %d",hits);
if (numhits)
*numhits=hits;
assert(output_setname);
assert(input_setnames);
sort_sequence = yaz_sort_spec (stream, sort_spec);
- yaz_log(LOG_API,"sort (FIXME) ");
+ yaz_log(log_level,"sort (FIXME) ");
if (!sort_sequence)
{
- logf(LOG_WARN,"invalid sort specs '%s'", sort_spec);
+ yaz_log(YLOG_WARN,"invalid sort specs '%s'", sort_spec);
zh->errCode = 207;
return -1;
}
-/* $Id: zebrash.c,v 1.29 2004-08-25 09:23:36 adam Exp $
+/* $Id: zebrash.c,v 1.30 2004-11-19 10:27:04 heikki Exp $
Copyright (C) 2002,2003,2004
Index Data Aps
#endif
#include <idzebra/api.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <yaz/proto.h>
#include <yaz/sortspec.h>
#include <yaz/options.h>
/* time being, only one session works */
int nextrecno=1; /* record number to show next */
static char *default_config = DEFAULTCONFIG;
+static int log_level=0;
+
/**************************************
* Help functions
rc=onecommand("yaz_log_file zebrash.log",outbuff,"");
if (!rc)
rc=onecommand("yaz_log_prefix ZebraSh", outbuff,"");
- sprintf(tmp, "yaz_log_level 0x%x", LOG_DEFAULT_LEVEL | LOG_APP);
+ sprintf(tmp, "yaz_log_level 0x%x", YLOG_DEFAULT_LEVEL | log_level );
if (!rc)
rc=onecommand(tmp,outbuff,"");
- logf(LOG_APP,"quickstart");
+ yaz_log(log_level,"quickstart");
if (!zs)
if (!rc)
rc=onecommand("zebra_start",outbuff,"");
static int cmd_yaz_log_level( char *args[], WRBUF outbuff)
{
- int lev = defargint(args[1],LOG_DEFAULT_LEVEL);
+ int lev = defargint(args[1],YLOG_DEFAULT_LEVEL);
wrbuf_printf(outbuff, "setting yaz-log to level %d (ox%x)\n",lev,lev);
yaz_log_init_level(lev);
return 0; /* ok */
if (lev)
i=2;
else
- lev=LOG_LOG; /* this is in the default set!*/
- logf( lev, restargs(args,i));
+ lev=YLOG_LOG; /* this is in the default set!*/
+ yaz_log( lev, restargs(args,i));
return 0; /* ok */
}
"[prefix]",
"Sets the log prefix",
cmd_yaz_log_prefix},
- { "logf",
+ { "yaz_log",
"[level] text...",
"writes an entry in the log",
cmd_logf},
char *args[MAX_NO_ARGS];
int nargs;
char argbuf[MAX_ARG_LEN];
- logf(LOG_APP,"%s",line);
+ yaz_log(log_level,"%s",line);
strncpy(argbuf,line, MAX_ARG_LEN-1);
argbuf[MAX_ARG_LEN-1]='\0'; /* just to be sure */
/*memset(args,'\0',MAX_NO_ARGS*sizeof(char *));*/
return ((cmds[i].testfunc)(args,outbuff));
}
wrbuf_printf(outbuff, "Unknown command '%s'. Try help\n",args[0]);
- logf(LOG_APP,"Unknown command");
+ yaz_log(log_level,"Unknown command");
return -90;
}
ec=zebra_errCode (zh);
if (ec)
{
- logf(LOG_APP, " Zebra error %d: %s, (%s)",
+ yaz_log(log_level, " Zebra error %d: %s, (%s)",
ec, zebra_errString (zh),
zebra_errAdd (zh) );
wrbuf_printf(outbuff, " Zebra error %d: %s, (%s)\n",
if (rc==0)
{
wrbuf_puts(outbuff, " OK\n");
- logf(LOG_APP, "OK");
+ yaz_log(log_level, "OK");
}
else if (rc>-90)
{
break;
case 'h':
usage();
+ /* FIXME - handle -v */
default:
fprintf(stderr, "bad option %s\n", arg);
usage();
}
}
+ log_level=yaz_log_module_level("zebrash");
+
shell();
return 0;
} /* main */
-/* $Id: zinfo.c,v 1.40 2004-08-25 09:23:36 adam Exp $
+/* $Id: zinfo.c,v 1.41 2004-11-19 10:27:05 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
void zebraExplain_close (ZebraExplainInfo zei)
{
#if ZINFO_DEBUG
- yaz_log (LOG_LOG, "zebraExplain_close");
+ yaz_log (YLOG_LOG, "zebraExplain_close");
#endif
if (!zei)
return;
NMEM nmem = nmem_create ();
#if ZINFO_DEBUG
- logf (LOG_LOG, "zebraExplain_open wr=%d", writeFlag);
+ yaz_log (YLOG_LOG, "zebraExplain_open wr=%d", writeFlag);
#endif
zei = (ZebraExplainInfo) nmem_malloc (nmem, sizeof(*zei));
zei->write_flag = writeFlag;
if (!zei->data1_target)
#endif
{
- logf (LOG_FATAL, "Explain schema missing. Check profilePath");
+ yaz_log (YLOG_FATAL, "Explain schema missing. Check profilePath");
nmem_destroy (zei->nmem);
return 0;
}
np = np->child;
assert (np && np->which == DATA1N_data);
zei->runNumber = atoi_zn (np->u.data.data, np->u.data.len);
- yaz_log (LOG_DEBUG, "read runnumber=" ZINT_FORMAT, zei->runNumber);
+ yaz_log (YLOG_DEBUG, "read runnumber=" ZINT_FORMAT, zei->runNumber);
*zdip = NULL;
}
rec_rm (&trec);
"</></>\n" );
if (!zei->data1_target)
{
- logf (LOG_FATAL, "Explain schema missing. Check profilePath");
+ yaz_log (YLOG_FATAL, "Explain schema missing. Check profilePath");
nmem_destroy (zei->nmem);
return 0;
}
node_use->u.data.len);
(*zsuip)->info.ordinal = atoi_n (node_ordinal->u.data.data,
node_ordinal->u.data.len);
- logf (LOG_DEBUG, "set=%d use=%d ordinal=%d",
+ yaz_log (YLOG_DEBUG, "set=%d use=%d ordinal=%d",
(*zsuip)->info.set, (*zsuip)->info.use, (*zsuip)->info.ordinal);
zsuip = &(*zsuip)->next;
}
if (!zdi)
return -1;
#if ZINFO_DEBUG
- logf (LOG_LOG, "zebraExplain_curDatabase: %s", database);
+ yaz_log (YLOG_LOG, "zebraExplain_curDatabase: %s", database);
#endif
if (zdi->readFlag)
{
#if ZINFO_DEBUG
- logf (LOG_LOG, "zebraExplain_readDatabase: %s", database);
+ yaz_log (YLOG_LOG, "zebraExplain_readDatabase: %s", database);
#endif
zebraExplain_readDatabase (zei, zdi);
}
if (zdi->attributeDetails->readFlag)
{
#if ZINFO_DEBUG
- logf (LOG_LOG, "zebraExplain_readAttributeDetails: %s", database);
+ yaz_log (YLOG_LOG, "zebraExplain_readAttributeDetails: %s", database);
#endif
zebraExplain_readAttributeDetails (zei, zdi->attributeDetails);
}
database_n = database;
#if ZINFO_DEBUG
- logf (LOG_LOG, "zebraExplain_newDatabase: %s", database);
+ yaz_log (YLOG_LOG, "zebraExplain_newDatabase: %s", database);
#endif
assert (zei);
for (zdi = zei->databaseInfo; zdi; zdi=zdi->next)
node_categoryList = zcl->data1_categoryList;
#if ZINFO_DEBUG
- logf (LOG_LOG, "zebraExplain_writeCategoryList");
+ yaz_log (YLOG_LOG, "zebraExplain_writeCategoryList");
#endif
drec = createRecord (zei->records, &sysno);
zad->dirty = 0;
#if ZINFO_DEBUG
- logf (LOG_LOG, "zebraExplain_writeAttributeDetails");
+ yaz_log (YLOG_LOG, "zebraExplain_writeAttributeDetails");
#endif
drec = createRecord (zei->records, &zad->sysno);
zdi->dirty = 0;
#if ZINFO_DEBUG
- logf (LOG_LOG, "zebraExplain_writeDatabase %s", zdi->databaseName);
+ yaz_log (YLOG_LOG, "zebraExplain_writeDatabase %s", zdi->databaseName);
#endif
drec = createRecord (zei->records, &zdi->sysno);
assert (zdi->data1_database);
attset = data1_attset_search_id (zei->dh, entp->value);
#if ZINFO_DEBUG
- logf (LOG_LOG, "zebraExplain_writeAttributeSet %s",
+ yaz_log (YLOG_LOG, "zebraExplain_writeAttributeSet %s",
attset ? attset->name : "<unknown>");
#endif
{
data1_handle dh = (data1_handle) p;
if (!data1_get_attset (dh, name))
- logf (LOG_WARN, "Directive attset failed for %s", name);
+ yaz_log (YLOG_WARN, "Directive attset failed for %s", name);
}
void zebraExplain_loadAttsets (data1_handle dh, Res res)
-/* $Id: zrpn.c,v 1.160 2004-11-15 22:57:25 adam Exp $
+/* $Id: zrpn.c,v 1.161 2004-11-19 10:27:06 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
if (out && *out)
{
const char *outp = *out;
- yaz_log(LOG_LOG, "---");
+ yaz_log(YLOG_LOG, "---");
while (*outp)
{
- yaz_log(LOG_LOG, "%02X", *outp);
+ yaz_log(YLOG_LOG, "%02X", *outp);
outp++;
}
}
int len = key_SU_decode (&su_code, name);
term_untrans (p->zh, p->reg_type, term_tmp, name+len+1);
- yaz_log(LOG_LOG, "grep: %d %c %s", su_code, name[len], term_tmp);
+ yaz_log(YLOG_LOG, "grep: %d %c %s", su_code, name[len], term_tmp);
zebraExplain_lookup_ord (p->zh->reg->zei,
su_code, &db, &set, &use);
- yaz_log(LOG_LOG, "grep: set=%d use=%d db=%s", set, use, db);
+ yaz_log(YLOG_LOG, "grep: set=%d use=%d db=%s", set, use, db);
resultSetAddTerm(p->zh, p->termset, name[len], db,
set, use, term_tmp);
int pos = 0;
char numstr[20];
- yaz_log(LOG_DEBUG, "gen_regular_rel. val=%d, islt=%d", val, islt);
+ yaz_log(YLOG_DEBUG, "gen_regular_rel. val=%d, islt=%d", val, islt);
if (val >= 0)
{
if (islt)
attr_init(&relation, zapt, 2);
relation_value = attr_find(&relation, NULL);
- yaz_log(LOG_DEBUG, "string relation value=%d", relation_value);
+ yaz_log(YLOG_DEBUG, "string relation value=%d", relation_value);
switch (relation_value)
{
case 1:
term_sub, term_component,
space_split, term_dst))
return 0;
- yaz_log(LOG_DEBUG, "Relation <");
+ yaz_log(YLOG_DEBUG, "Relation <");
*term_tmp++ = '(';
for (i = 0; term_component[i]; )
term_sub, term_component,
space_split, term_dst))
return 0;
- yaz_log(LOG_DEBUG, "Relation <=");
+ yaz_log(YLOG_DEBUG, "Relation <=");
*term_tmp++ = '(';
for (i = 0; term_component[i]; )
if (!term_100 (zh->reg->zebra_maps, reg_type,
term_sub, term_component, space_split, term_dst))
return 0;
- yaz_log(LOG_DEBUG, "Relation >");
+ yaz_log(YLOG_DEBUG, "Relation >");
*term_tmp++ = '(';
for (i = 0; term_component[i];)
if (!term_100 (zh->reg->zebra_maps, reg_type, term_sub,
term_component, space_split, term_dst))
return 0;
- yaz_log(LOG_DEBUG, "Relation >=");
+ yaz_log(YLOG_DEBUG, "Relation >=");
*term_tmp++ = '(';
for (i = 0; term_component[i];)
break;
case 3:
default:
- yaz_log(LOG_DEBUG, "Relation =");
+ yaz_log(YLOG_DEBUG, "Relation =");
if (!term_100 (zh->reg->zebra_maps, reg_type, term_sub,
term_component, space_split, term_dst))
return 0;
term_dst, xpath_use);
if (r < 1)
return 0;
- yaz_log(LOG_DEBUG, "term: %s", term_dst);
+ yaz_log(YLOG_DEBUG, "term: %s", term_dst);
return rset_trunc(zh, grep_info->isam_p_buf,
grep_info->isam_p_indx, term_dst,
strlen(term_dst), rank_type, 1 /* preserve pos */,
rpn_char_map_prepare (zh->reg, reg_type, &rcmi);
attr_init (&use, zapt, 1);
use_value = attr_find_ex (&use, &curAttributeSet, &use_string);
- yaz_log(LOG_DEBUG, "string_term, use value %d", use_value);
+ yaz_log(YLOG_DEBUG, "string_term, use value %d", use_value);
attr_init (&truncation, zapt, 5);
truncation_value = attr_find (&truncation, NULL);
- yaz_log(LOG_DEBUG, "truncation value %d", truncation_value);
+ yaz_log(YLOG_DEBUG, "truncation value %d", truncation_value);
if (use_value == -1) /* no attribute - assumy "any" */
use_value = 1016;
if ((r=att_getentbyatt (zh, &attp, curAttributeSet, use_value,
use_string)))
{
- yaz_log(LOG_DEBUG, "att_getentbyatt fail. set=%d use=%d r=%d",
+ yaz_log(YLOG_DEBUG, "att_getentbyatt fail. set=%d use=%d r=%d",
curAttributeSet, use_value, r);
if (r == -1)
{
term_dict[prefix_len++] = ')';
term_dict[prefix_len++] = 1;
term_dict[prefix_len++] = reg_type;
- yaz_log(LOG_DEBUG, "reg_type = %d", term_dict[prefix_len-1]);
+ yaz_log(YLOG_DEBUG, "reg_type = %d", term_dict[prefix_len-1]);
term_dict[prefix_len] = '\0';
j = prefix_len;
switch (truncation_value)
}
if (attr_ok)
{
- yaz_log(LOG_DEBUG, "dict_lookup_grep: %s", term_dict+prefix_len);
+ yaz_log(YLOG_DEBUG, "dict_lookup_grep: %s", term_dict+prefix_len);
r = dict_lookup_grep(zh->reg->dict, term_dict, regex_range,
grep_info, &max_pos, init_pos,
grep_handle);
if (r)
- yaz_log(LOG_WARN, "dict_lookup_grep fail %d", r);
+ yaz_log(YLOG_WARN, "dict_lookup_grep fail %d", r);
}
}
if (!bases_ok)
return -1;
}
*term_sub = termp;
- yaz_log(LOG_DEBUG, "%d positions", grep_info->isam_p_indx);
+ yaz_log(YLOG_DEBUG, "%d positions", grep_info->isam_p_indx);
return 1;
}
}
else
termset_name = termset_value_string;
- yaz_log(LOG_LOG, "creating termset set %s", termset_name);
+ yaz_log(YLOG_LOG, "creating termset set %s", termset_name);
grep_info->termset = resultSetAdd (zh, termset_name, 1);
if (!grep_info->termset)
{
return 0;
while (1)
{
- yaz_log(LOG_DEBUG, "APT_phrase termp=%s", termp);
+ yaz_log(YLOG_DEBUG, "APT_phrase termp=%s", termp);
rset[rset_no] = term_trunc(zh, zapt, &termp, attributeSet,
stream, &grep_info,
reg_type, complete_flag,
return 0;
while (1)
{
- yaz_log(LOG_DEBUG, "APT_or_list termp=%s", termp);
+ yaz_log(YLOG_DEBUG, "APT_or_list termp=%s", termp);
rset[rset_no] = term_trunc(zh, zapt, &termp, attributeSet,
stream, &grep_info,
reg_type, complete_flag,
return 0;
while (1)
{
- yaz_log(LOG_DEBUG, "APT_and_list termp=%s", termp);
+ yaz_log(YLOG_DEBUG, "APT_and_list termp=%s", termp);
rset[rset_no] = term_trunc(zh, zapt, &termp, attributeSet,
stream, &grep_info,
reg_type, complete_flag,
attr_init (&relation, zapt, 2);
relation_value = attr_find (&relation, NULL);
- yaz_log(LOG_DEBUG, "numeric relation value=%d", relation_value);
+ yaz_log(YLOG_DEBUG, "numeric relation value=%d", relation_value);
if (!term_100 (zh->reg->zebra_maps, reg_type, term_sub, term_tmp, 1,
term_dst))
switch (relation_value)
{
case 1:
- yaz_log(LOG_DEBUG, "Relation <");
+ yaz_log(YLOG_DEBUG, "Relation <");
gen_regular_rel (term_tmp, term_value-1, 1);
break;
case 2:
- yaz_log(LOG_DEBUG, "Relation <=");
+ yaz_log(YLOG_DEBUG, "Relation <=");
gen_regular_rel (term_tmp, term_value, 1);
break;
case 4:
- yaz_log(LOG_DEBUG, "Relation >=");
+ yaz_log(YLOG_DEBUG, "Relation >=");
gen_regular_rel (term_tmp, term_value, 0);
break;
case 5:
- yaz_log(LOG_DEBUG, "Relation >");
+ yaz_log(YLOG_DEBUG, "Relation >");
gen_regular_rel (term_tmp, term_value+1, 0);
break;
case 3:
default:
- yaz_log(LOG_DEBUG, "Relation =");
+ yaz_log(YLOG_DEBUG, "Relation =");
sprintf (term_tmp, "(0*%d)", term_value);
}
- yaz_log(LOG_DEBUG, "dict_lookup_grep: %s", term_tmp);
+ yaz_log(YLOG_DEBUG, "dict_lookup_grep: %s", term_tmp);
r = dict_lookup_grep(zh->reg->dict, term_dict, 0, grep_info, max_pos,
0, grep_handle);
if (r)
- yaz_log(LOG_WARN, "dict_lookup_grep fail, rel=gt: %d", r);
- yaz_log(LOG_DEBUG, "%d positions", grep_info->isam_p_indx);
+ yaz_log(YLOG_WARN, "dict_lookup_grep fail, rel=gt: %d", r);
+ yaz_log(YLOG_DEBUG, "%d positions", grep_info->isam_p_indx);
return 1;
}
if ((r=att_getentbyatt (zh, &attp, curAttributeSet, use_value,
use_string)))
{
- yaz_log(LOG_DEBUG, "att_getentbyatt fail. set=%d use=%d r=%d",
+ yaz_log(YLOG_DEBUG, "att_getentbyatt fail. set=%d use=%d r=%d",
curAttributeSet, use_value, r);
if (r == -1)
{
term_dict[prefix_len++] = ')';
term_dict[prefix_len++] = 1;
term_dict[prefix_len++] = reg_type;
- yaz_log(LOG_DEBUG, "reg_type = %d", term_dict[prefix_len-1]);
+ yaz_log(YLOG_DEBUG, "reg_type = %d", term_dict[prefix_len-1]);
term_dict[prefix_len] = '\0';
if (!numeric_relation (zh, zapt, &termp, term_dict,
attributeSet, grep_info, &max_pos, reg_type,
return -1;
}
*term_sub = termp;
- yaz_log(LOG_DEBUG, "%d positions", grep_info->isam_p_indx);
+ yaz_log(YLOG_DEBUG, "%d positions", grep_info->isam_p_indx);
return 1;
}
int r, rset_no = 0;
struct grep_info grep_info;
- yaz_log(LOG_DEBUG, "APT_numeric t='%s'",termz);
+ yaz_log(YLOG_DEBUG, "APT_numeric t='%s'",termz);
if (grep_info_prepare (zh, zapt, &grep_info, reg_type, stream))
return 0;
while (1)
{
- yaz_log(LOG_DEBUG, "APT_numeric termp=%s", termp);
+ yaz_log(YLOG_DEBUG, "APT_numeric termp=%s", termp);
grep_info.isam_p_indx = 0;
r = numeric_term(zh, zapt, &termp, attributeSet, &grep_info,
reg_type, complete_flag, num_bases, basenames,
stream);
if (r < 1)
break;
- yaz_log(LOG_DEBUG, "term: %s", term_dst);
+ yaz_log(YLOG_DEBUG, "term: %s", term_dst);
rset[rset_no] = rset_trunc(zh, grep_info.isam_p_buf,
grep_info.isam_p_indx, term_dst,
strlen(term_dst), rank_type,
grep_info.isam_p_indx = 0;
r = dict_lookup_grep(zh->reg->dict, term_dict, 0,
&grep_info, &max_pos, 0, grep_handle);
- yaz_log (LOG_LOG, "%s %d positions", term,
+ yaz_log (YLOG_LOG, "%s %d positions", term,
grep_info.isam_p_indx);
rset = rset_trunc(zh, grep_info.isam_p_buf,
grep_info.isam_p_indx, term, strlen(term),
if (xpath_len < 0)
return rset;
- yaz_log (LOG_LOG, "len=%d", xpath_len);
+ yaz_log (YLOG_LOG, "len=%d", xpath_len);
for (i = 0; i<xpath_len; i++)
{
- yaz_log (LOG_LOG, "XPATH %d %s", i, xpath[i].part);
+ yaz_log (YLOG_LOG, "XPATH %d %s", i, xpath[i].part);
}
if (!first_path)
continue;
}
- yaz_log (LOG_LOG, "xpath_rev (%d) = %s", level, xpath_rev);
+ yaz_log (YLOG_LOG, "xpath_rev (%d) = %s", level, xpath_rev);
if (strlen(xpath_rev))
{
rset_start_tag = xpath_trunc(zh, stream, '0',
zebra_maps_attr (zh->reg->zebra_maps, zapt, ®_id, &search_type,
rank_type, &complete_flag, &sort_flag);
- yaz_log(LOG_DEBUG, "reg_id=%c", reg_id);
- yaz_log(LOG_DEBUG, "complete_flag=%d", complete_flag);
- yaz_log(LOG_DEBUG, "search_type=%s", search_type);
- yaz_log(LOG_DEBUG, "rank_type=%s", rank_type);
+ yaz_log(YLOG_DEBUG, "reg_id=%c", reg_id);
+ yaz_log(YLOG_DEBUG, "complete_flag=%d", complete_flag);
+ yaz_log(YLOG_DEBUG, "search_type=%s", search_type);
+ yaz_log(YLOG_DEBUG, "rank_type=%s", rank_type);
if (zapt_term_to_utf8(zh, zapt, termz))
return 0;
{
if (zs->u.simple->which == Z_Operand_APT)
{
- yaz_log(LOG_DEBUG, "rpn_search_APT");
+ yaz_log(YLOG_DEBUG, "rpn_search_APT");
r = rpn_search_APT (zh, zs->u.simple->u.attributesPlusTerm,
attributeSet, stream, sort_sequence,
num_bases, basenames,rset_nmem);
}
else if (zs->u.simple->which == Z_Operand_resultSetId)
{
- yaz_log(LOG_DEBUG, "rpn_search_ref");
+ yaz_log(YLOG_DEBUG, "rpn_search_ref");
r = resultSetRef (zh, zs->u.simple->u.resultSetId);
if (!r)
{
return 0;
if (zh->errCode)
- yaz_log(LOG_DEBUG, "search error: %d", zh->errCode);
+ yaz_log(YLOG_DEBUG, "search error: %d", zh->errCode);
for (i = 0; sort_sequence->specs[i]; i++)
;
resultSetRank (zh, sset, rset, rset_nmem);
else
{
- yaz_log(LOG_DEBUG, "resultSetSortSingle in rpn_search");
+ yaz_log(YLOG_DEBUG, "resultSetSortSingle in rpn_search");
resultSetSortSingle (zh, nmem, sset, rset,
sort_sequence, &sort_status);
if (zh->errCode)
{
- yaz_log(LOG_DEBUG, "resultSetSortSingle status = %d", zh->errCode);
+ yaz_log(YLOG_DEBUG, "resultSetSortSingle status = %d", zh->errCode);
}
}
return rset;
struct it_key key;
RSFD rfd;
- yaz_log(LOG_DEBUG, "count_set");
+ yaz_log(YLOG_DEBUG, "count_set");
*count = 0;
rfd = rset_open (r, RSETF_READ);
kno++;
}
rset_close (rfd);
- yaz_log(LOG_DEBUG, "%d keys, %d records", kno, *count);
+ yaz_log(YLOG_DEBUG, "%d keys, %d records", kno, *count);
}
void rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
}
}
- yaz_log (LOG_DEBUG, "position = %d, num = %d set=%d",
+ yaz_log (YLOG_DEBUG, "position = %d, num = %d set=%d",
pos, num, attributeset);
attr_init (&use, zapt, 1);
zh->errCode = 113;
return ;
}
- yaz_log (LOG_DEBUG, "use_value = %d", use_value);
+ yaz_log (YLOG_DEBUG, "use_value = %d", use_value);
if (use_value == -1)
use_value = 1016;
if ((r=att_getentbyatt (zh, &attp, attributeset, use_value,
use_string)))
{
- yaz_log(LOG_DEBUG, "att_getentbyatt fail. set=%d use=%d",
+ yaz_log(YLOG_DEBUG, "att_getentbyatt fail. set=%d use=%d",
attributeset, use_value);
if (r == -1)
{
nmem_destroy(rset_nmem);
*list = glist + i; /* list is set to first 'real' entry */
- yaz_log(LOG_DEBUG, "position = %d, num_entries = %d",
+ yaz_log(YLOG_DEBUG, "position = %d, num_entries = %d",
*position, *num_entries);
if (zh->errCode)
- yaz_log(LOG_DEBUG, "scan error: %d", zh->errCode);
+ yaz_log(YLOG_DEBUG, "scan error: %d", zh->errCode);
}
-/* $Id: zserver.c,v 1.122 2004-08-25 09:28:01 adam Exp $
+/* $Id: zserver.c,v 1.123 2004-11-19 10:27:08 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#endif
#include <errno.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <yaz/ill.h>
#include <yaz/yaz-util.h>
q->implementation_name = "Zebra Information Server";
q->implementation_version = "Zebra " ZEBRAVER;
- yaz_log (LOG_DEBUG, "bend_init");
+ yaz_log (YLOG_DEBUG, "bend_init");
sob = statserv_getcontrol ();
if (!(zh = zebra_open (sob->handle)))
{
- yaz_log (LOG_WARN, "Failed to read config `%s'", sob->configname);
+ yaz_log (YLOG_WARN, "Failed to read config `%s'", sob->configname);
r->errcode = 1;
return r;
}
int i;
NMEM nmem = nmem_create();
- yaz_log (LOG_LOG, "character set and language negotiation");
+ yaz_log (YLOG_LOG, "character set and language negotiation");
yaz_get_proposal_charneg (nmem, q->charneg_request,
&charsets, &num_charsets,
}
if (odr_set_charset (q->decode, "UTF-8", right_name) == 0)
{
- yaz_log (LOG_LOG, "charset %d %s (proper name %s): OK", i,
+ yaz_log (YLOG_LOG, "charset %d %s (proper name %s): OK", i,
charsets[i], right_name);
odr_set_charset (q->stream, right_name, "UTF-8");
if (selected)
0, selected);
break;
} else {
- yaz_log (LOG_LOG, "charset %d %s (proper name %s): unsupported", i,
+ yaz_log (YLOG_LOG, "charset %d %s (proper name %s): unsupported", i,
charsets[i], right_name);
}
}
switch (type)
{
case Z_Term_characterString:
- yaz_log (LOG_DEBUG, "term as characterString");
+ yaz_log (YLOG_DEBUG, "term as characterString");
term->which = Z_Term_characterString;
term->u.characterString = odr_strdup (r->stream, outbuf);
break;
case Z_Term_general:
- yaz_log (LOG_DEBUG, "term as general");
+ yaz_log (YLOG_DEBUG, "term as general");
term->which = Z_Term_general;
term->u.general = odr_malloc (r->stream, sizeof(*term->u.general));
term->u.general->size = term->u.general->len = len;
zebra_result (zh, &r->errcode, &r->errstring);
return 0;
}
- yaz_log (LOG_LOG, "ResultSet '%s'", r->setname);
+ yaz_log (YLOG_LOG, "ResultSet '%s'", r->setname);
switch (r->query->which)
{
case Z_Query_type_1: case Z_Query_type_101:
{
if (r->toKeep->databaseName)
{
- yaz_log(LOG_LOG, "adm request database %s", r->toKeep->databaseName);
+ yaz_log(YLOG_LOG, "adm request database %s", r->toKeep->databaseName);
}
switch (r->toKeep->which)
{
case Z_ESAdminOriginPartToKeep_reIndex:
- yaz_log(LOG_LOG, "adm-reindex");
+ yaz_log(YLOG_LOG, "adm-reindex");
break;
case Z_ESAdminOriginPartToKeep_truncate:
- yaz_log(LOG_LOG, "adm-truncate");
+ yaz_log(YLOG_LOG, "adm-truncate");
break;
case Z_ESAdminOriginPartToKeep_drop:
- yaz_log(LOG_LOG, "adm-drop");
+ yaz_log(YLOG_LOG, "adm-drop");
zebra_drop_database (zh, r->toKeep->databaseName);
break;
case Z_ESAdminOriginPartToKeep_create:
- yaz_log(LOG_LOG, "adm-create %s", r->toKeep->databaseName);
+ yaz_log(YLOG_LOG, "adm-create %s", r->toKeep->databaseName);
zebra_create_database (zh, r->toKeep->databaseName);
break;
case Z_ESAdminOriginPartToKeep_import:
- yaz_log(LOG_LOG, "adm-import");
+ yaz_log(YLOG_LOG, "adm-import");
zebra_admin_import_begin (zh, r->toKeep->databaseName,
r->toKeep->u.import->recordType);
break;
case Z_ESAdminOriginPartToKeep_refresh:
- yaz_log(LOG_LOG, "adm-refresh");
+ yaz_log(YLOG_LOG, "adm-refresh");
break;
case Z_ESAdminOriginPartToKeep_commit:
- yaz_log(LOG_LOG, "adm-commit");
+ yaz_log(YLOG_LOG, "adm-commit");
if (r->toKeep->databaseName)
zebra_select_database(zh, r->toKeep->databaseName);
zebra_commit(zh);
break;
case Z_ESAdminOriginPartToKeep_shutdown:
- yaz_log(LOG_LOG, "shutdown");
+ yaz_log(YLOG_LOG, "shutdown");
zebra_admin_shutdown(zh);
break;
case Z_ESAdminOriginPartToKeep_start:
- yaz_log(LOG_LOG, "start");
+ yaz_log(YLOG_LOG, "start");
zebra_admin_start(zh);
break;
default:
- yaz_log(LOG_LOG, "unknown admin");
+ yaz_log(YLOG_LOG, "unknown admin");
}
return 0;
}
es_admin_request (zh, r->u.esRequest);
break;
case Z_Admin_taskPackage:
- yaz_log (LOG_LOG, "adm taskpackage (unhandled)");
+ yaz_log (YLOG_LOG, "adm taskpackage (unhandled)");
break;
default:
break;
{
ZebraHandle zh = (ZebraHandle) handle;
- yaz_log(LOG_LOG, "function: %d", *rr->esr->function);
+ yaz_log(YLOG_LOG, "function: %d", *rr->esr->function);
if (rr->esr->packageName)
- yaz_log(LOG_LOG, "packagename: %s", rr->esr->packageName);
- yaz_log(LOG_LOG, "Waitaction: %d", *rr->esr->waitAction);
+ yaz_log(YLOG_LOG, "packagename: %s", rr->esr->packageName);
+ yaz_log(YLOG_LOG, "Waitaction: %d", *rr->esr->waitAction);
if (!rr->esr->taskSpecificParameters)
{
- yaz_log (LOG_WARN, "No task specific parameters");
+ yaz_log (YLOG_WARN, "No task specific parameters");
}
else if (rr->esr->taskSpecificParameters->which == Z_External_ESAdmin)
{
else if (rr->esr->taskSpecificParameters->which == Z_External_update)
{
Z_IUUpdate *up = rr->esr->taskSpecificParameters->u.update;
- yaz_log (LOG_LOG, "Received DB Update");
+ yaz_log (YLOG_LOG, "Received DB Update");
if (up->which == Z_IUUpdate_esRequest)
{
Z_IUUpdateEsRequest *esRequest = up->u.esRequest;
Z_IUOriginPartToKeep *toKeep = esRequest->toKeep;
Z_IUSuppliedRecords *notToKeep = esRequest->notToKeep;
- yaz_log (LOG_LOG, "action");
+ yaz_log (YLOG_LOG, "action");
if (toKeep->action)
{
switch (*toKeep->action)
{
case Z_IUOriginPartToKeep_recordInsert:
- yaz_log (LOG_LOG, "recordInsert");
+ yaz_log (YLOG_LOG, "recordInsert");
break;
case Z_IUOriginPartToKeep_recordReplace:
- yaz_log (LOG_LOG, "recordUpdate");
+ yaz_log (YLOG_LOG, "recordUpdate");
break;
case Z_IUOriginPartToKeep_recordDelete:
- yaz_log (LOG_LOG, "recordDelete");
+ yaz_log (YLOG_LOG, "recordDelete");
break;
case Z_IUOriginPartToKeep_elementUpdate:
- yaz_log (LOG_LOG, "elementUpdate");
+ yaz_log (YLOG_LOG, "elementUpdate");
break;
case Z_IUOriginPartToKeep_specialUpdate:
- yaz_log (LOG_LOG, "specialUpdate");
+ yaz_log (YLOG_LOG, "specialUpdate");
break;
case Z_ESAdminOriginPartToKeep_shutdown:
- yaz_log (LOG_LOG, "shutDown");
+ yaz_log (YLOG_LOG, "shutDown");
break;
case Z_ESAdminOriginPartToKeep_start:
- yaz_log (LOG_LOG, "start");
+ yaz_log (YLOG_LOG, "start");
break;
default:
- yaz_log (LOG_LOG, " unknown (%d)", *toKeep->action);
+ yaz_log (YLOG_LOG, " unknown (%d)", *toKeep->action);
}
}
if (toKeep->databaseName)
{
- yaz_log (LOG_LOG, "database: %s", toKeep->databaseName);
+ yaz_log (YLOG_LOG, "database: %s", toKeep->databaseName);
if (zebra_select_database(zh, toKeep->databaseName))
return 0;
}
else
{
- yaz_log (LOG_WARN, "no database supplied for ES Update");
+ yaz_log (YLOG_WARN, "no database supplied for ES Update");
rr->errcode = 1008;
rr->errstring = "database";
return 0;
{
oident = oid_getentbyoid(rec->direct_reference);
if (oident)
- yaz_log (LOG_LOG, "record %d type %s", i,
+ yaz_log (YLOG_LOG, "record %d type %s", i,
oident->desc);
}
switch (rec->which)
{
case Z_External_sutrs:
if (rec->u.octet_aligned->len > 170)
- yaz_log (LOG_LOG, "%d bytes:\n%.168s ...",
+ yaz_log (YLOG_LOG, "%d bytes:\n%.168s ...",
rec->u.sutrs->len,
rec->u.sutrs->buf);
else
- yaz_log (LOG_LOG, "%d bytes:\n%s",
+ yaz_log (YLOG_LOG, "%d bytes:\n%s",
rec->u.sutrs->len,
rec->u.sutrs->buf);
break;
case Z_External_octet:
if (rec->u.octet_aligned->len > 170)
- yaz_log (LOG_LOG, "%d bytes:\n%.168s ...",
+ yaz_log (YLOG_LOG, "%d bytes:\n%.168s ...",
rec->u.octet_aligned->len,
rec->u.octet_aligned->buf);
else
- yaz_log (LOG_LOG, "%d bytes\n%s",
+ yaz_log (YLOG_LOG, "%d bytes\n%s",
rec->u.octet_aligned->len,
rec->u.octet_aligned->buf);
}
}
else
{
- yaz_log (LOG_WARN, "Unknown Extended Service(%d)",
+ yaz_log (YLOG_WARN, "Unknown Extended Service(%d)",
rr->esr->taskSpecificParameters->which);
rr->errcode = 221;
sob->handle = zebra_start(sob->configname);
if (!sob->handle)
{
- yaz_log (LOG_FATAL, "Failed to read config `%s'", sob->configname);
+ yaz_log (YLOG_FATAL, "Failed to read config `%s'", sob->configname);
exit (1);
}
#ifdef WIN32
{
if (errno != EEXIST)
{
- yaz_log(LOG_FATAL|LOG_ERRNO, "lock file %s", pidfname);
+ yaz_log(YLOG_FATAL|YLOG_ERRNO, "lock file %s", pidfname);
exit(1);
}
fd = open(pidfname, O_RDWR, 0666);
if (fd == -1)
{
- yaz_log(LOG_FATAL|LOG_ERRNO, "lock file %s", pidfname);
+ yaz_log(YLOG_FATAL|YLOG_ERRNO, "lock file %s", pidfname);
exit(1);
}
}
area.l_len = area.l_start = 0L;
if (fcntl (fd, F_SETLK, &area) == -1)
{
- yaz_log(LOG_ERRNO|LOG_FATAL, "Zebra server already running");
+ yaz_log(YLOG_ERRNO|YLOG_FATAL, "Zebra server already running");
exit(1);
}
else
-/* $Id: zsets.c,v 1.70 2004-11-15 22:44:33 adam Exp $
+/* $Id: zsets.c,v 1.71 2004-11-19 10:27:09 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
break;
if (s)
{
- yaz_log(LOG_DEBUG, "updating result set %s", name);
+ yaz_log(YLOG_DEBUG, "updating result set %s", name);
if (!ov || s->locked)
return NULL;
if (s->rset)
{
const char *sort_max_str = zebra_get_resource(zh, "sortmax", "1000");
- yaz_log(LOG_DEBUG, "adding result set %s", name);
+ yaz_log(YLOG_DEBUG, "adding result set %s", name);
s = (ZebraSet) xmalloc (sizeof(*s));
s->next = zh->sets;
zh->sets = s;
if (!s->term_entries && !s->rset && s->rpn)
{
NMEM nmem = nmem_create ();
- yaz_log(LOG_LOG, "research %s", name);
+ yaz_log(YLOG_LOG, "research %s", name);
if (!s->rset_nmem)
s->rset_nmem=nmem_create();
s->rset =
position = positions[i];
if (position > 0 && position <= sort_info->num_entries)
{
- yaz_log(LOG_DEBUG, "got pos=%d (sorted)", position);
+ yaz_log(YLOG_DEBUG, "got pos=%d (sorted)", position);
sr[i].sysno = sort_info->entries[position-1]->sysno;
sr[i].score = sort_info->entries[position-1]->score;
}
if (position == positions[num_i])
{
sr[num_i].sysno = psysno;
- yaz_log(LOG_DEBUG, "got pos=%d (unsorted)", position);
+ yaz_log(YLOG_DEBUG, "got pos=%d (unsorted)", position);
sr[num_i].score = -1;
num_i++;
}
zh->errCode = 230;
return;
}
- yaz_log(LOG_DEBUG, "result set sort input=%s output=%s",
+ yaz_log(YLOG_DEBUG, "result set sort input=%s output=%s",
*input_setnames, output_setname);
sset = resultSetGet (zh, input_setnames[0]);
if (!sset)
switch (sk->which)
{
case Z_SortKey_sortField:
- yaz_log(LOG_DEBUG, "Sort: key %d is of type sortField", i+1);
+ yaz_log(YLOG_DEBUG, "Sort: key %d is of type sortField", i+1);
zh->errCode = 207;
return;
case Z_SortKey_elementSpec:
- yaz_log(LOG_DEBUG, "Sort: key %d is of type elementSpec", i+1);
+ yaz_log(YLOG_DEBUG, "Sort: key %d is of type elementSpec", i+1);
zh->errCode = 207;
return;
case Z_SortKey_sortAttributes:
- yaz_log(LOG_DEBUG, "Sort: key %d is of type sortAttributes", i+1);
+ yaz_log(YLOG_DEBUG, "Sort: key %d is of type sortAttributes", i+1);
sort_criteria[i].attrUse =
zebra_maps_sort (zh->reg->zebra_maps,
sk->u.sortAttributes,
&sort_criteria[i].numerical);
- yaz_log(LOG_DEBUG, "use value = %d", sort_criteria[i].attrUse);
+ yaz_log(YLOG_DEBUG, "use value = %d", sort_criteria[i].attrUse);
if (sort_criteria[i].attrUse == -1)
{
zh->errCode = 116;
}
}
rset_close (rfd);
- yaz_log(LOG_DEBUG, ZINT_FORMAT " keys, " ZINT_FORMAT " sysnos, sort",
+ yaz_log(YLOG_DEBUG, ZINT_FORMAT " keys, " ZINT_FORMAT " sysnos, sort",
kno, sset->hits);
for (i = 0; i < numTerms; i++)
- yaz_log(LOG_LOG, "term=\"%s\" type=%s count=" ZINT_FORMAT,
+ yaz_log(YLOG_LOG, "term=\"%s\" type=%s count=" ZINT_FORMAT,
terms[i]->name, terms[i]->flags, rset_count(terms[i]->rset));
*sort_status = Z_SortResponse_success;
}
rank_class = zebraRankLookup (zh, rank_handler_name);
if (!rank_class)
{
- yaz_log(LOG_WARN, "No such rank handler: %s", rank_handler_name);
+ yaz_log(YLOG_WARN, "No such rank handler: %s", rank_handler_name);
return;
}
rc = rank_class->control;
if (tot>0) {
ratio = cur/tot;
est = (zint)(0.5+zebraSet->hits/ratio);
- logf(LOG_LOG, "Estimating hits (%s) "
+ yaz_log(YLOG_LOG, "Estimating hits (%s) "
"%0.1f->" ZINT_FORMAT
"; %0.1f->" ZINT_FORMAT,
rset->control->desc,
}
rset_close (rfd);
- yaz_log(LOG_DEBUG, ZINT_FORMAT " keys, " ZINT_FORMAT " sysnos, rank",
+ yaz_log(YLOG_DEBUG, ZINT_FORMAT " keys, " ZINT_FORMAT " sysnos, rank",
kno, zebraSet->hits);
for (i = 0; i < numTerms; i++)
{
- yaz_log(LOG_LOG, "term=\"%s\" type=%s count=" ZINT_FORMAT,
+ yaz_log(YLOG_LOG, "term=\"%s\" type=%s count=" ZINT_FORMAT,
terms[i]->name, terms[i]->flags, rset_count(terms[i]->rset));
}
}
-/* $Id: isamb.c,v 1.58 2004-09-09 10:08:05 heikki Exp $
+/* $Id: isamb.c,v 1.59 2004-11-19 10:27:09 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#include <string.h>
#include <yaz/xmalloc.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <isamb.h>
#include <assert.h>
const char *src = 0;
if (memcmp(hbuf, "isamb", 5))
{
- logf(LOG_WARN, "bad isamb header for file %s", fname);
+ yaz_log(YLOG_WARN, "bad isamb header for file %s", fname);
return 0;
}
if (sscanf(hbuf+5, "%d %d %d", &major, &minor, &len) != 3)
{
- logf(LOG_WARN, "bad isamb header for file %s", fname);
+ yaz_log(YLOG_WARN, "bad isamb header for file %s", fname);
return 0;
}
if (major != ISAMB_MAJOR_VERSION)
{
- logf(LOG_WARN, "bad major version for file %s %d, must be %d",
+ yaz_log(YLOG_WARN, "bad major version for file %s %d, must be %d",
fname, major, ISAMB_MAJOR_VERSION);
return 0;
}
pos++;
if (!bf_read (isamb->file[i].bf, pos, 0, 0, hbuf + pos*b_size))
{
- logf(LOG_WARN, "truncated isamb header for "
+ yaz_log(YLOG_WARN, "truncated isamb header for "
"file=%s len=%d pos=%d",
fname, len, pos);
return 0;
b_size = b_size * 4;
}
#if ISAMB_DEBUG
- logf(LOG_WARN, "isamb debug enabled. Things will be slower than usual");
+ yaz_log(YLOG_WARN, "isamb debug enabled. Things will be slower than usual");
#endif
return isamb;
}
{
int i;
for (i=0;isamb->accessed_nodes[i];i++)
- logf(LOG_DEBUG,"isamb_close level leaf-%d: "ZINT_FORMAT" read, "
+ yaz_log(YLOG_DEBUG,"isamb_close level leaf-%d: "ZINT_FORMAT" read, "
ZINT_FORMAT" skipped",
i, isamb->accessed_nodes[i], isamb->skipped_nodes[i]);
- logf(LOG_DEBUG,"isamb_close returned "ZINT_FORMAT" values, "
+ yaz_log(YLOG_DEBUG,"isamb_close returned "ZINT_FORMAT" values, "
"skipped "ZINT_FORMAT,
isamb->skipped_numbers, isamb->returned_numbers);
for (i = 0; i<isamb->no_cat; i++)
yaz_log (b->log_io, "bf_read: open_block");
if (!bf_read (b->file[cat].bf, pos/CAT_MAX, 0, 0, p->buf))
{
- yaz_log (LOG_FATAL, "isamb: read fail for pos=%ld block=%ld",
+ yaz_log (YLOG_FATAL, "isamb: read fail for pos=%ld block=%ld",
(long) pos, (long) pos/CAT_MAX);
abort();
}
p->size = (p->buf[1] + 256 * p->buf[2]) - offset;
if (p->size < 0)
{
- yaz_log (LOG_FATAL, "Bad block size %d in pos=" ZINT_FORMAT "\n",
+ yaz_log (YLOG_FATAL, "Bad block size %d in pos=" ZINT_FORMAT "\n",
p->size, pos);
}
assert (p->size >= 0);
yaz_log (b->log_io, "bf_read: new_block");
if (!bf_read (b->file[cat].bf, p->pos/CAT_MAX, 0, 0, p->buf))
{
- yaz_log (LOG_FATAL, "isamb: read fail for pos=%ld block=%ld",
+ yaz_log (YLOG_FATAL, "isamb: read fail for pos=%ld block=%ld",
(long) p->pos/CAT_MAX, (long) p->pos/CAT_MAX);
abort ();
}
/* if this is not an insertion, it's really bad .. */
if (!*lookahead_mode)
{
- yaz_log (LOG_WARN, "isamb: Inconsistent register (1)");
+ yaz_log (YLOG_WARN, "isamb: Inconsistent register (1)");
assert (*lookahead_mode);
}
}
if (!*lookahead_mode)
{
/* this is append. So a delete is bad */
- yaz_log (LOG_WARN, "isamb: Inconsistent register (2)");
+ yaz_log (YLOG_WARN, "isamb: Inconsistent register (2)");
abort();
}
else if (!half1 && dst > tail_cut)
int i;
if (!pp)
return;
- logf(LOG_DEBUG,"isamb_pp_close lev=%d returned "ZINT_FORMAT" values,"
+ yaz_log(YLOG_DEBUG,"isamb_pp_close lev=%d returned "ZINT_FORMAT" values,"
"skipped "ZINT_FORMAT,
pp->maxlevel, pp->skipped_numbers, pp->returned_numbers);
for (i=pp->maxlevel;i>=0;i--)
if ( pp->skipped_nodes[i] || pp->accessed_nodes[i])
- logf(LOG_DEBUG,"isamb_pp_close level leaf-%d: "
+ yaz_log(YLOG_DEBUG,"isamb_pp_close level leaf-%d: "
ZINT_FORMAT" read, "ZINT_FORMAT" skipped", i,
pp->accessed_nodes[i], pp->skipped_nodes[i]);
pp->isamb->skipped_numbers += pp->skipped_numbers;
const char *src = p->bytes + p->offset;
char *dst = buf;
(*b->method->codec.decode)(p->decodeClientData, &dst, &src);
- (*b->method->log_item)(LOG_DEBUG, buf, prefix_str);
+ (*b->method->log_item)(YLOG_DEBUG, buf, prefix_str);
p->offset = src - (char*) p->bytes;
}
assert(p->offset == p->size);
while (p->offset < p->size)
{
decode_ptr (&src, &item_len);
- (*b->method->log_item)(LOG_DEBUG, src, prefix_str);
+ (*b->method->log_item)(YLOG_DEBUG, src, prefix_str);
src += item_len;
decode_ptr (&src, &sub);
assert(level>=0);
if ( level == 0) {
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_on_right returning true for root");
+ yaz_log(YLOG_DEBUG,"isamb_pp_on_right returning true for root");
#endif
return 1; /* we can never skip the root node */
}
src=p->bytes + p->offset;
decode_ptr(&src, &item_len);
#if ISAMB_DEBUG
- (*pp->isamb->method->codec.log_item)(LOG_DEBUG,untilbuf,"on_leaf: until");
- (*pp->isamb->method->codec.log_item)(LOG_DEBUG,src,"on_leaf: value");
+ (*pp->isamb->method->codec.log_item)(YLOG_DEBUG,untilbuf,"on_leaf: until");
+ (*pp->isamb->method->codec.log_item)(YLOG_DEBUG,src,"on_leaf: value");
#endif
cmp=(*pp->isamb->method->compare_item)(untilbuf,src);
if (cmp<pp->scope) { /* cmp<2 */
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_on_right returning true "
+ yaz_log(YLOG_DEBUG,"isamb_pp_on_right returning true "
"cmp=%d lev=%d ofs=%d",cmp,level,p->offset);
#endif
return 1;
}
else {
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_on_right returning false "
+ yaz_log(YLOG_DEBUG,"isamb_pp_on_right returning false "
"cmp=%d lev=%d ofs=%d",cmp,level,p->offset);
#endif
return 0;
}
else {
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_on_right at tail, looking higher "
+ yaz_log(YLOG_DEBUG,"isamb_pp_on_right at tail, looking higher "
"lev=%d",level);
#endif
return isamb_pp_on_right_node(pp, level, untilbuf);
assert(buf);
if (p->offset == p->size) {
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_read_on_leaf returning 0 on node %d",p->pos);
+ yaz_log(YLOG_DEBUG,"isamb_pp_read_on_leaf returning 0 on node %d",p->pos);
#endif
return 0; /* at end of leaf */
}
(*pp->isamb->method->codec.decode)(p->decodeClientData,&dst, &src);
p->offset = src - (char*) p->bytes;
#if ISAMB_DEBUG
- (*pp->isamb->method->codec.log_item)(LOG_DEBUG, buf, "read_on_leaf returning 1");
+ (*pp->isamb->method->codec.log_item)(YLOG_DEBUG, buf, "read_on_leaf returning 1");
#endif
pp->returned_numbers++;
return 1;
if (cmp <pp->scope){ /* cmp<2 found a good one */
#if ISAMB_DEBUG
if (skips)
- logf(LOG_DEBUG, "isam_pp_fwd_on_leaf skipped %d items",skips);
+ yaz_log(YLOG_DEBUG, "isam_pp_fwd_on_leaf skipped %d items",skips);
#endif
pp->returned_numbers++;
return 1;
const char *src;
zint item_len;
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_climb_level starting "
+ yaz_log(YLOG_DEBUG,"isamb_pp_climb_level starting "
"at level %d node %d ofs=%d sz=%d",
pp->level, p->pos, p->offset, p->size);
#endif
if (pp->level==0)
{
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_climb_level returning 0 at root");
+ yaz_log(YLOG_DEBUG,"isamb_pp_climb_level returning 0 at root");
#endif
return 0;
}
(pp->level)--;
p=pp->block[pp->level];
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_climb_level climbed to level %d node %d ofs=%d",
+ yaz_log(YLOG_DEBUG,"isamb_pp_climb_level climbed to level %d node %d ofs=%d",
pp->level, p->pos, p->offset);
#endif
assert(!p->leaf);
{
/* skip the child we just came from */
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isam_pp_climb_level: skipping lev=%d ofs=%d sz=%d",
+ yaz_log(YLOG_DEBUG,"isam_pp_climb_level: skipping lev=%d ofs=%d sz=%d",
pp->level, p->offset, p->size);
#endif
assert (p->offset < p->size );
zint nxtpos;
#if ISAMB_DEBUG
int skips=0;
- logf(LOG_DEBUG,"isamb_pp_forward_unode starting "
+ yaz_log(YLOG_DEBUG,"isamb_pp_forward_unode starting "
"at level %d node %d ofs=%di sz=%d",
pp->level, p->pos, p->offset, p->size);
#endif
assert(p->offset <= p->size);
if (p->offset == p->size) {
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_forward_unode returning at end "
+ yaz_log(YLOG_DEBUG,"isamb_pp_forward_unode returning at end "
"at level %d node %d ofs=%di sz=%d",
pp->level, p->pos, p->offset, p->size);
#endif
if (cmp<pp->scope) /* cmp<2 */
{
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_forward_unode returning a hit "
+ yaz_log(YLOG_DEBUG,"isamb_pp_forward_unode returning a hit "
"at level %d node %d ofs=%d sz=%d",
pp->level, p->pos, p->offset, p->size);
#endif
#endif
}
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_forward_unode returning at tail "
+ yaz_log(YLOG_DEBUG,"isamb_pp_forward_unode returning at tail "
"at level %d node %d ofs=%d sz=%d skips=%d",
pp->level, p->pos, p->offset, p->size, skips);
#endif
const char *src;
assert(!p->leaf);
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_descend_to_leaf "
+ yaz_log(YLOG_DEBUG,"isamb_pp_descend_to_leaf "
"starting at lev %d node %d ofs=%d lf=%d u=%p",
pp->level, p->pos, p->offset, p->leaf, untilbuf);
#endif
++(pp->accessed_nodes[pp->maxlevel-pp->level]);
++(pp->no_blocks);
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_descend_to_leaf "
+ yaz_log(YLOG_DEBUG,"isamb_pp_descend_to_leaf "
"got lev %d node %d lf=%d",
pp->level, p->pos, p->leaf);
#endif
p->offset=src-(char*)p->bytes;
isamb_pp_descend_to_leaf(pp,pos,untilbuf);
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_descend_to_leaf "
+ yaz_log(YLOG_DEBUG,"isamb_pp_descend_to_leaf "
"returning at lev %d node %d ofs=%d lf=%d",
pp->level, p->pos, p->offset, p->leaf);
#endif
ISAMB_P pos;
#if ISAMB_DEBUG
struct ISAMB_block *p = pp->block[pp->level];
- logf(LOG_DEBUG,"isamb_pp_climb_desc starting "
+ yaz_log(YLOG_DEBUG,"isamb_pp_climb_desc starting "
"at level %d node %d ofs=%d sz=%d",
pp->level, p->pos, p->offset, p->size);
#endif
isamb_pp_descend_to_leaf(pp, pos,untilbuf);
#if ISAMB_DEBUG
p = pp->block[pp->level];
- logf(LOG_DEBUG,"isamb_pp_climb_desc done "
+ yaz_log(YLOG_DEBUG,"isamb_pp_climb_desc done "
"at level %d node %d ofs=%d sz=%d",
pp->level, p->pos, p->offset, p->size);
#endif
#if ISAMB_DEBUG
struct ISAMB_block *p = pp->block[pp->level];
assert(p->leaf);
- logf(LOG_DEBUG,"isamb_pp_forward starting "
+ yaz_log(YLOG_DEBUG,"isamb_pp_forward starting "
"at level %d node %d ofs=%d sz=%d u=%p sc=%d",
pp->level, p->pos, p->offset, p->size,untilbuf, scope);
#endif
if (untilbuf) {
if (isamb_pp_forward_on_leaf( pp, buf, untilbuf)) {
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_forward (f) returning (A) "
+ yaz_log(YLOG_DEBUG,"isamb_pp_forward (f) returning (A) "
"at level %d node %d ofs=%d sz=%d",
pp->level, p->pos, p->offset, p->size);
#endif
}
if (! isamb_pp_climb_desc( pp, untilbuf)) {
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_forward (f) returning notfound (B) "
+ yaz_log(YLOG_DEBUG,"isamb_pp_forward (f) returning notfound (B) "
"at level %d node %d ofs=%d sz=%d",
pp->level, p->pos, p->offset, p->size);
#endif
do{
if (isamb_pp_forward_on_leaf( pp, buf, untilbuf)) {
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_forward (f) returning (C) "
+ yaz_log(YLOG_DEBUG,"isamb_pp_forward (f) returning (C) "
"at level %d node %d ofs=%d sz=%d",
pp->level, p->pos, p->offset, p->size);
#endif
* interface as the old fwd */
if (isamb_pp_read_on_leaf( pp, buf)) {
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_forward (read) returning (D) "
+ yaz_log(YLOG_DEBUG,"isamb_pp_forward (read) returning (D) "
"at level %d node %d ofs=%d sz=%d",
pp->level, p->pos, p->offset, p->size);
#endif
}
if (isamb_pp_find_next_leaf(pp)) {
#if ISAMB_DEBUG
- logf(LOG_DEBUG,"isamb_pp_forward (read) returning (E) "
+ yaz_log(YLOG_DEBUG,"isamb_pp_forward (read) returning (E) "
"at level %d node %d ofs=%d sz=%d",
pp->level, p->pos, p->offset, p->size);
#endif
*total = pp->block[0]->no_items;
*current = (double) pp->returned_numbers;
#if ISAMB_DEBUG
- logf(LOG_LOG, "isamb_pp_pos returning: cur= %0.1f tot=%0.1f rn="
+ yaz_log(YLOG_LOG, "isamb_pp_pos returning: cur= %0.1f tot=%0.1f rn="
ZINT_FORMAT, *current, *total, pp->returned_numbers);
#endif
}
-/* $Id: tstisamb.c,v 1.10 2004-09-09 10:08:06 heikki Exp $
+/* $Id: tstisamb.c,v 1.11 2004-11-19 10:27:09 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#include <string.h>
#include <yaz/xmalloc.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <isamb.h>
#include <assert.h>
{
int x;
memcpy(&x, b, sizeof(int));
- yaz_log(LOG_DEBUG, "%s %d", txt, x);
+ yaz_log(YLOG_DEBUG, "%s %d", txt, x);
}
static void log_pr(const char *txt)
{
- yaz_log(LOG_DEBUG, "%s", txt);
+ yaz_log(YLOG_DEBUG, "%s", txt);
}
int compare_item(const void *a, const void *b)
isamb_pp_forward(pp, &x, &xu);
if (x != xu && xu != x+1)
{
- yaz_log(LOG_WARN, "isamb_pp_forward (1). Got %d (expected %d)",
+ yaz_log(YLOG_WARN, "isamb_pp_forward (1). Got %d (expected %d)",
x, xu);
exit(4);
}
isamb_pp_forward(pp, &x, &xu);
if (x != xu && xu != x+1)
{
- yaz_log(LOG_WARN, "isamb_pp_forward (2). Got %d (expected %d)",
+ yaz_log(YLOG_WARN, "isamb_pp_forward (2). Got %d (expected %d)",
x, xu);
exit(4);
}
memcpy (&x, key_buf, sizeof(int));
if (x != ri.no)
{
- yaz_log(LOG_WARN, "isamb_pp_read. Got %d (expected %d)",
+ yaz_log(YLOG_WARN, "isamb_pp_read. Got %d (expected %d)",
x, ri.no);
exit(3);
}
}
if (ri.no != ri.max)
{
- yaz_log(LOG_WARN, "ri.max != ri.max (%d != %d)", ri.no, ri.max);
+ yaz_log(YLOG_WARN, "ri.max != ri.max (%d != %d)", ri.no, ri.max);
exit(3);
}
isamb_pp_close(pp);
if (isamc_p)
{
- yaz_log(LOG_WARN, "isamb_merge did not return empty list");
+ yaz_log(YLOG_WARN, "isamb_merge did not return empty list");
exit(3);
}
}
ISAMC_M method;
if (argc == 2)
- yaz_log_init_level(LOG_ALL);
+ yaz_log_init_level(YLOG_ALL);
/* setup method (attributes) */
method.compare_item = compare_item;
bfs = bfs_create(0, 0);
if (!bfs)
{
- yaz_log(LOG_WARN, "bfs_create failed");
+ yaz_log(YLOG_WARN, "bfs_create failed");
exit(1);
}
isb = isamb_open (bfs, "isamb", 1, &method, 0);
if (!isb)
{
- yaz_log(LOG_WARN, "isamb_open failed");
+ yaz_log(YLOG_WARN, "isamb_open failed");
exit(2);
}
tst_insert(isb, 1);
-/* $Id: isamc.c,v 1.26 2004-08-06 12:28:23 adam Exp $
+/* $Id: isamc.c,v 1.27 2004-11-19 10:27:09 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#include <string.h>
#include <stdio.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include "isamc-p.h"
static void flush_block (ISAMC is, int cat);
/* determine number of block categories */
if (is->method->debug)
- logf (LOG_LOG, "isc: bsize ifill mfill mblocks");
+ yaz_log (YLOG_LOG, "isc: bsize ifill mfill mblocks");
do
{
if (is->method->debug)
- logf (LOG_LOG, "isc:%6d %6d %6d %6d",
+ yaz_log (YLOG_LOG, "isc:%6d %6d %6d %6d",
filecat[i].bsize, filecat[i].ifill,
filecat[i].mfill, filecat[i].mblocks);
if (max_buf_size < filecat[i].mblocks * filecat[i].bsize)
if (max_buf_size < (1+is->method->max_blocks_mem) * filecat[i].bsize)
max_buf_size = (1+is->method->max_blocks_mem) * filecat[i].bsize;
if (is->method->debug)
- logf (LOG_LOG, "isc: max_buf_size %d", max_buf_size);
+ yaz_log (YLOG_LOG, "isc: max_buf_size %d", max_buf_size);
assert (is->no_files > 0);
is->files = (ISAMC_file) xmalloc (sizeof(*is->files)*is->no_files);
if (is->method->debug)
{
- logf (LOG_LOG, "isc: next forw mid-f prev backw mid-b");
+ yaz_log (YLOG_LOG, "isc: next forw mid-f prev backw mid-b");
for (i = 0; i<is->no_files; i++)
- logf (LOG_LOG, "isc:%8d%8d%8.1f%8d%8d%8.1f",
+ yaz_log (YLOG_LOG, "isc:%8d%8d%8.1f%8d%8d%8.1f",
is->files[i].no_next,
is->files[i].no_forward,
is->files[i].no_forward ?
: 0.0);
}
if (is->method->debug)
- logf (LOG_LOG, "isc: writes reads skipped alloc released remap");
+ yaz_log (YLOG_LOG, "isc: writes reads skipped alloc released remap");
for (i = 0; i<is->no_files; i++)
{
release_fc (is, i);
bf_write (is->files[i].bf, 0, 0, sizeof(ISAMC_head),
&is->files[i].head);
if (is->method->debug)
- logf (LOG_LOG, "isc:%8d%8d%8d%8d%8d%8d",
+ yaz_log (YLOG_LOG, "isc:%8d%8d%8d%8d%8d%8d",
is->files[i].no_writes,
is->files[i].no_reads,
is->files[i].no_skip_writes,
{
++(is->files[cat].no_writes);
if (is->method->debug > 2)
- logf (LOG_LOG, "isc: write_block %d " ZINT_FORMAT, cat, pos);
+ yaz_log (YLOG_LOG, "isc: write_block %d " ZINT_FORMAT, cat, pos);
return bf_write (is->files[cat].bf, pos, 0, 0, src);
}
{
ISAMC_BLOCK_SIZE size = offset + ISAMC_BLOCK_OFFSET_N;
if (is->method->debug > 2)
- logf (LOG_LOG, "isc: write_dblock. size=%d nextpos=" ZINT_FORMAT,
+ yaz_log (YLOG_LOG, "isc: write_dblock. size=%d nextpos=" ZINT_FORMAT,
(int) size, nextpos);
src -= ISAMC_BLOCK_OFFSET_N;
memcpy (src, &nextpos, sizeof(nextpos));
if (!block)
block = alloc_block (is, cat);
if (is->method->debug > 3)
- logf (LOG_LOG, "isc: alloc_block in cat %d: " ZINT_FORMAT, cat, block);
+ yaz_log (YLOG_LOG, "isc: alloc_block in cat %d: " ZINT_FORMAT, cat, block);
return block;
}
void isc_release_block (ISAMC is, int cat, zint pos)
{
if (is->method->debug > 3)
- logf (LOG_LOG, "isc: release_block in cat %d:" ZINT_FORMAT, cat, pos);
+ yaz_log (YLOG_LOG, "isc: release_block in cat %d:" ZINT_FORMAT, cat, pos);
if (is->files[cat].fc_list)
{
int j;
src += sizeof(pp->numKeys);
if (pp->next == pp->pos)
{
- yaz_log(LOG_FATAL|LOG_LOG, "pp->next = " ZINT_FORMAT, pp->next);
- yaz_log(LOG_FATAL|LOG_LOG, "pp->pos = " ZINT_FORMAT, pp->pos);
+ yaz_log(YLOG_FATAL|YLOG_LOG, "pp->next = " ZINT_FORMAT, pp->next);
+ yaz_log(YLOG_FATAL|YLOG_LOG, "pp->pos = " ZINT_FORMAT, pp->pos);
assert (pp->next != pp->pos);
}
pp->offset = src - pp->buf;
assert (pp->offset == ISAMC_BLOCK_OFFSET_1);
if (is->method->debug > 2)
- logf (LOG_LOG, "isc: read_block size=%d %d " ZINT_FORMAT " next="
+ yaz_log (YLOG_LOG, "isc: read_block size=%d %d " ZINT_FORMAT " next="
ZINT_FORMAT, pp->size, pp->cat, pp->pos, pp->next);
}
return pp;
if (pp->next == pp->pos)
{
- yaz_log(LOG_FATAL|LOG_LOG, "pp->next = " ZINT_FORMAT, pp->next);
- yaz_log(LOG_FATAL|LOG_LOG, "pp->pos = " ZINT_FORMAT, pp->pos);
+ yaz_log(YLOG_FATAL|YLOG_LOG, "pp->next = " ZINT_FORMAT, pp->next);
+ yaz_log(YLOG_FATAL|YLOG_LOG, "pp->pos = " ZINT_FORMAT, pp->pos);
assert (pp->next != pp->pos);
}
(*is->method->codec.decode)(pp->decodeClientData, dst, &src);
pp->offset = src - pp->buf;
if (is->method->debug > 2)
- logf (LOG_LOG, "isc: read_block size=%d %d " ZINT_FORMAT " next="
+ yaz_log (YLOG_LOG, "isc: read_block size=%d %d " ZINT_FORMAT " next="
ZINT_FORMAT, pp->size, pp->cat, pp->pos, pp->next);
return 2;
}
-/* $Id: merge.c,v 1.26 2004-08-06 12:55:02 adam Exp $
+/* $Id: merge.c,v 1.27 2004-11-19 10:27:09 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#include <assert.h>
#include <string.h>
#include <stdio.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include "isamc-p.h"
struct isc_merge_block {
if (!*firstpos)
*firstpos = mb[i].block;
if (is->method->debug > 2)
- logf (LOG_LOG, "isc: skip ptr=%d size=%d %d " ZINT_FORMAT,
+ yaz_log (YLOG_LOG, "isc: skip ptr=%d size=%d %d " ZINT_FORMAT,
i, ssize, cat, mb[i].block);
++(is->files[cat].no_skip_writes);
continue;
memcpy (src+sizeof(zint)+sizeof(ssize), numkeys, sizeof(*numkeys));
if (is->method->debug > 2)
- logf (LOG_LOG, "isc: flush ptr=%d numk=" ZINT_FORMAT " size=%d nextpos="
+ yaz_log (YLOG_LOG, "isc: flush ptr=%d numk=" ZINT_FORMAT " size=%d nextpos="
ZINT_FORMAT, i, *numkeys, (int) ssize, mb[i+1].block);
}
else
src = r_buf + mb[i].offset - ISAMC_BLOCK_OFFSET_N;
ssize += ISAMC_BLOCK_OFFSET_N;
if (is->method->debug > 2)
- logf (LOG_LOG, "isc: flush ptr=%d size=%d nextpos=" ZINT_FORMAT,
+ yaz_log (YLOG_LOG, "isc: flush ptr=%d size=%d nextpos=" ZINT_FORMAT,
i, (int) ssize, mb[i+1].block);
}
memcpy (src, &mb[i+1].block, sizeof(zint));
cat = pp->cat;
if (debug > 1)
- logf (LOG_LOG, "isc: isc_merge begin %d " ZINT_FORMAT, cat, pp->pos);
+ yaz_log (YLOG_LOG, "isc: isc_merge begin %d " ZINT_FORMAT, cat, pp->pos);
/* read first item from i */
i_item_ptr = i_item;
the original (if any)
*/
if (debug > 3)
- logf (LOG_LOG, "isc: release A");
+ yaz_log (YLOG_LOG, "isc: release A");
if (mb[ptr].block)
isc_release_block (is, pp->cat, mb[ptr].block);
mb[ptr].block = pp->pos;
mb[ptr].dirty = last_dirty;
mb[ptr].offset = r_offset;
if (debug > 3)
- logf (LOG_LOG, "isc: bound ptr=%d,offset=%d",
+ yaz_log (YLOG_LOG, "isc: bound ptr=%d,offset=%d",
ptr, r_offset);
if (cat==is->max_cat && ptr >= is->method->max_blocks_mem)
{
except 1 will be flushed.
*/
if (debug > 2)
- logf (LOG_LOG, "isc: flush A %d sections", ptr);
+ yaz_log (YLOG_LOG, "isc: flush A %d sections", ptr);
flush_blocks (is, mb, ptr-1, r_buf, &firstpos, cat,
0, &pp->numKeys);
mb[0].block = mb[ptr-1].block;
{
if (!i_mode) /* delete item which isn't there? */
{
- logf (LOG_FATAL, "Inconsistent register at offset %d",
+ yaz_log (YLOG_FATAL, "Inconsistent register at offset %d",
r_offset);
abort ();
}
if (border < new_offset && border >= r_offset)
{
if (debug > 2)
- logf (LOG_LOG, "isc: border %d " ZINT_FORMAT,
+ yaz_log (YLOG_LOG, "isc: border %d " ZINT_FORMAT,
ptr, border);
/* Max size of current block category reached ...
make new virtual block entry */
surely not the last one(s).
*/
if (debug > 2)
- logf (LOG_LOG, "isc: flush B %d sections", ptr-1);
+ yaz_log (YLOG_LOG, "isc: flush B %d sections", ptr-1);
flush_blocks (is, mb, ptr-1, r_buf, &firstpos, cat,
0, &pp->numKeys);
mb[0].block = mb[ptr-1].block;
int border = is->method->filecat[cat].ifill -
ISAMC_BLOCK_OFFSET_1 + mb[j].offset;
if (debug > 3)
- logf (LOG_LOG, "isc: remap %d border=%d", i, border);
+ yaz_log (YLOG_LOG, "isc: remap %d border=%d", i, border);
if (mb[i+1].offset > border && mb[i].offset <= border)
{
if (debug > 3)
- logf (LOG_LOG, "isc: to %d %d", j, mb[i].offset);
+ yaz_log (YLOG_LOG, "isc: to %d %d", j, mb[i].offset);
mb[++j].dirty = 1;
mb[j].block = 0;
mb[j].offset = mb[i].offset;
}
}
if (debug > 2)
- logf (LOG_LOG, "isc: remap from %d to %d sections to cat %d",
+ yaz_log (YLOG_LOG, "isc: remap from %d to %d sections to cat %d",
ptr, j, cat);
ptr = j;
border = get_border (is, mb, ptr, cat, firstpos);
if (debug > 3)
- logf (LOG_LOG, "isc: border=" ZINT_FORMAT " r_offset=%d",
+ yaz_log (YLOG_LOG, "isc: border=" ZINT_FORMAT " r_offset=%d",
border, r_offset);
}
}
if (cat == pp->cat && mb[ptr].block)
{
if (debug > 3)
- logf (LOG_LOG, "isc: release C");
+ yaz_log (YLOG_LOG, "isc: release C");
isc_release_block (is, pp->cat, mb[ptr].block);
mb[ptr].block = 0;
if (ptr > 0)
}
if (debug > 2)
- logf (LOG_LOG, "isc: flush C, %d sections", ptr);
+ yaz_log (YLOG_LOG, "isc: flush C, %d sections", ptr);
if (firstpos)
{
if (numKeys != isc_pp_num (pp))
{
if (debug > 2)
- logf (LOG_LOG, "isc: patch num keys firstpos=" ZINT_FORMAT " num=" ZINT_FORMAT,
+ yaz_log (YLOG_LOG, "isc: patch num keys firstpos=" ZINT_FORMAT " num=" ZINT_FORMAT,
firstpos, numKeys);
bf_write (is->files[cat].bf, firstpos, ISAMC_BLOCK_OFFSET_N,
sizeof(numKeys), &numKeys);
if (!firstpos)
cat = 0;
if (debug > 1)
- logf (LOG_LOG, "isc: isc_merge return %d " ZINT_FORMAT, cat, firstpos);
+ yaz_log (YLOG_LOG, "isc: isc_merge return %d " ZINT_FORMAT, cat, firstpos);
isc_pp_close (pp);
return cat + firstpos * 8;
}
-/* $Id: isamg.c,v 1.3 2003-04-02 19:01:47 adam Exp $
+/* $Id: isamg.c,v 1.4 2004-11-19 10:27:10 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
writeflag, key_isamd_m (res,&isamd_m)
}
else {
- logf (LOG_FATAL, "isamg: Unknown isam type: %s", isam_type_name);
+ yaz_log (YLOG_FATAL, "isamg: Unknown isam type: %s", isam_type_name);
exit(1);
}
} /* open */
/*
* $Log: isamg.c,v $
- * Revision 1.3 2003-04-02 19:01:47 adam
+ * Revision 1.4 2004-11-19 10:27:10 heikki
+ * Using the new ylog.h everywhere, and fixing what that breaks!
+ *
+ * Revision 1.3 2003/04/02 19:01:47 adam
* Remove // comment
*
* Revision 1.2 2002/08/02 19:26:56 adam
-/* $Id: isams.c,v 1.7 2004-08-06 13:36:23 adam Exp $
+/* $Id: isams.c,v 1.8 2004-11-19 10:27:11 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#include <string.h>
#include <stdio.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <isams.h>
typedef struct {
if (is->head.last_offset > is->block_size)
{
if (is->debug > 2)
- logf (LOG_LOG, "first_block=%d", first_block);
+ yaz_log (YLOG_LOG, "first_block=%d", first_block);
bf_write(is->bf, is->head.last_block, 0, 0, is->merge_buf);
(is->head.last_block)++;
is->head.last_offset -= is->block_size;
ISAMS_PP pp = (ISAMS_PP) xmalloc (sizeof(*pp));
if (is->debug > 1)
- logf (LOG_LOG, "isams: isams_pp_open pos=%ld", (long) pos);
+ yaz_log (YLOG_LOG, "isams: isams_pp_open pos=%ld", (long) pos);
pp->is = is;
pp->decodeClientData = (*is->method->codec.start)();
pp->numKeys = 0;
pp->block_no = (int) (pos/is->block_size);
pp->block_offset = (int) (pos - pp->block_no * is->block_size);
if (is->debug)
- logf (LOG_LOG, "isams: isams_pp_open off=%d no=%d",
+ yaz_log (YLOG_LOG, "isams: isams_pp_open off=%d no=%d",
pp->block_offset, pp->block_no);
if (pos)
{
bf_read (is->bf, pp->block_no+1, 0, 0, pp->buf + is->block_size);
memcpy(&pp->numKeys, pp->buf + pp->block_offset, sizeof(int));
if (is->debug)
- logf (LOG_LOG, "isams: isams_pp_open numKeys=%d", pp->numKeys);
+ yaz_log (YLOG_LOG, "isams: isams_pp_open numKeys=%d", pp->numKeys);
pp->block_offset += sizeof(int);
}
return pp;
#include <yaz/yaz-util.h>
#include <yaz/proto.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <yaz/cql.h>
#include <yaz/pquery.h>
void init (void) {
nmem_init ();
yaz_log_init_prefix ("ZebraPerl");
- yaz_log (LOG_LOG, "Zebra API initialized");
+ yaz_log (YLOG_LOG, "Zebra API initialized");
}
void DESTROY (void) {
nmem_exit ();
- yaz_log (LOG_LOG, "Zebra API destroyed");
+ yaz_log (YLOG_LOG, "Zebra API destroyed");
}
/* Logging facilities from yaz */
void logMsg (int level, const char *message) {
- logf(level, "%s", message);
+ yaz_log(level, "%s", message);
}
/* debug tool for data1... maybe should be moved to data1.
} else {
schema = oid_getvalbyname (a_schema);
if (schema == VAL_NONE) {
- logf(LOG_WARN,"unknown schema '%s'",a_schema);
+ yaz_log(YLOG_WARN,"unknown schema '%s'",a_schema);
}
}
} else {
recordsyntax = oid_getvalbyname (a_format);
if (recordsyntax == VAL_NONE) {
- logf(LOG_WARN,"unknown record syntax '%s', using SUTRS",a_schema);
+ yaz_log(YLOG_WARN,"unknown record syntax '%s', using SUTRS",a_schema);
recordsyntax = VAL_SUTRS;
}
}
if (cql_transform_buf(ct, cql_parser_result(cp), res, len)) {
status = cql_transform_error(ct, &addinfo);
- logf (LOG_WARN,"Transform error %d %s\n", status, addinfo ? addinfo : "");
+ yaz_log (YLOG_WARN,"Transform error %d %s\n", status, addinfo ? addinfo : "");
cql_parser_destroy(cp);
return (status);
}
ZebraScanEntry *entries;
int i, class;
- logf(LOG_DEBUG,
+ yaz_log(YLOG_DEBUG,
"scan req: pos:%d, num:%d, partial:%d",
so->position, so->num_entries, so->is_partial);
zapt = p_query_scan (stream, PROTO_Z3950, &attrsetid, pqf_query);
oidname = yaz_z3950oid_to_str (attrsetid, &class);
- logf (LOG_DEBUG, "Attributreset: %s", oidname);
+ yaz_log (YLOG_DEBUG, "Attributreset: %s", oidname);
attributeset = oid_getvalbyname(oidname);
if (!zapt) {
- logf (LOG_WARN, "bad query %s\n", pqf_query);
+ yaz_log (YLOG_WARN, "bad query %s\n", pqf_query);
odr_reset (stream);
return;
}
&so->position, &so->num_entries,
(ZebraScanEntry **) &so->entries, &so->is_partial);
- logf(LOG_DEBUG,
+ yaz_log(YLOG_DEBUG,
"scan res: pos:%d, num:%d, partial:%d",
so->position, so->num_entries, so->is_partial);
}
-/* $Id: danbibr.c,v 1.6 2004-09-28 10:15:03 adam Exp $
+/* $Id: danbibr.c,v 1.7 2004-11-19 10:27:12 heikki Exp $
Copyright (C) 2004
Index Data Aps
#include <stdio.h>
#include <stdlib.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <idzebra/recgrs.h>
-/* $Id: marcread.c,v 1.26 2004-09-28 10:15:03 adam Exp $
+/* $Id: marcread.c,v 1.27 2004-11-19 10:27:12 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#include <ctype.h>
#include <assert.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <yaz/yaz-util.h>
#include <yaz/marcdisp.h>
#include <idzebra/recgrs.h>
record_length = atoi_n (buf, 5);
if (record_length < 25)
{
- logf (LOG_WARN, "MARC record length < 25, is %d", record_length);
+ yaz_log (YLOG_WARN, "MARC record length < 25, is %d", record_length);
return NULL;
}
/* read remaining part - attempt to read one byte furhter... */
read_bytes = (*p->readf)(p->fh, buf+5, record_length-4);
if (read_bytes < record_length-5)
{
- logf (LOG_WARN, "Couldn't read whole MARC record");
+ yaz_log (YLOG_WARN, "Couldn't read whole MARC record");
return NULL;
}
if (read_bytes == record_length - 4)
res_root = data1_mk_root (p->dh, p->mem, absynName);
if (!res_root)
{
- yaz_log (LOG_WARN, "cannot read MARC without an abstract syntax");
+ yaz_log (YLOG_WARN, "cannot read MARC without an abstract syntax");
return 0;
}
if (marc_xml)
wrbuf_puts(buf, " ");
}
#if MARCOMP_DEBUG
- logf(LOG_LOG, "cat_inline_subfield(): add subfield $%s", found->name);
+ yaz_log(YLOG_LOG, "cat_inline_subfield(): add subfield $%s", found->name);
#endif
pisf = found->next;
}
int i;
if ((i=inline_parse(pif, psubf->u.tag.tag, get_data(psubf, &len)))<0)
{
- logf(LOG_WARN, "inline subfield ($%s): parse error",
+ yaz_log(YLOG_WARN, "inline subfield ($%s): parse error",
psubf->u.tag.tag);
inline_destroy_field(pif);
return;
}
else
{
- logf(LOG_WARN, "In-line field %s missed -- indicators do not match", pif->name);
+ yaz_log(YLOG_WARN, "In-line field %s missed -- indicators do not match", pif->name);
}
}
}
inline_destroy_field(pif);
}
#if MARCOMP_DEBUG
- logf(LOG_LOG, "cat_inline_field(): got buffer {%s}", buf);
+ yaz_log(YLOG_LOG, "cat_inline_field(): got buffer {%s}", buf);
#endif
}
wrbuf_puts(buf, " ");
}
#if MARCOMP_DEBUG
- logf(LOG_LOG, "cat_subfield(): add subfield $%s", found->u.tag.tag);
+ yaz_log(YLOG_LOG, "cat_subfield(): add subfield $%s", found->u.tag.tag);
#endif
subfield = found->next;
}
wrbuf_puts(buf, "");
}
#if MARCOMP_DEBUG
- logf(LOG_LOG, "cat_field(): got buffer {%s}", buf);
+ yaz_log(YLOG_LOG, "cat_field(): got buffer {%s}", buf);
#endif
return field->next;
}
))
{
#if MARCOMP_DEBUG
- logf(LOG_WARN, "Field %s missed -- does not match indicators", field->u.tag.tag);
+ yaz_log(YLOG_WARN, "Field %s missed -- does not match indicators", field->u.tag.tag);
#endif
return field->next;
}
cat_subfield(pf->list, buf, subfield);
#if MARCOMP_DEBUG
- logf(LOG_LOG, "cat_field(): got buffer {%s}", buf);
+ yaz_log(YLOG_LOG, "cat_field(): got buffer {%s}", buf);
#endif
return field->next;
}
buf = wrbuf_alloc();
#if MARCOMP_DEBUG
- logf(LOG_LOG, "parse_data1_tree(): statement -{%s}", mc_stmnt);
+ yaz_log(YLOG_LOG, "parse_data1_tree(): statement -{%s}", mc_stmnt);
#endif
if (!yaz_matchstr(pf->name, "ldr"))
{
data1_node *new;
#if MARCOMP_DEBUG
- logf(LOG_LOG,"parse_data1_tree(): try LEADER from {%d} to {%d} positions",
+ yaz_log(YLOG_LOG,"parse_data1_tree(): try LEADER from {%d} to {%d} positions",
pf->interval.start, pf->interval.end);
#endif
new = data1_mk_tag_n(p->dh, p->mem, mc_stmnt, strlen(mc_stmnt), 0, top);
data1_node *new;
char *pb;
#if MARCOMP_DEBUG
- logf(LOG_LOG, "parse_data1_tree(): try field {%s}", field->u.tag.tag);
+ yaz_log(YLOG_LOG, "parse_data1_tree(): try field {%s}", field->u.tag.tag);
#endif
wrbuf_rewind(buf);
wrbuf_puts(buf, "");
-/* $Id: recctrl.c,v 1.12 2004-09-30 08:30:05 adam Exp $
+/* $Id: recctrl.c,v 1.13 2004-11-19 10:27:12 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
if (module_path)
{
DIR *dir = opendir(module_path);
- yaz_log(LOG_LOG, "searching filters in %s", module_path);
+ yaz_log(YLOG_LOG, "searching filters in %s", module_path);
if (dir)
{
struct dirent *de;
mod_p = dlopen(fname, RTLD_NOW|RTLD_GLOBAL);
if (mod_p && (fl = dlsym(mod_p, "idzebra_filter")))
{
- yaz_log(LOG_LOG, "Loaded filter module %s", fname);
+ yaz_log(YLOG_LOG, "Loaded filter module %s", fname);
recTypeClass_add(&rts, fl, nmem, mod_p);
}
else if (mod_p)
{
const char *err = dlerror();
- yaz_log(LOG_WARN, "dlsym failed %s %s",
+ yaz_log(YLOG_WARN, "dlsym failed %s %s",
fname, err ? err : "none");
dlclose(mod_p);
}
else
{
const char *err = dlerror();
- yaz_log(LOG_WARN, "dlopen failed %s %s",
+ yaz_log(YLOG_WARN, "dlopen failed %s %s",
fname, err ? err : "none");
}
r->next = *rts;
*rts = r;
- yaz_log(LOG_LOG, "Adding filter %s", (*rt)->name);
+ yaz_log(YLOG_LOG, "Adding filter %s", (*rt)->name);
r->module_handle = module_handle;
module_handle = 0; /* so that we only store module_handle once */
r->recType = *rt;
-/* $Id: recgrs.c,v 1.92 2004-10-12 18:21:35 quinn Exp $
+/* $Id: recgrs.c,v 1.93 2004-11-19 10:27:12 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#include <dlfcn.h>
#endif
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <yaz/oid.h>
#include <d1_absyn.h>
if (p->which == XPATH_PREDICATE_RELATION) {
if (p->u.relation.name[0]) {
if (*p->u.relation.name != '@') {
- yaz_log(LOG_WARN,
+ yaz_log(YLOG_WARN,
" Only attributes (@) are supported in xelm xpath predicates");
- yaz_log(LOG_WARN, "predicate %s ignored", p->u.relation.name);
+ yaz_log(YLOG_WARN, "predicate %s ignored", p->u.relation.name);
return (1);
}
attname = p->u.relation.name + 1;
res = 0;
/* looking for the attribute with a specified name */
for (attr = n->u.tag.attributes; attr; attr = attr->next) {
- yaz_log(LOG_DEBUG," - attribute %s <-> %s", attname, attr->name );
+ yaz_log(YLOG_DEBUG," - attribute %s <-> %s", attname, attr->name );
if (!strcmp(attr->name, attname)) {
if (p->u.relation.op[0]) {
if (*p->u.relation.op != '=') {
- yaz_log(LOG_WARN,
+ yaz_log(YLOG_WARN,
"Only '=' relation is supported (%s)",p->u.relation.op);
- yaz_log(LOG_WARN, "predicate %s ignored", p->u.relation.name);
+ yaz_log(YLOG_WARN, "predicate %s ignored", p->u.relation.name);
res = 1; break;
} else {
- yaz_log(LOG_DEBUG," - value %s <-> %s",
+ yaz_log(YLOG_DEBUG," - value %s <-> %s",
p->u.relation.value, attr->value );
if (!strcmp(attr->value, p->u.relation.value)) {
res = 1; break;
}
}
}
- yaz_log(LOG_DEBUG, "return %d", res);
+ yaz_log(YLOG_DEBUG, "return %d", res);
return res;
} else {
return 1;
return (d1_check_xpath_predicate(n, p->u.boolean.left)
|| d1_check_xpath_predicate(n, p->u.boolean.right));
} else {
- yaz_log(LOG_WARN, "Unknown boolean relation %s, ignored",p->u.boolean.op);
+ yaz_log(YLOG_WARN, "Unknown boolean relation %s, ignored",p->u.boolean.op);
return 1;
}
}
int ok = 0;
sprintf (pexpr, "%s\n", tagpath);
- yaz_log(LOG_DEBUG,"Checking tagpath %s",tagpath);
+ yaz_log(YLOG_DEBUG,"Checking tagpath %s",tagpath);
while (xpe)
{
struct DFA_state **dfaar = xpe->dfa->states;
} while (i >= 0);
}
if (ok)
- yaz_log(LOG_DEBUG," xpath match %s",xpe->xpath_expr);
+ yaz_log(YLOG_DEBUG," xpath match %s",xpe->xpath_expr);
else
- yaz_log(LOG_DEBUG," xpath no match %s",xpe->xpath_expr);
+ yaz_log(YLOG_DEBUG," xpath no match %s",xpe->xpath_expr);
pexpr--;
if (ok) {
backwards trough xpath location steps ... */
for (i=xpe->xpath_len - 1; i>0; i--) {
- yaz_log(LOG_DEBUG,"Checking step %d: %s on tag %s",
+ yaz_log(YLOG_DEBUG,"Checking step %d: %s on tag %s",
i,xp[i].part,nn->u.tag.tag);
if (!d1_check_xpath_predicate(nn, xp[i].predicate)) {
- yaz_log(LOG_DEBUG," Predicates didn't match");
+ yaz_log(YLOG_DEBUG," Predicates didn't match");
ok = 0;
break;
}
xfree(pexpr);
if (ok) {
- yaz_log(LOG_DEBUG,"Got it");
+ yaz_log(YLOG_DEBUG,"Got it");
return xpe->termlists;
} else {
return NULL;
data1_termlist *tl;
int xpdone = 0;
- yaz_log(LOG_DEBUG, "index_xpath level=%d use=%d", level, use);
+ yaz_log(YLOG_DEBUG, "index_xpath level=%d use=%d", level, use);
if ((!n->root->u.root.absyn) ||
(n->root->u.root.absyn->enable_xpath_indexing)) {
termlist_only = 0;
if (!(eset = data1_getesetbyname(dh, n->u.root.absyn,
c->u.simple->u.generic)))
{
- yaz_log(LOG_LOG, "Unknown esetname '%s'", c->u.simple->u.generic);
+ yaz_log(YLOG_LOG, "Unknown esetname '%s'", c->u.simple->u.generic);
return 25; /* invalid esetname */
}
- yaz_log(LOG_DEBUG, "Esetname '%s' in simple compspec",
+ yaz_log(YLOG_DEBUG, "Esetname '%s' in simple compspec",
c->u.simple->u.generic);
espec = eset->spec;
break;
data1_getesetbyname(dh, n->u.root.absyn,
p->u.elementSetName)))
{
- yaz_log(LOG_LOG, "Unknown esetname '%s'",
+ yaz_log(YLOG_LOG, "Unknown esetname '%s'",
p->u.elementSetName);
return 25; /* invalid esetname */
}
- yaz_log(LOG_DEBUG, "Esetname '%s' in complex compspec",
+ yaz_log(YLOG_DEBUG, "Esetname '%s' in complex compspec",
p->u.elementSetName);
espec = eset->spec;
break;
case Z_ElementSpec_externalSpec:
if (p->u.externalSpec->which == Z_External_espec1)
{
- yaz_log(LOG_DEBUG, "Got Espec-1");
+ yaz_log(YLOG_DEBUG, "Got Espec-1");
espec = p->u.externalSpec-> u.espec1;
}
else
{
- yaz_log(LOG_LOG, "Unknown external espec.");
+ yaz_log(YLOG_LOG, "Unknown external espec.");
return 25; /* bad. what is proper diagnostic? */
}
break;
}
if (espec)
{
- yaz_log(LOG_DEBUG, "Element: Espec-1 match");
+ yaz_log(YLOG_DEBUG, "Element: Espec-1 match");
return data1_doespec1(dh, n, espec);
}
else
{
- yaz_log(LOG_DEBUG, "Element: all match");
+ yaz_log(YLOG_DEBUG, "Element: all match");
return -1;
}
}
gri.dh = p->dh;
gri.clientData = clientData;
- yaz_log(LOG_DEBUG, "grs_retrieve");
+ yaz_log(YLOG_DEBUG, "grs_retrieve");
node = (*grs_read)(&gri);
if (!node)
{
#endif
top = data1_get_root_tag (p->dh, node);
- yaz_log(LOG_DEBUG, "grs_retrieve: size");
+ yaz_log(YLOG_DEBUG, "grs_retrieve: size");
tagname = data1_systag_lookup(node->u.root.absyn, "size", "size");
if (tagname &&
(dnew = data1_mk_tag_data_wd(p->dh, top, tagname, mem)))
if (tagname && p->score >= 0 &&
(dnew = data1_mk_tag_data_wd(p->dh, top, tagname, mem)))
{
- yaz_log(LOG_DEBUG, "grs_retrieve: %s", tagname);
+ yaz_log(YLOG_DEBUG, "grs_retrieve: %s", tagname);
dnew->u.data.what = DATA1I_num;
dnew->u.data.data = dnew->lbuf;
sprintf(dnew->u.data.data, "%d", p->score);
if (tagname && p->localno > 0 &&
(dnew = data1_mk_tag_data_wd(p->dh, top, tagname, mem)))
{
- yaz_log(LOG_DEBUG, "grs_retrieve: %s", tagname);
+ yaz_log(YLOG_DEBUG, "grs_retrieve: %s", tagname);
dnew->u.data.what = DATA1I_text;
dnew->u.data.data = dnew->lbuf;
*/
if (requested_schema != VAL_NONE)
{
- yaz_log(LOG_DEBUG, "grs_retrieve: schema mapping");
+ yaz_log(YLOG_DEBUG, "grs_retrieve: schema mapping");
for (map = node->u.root.absyn->maptabs; map; map = map->next)
{
if (map->target_absyn_ref == requested_schema)
* the overlap of schema and formatting which is inherent in the MARC
* family)
*/
- yaz_log(LOG_DEBUG, "grs_retrieve: syntax mapping");
+ yaz_log(YLOG_DEBUG, "grs_retrieve: syntax mapping");
if (node->u.root.absyn)
for (map = node->u.root.absyn->maptabs; map; map = map->next)
{
break;
}
}
- yaz_log(LOG_DEBUG, "grs_retrieve: schemaIdentifier");
+ yaz_log(YLOG_DEBUG, "grs_retrieve: schemaIdentifier");
if (node->u.root.absyn &&
node->u.root.absyn->reference != VAL_NONE &&
p->input_format == VAL_GRS1)
}
}
- yaz_log(LOG_DEBUG, "grs_retrieve: element spec");
+ yaz_log(YLOG_DEBUG, "grs_retrieve: element spec");
if (p->comp && (res = process_comp(p->dh, node, p->comp)) > 0)
{
p->diagnostic = res;
#if 0
data1_pr_tree (p->dh, node, stdout);
#endif
- yaz_log(LOG_DEBUG, "grs_retrieve: transfer syntax mapping");
+ yaz_log(YLOG_DEBUG, "grs_retrieve: transfer syntax mapping");
switch (p->output_format = (p->input_format != VAL_NONE ?
p->input_format : VAL_SUTRS))
{
-/* $Id: rectext.c,v 1.21 2004-09-28 10:15:03 adam Exp $
+/* $Id: rectext.c,v 1.22 2004-11-19 10:27:13 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
struct buf_info *fi = buf_open (p);
#if 0
- yaz_log(LOG_LOG, "text_extract off=%ld",
+ yaz_log(YLOG_LOG, "text_extract off=%ld",
(long) (*fi->p->tellf)(fi->p->fh));
#endif
xfree(tinfo->sep);
-/* $Id: regxread.c,v 1.54 2004-09-28 10:15:03 adam Exp $
+/* $Id: regxread.c,v 1.55 2004-11-19 10:27:13 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
cmd[i] = '\0';
if (i == 0)
{
- logf (LOG_WARN, "bad character %d %c", *cp, *cp);
+ yaz_log (YLOG_WARN, "bad character %d %c", *cp, *cp);
cp++;
while (*cp && *cp != ' ' && *cp != '\t' &&
*cp != '\n' && *cp != '\r')
return REGX_INIT;
else
{
- logf (LOG_WARN, "bad command %s", cmd);
+ yaz_log (YLOG_WARN, "bad command %s", cmd);
return 0;
}
}
{
xfree (*ap);
*ap = NULL;
- logf (LOG_WARN, "regular expression error '%.*s'", s-s0, s0);
+ yaz_log (YLOG_WARN, "regular expression error '%.*s'", s-s0, s0);
return -1;
}
if (debug_dfa_tran)
s++;
break;
case REGX_BEGIN:
- logf (LOG_WARN, "cannot use BEGIN here");
+ yaz_log (YLOG_WARN, "cannot use BEGIN here");
continue;
case REGX_INIT:
- logf (LOG_WARN, "cannot use INIT here");
+ yaz_log (YLOG_WARN, "cannot use INIT here");
continue;
case REGX_END:
*ap = (struct lexRuleAction *) xmalloc (sizeof(**ap));
tok = readParseToken (&s, &len);
if (tok != REGX_CODE)
{
- logf (LOG_WARN, "missing name after CONTEXT keyword");
+ yaz_log (YLOG_WARN, "missing name after CONTEXT keyword");
return 0;
}
if (len > 31)
break;
case REGX_PATTERN:
#if REGX_DEBUG
- logf (LOG_LOG, "rule %d %s", spec->context->ruleNo, s);
+ yaz_log (YLOG_LOG, "rule %d %s", spec->context->ruleNo, s);
#endif
r = dfa_parse (spec->context->dfa, &s);
if (r)
{
- logf (LOG_WARN, "regular expression error. r=%d", r);
+ yaz_log (YLOG_WARN, "regular expression error. r=%d", r);
return -1;
}
if (*s != '/')
{
- logf (LOG_WARN, "expects / at end of pattern. got %c", *s);
+ yaz_log (YLOG_WARN, "expects / at end of pattern. got %c", *s);
return -1;
}
s++;
}
if (!spec_inf)
{
- logf (LOG_ERRNO|LOG_WARN, "cannot read spec file %s", spec->name);
+ yaz_log (YLOG_ERRNO|YLOG_WARN, "cannot read spec file %s", spec->name);
return -1;
}
- logf (LOG_LOG, "reading regx filter %s", fname);
+ yaz_log (YLOG_LOG, "reading regx filter %s", fname);
#if HAVE_TCL_H
if (spec->tcl_interp)
- logf (LOG_LOG, "Tcl enabled");
+ yaz_log (YLOG_LOG, "Tcl enabled");
#endif
#if 0
return ;
#if REGX_DEBUG
if (elen > 80)
- logf (LOG_LOG, "data(%d bytes) %.40s ... %.*s", elen,
+ yaz_log (YLOG_LOG, "data(%d bytes) %.40s ... %.*s", elen,
ebuf, 40, ebuf + elen-40);
else if (elen == 1 && ebuf[0] == '\n')
{
- logf (LOG_LOG, "data(new line)");
+ yaz_log (YLOG_LOG, "data(new line)");
}
else if (elen > 0)
- logf (LOG_LOG, "data(%d bytes) %.*s", elen, elen, ebuf);
+ yaz_log (YLOG_LOG, "data(%d bytes) %.*s", elen, elen, ebuf);
else
- logf (LOG_LOG, "data(%d bytes)", elen);
+ yaz_log (YLOG_LOG, "data(%d bytes)", elen);
#endif
if (spec->d1_level <= 1)
if (spec->d1_level == 0)
{
- logf (LOG_WARN, "in variant begin. No record type defined");
+ yaz_log (YLOG_WARN, "in variant begin. No record type defined");
return ;
}
if (class_len >= DATA1_MAX_SYMBOL)
ttype[type_len] = '\0';
#if REGX_DEBUG
- logf (LOG_LOG, "variant begin(%s,%s,%d)", tclass, ttype,
+ yaz_log (YLOG_LOG, "variant begin(%s,%s,%d)", tclass, ttype,
spec->d1_level);
#endif
}
#if REGX_DEBUG
- logf (LOG_LOG, "variant node(%d)", spec->d1_level);
+ yaz_log (YLOG_LOG, "variant node(%d)", spec->d1_level);
#endif
parent = spec->d1_stack[spec->d1_level-1];
res = data1_mk_node2 (spec->dh, spec->m, DATA1N_variant, parent);
{
if (spec->d1_level == 0)
{
- logf (LOG_WARN, "in element begin. No record type defined");
+ yaz_log (YLOG_WARN, "in element begin. No record type defined");
return ;
}
tagStrip (&tag, &len);
tagDataRelease (spec);
#if REGX_DEBUG
- logf (LOG_LOG, "begin tag(%.*s, %d)", len, tag, spec->d1_level);
+ yaz_log (YLOG_LOG, "begin tag(%.*s, %d)", len, tag, spec->d1_level);
#endif
spec->d1_stack[spec->d1_level] = data1_mk_tag_n (
break;
}
#if REGX_DEBUG
- logf (LOG_LOG, "end tag(%d)", spec->d1_level);
+ yaz_log (YLOG_LOG, "end tag(%d)", spec->d1_level);
#endif
}
data1_node *res;
#if REGX_DEBUG
- logf (LOG_LOG, "begin record %s", absynName);
+ yaz_log (YLOG_LOG, "begin record %s", absynName);
#endif
res = data1_mk_root (spec->dh, spec->m, absynName);
{
struct lexContext *lc = spec->context;
#if REGX_DEBUG
- logf (LOG_LOG, "begin context %s",argv[2]);
+ yaz_log (YLOG_LOG, "begin context %s",argv[2]);
#endif
while (lc && strcmp (argv[2], lc->name))
lc = lc->next;
spec->context_stack[++(spec->context_stack_top)] = lc;
}
else
- logf (LOG_WARN, "unknown context %s", argv[2]);
+ yaz_log (YLOG_WARN, "unknown context %s", argv[2]);
}
else
return TCL_ERROR;
(spec->d1_level)--;
}
#if REGX_DEBUG
- logf (LOG_LOG, "end record");
+ yaz_log (YLOG_LOG, "end record");
#endif
spec->stop_flag = 1;
}
if (spec->d1_level <= 1)
{
#if REGX_DEBUG
- logf (LOG_LOG, "end element end records");
+ yaz_log (YLOG_LOG, "end element end records");
#endif
spec->stop_flag = 1;
}
else if (!strcmp (argv[1], "context"))
{
#if REGX_DEBUG
- logf (LOG_LOG, "end context");
+ yaz_log (YLOG_LOG, "end context");
#endif
if (spec->context_stack_top)
(spec->context_stack_top)--;
if (ret != TCL_OK)
{
const char *err = Tcl_GetVar(spec->tcl_interp, "errorInfo", 0);
- logf(LOG_FATAL, "Tcl error, line=%d, \"%s\"\n%s",
+ yaz_log(YLOG_FATAL, "Tcl error, line=%d, \"%s\"\n%s",
spec->tcl_interp->errorLine,
spec->tcl_interp->result,
err ? err : "[NO ERRORINFO]");
r = execTok (spec, &s, &cmd_str, &cmd_len);
if (r < 2)
{
- logf (LOG_WARN, "missing keyword after 'begin'");
+ yaz_log (YLOG_WARN, "missing keyword after 'begin'");
continue;
}
p = regxStrz (cmd_str, cmd_len, ptmp);
memcpy (absynName, cmd_str, cmd_len);
absynName[cmd_len] = '\0';
#if REGX_DEBUG
- logf (LOG_LOG, "begin record %s", absynName);
+ yaz_log (YLOG_LOG, "begin record %s", absynName);
#endif
res = data1_mk_root (spec->dh, spec->m, absynName);
r = execTok (spec, &s, &cmd_str, &cmd_len);
p = regxStrz (cmd_str, cmd_len, ptmp);
#if REGX_DEBUG
- logf (LOG_LOG, "begin context %s", p);
+ yaz_log (YLOG_LOG, "begin context %s", p);
#endif
while (lc && strcmp (p, lc->name))
lc = lc->next;
if (lc)
spec->context_stack[++(spec->context_stack_top)] = lc;
else
- logf (LOG_WARN, "unknown context %s", p);
+ yaz_log (YLOG_WARN, "unknown context %s", p);
}
r = execTok (spec, &s, &cmd_str, &cmd_len);
}
else
{
- logf (LOG_WARN, "bad keyword '%s' after begin", p);
+ yaz_log (YLOG_WARN, "bad keyword '%s' after begin", p);
}
}
else if (!strcmp (p, "end"))
r = execTok (spec, &s, &cmd_str, &cmd_len);
if (r < 2)
{
- logf (LOG_WARN, "missing keyword after 'end'");
+ yaz_log (YLOG_WARN, "missing keyword after 'end'");
continue;
}
p = regxStrz (cmd_str, cmd_len, ptmp);
}
r = execTok (spec, &s, &cmd_str, &cmd_len);
#if REGX_DEBUG
- logf (LOG_LOG, "end record");
+ yaz_log (YLOG_LOG, "end record");
#endif
spec->stop_flag = 1;
}
if (spec->d1_level <= 1)
{
#if REGX_DEBUG
- logf (LOG_LOG, "end element end records");
+ yaz_log (YLOG_LOG, "end element end records");
#endif
spec->stop_flag = 1;
}
else if (!strcmp (p, "context"))
{
#if REGX_DEBUG
- logf (LOG_LOG, "end context");
+ yaz_log (YLOG_LOG, "end context");
#endif
if (spec->context_stack_top)
(spec->context_stack_top)--;
r = execTok (spec, &s, &cmd_str, &cmd_len);
}
else
- logf (LOG_WARN, "bad keyword '%s' after end", p);
+ yaz_log (YLOG_WARN, "bad keyword '%s' after end", p);
}
else if (!strcmp (p, "data"))
{
break;
}
else
- logf (LOG_WARN, "bad data option: %.*s",
+ yaz_log (YLOG_WARN, "bad data option: %.*s",
cmd_len, cmd_str);
}
if (r != 2)
{
- logf (LOG_WARN, "missing data item after data");
+ yaz_log (YLOG_WARN, "missing data item after data");
continue;
}
if (element_str)
r = execTok (spec, &s, &cmd_str, &cmd_len);
if (r < 2)
{
- logf (LOG_WARN, "missing number after -offset");
+ yaz_log (YLOG_WARN, "missing number after -offset");
continue;
}
p = regxStrz (cmd_str, cmd_len, ptmp);
offset = 0;
if (r < 2)
{
- logf (LOG_WARN, "missing index after unread command");
+ yaz_log (YLOG_WARN, "missing index after unread command");
continue;
}
if (cmd_len != 1 || *cmd_str < '0' || *cmd_str > '9')
{
- logf (LOG_WARN, "bad index after unread command");
+ yaz_log (YLOG_WARN, "bad index after unread command");
continue;
}
else
if (lc)
spec->context_stack[spec->context_stack_top] = lc;
else
- logf (LOG_WARN, "unknown context %s", p);
+ yaz_log (YLOG_WARN, "unknown context %s", p);
}
r = execTok (spec, &s, &cmd_str, &cmd_len);
}
else
{
- logf (LOG_WARN, "unknown code command '%.*s'", cmd_len, cmd_str);
+ yaz_log (YLOG_WARN, "unknown code command '%.*s'", cmd_len, cmd_str);
r = execTok (spec, &s, &cmd_str, &cmd_len);
continue;
}
if (r > 1)
{
- logf (LOG_WARN, "ignoring token %.*s", cmd_len, cmd_str);
+ yaz_log (YLOG_WARN, "ignoring token %.*s", cmd_len, cmd_str);
do {
r = execTok (spec, &s, &cmd_str, &cmd_len);
} while (r > 1);
arg_no++;
arg_start[arg_no] = F_WIN_EOF;
arg_end[arg_no] = F_WIN_EOF;
- yaz_log(LOG_DEBUG, "Pattern match rest of record");
+ yaz_log(YLOG_DEBUG, "Pattern match rest of record");
*pptr = F_WIN_EOF;
}
else
int ruleNo, int start_ptr, int *pptr)
{
#if REGX_DEBUG
- logf (LOG_LOG, "exec rule %d", ruleNo);
+ yaz_log (YLOG_LOG, "exec rule %d", ruleNo);
#endif
return execAction (spec, context->fastRule[ruleNo]->actionList,
start_ptr, pptr);
if (spec->f_win_ef && *ptr != F_WIN_EOF)
{
#if REGX_DEBUG
- logf (LOG_LOG, "regx: endf ptr=%d", *ptr);
+ yaz_log (YLOG_LOG, "regx: endf ptr=%d", *ptr);
#endif
(*spec->f_win_ef)(spec->f_win_fh, *ptr);
}
}
if (!lt)
{
- logf (LOG_WARN, "cannot find context %s", context_name);
+ yaz_log (YLOG_WARN, "cannot find context %s", context_name);
return NULL;
}
spec->context_stack[spec->context_stack_top] = lt;
struct lexSpec **curLexSpec = &specs->spec;
#if REGX_DEBUG
- logf (LOG_LOG, "grs_read_regx");
+ yaz_log (YLOG_LOG, "grs_read_regx");
#endif
if (!*curLexSpec || strcmp ((*curLexSpec)->name, specs->type))
{
struct lexSpec **curLexSpec = &specs->spec;
#if REGX_DEBUG
- logf (LOG_LOG, "grs_read_tcl");
+ yaz_log (YLOG_LOG, "grs_read_tcl");
#endif
if (!*curLexSpec || strcmp ((*curLexSpec)->name, specs->type))
{
-/* $Id: sgmlread.c,v 1.13 2004-09-28 10:15:03 adam Exp $
+/* $Id: sgmlread.c,v 1.14 2004-11-19 10:27:13 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#include <assert.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <idzebra/recgrs.h>
-/* $Id: xmlread.c,v 1.15 2004-09-28 10:15:03 adam Exp $
+/* $Id: xmlread.c,v 1.16 2004-11-19 10:27:13 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
#include <iconv.h>
#endif
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <idzebra/recgrs.h>
#include <yaz/xmalloc.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <expat.h>
data1_mk_preprocess (ui->dh, ui->nmem, "xml", attr_list,
ui->d1_stack[ui->level-1]);
#if 0
- yaz_log (LOG_LOG, "decl version=%s encoding=%s",
+ yaz_log (YLOG_LOG, "decl version=%s encoding=%s",
version ? version : "null",
encoding ? encoding : "null");
#endif
if (!(inf = fopen (systemId, "rb")))
{
- yaz_log (LOG_WARN|LOG_ERRNO, "fopen %s", systemId);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "fopen %s", systemId);
return 0;
}
void *buf = XML_GetBuffer (parser, XML_CHUNK);
if (!buf)
{
- yaz_log (LOG_WARN, "XML_GetBuffer fail");
+ yaz_log (YLOG_WARN, "XML_GetBuffer fail");
break;
}
r = fread (buf, 1, XML_CHUNK, inf);
{
if (ferror(inf))
{
- yaz_log (LOG_WARN|LOG_ERRNO, "fread %s", systemId);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "fread %s", systemId);
break;
}
done = 1;
if (!XML_ParseBuffer (parser, r, done))
{
done = 1;
- yaz_log (LOG_WARN, "%s:%d:%d:XML error: %s",
+ yaz_log (YLOG_WARN, "%s:%d:%d:XML error: %s",
systemId,
XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser),
unsigned short code;
#if 1
- yaz_log(LOG_LOG, "------------------------- cb_encoding_convert --- ");
+ yaz_log(YLOG_LOG, "------------------------- cb_encoding_convert --- ");
#endif
ret = iconv (t, &inbuf, &inleft, &outbuf, &outleft);
if (ret == (size_t) (-1) && errno != E2BIG)
{
info->map[i] = -1; /* no room for output */
if (i != 0)
- yaz_log (LOG_WARN, "Encoding %d: no room for output",
+ yaz_log (YLOG_WARN, "Encoding %d: no room for output",
i);
}
}
else
{ /* should never happen */
info->map[i] = -1;
- yaz_log (LOG_DEBUG, "Encoding %d: bad state", i);
+ yaz_log (YLOG_DEBUG, "Encoding %d: bad state", i);
}
}
if (info->data)
int done = 0;
data1_node *first_node;
- uinfo.loglevel = LOG_DEBUG;
+ uinfo.loglevel = YLOG_DEBUG;
uinfo.level = 1;
uinfo.dh = dh;
uinfo.nmem = m;
if (!buf)
{
/* error */
- yaz_log (LOG_WARN, "XML_GetBuffer fail");
+ yaz_log (YLOG_WARN, "XML_GetBuffer fail");
break;
}
r = (*rf)(fh, buf, XML_CHUNK);
if (r < 0)
{
/* error */
- yaz_log (LOG_WARN, "XML read fail");
+ yaz_log (YLOG_WARN, "XML read fail");
break;
}
else if (r == 0)
if (!XML_ParseBuffer (parser, r, done))
{
done = 1;
- yaz_log (LOG_WARN, "%d:%d:XML error: %s",
+ yaz_log (YLOG_WARN, "%d:%d:XML error: %s",
XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser),
XML_ErrorString(XML_GetErrorCode(parser)));
-/* $Id: rsbetween.c,v 1.31 2004-11-05 18:08:06 heikki Exp $
+/* $Id: rsbetween.c,v 1.32 2004-11-19 10:27:13 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
}
info->andset=rsmultiand_create( nmem, kcontrol, scope, n, rsetarray);
rnew->priv=info;
- logf(log_level,"create rset at %p",rnew);
+ yaz_log(log_level,"create rset at %p",rnew);
return rnew;
}
static void r_delete (RSET ct)
{
struct rset_between_info *info = (struct rset_between_info *) ct->priv;
- logf(log_level,"delete rset at %p",ct);
+ yaz_log(log_level,"delete rset at %p",ct);
rset_delete(info->andset);
}
if (flag & RSETF_WRITE)
{
- logf (LOG_FATAL, "between set type is read-only");
+ yaz_log (YLOG_FATAL, "between set type is read-only");
return NULL;
}
rfd=rfd_create_base(ct);
p->attrdepth=0;
p->attrbufok=0;
p->startbufok=0;
- logf(log_level,"open rset=%p rfd=%p", ct, rfd);
+ yaz_log(log_level,"open rset=%p rfd=%p", ct, rfd);
return rfd;
}
static void r_close (RSFD rfd)
{
struct rset_between_rfd *p=(struct rset_between_rfd *)rfd->priv;
- logf(log_level,"close rfd=%p", rfd);
+ yaz_log(log_level,"close rfd=%p", rfd);
rset_close (p->andrfd);
rfd_delete_base(rfd);
}
{
struct rset_between_rfd *p=(struct rset_between_rfd *)rfd->priv;
int rc;
- logf(log_level, "forwarding ");
+ yaz_log(log_level, "forwarding ");
rc=rset_forward(p->andrfd,buf,term,untilbuf);
return rc;
}
if (0==cmp) /* and the keys match */
{
p->attrdepth=p->depth;
- logf(log_level, "found attribute match at depth %d",p->attrdepth);
+ yaz_log(log_level, "found attribute match at depth %d",p->attrdepth);
}
}
}
struct rset_between_rfd *p=(struct rset_between_rfd *)rfd->priv;
const struct key_control *kctrl=rfd->rset->keycontrol;
int cmp;
- logf(log_level,"== read: term=%p",term);
+ yaz_log(log_level,"== read: term=%p",term);
TERMID dummyterm=0;
if (!term)
term=&dummyterm;
while ( rset_read(p->andrfd,buf,term) )
{
- logf(log_level,"read loop term=%p d=%d ad=%d",
+ yaz_log(log_level,"read loop term=%p d=%d ad=%d",
*term,p->depth, p->attrdepth);
if (p->hits<0)
{/* first time? */
}
else {
cmp=(kctrl->cmp)(buf,p->recbuf);
- logf(log_level, "cmp=%d",cmp);
+ yaz_log(log_level, "cmp=%d",cmp);
}
if (cmp>=rfd->rset->scope)
{
- logf(log_level,"new record");
+ yaz_log(log_level,"new record");
p->depth=0;
p->attrdepth=0;
memcpy(p->recbuf,buf,kctrl->key_size);
}
if (*term)
- logf(log_level," term: '%s'", (*term)->name);
+ yaz_log(log_level," term: '%s'", (*term)->name);
if (*term==info->startterm)
{
p->depth++;
- logf(log_level,"read start tag. d=%d",p->depth);
+ yaz_log(log_level,"read start tag. d=%d",p->depth);
memcpy(p->startbuf,buf,kctrl->key_size);
p->startbufok=1;
checkattr(rfd); /* in case we already saw the attr here */
if (p->depth == p->attrdepth)
p->attrdepth=0; /* ending the tag with attr match */
p->depth--;
- logf(log_level,"read end tag. d=%d ad=%d",p->depth, p->attrdepth);
+ yaz_log(log_level,"read end tag. d=%d ad=%d",p->depth, p->attrdepth);
}
else if (*term==info->attrterm)
{
- logf(log_level,"read attr");
+ yaz_log(log_level,"read attr");
memcpy(p->attrbuf,buf,kctrl->key_size);
p->attrbufok=1;
checkattr(rfd); /* in case the start tag came first */
if (p->depth && p->attrdepth)
{
p->hits++;
- logf(log_level,"got a hit h="ZINT_FORMAT" d=%d ad=%d",
+ yaz_log(log_level,"got a hit h="ZINT_FORMAT" d=%d ad=%d",
p->hits,p->depth,p->attrdepth);
return 1; /* we have everything in place already! */
} else
- logf(log_level, "Ignoring hit. h="ZINT_FORMAT" d=%d ad=%d",
+ yaz_log(log_level, "Ignoring hit. h="ZINT_FORMAT" d=%d ad=%d",
p->hits,p->depth,p->attrdepth);
}
} /* while read */
static int r_write (RSFD rfd, const void *buf)
{
- logf (LOG_FATAL, "between set type is read-only");
+ yaz_log (YLOG_FATAL, "between set type is read-only");
return -1;
}
{
struct rset_between_rfd *p=(struct rset_between_rfd *)rfd->priv;
rset_pos(p->andrfd,current, total);
- logf(log_level,"pos: %0.1f/%0.1f ", *current, *total);
+ yaz_log(log_level,"pos: %0.1f/%0.1f ", *current, *total);
}
static void r_get_terms(RSET ct, TERMID *terms, int maxterms, int *curterm)
-/* $Id: rsbool.c,v 1.50 2004-10-22 10:12:51 heikki Exp $
+/* $Id: rsbool.c,v 1.51 2004-11-19 10:27:14 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
if (flag & RSETF_WRITE)
{
- logf (LOG_FATAL, "bool set type is read-only");
+ yaz_log (YLOG_FATAL, "bool set type is read-only");
return NULL;
}
rfd = rfd_create_base(ct);
p->buf_r = nmem_malloc(ct->nmem, ct->keycontrol->key_size);
}
- logf(LOG_DEBUG,"rsbool (%s) open [%p]", ct->control->desc, rfd);
+ yaz_log(YLOG_DEBUG,"rsbool (%s) open [%p]", ct->control->desc, rfd);
p->hits=0;
p->rfd_l = rset_open (info->rset_l, RSETF_READ);
else
cmp = rfd->rset->scope;
#if RSET_DEBUG
- logf (LOG_DEBUG, "r_read_and [%p] looping: m=%d/%d c=%d t=%d",
+ yaz_log (YLOG_DEBUG, "r_read_and [%p] looping: m=%d/%d c=%d t=%d",
rfd, p->more_l, p->more_r, cmp, p->tail);
- (*kctrl->log_item)(LOG_DEBUG, p->buf_l, "left ");
- (*kctrl->log_item)(LOG_DEBUG, p->buf_r, "right ");
+ (*kctrl->log_item)(YLOG_DEBUG, p->buf_l, "left ");
+ (*kctrl->log_item)(YLOG_DEBUG, p->buf_r, "right ");
#endif
if (!cmp)
{ /* cmp==0 */
p->more_r = rset_read (p->rfd_r, p->buf_r, &p->term_r);
p->tail = 1;
#if RSET_DEBUG
- logf (LOG_DEBUG, "r_read_and [%p] returning R m=%d/%d c=%d",
+ yaz_log (YLOG_DEBUG, "r_read_and [%p] returning R m=%d/%d c=%d",
rfd, p->more_l, p->more_r, cmp);
- key_logdump(LOG_DEBUG,buf);
- (*kctrl->log_item)(LOG_DEBUG, buf, "");
+ key_logdump(YLOG_DEBUG,buf);
+ (*kctrl->log_item)(YLOG_DEBUG, buf, "");
#endif
p->hits++;
return 1;
p->more_l = rset_read (p->rfd_l, p->buf_l,&p->term_l);
p->tail = 1;
#if RSET_DEBUG
- logf (LOG_DEBUG, "r_read_and [%p] returning L m=%d/%d c=%d",
+ yaz_log (YLOG_DEBUG, "r_read_and [%p] returning L m=%d/%d c=%d",
rfd, p->more_l, p->more_r, cmp);
- (*kctrl->log_item)(LOG_DEBUG, buf, "");
+ (*kctrl->log_item)(YLOG_DEBUG, buf, "");
#endif
p->hits++;
return 1;
if (!p->more_r || (*kctrl->cmp)(p->buf_r, buf) > 1)
p->tail = 0;
#if RSET_DEBUG
- logf (LOG_DEBUG, "r_read_and [%p] returning R tail m=%d/%d c=%d",
+ yaz_log (YLOG_DEBUG, "r_read_and [%p] returning R tail m=%d/%d c=%d",
rfd, p->more_l, p->more_r, cmp);
- (*kctrl->log_item)(LOG_DEBUG, buf, "");
+ (*kctrl->log_item)(YLOG_DEBUG, buf, "");
#endif
p->hits++;
return 1;
else
{
#if RSET_DEBUG
- logf (LOG_DEBUG, "r_read_and [%p] about to forward R "
+ yaz_log (YLOG_DEBUG, "r_read_and [%p] about to forward R "
"m=%d/%d c=%d",
rfd, p->more_l, p->more_r, cmp);
#endif
if (!p->more_l || (*kctrl->cmp)(p->buf_l, buf) > 1)
p->tail = 0;
#if RSET_DEBUG
- logf (LOG_DEBUG, "r_read_and [%p] returning L tail m=%d/%d c=%d",
+ yaz_log (YLOG_DEBUG, "r_read_and [%p] returning L tail m=%d/%d c=%d",
rfd, p->more_l, p->more_r, cmp);
- (*kctrl->log_item)(LOG_DEBUG, buf, "");
+ (*kctrl->log_item)(YLOG_DEBUG, buf, "");
#endif
p->hits++;
return 1;
else
{
#if RSET_DEBUG
- logf (LOG_DEBUG, "r_read_and [%p] about to forward L "
+ yaz_log (YLOG_DEBUG, "r_read_and [%p] about to forward L "
"m=%d/%d c=%d",
rfd, p->more_l, p->more_r, cmp);
#endif
}
}
#if RSET_DEBUG
- logf (LOG_DEBUG, "r_read_and [%p] reached its end",rfd);
+ yaz_log (YLOG_DEBUG, "r_read_and [%p] reached its end",rfd);
#endif
return 0;
}
/* get to see both? */
p->more_r = rset_read (p->rfd_r, p->buf_r, &p->term_r);
#if RSET_DEBUG
- logf (LOG_DEBUG, "r_read_or returning A m=%d/%d c=%d",
+ yaz_log (YLOG_DEBUG, "r_read_or returning A m=%d/%d c=%d",
p->more_l, p->more_r, cmp);
- (*kctrl->log_item)(LOG_DEBUG, buf, "");
+ (*kctrl->log_item)(YLOG_DEBUG, buf, "");
#endif
p->hits++;
return 1;
*term=p->term_r;
p->more_r = rset_read (p->rfd_r, p->buf_r, &p->term_r);
#if RSET_DEBUG
- logf (LOG_DEBUG, "r_read_or returning B m=%d/%d c=%d",
+ yaz_log (YLOG_DEBUG, "r_read_or returning B m=%d/%d c=%d",
p->more_l, p->more_r, cmp);
- (*kctrl->log_item)(LOG_DEBUG, buf, "");
+ (*kctrl->log_item)(YLOG_DEBUG, buf, "");
#endif
p->hits++;
return 1;
*term=p->term_l;
p->more_l = rset_read ( p->rfd_l, p->buf_l, &p->term_l);
#if RSET_DEBUG
- logf (LOG_DEBUG, "r_read_or returning C m=%d/%d c=%d",
+ yaz_log (YLOG_DEBUG, "r_read_or returning C m=%d/%d c=%d",
p->more_l, p->more_r, cmp);
- (*kctrl->log_item)(LOG_DEBUG, buf, "");
+ (*kctrl->log_item)(YLOG_DEBUG, buf, "");
#endif
p->hits++;
return 1;
static int r_write (RSFD rfd, const void *buf)
{
- logf (LOG_FATAL, "bool set type is read-only");
+ yaz_log (YLOG_FATAL, "bool set type is read-only");
return -1;
}
*current=(double) (p->hits);
*total=*current/r ;
#if RSET_DEBUG
- yaz_log(LOG_DEBUG,"bool_pos: (%s/%s) %0.1f/%0.1f= %0.4f ",
+ yaz_log(YLOG_DEBUG,"bool_pos: (%s/%s) %0.1f/%0.1f= %0.4f ",
info->rset_l->control->desc, info->rset_r->control->desc,
*current, *total, r);
#endif
-/* $Id: rset.c,v 1.39 2004-11-04 13:54:08 heikki Exp $
+/* $Id: rset.c,v 1.40 2004-11-19 10:27:14 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
{
rs->free_list=rnew->next;
assert(rnew->rset==rs);
- logf(log_level,"rfd-create_base (fl): rfd=%p rs=%p fl=%p priv=%p",
+ yaz_log(log_level,"rfd-create_base (fl): rfd=%p rs=%p fl=%p priv=%p",
rnew, rs, rs->free_list, rnew->priv);
} else {
rnew=nmem_malloc(rs->nmem, sizeof(*rnew));
rnew->priv=NULL;
rnew->rset=rs;
- logf(log_level,"rfd_create_base (new): rfd=%p rs=%p fl=%p priv=%p",
+ yaz_log(log_level,"rfd_create_base (new): rfd=%p rs=%p fl=%p priv=%p",
rnew, rs, rs->free_list, rnew->priv);
}
rnew->next=NULL; /* not part of any (free?) list */
void rfd_delete_base(RSFD rfd)
{
RSET rs=rfd->rset;
- logf(log_level,"rfd_delete_base: rfd=%p rs=%p priv=%p fl=%p",
+ yaz_log(log_level,"rfd_delete_base: rfd=%p rs=%p priv=%p fl=%p",
rfd, rs, rfd->priv, rs->free_list);
assert(NULL == rfd->next);
rfd->next=rs->free_list;
else
M=nmem_create();
rnew = (RSET) nmem_malloc(M,sizeof(*rnew));
- logf (log_level, "rs_create(%s) rs=%p (nm=%p)", sel->desc, rnew, nmem);
+ yaz_log (log_level, "rs_create(%s) rs=%p (nm=%p)", sel->desc, rnew, nmem);
rnew->nmem=M;
if (nmem)
rnew->my_nmem=0;
void rset_delete (RSET rs)
{
(rs->count)--;
- logf(log_level,"rs_delete(%s), rs=%p, count=%d",
+ yaz_log(log_level,"rs_delete(%s), rs=%p, count=%d",
rs->control->desc, rs, rs->count);
if (!rs->count)
{
RSET rset_dup (RSET rs)
{
(rs->count)++;
- logf(log_level,"rs_dup(%s), rs=%p, count=%d",
+ yaz_log(log_level,"rs_dup(%s), rs=%p, count=%d",
rs->control->desc, rs, rs->count);
return rs;
}
int cmp=rfd->rset->scope;
if (log_level)
{
- logf (log_level, "rset_default_forward starting '%s' (ct=%p rfd=%p)",
+ yaz_log (log_level, "rset_default_forward starting '%s' (ct=%p rfd=%p)",
rfd->rset->control->desc, rfd->rset, rfd);
/* key_logdump(log_level, untilbuf); */
}
while ( (cmp>=rfd->rset->scope) && (more))
{
if (log_level) /* time-critical, check first */
- logf(log_level,"rset_default_forward looping m=%d c=%d",more,cmp);
+ yaz_log(log_level,"rset_default_forward looping m=%d c=%d",more,cmp);
more=rset_read(rfd, buf, term);
if (more)
cmp=(rfd->rset->keycontrol->cmp)(untilbuf,buf);
key_logdump(log_level,buf); */
}
if (log_level)
- logf (log_level, "rset_default_forward exiting m=%d c=%d",more,cmp);
+ yaz_log (log_level, "rset_default_forward exiting m=%d c=%d",more,cmp);
return more;
}
{
TERMID t;
- logf (log_level, "term_create '%s' %d f=%s type=%d nmem=%p",
+ yaz_log (log_level, "term_create '%s' %d f=%s type=%d nmem=%p",
name, length, flags, type, nmem);
t= (TERMID) nmem_malloc (nmem, sizeof(*t));
if (!name)
-/* $Id: rsisamb.c,v 1.27 2004-11-15 23:13:12 adam Exp $
+/* $Id: rsisamb.c,v 1.28 2004-11-19 10:27:14 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
if (flag & RSETF_WRITE)
{
- yaz_log(LOG_FATAL, "ISAMB set type is read-only");
+ yaz_log(YLOG_FATAL, "ISAMB set type is read-only");
return NULL;
}
rfd = rfd_create_base(ct);
static int r_write (RSFD rfd, const void *buf)
{
- yaz_log(LOG_FATAL, "ISAMB set type is read-only");
+ yaz_log(YLOG_FATAL, "ISAMB set type is read-only");
return -1;
}
-/* $Id: rsisamc.c,v 1.32 2004-11-15 23:13:12 adam Exp $
+/* $Id: rsisamc.c,v 1.33 2004-11-19 10:27:14 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
yaz_log(log_level, "risamc_open");
if (flag & RSETF_WRITE)
{
- yaz_log(LOG_FATAL, "ISAMC set type is read-only");
+ yaz_log(YLOG_FATAL, "ISAMC set type is read-only");
return NULL;
}
rfd = rfd_create_base(ct);
static int r_write (RSFD rfd, const void *buf)
{
- yaz_log(LOG_FATAL, "ISAMC set type is read-only");
+ yaz_log(YLOG_FATAL, "ISAMC set type is read-only");
return -1;
}
-/* $Id: rsisams.c,v 1.16 2004-10-22 10:12:52 heikki Exp $
+/* $Id: rsisams.c,v 1.17 2004-11-19 10:27:14 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
static void r_delete (RSET ct)
{
- logf (LOG_DEBUG, "rsisams_delete");
+ yaz_log (YLOG_DEBUG, "rsisams_delete");
rset_delete(ct);
}
RSFD rfd;
struct rset_pp_info *ptinfo;
- logf (LOG_DEBUG, "risams_open");
+ yaz_log (YLOG_DEBUG, "risams_open");
if (flag & RSETF_WRITE)
{
- logf (LOG_FATAL, "ISAMS set type is read-only");
+ yaz_log (YLOG_FATAL, "ISAMS set type is read-only");
return NULL;
}
rfd=rfd_create_base(ct);
static int r_write (RSFD rfd, const void *buf)
{
- logf (LOG_FATAL, "ISAMS set type is read-only");
+ yaz_log (YLOG_FATAL, "ISAMS set type is read-only");
return -1;
}
-/* $Id: rsmultiandor.c,v 1.9 2004-11-04 13:54:08 heikki Exp $
+/* $Id: rsmultiandor.c,v 1.10 2004-11-19 10:27:14 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
if (i>h->heapnum)
return;
(void)rset_pos(h->heap[i]->rset,h->heap[i]->fd, &cur, &tot);
- logf(log_level," %d %*s i=%p buf=%p %0.1f/%0.1f",i, level, "",
+ yaz_log(log_level," %d %*s i=%p buf=%p %0.1f/%0.1f",i, level, "",
&(h->heap[i]), h->heap[i]->buf, cur,tot );
heap_dump_item(h, 2*i, level+1);
heap_dump_item(h, 2*i+1, level+1);
}
static void heap_dump( HEAP h,char *msg) {
- logf(log_level, "heap dump: %s num=%d max=%d",msg, h->heapnum, h->heapmax);
+ yaz_log(log_level, "heap dump: %s num=%d max=%d",msg, h->heapnum, h->heapmax);
heap_dump_item(h,1,1);
}
#endif
if (flag & RSETF_WRITE)
{
- logf (LOG_FATAL, "multiandor set type is read-only");
+ yaz_log (YLOG_FATAL, "multiandor set type is read-only");
return NULL;
}
rfd=rfd_create_base(ct);
int i;
for (i=0; i<info->no_rsets; i++){
rset_pos(mrfd->items[i].fd, &cur, &tot);
- logf(log_level, "r_pos: %d %0.1f %0.1f", i, cur,tot);
+ yaz_log(log_level, "r_pos: %d %0.1f %0.1f", i, cur,tot);
scur += cur;
stot += tot;
}
if (stot <1.0) { /* nothing there */
*current=0;
*total=0;
- logf(log_level, "r_pos: NULL %0.1f %0.1f", *current, *total);
+ yaz_log(log_level, "r_pos: NULL %0.1f %0.1f", *current, *total);
return;
}
*current=mrfd->hits;
*total=*current*stot/scur;
- logf(log_level, "r_pos: = %0.1f %0.1f", *current, *total);
+ yaz_log(log_level, "r_pos: = %0.1f %0.1f", *current, *total);
}
static int r_write (RSFD rfd, const void *buf)
{
- logf (LOG_FATAL, "multior set type is read-only");
+ yaz_log (YLOG_FATAL, "multior set type is read-only");
return -1;
}
-/* $Id: rsnull.c,v 1.29 2004-10-22 10:12:52 heikki Exp $
+/* $Id: rsnull.c,v 1.30 2004-11-19 10:27:14 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
RSFD rfd;
if (flag & RSETF_WRITE)
{
- logf (LOG_FATAL, "NULL set type is read-only");
+ yaz_log (YLOG_FATAL, "NULL set type is read-only");
return NULL;
}
rfd=rfd_create_base(ct);
static int r_write (RSFD rfd, const void *buf)
{
- logf (LOG_FATAL, "NULL set type is read-only");
+ yaz_log (YLOG_FATAL, "NULL set type is read-only");
return -1;
}
-/* $Id: rsprox.c,v 1.20 2004-10-22 10:12:52 heikki Exp $
+/* $Id: rsprox.c,v 1.21 2004-11-19 10:27:14 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
if (flag & RSETF_WRITE)
{
- logf (LOG_FATAL, "prox set type is read-only");
+ yaz_log (YLOG_FATAL, "prox set type is read-only");
return NULL;
}
rfd = rfd_create_base(ct);
}
p->rfd = nmem_malloc(ct->nmem,sizeof(*p->rfd) * info->rset_no);
}
- logf(LOG_DEBUG,"rsprox (%s) open [%p] n=%d",
+ yaz_log(YLOG_DEBUG,"rsprox (%s) open [%p] n=%d",
ct->control->desc, rfd, info->rset_no);
for (i = 0; i < info->rset_no; i++) {
static int r_write (RSFD rfd, const void *buf)
{
- logf (LOG_FATAL, "prox set type is read-only");
+ yaz_log (YLOG_FATAL, "prox set type is read-only");
return -1;
}
double scur=0,stot=0;
double r;
- logf (LOG_DEBUG, "rsprox_pos");
+ yaz_log (YLOG_DEBUG, "rsprox_pos");
for (i = 0; i < info->rset_no; i++)
{
*current=p->hits;
*total=*current/r ;
}
- logf(LOG_DEBUG,"prox_pos: [%d] %0.1f/%0.1f= %0.4f ",
+ yaz_log(YLOG_DEBUG,"prox_pos: [%d] %0.1f/%0.1f= %0.4f ",
i,*current, *total, r);
}
-/* $Id: rstemp.c,v 1.54 2004-11-04 13:54:08 heikki Exp $
+/* $Id: rstemp.c,v 1.55 2004-11-19 10:27:14 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
Index Data Aps
{
struct rset_temp_info *info = (struct rset_temp_info*) ct->priv;
- logf (log_level, "r_delete: set size %ld", (long) info->pos_end);
+ yaz_log (log_level, "r_delete: set size %ld", (long) info->pos_end);
if (info->fname)
{
- logf (log_level, "r_delete: unlink %s", info->fname);
+ yaz_log (log_level, "r_delete: unlink %s", info->fname);
unlink (info->fname);
}
}
info->fd = open (info->fname, O_BINARY|O_RDONLY);
if (info->fd == -1)
{
- logf (LOG_FATAL|LOG_ERRNO, "rstemp: open failed %s", info->fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "rstemp: open failed %s", info->fname);
exit (1);
}
}
if (info->fd == -1)
{
- logf (LOG_FATAL|LOG_ERRNO, "rstemp: mkstemp %s", template);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "rstemp: mkstemp %s", template);
exit (1);
}
info->fname= nmem_malloc(rfd->rset->nmem,strlen(template)+1);
info->fname= nmem_malloc(rfd->rset->nmem,strlen(template)+1);
strcpy (info->fname, s);
- logf (log_level, "creating tempfile %s", info->fname);
+ yaz_log (log_level, "creating tempfile %s", info->fname);
info->fd = open (info->fname, O_BINARY|O_RDWR|O_CREAT, 0666);
if (info->fd == -1)
{
- logf (LOG_FATAL|LOG_ERRNO, "rstemp: open %s", info->fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "rstemp: open %s", info->fname);
exit (1);
}
#endif
if (lseek (info->fd, info->pos_buf, SEEK_SET) == -1)
{
- logf (LOG_FATAL|LOG_ERRNO, "rstemp: lseek %s", info->fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "rstemp: lseek %s", info->fname);
exit (1);
}
count = info->buf_size;
if ((r = write (info->fd, info->buf_mem, count)) < (int) count)
{
if (r == -1)
- logf (LOG_FATAL|LOG_ERRNO, "rstemp: write %s", info->fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "rstemp: write %s", info->fname);
else
- logf (LOG_FATAL, "rstemp: write of %ld but got %ld",
+ yaz_log (YLOG_FATAL, "rstemp: write of %ld but got %ld",
(long) count, (long) r);
exit (1);
}
{
if (lseek (info->fd, info->pos_buf, SEEK_SET) == -1)
{
- logf (LOG_FATAL|LOG_ERRNO, "rstemp: lseek %s", info->fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "rstemp: lseek %s", info->fname);
exit (1);
}
if ((r = read (info->fd, info->buf_mem, count)) < (int) count)
{
if (r == -1)
- logf (LOG_FATAL|LOG_ERRNO, "rstemp: read %s", info->fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "rstemp: read %s", info->fname);
else
- logf (LOG_FATAL, "read of %ld but got %ld",
+ yaz_log (YLOG_FATAL, "read of %ld but got %ld",
(long) count, (long) r);
exit (1);
}
SUBDIRS=codec api gils malxml config usmarc dmoz sort sort2 xelm cddb \
- rusmarc zsh marcxml charmap
+ rusmarc zsh marcxml charmap
-/* $Id: t10.c,v 1.4 2004-11-04 13:09:49 heikki Exp $
+/* $Id: t10.c,v 1.5 2004-11-19 10:27:15 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
zh = zebra_open (zs);
zebra_select_database(zh, "Default");
zebra_set_resource(zh, "zvrank.weighting-scheme", tests[i].schema);
- logf(LOG_LOG,"============%d: %s ============", i,tests[i].schema);
+ yaz_log(log_level,"============%d: %s ============", i,tests[i].schema);
ranking_query( __LINE__, zh, "@attr 1=1016 @attr 2=102 the",
3, tests[i].hit1, tests[i].score1);
-/* $Id: testlib.c,v 1.4 2004-11-04 13:10:07 heikki Exp $
+/* $Id: testlib.c,v 1.5 2004-11-19 10:27:15 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
/** testlib - utilities for the api tests */
#include <assert.h>
-#include <yaz/log.h>
#include <yaz/pquery.h>
#include <idzebra/api.h>
#include "testlib.h"
/** start_log: open a log file */
/* FIXME - parse command line arguments to set log levels etc */
-static int loglevel=0;
+int log_level=0; /* not static, t*.c may use it */
+
void start_log(int argc, char **argv)
{
char logname[2048];
return;
sprintf(logname, "%s.log", argv[0]);
yaz_log_init_file(logname);
- loglevel = yaz_log_mask_str_x(argv[0],0);
- yaz_log_init_level(LOG_DEFAULT_LEVEL | loglevel);
- logf(loglevel,"starting %s",argv[0]);
+ log_level = yaz_log_mask_str_x(argv[0],0);
+ yaz_log_init_level(YLOG_DEFAULT_LEVEL | log_level);
+ yaz_log(log_level,"starting %s",argv[0]);
}
/**
zebra_stop(zs);
if (retcode)
- logf(loglevel,"========= Exiting with return code %d", retcode);
+ yaz_log(log_level,"========= Exiting with return code %d", retcode);
else
- logf(loglevel,"========= All tests OK");
+ yaz_log(log_level,"========= All tests OK");
nmem_exit();
xmalloc_trav("x");
return retcode;
char *addinfo;
assert(zh);
zebra_select_database(zh, "Default");
- logf(LOG_DEBUG,"going to call init");
+ yaz_log(log_level,"going to call init");
i=zebra_init(zh);
- logf(LOG_DEBUG,"init returned %d",i);
+ yaz_log(log_level,"init returned %d",i);
if (i)
{
printf("init failed with %d\n",i);
int rc;
- logf(loglevel,"======================================");
- logf(loglevel,"qry[%d]: %s", lineno, query);
+ yaz_log(log_level,"======================================");
+ yaz_log(log_level,"qry[%d]: %s", lineno, query);
odr=odr_createmem (ODR_DECODE);
parser = yaz_pqf_create();
-/* $Id: testlib.h,v 1.3 2004-10-29 13:02:39 heikki Exp $
+/* $Id: testlib.h,v 1.4 2004-11-19 10:27:16 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
/** testlib - utilities for the api tests */
#include <stdlib.h>
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <yaz/pquery.h>
#include <idzebra/api.h>
+int log_level;
/**
-/* $Id: xpath1.c,v 1.1 2004-10-29 13:02:56 heikki Exp $
+/* $Id: xpath1.c,v 1.2 2004-11-19 10:27:16 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
*/
#include <stdlib.h>
-#include <yaz/log.h>
#include <idzebra/api.h>
#include "testlib.h"
-# $Id: Makefile.am,v 1.7 2004-05-25 08:49:11 adam Exp $
+# $Id: Makefile.am,v 1.8 2004-11-19 10:27:17 heikki Exp $
-check_SCRIPTS = simple1.sh test1.sh test2.sh test3.sh test4.sh test5.sh
+check_SCRIPTS = dummy.sh
+#check_SCRIPTS = simple1.sh test1.sh test2.sh test3.sh test4.sh test5.sh
TESTS = $(check_SCRIPTS)
-EXTRA_DIST = zebra.cfg rec.xml Zthes.abs zthes-b.est \
- simple1.xml rec4.xml rec5.xml $(check_SCRIPTS)
+#EXTRA_DIST = zebra.cfg rec.xml Zthes.abs zthes-b.est \
+# simple1.xml rec4.xml rec5.xml $(check_SCRIPTS)
--- /dev/null
+echo "xpath tests moved away"
-/* $Id: charmap.c,v 1.30 2004-09-14 14:38:08 quinn Exp $
+/* $Id: charmap.c,v 1.31 2004-11-19 10:27:17 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
root->target && root->target[0] && root->target[0][0] &&
strcmp (root->target[0], CHR_UNKNOWN))
{
- yaz_log (LOG_WARN, "duplicate entry for charmap from '%s'",
+ yaz_log (YLOG_WARN, "duplicate entry for charmap from '%s'",
from_0);
}
root->target = (unsigned char **)
unsigned char c;
unsigned int i = 0;
- yaz_log (LOG_DEBUG, "prim %.3s", *s);
+ yaz_log (YLOG_DEBUG, "prim %.3s", *s);
if (**s == '\\')
{
(*s)++;
ucs4_t i = 0;
char fmtstr[8];
- yaz_log (LOG_DEBUG, "prim_w %.3s", (char *) *s);
+ yaz_log (YLOG_DEBUG, "prim_w %.3s", (char *) *s);
if (**s == '\\')
{
(*s)++;
c = **s;
++(*s);
}
- yaz_log (LOG_DEBUG, "out %d", c);
+ yaz_log (YLOG_DEBUG, "out %d", c);
return c;
}
res = chr_map_input(arg->map, &s, strlen(s), 0);
if (*res == (char*) CHR_UNKNOWN)
- logf(LOG_WARN, "Map: '%s' has no mapping", p);
+ yaz_log(YLOG_WARN, "Map: '%s' has no mapping", p);
strncat(arg->string, *res, CHR_MAXSTR - strlen(arg->string));
arg->string[CHR_MAXSTR] = '\0';
}
chrwork *arg = (chrwork *) data;
assert(arg->map->input);
- logf (LOG_DEBUG, "set map %.*s", (int) strlen(s), s);
+ yaz_log (YLOG_DEBUG, "set map %.*s", (int) strlen(s), s);
set_map_string(arg->map->input, arg->map->nmem, s, strlen(s), arg->string,
0);
for (s = arg->string; *s; s++)
- logf (LOG_DEBUG, " %3d", (unsigned char) *s);
+ yaz_log (YLOG_DEBUG, " %3d", (unsigned char) *s);
}
/*
chrwork *arg = (chrwork *) data;
assert(arg->map->q_input);
- logf (LOG_DEBUG, "set qmap %.*s", (int) strlen(s), s);
+ yaz_log (YLOG_DEBUG, "set qmap %.*s", (int) strlen(s), s);
set_map_string(arg->map->q_input, arg->map->nmem, s,
strlen(s), arg->string, 0);
for (s = arg->string; *s; s++)
- logf (LOG_DEBUG, " %3d", (unsigned char) *s);
+ yaz_log (YLOG_DEBUG, " %3d", (unsigned char) *s);
}
static int scan_to_utf8 (yaz_iconv_t t, ucs4_t *from, size_t inlen,
ret = yaz_iconv (t, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
if (ret == (size_t) (-1))
{
- yaz_log(LOG_LOG, "from: %2X %2X %2X %2X",
+ yaz_log(YLOG_LOG, "from: %2X %2X %2X %2X",
from[0], from[1], from[2], from[3]);
- yaz_log (LOG_WARN|LOG_ERRNO, "bad unicode sequence");
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "bad unicode sequence");
return -1;
}
}
begin = zebra_prim_w(&s);
if (*s != '-')
{
- logf(LOG_FATAL, "Bad range in char-map");
+ yaz_log(YLOG_FATAL, "Bad range in char-map");
return -1;
}
s++;
end = zebra_prim_w(&s);
if (end <= begin)
{
- logf(LOG_FATAL, "Bad range in char-map");
+ yaz_log(YLOG_FATAL, "Bad range in char-map");
return -1;
}
s++;
t_utf8 = yaz_iconv_open ("UTF-8", ucs4_native);
- logf (LOG_DEBUG, "maptab %s open", name);
+ yaz_log (YLOG_DEBUG, "maptab %s open", name);
if (!(f = yaz_fopen(tabpath, name, "r", tabroot)))
{
- logf(LOG_WARN|LOG_ERRNO, "%s", name);
+ yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", name);
return 0;
}
nmem = nmem_create ();
{
if (argc != 2)
{
- logf(LOG_FATAL, "Syntax error in charmap");
+ yaz_log(YLOG_FATAL, "Syntax error in charmap");
++errors;
}
if (scan_string(argv[1], t_unicode, t_utf8, fun_addentry,
res, &num) < 0)
{
- logf(LOG_FATAL, "Bad value-set specification");
+ yaz_log(YLOG_FATAL, "Bad value-set specification");
++errors;
}
res->base_uppercase = num;
{
if (!res->base_uppercase)
{
- logf(LOG_FATAL, "Uppercase directive with no lowercase set");
+ yaz_log(YLOG_FATAL, "Uppercase directive with no lowercase set");
++errors;
}
if (argc != 2)
{
- logf(LOG_FATAL, "Missing arg for uppercase directive");
+ yaz_log(YLOG_FATAL, "Missing arg for uppercase directive");
++errors;
}
if (scan_string(argv[1], t_unicode, t_utf8, fun_addentry,
res, &num) < 0)
{
- logf(LOG_FATAL, "Bad value-set specification");
+ yaz_log(YLOG_FATAL, "Bad value-set specification");
++errors;
}
}
{
if (argc != 2)
{
- logf(LOG_FATAL, "Syntax error in charmap for space");
+ yaz_log(YLOG_FATAL, "Syntax error in charmap for space");
++errors;
}
if (scan_string(argv[1], t_unicode, t_utf8,
fun_addspace, res, 0) < 0)
{
- logf(LOG_FATAL, "Bad space specification");
+ yaz_log(YLOG_FATAL, "Bad space specification");
++errors;
}
}
{
if (argc != 2)
{
- logf(LOG_FATAL, "Syntax error in charmap for cut");
+ yaz_log(YLOG_FATAL, "Syntax error in charmap for cut");
++errors;
}
if (scan_string(argv[1], t_unicode, t_utf8,
fun_addcut, res, 0) < 0)
{
- logf(LOG_FATAL, "Bad cut specification");
+ yaz_log(YLOG_FATAL, "Bad cut specification");
++errors;
}
}
if (argc != 3)
{
- logf(LOG_FATAL, "charmap directive map requires 2 args");
+ yaz_log(YLOG_FATAL, "charmap directive map requires 2 args");
++errors;
}
buf.map = res;
if (scan_string(argv[2], t_unicode, t_utf8,
fun_mkstring, &buf, 0) < 0)
{
- logf(LOG_FATAL, "Bad map target");
+ yaz_log(YLOG_FATAL, "Bad map target");
++errors;
}
if (scan_string(argv[1], t_unicode, t_utf8,
fun_add_map, &buf, 0) < 0)
{
- logf(LOG_FATAL, "Bad map source");
+ yaz_log(YLOG_FATAL, "Bad map source");
++errors;
}
}
if (argc != 3)
{
- logf(LOG_FATAL, "charmap directive qmap requires 2 args");
+ yaz_log(YLOG_FATAL, "charmap directive qmap requires 2 args");
++errors;
}
buf.map = res;
if (scan_string(argv[2], t_unicode, t_utf8,
fun_mkstring, &buf, 0) < 0)
{
- logf(LOG_FATAL, "Bad qmap target");
+ yaz_log(YLOG_FATAL, "Bad qmap target");
++errors;
}
if (scan_string(argv[1], t_unicode, t_utf8,
fun_add_qmap, &buf, 0) < 0)
{
- logf(LOG_FATAL, "Bad qmap source");
+ yaz_log(YLOG_FATAL, "Bad qmap source");
++errors;
}
}
}
else
{
- logf(LOG_WARN, "Syntax error at '%s' in %s", line, name);
+ yaz_log(YLOG_WARN, "Syntax error at '%s' in %s", line, name);
}
yaz_fclose(f);
chrmaptab_destroy(res);
res = 0;
}
- logf (LOG_DEBUG, "maptab %s close %d errors", name, errors);
+ yaz_log (YLOG_DEBUG, "maptab %s close %d errors", name, errors);
if (t_utf8 != 0)
yaz_iconv_close(t_utf8);
if (t_unicode != 0)
-/* $Id: passwddb.c,v 1.7 2002-08-02 19:26:57 adam Exp $
+/* $Id: passwddb.c,v 1.8 2004-11-19 10:27:17 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#include <crypt.h>
#endif
-#include <yaz/log.h>
+#include <yaz/ylog.h>
#include <yaz/xmalloc.h>
#include <passwddb.h>
{
struct passwd_entry *pe;
for (pe = db->entries; pe; pe = pe->next)
- logf (LOG_LOG,"%s:%s", pe->name, pe->des);
+ yaz_log (YLOG_LOG,"%s:%s", pe->name, pe->des);
}
int passwd_db_auth (Passwd_db db, const char *user, const char *pass)
-/* $Id: res-test.c,v 1.8 2002-08-02 19:26:57 adam Exp $
+/* $Id: res-test.c,v 1.9 2004-11-19 10:27:18 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
static void res_print (const char *name, const char *value)
{
- logf (LOG_LOG, "%s=%s", name, value);
+ yaz_log (YLOG_LOG, "%s=%s", name, value);
}
int main(int argc, char **argv)
Res res;
int write_flag = 0;
- log_init (LOG_DEFAULT_LEVEL, prog, NULL);
+ log_init (YLOG_DEFAULT_LEVEL, prog, NULL);
while ((ret = options ("wp:v", argv, argc, &arg)) != -2)
if (ret == 0)
resfile = arg;
else if (ret == 'v')
- log_init (LOG_ALL, prog, NULL);
+ log_init (YLOG_ALL, prog, NULL);
else if (ret == 'p')
prefix = arg;
else if (ret == 'w')
write_flag = 1;
else
{
- logf (LOG_FATAL, "Unknown option '-%s'", arg);
+ yaz_log (YLOG_FATAL, "Unknown option '-%s'", arg);
exit (1);
}
if (!resfile)
{
- logf (LOG_FATAL, "No resource file given.");
+ yaz_log (YLOG_FATAL, "No resource file given.");
exit (1);
}
res = res_open (resfile);
-/* $Id: res.c,v 1.37 2004-07-26 13:59:25 adam Exp $
+/* $Id: res.c,v 1.38 2004-11-19 10:27:18 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
fr = fopen (r->name, "r");
if (!fr)
{
- logf (LOG_WARN|LOG_ERRNO, "Cannot open `%s'", r->name);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "Cannot open `%s'", r->name);
return ;
}
val_buf = (char*) xmalloc (val_max);
val_size--;
val_buf[val_size] = '\0';
resp->value = xstrdup_env(val_buf);
- logf (LOG_DEBUG, "(name=%s,value=%s)",
+ yaz_log (YLOG_DEBUG, "(name=%s,value=%s)",
resp->name, resp->value);
break;
}
if (access (name, R_OK))
#endif
{
- logf (LOG_WARN|LOG_ERRNO, "Cannot open `%s'", name);
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "Cannot open `%s'", name);
return 0;
}
}
if (!(t = res_get (r, name)))
{
- logf (LOG_DEBUG, "CAUTION: Using default resource %s:%s", name, def);
+ yaz_log (YLOG_DEBUG, "CAUTION: Using default resource %s:%s", name, def);
return def;
}
else
fr = fopen (r->name, "w");
if (!fr)
{
- logf (LOG_FATAL|LOG_ERRNO, "Cannot create `%s'", r->name);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "Cannot create `%s'", r->name);
exit (1);
}
-/* $Id: zebramap.c,v 1.34 2004-09-28 12:39:55 adam Exp $
+/* $Id: zebramap.c,v 1.35 2004-11-19 10:27:18 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
if (!(f = yaz_fopen(zms->tabpath, name, "r", zms->tabroot)))
{
- logf(LOG_WARN|LOG_ERRNO, "%s", name);
+ yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", name);
return ;
}
while ((argc = readconf_line(f, &lineno, line, 512, argv, 10)))
token->next = (*zm)->replace_tokens;
(*zm)->replace_tokens = token;
#if 0
- logf (LOG_LOG, "replace %s", argv[1]);
+ yaz_log (YLOG_LOG, "replace %s", argv[1]);
#endif
token->token_from = 0;
if (argc >= 2)
{
*dp++ = zebra_prim(&cp);
#if 0
- logf (LOG_LOG, " char %2X %c", dp[-1], dp[-1]);
+ yaz_log (YLOG_LOG, " char %2X %c", dp[-1], dp[-1]);
#endif
}
*dp = '\0';
if (!zm)
{
zm = (struct zebra_map *) nmem_malloc (zms->nmem, sizeof(*zm));
- logf (LOG_WARN, "Unknown register type: %c", reg_id);
+ yaz_log (YLOG_WARN, "Unknown register type: %c", reg_id);
zm->reg_id = reg_id;
zm->maptab_name = nmem_strdup (zms->nmem, "@");
if (!(zm->maptab = chrmaptab_create (zms->tabpath,
zm->maptab_name, 0,
zms->tabroot)))
- logf(LOG_WARN, "Failed to read character table %s",
+ yaz_log(YLOG_WARN, "Failed to read character table %s",
zm->maptab_name);
else
- logf(LOG_DEBUG, "Read character table %s", zm->maptab_name);
+ yaz_log(YLOG_DEBUG, "Read character table %s", zm->maptab_name);
}
return zm->maptab;
}
return zms->wrbuf_1;
#if 0
- logf (LOG_LOG, "in:%.*s:", wrbuf_len(zms->wrbuf_1),
+ yaz_log (YLOG_LOG, "in:%.*s:", wrbuf_len(zms->wrbuf_1),
wrbuf_buf(zms->wrbuf_1));
#endif
for (;;)
}
}
#if 0
- logf (LOG_LOG, "out:%.*s:", wrbuf_len(wrbuf), wrbuf_buf(wrbuf));
+ yaz_log (YLOG_LOG, "out:%.*s:", wrbuf_len(wrbuf), wrbuf_buf(wrbuf));
#endif
return no_replaces;
}