Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 May 2005 21:23:14 GMT
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 76986 for review
Message-ID:  <200505142123.j4ELNEAh032656@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=76986

Change 76986 by marcel@marcel_nfs on 2005/05/14 21:23:02

	Flesh-out the low-level console:
	o  Reject characters outside the 7-bit unsigned range.
	o  Process selected control characters.
	o  Diplay glyphs for non-control characters. Trim the
	   font table from the first 32 character ghyphs. Since
	   we only accept 7-bit characters, we can also trim the
	   table at the high end (not done yet).
	
	Backspace erases.

Affected files ...

.. //depot/projects/tty/sys/dev/vtc/vtc_con.c#7 edit
.. //depot/projects/tty/sys/dev/vtc/vtc_font.c#2 edit

Differences ...

==== //depot/projects/tty/sys/dev/vtc/vtc_con.c#7 (text+ko) ====

@@ -93,21 +93,50 @@
 {
 	static int col = 0, row = 0;
 	struct vtc_conout *vc = cp->cn_arg;
-	int width = vc->vtc_con_width;
+	int ch, width;
 	u_char *glyph;
 
+	/* Sanity check. */
+	if (c <= 0 || c >= 0x7f)
+		return;
+
+	width = vc->vtc_con_width;
 	switch (c) {
-	case 0x0a:
+	case 8:		/* BS */
+		if (col > 0)
+			col--;
+		ch = ' ';
+		break;
+	case 9:		/* HT */
+		col = (col + 7) & 7;
+		if (col >= 80)
+			col = 79;
+		ch = 0;
+		break;
+	case 10:	/* LF */
+	case 11:	/* VT (processed as LF) */
+	case 12:	/* FF (processed as LF) */
 		col = 0;
 		row++;
+		ch = 0;
+		break;
+	case 13:	/* CR */
+		col = 0;
+		ch = 0;
 		break;
 	default:
-		glyph = vtc_font_8x16 + (c * 16);
+		ch = (c >= ' ') ? c : 0;
+		break;
+	}
+
+	if (ch != 0) {
+		glyph = vtc_font_8x16 + ((ch - ' ') * 16);
 		vc->vtc_con_bitblt(vc, BITBLT_H1TOFB, (uintptr_t)glyph,
 		    width * row * 16 + col * 8, 8, 16, 0, 7);
-		col++;
-		break;
+		if (c != 8)
+			col++;
 	}
+
 	if (col >= 80) {
 		col = 0;
 		row++;

==== //depot/projects/tty/sys/dev/vtc/vtc_font.c#2 (text+ko) ====

@@ -27,31 +27,14 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-unsigned char vtc_font_8x16[16*256] = {
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,126,129,165,129,129,189,153,129,129,
-126,0,0,0,0,0,0,126,255,219,255,255,195,231,255,255,126,0,0,0,0,0,0,0,0,
-108,254,254,254,254,124,56,16,0,0,0,0,0,0,0,0,16,56,124,254,124,56,16,0,
-0,0,0,0,0,0,0,24,60,60,231,231,231,24,24,60,0,0,0,0,0,0,0,24,60,126,255,
-255,126,24,24,60,0,0,0,0,0,0,0,0,0,0,24,60,60,24,0,0,0,0,0,0,255,255,255,
-255,255,255,231,195,195,231,255,255,255,255,255,255,0,0,0,0,0,60,102,66,
-66,102,60,0,0,0,0,0,255,255,255,255,255,195,153,189,189,153,195,255,255,
-255,255,255,0,0,30,14,26,50,120,204,204,204,204,120,0,0,0,0,0,0,60,102,
-102,102,102,60,24,126,24,24,0,0,0,0,0,0,63,51,63,48,48,48,48,112,240,224,
-0,0,0,0,0,0,127,99,127,99,99,99,99,103,231,230,192,0,0,0,0,0,0,24,24,219,
-60,231,60,219,24,24,0,0,0,0,0,128,192,224,240,248,254,248,240,224,192,128,
-0,0,0,0,0,2,6,14,30,62,254,62,30,14,6,2,0,0,0,0,0,0,24,60,126,24,24,24,
-126,60,24,0,0,0,0,0,0,0,102,102,102,102,102,102,102,0,102,102,0,0,0,0,0,
-0,127,219,219,219,123,27,27,27,27,27,0,0,0,0,0,124,198,96,56,108,198,198,
-108,56,12,198,124,0,0,0,0,0,0,0,0,0,0,0,254,254,254,254,0,0,0,0,0,0,24,
-60,126,24,24,24,126,60,24,126,0,0,0,0,0,0,24,60,126,24,24,24,24,24,24,24,
-0,0,0,0,0,0,24,24,24,24,24,24,24,126,60,24,0,0,0,0,0,0,0,0,0,24,12,254,
-12,24,0,0,0,0,0,0,0,0,0,0,0,48,96,254,96,48,0,0,0,0,0,0,0,0,0,0,0,0,192,
-192,192,254,0,0,0,0,0,0,0,0,0,0,0,40,108,254,108,40,0,0,0,0,0,0,0,0,0,0,
-16,56,56,124,124,254,254,0,0,0,0,0,0,0,0,0,254,254,124,124,56,56,16,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,60,60,60,24,24,24,0,24,24,
-0,0,0,0,0,102,102,102,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,108,108,254,108,108,
-108,254,108,108,0,0,0,0,24,24,124,198,194,192,124,6,6,134,198,124,24,24,
-0,0,0,0,0,0,194,198,12,24,48,96,198,134,0,0,0,0,0,0,56,108,108,56,118,220,
+unsigned char vtc_font_8x16[16 * (256 - 32)] = {
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,24,60,60,60,24,24,24,0,24,24,0,0,0,0,
+0,102,102,102,36,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,108,108,254,108,108,108,254,108,108,0,0,0,0,
+24,24,124,198,194,192,124,6,6,134,198,124,24,24,0,0,
+
+0,0,0,0,194,198,12,24,48,96,198,134,0,0,0,0,0,0,56,108,108,56,118,220,
 204,204,204,118,0,0,0,0,0,48,48,48,96,0,0,0,0,0,0,0,0,0,0,0,0,0,12,24,48,
 48,48,48,48,48,24,12,0,0,0,0,0,0,48,24,12,12,12,12,12,12,24,48,0,0,0,0,
 0,0,0,0,0,102,60,255,60,102,0,0,0,0,0,0,0,0,0,0,0,24,24,126,24,24,0,0,0,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200505142123.j4ELNEAh032656>