Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Mar 2017 14:25:38 +0000 (UTC)
From:      Bruce Evans <bde@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315003 - head/sys/dev/syscons
Message-ID:  <201703101425.v2AEPcDq080911@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bde
Date: Fri Mar 10 14:25:38 2017
New Revision: 315003
URL: https://svnweb.freebsd.org/changeset/base/315003

Log:
  Rename scteken_revattr() to scteken_sc_to_te_attr().  scteken_revattr()
  looked like it might handle reverse attributes, but it actually handles
  conversion of attributes in the direction indicated by the new name.
  Reverse attributes are just broken.
  
  Rename scteken_attr() to scteken_te_to_sc_attr().  scteken_attr() looked
  like it might give teken attributes, but it actually gives sc attributes.
  
  Change scteken_te_to_sc_attr() to return int instead of unsigned int.
  u_char would be enough, and it promotes to int, and syscons uses int
  or u_short for its attributes everywhere else (u_short holds a shifted
  form and it promotes to int too).

Modified:
  head/sys/dev/syscons/scterm-teken.c

Modified: head/sys/dev/syscons/scterm-teken.c
==============================================================================
--- head/sys/dev/syscons/scterm-teken.c	Fri Mar 10 13:39:16 2017	(r315002)
+++ head/sys/dev/syscons/scterm-teken.c	Fri Mar 10 14:25:38 2017	(r315003)
@@ -51,8 +51,8 @@ __FBSDID("$FreeBSD$");
 
 #include <teken/teken.h>
 
-static void scteken_revattr(unsigned char, teken_attr_t *);
-static unsigned int scteken_attr(const teken_attr_t *);
+static void scteken_sc_to_te_attr(unsigned char, teken_attr_t *);
+static int scteken_te_to_sc_attr(const teken_attr_t *);
 
 static sc_term_init_t		scteken_init;
 static sc_term_term_t		scteken_term;
@@ -176,7 +176,7 @@ scteken_puts(scr_stat *scp, u_char *buf,
 	if (kernel) {
 		/* Use special colors for kernel messages. */
 		backup = *teken_get_curattr(&ts->ts_teken);
-		scteken_revattr(sc_kattr(), &kattr);
+		scteken_sc_to_te_attr(sc_kattr(), &kattr);
 		teken_set_curattr(&ts->ts_teken, &kattr);
 		teken_input(&ts->ts_teken, buf, len);
 		teken_set_curattr(&ts->ts_teken, &backup);
@@ -193,19 +193,19 @@ scteken_ioctl(scr_stat *scp, struct tty 
 {
 	teken_stat *ts = scp->ts;
 	vid_info_t *vi;
-	unsigned int attr;
+	int attr;
 
 	switch (cmd) {
 	case GIO_ATTR:      	/* get current attributes */
 		*(int*)data =
-		    scteken_attr(teken_get_curattr(&ts->ts_teken));
+		    scteken_te_to_sc_attr(teken_get_curattr(&ts->ts_teken));
 		return (0);
 	case CONS_GETINFO:  	/* get current (virtual) console info */
 		vi = (vid_info_t *)data;
 		if (vi->size != sizeof(struct vid_info))
 			return EINVAL;
 
-		attr = scteken_attr(teken_get_defattr(&ts->ts_teken));
+		attr = scteken_te_to_sc_attr(teken_get_defattr(&ts->ts_teken));
 		vi->mv_norm.fore = attr & 0x0f;
 		vi->mv_norm.back = (attr >> 4) & 0x0f;
 		vi->mv_rev.fore = vi->mv_norm.back;
@@ -225,7 +225,7 @@ scteken_default_attr(scr_stat *scp, int 
 	teken_stat *ts = scp->ts;
 	teken_attr_t ta;
 
-	scteken_revattr(color, &ta);
+	scteken_sc_to_te_attr(color, &ta);
 	teken_set_defattr(&ts->ts_teken, &ta);
 }
 
@@ -321,7 +321,7 @@ static const unsigned char bgcolors[TC_N
 };
 
 static void
-scteken_revattr(unsigned char color, teken_attr_t *a)
+scteken_sc_to_te_attr(unsigned char color, teken_attr_t *a)
 {
 	teken_color_t fg, bg;
 
@@ -360,10 +360,10 @@ scteken_revattr(unsigned char color, tek
 	}
 }
 
-static unsigned int
-scteken_attr(const teken_attr_t *a)
+static int
+scteken_te_to_sc_attr(const teken_attr_t *a)
 {
-	unsigned int attr = 0;
+	int attr = 0;
 	teken_color_t fg, bg;
 
 	if (a->ta_format & TF_REVERSE) {
@@ -558,7 +558,7 @@ scteken_putchar(void *arg, const teken_p
 	 * characters. Simply print a space and assume that the left
 	 * hand side describes the entire character.
 	 */
-	attr = scteken_attr(a) << 8;
+	attr = scteken_te_to_sc_attr(a) << 8;
 	if (a->ta_format & TF_CJK_RIGHT)
 		c = ' ';
 #ifdef TEKEN_UTF8
@@ -590,7 +590,7 @@ scteken_fill(void *arg, const teken_rect
 	unsigned int width;
 	int attr, row;
 
-	attr = scteken_attr(a) << 8;
+	attr = scteken_te_to_sc_attr(a) << 8;
 #ifdef TEKEN_UTF8
 	scteken_get_cp437(&c, &attr);
 #endif /* TEKEN_UTF8 */



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