Subject: Re: Codeset support for wscons
To: None <tech-kern@netbsd.org>
From: None <jakym@volny.cz>
List: tech-kern
Date: 04/02/2002 00:14:20
> With Lennart Augustsson addition of cyrillic keysymbols (which is totally
> wrong this way) we need a method to pass non-iso8851-1 keystrokes through
> wscons.

Yes, we definitly need this. At least the non-latin1 of us ;).

> I propose two ioctl's to get/set a codeset on a screen. The codesets map
> keysymbols to 8-bit characters.
> 
> Diffs appended. Comments?

The translating routine should go to wsemul_vt100_translate
(wscons/wsemul_vt100_keys.c) IMO. And this

@@ -1281,7 +1299,9 @@
 	tp = scr->scr_tty;
 
-	if (KS_GROUP(ks) == KS_GROUP_Ascii)
-		(*tp->t_linesw->l_rint)(KS_VALUE(ks), tp);
-	else if (WSSCREEN_HAS_EMULATOR(scr)) {
+	if (KS_GROUP(ks) == KS_GROUP_Ascii) {
+		count = wscodeset_translate(scr->scr_dconf->wscodesetcookie, ks, &dp);
+		while (count-- > 0)
+			(*tp->t_linesw->l_rint)((u_char)*dp++, tp);
+	} else if (WSSCREEN_HAS_EMULATOR(scr)) {
 		count = (*scr->scr_dconf->wsemul->translate)
 		    (scr->scr_dconf->wsemulcookie, ks, &dp);

seems somewhat wrong, as KS_GROUP() confuses ASCII and Latin1. Better KS_GROUP
should look like

#define KS_GROUP(k)	((k) >= 0x0300 && (k) < 0x0370 ? KS_GROUP_Dead : \
			    (((k) & 0xf000) == 0xe000 ? KS_GROUP_Keycode : \
  			      (((k) & 0xf800) == 0xf000 ? ((k) & 0xff00) : \
  				(((k) < 0x0080) ? KS_GROUP_Ascii : \
  				  KS_GROUP_Else))))

which would make your code convert only ASCII chars (<0x80). I think
more complex approach to multilingual wscons (in the spirit of World21)
is the right way to go (not to think my opinion is the important one).

Regards,
	-- Jachym _Freza_ Holecek