/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1995-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 *
* *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#include "vdelhdr.h"
/* Compute a transformation that takes source data to target data
**
** Written by Kiem-Phong Vo, kpv@research.att.com, 5/20/94
*/
#ifdef DEBUG
#endif
(c) > 0 && C_ISTINY(c) && \
(k) >= K_SELF )
struct _table_s
int n_src;
int n_tar;
};
/* encode and output delta instructions */
#if __STD_C
#else
int n_copy; /* length of match */
#endif
{
k_type = 0;
if(n_copy > 0) /* process the COPY instruction */
{ best = d;
}
for(n = 0; n < K_RTYPE; ++n)
continue;
best = d;
}
{ for(d = K_QTYPE-1; d > 0; --d)
if(n >= (d<<VD_BITS) )
break;
}
/* update address caches */
/* see if mergable to last ADD instruction */
}
else
}
}
if(n_add > 0)
return -1;
return -1;
return -1;
}
if(n_copy > 0)
return -1;
return -1;
return -1;
}
else
return -1;
}
}
return 0;
}
/* Fold a string */
#if __STD_C
#else
int target; /* 1 if doing the target stream */
#endif
{
goto done;
}
if(target)
bestm = -1;
for(;;)
{ for(;;) /* search for the longest match */
goto endsearch;
if(bestm >= 0) /* skip over past elements */
goto endsearch;
for(;;)
{ if((n = m) < n_src)
{ if(n < head)
goto next;
}
else
goto next;
}
/* make sure that the M_MIN bytes match */
goto next;
/* make sure this is a real match */
goto next;
/* extend forward as much as possible */
goto extend;
goto endsearch;
}
n = len;
goto endsearch;
/* check for a longer match */
if(len == n+1)
}
if(bestm >= 0)
return -1;
/* add a sufficient number of suffices */
if(target)
bestm = -1;
}
else
{ if(!add)
}
if((m = hash[n]) < 0 )
else
}
break;
}
{ if(!add)
goto done;
}
}
done:
if(target)
else bestm = -1;
}
return 0;
}
#if __STD_C
#else
#endif
{
/* check boundary conditions */
return 0;
/* see if there is a large enough match at the start */
break;
hn = 0;
}
else
return -1;
return 0;
}
/* see if there is a large enough match at the end */
break;
tn = 0;
}
/* maintain big enough data for matching the remained */
}
return -1;
}
#if __STD_C
#else
#endif
{
return -1;
return -1;
n_src = 0;
return -1;
return -1;
/* try to allocate working space */
window = DFLTWINDOW;
while(window > 0)
{ /* space for the target string */
goto reduce_window;
k = size;
/* space for sliding header or source string */
if(n_src <= 0) /* compression only */
{ size = 0;
k += n_tar;
}
else
k += size;
}
}
else /* differencing */
k += size;
size = 0;
}
goto reduce_window;
/* space for the hash table itself */
n = k/2;
do (size = n); while((n &= n-1) != 0);
if(size < 64)
size = 64;
k += size;
goto reduce_window;
/* successful */
break;
}
}
if((window >>= 1) <= 0)
return -1;
}
/* amount processed */
n = 0;
/* output magic bytes and sizes */
k = sizeof(VD_MAGIC) - 1;
goto done;
/* do one window at a time */
while(n < n_tar)
{ /* prepare the source string */
if(n_src <= 0) /* data compression */
{ if(n <= 0)
else
size );
}
}
else /* data differencing */
{ if(n < n_src)
p = 0;
else p = n;
goto done;
}
/* else use last window */
}
/* prepare the target string */
else
goto done;
}
/* reinitialize table before processing */
goto done;
n += size;
}
done:
}