Subject: Re: Codeset support for wscons
To: None <jakym@volny.cz>
From: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
List: tech-kern
Date: 04/02/2002 10:53:20
On Tue, Apr 02, 2002 at 12:14:20AM +0200, jakym@volny.cz wrote:
> > 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.

As codeset support is independent from emulation it has to stand outside
of the emulators.

> 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).

While the name `KS_GROUP_Ascii' is bad (it means `real character opposed to
function or command symbols' this is the problem I want to solve:

We need some form of `kernel locale', that remaps the much more than 256
possible characters to 8-bit chars. The real question is, WHERE should it be
done:

-) In the MD keyboard driver?
   This driver could send only meta symbols like function or command symbols
   and 8-bit ascii characters.

   Cons:
   One keyboard map per locale, only one locale for all screens.

-) In the MI keyboard driver?
   Cons:
   Only one locale for all screens.

-) In the MI display driver?
   Pro:
   One locale per screen. Possible to have one screen at Latin-1 and one
   screen at KOI8-U with ONE russian keyboard map.

> Regards,
> 	-- Jachym _Freza_ Holecek

-- 
Juergen Hannken-Illjes - hannken@eis.cs.tu-bs.de - TU Braunschweig (Germany)