/***********************************************************************
* *
* 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 "vdelhdr01.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 _match_s
};
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(match) /* 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;
}
}
else
return -1;
}
return 0;
}
/* Fold a string */
#if __STD_C
#else
int output;
#endif
{
if(!output)
return 0;
}
else
}
for(;;)
{ for(;;) /* search for the longest match */
goto endsearch;
if(bestm) /* skip over past elements */
{ for(;;)
break;
goto endsearch;
}
}
for(;;)
{ 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;
ends = s+n;
goto extend;
goto extend;
goto endsearch;
}
n = len;
goto endsearch;
/* check for a longer match */
if(len == n+1)
}
if(bestm)
return -1;
/* add a sufficient number of suffices */
if(!output)
}
else
{ if(!add)
add = s;
ss = s;
}
if(!(m = table[n]) )
else
}
break;
}
{ if(!add)
add = s;
break;
}
}
if(output) /* flush output */
return 0;
}
#if __STD_C
#else
long window; /* amount to process each time */
#endif
{
return -1;
return -1;
n_src = 0;
return -1;
return -1;
if(window <= 0)
window = DFLTWINDOW;
/* try to allocate working space */
while(window > 0)
{ /* space for the target string */
goto reduce_window;
/* space for sliding header or source string */
if(n_src <= 0) /* compression only */
else /* differencing */
}
goto reduce_window;
/* space for the hash table elements */
if(n_src <= 0)
goto reduce_window;
/* space for the hash table */
n = size/2;
do (size = n); while((n &= n-1) != 0);
if(size < 64)
size = 64;
if((size >>= 1) <= 0)
goto reduce_window;
/* if get here, successful */
break;
}
}
}
if((window >>= 1) <= 0)
return -1;
}
/* amount processed */
n = 0;
/* output magic bytes and sizes */
for(k = 0; VD_MAGIC[k]; k++)
;
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)
else p = n;
else
goto done;
}
} /* else use last window */
}
/* prepare the target string */
else
goto done;
}
/* reinitialize table before processing */
goto done;
goto done;
n += size;
}
done:
}