Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Dec 2008 19:00:22 GMT
From:      Ed Schouten <ed@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 154058 for review
Message-ID:  <200812041900.mB4J0Ml3011472@repoman.freebsd.org>

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

Change 154058 by ed@ed_flippo on 2008/12/04 18:59:41

	Let there be colors!

Affected files ...

.. //depot/projects/mpsafetty/sys/dev/syscons/scterm-teken.c#3 edit
.. //depot/projects/mpsafetty/sys/dev/syscons/teken/teken.h#4 edit

Differences ...

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

@@ -210,6 +210,19 @@
  * libteken routines.
  */
 
+static unsigned char sccolors[8] = {
+	FG_BLACK, FG_RED, FG_GREEN, FG_BROWN, FG_BLUE, FG_MAGENTA, FG_CYAN, 
+	FG_LIGHTGREY,
+};
+
+static inline int
+scteken_attr(const teken_attr_t *a)
+{
+
+	return (((unsigned int)sccolors[a->ta_fgcolor]) << 8) |
+	    (((unsigned int)sccolors[a->ta_bgcolor]) << 12);
+}
+
 static void
 scteken_bell(void *arg)
 {
@@ -238,7 +251,7 @@
 
 	cursor = tp->tp_row * scp->xsize + tp->tp_col;
 	p = sc_vtb_pointer(&scp->vtb, cursor);
-	sc_vtb_putchar(&scp->vtb, p, map[ch], SC_NORM_ATTR << 8);
+	sc_vtb_putchar(&scp->vtb, p, map[ch], scteken_attr(a));
 	mark_all(scp);
 }
 

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

@@ -40,11 +40,11 @@
 typedef unsigned char teken_char_t;
 #endif /* TEKEN_UTF8 */
 typedef unsigned int teken_unit_t;
-typedef char teken_format_t;
+typedef unsigned char teken_format_t;
 #define	TF_BOLD		0x01
 #define	TF_UNDERLINE	0x02
 #define	TF_BLINK	0x04
-typedef char teken_color_t;
+typedef unsigned char teken_color_t;
 #define	TC_BLACK	0
 #define	TC_RED		1
 #define	TC_GREEN	2



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