Lines Matching defs:pz

25  * pz deflate from pz->io to op
29 pzdeflate(register Pz_t* pz, Sfio_t* op)
53 if (!(pz->flags & PZ_WRITE))
55 if (pz->disc->errorf)
56 (*pz->disc->errorf)(pz, pz->disc, ERROR_SYSTEM|2, "%s: cannot deflate -- not open for write", pz->path);
59 if (pzheadwrite(pz, op))
61 if (pz->flags & PZ_NOPZIP)
63 n = pz->part->row;
64 if (readf = pz->disc->readf)
69 if (pz->disc->errorf)
70 (*pz->disc->errorf)(pz, pz->disc, 2, "%s: output write error", pz->path);
73 if ((r = (*readf)(pz, pz->io, buf, pz->disc)) < 0)
77 if (pz->disc->errorf)
78 (*pz->disc->errorf)(pz, pz->disc, 2, "%s: output write error", pz->path);
85 r = sfmove(pz->io, op, SF_UNBOUND, -1);
86 if (r < 0 || sferror(pz->io))
88 if (pz->disc->errorf)
89 (*pz->disc->errorf)(pz, pz->disc, 2, "%s: read error", pz->path);
94 if (pz->disc->errorf)
95 (*pz->disc->errorf)(pz, pz->disc, 2, "%s: output write error", pz->path);
100 if ((pz->split.flags & (PZ_SPLIT_DEFLATE|PZ_SPLIT_PART)) == PZ_SPLIT_DEFLATE)
102 if (pzsdeflate(pz, op) < 0)
111 pp = pz->part;
112 readf = pz->disc->readf;
113 indexf = (pz->disc->version >= PZ_VERSION_SPLIT) ? pz->disc->indexf : (Pzindex_f)0;
114 wrk = pz->wrk;
115 pat = pz->pat;
117 tmp = pz->tmp;
119 if (pz->flags & PZ_SORT)
121 if (!pz->sort.order)
124 pz->sort.freedisc.link = offsetof(Pzelt_t, link);
125 pz->sort.orderdisc.link = offsetof(Pzelt_t, link);
126 pz->sort.orderdisc.key = offsetof(Pzelt_t, buf);
127 pz->sort.orderdisc.size = pp->row;
128 if (!(elt = (Pzelt_t*)vmnewof(pz->vm, 0, char, pp->col * m, 0)) || !(pz->sort.order = dtnew(pz->vm, &pz->sort.orderdisc, Dtobag)) || !(pz->sort.free = dtnew(pz->vm, &pz->sort.freedisc, Dtlist)))
129 return pznospace(pz);;
132 dtinsert(pz->sort.free, elt);
139 order = pz->sort.order;
144 else if ((r = readf ? (*readf)(pz, pz->io, pat, pz->disc) : sfread(pz->io, pat, pp->row)) != pp->row)
153 if ((*indexf)(pz, &index, pat, pz->disc) < 0)
160 elt = (Pzelt_t*)dtfirst(pz->sort.free);
161 dtdelete(pz->sort.free, elt);
167 elt = (Pzelt_t*)dtfirst(pz->sort.free);
168 dtdelete(pz->sort.free, elt);
169 if ((r = readf ? (*readf)(pz, pz->io, elt->buf, pz->disc) : sfread(pz->io, elt->buf, pp->row)) != pp->row)
182 * and encode the lo frequency rows in tmp+pz->val
188 ve = (vp = pz->val) + pp->loq - 2 * pp->row;
191 buf = pz->buf;
202 dtinsert(pz->sort.free, old);
207 if ((r = readf ? (*readf)(pz, pz->io, wrk, pz->disc) : sfread(pz->io, wrk, pp->row)) != pp->row)
240 if ((*indexf)(pz, &index, wrk, pz->disc) < 0)
245 if (pz->flags & PZ_SECTION)
246 pz->count.sections++;
249 pz->count.windows++;
250 pz->count.records += n;
262 pp->mix[0] = buf = pz->wrk;
269 buf = pz->buf;
278 buf = pz->wrk;
284 if (pz->disc->errorf)
285 (*pz->disc->errorf)(pz, pz->disc, ERROR_SYSTEM|2, "hi frequency write error");
306 m = vp - pz->val;
308 if (sfwrite(op, pz->val, m) != m || sfsync(op))
310 if (pz->disc->errorf)
311 (*pz->disc->errorf)(pz, pz->disc, ERROR_SYSTEM|2, "lo frequency value write error");
317 if (pz->disc->errorf)
318 (*pz->disc->errorf)(pz, pz->disc, ERROR_SYSTEM|2, "lo frequency code write error");
327 if (pz->disc->errorf)
328 (*pz->disc->errorf)(pz, pz->disc, ERROR_SYSTEM|2, "read error");
332 if (pz->disc->errorf)
333 (*pz->disc->errorf)(pz, pz->disc, 1, "last record incomplete %u/%u", r, pp->row);
339 if (!(pz->flags & PZ_SECTION))
342 if (pz->disc->eventf && (*pz->disc->eventf)(pz, PZ_TAILWRITE, op, 0, pz->disc) < 0)
349 if (pz->disc->errorf)
350 (*pz->disc->errorf)(pz, pz->disc, ERROR_SYSTEM|2, "write error");