First version of ISAMS.
[idzebra-moved-to-github.git] / index / kinput.c
1 /*
2  * Copyright (C) 1994-1999, Index Data
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: kinput.c,v $
7  * Revision 1.32  1999-05-12 13:08:06  adam
8  * First version of ISAMS.
9  *
10  * Revision 1.31  1999/02/02 14:50:56  adam
11  * Updated WIN32 code specific sections. Changed header.
12  *
13  * Revision 1.30  1998/10/28 10:53:57  adam
14  * Added type cast to prevent warning.
15  *
16  * Revision 1.29  1998/06/11 15:41:39  adam
17  * Minor changes.
18  *
19  * Revision 1.28  1998/03/05 08:45:12  adam
20  * New result set model and modular ranking system. Moved towards
21  * descent server API. System information stored as "SGML" records.
22  *
23  * Revision 1.27  1998/02/17 10:32:52  adam
24  * Fixed bug: binary files weren't opened with flag b on NT.
25  *
26  * Revision 1.26  1998/01/29 13:39:13  adam
27  * Compress ISAM is default.
28  *
29  * Revision 1.25  1997/09/17 12:19:14  adam
30  * Zebra version corresponds to YAZ version 1.4.
31  * Changed Zebra server so that it doesn't depend on global common_resource.
32  *
33  * Revision 1.24  1997/09/09 13:38:07  adam
34  * Partial port to WIN95/NT.
35  *
36  * Revision 1.23  1997/09/04 13:57:39  adam
37  * Added O_BINARY for open calls.
38  *
39  * Revision 1.22  1997/02/12 20:39:45  adam
40  * Implemented options -f <n> that limits the log to the first <n>
41  * records.
42  * Changed some log messages also.
43  *
44  * Revision 1.21  1996/11/08 11:10:23  adam
45  * Buffers used during file match got bigger.
46  * Compressed ISAM support everywhere.
47  * Bug fixes regarding masking characters in queries.
48  * Redesigned Regexp-2 queries.
49  *
50  * Revision 1.20  1996/11/01 08:58:41  adam
51  * Interface to isamc system now includes update and delete.
52  *
53  * Revision 1.19  1996/10/29 14:09:46  adam
54  * Use of cisam system - enabled if setting isamc is 1.
55  *
56  * Revision 1.18  1996/06/04 10:18:59  adam
57  * Minor changes - removed include of ctype.h.
58  *
59  * Revision 1.17  1996/05/14  15:47:07  adam
60  * Cleanup of various buffer size entities.
61  *
62  * Revision 1.16  1996/04/09  10:05:20  adam
63  * Bug fix: prev_name buffer possibly too small; allocated in key_file_init.
64  *
65  * Revision 1.15  1996/03/21  14:50:09  adam
66  * File update uses modify-time instead of change-time.
67  *
68  * Revision 1.14  1996/02/07  14:06:37  adam
69  * Better progress report during register merge.
70  * New command: clean - removes temporary shadow files.
71  *
72  * Revision 1.13  1996/02/05  12:30:00  adam
73  * Logging reduced a bit.
74  * The remaining running time is estimated during register merge.
75  *
76  * Revision 1.12  1995/12/06  17:49:19  adam
77  * Uses dict_delete now.
78  *
79  * Revision 1.11  1995/12/06  16:06:43  adam
80  * Better diagnostics. Work on 'real' dictionary deletion.
81  *
82  * Revision 1.10  1995/12/06  12:41:22  adam
83  * New command 'stat' for the index program.
84  * Filenames can be read from stdin by specifying '-'.
85  * Bug fix/enhancement of the transformation from terms to regular
86  * expressons in the search engine.
87  *
88  * Revision 1.9  1995/10/10  12:24:39  adam
89  * Temporary sort files are compressed.
90  *
91  * Revision 1.8  1995/10/04  16:57:19  adam
92  * Key input and merge sort in one pass.
93  *
94  * Revision 1.7  1995/10/02  15:18:52  adam
95  * New member in recRetrieveCtrl: diagnostic.
96  *
97  * Revision 1.6  1995/09/29  15:51:56  adam
98  * First work on multi-way read.
99  *
100  * Revision 1.5  1995/09/29  14:01:43  adam
101  * Bug fixes.
102  *
103  * Revision 1.4  1995/09/28  14:22:57  adam
104  * Sort uses smaller temporary files.
105  *
106  * Revision 1.3  1995/09/06  16:11:17  adam
107  * Option: only one word key per file.
108  *
109  * Revision 1.2  1995/09/04  12:33:42  adam
110  * Various cleanup. YAZ util used instead.
111  *
112  * Revision 1.1  1995/09/04  09:10:37  adam
113  * More work on index add/del/update.
114  * Merge sort implemented.
115  * Initial work on z39 server.
116  *
117  */
118
119 #include <fcntl.h>
120 #ifdef WIN32
121 #include <io.h>
122 #else
123 #include <unistd.h>
124 #endif
125 #include <stdlib.h>
126 #include <string.h>
127 #include <stdio.h>
128 #include <assert.h>
129
130 #include "index.h"
131
132 #define KEY_SIZE (1+sizeof(struct it_key))
133 #define INP_NAME_MAX 768
134 #define INP_BUF_START 60000
135 #define INP_BUF_ADD  400000
136
137 static int no_diffs   = 0;
138 static int no_updates = 0;
139 static int no_deletions = 0;
140 static int no_insertions = 0;
141 static int no_iterations = 0;
142
143 struct key_file {
144     int   no;            /* file no */
145     off_t offset;        /* file offset */
146     unsigned char *buf;  /* buffer block */
147     size_t buf_size;     /* number of read bytes in block */
148     size_t chunk;        /* number of bytes allocated */
149     size_t buf_ptr;      /* current position in buffer */
150     char *prev_name;     /* last word read */
151     int   sysno;         /* last sysno */
152     int   seqno;         /* last seqno */
153     off_t length;        /* length of file */
154                          /* handler invoked in each read */
155     void (*readHandler)(struct key_file *keyp, void *rinfo);
156     void *readInfo;
157 };
158
159 void getFnameTmp (char *fname, int no)
160 {
161     const char *pre;
162     
163     pre = res_get_def (common_resource, "keyTmpDir", ".");
164     sprintf (fname, "%s/key%d.tmp", pre, no);
165 }
166
167 void key_file_chunk_read (struct key_file *f)
168 {
169     int nr = 0, r = 0, fd;
170     char fname[1024];
171     getFnameTmp (fname, f->no);
172     fd = open (fname, O_BINARY|O_RDONLY);
173     if (fd == -1)
174     {
175         logf (LOG_FATAL|LOG_ERRNO, "cannot open %s", fname);
176         exit (1);
177     }
178     if (!f->length)
179     {
180         if ((f->length = lseek (fd, 0L, SEEK_END)) == (off_t) -1)
181         {
182             logf (LOG_FATAL|LOG_ERRNO, "cannot seek %s", fname);
183             exit (1);
184         }
185     }
186     if (lseek (fd, f->offset, SEEK_SET) == -1)
187     {
188         logf (LOG_FATAL|LOG_ERRNO, "cannot seek %s", fname);
189         exit (1);
190     }
191     while (f->chunk - nr > 0)
192     {
193         r = read (fd, f->buf + nr, f->chunk - nr);
194         if (r <= 0)
195             break;
196         nr += r;
197     }
198     if (r == -1)
199     {
200         logf (LOG_FATAL|LOG_ERRNO, "read of %s", fname);
201         exit (1);
202     }
203     f->buf_size = nr;
204     f->buf_ptr = 0;
205     if (f->readHandler)
206         (*f->readHandler)(f, f->readInfo);
207     close (fd);
208 }
209
210 struct key_file *key_file_init (int no, int chunk)
211 {
212     struct key_file *f;
213
214     f = xmalloc (sizeof(*f));
215     f->sysno = 0;
216     f->seqno = 0;
217     f->no = no;
218     f->chunk = chunk;
219     f->offset = 0;
220     f->length = 0;
221     f->readHandler = NULL;
222     f->buf = xmalloc (f->chunk);
223     f->prev_name = xmalloc (INP_NAME_MAX);
224     *f->prev_name = '\0';
225     key_file_chunk_read (f);
226     return f;
227 }
228
229 int key_file_getc (struct key_file *f)
230 {
231     if (f->buf_ptr < f->buf_size)
232         return f->buf[(f->buf_ptr)++];
233     if (f->buf_size < f->chunk)
234         return EOF;
235     f->offset += f->buf_size;
236     key_file_chunk_read (f);
237     if (f->buf_ptr < f->buf_size)
238         return f->buf[(f->buf_ptr)++];
239     else
240         return EOF;
241 }
242
243 int key_file_decode (struct key_file *f)
244 {
245     int c, d;
246
247     c = key_file_getc (f);
248     switch (c & 192) 
249     {
250     case 0:
251         d = c;
252         break;
253     case 64:
254         d = ((c&63) << 8) + (key_file_getc (f) & 0xff);
255         break;
256     case 128:
257         d = ((c&63) << 8) + (key_file_getc (f) & 0xff);
258         d = (d << 8) + (key_file_getc (f) & 0xff);
259         break;
260     case 192:
261         d = ((c&63) << 8) + (key_file_getc (f) & 0xff);
262         d = (d << 8) + (key_file_getc (f) & 0xff);
263         d = (d << 8) + (key_file_getc (f) & 0xff);
264         break;
265     }
266     return d;
267 }
268
269 int key_file_read (struct key_file *f, char *key)
270 {
271     int i, d, c;
272     struct it_key itkey;
273
274     c = key_file_getc (f);
275     if (c == 0)
276     {
277         strcpy (key, f->prev_name);
278         i = 1+strlen (key);
279     }
280     else if (c == EOF)
281         return 0;
282     else
283     {
284         i = 0;
285         key[i++] = c;
286         while ((key[i++] = key_file_getc (f)))
287             ;
288         strcpy (f->prev_name, key);
289         f->sysno = 0;
290     }
291     d = key_file_decode (f);
292     key[i++] = d & 1;
293     d = d >> 1;
294     itkey.sysno = d + f->sysno;
295     if (d) 
296     {
297         f->sysno = itkey.sysno;
298         f->seqno = 0;
299     }
300     d = key_file_decode (f);
301     itkey.seqno = d + f->seqno;
302     f->seqno = itkey.seqno;
303     memcpy (key + i, &itkey, sizeof(struct it_key));
304     return i + sizeof (struct it_key);
305 }
306
307 struct heap_info {
308     struct {
309         struct key_file **file;
310         char   **buf;
311     } info;
312     int    heapnum;
313     int    *ptr;
314     int    (*cmp)(const void *p1, const void *p2);
315     Dict dict;
316     ISAM isam;
317     ISAMC isamc;
318     ISAMS isams;
319 };
320
321 struct heap_info *key_heap_init (int nkeys,
322                                  int (*cmp)(const void *p1, const void *p2))
323 {
324     struct heap_info *hi;
325     int i;
326
327     hi = xmalloc (sizeof(*hi));
328     hi->info.file = xmalloc (sizeof(*hi->info.file) * (1+nkeys));
329     hi->info.buf = xmalloc (sizeof(*hi->info.buf) * (1+nkeys));
330     hi->heapnum = 0;
331     hi->ptr = xmalloc (sizeof(*hi->ptr) * (1+nkeys));
332     hi->cmp = cmp;
333     for (i = 0; i<= nkeys; i++)
334     {
335         hi->ptr[i] = i;
336         hi->info.buf[i] = xmalloc (INP_NAME_MAX);
337     }
338     return hi;
339 }
340
341 static void key_heap_swap (struct heap_info *hi, int i1, int i2)
342 {
343     int swap;
344
345     swap = hi->ptr[i1];
346     hi->ptr[i1] = hi->ptr[i2];
347     hi->ptr[i2] = swap;
348 }
349
350
351 static void key_heap_delete (struct heap_info *hi)
352 {
353     int cur = 1, child = 2;
354
355     assert (hi->heapnum > 0);
356
357     key_heap_swap (hi, 1, hi->heapnum);
358     hi->heapnum--;
359     while (child <= hi->heapnum) {
360         if (child < hi->heapnum &&
361             (*hi->cmp)(&hi->info.buf[hi->ptr[child]],
362                        &hi->info.buf[hi->ptr[child+1]]) > 0)
363             child++;
364         if ((*hi->cmp)(&hi->info.buf[hi->ptr[cur]],
365                        &hi->info.buf[hi->ptr[child]]) > 0)
366         {            
367             key_heap_swap (hi, cur, child);
368             cur = child;
369             child = 2*cur;
370         }
371         else
372             break;
373     }
374 }
375
376 static void key_heap_insert (struct heap_info *hi, const char *buf, int nbytes,
377                              struct key_file *kf)
378 {
379     int cur, parent;
380
381     cur = ++(hi->heapnum);
382     memcpy (hi->info.buf[hi->ptr[cur]], buf, nbytes);
383     hi->info.file[hi->ptr[cur]] = kf;
384
385     parent = cur/2;
386     while (parent && (*hi->cmp)(&hi->info.buf[hi->ptr[parent]],
387                                 &hi->info.buf[hi->ptr[cur]]) > 0)
388     {
389         key_heap_swap (hi, cur, parent);
390         cur = parent;
391         parent = cur/2;
392     }
393 }
394
395 static int heap_read_one (struct heap_info *hi, char *name, char *key)
396 {
397     int n, r;
398     char rbuf[INP_NAME_MAX];
399     struct key_file *kf;
400
401     if (!hi->heapnum)
402         return 0;
403     n = hi->ptr[1];
404     strcpy (name, hi->info.buf[n]);
405     kf = hi->info.file[n];
406     r = strlen(name);
407     memcpy (key, hi->info.buf[n] + r+1, KEY_SIZE);
408     key_heap_delete (hi);
409     if ((r = key_file_read (kf, rbuf)))
410         key_heap_insert (hi, rbuf, r, kf);
411     no_iterations++;
412     return 1;
413 }
414
415 struct heap_cread_info {
416     char prev_name[INP_NAME_MAX];
417     char cur_name[INP_NAME_MAX];
418     char *key;
419     struct heap_info *hi;
420     int mode;
421     int more;
422 };
423       
424 int heap_cread_item (void *vp, char **dst, int *insertMode)
425 {
426     struct heap_cread_info *p = vp;
427     struct heap_info *hi = p->hi;
428
429     if (p->mode == 1)
430     {
431         *insertMode = p->key[0];
432         memcpy (*dst, p->key+1, sizeof(struct it_key));
433         (*dst) += sizeof(struct it_key);
434         p->mode = 2;
435         return 1;
436     }
437     strcpy (p->prev_name, p->cur_name);
438     if (!(p->more = heap_read_one (hi, p->cur_name, p->key)))
439         return 0;
440     if (*p->cur_name && strcmp (p->cur_name, p->prev_name))
441     {
442         p->mode = 1;
443         return 0;
444     }
445     *insertMode = p->key[0];
446     memcpy (*dst, p->key+1, sizeof(struct it_key));
447     (*dst) += sizeof(struct it_key);
448     return 1;
449 }
450
451 int heap_inpc (struct heap_info *hi)
452 {
453     struct heap_cread_info hci;
454     ISAMC_I isamc_i = xmalloc (sizeof(*isamc_i));
455
456     hci.key = xmalloc (KEY_SIZE);
457     hci.mode = 1;
458     hci.hi = hi;
459     hci.more = heap_read_one (hi, hci.cur_name, hci.key);
460
461     isamc_i->clientData = &hci;
462     isamc_i->read_item = heap_cread_item;
463
464     while (hci.more)
465     {
466         char this_name[INP_NAME_MAX];
467         ISAMC_P isamc_p, isamc_p2;
468         char *dict_info;
469
470         strcpy (this_name, hci.cur_name);
471         assert (hci.cur_name[1]);
472         no_diffs++;
473         if ((dict_info = dict_lookup (hi->dict, hci.cur_name)))
474         {
475             memcpy (&isamc_p, dict_info+1, sizeof(ISAMC_P));
476             isamc_p2 = isc_merge (hi->isamc, isamc_p, isamc_i);
477             if (!isamc_p2)
478             {
479                 no_deletions++;
480                 if (!dict_delete (hi->dict, this_name))
481                     abort();
482             }
483             else 
484             {
485                 no_updates++;
486                 if (isamc_p2 != isamc_p)
487                     dict_insert (hi->dict, this_name,
488                                  sizeof(ISAMC_P), &isamc_p2);
489             }
490         } 
491         else
492         {
493             isamc_p = isc_merge (hi->isamc, 0, isamc_i);
494             no_insertions++;
495             dict_insert (hi->dict, this_name, sizeof(ISAMC_P), &isamc_p);
496         }
497     }
498     xfree (isamc_i);
499     return 0;
500
501
502 int heap_inps (struct heap_info *hi)
503 {
504     struct heap_cread_info hci;
505     ISAMS_I isams_i = xmalloc (sizeof(*isams_i));
506
507     hci.key = xmalloc (KEY_SIZE);
508     hci.mode = 1;
509     hci.hi = hi;
510     hci.more = heap_read_one (hi, hci.cur_name, hci.key);
511
512     isams_i->clientData = &hci;
513     isams_i->read_item = heap_cread_item;
514
515     while (hci.more)
516     {
517         char this_name[INP_NAME_MAX];
518         ISAMS_P isams_p;
519         char *dict_info;
520
521         strcpy (this_name, hci.cur_name);
522         assert (hci.cur_name[1]);
523         no_diffs++;
524         if (!(dict_info = dict_lookup (hi->dict, hci.cur_name)))
525         {
526             isams_p = isams_merge (hi->isams, isams_i);
527             no_insertions++;
528             dict_insert (hi->dict, this_name, sizeof(ISAMS_P), &isams_p);
529         }
530         else
531             abort();
532     }
533     xfree (isams_i);
534     return 0;
535
536
537
538 int heap_inp (struct heap_info *hi)
539 {
540     char *info;
541     char next_name[INP_NAME_MAX];
542     char cur_name[INP_NAME_MAX];
543     int key_buf_size = INP_BUF_START;
544     int key_buf_ptr;
545     char *next_key;
546     char *key_buf;
547     int more;
548     
549     next_key = xmalloc (KEY_SIZE);
550     key_buf = xmalloc (key_buf_size);
551     more = heap_read_one (hi, cur_name, key_buf);
552     while (more)                   /* EOF ? */
553     {
554         int nmemb;
555         key_buf_ptr = KEY_SIZE;
556         while (1)
557         {
558             if (!(more = heap_read_one (hi, next_name, next_key)))
559                 break;
560             if (*next_name && strcmp (next_name, cur_name))
561                 break;
562             memcpy (key_buf + key_buf_ptr, next_key, KEY_SIZE);
563             key_buf_ptr += KEY_SIZE;
564             if (key_buf_ptr+(int) KEY_SIZE >= key_buf_size)
565             {
566                 char *new_key_buf;
567                 new_key_buf = xmalloc (key_buf_size + INP_BUF_ADD);
568                 memcpy (new_key_buf, key_buf, key_buf_size);
569                 key_buf_size += INP_BUF_ADD;
570                 xfree (key_buf);
571                 key_buf = new_key_buf;
572             }
573         }
574         no_diffs++;
575         nmemb = key_buf_ptr / KEY_SIZE;
576         assert (nmemb * (int) KEY_SIZE == key_buf_ptr);
577         if ((info = dict_lookup (hi->dict, cur_name)))
578         {
579             ISAM_P isam_p, isam_p2;
580             memcpy (&isam_p, info+1, sizeof(ISAM_P));
581             isam_p2 = is_merge (hi->isam, isam_p, nmemb, key_buf);
582             if (!isam_p2)
583             {
584                 no_deletions++;
585                 if (!dict_delete (hi->dict, cur_name))
586                     abort ();
587             }
588             else 
589             {
590                 no_updates++;
591                 if (isam_p2 != isam_p)
592                     dict_insert (hi->dict, cur_name, sizeof(ISAM_P), &isam_p2);
593             }
594         }
595         else
596         {
597             ISAM_P isam_p;
598             no_insertions++;
599             isam_p = is_merge (hi->isam, 0, nmemb, key_buf);
600             dict_insert (hi->dict, cur_name, sizeof(ISAM_P), &isam_p);
601         }
602         memcpy (key_buf, next_key, KEY_SIZE);
603         strcpy (cur_name, next_name);
604     }
605     return 0;
606 }
607
608 struct progressInfo {
609     time_t   startTime;
610     time_t   lastTime;
611     off_t    totalBytes;
612     off_t    totalOffset;
613 };
614
615 void progressFunc (struct key_file *keyp, void *info)
616 {
617     struct progressInfo *p = info;
618     time_t now, remaining;
619
620     if (keyp->buf_size <= 0 || p->totalBytes <= 0)
621         return ;
622     time (&now);
623
624     if (now >= p->lastTime+10)
625     {
626         p->lastTime = now;
627         remaining = (time_t) ((now - p->startTime)*
628             ((double) p->totalBytes/p->totalOffset - 1.0));
629         if (remaining <= 130)
630             logf (LOG_LOG, "Merge %2.1f%% completed; %ld seconds remaining",
631                  (100.0*p->totalOffset) / p->totalBytes, (long) remaining);
632         else
633             logf (LOG_LOG, "Merge %2.1f%% completed; %ld minutes remaining",
634                  (100.0*p->totalOffset) / p->totalBytes, (long) remaining/60);
635     }
636     p->totalOffset += keyp->buf_size;
637 }
638
639 #ifndef R_OK
640 #define R_OK 4
641 #endif
642
643 void key_input (BFiles bfs, int nkeys, int cache)
644                 
645 {
646     Dict dict;
647     ISAM isam = NULL;
648     ISAMC isamc = NULL;
649     ISAMS isams = NULL;
650     struct key_file **kf;
651     char rbuf[1024];
652     int i, r;
653     struct heap_info *hi;
654     struct progressInfo progressInfo;
655
656     if (nkeys < 0)
657     {
658         char fname[1024];
659         nkeys = 0;
660         while (1)
661         {
662             getFnameTmp (fname, nkeys+1);
663             if (access (fname, R_OK) == -1)
664                 break;
665             nkeys++;
666         }
667         if (!nkeys)
668             return ;
669     }
670     dict = dict_open (bfs, FNAME_DICT, cache, 1);
671     if (!dict)
672     {
673         logf (LOG_FATAL, "dict_open fail");
674         exit (1);
675     }
676     if (res_get_match (common_resource, "isam", "s", NULL))
677     {
678         isams = isams_open (bfs, FNAME_ISAMS, 1,
679                             key_isams_m (common_resource));
680         if (!isams)
681         {
682             logf (LOG_FATAL, "isams_open fail");
683             exit (1);
684         }
685     }
686     else if (res_get_match (common_resource, "isam", "i", NULL))
687     {
688         isam = is_open (bfs, FNAME_ISAM, key_compare, 1,
689                         sizeof(struct it_key), common_resource);
690         if (!isam)
691         {
692             logf (LOG_FATAL, "is_open fail");
693             exit (1);
694         }
695     }
696     else
697     {
698         isamc = isc_open (bfs, FNAME_ISAMC, 1,
699                           key_isamc_m (common_resource));
700         if (!isamc)
701         {
702             logf (LOG_FATAL, "isc_open fail");
703             exit (1);
704         }
705     }
706     kf = xmalloc ((1+nkeys) * sizeof(*kf));
707     progressInfo.totalBytes = 0;
708     progressInfo.totalOffset = 0;
709     time (&progressInfo.startTime);
710     time (&progressInfo.lastTime);
711     for (i = 1; i<=nkeys; i++)
712     {
713         kf[i] = key_file_init (i, 32768);
714         kf[i]->readHandler = progressFunc;
715         kf[i]->readInfo = &progressInfo;
716         progressInfo.totalBytes += kf[i]->length;
717         progressInfo.totalOffset += kf[i]->buf_size;
718     }
719     hi = key_heap_init (nkeys, key_qsort_compare);
720     hi->dict = dict;
721     hi->isam = isam;
722     hi->isamc = isamc;
723     hi->isams = isams;
724
725     for (i = 1; i<=nkeys; i++)
726         if ((r = key_file_read (kf[i], rbuf)))
727             key_heap_insert (hi, rbuf, r, kf[i]);
728     if (isamc)
729         heap_inpc (hi);
730     else if (isams)
731         heap_inps (hi);
732     else if (isam)
733         heap_inp (hi);
734     dict_close (dict);
735     if (isam)
736         is_close (isam);
737     if (isamc)
738         isc_close (isamc);
739     if (isams)
740         isams_close (isams);
741    
742     for (i = 1; i<=nkeys; i++)
743     {
744         getFnameTmp (rbuf, i);
745         unlink (rbuf);
746     }
747     logf (LOG_LOG, "Iterations . . .%7d", no_iterations);
748     logf (LOG_LOG, "Distinct words .%7d", no_diffs);
749     logf (LOG_LOG, "Updates. . . . .%7d", no_updates);
750     logf (LOG_LOG, "Deletions. . . .%7d", no_deletions);
751     logf (LOG_LOG, "Insertions . . .%7d", no_insertions);
752 }
753
754