Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Dec 2008 12:28:29 GMT
From:      Ed Schouten <ed@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 154249 for review
Message-ID:  <200812071228.mB7CSTfx062465@repoman.freebsd.org>

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

Change 154249 by ed@ed_flippo on 2008/12/07 12:27:41

	- Import updated libteken with support for 132 column mode (not
	  implemented by us).
	
	- Replace UTF-8 characters by bright yellow/red cells with a
	  question mark for now. We still need UTF-8 font maps.

Affected files ...

.. //depot/projects/mpsafetty/sys/dev/syscons/scterm-teken.c#14 edit
.. //depot/projects/mpsafetty/sys/dev/syscons/teken/teken.h#7 edit
.. //depot/projects/mpsafetty/sys/dev/syscons/teken/teken_subr.h#5 edit

Differences ...

==== //depot/projects/mpsafetty/sys/dev/syscons/scterm-teken.c#14 (text+ko) ====

@@ -265,11 +265,19 @@
 {
 	scr_stat *scp = arg;
 	u_char *map;
-	u_char ch = c;
+	u_char ch;
 	vm_offset_t p;
 	int cursor, attr;
 
-	attr = scteken_attr(a);
+	if (c >= 0x80) {
+		/* XXX: Don't display UTF-8 yet. */
+		attr = (FG_YELLOW|BG_RED) << 8;
+		ch = '?';
+	} else {
+		attr = scteken_attr(a);
+		ch = c;
+	}
+
 	map = scp->sc->scr_map;
 
 	cursor = tp->tp_row * scp->xsize + tp->tp_col;
@@ -287,11 +295,19 @@
 {
 	scr_stat *scp = arg;
 	u_char *map;
-	u_char ch = c;
+	u_char ch;
 	unsigned int width;
 	int attr, row;
 
-	attr = scteken_attr(a);
+	if (c >= 0x80) {
+		/* XXX: Don't display UTF-8 yet. */
+		attr = (FG_YELLOW|BG_RED) << 8;
+		ch = '?';
+	} else {
+		attr = scteken_attr(a);
+		ch = c;
+	}
+
 	map = scp->sc->scr_map;
 
 	if (r->tr_begin.tp_col == 0 && r->tr_end.tp_col == scp->xsize) {

==== //depot/projects/mpsafetty/sys/dev/syscons/teken/teken.h#7 (text+ko) ====

@@ -95,6 +95,7 @@
 #define	TP_KEYPADAPP	2
 #define	TP_AUTOREPEAT	3
 #define	TP_SWITCHVT	4
+#define	TP_132COLS	5
 typedef void tf_respond_t(void *, const void *, size_t);
 
 typedef struct {

==== //depot/projects/mpsafetty/sys/dev/syscons/teken/teken_subr.h#5 (text+ko) ====

@@ -24,9 +24,10 @@
  * SUCH DAMAGE.
  */
 
+static void teken_subr_cursor_up(teken_t *, unsigned int);
 static void teken_subr_erase_line(teken_t *, unsigned int);
 static void teken_subr_regular_character(teken_t *, teken_char_t);
-static void teken_subr_cursor_up(teken_t *, unsigned int);
+static void teken_subr_reset_to_initial_state(teken_t *);
 
 static inline int
 teken_tab_isset(teken_t *t, unsigned int col)
@@ -684,25 +685,33 @@
 static void
 teken_subr_regular_character(teken_t *t, teken_char_t c)
 {
+	unsigned int width;
 
 	/* Unprintable characters. */
 	if (c <= 0x1B)
 		return;
+	
+	/* XXX: calculate character width! */
+#ifdef TEKEN_UTF8
+	width = 1;
+#else /* !TEKEN_UTF8 */
+	width = 1;
+#endif /* TEKEN_UTF8 */
 
 	if (t->t_stateflags & TS_INSERT) {
 		/*
 		 * Insert mode. Keep cursor at the same place, but move
 		 * all existing characters to the right.
 		 */
-		if (t->t_cursor.tp_col < t->t_winsize.tp_col - 1) {
+		if (t->t_cursor.tp_col < t->t_winsize.tp_col - width) {
 			teken_rect_t tr;
 			teken_pos_t tp;
 
 			tr.tr_begin = t->t_cursor;
 			tr.tr_end.tp_row = t->t_cursor.tp_row + 1;
-			tr.tr_end.tp_col = t->t_winsize.tp_col - 1;
+			tr.tr_end.tp_col = t->t_winsize.tp_col - width;
 			tp.tp_row = t->t_cursor.tp_row;
-			tp.tp_col = t->t_cursor.tp_col + 1;
+			tp.tp_col = t->t_cursor.tp_col + width;
 			teken_funcs_copy(t, &tr, &tp);
 		}
 
@@ -733,7 +742,7 @@
 		teken_funcs_putchar(t, &tp, c, &t->t_curattr);
 
 		t->t_cursor.tp_row = tp.tp_row;
-		t->t_cursor.tp_col = 1;
+		t->t_cursor.tp_col = width;
 		t->t_stateflags &= ~TS_WRAPPED;
 	} else {
 		/* No scrolling needed. */
@@ -741,7 +750,7 @@
 		if (t->t_cursor.tp_col == t->t_winsize.tp_col - 1) {
 			t->t_stateflags |= TS_WRAPPED;
 		} else {
-			t->t_cursor.tp_col++;
+			t->t_cursor.tp_col += width;
 			t->t_stateflags &= ~TS_WRAPPED;
 		}
 	}
@@ -758,19 +767,13 @@
 		teken_funcs_param(t, TP_CURSORKEYS, 0);
 		break;
 	case 3: /* 132 column mode. */
-		teken_printf("DECRST 132 columns\n");
-		/* XXX: temporary hacks to allow autowrap testing. */
-		teken_subr_erase_display(t, 2);
-		t->t_cursor.tp_row = 0;
-		t->t_cursor.tp_col = 0;
-		t->t_stateflags &= ~TS_WRAPPED;
-		teken_funcs_cursor(t);
+		teken_funcs_param(t, TP_132COLS, 0);
+		teken_subr_reset_to_initial_state(t);
 		break;
 	case 5: /* Inverse video. */
 		teken_printf("DECRST inverse video\n");
 		break;
 	case 6: /* Origin mode. */
-		teken_printf("DECRST origin mode\n");
 		t->t_stateflags &= ~TS_ORIGIN;
 		t->t_originreg.ts_begin = 0;
 		t->t_originreg.ts_end = t->t_winsize.tp_row;
@@ -779,7 +782,6 @@
 		teken_funcs_cursor(t);
 		break;
 	case 7: /* Autowrap mode. */
-		teken_printf("DECRST autowrap mode\n");
 		t->t_stateflags &= ~TS_AUTOWRAP;
 		break;
 	case 8: /* Autorepeat mode. */
@@ -892,19 +894,13 @@
 		teken_funcs_param(t, TP_CURSORKEYS, 1);
 		break;
 	case 3: /* 132 column mode. */
-		teken_printf("DECSET 132 columns\n");
-		/* XXX: temporary hacks to allow autowrap testing. */
-		teken_subr_erase_display(t, 2);
-		t->t_cursor.tp_row = 0;
-		t->t_cursor.tp_col = 0;
-		t->t_stateflags &= ~TS_WRAPPED;
-		teken_funcs_cursor(t);
+		teken_funcs_param(t, TP_132COLS, 1);
+		teken_subr_reset_to_initial_state(t);
 		break;
 	case 5: /* Inverse video. */
 		teken_printf("DECSET inverse video\n");
 		break;
 	case 6: /* Origin mode. */
-		teken_printf("DECSET origin mode\n");
 		t->t_stateflags |= TS_ORIGIN;
 		t->t_originreg = t->t_scrollreg;
 		t->t_cursor.tp_row = t->t_scrollreg.ts_begin;
@@ -913,7 +909,6 @@
 		teken_funcs_cursor(t);
 		break;
 	case 7: /* Autowrap mode. */
-		teken_printf("DECSET autowrap mode\n");
 		t->t_stateflags |= TS_AUTOWRAP;
 		break;
 	case 8: /* Autorepeat mode. */



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