Lines Matching defs:pz
58 Pz_t* pz;
66 Pz_t* pz;
143 if (!use && (!(dp->pz->test & 04) || !(file = getenv("_AST_pzip_debug_use")) || !(use = strton(file, NiL, NiL, 1))))
145 dp->pz->count.windows++;
146 if ((dp->pz->flags & (PZ_DUMP|PZ_VERBOSE)) && dp->pz->disc->errorf)
147 (*dp->pz->disc->errorf)(dp->pz, dp->pz->disc, 0, "window %I*u %I*u", sizeof(dp->pz->count.windows), dp->pz->count.windows, sizeof(w), w);
167 if (!ip->used++ && !ip->part && !streq(ip->name, "0") && dp->pz->disc->errorf && (dp->pz->flags & (PZ_SUMMARY|PZ_VERBOSE|PZ_DUMP)))
168 (*dp->pz->disc->errorf)(dp->pz, dp->pz->disc, 1, "%s: generate a partition to improve compression", ip->name);
169 if (ip->use = !(dp->pz->flags & PZ_NOPZIP) && ip->part)
182 if (pzpartwrite(dp->pz, op))
198 if ((dp->pz->flags & PZ_DUMP) && dp->pz->disc->errorf)
199 (*dp->pz->disc->errorf)(dp->pz, dp->pz->disc, 0, "%8d %12s %2d %4d %4I*u %12I*u%s", ip->seq, ip->name, !!ip->part, ip->use, sizeof(ip->row), ip->row, sizeof(n), n, ip->windows == 1 ? " NEW" : "");
203 if (dp->pz->disc->errorf)
204 (*dp->pz->disc->errorf)(dp->pz, dp->pz->disc, ERROR_SYSTEM|2, "partition table write error");
214 io = dp->pz->io;
221 if (!pzpartset(dp->pz, ip->part))
224 dp->pz->io = state.buf;
225 if (pzdeflate(dp->pz, op))
242 if (dp->pz->disc->errorf)
243 (*dp->pz->disc->errorf)(dp->pz, dp->pz->disc, ERROR_SYSTEM|2, "partition data write error");
250 dp->pz->io = io;
261 if (dp->pz->disc->errorf)
262 (*dp->pz->disc->errorf)(dp->pz, dp->pz->disc, ERROR_SYSTEM|2, "record sequence write error");
272 if (dp->pz->disc->errorf)
273 (*dp->pz->disc->errorf)(dp->pz, dp->pz->disc, ERROR_SYSTEM|2, "write error");
282 dp->pz->io = io;
291 deflate(Pz_t* pz, Sfio_t* op)
328 def.pz = pz;
339 if (pzheadwrite(def.pz, op))
343 if (pz->disc->errorf)
344 (*pz->disc->errorf)(pz, pz->disc, ERROR_SYSTEM|2, "magic write error");
352 if (indexf = pz->disc->indexf)
357 m = pz->win - 8;
358 error_info.file = (char*)pz->path;
360 while (rp = (*pz->disc->splitf)(pz, pz->io, pz->disc))
366 pz->count.records++;
378 pz->count.uncompressed += index.offset - extra;
381 if (rp->record && indexf && (*indexf)(pz, &index, rp->data, pz->disc) < 0)
386 if (pz->disc->namef)
387 s = (*pz->disc->namef)(pz, rp->id, pz->disc);
397 if (pz->disc->errorf)
398 (*pz->disc->errorf)(pz, pz->disc, ERROR_SYSTEM|2, "%s: cannot create tmp stream", ip->name);
401 if ((ip->part = pzpartget(def.pz, ip->name)) && pz->disc->errorf && ip->row && ip->part->row != ip->row)
402 (*pz->disc->errorf)(pz, pz->disc, 1, "%s: partition row %I*u != data row %I*u", ip->name, sizeof(ip->part->row), ip->part->row, sizeof(ip->row), ip->row);
407 else if (pz->disc->errorf && ip->row != rp->size && (ip->row % rp->size))
408 (*pz->disc->errorf)(pz, pz->disc, 1, "%s: size %I*u not a multiple of %I*u", ip->name, sizeof(rp->size), rp->size, sizeof(ip->row), ip->row);
425 if (pz->disc->errorf)
426 (*pz->disc->errorf)(pz, pz->disc, ERROR_SYSTEM|2, "%s: %I*u byte write error", ip->name, sizeof(rp->size), rp->size);
430 pz->count.modules++;
436 pz->count.uncompressed += index.offset - extra;
447 if (pz->disc->errorf)
448 (*pz->disc->errorf)(pz, pz->disc, ERROR_SYSTEM|2, "write error");
451 if ((pz->flags & PZ_DUMP) && pz->disc->errorf)
453 (*pz->disc->errorf)(pz, pz->disc, 0, "totals");
455 (*pz->disc->errorf)(pz, pz->disc, 0, "%8I*u %12s %2u %4I*u %4I*u %12I*u %12I*u%s", sizeof(ip->windows), ip->windows, ip->name, !!ip->part, sizeof(ip->used), ip->used, sizeof(ip->row), ip->row, sizeof(ip->total), ip->total ? ip->total : ip->modules * ip->row, sizeof(ip->modules), ip->modules, ip->used && !ip->part ? " GENERATE PARTITION" : "");
460 pznospace(pz);
482 inflate(Pz_t* pz, Sfio_t* op)
512 if (!(win = newof(0, char, pz->win, 0)))
518 * w <= pz->win guaranteed
521 while ((w = sfgetu(pz->io)) && w <= pz->win)
523 if ((pz->flags & (PZ_DUMP|PZ_VERBOSE)) && pz->disc->errorf)
524 (*pz->disc->errorf)(pz, pz->disc, 0, "window %I*u", sizeof(w), w);
530 if (pzpartread(pz))
537 parts = sfgetu(pz->io);
554 row = sfgetu(pz->io);
555 use = sfgetu(pz->io);
556 m = sfgetu(pz->io);
557 id = sfgetr(pz->io, 0, 0);
560 if (!(ip = newof(0, Id_t, 1, sfvalue(pz->io))))
564 if ((ip->part = pzpartget(pz, ip->name)) && pz->disc->errorf && ip->row && ip->part->row != ip->row)
565 (*pz->disc->errorf)(pz, pz->disc, 1, "%s: partition row %I*u != data row %I*u", ip->name, sizeof(ip->part->row), ip->part->row, sizeof(ip->row), ip->row);
571 if (m >= pz->win || ip->row && m % ip->row)
573 if (pz->disc->errorf)
574 (*pz->disc->errorf)(pz, pz->disc, 2, "input corrupted [%s partition table size %I*u]", ip->name, sizeof(m), m);
585 if ((pz->flags & PZ_DUMP) && pz->disc->errorf)
586 (*pz->disc->errorf)(pz, pz->disc, 0, "%8d %12s %2d %4I*u %4I*u %12I*u%s", i + 1, ip->name, ip->use, sizeof(ip->used), ip->used, sizeof(ip->row), ip->row, sizeof(ip->size), ip->size, ip->used == 1 ? " NEW" : "");
597 if (!pzpartset(pz, tab[i]->part))
599 if (pzinflate(pz, state.buf))
608 if (sfread(pz->io, s, u) != u)
610 if (pz->disc->errorf)
611 (*pz->disc->errorf)(pz, pz->disc, ERROR_SYSTEM|2, "cannot read %I*u byte partition data buffer", sizeof(u), u);
625 while (m = sfgetu(pz->io))
629 if (pz->disc->errorf)
630 (*pz->disc->errorf)(pz, pz->disc, 2, "input corrupted [partition record index %I*u > %I*u]", sizeof(m), m, sizeof(parts), parts);
649 if (pz->disc->errorf)
650 (*pz->disc->errorf)(pz, pz->disc, ERROR_SYSTEM|2, "%I*u byte write error", sizeof(n), n);
656 if (w || sfgetc(pz->io) != EOF)
658 if (pz->disc->errorf)
659 (*pz->disc->errorf)(pz, pz->disc, 2, "%s: input corrupted [EOF expected at %I*u]", pz->path, sftell(pz->io));
664 if (pz->disc->errorf)
665 (*pz->disc->errorf)(pz, pz->disc, ERROR_SYSTEM|2, "write error");
671 pznospace(pz);
687 pzsdeflate(Pz_t* pz, Sfio_t* op)
691 pz->split.flags |= PZ_SPLIT_PART;
692 r = deflate(pz, op);
693 pz->split.flags &= ~PZ_SPLIT_PART;
698 pzsinflate(Pz_t* pz, Sfio_t* op)
702 pz->split.flags |= PZ_SPLIT_PART;
703 r = inflate(pz, op);
704 pz->split.flags &= ~PZ_SPLIT_PART;
709 pzssplit(Pz_t* pz)
722 if (!pz->disc->splitf)
724 if (pz->disc->errorf)
725 (*pz->disc->errorf)(pz, pz->disc, 2, "%s: split discipline library expected", pz->path);
728 window = pz->disc->window ? pz->disc->window : PZ_WINDOW;
746 error_info.file = (char*)pz->path;
748 while (rp = (*pz->disc->splitf)(pz, pz->io, pz->disc))
753 pz->count.records++;
757 if (pz->disc->namef)
758 s = (*pz->disc->namef)(pz, rp->id, pz->disc);
766 if (!pz->split.match || strmatch(ip->name, pz->split.match))
768 if (!(ip->sp = sfopen(NiL, ip->name, (pz->flags & PZ_APPEND) ? "a" : "w")))
770 if (pz->disc->errorf)
771 (*pz->disc->errorf)(pz, pz->disc, ERROR_SYSTEM|2, "%s: cannot create split stream", ip->name);
777 if ((pz->flags & PZ_DUMP) && pz->disc->errorf)
778 (*pz->disc->errorf)(pz, pz->disc, 0, "split %s size %I*u", ip->name, sizeof(ip->row), ip->row);
782 else if (pz->disc->errorf && ip->row != rp->size && rp->size && (ip->row % rp->size))
783 (*pz->disc->errorf)(pz, pz->disc, 1, "%s: size %I*u not a multiple of %I*u", ip->name, sizeof(rp->size), rp->size, sizeof(ip->row), ip->row);
790 if (pz->disc->errorf)
791 (*pz->disc->errorf)(pz, pz->disc, ERROR_SYSTEM|2, "%s: %I*u byte write error", ip->name, sizeof(rp->size), rp->size);
797 pz->count.modules++;
800 if ((pz->flags & PZ_DUMP) && pz->disc->errorf)
802 (*pz->disc->errorf)(pz, pz->disc, 0, "totals");
805 (*pz->disc->errorf)(pz, pz->disc, 0, "%8I*u %12s %2u %4I*u %4I*u %12I*u %12I*u%s", sizeof(ip->windows), ip->windows, ip->name, !!ip->part, sizeof(ip->used), ip->used, sizeof(ip->row), ip->row, sizeof(ip->total), ip->total ? ip->total : ip->modules * ip->row, sizeof(ip->modules), ip->modules, ip->used && !ip->part ? " GENERATE PARTITION" : "");
810 if (pz->disc->errorf)
811 (*pz->disc->errorf)(pz, pz->disc, ERROR_SYSTEM|2, "%s: write error", ip->name);
817 pznospace(pz);