/************************************************************************ * * * copyright Richard Bornat 1981 * * * ************************************************************************/ /************************************************************************ * * * tvi920 - as used at Birkbeck. No reasonable * * way of making bright characters, and the convention * * for control keys is horrid. * * * ************************************************************************/ tvi_move(srow, scol) register int srow, scol; { /* ESC, =, row+040, col+040 */ ttyout('\033'); ttyout('='); ttyout(srow+040); ttyout(scol+040); } int tvi_special(typein, c) int typein; register char c; /* returns the character type corresponding to * tvi 'ctrl-a, character, return' combination. * On input returns class IGN (which will treat character as * ctrl-a) */ { register char ch, ctype=IGN; if (c!='\001') editerror("character %o given to tvi_special", c); else if (typein) { ch = ttyin(); switch(ch) { case 0100: ctype = WLEFT; break; case 0101: ctype = WRIGHT; break; case 0102: ctype = LSTART; break; case 0103: ctype = LEND; break; case 0104: ctype = SEND; break; case 0105: if (mode==in_mode) ctype = LINEERASE; break; default: break; } ch = ttyin(); if (ch!='\015') ctype = IGN; if (ctype==IGN) complain(); return(ctype); } else return(IGN); } tvi_pad() { register int i; for (i=1; i<=10; i++) ttyout('\0'); } #define TER_ROWS 24 #define TER_COLS 80 struct TERMINAL tvi_ter = { /* nrows, ncols - size of the screen */ TER_ROWS, TER_COLS, /* up, left, c_MODIFY, c_CONTROL, c_BLOB - single characters */ { '\013', '\010', 0, '^'|0200, '*'|0200 }, /* onechar */ /* rollup, pushdown, pushup, pulldown, pullup STRINGS */ /* and hardscroll boolean */ { "\0\012", "\0\033E", 0, 0, "\0\033R", true }, /* scrseq */ /* scrollup, scrolldown PROCEDURES */ scr2_up, scr2_down, /* splitdown, splitup, joindown, joinup STRINGS */ { 0, 0, 0, 0 }, /* splitseq */ /* split_row, join_row PROCEDURES */ split0, join0, /* clearscreen, clearhead, cleartail STRINGS */ { "\033+", 0, "\033T" }, /* clrseq */ /* clr_screen, clr_head, clr_tail PROCEDURES */ clrs1, clrh0, clrt1, /* inspace, makespace, rubout, erase STRINGS */ { 0, "\033Q", 0, "\033W" }, /* charseq */ /* ins_char, del_char PROCEDURES */ insc2, delc2, /* bright, normal STRINGS */ { "\033)", "\033(" }, /* vidseq */ /* in_two, out_two PROCEDURES */ no_char, no_char, /* move PROCEDURE and nmove integer */ tvi_move, 4, /* setup, special, pad PROCEDURES */ no_int, tvi_special, tvi_pad }; /* table of characters for input (INMODE) mode */ char ictab[] = { /* 000 - 007, null - ^G */ IGN, SPECIAL, WLEFT, IGN, IGN, DOWN, TAILERASE, WERASE, /* 010 - 017, ^H - ^O */ LEFT, TAB, DOWN, UP, RIGHT, CR, BOTSCREEN, TOPSCREEN, /* 020 - 027, ^P - ^W */ IGN, RIGHT, ERASE, UP, IGN, LEFT, SEND, WRUBOUT, /* 030 - 037, ^X - ^_ */ HEADRUBOUT, CHMODE, CONTROL, ENTERedit, IGN, LINEERASE, IGN, IGN, SPACE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, RUBOUT }; /* table of characters for edit (EDMODE) mode. Much the same * as ictab, except for the absence of UP, DOWN, TOPSCREEN, * BOTSCREEN and LINEERASE. CR or LF are also COMMAND in this mode */ char ectab[] = { /* 000 - 007, null - ^G */ IGN, SPECIAL, WLEFT, IGN, IGN, IGN, TAILERASE, WERASE, /* 010 - 017, ^H - ^O */ LEFT, TAB, IGN, IGN, RIGHT, COMMAND, IGN, IGN, /* 020 - 027, ^P - ^W */ IGN, RIGHT, ERASE, IGN, IGN, LEFT, SEND, WRUBOUT, /* 030 - 037, ^X - ^_ */ HEADRUBOUT, CHMODE, CONTROL, ENTERedit, IGN, IGN, IGN, IGN, SPACE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE, RUBOUT };