/*
- * Copyright (C) 1994-1995, Index Data I/S
+ * Copyright (C) 1994-1996, Index Data I/S
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zserver.c,v $
- * Revision 1.35 1996-03-26 16:01:14 adam
+ * Revision 1.38 1996-05-14 11:34:01 adam
+ * Scan support in multiple registers/databases.
+ *
+ * Revision 1.37 1996/05/14 06:16:48 adam
+ * Compact use/set bytes used in search service.
+ *
+ * Revision 1.36 1996/05/01 13:46:37 adam
+ * First work on multiple records in one file.
+ * New option, -offset, to the "unread" command in the filter module.
+ *
+ * Revision 1.35 1996/03/26 16:01:14 adam
* New setting lockPath: directory of various lock files.
*
* Revision 1.34 1996/03/20 09:36:46 adam
zi->registerChange = lastChange;
if (zi->records)
{
+ zebTargetInfo_close (zi->zti, 0);
dict_close (zi->wordDict);
is_close (zi->wordIsam);
rec_close (&zi->records);
if (!(zi->wordIsam = is_open (FNAME_WORD_ISAM, key_compare, 0,
sizeof (struct it_key))))
return -1;
+ zi->zti = zebTargetInfo_open (zi->records, 0);
return 0;
}
return &r;
}
+static int record_offset;
+
static int record_ext_read (void *fh, char *buf, size_t count)
{
return read (*((int*) fh), buf, count);
}
+static off_t record_ext_seek (void *fh, off_t offset)
+{
+ return lseek (*((int*) fh), offset + record_offset, SEEK_SET);
+}
+
static int record_int_pos;
static char *record_int_buf;
static int record_int_len;
+static off_t record_int_seek (void *fh, off_t offset)
+{
+ return (off_t) (record_int_pos = offset);
+}
+
static int record_int_read (void *fh, char *buf, size_t count)
{
int l = record_int_len - record_int_pos;
if (rec->size[recInfo_storeData] > 0)
{
retrieveCtrl.readf = record_int_read;
+ retrieveCtrl.seekf = record_int_seek;
record_int_len = rec->size[recInfo_storeData];
record_int_buf = rec->info[recInfo_storeData];
record_int_pos = 0;
rec_rm (&rec);
return 0; /* or 14: System error in presenting records */
}
+
+ memcpy (&record_offset, rec->info[recInfo_offset],
+ sizeof(record_offset));
+
retrieveCtrl.fh = &fd;
retrieveCtrl.readf = record_ext_read;
+ retrieveCtrl.seekf = record_ext_seek;
+
+ record_ext_seek (retrieveCtrl.fh, 0);
}
retrieveCtrl.subType = subType;
retrieveCtrl.localno = sysno;
r.term_position = q->term_position;
r.num_entries = q->num_entries;
r.errcode = rpn_scan (&server_info, q->term,
+ q->attributeset,
q->num_bases, q->basenames,
&r.term_position,
&r.num_entries, &r.entries, &status);