PERFORCE change 154058 for review

Ed Schouten ed at FreeBSD.org
Thu Dec 4 11:00:22 PST 2008


http://perforce.freebsd.org/chv.cgi?CH=154058

Change 154058 by ed at 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


More information about the p4-projects mailing list