projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added support for term references (queryIDs) for searchResult.
[idzebra-moved-to-github.git]
/
rset
/
rstemp.c
diff --git
a/rset/rstemp.c
b/rset/rstemp.c
index
57e1beb
..
338e697
100644
(file)
--- a/
rset/rstemp.c
+++ b/
rset/rstemp.c
@@
-1,4
+1,4
@@
-/* $Id: rstemp.c,v 1.60 2005-01-17 01:21:44 adam Exp $
+/* $Id: rstemp.c,v 1.65 2005-06-14 20:28:54 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-27,12
+27,13
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include <string.h>
#ifdef WIN32
#include <io.h>
#include <string.h>
#ifdef WIN32
#include <io.h>
-#else
+#endif
+#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <unistd.h>
#endif
#include <sys/types.h>
-#include <zebrautl.h>
+#include <idzebra/util.h>
#include <rset.h>
static RSFD r_open(RSET ct, int flag);
#include <rset.h>
static RSFD r_open(RSET ct, int flag);
@@
-44,7
+45,6
@@
static void r_pos(RSFD rfd, double *current, double *total);
static void r_flush(RSFD rfd, int mk);
static void r_reread(RSFD rfd);
static void r_flush(RSFD rfd, int mk);
static void r_reread(RSFD rfd);
-
static const struct rset_control control =
{
"temp",
static const struct rset_control control =
{
"temp",
@@
-52,15
+52,13
@@
static const struct rset_control control =
rset_get_one_term,
r_open,
r_close,
rset_get_one_term,
r_open,
r_close,
- rset_default_forward,
+ 0, /* no forward */
r_pos,
r_read,
r_write,
};
r_pos,
r_read,
r_write,
};
-const struct rset_control *rset_kind_temp = &control;
-
-struct rset_temp_info {
+struct rset_private {
int fd; /* file descriptor for temp file */
char *fname; /* name of temp file */
char *buf_mem; /* window buffer */
int fd; /* file descriptor for temp file */
char *fname; /* name of temp file */
char *buf_mem; /* window buffer */
@@
-69,11
+67,11
@@
struct rset_temp_info {
size_t pos_buf; /* position of first byte in window */
size_t pos_border; /* position of last byte+1 in window */
int dirty; /* window is dirty */
size_t pos_buf; /* position of first byte in window */
size_t pos_border; /* position of last byte+1 in window */
int dirty; /* window is dirty */
- zint hits; /* no of hits */
+ zint hits; /* no of hits */
char *temp_path;
};
char *temp_path;
};
-struct rset_temp_rfd {
+struct rfd_private {
void *buf;
size_t pos_cur; /* current position in set */
/* FIXME - term pos or what ?? */
void *buf;
size_t pos_cur; /* current position in set */
/* FIXME - term pos or what ?? */
@@
-83,17
+81,18
@@
struct rset_temp_rfd {
static int log_level = 0;
static int log_level_initialized = 0;
static int log_level = 0;
static int log_level_initialized = 0;
-RSET rstemp_create( NMEM nmem, const struct key_control *kcontrol,
- int scope, const char *temp_path, TERMID term)
+RSET rstemp_create(NMEM nmem, struct rset_key_control *kcontrol,
+ int scope, const char *temp_path, TERMID term)
{
{
- RSET rnew = rset_create_base(&control, nmem, kcontrol, scope,term);
- struct rset_temp_info *info;
+ RSET rnew = rset_create_base(&control, nmem, kcontrol, scope, term,
+ 0, 0);
+ struct rset_private *info;
if (!log_level_initialized)
{
log_level = yaz_log_module_level("rstemp");
log_level_initialized = 1;
}
if (!log_level_initialized)
{
log_level = yaz_log_module_level("rstemp");
log_level_initialized = 1;
}
- info = (struct rset_temp_info *) nmem_malloc(rnew->nmem, sizeof(*info));
+ info = (struct rset_private *) nmem_malloc(rnew->nmem, sizeof(*info));
info->fd = -1;
info->fname = NULL;
info->buf_size = 4096;
info->fd = -1;
info->fname = NULL;
info->buf_size = 4096;
@@
-113,7
+112,7
@@
RSET rstemp_create( NMEM nmem, const struct key_control *kcontrol,
static void r_delete(RSET ct)
{
static void r_delete(RSET ct)
{
- struct rset_temp_info *info = (struct rset_temp_info*) ct->priv;
+ struct rset_private *info = (struct rset_private*) ct->priv;
yaz_log(log_level, "r_delete: set size %ld", (long) info->pos_end);
if (info->fname)
yaz_log(log_level, "r_delete: set size %ld", (long) info->pos_end);
if (info->fname)
@@
-125,9
+124,9
@@
static void r_delete(RSET ct)
static RSFD r_open(RSET ct, int flag)
{
static RSFD r_open(RSET ct, int flag)
{
- struct rset_temp_info *info = (struct rset_temp_info *) ct->priv;
+ struct rset_private *info = (struct rset_private *) ct->priv;
RSFD rfd;
RSFD rfd;
- struct rset_temp_rfd *prfd;
+ struct rfd_private *prfd;
if (info->fd == -1 && info->fname)
{
if (info->fd == -1 && info->fname)
{
@@
-144,7
+143,7
@@
static RSFD r_open(RSET ct, int flag)
rfd = rfd_create_base(ct);
if (!rfd->priv)
{
rfd = rfd_create_base(ct);
if (!rfd->priv)
{
- prfd = (struct rset_temp_rfd *) nmem_malloc(ct->nmem, sizeof(*prfd));
+ prfd = (struct rfd_private *) nmem_malloc(ct->nmem, sizeof(*prfd));
rfd->priv = (void *)prfd;
prfd->buf = nmem_malloc(ct->nmem,ct->keycontrol->key_size);
}
rfd->priv = (void *)prfd;
prfd->buf = nmem_malloc(ct->nmem,ct->keycontrol->key_size);
}
@@
-163,8
+162,7
@@
static RSFD r_open(RSET ct, int flag)
*/
static void r_flush(RSFD rfd, int mk)
{
*/
static void r_flush(RSFD rfd, int mk)
{
- /* struct rset_temp_info *info = ((struct rset_temp_rfd*) rfd)->info; */
- struct rset_temp_info *info = rfd->rset->priv;
+ struct rset_private *info = rfd->rset->priv;
if (!info->fname && mk)
{
if (!info->fname && mk)
{
@@
-224,8
+222,7
@@
static void r_flush(RSFD rfd, int mk)
static void r_close(RSFD rfd)
{
static void r_close(RSFD rfd)
{
- /*struct rset_temp_rfd *mrfd = (struct rset_temp_rfd*) rfd->priv; */
- struct rset_temp_info *info = (struct rset_temp_info *)rfd->rset->priv;
+ struct rset_private *info = (struct rset_private *)rfd->rset->priv;
if (rfd_is_last(rfd))
{
r_flush(rfd, 0);
if (rfd_is_last(rfd))
{
r_flush(rfd, 0);
@@
-235,7
+232,6
@@
static void r_close(RSFD rfd)
info->fd = -1;
}
}
info->fd = -1;
}
}
- rfd_delete_base(rfd);
}
}
@@
-245,8
+241,8
@@
static void r_close(RSFD rfd)
*/
static void r_reread(RSFD rfd)
{
*/
static void r_reread(RSFD rfd)
{
- struct rset_temp_rfd *mrfd = (struct rset_temp_rfd*) rfd->priv;
- struct rset_temp_info *info = (struct rset_temp_info *)rfd->rset->priv;
+ struct rfd_private *mrfd = (struct rfd_private*) rfd->priv;
+ struct rset_private *info = (struct rset_private *)rfd->rset->priv;
if (info->fname)
{
if (info->fname)
{
@@
-282,8
+278,8
@@
static void r_reread(RSFD rfd)
static int r_read(RSFD rfd, void *buf, TERMID *term)
{
static int r_read(RSFD rfd, void *buf, TERMID *term)
{
- struct rset_temp_rfd *mrfd = (struct rset_temp_rfd*) rfd->priv;
- struct rset_temp_info *info = (struct rset_temp_info *)rfd->rset->priv;
+ struct rfd_private *mrfd = (struct rfd_private*) rfd->priv;
+ struct rset_private *info = (struct rset_private *)rfd->rset->priv;
size_t nc = mrfd->pos_cur + rfd->rset->keycontrol->key_size;
size_t nc = mrfd->pos_cur + rfd->rset->keycontrol->key_size;
@@
-307,8
+303,8
@@
static int r_read(RSFD rfd, void *buf, TERMID *term)
static int r_write(RSFD rfd, const void *buf)
{
static int r_write(RSFD rfd, const void *buf)
{
- struct rset_temp_rfd *mrfd = (struct rset_temp_rfd*) rfd->priv;
- struct rset_temp_info *info = (struct rset_temp_info *)rfd->rset->priv;
+ struct rfd_private *mrfd = (struct rfd_private*) rfd->priv;
+ struct rset_private *info = (struct rset_private *)rfd->rset->priv;
size_t nc = mrfd->pos_cur + rfd->rset->keycontrol->key_size;
size_t nc = mrfd->pos_cur + rfd->rset->keycontrol->key_size;
@@
-331,9
+327,8
@@
static int r_write(RSFD rfd, const void *buf)
static void r_pos(RSFD rfd, double *current, double *total)
{
static void r_pos(RSFD rfd, double *current, double *total)
{
- /* struct rset_temp_rfd *mrfd = (struct rset_temp_rfd*) rfd; */
- struct rset_temp_rfd *mrfd = (struct rset_temp_rfd*) rfd->priv;
- struct rset_temp_info *info = (struct rset_temp_info *)rfd->rset->priv;
+ struct rfd_private *mrfd = (struct rfd_private*) rfd->priv;
+ struct rset_private *info = (struct rset_private *)rfd->rset->priv;
*current = (double) mrfd->cur;
*total = (double) info->hits;
*current = (double) mrfd->cur;
*total = (double) info->hits;