From owner-p4-projects@FreeBSD.ORG Sun Dec 7 12:28:29 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A7A971065673; Sun, 7 Dec 2008 12:28:29 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52F9D106564A for ; Sun, 7 Dec 2008 12:28:29 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 412EB8FC0C for ; Sun, 7 Dec 2008 12:28:29 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id mB7CSTBq062467 for ; Sun, 7 Dec 2008 12:28:29 GMT (envelope-from ed@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id mB7CSTfx062465 for perforce@freebsd.org; Sun, 7 Dec 2008 12:28:29 GMT (envelope-from ed@FreeBSD.org) Date: Sun, 7 Dec 2008 12:28:29 GMT Message-Id: <200812071228.mB7CSTfx062465@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to ed@FreeBSD.org using -f From: Ed Schouten To: Perforce Change Reviews Cc: Subject: PERFORCE change 154249 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Dec 2008 12:28:29 -0000 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. */