[8472] in Athena Bugs
VS2 Console Patches. You've been waiting for these for so long...
daemon@ATHENA.MIT.EDU (Mark W. Eichin)
Thu Oct 24 20:19:45 1991
Date: Thu, 24 Oct 91 20:19:28 -0400
From: "Mark W. Eichin" <eichin@Athena.MIT.EDU>
To: bugs@Athena.MIT.EDU
I have two patches for inclusion in the VAX kernel sources.
1) There is a bug in sys/tty.c which only shows up using a
non-external console (such as the qv or sm). When ttwrite detects a
that the output queue is overflowing its high-water mark, it branches
down to the label ovhiwat and fires off ttstart to begin draining the
queue. It assumes, however, that when the queue drops to the low water
mark, it will call wakeup. The qv (and presumably any non-waiting
device) completely drains the queue on any call to ttstart; since the
tty is not asleep, it doesn't call wakeup, and ttwrite hadn't gone to
sleep yet anyway. The fix: only go to sleep if we're still above the
high water mark. [I've tested it in the SIPB office. This has been an
annoyance for about 5 years now; I'd really appreciate seeing the fix
applied to a near future release.]
*** /mit/release.73/source/bsd-4.3/common/sys/sys.vax_bsd43/tty.c Wed Feb 6 14:09:34 1991
--- sys/tty.c Thu Oct 24 18:56:11 1991
***************
*** 1532,1539 ****
--- 1532,1542 ----
return (EWOULDBLOCK);
return (0);
}
+ /* there is a *chance* that ttstart emptied the queue... */
+ if (tp->t_outq.c_cc > hiwat) {
tp->t_state |= TS_ASLEEP;
sleep((caddr_t)&tp->t_outq, TTOPRI);
+ }
splx(s);
goto loop;
}
2) I added the ANSI console support to the VS2 & VS2000 (qv
and sm) consoles several years ago, and never got around to doing full
meta key support or inverse video (both important to pleasant use of
emacs on the console.) The following patches implement a real meta key
(with escape prefixing rather than high bit setting, since pass8 is
inconvenient to set) and recognition of \E[7m for inverse video, and
\E[4m for underlining. The following termcap entry should be added to
/etc/termcap:
sy|ansi-rv|ansi with extra support for VS2 console:\
:co#80:li#24:cl=50\E[;H\E[2J:bs:am:cm=\E[%i%d;%dH:\
:nd=\E[C:up=\E[A:ce=\E[K:ho=\E[H:pt:\
:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:
and /etc/ttys should be changed to use ansi-rv for the default console
type.
The identical patch should be applied to sm.c, with qv changed
to sm and some shift of line numbers. I have not done testing on the
sm, but the existing driver code is identical (and probably ought to
be combined with ifdef's anyway) so testing on the VS2 should probably
count towards the VS2000.
*** /mit/release.73/source/bsd-4.3/common/sys/machineio.vax_bsd43/qv.c Tue Sep 6 05:34:52 1988
--- machineio.vax_bsd43/qv.c Thu Oct 24 19:17:51 1991
***************
*** 199,204 ****
--- 199,205 ----
int shift; /* state variables */
int cntrl;
int lock;
+ int meta;
char last; /* last character */
} qv_keyboard;
***************
*** 545,552 ****
case CNTRL:
qv_keyboard.cntrl ^= 0xffff;
return;
case ALLUP:
! qv_keyboard.cntrl = qv_keyboard.shift = 0;
return;
case REPEAT:
c = qv_keyboard.last;
--- 546,556 ----
case CNTRL:
qv_keyboard.cntrl ^= 0xffff;
return;
+ case META:
+ qv_keyboard.meta ^= 0xffff;
+ return;
case ALLUP:
! qv_keyboard.cntrl = qv_keyboard.meta = qv_keyboard.shift = 0;
return;
case REPEAT:
c = qv_keyboard.last;
***************
*** 577,584 ****
string = q_special[ c & 0x7f ];
while( *string )
(*linesw[tp->t_line].l_rint)(*string++, tp);
! } else
(*linesw[tp->t_line].l_rint)(c, tp);
} else {
/*
* Mouse channel is open put it into the event queue
--- 581,595 ----
string = q_special[ c & 0x7f ];
while( *string )
(*linesw[tp->t_line].l_rint)(*string++, tp);
! } else {
! if( qv_keyboard.meta )
! #ifdef META_8BIT
! c |= 0x80;
! #else
! (*linesw[tp->t_line].l_rint)(0x1b, tp);
! #endif
(*linesw[tp->t_line].l_rint)(c, tp);
+ }
} else {
/*
* Mouse channel is open put it into the event queue
***************
*** 965,970 ****
--- 981,994 ----
* by a window manager.
*
*/
+
+ /*
+ * Values for character attribute bit mask
+ */
+ #define CHAR_NONE 0
+ #define CHAR_REVERSE 1
+ #define CHAR_UNDERLINE 2
+
qvputc( c )
register char c;
{
***************
*** 978,985 ****
NORM = 0, ESC, ESCBRAK,
} state = NORM;
static int num_row=0, num_col=0, cur_num=0;
-
/*
* This routine may be called in physical mode by the dump code
* so we check and punt if that's the case.
--- 1002,1009 ----
NORM = 0, ESC, ESCBRAK,
} state = NORM;
static int num_row=0, num_col=0, cur_num=0;
+ static char_attr=0;
/*
* This routine may be called in physical mode by the dump code
* so we check and punt if that's the case.
***************
*** 1053,1073 ****
/* inline expansion for speed */
! *b_row = *f_row++; b_row += ote;
! *b_row = *f_row++; b_row += ote;
! *b_row = *f_row++; b_row += ote;
! *b_row = *f_row++; b_row += ote;
! *b_row = *f_row++; b_row += ote;
! *b_row = *f_row++; b_row += ote;
! *b_row = *f_row++; b_row += ote;
! *b_row = *f_row++; b_row += ote;
! *b_row = *f_row++; b_row += ote;
! *b_row = *f_row++; b_row += ote;
! *b_row = *f_row++; b_row += ote;
! *b_row = *f_row++; b_row += ote;
! *b_row = *f_row++; b_row += ote;
! *b_row = *f_row++; b_row += ote;
! *b_row = *f_row++; b_row += ote;
/* the following is so that ansi marginning works... */
if( ++qp->col >= qp->max_col ) {
qp->col = 0 ;
--- 1077,1102 ----
/* inline expansion for speed */
! *b_row = (char_attr & CHAR_REVERSE)?(*f_row++ ^ 0xff):(*f_row++); b_row += ote;
! *b_row = (char_attr & CHAR_REVERSE)?(*f_row++ ^ 0xff):(*f_row++); b_row += ote;
! *b_row = (char_attr & CHAR_REVERSE)?(*f_row++ ^ 0xff):(*f_row++); b_row += ote;
! *b_row = (char_attr & CHAR_REVERSE)?(*f_row++ ^ 0xff):(*f_row++); b_row += ote;
!
! *b_row = (char_attr & CHAR_REVERSE)?(*f_row++ ^ 0xff):(*f_row++); b_row += ote;
! *b_row = (char_attr & CHAR_REVERSE)?(*f_row++ ^ 0xff):(*f_row++); b_row += ote;
! *b_row = (char_attr & CHAR_REVERSE)?(*f_row++ ^ 0xff):(*f_row++); b_row += ote;
! *b_row = (char_attr & CHAR_REVERSE)?(*f_row++ ^ 0xff):(*f_row++); b_row += ote;
!
! *b_row = (char_attr & CHAR_REVERSE)?(*f_row++ ^ 0xff):(*f_row++); b_row += ote;
! *b_row = (char_attr & CHAR_REVERSE)?(*f_row++ ^ 0xff):(*f_row++); b_row += ote;
! *b_row = (char_attr & CHAR_REVERSE)?(*f_row++ ^ 0xff):(*f_row++); b_row += ote;
! *b_row = (char_attr & CHAR_REVERSE)?(*f_row++ ^ 0xff):(*f_row++); b_row += ote;
!
! *b_row = (char_attr & CHAR_REVERSE)?(*f_row++ ^ 0xff):(*f_row++); b_row += ote;
! *b_row = (char_attr & CHAR_UNDERLINE)?((char_attr & CHAR_REVERSE)?0:0xff):
! ((char_attr & CHAR_REVERSE)?(*f_row ^ 0xff):(*f_row)); f_row++; b_row += ote;
! *b_row = (char_attr & CHAR_REVERSE)?(*f_row++ ^ 0xff):(*f_row++); b_row += ote;
!
/* the following is so that ansi marginning works... */
if( ++qp->col >= qp->max_col ) {
qp->col = 0 ;
***************
*** 1155,1165 ****
--- 1184,1220 ----
state = NORM;
return(0);
+ case 'm':
+ /* \E[7m = reverse video
+ * \E[m = disable modes
+ * \E[16m = bitrot characters
+ */
+
+ switch(cur_num) {
+ case 0:
+ /* clear modes */
+ char_attr = CHAR_NONE;
+ break;
+ case 4:
+ /* set reverse video */
+ char_attr |= CHAR_UNDERLINE;
+ break;
+ case 7:
+ /* set reverse video */
+ char_attr |= CHAR_REVERSE;
+ break;
+ }
+
+ cur_num = 0;
+ state = NORM;
+ return(0);
+
default:
state = NORM;
return(0);
}
break;
+
default:
state = NORM;
return(0);
_Mark_ <eichin@athena.mit.edu>
MIT Student Information Processing Board
Cygnus Support <eichin@cygnus.com>