164 for (i = 0; i <
N; i++) {
178 for (i = N + 1; i <= (N + 256); i++) {
223 key = &(m_ring_buffer[Pos]);
229 p = (
short int) (
N + 1 + key[0]);
266 for (i = 1; i <
F; i++) {
267 cmp = key[i] - m_ring_buffer[p + i];
272 if (i > m_match_length) {
273 m_match_position =
p;
281 m_dad[Pos] = m_dad[
p];
282 m_lson[Pos] = m_lson[
p];
283 m_rson[Pos] = m_rson[
p];
285 m_dad[ m_lson[
p] ] = Pos;
286 m_dad[ m_rson[
p] ] = Pos;
288 if (m_rson[ m_dad[p] ] == p) {
289 m_rson[ m_dad[
p] ] = Pos;
292 m_lson[ m_dad[
p] ] = Pos;
324 else if (m_lson[Node] ==
NOT_USED) {
334 m_rson[ m_dad[q] ] = m_lson[q];
335 m_dad[ m_lson[q] ] = m_dad[q];
336 m_lson[q] = m_lson[Node];
337 m_dad[ m_lson[Node] ] = q;
340 m_rson[q] = m_rson[Node];
341 m_dad[ m_rson[Node] ] = q;
344 m_dad[q] = m_dad[Node];
346 if (m_rson[ m_dad[Node] ] == Node) {
347 m_rson[ m_dad[Node] ] = q;
350 m_lson[ m_dad[Node] ] = q;
372 unsigned short int len;
373 short int last_match_length;
374 short int code_buf_pos;
375 unsigned char code_buf[17];
409 r = (
short int)
N - (
short int)
F;
436 for (i = 1; i <=
F; i++) {
476 code_buf[code_buf_pos++] = (
unsigned char) (
484 mask = (
unsigned char) (mask << 1);
494 sendChars((
char *) code_buf, code_buf_pos);
507 for (i = 0; i < last_match_length; i++) {
551 s = (
short int) ( (s + 1) & (
N - 1) );
552 r = (
short int) ( (r + 1) & (
N - 1) );
564 while (i++ < last_match_length) {
567 s = (
short int) ( (s + 1) & (
N - 1) );
568 r = (
short int) ( (r + 1) & (
N - 1) );
590 if (code_buf_pos > 1) {
594 sendChars((
char *) code_buf, code_buf_pos);
620 unsigned long totalLen = 0;
643 if (flag_count > 0) {
644 flags = (
unsigned char) (flags >> 1);
650 if (
getChars((
char *) &flags, 1) != 1)
676 r = (
short int) ( (r + 1) & (
N - 1) );
704 pos = (
short int) ( c[0] | ((c[1] & 0xf0) << 4) );
706 len = (
short int) ( (c[1] & 0x0f) +
THRESHOLD );
712 for (k = 0; k < len; k++) {
718 r = (
short int) ( (r + 1) & (
N - 1) );
723 if (
sendChars((
char *) c, len) != (
unsigned int)len) {
#define SWORD_NAMESPACE_START
void InsertNode(short int Pos)
static short int m_lson[N+1]
void DeleteNode(short int Node)
virtual void encode(void)
static short int m_rson[N+257]
virtual void decode(void)
static short int m_match_length
static unsigned char m_ring_buffer[N+F-1]
virtual unsigned long getChars(char *buf, unsigned long len)
static short int m_match_position
#define SWORD_NAMESPACE_END
static short int m_dad[N+1]
virtual unsigned long sendChars(char *buf, unsigned long len)