SCCS-vsn: usr.bin/window/tth19.c 3.23
SCCS-vsn: usr.bin/window/tth29.c 3.8
SCCS-vsn: usr.bin/window/tt.h 3.24
SCCS-vsn: usr.bin/window/ttzapple.c 3.7
SCCS-vsn: usr.bin/window/tth19.c 3.23
SCCS-vsn: usr.bin/window/tth29.c 3.8
* 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.23 (Berkeley) %G%
+ * @(#)tt.h 3.24 (Berkeley) %G%
/*
* Buffered output without stdio.
/*
* Buffered output without stdio.
- * These variables have different meanings from the ww_ob* variabels.
+ * These variables have different meanings from the ww_ob* variables.
* But I'm too lazy to think up different names.
*/
char tt_ob[512];
* But I'm too lazy to think up different names.
*/
char tt_ob[512];
char *tt_obe;
#define ttputc(c) (tt_obp < tt_obe ? (*tt_obp++ = (c)) \
: (ttflush(), *tt_obp++ = (c)))
char *tt_obe;
#define ttputc(c) (tt_obp < tt_obe ? (*tt_obp++ = (c)) \
: (ttflush(), *tt_obp++ = (c)))
+
+/*
+ * Convenience macros for the drivers
+ * They require char.h
+ */
+#define ttctrl(c) ttputc(ctrl(c))
+#define ttesc(c) (ttctrl('['), ttputc(c))
-static char sccsid[] = "@(#)tth19.c 3.22 (Berkeley) %G%";
+static char sccsid[] = "@(#)tth19.c 3.23 (Berkeley) %G%";
#endif /* not lint */
#include "ww.h"
#include "tt.h"
#endif /* not lint */
#include "ww.h"
#include "tt.h"
/*
kb|h19|heath|h19-b|h19b|heathkit|heath-19|z19|zenith:
/*
kb|h19|heath|h19-b|h19b|heathkit|heath-19|z19|zenith:
-#define pc(c) ttputc(c)
-#define esc() pc('\033')
#define PAD(ms10) { \
register i; \
for (i = ((ms10) + 5) / h19_msp10c; --i >= 0;) \
#define PAD(ms10) { \
register i; \
for (i = ((ms10) + 5) / h19_msp10c; --i >= 0;) \
}
#define ICPAD() PAD((NCOL - tt.tt_col) * 1) /* 0.1 ms per char */
#define ILPAD() PAD((NROW - tt.tt_row) * 10) /* 1 ms per char */
}
#define ICPAD() PAD((NCOL - tt.tt_col) * 1) /* 0.1 ms per char */
#define ILPAD() PAD((NROW - tt.tt_row) * 10) /* 1 ms per char */
-#define H19_SETINSERT(m) (esc(), (tt.tt_insert = (m)) ? pc('@') : pc('O'))
+#define H19_SETINSERT(m) ttesc((tt.tt_insert = (m)) ? '@' : 'O')
h19_setmodes(new)
register new;
h19_setmodes(new)
register new;
register diff;
diff = new ^ tt.tt_modes;
register diff;
diff = new ^ tt.tt_modes;
- if (diff & WWM_REV) {
- esc();
- if (new & WWM_REV)
- pc('p');
- else
- pc('q');
- }
- if (diff & WWM_GRP) {
- esc();
- if (new & WWM_GRP)
- pc('F');
- else
- pc('G');
- }
+ if (diff & WWM_REV)
+ ttesc(new & WWM_REV ? 'p' : 'q');
+ if (diff & WWM_GRP)
+ ttesc(new & WWM_REV ? 'F' : 'G');
tt.tt_modes = new;
}
h19_insline(n)
{
while (--n >= 0) {
tt.tt_modes = new;
}
h19_insline(n)
{
while (--n >= 0) {
h19_delline(n)
{
while (--n >= 0) {
h19_delline(n)
{
while (--n >= 0) {
(*tt.tt_setmodes)(tt.tt_nmodes);
if (tt.tt_insert)
H19_SETINSERT(0);
(*tt.tt_setmodes)(tt.tt_nmodes);
if (tt.tt_insert)
H19_SETINSERT(0);
if (++tt.tt_col == NCOL)
tt.tt_col = NCOL - 1;
}
if (++tt.tt_col == NCOL)
tt.tt_col = NCOL - 1;
}
if (tt.tt_col == col)
return;
if (col == 0) {
if (tt.tt_col == col)
return;
if (col == 0) {
goto out;
}
if (tt.tt_col == col - 1) {
goto out;
}
if (tt.tt_col == col - 1) {
goto out;
}
if (tt.tt_col == col + 1) {
goto out;
}
if (tt.tt_col == col + 1) {
goto out;
}
}
if (tt.tt_col == col) {
if (tt.tt_row == row + 1) {
goto out;
}
}
if (tt.tt_col == col) {
if (tt.tt_row == row + 1) {
goto out;
}
if (tt.tt_row == row - 1) {
goto out;
}
if (tt.tt_row == row - 1) {
goto out;
}
}
if (col == 0 && row == 0) {
goto out;
}
}
if (col == 0 && row == 0) {
- esc();
- pc('Y');
- pc(' ' + row);
- pc(' ' + col);
+ ttesc('Y');
+ ttputc(' ' + row);
+ ttputc(' ' + col);
out:
tt.tt_col = col;
tt.tt_row = row;
out:
tt.tt_col = col;
tt.tt_row = row;
{
if (gen_VS)
ttxputs(gen_VS);
{
if (gen_VS)
ttxputs(gen_VS);
- esc();
- pc('w');
- esc();
- pc('E');
+ ttesc('w');
+ ttesc('E');
tt.tt_col = tt.tt_row = 0;
tt.tt_insert = 0;
tt.tt_nmodes = tt.tt_modes = 0;
tt.tt_col = tt.tt_row = 0;
tt.tt_insert = 0;
tt.tt_nmodes = tt.tt_modes = 0;
H19_SETINSERT(0);
if (gen_VE)
ttxputs(gen_VE);
H19_SETINSERT(0);
if (gen_VE)
ttxputs(gen_VE);
(*tt.tt_setmodes)(tt.tt_nmodes);
if (!tt.tt_insert)
H19_SETINSERT(1);
(*tt.tt_setmodes)(tt.tt_nmodes);
if (!tt.tt_insert)
H19_SETINSERT(1);
if (tt.tt_insert)
ICPAD();
if (++tt.tt_col == NCOL)
if (tt.tt_insert)
ICPAD();
if (++tt.tt_col == NCOL)
- while (--n >= 0) {
- esc();
- pc('N');
- }
+ while (--n >= 0)
+ ttesc('N');
}
h19_scroll_down(n)
{
h19_move(NROW - 1, 0);
while (--n >= 0)
}
h19_scroll_down(n)
{
h19_move(NROW - 1, 0);
while (--n >= 0)
}
h19_scroll_up(n)
{
h19_move(0, 0);
}
h19_scroll_up(n)
{
h19_move(0, 0);
- while (--n >= 0) {
- esc();
- pc('I');
- }
+ while (--n >= 0)
+ ttesc('I');
-static char sccsid[] = "@(#)tth29.c 3.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)tth29.c 3.8 (Berkeley) %G%";
#endif /* not lint */
#include "ww.h"
#include "tt.h"
#endif /* not lint */
#include "ww.h"
#include "tt.h"
-#define pc(c) ttputc(c)
-#define esc() pc('\033')
-
h29_setmodes(new)
register new;
{
h29_setmodes(new)
register new;
{
modes += 0x08;
if (new & WWM_USR)
modes += 0x10;
modes += 0x08;
if (new & WWM_USR)
modes += 0x10;
- esc();
- pc('s');
- pc(modes);
+ ttesc('s');
+ ttputc(modes);
if (new & WWM_GRP) {
if ((tt.tt_modes & WWM_GRP) == 0)
if (new & WWM_GRP) {
if ((tt.tt_modes & WWM_GRP) == 0)
} else
if (tt.tt_modes & WWM_GRP)
} else
if (tt.tt_modes & WWM_GRP)
-static char sccsid[] = "@(#)ttzapple.c 3.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)ttzapple.c 3.7 (Berkeley) %G%";
#endif /* not lint */
#include "ww.h"
#endif /* not lint */
#include "ww.h"
#define NROW 24
#define TOKEN_MAX 32
#define NROW 24
#define TOKEN_MAX 32
-#define pc(c) ttputc(c)
-#define esc(c) (pc(ctrl('[')), pc(c))
-
extern short gen_frame[];
zz_setmodes(new)
{
if (new & WWM_REV) {
if ((tt.tt_modes & WWM_REV) == 0)
extern short gen_frame[];
zz_setmodes(new)
{
if (new & WWM_REV) {
if ((tt.tt_modes & WWM_REV) == 0)
} else
if (tt.tt_modes & WWM_REV)
} else
if (tt.tt_modes & WWM_REV)
tt.tt_modes = new;
}
zz_insline(n)
{
if (n == 1)
tt.tt_modes = new;
}
zz_insline(n)
{
if (n == 1)
- esc('A');
- pc(n + ' ');
+ ttesc('A');
+ ttputc(n + ' ');
}
}
zz_delline(n)
{
if (n == 1)
}
}
zz_delline(n)
{
if (n == 1)
- esc('D');
- pc(n + ' ');
+ ttesc('D');
+ ttputc(n + ' ');
if ((x = col - tt.tt_col) == 0)
return;
if (col == 0) {
if ((x = col - tt.tt_col) == 0)
return;
if (col == 0) {
goto out;
}
switch (x) {
case 2:
goto out;
}
switch (x) {
case 2:
goto out;
}
if (col & 7 == 0 && x > 0 && x <= 16) {
goto out;
}
if (col & 7 == 0 && x > 0 && x <= 16) {
- esc('<');
- pc(col + ' ');
+ ttesc('<');
+ ttputc(col + ' ');
goto out;
}
if (tt.tt_col == col) {
switch (row - tt.tt_row) {
case 2:
goto out;
}
if (tt.tt_col == col) {
switch (row - tt.tt_row) {
case 2:
goto out;
}
if (col == 0) {
goto out;
}
if (col == 0) {
if (row == NROW - 1)
goto ll;
}
if (row == NROW - 1)
goto ll;
}
- esc('>');
- pc(row + ' ');
+ ttesc('>');
+ ttputc(row + ' ');
goto out;
}
if (col == 0) {
if (row == 0) {
home:
goto out;
}
if (col == 0) {
if (row == 0) {
home:
goto out;
}
if (row == tt.tt_row + 1) {
goto out;
}
if (row == tt.tt_row + 1) {
+ ttctrl('m');
+ ttctrl('j');
goto out;
}
if (row == NROW - 1) {
ll:
goto out;
}
if (row == NROW - 1) {
ll:
- esc('=');
- pc(' ' + row);
- pc(' ' + col);
+ ttesc('=');
+ ttputc(' ' + row);
+ ttputc(' ' + col);
out:
tt.tt_col = col;
tt.tt_row = row;
out:
tt.tt_col = col;
tt.tt_row = row;
zz_setmodes(0);
zz_setscroll(0, NROW - 1);
zz_clear();
zz_setmodes(0);
zz_setscroll(0, NROW - 1);
zz_clear();
- esc('T');
- pc(TOKEN_MAX + ' ');
+ ttesc('T');
+ ttputc(TOKEN_MAX + ' ');
+ ttesc('T');
+ ttputc(' ');
tt.tt_col = tt.tt_row = 0;
}
zz_insspace(n)
{
if (n == 1)
tt.tt_col = tt.tt_row = 0;
}
zz_insspace(n)
{
if (n == 1)
- esc('I');
- pc(n + ' ');
+ ttesc('I');
+ ttputc(n + ' ');
}
}
zz_delchar(n)
{
if (n == 1)
}
}
zz_delchar(n)
{
if (n == 1)
- esc('C');
- pc(n + ' ');
+ ttesc('C');
+ ttputc(n + ' ');
{
if (n == 1)
if (tt.tt_row == NROW - 1)
{
if (n == 1)
if (tt.tt_row == NROW - 1)
- esc('F');
- pc(n + ' ');
+ ttesc('F');
+ ttputc(n + ' ');
}
}
zz_scroll_up(n)
{
if (n == 1)
}
}
zz_scroll_up(n)
{
if (n == 1)
- esc('R');
- pc(n + ' ');
+ ttesc('R');
+ ttputc(n + ' ');
}
}
zz_setscroll(top, bot)
{
}
}
zz_setscroll(top, bot)
{
- esc('?');
- pc(top + ' ');
- pc(bot + ' ');
+ ttesc('?');
+ ttputc(top + ' ');
+ ttputc(bot + ' ');
tt.tt_scroll_top = top;
tt.tt_scroll_bot = bot;
}
tt.tt_scroll_top = top;
tt.tt_scroll_bot = bot;
}
ttputs(buf);
tt.tt_col += 3;
}
ttputs(buf);
tt.tt_col += 3;
}
+ ttputc(0x80);
+ ttputc(t + 1);
s[n - 1] |= 0x80;
ttwrite(s, n);
s[n - 1] &= ~0x80;
s[n - 1] |= 0x80;
ttwrite(s, n);
s[n - 1] &= ~0x80;
ttputs(buf);
tt.tt_col += 3;
}
ttputs(buf);
tt.tt_col += 3;
}
tt.tt_col += n;
if (tt.tt_col == NCOL)
tt.tt_col = 0, tt.tt_row++;
tt.tt_col += n;
if (tt.tt_col == NCOL)
tt.tt_col = 0, tt.tt_row++;