source: trunk/gsdl/packages/mg-1.3d/src/text/text.pass2.c@ 30

Last change on this file since 30 was 13, checked in by rjmcnab, 26 years ago

* empty log message *

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 18.3 KB
Line 
1/**************************************************************************
2 *
3 * text.pass2.c -- Text compression (Pass 2)
4 * Copyright (C) 1994 Neil Sharman, Gary Eddy and Alistair Moffat
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 * $Id: text.pass2.c 13 1998-11-17 09:36:00Z rjmcnab $
21 *
22 **************************************************************************/
23
24
25#include "sysfuncs.h"
26
27#include "memlib.h"
28#include "messages.h"
29#include "local_strings.h"
30#include "bitio_m_mem.h"
31#include "bitio_m.h"
32#include "huffman.h"
33#include "bitio_stdio.h"
34#include "huffman_stdio.h"
35#include "netorder.h" /* [RPAP - Jan 97: Endian Ordering] */
36
37#include "mg.h"
38#include "mg_files.h"
39#include "build.h"
40#include "words.h"
41#include "text.h"
42#include "hash.h"
43#include "locallib.h"
44#include "comp_dict.h"
45
46
47
48
49/*
50 $Log$
51 Revision 1.1 1998/11/17 09:35:47 rjmcnab
52 *** empty log message ***
53
54 * Revision 1.3 1994/10/20 03:57:10 tes
55 * I have rewritten the boolean query optimiser and abstracted out the
56 * components of the boolean query.
57 *
58 * Revision 1.2 1994/09/20 04:42:14 tes
59 * For version 1.1
60 *
61 */
62
63static char *RCSID = "$Id: text.pass2.c 13 1998-11-17 09:36:00Z rjmcnab $";
64
65#define POOL_SIZE 1024*256
66
67typedef struct char_pool
68 {
69 struct char_pool *next;
70 u_long left;
71 u_char *ptr;
72 u_char pool[POOL_SIZE];
73 }
74char_pool;
75
76typedef struct novel_hash_rec
77 {
78 u_long ordinal_num;
79 u_char *word;
80 }
81novel_hash_rec;
82
83
84#define INITIAL_HASH_SIZE 7927
85#define MAX_SWAPS 10000
86
87typedef struct novel_hash_table
88 {
89 novel_hash_rec *HashTable;
90 u_long HashSize, HashUsed;
91 char_pool *first_pool;
92 char_pool *pool;
93 u_long next_num, binary_start;
94 novel_hash_rec **code_to_nhr;
95 }
96novel_hash_table;
97
98
99static FILE *text, *text_idx;
100
101static u_char *comp_buffer;
102
103static u_long text_length;
104
105/* [RJM 07/97: 4G limit] */
106static double stats_in_tot_bytes = 0.0;
107static double stats_in_bytes = 0.0;
108static double stats_out_bytes = 0.0;
109
110
111static novel_hash_table nht[2];
112
113static u_long prefix_len = 0;
114
115int blk_start[2][33], blk_end[2][33];
116
117
118static char_pool *
119new_pool (char_pool * pool)
120{
121 char_pool *p = Xmalloc (sizeof (char_pool));
122 if (!p)
123 FatalError (1, "Unable to allocate memory for pool");
124 if (pool)
125 pool->next = p;
126 p->next = NULL;
127 p->left = POOL_SIZE;
128 p->ptr = p->pool;
129 return p;
130}
131
132
133
134int
135init_text_2 (char *file_name)
136{
137 char path[512];
138 int i;
139
140 if (LoadCompressionDictionary (make_name (file_name, TEXT_DICT_SUFFIX,
141 path)) == COMPERROR)
142 return COMPERROR;
143
144 if (!(text = create_file (file_name, TEXT_SUFFIX, "w+b",
145 MAGIC_TEXT, MG_MESSAGE))) /* [RPAP - Feb 97: WIN32 Port] */
146 return COMPERROR;
147
148 bzero ((char *) &cth, sizeof (cth));
149
150 if (fwrite (&cth, sizeof (cth), 1, text) != 1)
151 return COMPERROR;
152
153 text_length = sizeof (u_long) + sizeof (cth);
154
155 if (!(text_idx = create_file (file_name, TEXT_IDX_SUFFIX, "w+b",
156 MAGIC_TEXI, MG_MESSAGE))) /* [RPAP - Feb 97: WIN32 Port] */
157 return COMPERROR;
158
159 if (fwrite (&cth, sizeof (cth), 1, text_idx) != 1)
160 return COMPERROR;
161
162 if (!(comp_buffer = Xmalloc (sizeof (u_char) * buf_size)))
163 {
164 Message ("No memory for compression buffer");
165 return (COMPERROR);
166 }
167
168#if 0
169 MaxMemInUse += sizeof (u_char) * buf_size;
170#endif
171
172 if (cdh.novel_method != MG_NOVEL_HUFFMAN_CHARS)
173 for (i = 0; i <= 1; i++)
174 {
175 nht[i].HashSize = INITIAL_HASH_SIZE;
176 nht[i].HashTable = Xmalloc (sizeof (novel_hash_rec) * nht[i].HashSize);
177 bzero ((char *) nht[i].HashTable,
178 sizeof (novel_hash_rec) * nht[i].HashSize);
179 nht[i].HashUsed = 0;
180 nht[i].HashSize = INITIAL_HASH_SIZE;
181 nht[i].pool = nht[i].first_pool = new_pool (NULL);
182 nht[i].next_num = 1;
183 nht[i].binary_start = 1;
184 if (cdh.novel_method == MG_NOVEL_HYBRID_MTF)
185 nht[i].code_to_nhr = Xmalloc (sizeof (novel_hash_rec *) *
186 ((nht[i].HashSize >> 1) + 2));
187 else
188 nht[i].code_to_nhr = NULL;
189 if (cdh.novel_method == MG_NOVEL_HYBRID ||
190 cdh.novel_method == MG_NOVEL_HYBRID_MTF)
191 {
192 int num;
193 num = 1;
194 blk_start[i][0] = 0;
195 blk_end[i][0] = cdh.num_words[i] - 1;
196 while (num < 33)
197 {
198 blk_start[i][num] = blk_end[i][num - 1] + 1;
199 blk_end[i][num] = blk_start[i][num] +
200 (blk_end[i][num - 1] - blk_start[i][num - 1]) * 2;
201 num++;
202 }
203 }
204 }
205
206 return (COMPALLOK);
207}
208
209
210
211int
212ic (void *a, void *b)
213{
214 return *((int *) a) - *((int *) b);
215}
216
217
218
219/* #define DOCDUMP 477 */
220
221int
222process_text_2 (u_char * s_in, int l_in)
223{
224 int which, byte_length;
225 u_char *end = s_in + l_in - 1;
226 int novels_used[2];
227 int swaps[2][MAX_SWAPS];
228
229 which = INAWORD (*s_in);
230
231 ENCODE_START (comp_buffer, buf_size)
232
233 ENCODE_BIT (which);
234
235 if (cdh.novel_method == MG_NOVEL_BINARY)
236 {
237 DELTA_ENCODE_L (nht[0].binary_start, prefix_len);
238 DELTA_ENCODE_L (nht[1].binary_start, prefix_len);
239 }
240
241 novels_used[0] = novels_used[1] = 0;
242
243#ifdef DOCDUMP
244 if (cth.num_of_docs == DOCDUMP)
245 {
246 printf ("---------------------------------------------------\n");
247 printf ("which = %d\n", which);
248 }
249#endif
250
251 for (; s_in <= end; which = !which)
252 {
253 u_char Word[MAXWORDLEN + 1];
254 int res;
255
256 if (which)
257 cth.num_of_words++;
258
259 /* First parse a word or non-word out of the string */
260 if (which)
261 PARSE_WORD (Word, s_in, end);
262 else
263 PARSE_NON_WORD (Word, s_in, end);
264
265#ifdef DOCDUMP
266 if (cth.num_of_docs == DOCDUMP)
267 {
268 printf ("%sword : \"%.*s\"", which ? " " : "non-", Word[0], Word + 1);
269 }
270#endif
271
272 /* Search the hash table for Word */
273 if (ht[which])
274 {
275 register unsigned long hashval, step;
276 register int tsize = ht[which]->size;
277 register u_char **wptr;
278 HASH (hashval, step, Word, tsize);
279 for (;;)
280 {
281 register u_char *s1;
282 register u_char *s2;
283 register int len;
284 wptr = ht[which]->table[hashval];
285 if (wptr == NULL)
286 {
287 res = COMPERROR;
288 break;
289 }
290
291 /* Compare the words */
292 s1 = Word;
293 s2 = *wptr;
294 len = *s1 + 1;
295 for (; len; len--)
296 if (*s1++ != *s2++)
297 break;
298
299 if (len)
300 {
301 hashval += step;
302 if (hashval >= tsize)
303 hashval -= tsize;
304 }
305 else
306 {
307 res = ht[which]->table[hashval] - ht[which]->words;
308 break;
309 }
310 }
311 }
312 else
313 res = COMPERROR;
314 /* Check that the word was found in the dictionary */
315 if (res == COMPERROR)
316 {
317 if (cdh.dict_type == MG_COMPLETE_DICTIONARY)
318 {
319 Message ("Unknown word \"%.*s\"\n", *Word, Word + 1);
320 return (COMPERROR);
321 }
322 if (cdh.dict_type == MG_PARTIAL_DICTIONARY)
323 {
324 u_long i;
325 if (ht[which])
326 {
327 res = ht[which]->hd->num_codes - 1;
328 HUFF_ENCODE (res, ht[which]->codes, ht[which]->hd->clens);
329 }
330 HUFF_ENCODE (Word[0], lens_codes[which], lens_huff[which].clens);
331 for (i = 0; i < Word[0]; i++)
332 HUFF_ENCODE (Word[i + 1], char_codes[which],
333 char_huff[which].clens);
334 }
335 if (cdh.dict_type == MG_SEED_DICTIONARY)
336 {
337 if (ht[which])
338 {
339 res = ht[which]->hd->num_codes - 1;
340 HUFF_ENCODE (res, ht[which]->codes, ht[which]->hd->clens);
341 }
342 switch (cdh.novel_method)
343 {
344 case MG_NOVEL_HUFFMAN_CHARS:
345 {
346 u_long i;
347 HUFF_ENCODE (Word[0], lens_codes[which],
348 lens_huff[which].clens);
349 for (i = 0; i < Word[0]; i++)
350 HUFF_ENCODE (Word[i + 1], char_codes[which],
351 char_huff[which].clens);
352 }
353 break;
354 case MG_NOVEL_BINARY:
355 case MG_NOVEL_DELTA:
356 case MG_NOVEL_HYBRID:
357 case MG_NOVEL_HYBRID_MTF:
358 {
359 register unsigned long hashval, step;
360 register novel_hash_table *h = &nht[which];
361 register int hsize = h->HashSize;
362 register novel_hash_rec *ent;
363 HASH (hashval, step, Word, hsize);
364 for (;;)
365 {
366 register u_char *s1, *s2;
367 register int len;
368 ent = h->HashTable + hashval;
369 if (!ent->word)
370 {
371 int len = *Word + 1;
372 if (len > h->pool->left)
373 h->pool = new_pool (h->pool);
374 ent->word = h->pool->ptr;
375 ent->ordinal_num = h->next_num++;
376 if (cdh.novel_method == MG_NOVEL_HYBRID_MTF)
377 h->code_to_nhr[ent->ordinal_num - 1] = ent;
378 memcpy (h->pool->ptr, Word, len);
379 h->pool->ptr += len;
380 h->pool->left -= len;
381 h->HashUsed++;
382 break;
383 }
384 /* Compare the words */
385 s1 = Word;
386 s2 = ent->word;
387 len = *s1 + 1;
388 for (; len; len--)
389 if (*s1++ != *s2++)
390 break;
391
392 if (!len)
393 break;
394
395 hashval = (hashval + step);
396 if (hashval >= hsize)
397 hashval -= hsize;
398 }
399
400 switch (cdh.novel_method)
401 {
402 case MG_NOVEL_BINARY:
403 {
404 BINARY_ENCODE (ent->ordinal_num, h->binary_start);
405 if (ent->ordinal_num == h->binary_start)
406 h->binary_start++;
407 }
408 break;
409 case MG_NOVEL_DELTA:
410 {
411 DELTA_ENCODE (ent->ordinal_num);
412 }
413 break;
414 case MG_NOVEL_HYBRID:
415 {
416 int k = 0;
417 int j = ent->ordinal_num - 1;
418 while (j > blk_end[which][k])
419 k++;
420 assert (j - blk_start[which][k] + 1 >= 1 &&
421 j - blk_start[which][k] + 1 <=
422 blk_end[which][k] - blk_start[which][k] + 1);
423
424 GAMMA_ENCODE (k + 1);
425 BINARY_ENCODE (j - blk_start[which][k] + 1,
426 blk_end[which][k] -
427 blk_start[which][k] + 1);
428 }
429 break;
430 case MG_NOVEL_HYBRID_MTF:
431 {
432 int k = 0;
433 int j = ent->ordinal_num - 1;
434 while (j > blk_end[which][k])
435 k++;
436 assert (j - blk_start[which][k] + 1 >= 1 &&
437 j - blk_start[which][k] + 1 <=
438 blk_end[which][k] - blk_start[which][k] + 1);
439 GAMMA_ENCODE (k + 1);
440 BINARY_ENCODE (j - blk_start[which][k] + 1,
441 blk_end[which][k] -
442 blk_start[which][k] + 1);
443
444 if (ent->ordinal_num - 1 >= novels_used[which])
445 {
446 int a = novels_used[which];
447 int b = ent->ordinal_num - 1;
448 novel_hash_rec *temp;
449
450
451/* fprintf(stderr, "a = %d , b = %d\n", a, b);
452 */
453 temp = h->code_to_nhr[a];
454 h->code_to_nhr[a] = h->code_to_nhr[b];
455 h->code_to_nhr[b] = temp;
456 h->code_to_nhr[a]->ordinal_num = a + 1;
457 h->code_to_nhr[b]->ordinal_num = b + 1;
458 if (novels_used[which] == MAX_SWAPS)
459 FatalError (1, "Not enough mem for swapping");
460 swaps[which][novels_used[which]] = b;
461 novels_used[which]++;
462 }
463 }
464 break;
465 }
466 if (h->HashUsed >= h->HashSize >> 1)
467 {
468 novel_hash_rec *ht;
469 unsigned long size;
470 unsigned long i;
471 size = prime (h->HashSize * 2);
472 if (cdh.novel_method == MG_NOVEL_HYBRID_MTF)
473 {
474 Xfree (h->code_to_nhr);
475 h->code_to_nhr = Xmalloc (sizeof (novel_hash_rec *) *
476 ((size >> 1) + 2));
477 }
478 if (!(ht = Xmalloc (sizeof (novel_hash_rec) * size)))
479 {
480 Message ("Unable to allocate memory for table");
481 return (COMPERROR);
482 }
483 bzero ((char *) ht, sizeof (novel_hash_rec) * size);
484
485 for (i = 0; i < h->HashSize; i++)
486 if (h->HashTable[i].word)
487 {
488 register u_char *wptr;
489 register unsigned long hashval, step;
490
491 wptr = h->HashTable[i].word;
492 HASH (hashval, step, wptr, size);
493 wptr = (ht + hashval)->word;
494 while (wptr)
495 {
496 hashval += step;
497 if (hashval >= size)
498 hashval -= size;
499 wptr = (ht + hashval)->word;
500 }
501 ht[hashval] = h->HashTable[i];
502 if (cdh.novel_method == MG_NOVEL_HYBRID_MTF)
503 h->code_to_nhr[ht[hashval].ordinal_num - 1] =
504 &ht[hashval];
505 }
506 Xfree (h->HashTable);
507 h->HashTable = ht;
508 h->HashSize = size;
509 }
510 }
511 break;
512 }
513 }
514 }
515 else
516 {
517 HUFF_ENCODE (res, ht[which]->codes, ht[which]->hd->clens);
518#ifdef DOCDUMP
519 if (cth.num_of_docs == DOCDUMP)
520 {
521 printf (" %d %d\n", ht[which]->hd->clens[res],
522 ht[which]->codes[res]);
523 }
524#endif
525 }
526 }
527
528
529 /* Add a 1 bit onto the end of the buffer the remaining bits in the last
530 byte will all be zero */
531
532 ENCODE_BIT (1);
533
534 ENCODE_FLUSH;
535
536 byte_length = __pos - __base;
537 if (!__remaining)
538 {
539 Message ("The end of the buffer was probably overrun");
540 return COMPERROR;
541 }
542
543 ENCODE_DONE
544
545#ifdef DOCDUMP
546 if (cth.num_of_docs == DOCDUMP)
547 {
548 printf ("unused bits = %d\n", bits_unused);
549 }
550#endif
551
552 HTONUL(text_length); /* [RPAP - Jan 97: Endian Ordering] */
553 fwrite (&text_length, sizeof (text_length), 1, text_idx);
554 NTOHUL(text_length); /* [RPAP - Jan 97: Endian Ordering] */
555 text_length += byte_length;
556
557#ifdef DOCDUMP
558 if (cth.num_of_docs == DOCDUMP)
559 {
560 int i;
561 for (i = 0; i < byte_length; i++)
562 printf ("%02x ", comp_buffer[i]);
563 printf ("\n");
564 }
565#endif
566
567 if (cdh.novel_method == MG_NOVEL_HYBRID_MTF)
568 for (which = 0; which <= 1; which++)
569 for (novels_used[which]--; novels_used[which] >= 0; novels_used[which]--)
570 {
571 int a = novels_used[which];
572 int b = swaps[which][novels_used[which]];
573 novel_hash_rec *temp;
574 temp = nht[which].code_to_nhr[a];
575 nht[which].code_to_nhr[a] = nht[which].code_to_nhr[b];
576 nht[which].code_to_nhr[b] = temp;
577 nht[which].code_to_nhr[a]->ordinal_num = a + 1;
578 nht[which].code_to_nhr[b]->ordinal_num = b + 1;
579 }
580
581
582 fwrite (comp_buffer, sizeof (*comp_buffer), byte_length, text);
583
584 if ((double) l_in / (double) byte_length > cth.ratio)
585 cth.ratio = (double) l_in / (double) byte_length;
586
587 cth.num_of_docs++;
588 if (l_in > cth.length_of_longest_doc)
589 cth.length_of_longest_doc = l_in;
590
591 cth.num_of_bytes += l_in;
592
593 if (Comp_Stats)
594 {
595 stats_in_tot_bytes += l_in;
596 stats_in_bytes += l_in;
597 stats_out_bytes += byte_length;
598 if (stats_in_bytes >= comp_stat_point)
599 {
600 fprintf (Comp_Stats, "%10.0f %10.0f %10.0f %f\n", stats_in_tot_bytes,
601 stats_in_bytes, stats_out_bytes,
602 (double) stats_out_bytes / (double) stats_in_bytes);
603 stats_in_bytes = 0.0;
604 stats_out_bytes = 0.0;
605 }
606 }
607
608 return COMPALLOK;
609}
610
611
612
613
614
615
616int
617write_aux_dict (char *FileName)
618{
619 int i;
620 FILE *aux;
621 if (!(aux = create_file (FileName, TEXT_DICT_AUX_SUFFIX, "wb",
622 MAGIC_AUX_DICT, MG_MESSAGE))) /* [RPAP - Feb 97: WIN32 Port] */
623 return COMPERROR;
624
625 for (i = 0; i <= 1; i++)
626 {
627 aux_frags_header afh;
628 char_pool *cp;
629
630 afh.num_frags = nht[i].HashUsed;
631 afh.mem_for_frags = 0;
632 for (cp = nht[i].first_pool; cp; cp = cp->next)
633 afh.mem_for_frags += POOL_SIZE - cp->left;
634
635 /* [RPAP - Jan 97: Endian Ordering] */
636 HTONUL(afh.num_frags);
637 HTONUL(afh.mem_for_frags);
638
639 fwrite (&afh, sizeof (afh), 1, aux);
640
641 for (cp = nht[i].first_pool; cp; cp = cp->next)
642 fwrite (cp->pool, POOL_SIZE - cp->left, sizeof (u_char), aux);
643 }
644 fclose (aux);
645 return COMPALLOK;
646}
647
648
649void
650estimate_compressed_aux_dict (void)
651{
652 int i;
653 u_long aux_compressed = 0, total_uncomp = 0;
654 for (i = 0; i <= 1; i++)
655 {
656 int j;
657 long chars[256], fchars[256];
658 long lens[16], flens[16];
659 char_pool *cp;
660 bzero ((char *) chars, sizeof (chars));
661 bzero ((char *) lens, sizeof (lens));
662 for (cp = nht[i].first_pool; cp; cp = cp->next)
663 {
664 u_char *buf = cp->pool;
665 while (buf != cp->ptr)
666 {
667 int len = *buf++;
668 lens[len]++;
669 total_uncomp += len + 4;
670 for (; len; len--)
671 chars[*buf++]++;
672 }
673 }
674 for (j = 0; j < 256; j++)
675 if (!chars[j] && INAWORD (j) == i)
676 fchars[j] = 1;
677 else
678 fchars[j] = chars[j];
679 for (j = 0; j < 16; j++)
680 if (!lens[j])
681 flens[j] = 1;
682 else
683 flens[j] = lens[j];
684
685 aux_compressed += (Calculate_Huffman_Size (16, flens, lens) +
686 Calculate_Huffman_Size (256, fchars, chars)) / 8;
687
688 }
689
690 Message ("Aux dictionary (Uncompressed) %.2f Mb ( %u bytes %0.3f %%)",
691 total_uncomp / 1024.0 / 1024, total_uncomp,
692 (total_uncomp * 100.0) / bytes_processed);
693 Message ("Aux dictionary (Compressed) %.2f Mb ( %.0f bytes %0.3f %%)",
694 aux_compressed / 1024.0 / 1024, aux_compressed * 1.0,
695 (aux_compressed * 100.0) / bytes_processed);
696}
697
698
699
700
701
702
703int
704done_text_2 (char *FileName)
705{
706 if (Comp_Stats)
707 fprintf (Comp_Stats, "%10.0f %10.0f %10.0f %f\n", stats_in_tot_bytes,
708 stats_in_bytes, stats_out_bytes,
709 (double) stats_out_bytes / (double) stats_in_bytes);
710
711 HTONUL(text_length); /* [RPAP - Jan 97: Endian Ordering] */
712 fwrite (&text_length, sizeof (text_length), 1, text_idx);
713 NTOHUL(text_length); /* [RPAP - Jan 97: Endian Ordering] */
714
715 /* [RPAP - Jan 97: Endian Ordering] */
716 HTONUL(cth.num_of_docs);
717 HTOND(cth.num_of_bytes); /* [RJM 07/97: 4G limit] */
718 HTONUL(cth.num_of_words);
719 HTONUL(cth.length_of_longest_doc);
720 HTOND(cth.ratio);
721
722 if (fseek (text_idx, sizeof (u_long), SEEK_SET) == -1 ||
723 fwrite (&cth, sizeof (cth), 1, text_idx) != 1)
724 return COMPERROR;
725 fclose (text_idx);
726
727 if (fseek (text, sizeof (u_long), SEEK_SET) == -1 ||
728 fwrite (&cth, sizeof (cth), 1, text) != 1)
729 return COMPERROR;
730 fclose (text);
731
732 /* [RPAP - Jan 97: Endian Ordering] */
733 NTOHUL(cth.num_of_docs);
734 NTOHD(cth.num_of_bytes); /* [RJM 07/97: 4G limit] */
735 NTOHUL(cth.num_of_words);
736 NTOHUL(cth.length_of_longest_doc);
737 NTOHD(cth.ratio);
738
739
740 Message ("Compressed Text %.2f Mb ( %u bytes %0.3f %%)",
741 text_length / 1024.0 / 1024.0, text_length,
742 (text_length * 100.0) / bytes_processed);
743 Message ("Words portion of the dictionary %.2f Mb ( %.0f bytes %0.3f %%)",
744 Words_disk / 1024.0 / 1024, Words_disk * 1.0,
745 (Words_disk * 100.0) / bytes_processed);
746
747 if (cdh.dict_type != MG_COMPLETE_DICTIONARY &&
748 (cdh.novel_method == MG_NOVEL_BINARY ||
749 cdh.novel_method == MG_NOVEL_DELTA ||
750 cdh.novel_method == MG_NOVEL_HYBRID ||
751 cdh.novel_method == MG_NOVEL_HYBRID_MTF))
752 {
753 if (write_aux_dict (FileName) == COMPERROR)
754 return COMPERROR;
755 estimate_compressed_aux_dict ();
756 }
757 else
758 {
759 if (cdh.dict_type != MG_COMPLETE_DICTIONARY)
760 Message ("Huffman info for chars in dictionary %.2f Mb"
761 " ( %u bytes %0.3f %%)",
762 Chars_disk / 1024.0 / 1024, Chars_disk,
763 (Chars_disk * 100.0) / bytes_processed);
764 unlink (make_name (FileName, TEXT_DICT_AUX_SUFFIX, NULL));
765 }
766
767 return (COMPALLOK);
768}
Note: See TracBrowser for help on using the repository browser.