SCCS-vsn: usr.bin/window/ttoutput.c 3.7
SCCS-vsn: usr.bin/window/ttinit.c 3.22
SCCS-vsn: usr.bin/window/tt.h 3.25
SCCS-vsn: usr.bin/window/Makefile 5.6
SCCS-vsn: usr.bin/window/xx.c 3.4
SCCS-vsn: usr.bin/window/ttzapple.c 3.8
SCCS-vsn: usr.bin/window/xxflush.c 3.4
SCCS-vsn: usr.bin/window/compress.c 3.3
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# @(#)Makefile 5.5 (Berkeley) %G%
+# @(#)Makefile 5.6 (Berkeley) %G%
#
CFLAGS= -O -R
LIBC= /lib/libc.a
#
CFLAGS= -O -R
LIBC= /lib/libc.a
wwiomux.c wwlabel.c wwmisc.c wwmove.c wwopen.c wwprintf.c wwpty.c \
wwputc.c wwputs.c wwredraw.c wwredrawwin.c wwrint.c wwscroll.c \
wwsize.c wwspawn.c wwsuspend.c wwtty.c wwunframe.c wwupdate.c \
wwiomux.c wwlabel.c wwmisc.c wwmove.c wwopen.c wwprintf.c wwpty.c \
wwputc.c wwputs.c wwredraw.c wwredrawwin.c wwrint.c wwscroll.c \
wwsize.c wwspawn.c wwsuspend.c wwtty.c wwunframe.c wwupdate.c \
- wwwrite.c xx.c xxcompress.c xxflush.c
+ wwwrite.c xx.c xxflush.c compress.c
OBJS= char.o cmd.o cmd1.o cmd2.o cmd3.o cmd4.o cmd5.o cmd6.o cmd7.o \
context.o error.o lcmd.o lcmd1.o lcmd2.o main.o mloop.o parser1.o \
parser2.o parser3.o parser4.o parser5.o scanner.o startup.o string.o \
OBJS= char.o cmd.o cmd1.o cmd2.o cmd3.o cmd4.o cmd5.o cmd6.o cmd7.o \
context.o error.o lcmd.o lcmd1.o lcmd2.o main.o mloop.o parser1.o \
parser2.o parser3.o parser4.o parser5.o scanner.o startup.o string.o \
wwiomux.o wwlabel.o wwmisc.o wwmove.o wwopen.o wwprintf.o wwpty.o \
wwputc.o wwputs.o wwredraw.o wwredrawwin.o wwrint.o wwscroll.o \
wwsize.o wwspawn.o wwsuspend.o wwtty.o wwunframe.o wwupdate.o \
wwiomux.o wwlabel.o wwmisc.o wwmove.o wwopen.o wwprintf.o wwpty.o \
wwputc.o wwputs.o wwredraw.o wwredrawwin.o wwrint.o wwscroll.o \
wwsize.o wwspawn.o wwsuspend.o wwtty.o wwunframe.o wwupdate.o \
- wwwrite.o xx.o xxcompress.o xxflush.o
+ wwwrite.o xx.o xxflush.o compress.o
MAN= window.0
all: window
MAN= window.0
all: window
-static char sccsid[] = "@(#)compress.c 3.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)compress.c 3.3 (Berkeley) %G%";
#endif /* not lint */
#include "ww.h"
#endif /* not lint */
#include "ww.h"
+ /* special */
+#include <stdio.h>
+int cc_trace = 0;
+FILE *cc_trace_fp;
+
-int xc_reverse = 1;
-int xc_sort = 0;
-int xc_chop = 0;
+int cc_reverse = 1;
+int cc_sort = 0;
+int cc_chop = 0;
-int xc_token_max = 8; /* <= TOKEN_MAX */
-int xc_token_min = 2; /* > tt.tt_put_token_cost */
-int xc_npass0 = 1;
-int xc_npass1 = 1;
+int cc_token_max = 8; /* <= TOKEN_MAX */
+int cc_token_min = 2; /* > tt.tt_put_token_cost */
+int cc_npass0 = 1;
+int cc_npass1 = 1;
-int xc_bufsize = 1024 * 3; /* XXX, or 80 * 24 * 2 */
+int cc_bufsize = 1024 * 3; /* XXX, or 80 * 24 * 2 */
-#define xc_weight XXX
-#ifndef xc_weight
-int xc_weight = 0;
+#define cc_weight XXX
+#ifndef cc_weight
+int cc_weight = 0;
#endif
#define TOKEN_MAX 16
#endif
#define TOKEN_MAX 16
char string[TOKEN_MAX];
char length;
char flag;
char string[TOKEN_MAX];
char length;
char flag;
short weight;
#endif
long time; /* time last seen */
short weight;
#endif
long time; /* time last seen */
short ccount; /* count in compression */
short places; /* places in the buffer */
short code; /* token code */
short ccount; /* count in compression */
short places; /* places in the buffer */
short code; /* token code */
- struct xc *qforw, *qback;
- struct xc *hforw, **hback;
+ struct cc *qforw, *qback;
+ struct cc *hforw, **hback;
-short xc_thresholds[TOKEN_MAX + 1];
-#define thresh(length) (xc_thresholds[length])
+short cc_thresholds[TOKEN_MAX + 1];
+#define thresh(length) (cc_thresholds[length])
#define threshp(code, count, length) \
#define threshp(code, count, length) \
- ((code) >= 0 || (short) (count) >= xc_thresholds[length])
+ ((code) >= 0 || (short) (count) >= cc_thresholds[length])
-#ifndef xc_weight
-short xc_wthresholds[TOKEN_MAX + 1];
-#define wthresh(length) (xc_wthresholds[length])
-#define wthreshp(weight, length) ((short) (weight) >= xc_wthresholds[length])
+#ifndef cc_weight
+short cc_wthresholds[TOKEN_MAX + 1];
+#define wthresh(length) (cc_wthresholds[length])
+#define wthreshp(weight, length) ((short) (weight) >= cc_wthresholds[length])
#else
#define wthreshp(weight, length) (0)
#endif
#else
#define wthreshp(weight, length) (0)
#endif
-#ifndef xc_weight
-short xc_wlimits[TOKEN_MAX + 1];
-#define wlimit(length) (xc_wlimits[length])
+#ifndef cc_weight
+short cc_wlimits[TOKEN_MAX + 1];
+#define wlimit(length) (cc_wlimits[length])
#endif
#define put_token_score(length) ((length) - tt.tt_put_token_cost)
#endif
#define put_token_score(length) ((length) - tt.tt_put_token_cost)
-int xc_score_adjustments[TOKEN_MAX + 1][8]; /* XXX, 8 > max of xc_thresholds */
+int cc_score_adjustments[TOKEN_MAX + 1][8]; /* XXX, 8 > max of cc_thresholds */
#define score_adjust(score, p) \
do { \
int length = (p)->length; \
#define score_adjust(score, p) \
do { \
int length = (p)->length; \
wthreshp((p)->weight, length)) /* XXX */ \
(score) -= length - tt.tt_put_token_cost; \
else \
wthreshp((p)->weight, length)) /* XXX */ \
(score) -= length - tt.tt_put_token_cost; \
else \
- (score) += xc_score_adjustments[length][ccount]; \
+ (score) += cc_score_adjustments[length][ccount]; \
-int xc_initial_scores[TOKEN_MAX + 1][8]; /* XXX, 8 > max of xc_thresholds */
+int cc_initial_scores[TOKEN_MAX + 1][8]; /* XXX, 8 > max of cc_thresholds */
-struct xc xc_q0a, xc_q0b, xc_q1a, xc_q1b;
+struct cc cc_q0a, cc_q0b, cc_q1a, cc_q1b;
-#define qinsert(x1, x2) \
+#define qinsert(p1, p2) \
- register struct xc *forw = (x1)->qforw; \
- register struct xc *back = (x1)->qback; \
+ register struct cc *forw = (p1)->qforw; \
+ register struct cc *back = (p1)->qback; \
back->qforw = forw; \
forw->qback = back; \
back->qforw = forw; \
forw->qback = back; \
- forw = (x2)->qforw; \
- (x1)->qforw = forw; \
- forw->qback = (x1); \
- (x2)->qforw = (x1); \
- (x1)->qback = (x2); \
+ forw = (p2)->qforw; \
+ (p1)->qforw = forw; \
+ forw->qback = (p1); \
+ (p2)->qforw = (p1); \
+ (p1)->qback = (p2); \
-#define qinsertq(q, x) \
+#define qinsertq(q, p) \
((q)->qforw == (q) ? 0 : \
((q)->qforw == (q) ? 0 : \
- ((q)->qback->qforw = (x)->qforw, \
- (x)->qforw->qback = (q)->qback, \
- (q)->qforw->qback = (x), \
- (x)->qforw = (q)->qforw, \
+ ((q)->qback->qforw = (p)->qforw, \
+ (p)->qforw->qback = (q)->qback, \
+ (q)->qforw->qback = (p), \
+ (p)->qforw = (q)->qforw, \
(q)->qforw = (q), \
(q)->qback = (q)))
#define H (14)
#define HSIZE (1 << H)
(q)->qforw = (q), \
(q)->qback = (q)))
#define H (14)
#define HSIZE (1 << H)
-#define hash(h, c) ((((h) >> H - 8 | (h) << 8) ^ (unsigned char)(c)) & \
- HSIZE - 1)
-
-struct xc **xc_output; /* the output array */
-short *xc_places[TOKEN_MAX + 1];
-short *xc_hashcodes; /* for computing hashcodes */
-struct xc **xc_htab; /* the hash table */
-struct xc **xc_tokens; /* holds all the active tokens */
-struct xc_undo {
- struct xc **pos;
- struct xc *val;
-} *xc_undo;
-
-long xc_time, xc_time0;
-
-xcinit()
+#define hash(h, c) ((((h) >> H - 8 | (h) << 8) ^ (c)) & HSIZE - 1)
+
+char *cc_buffer;
+struct cc **cc_output; /* the output array */
+short *cc_places[TOKEN_MAX + 1];
+short *cc_hashcodes; /* for computing hashcodes */
+struct cc **cc_htab; /* the hash table */
+struct cc **cc_tokens; /* holds all the active tokens */
+struct cc_undo {
+ struct cc **pos;
+ struct cc *val;
+} *cc_undo;
+
+long cc_time, cc_time0;
+
+char *cc_tt_ob, *cc_tt_obe;
+
+ccinit()
- if (tt.tt_token_max > xc_token_max)
- tt.tt_token_max = xc_token_max;
- if (tt.tt_token_min < xc_token_min)
- tt.tt_token_min = xc_token_min;
+ if (tt.tt_token_max > cc_token_max)
+ tt.tt_token_max = cc_token_max;
+ if (tt.tt_token_min < cc_token_min)
+ tt.tt_token_min = cc_token_min;
if (tt.tt_token_min > tt.tt_token_max) {
tt.tt_ntoken = 0;
return 0;
}
if (tt.tt_token_min > tt.tt_token_max) {
tt.tt_ntoken = 0;
return 0;
}
- if (tt.tt_ntoken > xc_ntoken / 2) /* not likely */
- tt.tt_ntoken = xc_ntoken / 2;
- if (xxbufsize > xc_bufsize)
- xxbufsize = xc_bufsize; /* XXX */
+ if (tt.tt_ntoken > cc_ntoken / 2) /* not likely */
+ tt.tt_ntoken = cc_ntoken / 2;
#define C(x) (sizeof (x) / sizeof *(x))
#define C(x) (sizeof (x) / sizeof *(x))
- for (i = 0; i < C(xc_thresholds); i++) {
+ for (i = 0; i < C(cc_thresholds); i++) {
int h = i - tt.tt_put_token_cost;
if (h > 0)
int h = i - tt.tt_put_token_cost;
if (h > 0)
(tt.tt_set_token_cost + 1 + h - 1) / h + 1;
else
(tt.tt_set_token_cost + 1 + h - 1) / h + 1;
else
- for (i = 0; i < C(xc_score_adjustments); i++) {
- int t = xc_thresholds[i];
- for (j = 0; j < C(*xc_score_adjustments); j++) {
+ for (i = 0; i < C(cc_score_adjustments); i++) {
+ int t = cc_thresholds[i];
+ for (j = 0; j < C(*cc_score_adjustments); j++) {
- xc_score_adjustments[i][j] =
+ cc_score_adjustments[i][j] =
- (i - tt.tt_put_token_cost);
else if (j < t - 1)
- (i - tt.tt_put_token_cost);
else if (j < t - 1)
- xc_score_adjustments[i][j] = 0;
+ cc_score_adjustments[i][j] = 0;
* ccount * put-token-cost b
* the score adjustment is (b - a)
*/
* ccount * put-token-cost b
* the score adjustment is (b - a)
*/
- xc_score_adjustments[i][j] =
+ cc_score_adjustments[i][j] =
tt.tt_set_token_cost + i +
j * tt.tt_put_token_cost -
i * (j + 1);
if (j >= t)
tt.tt_set_token_cost + i +
j * tt.tt_put_token_cost -
i * (j + 1);
if (j >= t)
- xc_initial_scores[i][j] = 0;
+ cc_initial_scores[i][j] = 0;
else
/*
* - (set-token-cost +
* (length - put-token-cost) -
* (length - put-token-cost) * ccount)
*/
else
/*
* - (set-token-cost +
* (length - put-token-cost) -
* (length - put-token-cost) * ccount)
*/
- xc_initial_scores[i][j] =
+ cc_initial_scores[i][j] =
- (tt.tt_set_token_cost +
(i - tt.tt_put_token_cost) -
(i - tt.tt_put_token_cost) * j);
}
}
- (tt.tt_set_token_cost +
(i - tt.tt_put_token_cost) -
(i - tt.tt_put_token_cost) * j);
}
}
-#ifndef xc_weight
- for (i = 1; i < C(xc_wthresholds); i++) {
- xc_wthresholds[i] =
+#ifndef cc_weight
+ for (i = 1; i < C(cc_wthresholds); i++) {
+ cc_wthresholds[i] =
((tt.tt_set_token_cost + tt.tt_put_token_cost) / i +
i / 5 + 1) *
((tt.tt_set_token_cost + tt.tt_put_token_cost) / i +
i / 5 + 1) *
- xc_weight + 1;
- xc_wlimits[i] = xc_wthresholds[i] + xc_weight;
+ cc_weight + 1;
+ cc_wlimits[i] = cc_wthresholds[i] + cc_weight;
- if ((xc_output = (struct xc **)
- malloc((unsigned) xxbufsize * sizeof *xc_output)) == 0)
+ if ((cc_output = (struct cc **)
+ malloc((unsigned) cc_bufsize * sizeof *cc_output)) == 0)
- if ((xc_hashcodes = (short *)
- malloc((unsigned) xxbufsize * sizeof *xc_hashcodes)) == 0)
+ if ((cc_hashcodes = (short *)
+ malloc((unsigned) cc_bufsize * sizeof *cc_hashcodes)) == 0)
- if ((xc_htab = (struct xc **) malloc(HSIZE * sizeof *xc_htab)) == 0)
+ if ((cc_htab = (struct cc **) malloc(HSIZE * sizeof *cc_htab)) == 0)
- if ((xc_tokens = (struct xc **)
+ if ((cc_tokens = (struct cc **)
- (xc_ntoken + tt.tt_token_max - tt.tt_token_min + 1) *
- sizeof *xc_tokens)) == 0)
+ (cc_ntoken + tt.tt_token_max - tt.tt_token_min + 1) *
+ sizeof *cc_tokens)) == 0)
- if ((xc_undo = (struct xc_undo *)
- malloc((unsigned) xxbufsize * sizeof *xc_undo)) == 0)
+ if ((cc_undo = (struct cc_undo *)
+ malloc((unsigned) cc_bufsize * sizeof *cc_undo)) == 0)
goto nomem;
for (i = tt.tt_token_min; i <= tt.tt_token_max; i++)
goto nomem;
for (i = tt.tt_token_min; i <= tt.tt_token_max; i++)
- if ((xc_places[i] = (short *)
- malloc((unsigned) xxbufsize * sizeof **xc_places)) == 0)
+ if ((cc_places[i] = (short *)
+ malloc((unsigned) cc_bufsize * sizeof **cc_places)) == 0)
- xc_q0a.qforw = xc_q0a.qback = &xc_q0a;
- xc_q0b.qforw = xc_q0b.qback = &xc_q0b;
- xc_q1a.qforw = xc_q1a.qback = &xc_q1a;
- xc_q1b.qforw = xc_q1b.qback = &xc_q1b;
- if ((p = (struct xc *) malloc((unsigned) xc_ntoken * sizeof *p)) == 0)
+ cc_q0a.qforw = cc_q0a.qback = &cc_q0a;
+ cc_q0b.qforw = cc_q0b.qback = &cc_q0b;
+ cc_q1a.qforw = cc_q1a.qback = &cc_q1a;
+ cc_q1b.qforw = cc_q1b.qback = &cc_q1b;
+ if ((p = (struct cc *) malloc((unsigned) cc_ntoken * sizeof *p)) == 0)
goto nomem;
for (i = 0; i < tt.tt_ntoken; i++) {
p->code = i;
p->time = -1;
goto nomem;
for (i = 0; i < tt.tt_ntoken; i++) {
p->code = i;
p->time = -1;
- p->qback = xc_q0a.qback;
- p->qforw = &xc_q0a;
+ p->qback = cc_q0a.qback;
+ p->qforw = &cc_q0a;
- for (; i < xc_ntoken; i++) {
+ for (; i < cc_ntoken; i++) {
p->code = -1;
p->time = -1;
p->code = -1;
p->time = -1;
- p->qback = xc_q1a.qback;
- p->qforw = &xc_q1a;
+ p->qback = cc_q1a.qback;
+ p->qforw = &cc_q1a;
+ cc_tt_ob = tt_ob;
+ cc_tt_obe = tt_obe;
+ if ((cc_buffer = malloc((unsigned) cc_bufsize)) == 0)
+ goto nomem;
return 0;
nomem:
wwerrno = WWE_NOMEM;
return -1;
}
return 0;
nomem:
wwerrno = WWE_NOMEM;
return -1;
}
- register struct xc *p;
-
- bzero((char *) xc_htab, HSIZE * sizeof *xc_htab);
- for (p = xc_q0a.qforw; p != &xc_q0a; p = p->qforw)
+ register struct cc *p;
+ int ccflush();
+
+ (*tt.tt_flush)();
+ tt_obp = tt_ob = cc_buffer;
+ tt_obe = tt_ob + cc_bufsize;
+ tt.tt_flush = ccflush;
+ bzero((char *) cc_htab, HSIZE * sizeof *cc_htab);
+ for (p = cc_q0a.qforw; p != &cc_q0a; p = p->qforw)
- for (p = xc_q1a.qforw; p != &xc_q1a; p = p->qforw)
+ for (p = cc_q1a.qforw; p != &cc_q1a; p = p->qforw)
+ if (cc_trace)
+ cc_trace_fp = fopen("window-trace", "a");
-xcscan(buffer, bufsize)
- char *buffer;
+ int ttflush();
+
+ (*tt.tt_flush)();
+ tt_obp = tt_ob = cc_tt_ob;
+ tt_obe = cc_tt_obe;
+ tt.tt_flush = ttflush;
+ if (cc_trace_fp != NULL) {
+ (void) fclose(cc_trace_fp);
+ cc_trace_fp = NULL;
+ }
+}
+
+ccflush()
+{
+ int bufsize = tt_obp - tt_ob;
- if (bufsize <= tt.tt_token_min) /* one more for char_sep */
+ if (tt_ob != cc_buffer)
+ abort();
+ if (cc_trace_fp != NULL) {
+ (void) fwrite(tt_ob, 1, bufsize, cc_trace_fp);
+ putc(-1, cc_trace_fp);
+ }
+ if (bufsize < tt.tt_token_min) {
+ ttflush();
- xc_time0 = xc_time;
- xc_time += bufsize;
-#ifdef STATS
- if (verbose >= 0)
- time_begin();
-#endif
- n = xc_sweep_phase(buffer, bufsize, xc_tokens);
-#ifdef STATS
- if (verbose >= 0) {
- time_end();
- time_begin();
-#endif
- xc_compress_phase(xc_output, bufsize, xc_tokens, n);
-#ifdef STATS
- if (verbose >= 0)
- time_end();
-#endif
+ tt_obp = tt_ob = cc_tt_ob;
+ tt_obe = cc_tt_obe;
+ tt.tt_flush = ttflush;
+ cc_time0 = cc_time;
+ cc_time += bufsize;
+ n = cc_sweep_phase(cc_buffer, bufsize, cc_tokens);
+ cc_compress_phase(cc_output, bufsize, cc_tokens, n);
+ cc_output_phase(cc_buffer, cc_output, bufsize);
+ ttflush();
+ tt_obp = tt_ob = cc_buffer;
+ tt_obe = cc_buffer + cc_bufsize;
+ tt.tt_flush = ccflush;
-xc_sweep_phase(buffer, bufsize, tokens)
+cc_sweep_phase(buffer, bufsize, tokens)
- register struct xc **pp = tokens;
+ register struct cc **pp = tokens;
register i, n;
#ifdef STATS
int nn, ii;
#endif
#ifdef STATS
register i, n;
#ifdef STATS
int nn, ii;
#endif
#ifdef STATS
+ if (verbose >= 0)
+ time_begin();
if (verbose > 0)
printf("Sweep:");
#endif
if (verbose > 0)
printf("Sweep:");
#endif
- xc_sweep0(buffer, bufsize, tt.tt_token_min - 1);
+ cc_sweep0(buffer, bufsize, tt.tt_token_min - 1);
(void) fflush(stdout);
}
#endif
(void) fflush(stdout);
}
#endif
- n = xc_sweep(buffer, bufsize, pp, i);
+ n = cc_sweep(buffer, bufsize, pp, i);
pp += n;
#ifdef STATS
if (verbose > 0) {
pp += n;
#ifdef STATS
if (verbose > 0) {
- qinsertq(&xc_q1b, &xc_q1a);
+ qinsertq(&cc_q1b, &cc_q1a);
#ifdef STATS
if (verbose > 0)
printf("\n %d tokens, %d candidates\n",
#ifdef STATS
if (verbose > 0)
printf("\n %d tokens, %d candidates\n",
+ ntoken_stat, nn);
+ if (verbose >= 0)
+ time_end();
#endif
return pp - tokens;
}
#endif
return pp - tokens;
}
-xc_sweep0(buffer, n, length)
+cc_sweep0(buffer, n, length)
- register n;
- register length;
+ register char *p;
+ register short *hc;
- register char *p = buffer;
- register short *hc = xc_hashcodes;
- register h;
+ register short c;
+ register short pc = tt.tt_padc;
- if (--length == 0)
- do {
-#ifdef char_sep
- if ((*hc++ = *p++) == char_sep)
- hc[-1] = -1;
-#else
- *hc++ = *p++;
-#endif
- } while (--n);
- else
- for (n -= length; --n >= 0;) {
-#ifdef char_sep
- if (*p == char_sep) {
- *hc++ = -1;
- p++;
- continue;
- }
-#endif
- h = *p++;
- for (i = length; --i >= 0;) {
-#ifdef char_sep
- if (*p == char_sep) {
- h = -1;
- p += i + 1;
- break;
- }
-#endif
- h = hash(h, *p++);
- }
- *hc++ = h;
- p -= length;
+ /* n and length are at least 1 */
+ p = buffer++;
+ hc = cc_hashcodes;
+ i = n;
+ do {
+ if ((*hc++ = *p++) == pc)
+ hc[-1] = -1;
+ } while (--i);
+ while (--length) {
+ p = buffer++;
+ hc = cc_hashcodes;
+ for (i = n--; --i;) {
+ if ((c = *p++) == pc || *hc < 0)
+ c = -1;
+ else
+ c = hash(*hc, c);
+ *hc++ = c;
-xc_sweep(buffer, bufsize, tokens, length)
+cc_sweep(buffer, bufsize, tokens, length)
register char *cp;
register i;
short *hc;
register char *cp;
register i;
short *hc;
- short *places = xc_places[length];
- struct xc **pp = tokens;
+ short *places = cc_places[length];
+ struct cc **pp = tokens;
short threshold = thresh(length);
short threshold = thresh(length);
short wthreshold = wthresh(length);
short limit = wlimit(length);
#endif
int time;
short wthreshold = wthresh(length);
short limit = wlimit(length);
#endif
int time;
i = length - 1;
bufsize -= i;
cp = buffer + i;
i = length - 1;
bufsize -= i;
cp = buffer + i;
- hc = xc_hashcodes;
- time = xc_time0;
+ hc = cc_hashcodes;
+ time = cc_time0;
for (i = 0; i < bufsize; i++, time++) {
for (i = 0; i < bufsize; i++, time++) {
{
register short *hc1 = hc;
{
register short *hc1 = hc;
-#ifdef char_sep
- if (*hc1 < 0 || *cp == char_sep) {
+ register short c = *cp++;
+ register short hh;
+ if ((hh = *hc1) < 0 || c == pc) {
-#endif
- h = xc_htab + (*hc1 = hash(*hc1, *cp++));
- hc = hc1 + 1;
+ h = cc_htab + (*hc1++ = hash(hh, c));
+ hc = hc1;
}
for (p = *h; p != 0; p = p->hforw)
if (p->length == (char) length) {
}
for (p = *h; p != 0; p = p->hforw)
if (p->length == (char) length) {
- p = xc_q1a.qback;
- if (p == &xc_q1a ||
- p->time >= xc_time0 && p->length == (char) length)
+ p = cc_q1a.qback;
+ if (p == &cc_q1a ||
+ p->time >= cc_time0 && p->length == (char) length)
continue;
if (p->hback != 0)
if ((*p->hback = p->hforw) != 0)
continue;
if (p->hback != 0)
if ((*p->hback = p->hforw) != 0)
while (--n);
}
p->length = length;
while (--n);
}
p->length = length;
-#ifndef xc_weight
- p->weight = xc_weight;
+#ifndef cc_weight
+ p->weight = cc_weight;
#endif
p->time = time;
p->bcount = 1;
#endif
p->time = time;
p->bcount = 1;
p->hforw->hback = &p->hforw;
*h = p;
p->hback = h;
p->hforw->hback = &p->hforw;
*h = p;
p->hback = h;
places[i] = -1;
p->places = i;
#ifdef STATS
places[i] = -1;
p->places = i;
#ifdef STATS
- } else if (p->time < xc_time0) {
-#ifndef xc_weight
+ } else if (p->time < cc_time0) {
+#ifndef cc_weight
if ((p->weight += p->time - time) < 0)
if ((p->weight += p->time - time) < 0)
- p->weight = xc_weight;
- else if ((p->weight += xc_weight) > limit)
+ p->weight = cc_weight;
+ else if ((p->weight += cc_weight) > limit)
p->weight = limit;
#endif
p->time = time;
p->weight = limit;
#endif
p->time = time;
p->flag = 1;
*pp++ = p;
} else
p->flag = 1;
*pp++ = p;
} else
if (p->weight >= wthreshold) {
p->flag = 1;
*pp++ = p;
if (p->weight >= wthreshold) {
p->flag = 1;
*pp++ = p;
} else
#endif
{
p->flag = 0;
} else
#endif
{
p->flag = 0;
}
places[i] = -1;
p->places = i;
#ifdef STATS
}
places[i] = -1;
p->places = i;
#ifdef STATS
#endif
} else if (p->time + length > time) {
/*
#endif
} else if (p->time + length > time) {
/*
* don't update time, but do adjust weight to offset
* the difference
*/
* don't update time, but do adjust weight to offset
* the difference
*/
-#ifndef xc_weight
- if (xc_weight != 0) { /* XXX */
+#ifndef cc_weight
+ if (cc_weight != 0) { /* XXX */
p->weight += time - p->time;
if (!p->flag && p->weight >= wthreshold) {
p->flag = 1;
*pp++ = p;
p->weight += time - p->time;
if (!p->flag && p->weight >= wthreshold) {
p->flag = 1;
*pp++ = p;
}
}
#endif
places[i] = p->places;
p->places = i;
} else {
}
}
#endif
places[i] = p->places;
p->places = i;
} else {
if ((p->weight += p->time - time) < 0)
if ((p->weight += p->time - time) < 0)
- p->weight = xc_weight;
- else if ((p->weight += xc_weight) > limit)
+ p->weight = cc_weight;
+ else if ((p->weight += cc_weight) > limit)
p->weight = limit;
#endif
p->time = time;
p->weight = limit;
#endif
p->time = time;
if (!p->flag &&
/* code must be < 0 if flag false here */
(p->bcount >= threshold
if (!p->flag &&
/* code must be < 0 if flag false here */
(p->bcount >= threshold
|| p->weight >= wthreshold
#endif
)) {
p->flag = 1;
*pp++ = p;
|| p->weight >= wthreshold
#endif
)) {
p->flag = 1;
*pp++ = p;
}
places[i] = p->places;
p->places = i;
}
places[i] = p->places;
p->places = i;
}
if ((i = pp - tokens) > 0) {
*pp = 0;
}
if ((i = pp - tokens) > 0) {
*pp = 0;
- if (xc_reverse)
- xc_sweep_reverse(tokens, places);
- if (xc_sort && i > 1) {
- int xc_token_compare();
+ if (cc_reverse)
+ cc_sweep_reverse(tokens, places);
+ if (cc_sort && i > 1) {
+ int cc_token_compare();
qsort((char *) tokens, i, sizeof *tokens,
qsort((char *) tokens, i, sizeof *tokens,
- if (xc_chop) {
- if ((i = i * xc_chop / 100) == 0)
+ if (cc_chop) {
+ if ((i = i * cc_chop / 100) == 0)
-xc_sweep_reverse(pp, places)
- register struct xc **pp;
+cc_sweep_reverse(pp, places)
+ register struct cc **pp;
register short *places;
{
register short *places;
{
register short front, back, t;
while ((p = *pp++) != 0) {
register short front, back, t;
while ((p = *pp++) != 0) {
-xc_compress_phase(output, bufsize, tokens, ntoken)
- struct xc **output;
- struct xc **tokens;
+cc_compress_phase(output, bufsize, tokens, ntoken)
+ struct cc **output;
+ struct cc **tokens;
{
register i;
bzero((char *) output, bufsize * sizeof *output);
{
register i;
bzero((char *) output, bufsize * sizeof *output);
- for (i = 0; i < xc_npass0; i++)
- xc_compress_phase1(output, tokens, ntoken, 0);
- for (i = 0; i < xc_npass1; i++)
- xc_compress_phase1(output, tokens, ntoken, 1);
- xc_compress_cleanup(output, bufsize);
+ for (i = 0; i < cc_npass0; i++)
+ cc_compress_phase1(output, tokens, ntoken, 0);
+ for (i = 0; i < cc_npass1; i++)
+ cc_compress_phase1(output, tokens, ntoken, 1);
+ cc_compress_cleanup(output, bufsize);
-xc_compress_phase1(output, tokens, ntoken, flag)
- register struct xc **output;
- struct xc **tokens;
+cc_compress_phase1(output, tokens, ntoken, flag)
+ register struct cc **output;
+ struct cc **tokens;
- register struct xc **pp;
+ register struct cc **pp;
+#ifdef STATS
+ int nt = 0, cc = 0, nc = 0;
+#endif
+ if (verbose >= 0)
+ time_begin();
if (verbose > 0)
printf("Compress:");
#endif
if (verbose > 0)
printf("Compress:");
#endif
while (pp < tokens + ntoken) {
#ifdef STATS
if (verbose > 0) {
while (pp < tokens + ntoken) {
#ifdef STATS
if (verbose > 0) {
- xc_ntoken_stat = 0;
- xc_ccount_stat = 0;
- xc_ncover_stat = 0;
+ ntoken_stat = 0;
+ ccount_stat = 0;
+ ncover_stat = 0;
if (i > 2) {
printf("\n ");
i = 0;
if (i > 2) {
printf("\n ");
i = 0;
(void) fflush(stdout);
}
#endif
(void) fflush(stdout);
}
#endif
- pp += xc_compress(output, pp, flag);
+ pp += cc_compress(output, pp, flag);
- if (verbose > 0)
- printf(" %dt %du %dc)", xc_ntoken_stat, xc_ccount_stat,
- xc_ncover_stat);
+ if (verbose > 0) {
+ printf(" %dt %du %dc)", ntoken_stat, ccount_stat,
+ ncover_stat);
+ nt += ntoken_stat;
+ cc += ccount_stat;
+ nc += ncover_stat;
+ }
#endif
}
#ifdef STATS
if (verbose > 0)
#endif
}
#ifdef STATS
if (verbose > 0)
+ printf("\n total: (%dt %du %dc)\n", nt, cc, nc);
+ if (verbose >= 0)
+ time_end();
-xc_compress_cleanup(output, bufsize)
- register struct xc **output;
+cc_compress_cleanup(output, bufsize)
+ register struct cc **output;
- register struct xc **end;
+ register struct cc **end;
/* the previous output phase may have been interrupted */
/* the previous output phase may have been interrupted */
- qinsertq(&xc_q0b, &xc_q0a);
+ qinsertq(&cc_q0b, &cc_q0a);
for (end = output + bufsize; output < end;) {
for (end = output + bufsize; output < end;) {
register length;
if ((p = *output) == 0) {
output++;
register length;
if ((p = *output) == 0) {
output++;
length = p->length;
if (!p->flag) {
} else if (p->code >= 0) {
length = p->length;
if (!p->flag) {
} else if (p->code >= 0) {
p->flag = 0;
} else if (p->ccount == 0) {
*output = 0;
} else if (p->ccount >= thresh(length)
p->flag = 0;
} else if (p->ccount == 0) {
*output = 0;
} else if (p->ccount >= thresh(length)
|| wthreshp(p->weight, length)
#endif
) {
|| wthreshp(p->weight, length)
#endif
) {
-xc_compress(output, tokens, flag)
- struct xc **output;
- struct xc **tokens;
+cc_compress(output, tokens, flag)
+ struct cc **output;
+ struct cc **tokens;
- struct xc **pp = tokens;
- register struct xc *p = *pp++;
+ struct cc **pp = tokens;
+ register struct cc *p = *pp++;
int length = p->length;
int threshold = thresh(length);
int length = p->length;
int threshold = thresh(length);
short wthreshold = wthresh(length);
#endif
short wthreshold = wthresh(length);
#endif
- short *places = xc_places[length];
- int *initial_scores = xc_initial_scores[length];
+ short *places = cc_places[length];
+ int *initial_scores = cc_initial_scores[length];
int initial_score0 = put_token_score(length);
do {
int score;
int initial_score0 = put_token_score(length);
do {
int score;
- register struct xc_undo *undop;
+ register struct cc_undo *undop;
int ccount;
#ifdef STATS
int ncover;
int ccount;
#ifdef STATS
int ncover;
continue;
if (p->code >= 0 || ccount >= threshold)
score = 0;
continue;
if (p->code >= 0 || ccount >= threshold)
score = 0;
else if (p->weight >= wthreshold)
/* allow one fewer match than normal */
/* XXX, should adjust for ccount */
else if (p->weight >= wthreshold)
/* allow one fewer match than normal */
/* XXX, should adjust for ccount */
#endif
else
score = initial_scores[ccount];
#endif
else
score = initial_scores[ccount];
#ifdef STATS
ncover = 0;
#endif
for (i = p->places; i >= 0; i = places[i]) {
#ifdef STATS
ncover = 0;
#endif
for (i = p->places; i >= 0; i = places[i]) {
- register struct xc **jp;
- register struct xc *x;
- register struct xc **ip = output + i;
+ register struct cc **jp;
+ register struct cc *x;
+ register struct cc **ip = output + i;
register score0 = initial_score0;
register score0 = initial_score0;
- struct xc **iip = ip + length;
- struct xc_undo *undop1 = undop;
+ struct cc **iip = ip + length;
+ struct cc_undo *undop1 = undop;
if ((x = *(jp = ip)) != 0)
goto z;
if ((x = *(jp = ip)) != 0)
goto z;
}
if (score > 0) {
#ifdef STATS
}
if (score > 0) {
#ifdef STATS
- xc_ccount_stat += ccount - p->ccount;
- xc_ntoken_stat++;
- xc_ncover_stat += ncover;
+ ccount_stat += ccount - p->ccount;
+ ntoken_stat++;
+ ncover_stat += ncover;
#endif
p->ccount = ccount;
} else {
#endif
p->ccount = ccount;
} else {
- register struct xc_undo *u = xc_undo;
+ register struct cc_undo *u = cc_undo;
if (*undop->pos = x = undop->val)
x->ccount++;
}
if (*undop->pos = x = undop->val)
x->ccount++;
}
-xcwrite(s, n, x)
- register char *s;
- register n;
+cc_output_phase(buffer, output, bufsize)
+ register char *buffer;
+ register struct cc **output;
+ register bufsize;
- register struct xc *p, *p1;
- register struct xc **output = xc_output + x;
+ register struct cc *p, *p1;
- if (n < tt.tt_token_min) {
- (*tt.tt_write)(s, n);
- return;
- }
- for (i = 0; i < n;) {
+ for (i = 0; i < bufsize;) {
if ((p = output[i]) == 0) {
if ((p = output[i]) == 0) {
i++;
} else if (p->code >= 0) {
if (--p->ccount == 0)
i++;
} else if (p->code >= 0) {
if (--p->ccount == 0)
(*tt.tt_put_token)(p->code, p->string, p->length);
wwntokuse++;
wwntoksave += put_token_score(p->length);
i += p->length;
(*tt.tt_put_token)(p->code, p->string, p->length);
wwntokuse++;
wwntoksave += put_token_score(p->length);
i += p->length;
- } else if ((p1 = xc_q0a.qback) != &xc_q0a) {
+ } else if ((p1 = cc_q0a.qback) != &cc_q0a) {
p->code = p1->code;
p1->code = -1;
p->code = p1->code;
p1->code = -1;
(*tt.tt_set_token)(p->code, p->string, p->length);
wwntokdef++;
wwntoksave -= tt.tt_set_token_cost;
i += p->length;
} else {
p->ccount--;
(*tt.tt_set_token)(p->code, p->string, p->length);
wwntokdef++;
wwntoksave -= tt.tt_set_token_cost;
i += p->length;
} else {
p->ccount--;
- (*tt.tt_write)(p->string, p->length);
+ ttwrite(p->string, p->length);
wwntokbad++;
i += p->length;
}
}
wwntokbad++;
i += p->length;
}
}
-xc_token_compare(p1, p2)
- struct xc **p1, **p2;
+cc_token_compare(p1, p2)
+ struct cc **p1, **p2;
{
return (*p2)->bcount - (*p1)->bcount;
}
{
return (*p2)->bcount - (*p1)->bcount;
}
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#)tt.h 3.24 (Berkeley) %G%
+ * @(#)tt.h 3.25 (Berkeley) %G%
char tt_availmodes; /* the display modes supported */
char tt_wrap; /* has auto wrap around */
char tt_retain; /* can retain below (db flag) */
char tt_availmodes; /* the display modes supported */
char tt_wrap; /* has auto wrap around */
char tt_retain; /* can retain below (db flag) */
+ short tt_padc; /* the pad character */
int tt_ntoken; /* number of compression tokens */
int tt_token_min; /* minimun token size */
int tt_token_max; /* maximum token size */
int tt_ntoken; /* number of compression tokens */
int tt_token_min; /* minimun token size */
int tt_token_max; /* maximum token size */
/* the frame characters */
short *tt_frame;
/* the frame characters */
short *tt_frame;
+
+ /* the output routine */
+ int (*tt_flush)();
+/*
+ * tt_padc is used by the compression routine.
+ * It is a short to allow the driver to indicate that there is no padding.
+ */
+#define TT_PADC_NONE 0x100
+
/*
* List of terminal drivers.
*/
/*
* List of terminal drivers.
*/
* These variables have different meanings from the ww_ob* variables.
* But I'm too lazy to think up different names.
*/
* These variables have different meanings from the ww_ob* variables.
* But I'm too lazy to think up different names.
*/
char *tt_obp;
char *tt_obe;
#define ttputc(c) (tt_obp < tt_obe ? (*tt_obp++ = (c)) \
char *tt_obp;
char *tt_obe;
#define ttputc(c) (tt_obp < tt_obe ? (*tt_obp++ = (c)) \
- : (ttflush(), *tt_obp++ = (c)))
+ : ((*tt.tt_flush)(), *tt_obp++ = (c)))
/*
* Convenience macros for the drivers
/*
* Convenience macros for the drivers
-static char sccsid[] = "@(#)ttinit.c 3.21 (Berkeley) %G%";
+static char sccsid[] = "@(#)ttinit.c 3.22 (Berkeley) %G%";
#endif /* not lint */
#include "ww.h"
#endif /* not lint */
#include "ww.h"
register struct tt_tab *tp;
register char *p, *q;
register char *t;
struct winsize winsize;
register struct tt_tab *tp;
register char *p, *q;
register char *t;
struct winsize winsize;
tt_strp = tt_strings;
/*
* Set output buffer size to about 1 second of output time.
*/
tt_strp = tt_strings;
/*
* Set output buffer size to about 1 second of output time.
*/
+ i = MIN(wwbaud/10, 512);
+ if ((tt_ob = malloc((unsigned) i)) == 0) {
+ wwerrno = WWE_NOMEM;
+ return -1;
+ }
- tt_obe = tt_ob + MIN(wwbaud/10, sizeof tt_ob);
/*
* Use the standard name of the terminal (i.e. the second
/*
* Use the standard name of the terminal (i.e. the second
tt.tt_nrow = winsize.ws_row;
tt.tt_ncol = winsize.ws_col;
}
tt.tt_nrow = winsize.ws_row;
tt.tt_ncol = winsize.ws_col;
}
-static char sccsid[] = "@(#)ttoutput.c 3.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)ttoutput.c 3.7 (Berkeley) %G%";
#endif /* not lint */
#include "ww.h"
#endif /* not lint */
#include "ww.h"
break;
case 2:
if (tt_obe - tt_obp < 2)
break;
case 2:
if (tt_obe - tt_obp < 2)
*tt_obp++ = *s++;
*tt_obp++ = *s;
break;
case 3:
if (tt_obe - tt_obp < 3)
*tt_obp++ = *s++;
*tt_obp++ = *s;
break;
case 3:
if (tt_obe - tt_obp < 3)
*tt_obp++ = *s++;
*tt_obp++ = *s++;
*tt_obp++ = *s;
break;
case 4:
if (tt_obe - tt_obp < 4)
*tt_obp++ = *s++;
*tt_obp++ = *s++;
*tt_obp++ = *s;
break;
case 4:
if (tt_obe - tt_obp < 4)
*tt_obp++ = *s++;
*tt_obp++ = *s++;
*tt_obp++ = *s++;
*tt_obp++ = *s++;
*tt_obp++ = *s++;
*tt_obp++ = *s++;
break;
case 5:
if (tt_obe - tt_obp < 5)
break;
case 5:
if (tt_obe - tt_obp < 5)
*tt_obp++ = *s++;
*tt_obp++ = *s++;
*tt_obp++ = *s++;
*tt_obp++ = *s++;
*tt_obp++ = *s++;
*tt_obp++ = *s++;
register m;
while ((m = tt_obe - tt_obp) == 0)
register m;
while ((m = tt_obe - tt_obp) == 0)
if ((m = tt_obe - tt_obp) > n)
m = n;
bcopy(s, tt_obp, m);
if ((m = tt_obe - tt_obp) > n)
m = n;
bcopy(s, tt_obp, m);
-static char sccsid[] = "@(#)ttzapple.c 3.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)ttzapple.c 3.8 (Berkeley) %G%";
#endif /* not lint */
#include "ww.h"
#endif /* not lint */
#include "ww.h"
register x;
if (tt.tt_row == row) {
register x;
if (tt.tt_row == row) {
if ((x = col - tt.tt_col) == 0)
return;
if (col == 0) {
if ((x = col - tt.tt_col) == 0)
return;
if (col == 0) {
goto out;
}
if (row == tt.tt_row + 1) {
goto out;
}
if (row == tt.tt_row + 1) {
+ /*
+ * Do newline first to match the sequence
+ * for scroll down and return
+ */
goto out;
}
if (row == NROW - 1) {
goto out;
}
if (row == NROW - 1) {
+ /* favor local motion for better compression */
+ if (row == tt.tt_row + 1) {
+ ttctrl('j');
+ goto same_row;
+ }
+ if (row == tt.tt_row - 1) {
+ ttctrl('k');
+ goto same_row;
+ }
ttesc('=');
ttputc(' ' + row);
ttputc(' ' + col);
ttesc('=');
ttputc(' ' + row);
ttputc(' ' + col);
s[n - 1] |= 0x80;
ttwrite(s, n);
s[n - 1] &= ~0x80;
s[n - 1] |= 0x80;
ttwrite(s, n);
s[n - 1] &= ~0x80;
- tt.tt_col += n;
- if (tt.tt_col == NCOL)
- tt.tt_col = 0, tt.tt_row++;
tt.tt_col += 3;
}
ttputc(t + 0x81);
tt.tt_col += 3;
}
ttputc(t + 0x81);
- tt.tt_col += n;
- if (tt.tt_col == NCOL)
- tt.tt_col = 0, tt.tt_row++;
tt.tt_clear = zz_clear;
tt.tt_setmodes = zz_setmodes;
tt.tt_frame = gen_frame;
tt.tt_clear = zz_clear;
tt.tt_setmodes = zz_setmodes;
tt.tt_frame = gen_frame;
+ tt.tt_padc = TT_PADC_NONE;
tt.tt_ntoken = 127;
tt.tt_set_token = zz_set_token;
tt.tt_put_token = zz_put_token;
tt.tt_ntoken = 127;
tt.tt_set_token = zz_set_token;
tt.tt_put_token = zz_put_token;
-static char sccsid[] = "@(#)xx.c 3.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)xx.c 3.4 (Berkeley) %G%";
#endif /* not lint */
#include "ww.h"
#endif /* not lint */
#include "ww.h"
if (ttinit() < 0)
return -1;
xxbufsize = tt.tt_nrow * tt.tt_ncol * 2;
if (ttinit() < 0)
return -1;
xxbufsize = tt.tt_nrow * tt.tt_ncol * 2;
- /* xcinit may choose to change xxbufsize */
- if (tt.tt_ntoken > 0 && xcinit() < 0)
+ /* ccinit may choose to change xxbufsize */
+ if (tt.tt_ntoken > 0 && ccinit() < 0)
return -1;
xxbuf = malloc((unsigned) xxbufsize * sizeof *xxbuf);
if (xxbuf == 0) {
return -1;
xxbuf = malloc((unsigned) xxbufsize * sizeof *xxbuf);
if (xxbuf == 0) {
{
(*tt.tt_start)();
if (tt.tt_ntoken > 0)
{
(*tt.tt_start)();
if (tt.tt_ntoken > 0)
xxreset(); /* might be a restart */
}
xxreset(); /* might be a restart */
}
if (tt.tt_scroll_down)
(*tt.tt_scroll_down)(1);
(*tt.tt_move)(tt.tt_nrow - 1, 0);
if (tt.tt_scroll_down)
(*tt.tt_scroll_down)(1);
(*tt.tt_move)(tt.tt_nrow - 1, 0);
+ if (tt.tt_ntoken > 0)
+ ccend();
-static char sccsid[] = "@(#)xxflush.c 3.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)xxflush.c 3.4 (Berkeley) %G%";
#endif /* not lint */
#include "ww.h"
#endif /* not lint */
#include "ww.h"
{
register struct xx *xp, *xq;
{
register struct xx *xp, *xq;
- if (tt.tt_ntoken > 0)
- xcscan(xxbuf, xxbufp - xxbuf); /* XXX, starting point */
for (xp = xx_head; xp != 0 && !(intr && wwinterrupt()); xp = xq) {
switch (xp->cmd) {
case xc_move:
for (xp = xx_head; xp != 0 && !(intr && wwinterrupt()); xp = xq) {
switch (xp->cmd) {
case xc_move:
case xc_write:
(*tt.tt_move)(xp->arg0, xp->arg1);
tt.tt_nmodes = xp->arg3;
case xc_write:
(*tt.tt_move)(xp->arg0, xp->arg1);
tt.tt_nmodes = xp->arg3;
- if (tt.tt_ntoken > 0)
- xcwrite(xp->buf, xp->arg2, xp->buf - xxbuf);
- else
- (*tt.tt_write)(xp->buf, xp->arg2);
+ (*tt.tt_write)(xp->buf, xp->arg2);
xx_tail = 0;
xxbufp = xxbuf;
}
xx_tail = 0;
xxbufp = xxbuf;
}