Set log levels to decent values
[idzebra-moved-to-github.git] / isamc / isamd.c
1 /*
2  * Copyright (c) 1995-1998, Index Data.
3  * See the file LICENSE for details.
4  * $Id: isamd.c,v 1.8 1999-08-18 13:28:16 heikki Exp $ 
5  *
6  * Isamd - isam with diffs 
7  * Programmed by: Heikki Levanto
8  *
9  * Todo
10  *  - Statistics are missing and/or completely wrong
11  *  - Lots of code stolen from isamc, not all needed any more
12  */
13
14
15 #include <stdlib.h>
16 #include <assert.h>
17 #include <string.h>
18 #include <stdio.h>
19
20 #include <log.h>
21 #include "../index/index.h"  /* isamd uses the internal structure of it_key */
22 #include "isamd-p.h"
23
24 static void flush_block (ISAMD is, int cat);
25 static void release_fc (ISAMD is, int cat);
26 static void init_fc (ISAMD is, int cat);
27
28 #define ISAMD_FREELIST_CHUNK 1
29
30 #define SMALL_TEST 1
31
32 ISAMD_M isamd_getmethod (ISAMD_M me)
33 {
34     static struct ISAMD_filecat_s def_cat[] = {
35 #if SMALL_TEST
36 /*        blocksz,   max. Unused time being */
37         {    20,   40 },
38         {    32,    0 },
39 #else
40         {    24,    1 },
41         {    32,    1 },
42         {    64,    1 },
43         {   128,    1 },
44         {   256,    1 },
45         {  1024,    1 },
46         {  2048,    0 },
47 #endif 
48
49 /* old values from isamc, long time ago...
50         {    24,   40 },
51         {   128,  256 },
52         {   512, 1024 },
53         {  2048, 4096 },
54         {  8192,16384 },
55         { 32768,   0  },
56 */
57
58     };
59     ISAMD_M m = (ISAMD_M) xmalloc (sizeof(*m));  /* never released! */
60     m->filecat = def_cat;                        /* ok, only alloc'd once */
61
62     m->code_start = NULL;
63     m->code_item = NULL;
64     m->code_stop = NULL;
65     m->code_reset = NULL;
66
67     m->compare_item = NULL;
68
69     m->debug = 0; /* default to no debug */
70
71     m->max_blocks_mem = 10;
72
73     return m;
74 }
75
76
77
78 ISAMD isamd_open (BFiles bfs, const char *name, int writeflag, ISAMD_M method)
79 {
80     ISAMD is;
81     ISAMD_filecat filecat;
82     int i = 0;
83
84     is = (ISAMD) xmalloc (sizeof(*is));
85
86     is->method = (ISAMD_M) xmalloc (sizeof(*is->method));
87     memcpy (is->method, method, sizeof(*method));
88     filecat = is->method->filecat;
89     assert (filecat);
90
91     /* determine number of block categories */
92     if (is->method->debug>0)
93         logf (LOG_LOG, "isamd: bsize  maxkeys");
94     do
95     {
96         if (is->method->debug>0)
97             logf (LOG_LOG, "isamd:%6d %6d",
98                   filecat[i].bsize, filecat[i].mblocks);
99     } while (filecat[i++].mblocks);
100     is->no_files = i;
101     is->max_cat = --i;
102  
103     assert (is->no_files > 0);
104     assert (is->max_cat <=8 ); /* we have only 3 bits for it */
105     
106     is->files = (ISAMD_file) xmalloc (sizeof(*is->files)*is->no_files);
107
108     for (i = 0; i<is->no_files; i++)
109     {
110         char fname[512];
111
112         sprintf (fname, "%s%c", name, i+'A');
113         is->files[i].bf = bf_open (bfs, fname, is->method->filecat[i].bsize,
114                                    writeflag);
115         is->files[i].head_is_dirty = 0;
116         if (!bf_read (is->files[i].bf, 0, 0, sizeof(ISAMD_head),
117                      &is->files[i].head))
118         {
119             is->files[i].head.lastblock = 1;
120             is->files[i].head.freelist = 0;
121         }
122         is->files[i].alloc_entries_num = 0;
123         is->files[i].alloc_entries_max =
124             is->method->filecat[i].bsize / sizeof(int) - 1;
125         is->files[i].alloc_buf = (char *)
126             xmalloc (is->method->filecat[i].bsize);
127         is->files[i].no_writes = 0; /* clear statistics */
128         is->files[i].no_reads = 0;
129         is->files[i].no_skip_writes = 0;
130         is->files[i].no_allocated = 0;
131         is->files[i].no_released = 0;
132         is->files[i].no_remap = 0;
133         is->files[i].no_forward = 0;
134         is->files[i].no_backward = 0;
135         is->files[i].sum_forward = 0;
136         is->files[i].sum_backward = 0;
137         is->files[i].no_next = 0;
138         is->files[i].no_prev = 0;
139
140         init_fc (is, i);
141     }
142     return is;
143 }
144
145 int isamd_block_used (ISAMD is, int type)
146 {
147     if (type < 0 || type >= is->no_files)
148         return -1;
149     return is->files[type].head.lastblock-1;
150 }
151
152 int isamd_block_size (ISAMD is, int type)
153 {
154     ISAMD_filecat filecat = is->method->filecat;
155     if (type < 0 || type >= is->no_files)
156         return -1;
157     return filecat[type].bsize;
158 }
159
160 int isamd_close (ISAMD is)
161 {
162     int i;
163
164     if (is->method->debug>0)
165     {
166         logf (LOG_LOG, "isamd:    next    forw   mid-f    prev   backw   mid-b");
167         for (i = 0; i<is->no_files; i++)
168             logf (LOG_LOG, "isamd:%8d%8d%8.1f%8d%8d%8.1f",
169                   is->files[i].no_next,
170                   is->files[i].no_forward,
171                   is->files[i].no_forward ?
172                   (double) is->files[i].sum_forward/is->files[i].no_forward
173                   : 0.0,
174                   is->files[i].no_prev,
175                   is->files[i].no_backward,
176                   is->files[i].no_backward ?
177                   (double) is->files[i].sum_backward/is->files[i].no_backward
178                   : 0.0);
179     }
180     if (is->method->debug>0)
181         logf (LOG_LOG, "isamd:  writes   reads skipped   alloc released  remap");
182     for (i = 0; i<is->no_files; i++)
183     {
184         release_fc (is, i);
185         assert (is->files[i].bf);
186         if (is->files[i].head_is_dirty)
187             bf_write (is->files[i].bf, 0, 0, sizeof(ISAMD_head),
188                  &is->files[i].head);
189         if (is->method->debug>0)
190             logf (LOG_LOG, "isamd:%8d%8d%8d%8d%8d%8d",
191                   is->files[i].no_writes,
192                   is->files[i].no_reads,
193                   is->files[i].no_skip_writes,
194                   is->files[i].no_allocated,
195                   is->files[i].no_released,
196                   is->files[i].no_remap);
197         xfree (is->files[i].fc_list);
198         flush_block (is, i);
199         bf_close (is->files[i].bf);
200     }
201     xfree (is->files);
202     xfree (is->method);
203     xfree (is);
204     return 0;
205 }
206
207 int isamd_read_block (ISAMD is, int cat, int pos, char *dst)
208 {
209     ++(is->files[cat].no_reads);
210     if (is->method->debug > 6)
211         logf (LOG_LOG, "isamd: read_block %d %d", cat, pos);
212     return bf_read (is->files[cat].bf, pos, 0, 0, dst);
213 }
214
215 int isamd_write_block (ISAMD is, int cat, int pos, char *src)
216 {
217     ++(is->files[cat].no_writes);
218     if (is->method->debug > 6)
219         logf (LOG_LOG, "isamd: write_block %d %d", cat, pos);
220     return bf_write (is->files[cat].bf, pos, 0, 0, src);
221 }
222
223 int isamd_write_dblock (ISAMD is, int cat, int pos, char *src,
224                       int nextpos, int offset)
225 {
226     ISAMD_BLOCK_SIZE size = offset + ISAMD_BLOCK_OFFSET_N;
227     if (is->method->debug > 4)
228         logf (LOG_LOG, "isamd: write_dblock. size=%d nextpos=%d",
229               (int) size, nextpos);
230     src -= ISAMD_BLOCK_OFFSET_N;
231     assert( ISAMD_BLOCK_OFFSET_N == sizeof(int)+sizeof(int) );
232     memcpy (src, &nextpos, sizeof(int));
233     memcpy (src + sizeof(int), &size, sizeof(size));
234     return isamd_write_block (is, cat, pos, src);
235 }
236
237 #if ISAMD_FREELIST_CHUNK
238 static void flush_block (ISAMD is, int cat)
239 {
240     char *abuf = is->files[cat].alloc_buf;
241     int block = is->files[cat].head.freelist;
242     if (block && is->files[cat].alloc_entries_num)
243     {
244         memcpy (abuf, &is->files[cat].alloc_entries_num, sizeof(int));
245         bf_write (is->files[cat].bf, block, 0, 0, abuf);
246         is->files[cat].alloc_entries_num = 0;
247     }
248     xfree (abuf);
249 }
250
251 static int alloc_block (ISAMD is, int cat)
252 {
253     int block = is->files[cat].head.freelist;
254     char *abuf = is->files[cat].alloc_buf;
255
256     (is->files[cat].no_allocated)++;
257
258     if (!block)
259     {
260         block = (is->files[cat].head.lastblock)++;   /* no free list */
261         is->files[cat].head_is_dirty = 1;
262     }
263     else
264     {
265         if (!is->files[cat].alloc_entries_num) /* read first time */
266         {
267             bf_read (is->files[cat].bf, block, 0, 0, abuf);
268             memcpy (&is->files[cat].alloc_entries_num, abuf,
269                     sizeof(is->files[cat].alloc_entries_num));
270             assert (is->files[cat].alloc_entries_num > 0);
271         }
272         /* have some free blocks now */
273         assert (is->files[cat].alloc_entries_num > 0);
274         is->files[cat].alloc_entries_num--;
275         if (!is->files[cat].alloc_entries_num)  /* last one in block? */
276         {
277             memcpy (&is->files[cat].head.freelist, abuf + sizeof(int),
278                     sizeof(int));
279             is->files[cat].head_is_dirty = 1;
280
281             if (is->files[cat].head.freelist)
282             {
283                 bf_read (is->files[cat].bf, is->files[cat].head.freelist,
284                          0, 0, abuf);
285                 memcpy (&is->files[cat].alloc_entries_num, abuf,
286                         sizeof(is->files[cat].alloc_entries_num));
287                 assert (is->files[cat].alloc_entries_num);
288             }
289         }
290         else
291             memcpy (&block, abuf + sizeof(int) + sizeof(int) *
292                     is->files[cat].alloc_entries_num, sizeof(int));
293     }
294     return block;
295 }
296
297 static void release_block (ISAMD is, int cat, int pos)
298 {
299     char *abuf = is->files[cat].alloc_buf;
300     int block = is->files[cat].head.freelist;
301
302     (is->files[cat].no_released)++;
303
304     if (block && !is->files[cat].alloc_entries_num) /* must read block */
305     {
306         bf_read (is->files[cat].bf, block, 0, 0, abuf);
307         memcpy (&is->files[cat].alloc_entries_num, abuf,
308                 sizeof(is->files[cat].alloc_entries_num));
309         assert (is->files[cat].alloc_entries_num > 0);
310     }
311     assert (is->files[cat].alloc_entries_num <= is->files[cat].alloc_entries_max);
312     if (is->files[cat].alloc_entries_num == is->files[cat].alloc_entries_max)
313     {
314         assert (block);
315         memcpy (abuf, &is->files[cat].alloc_entries_num, sizeof(int));
316         bf_write (is->files[cat].bf, block, 0, 0, abuf);
317         is->files[cat].alloc_entries_num = 0;
318     }
319     if (!is->files[cat].alloc_entries_num) /* make new buffer? */
320     {
321         memcpy (abuf + sizeof(int), &block, sizeof(int));
322         is->files[cat].head.freelist = pos;
323         is->files[cat].head_is_dirty = 1; 
324     }
325     else
326     {
327         memcpy (abuf + sizeof(int) +
328                 is->files[cat].alloc_entries_num*sizeof(int),
329                 &pos, sizeof(int));
330     }
331     is->files[cat].alloc_entries_num++;
332 }
333 #else
334 static void flush_block (ISAMD is, int cat)
335 {
336     char *abuf = is->files[cat].alloc_buf;
337     xfree (abuf);
338 }
339
340 static int alloc_block (ISAMD is, int cat)
341 {
342     int block;
343     char buf[sizeof(int)];
344
345     is->files[cat].head_is_dirty = 1;
346     (is->files[cat].no_allocated)++;
347     if ((block = is->files[cat].head.freelist))
348     {
349         bf_read (is->files[cat].bf, block, 0, sizeof(int), buf);
350         memcpy (&is->files[cat].head.freelist, buf, sizeof(int));
351     }
352     else
353         block = (is->files[cat].head.lastblock)++;
354     return block;
355 }
356
357 static void release_block (ISAMD is, int cat, int pos)
358 {
359     char buf[sizeof(int)];
360    
361     (is->files[cat].no_released)++;
362     is->files[cat].head_is_dirty = 1; 
363     memcpy (buf, &is->files[cat].head.freelist, sizeof(int));
364     is->files[cat].head.freelist = pos;
365     bf_write (is->files[cat].bf, pos, 0, sizeof(int), buf);
366 }
367 #endif
368
369 int isamd_alloc_block (ISAMD is, int cat)
370 {
371     int block = 0;
372
373     if (is->files[cat].fc_list)
374     {
375         int j, nb;
376         for (j = 0; j < is->files[cat].fc_max; j++)
377             if ((nb = is->files[cat].fc_list[j]) && (!block || nb < block))
378             {
379                 is->files[cat].fc_list[j] = 0;
380                 block = nb;
381                 break;
382             }
383     }
384     if (!block)
385         block = alloc_block (is, cat);
386     if (is->method->debug > 4)
387         logf (LOG_LOG, "isamd: alloc_block in cat %d: %d", cat, block);
388     return block;
389 }
390
391 void isamd_release_block (ISAMD is, int cat, int pos)
392 {
393     if (is->method->debug > 4)
394         logf (LOG_LOG, "isamd: release_block in cat %d: %d", cat, pos);
395     assert(pos!=0);
396     
397     if (is->files[cat].fc_list)
398     {
399         int j;
400         for (j = 0; j<is->files[cat].fc_max; j++)
401             if (!is->files[cat].fc_list[j])
402             {
403                 is->files[cat].fc_list[j] = pos;
404                 return;
405             }
406     }
407     release_block (is, cat, pos);
408 }
409
410 static void init_fc (ISAMD is, int cat)
411 {
412     int j = 100;
413         
414     is->files[cat].fc_max = j;
415     is->files[cat].fc_list = (int *)
416         xmalloc (sizeof(*is->files[0].fc_list) * j);
417     while (--j >= 0)
418         is->files[cat].fc_list[j] = 0;
419 }
420
421 static void release_fc (ISAMD is, int cat)
422 {
423     int b, j = is->files[cat].fc_max;
424
425     while (--j >= 0)
426         if ((b = is->files[cat].fc_list[j]))
427         {
428             release_block (is, cat, b);
429             is->files[cat].fc_list[j] = 0;
430         }
431 }
432
433 void isamd_pp_close (ISAMD_PP pp)
434 {
435     ISAMD is = pp->is;
436
437     (*is->method->code_stop)(ISAMD_DECODE, pp->decodeClientData);
438     isamd_free_diffs(pp);  /* see merge-d.h */
439     xfree (pp->buf);
440     xfree (pp);
441     if (is->method->debug > 5)
442        logf (LOG_LOG, "isamd_pp_close %p %d=%d:%d  sz=%d n=%d=%d:%d",
443              pp, isamd_addr(pp->pos, pp->cat), pp->cat, pp->pos, pp->size, 
444              pp->next, isamd_type(pp->next), isamd_block(pp->next) );
445 }
446
447
448
449 ISAMD_PP isamd_pp_open (ISAMD is, ISAMD_P ipos)
450 {
451     ISAMD_PP pp = (ISAMD_PP) xmalloc (sizeof(*pp));
452     char *src;
453     int sz = is->method->filecat[is->max_cat].bsize;
454                  /* always allocate for the largest blocks, saves trouble */
455    
456     pp->cat = isamd_type(ipos);
457     pp->pos = isamd_block(ipos); 
458
459     src = pp->buf = (char *) xmalloc (sz);
460     memset(src,'\0',sz); /* clear the buffer, for new blocks */
461     
462     pp->next = 0;
463     pp->size = 0;
464     pp->offset = 0;
465     pp->is = is;
466     pp->decodeClientData = (*is->method->code_start)(ISAMD_DECODE);
467     pp->numKeys = 0;
468     pp->diffs=0;
469   
470     pp->diffbuf=0;
471     pp->diffinfo=0;
472     
473     if (pp->pos)
474     {
475         src = pp->buf;
476         isamd_read_block (is, pp->cat, pp->pos, src);
477         memcpy (&pp->next, src, sizeof(pp->next));
478         src += sizeof(pp->next);
479         memcpy (&pp->size, src, sizeof(pp->size));
480         src += sizeof(pp->size);
481         memcpy (&pp->numKeys, src, sizeof(pp->numKeys));
482         src += sizeof(pp->numKeys);
483         memcpy (&pp->diffs, src, sizeof(pp->diffs));
484         src += sizeof(pp->diffs);
485         assert (pp->next != pp->pos);
486         pp->offset = src - pp->buf; 
487         assert (pp->offset == ISAMD_BLOCK_OFFSET_1);
488     }
489     if (is->method->debug > 5)
490        logf (LOG_LOG, "isamd_pp_open  %p %d=%d:%d  sz=%d n=%d=%d:%d",
491              pp, isamd_addr(pp->pos, pp->cat), pp->cat, pp->pos, pp->size, 
492              pp->next, isamd_type(pp->next), isamd_block(pp->next) );
493     
494       
495     return pp;
496 }
497
498
499
500 void isamd_buildfirstblock(ISAMD_PP pp){
501   char *dst=pp->buf;
502   assert(pp->buf);
503   assert(pp->next != pp->pos); 
504   memcpy(dst, &pp->next, sizeof(pp->next) );
505   dst += sizeof(pp->next);
506   memcpy(dst, &pp->size,sizeof(pp->size));
507   dst += sizeof(pp->size);
508   memcpy(dst, &pp->numKeys, sizeof(pp->numKeys));
509   dst += sizeof(pp->numKeys);
510   memcpy(dst, &pp->diffs, sizeof(pp->diffs));
511   dst += sizeof(pp->diffs);  
512   assert (dst - pp->buf  == ISAMD_BLOCK_OFFSET_1);
513   if (pp->is->method->debug > 5)
514      logf (LOG_LOG, "isamd: first: sz=%d  p=%d/%d>%d/%d nk=%d d=%d",
515            pp->size, 
516            pp->cat, pp->pos, 
517            isamd_type(pp->next), isamd_block(pp->next),
518            pp->numKeys, pp->diffs);
519 }
520
521 void isamd_buildlaterblock(ISAMD_PP pp){
522   char *dst=pp->buf;
523   assert(pp->buf);
524   assert(pp->next != isamd_addr(pp->pos,pp->cat)); 
525   memcpy(dst, &pp->next, sizeof(pp->next) );
526   dst += sizeof(pp->next);
527   memcpy(dst, &pp->size,sizeof(pp->size));
528   dst += sizeof(pp->size);
529   assert (dst - pp->buf  == ISAMD_BLOCK_OFFSET_N);
530   if (pp->is->method->debug > 5)
531      logf (LOG_LOG, "isamd: l8r: sz=%d  p=%d/%d>%d/%d",
532            pp->size, 
533            pp->pos, pp->cat, 
534            isamd_block(pp->next), isamd_type(pp->next) );
535 }
536
537
538
539 /* returns non-zero if item could be read; 0 otherwise */
540 int isamd_pp_read (ISAMD_PP pp, void *buf)
541 {
542     return isamd_read_item (pp, (char **) &buf);
543     /* note: isamd_read_item is in merge-d.c, because it is so */
544     /* convoluted with the merge process */
545 }
546
547 /* read one main item from file - decode and store it in *dst.
548    Does not worry about diffs
549    Returns
550      0 if end-of-file
551      1 if item could be read ok
552 */
553 int isamd_read_main_item (ISAMD_PP pp, char **dst)
554 {
555     ISAMD is = pp->is;
556     char *src = pp->buf + pp->offset;
557     int newcat;
558
559     if (pp->offset >= pp->size)
560     {
561         if (!pp->next)
562         {
563             pp->pos = 0;
564             return 0; /* end of file */
565         }
566         if (pp->next > pp->pos)
567         {
568             if (pp->next == pp->pos + 1)
569                 is->files[pp->cat].no_next++;
570             else
571             {
572                 is->files[pp->cat].no_forward++;
573                 is->files[pp->cat].sum_forward += pp->next - pp->pos;
574             }
575         }
576         else
577         {
578             if (pp->next + 1 == pp->pos)
579                 is->files[pp->cat].no_prev++;
580             else
581             {
582                 is->files[pp->cat].no_backward++;
583                 is->files[pp->cat].sum_backward += pp->pos - pp->next;
584             }
585         }
586         /* out new block position */
587         newcat = isamd_type(pp->next);
588         pp->pos = isamd_block(pp->next);
589         pp->cat = isamd_type(pp->next);
590         
591         src = pp->buf;
592         /* read block and save 'next' and 'size' entry */
593         isamd_read_block (is, pp->cat, pp->pos, src);
594         memcpy (&pp->next, src, sizeof(pp->next));
595         src += sizeof(pp->next);
596         memcpy (&pp->size, src, sizeof(pp->size));
597         src += sizeof(pp->size);
598         /* assume block is non-empty */
599         assert (src - pp->buf == ISAMD_BLOCK_OFFSET_N);
600         assert (pp->next != isamd_addr(pp->pos,pp->cat));
601         (*is->method->code_reset)(pp->decodeClientData);
602         (*is->method->code_item)(ISAMD_DECODE, pp->decodeClientData, dst, &src);
603         pp->offset = src - pp->buf; 
604         if (is->method->debug > 4)
605             logf (LOG_LOG, "isamd: read_block size=%d %d %d next=%d",
606                  pp->size, pp->cat, pp->pos, pp->next);
607         return 2;
608     }
609     (*is->method->code_item)(ISAMD_DECODE, pp->decodeClientData, dst, &src);
610     pp->offset = src - pp->buf; 
611     return 1;
612 }
613
614 int isamd_pp_num (ISAMD_PP pp)
615 {
616     return pp->numKeys;
617 }
618
619 static char *hexdump(unsigned char *p, int len, char *buff) {
620   static char localbuff[128];
621   char bytebuff[8];
622   if (!buff) buff=localbuff;
623   *buff='\0';
624   while (len--) {
625     sprintf(bytebuff,"%02x",*p);
626     p++;
627     strcat(buff,bytebuff);
628     if (len) strcat(buff," ");
629   }
630   return buff;
631 }
632
633
634 void isamd_pp_dump (ISAMD is, ISAMD_P ipos)
635 {
636   ISAMD_PP pp;
637   ISAMD_P oldaddr=0;
638   struct it_key key;
639   int i,n;
640   int occur =0;
641   int oldoffs;
642   char hexbuff[64];
643   
644   logf(LOG_LOG,"dumping isamd block %d (%d:%d)",
645                   (int)ipos, isamd_type(ipos), isamd_block(ipos) );
646   pp=isamd_pp_open(is,ipos);
647   logf(LOG_LOG,"numKeys=%d,  ofs=%d d=%d",
648        pp->numKeys, 
649        pp->offset, pp->diffs);
650   oldoffs= pp->offset;
651   while(isamd_pp_read(pp, &key))
652   {
653      if (oldaddr != isamd_addr(pp->pos,pp->cat) )
654      {
655         oldaddr = isamd_addr(pp->pos,pp->cat); 
656         logf(LOG_LOG,"block %d (%d:%d) sz=%d nx=%d (%d:%d) ofs=%d",
657                   isamd_addr(pp->pos,pp->cat), 
658                   pp->cat, pp->pos, pp->size,
659                   pp->next, isamd_type(pp->next), isamd_block(pp->next),
660                   pp->offset);
661         i=0;      
662         while (i<pp->size) {
663           n=pp->size-i;
664           if (n>8) n=8;
665           logf(LOG_LOG,"  %05x: %s",i,hexdump(pp->buf+i,n,hexbuff));
666           i+=n;
667         }
668         if (oldoffs >  ISAMD_BLOCK_OFFSET_N)
669            oldoffs=ISAMD_BLOCK_OFFSET_N;
670      } /* new block */
671      occur++;
672      logf (LOG_LOG,"    got %d:%d=%x:%x from %s at %d=%x",
673                   key.sysno, key.seqno,
674                   key.sysno, key.seqno,
675                   hexdump(pp->buf+oldoffs, pp->offset-oldoffs, hexbuff),
676                   oldoffs, oldoffs);
677      oldoffs = pp->offset;
678   }
679   /*!*/ /*TODO: dump diffs too!!! */
680   isamd_pp_close(pp);
681 } /* dump */
682
683 /*
684  * $Log: isamd.c,v $
685  * Revision 1.8  1999-08-18 13:28:16  heikki
686  * Set log levels to decent values
687  *
688  * Revision 1.6  1999/08/17 19:44:25  heikki
689  * Fixed memory leaks
690  *
691  * Revision 1.4  1999/08/04 14:21:18  heikki
692  * isam-d seems to be working.
693  *
694  * Revision 1.3  1999/07/21 14:24:50  heikki
695  * isamd write and read functions ok, except when diff block full.
696  * (merge not yet done)
697  *
698  * Revision 1.1  1999/07/14 12:34:43  heikki
699  * Copied from isamh, starting to change things...
700  *
701  *
702  */