* Sebastian Hammer, Adam Dickmeiss
*
* $Log: isams.c,v $
- * Revision 1.1 1999-05-12 13:08:06 adam
+ * Revision 1.5 1999-07-14 10:59:27 adam
+ * Changed functions isc_getmethod, isams_getmethod.
+ * Improved fatal error handling (such as missing EXPLAIN schema).
+ *
+ * Revision 1.4 1999/05/26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.3 1999/05/20 12:57:18 adam
+ * Implemented TCL filter. Updated recctrl system.
+ *
+ * Revision 1.2 1999/05/15 14:35:48 adam
+ * Minor changes.
+ *
+ * Revision 1.1 1999/05/12 13:08:06 adam
* First version of ISAMS.
*
*/
char *merge_buf;
int block_size;
+ int debug;
BFile bf;
};
int numRead;
};
-ISAMS_M isams_getmethod (void)
+void isams_getmethod (ISAMS_M m)
{
- ISAMS_M m = xmalloc (sizeof(*m));
-
m->code_start = NULL;
m->code_item = NULL;
m->code_stop = NULL;
m->debug = 1;
m->block_size = 128;
-
- return m;
}
ISAMS isams_open (BFiles bfs, const char *name, int writeflag,
ISAMS_M method)
{
- ISAMS is = xmalloc (sizeof(*is));
+ ISAMS is = (ISAMS) xmalloc (sizeof(*is));
- is->method = xmalloc (sizeof(*is->method));
+ is->method = (ISAMS_M) xmalloc (sizeof(*is->method));
memcpy (is->method, method, sizeof(*method));
is->block_size = is->method->block_size;
+ is->debug = is->method->debug;
is->bf = bf_open (bfs, name, is->block_size, writeflag);
is->head.last_offset = 0;
}
memcpy (&is->head_old, &is->head, sizeof(is->head));
- is->merge_buf = xmalloc(2*is->block_size);
+ is->merge_buf = (char *) xmalloc(2*is->block_size);
memset(is->merge_buf, 0, 2*is->block_size);
return is;
}
is->head.last_offset += sizeof(int);
if (is->head.last_offset > is->block_size)
{
- logf (LOG_LOG, "first_block=%d", first_block);
+ if (is->debug > 2)
+ logf (LOG_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;
assert (gap <= (int) sizeof(int));
if (gap > 0)
{
- if (gap < sizeof(int))
+ if (gap < (int) sizeof(int))
bf_write(is->bf, first_block, first_offset, sizeof(int)-gap,
&count);
memcpy (is->merge_buf, ((char*)&count)+(sizeof(int)-gap), gap);
ISAMS_PP isams_pp_open (ISAMS is, ISAMS_P pos)
{
- ISAMS_PP pp = xmalloc (sizeof(*pp));
+ ISAMS_PP pp = (ISAMS_PP) xmalloc (sizeof(*pp));
- logf (LOG_LOG, "isams: isams_pp_open pos=%ld", (long) pos);
+ if (is->debug > 1)
+ logf (LOG_LOG, "isams: isams_pp_open pos=%ld", (long) pos);
pp->is = is;
pp->decodeClientData = (*is->method->code_start)(ISAMC_DECODE);
pp->numKeys = 0;
pp->numRead = 0;
- pp->buf = xmalloc(is->block_size*2);
+ pp->buf = (char *) xmalloc(is->block_size*2);
pp->block_no = pos/is->block_size;
pp->block_offset = pos - pp->block_no * is->block_size;
logf (LOG_LOG, "isams: isams_pp_open off=%d no=%d",