/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1998-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
#include "pzlib.h"
/*
* pz deflate from pz->io to op
*/
int
{
register int i;
register int j;
register size_t n;
register size_t m;
register unsigned char* buf;
register unsigned char* wrk;
register unsigned char* pat;
register unsigned char* low;
unsigned char* incomplete;
unsigned char* vp;
unsigned char* ve;
Sfoff_t r;
int peek;
{
(*pz->disc->errorf)(pz, pz->disc, ERROR_SYSTEM|2, "%s: cannot deflate -- not open for write", pz->path);
return -1;
}
return -1;
{
for (;;)
{
{
return -1;
}
return -1;
{
return -1;
}
if (r < n)
break;
}
else
{
return -1;
}
{
return -1;
}
return 0;
}
{
return -1;
}
else
{
/*
* deflate each window
*/
peek = 0;
{
{
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)))
{
}
}
elt = 0;
}
incomplete = 0;
do
{
if (peek)
peek = 0;
else if ((r = readf ? (*readf)(pz, pz->io, pat, pz->disc) : sfread(pz->io, pat, pp->row)) != pp->row)
{
incomplete = pat;
break;
}
if (indexf)
{
break;
}
if (order)
{
if (!elt)
{
}
{
if ((r = readf ? (*readf)(pz, pz->io, elt->buf, pz->disc) : sfread(pz->io, elt->buf, pp->row)) != pp->row)
{
break;
}
}
}
/*
* collect a window of hi frequency cols in buf
* and encode the lo frequency rows in tmp+pz->val
* lo frequency values must not exceed pp->loq
*/
m = 1;
{
if (order)
{
if (!elt)
break;
}
{
incomplete = wrk;
break;
}
{
{
peek = 1;
goto dump;
}
m = 0;
{
}
break;
}
m++;
if (indexf)
{
break;
}
}
dump:
else
{
}
/*
* transpose the hi frequency from row major to col major
* and write it by group to op
*/
{
m = 0;
{
m += n;
}
for (i = 0; i < n; i++)
{
}
{
{
return -1;
}
buf += m;
}
}
else
{
/*
* this is a phony size that is verified on inflate
* 0 here would terminate the inflate loop in the
* first window
*/
}
/*
* now write the lo frequency encoding
*/
{
return -1;
}
{
return -1;
}
} while (!incomplete);
if (incomplete && !readf)
{
if (r < 0)
{
}
else if (r > 0)
{
}
}
{
return -1;
}
}
{
return -1;
}
return 0;
}