summaryrefslogtreecommitdiff
path: root/app/xterm/charsets.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/xterm/charsets.c')
-rw-r--r--app/xterm/charsets.c789
1 files changed, 407 insertions, 382 deletions
diff --git a/app/xterm/charsets.c b/app/xterm/charsets.c
index 70885e76c..d3bd79f07 100644
--- a/app/xterm/charsets.c
+++ b/app/xterm/charsets.c
@@ -1,12 +1,8 @@
-/* $XTermId: charsets.c,v 1.33 2006/07/02 17:28:50 tom Exp $ */
-
-/*
- * $XFree86: xc/programs/xterm/charsets.c,v 1.12 2005/01/14 01:50:02 dickey Exp $
- */
+/* $XTermId: charsets.c,v 1.40 2008/05/26 22:49:57 tom Exp $ */
/************************************************************
-Copyright 1998-2005,2006 by Thomas E. Dickey
+Copyright 1998-2007,2008 by Thomas E. Dickey
All Rights Reserved
@@ -63,399 +59,428 @@ authorization.
/*
* Translate an input keysym to the corresponding NRC keysym.
*/
-unsigned xtermCharSetIn(unsigned code, int charset)
+unsigned
+xtermCharSetIn(unsigned code, int charset)
{
- if (code >= 128 && code < 256) {
- switch (charset) {
- case 'A': /* United Kingdom set (or Latin 1) */
- if (code == XK_sterling)
- code = 0x23;
- code &= 0x7f;
- break;
+#define MAP(to, from) case from: code = to; break
+
+ if (code >= 128 && code < 256) {
+ switch (charset) {
+ case 'A': /* United Kingdom set (or Latin 1) */
+ if (code == XK_sterling)
+ code = 0x23;
+ code &= 0x7f;
+ break;
#if OPT_XMC_GLITCH
- case '?':
+ case '?':
#endif
- case '1': /* Alternate Character ROM standard characters */
- case '2': /* Alternate Character ROM special graphics */
- case 'B': /* ASCII set */
- break;
-
- case '0': /* special graphics (line drawing) */
- break;
-
- case '4': /* Dutch */
- switch (code) {
- case XK_sterling: code = 0x23; break;
- case XK_threequarters: code = 0x40; break;
- case XK_ydiaeresis: code = 0x5b; break;
- case XK_onehalf: code = 0x5c; break;
- /* N/A case XK_bar: code = 0x5d; break; */
- case XK_diaeresis: code = 0x7b; break;
- /* N/A case XK_f: code = 0x7c; break; */
- case XK_onequarter: code = 0x7d; break;
- case XK_acute: code = 0x7e; break;
- }
- break;
-
- case 'C':
- case '5': /* Finnish */
- switch (code) {
- case XK_Adiaeresis: code = 0x5b; break;
- case XK_Odiaeresis: code = 0x5c; break;
- case XK_Aring: code = 0x5d; break;
- case XK_Udiaeresis: code = 0x5e; break;
- case XK_eacute: code = 0x60; break;
- case XK_adiaeresis: code = 0x7b; break;
- case XK_odiaeresis: code = 0x7c; break;
- case XK_aring: code = 0x7d; break;
- case XK_udiaeresis: code = 0x7e; break;
- }
- break;
-
- case 'R': /* French */
- switch (code) {
- case XK_sterling: code = 0x23; break;
- case XK_agrave: code = 0x40; break;
- case XK_degree: code = 0x5b; break;
- case XK_ccedilla: code = 0x5c; break;
- case XK_section: code = 0x5d; break;
- case XK_eacute: code = 0x7b; break;
- case XK_ugrave: code = 0x7c; break;
- case XK_egrave: code = 0x7d; break;
- case XK_diaeresis: code = 0x7e; break;
- }
- break;
-
- case 'Q': /* French Canadian */
- switch (code) {
- case XK_agrave: code = 0x40; break;
- case XK_acircumflex: code = 0x5b; break;
- case XK_ccedilla: code = 0x5c; break;
- case XK_ecircumflex: code = 0x5d; break;
- case XK_icircumflex: code = 0x5e; break;
- case XK_ocircumflex: code = 0x60; break;
- case XK_eacute: code = 0x7b; break;
- case XK_ugrave: code = 0x7c; break;
- case XK_egrave: code = 0x7d; break;
- case XK_ucircumflex: code = 0x7e; break;
- }
- break;
-
- case 'K': /* German */
- switch (code) {
- case XK_section: code = 0x40; break;
- case XK_Adiaeresis: code = 0x5b; break;
- case XK_Odiaeresis: code = 0x5c; break;
- case XK_Udiaeresis: code = 0x5d; break;
- case XK_adiaeresis: code = 0x7b; break;
- case XK_odiaeresis: code = 0x7c; break;
- case XK_udiaeresis: code = 0x7d; break;
- case XK_ssharp: code = 0x7e; break;
- }
- break;
-
- case 'Y': /* Italian */
- switch (code) {
- case XK_sterling: code = 0x23; break;
- case XK_section: code = 0x40; break;
- case XK_degree: code = 0x5b; break;
- case XK_ccedilla: code = 0x5c; break;
- case XK_eacute: code = 0x5d; break;
- case XK_ugrave: code = 0x60; break;
- case XK_agrave: code = 0x7b; break;
- case XK_ograve: code = 0x7c; break;
- case XK_egrave: code = 0x7d; break;
- case XK_igrave: code = 0x7e; break;
- }
- break;
-
- case 'E':
- case '6': /* Norwegian/Danish */
- switch (code) {
- case XK_Adiaeresis: code = 0x40; break;
- case XK_AE: code = 0x5b; break;
- case XK_Ooblique: code = 0x5c; break;
- case XK_Aring: code = 0x5d; break;
- case XK_Udiaeresis: code = 0x5e; break;
- case XK_adiaeresis: code = 0x60; break;
- case XK_ae: code = 0x7b; break;
- case XK_oslash: code = 0x7c; break;
- case XK_aring: code = 0x7d; break;
- case XK_udiaeresis: code = 0x7e; break;
- }
- break;
-
- case 'Z': /* Spanish */
- switch (code) {
- case XK_sterling: code = 0x23; break;
- case XK_section: code = 0x40; break;
- case XK_exclamdown: code = 0x5b; break;
- case XK_Ntilde: code = 0x5c; break;
- case XK_questiondown: code = 0x5d; break;
- case XK_degree: code = 0x7b; break;
- case XK_ntilde: code = 0x7c; break;
- case XK_ccedilla: code = 0x7d; break;
- }
- break;
-
- case 'H':
- case '7': /* Swedish */
- switch (code) {
- case XK_Eacute: code = 0x40; break;
- case XK_Adiaeresis: code = 0x5b; break;
- case XK_Odiaeresis: code = 0x5c; break;
- case XK_Aring: code = 0x5d; break;
- case XK_Udiaeresis: code = 0x5e; break;
- case XK_eacute: code = 0x60; break;
- case XK_adiaeresis: code = 0x7b; break;
- case XK_odiaeresis: code = 0x7c; break;
- case XK_aring: code = 0x7d; break;
- case XK_udiaeresis: code = 0x7e; break;
- }
- break;
-
- case '=': /* Swiss */
- switch (code) {
- case XK_ugrave: code = 0x23; break;
- case XK_agrave: code = 0x40; break;
- case XK_eacute: code = 0x5b; break;
- case XK_ccedilla: code = 0x5c; break;
- case XK_ecircumflex: code = 0x5d; break;
- case XK_icircumflex: code = 0x5e; break;
- case XK_egrave: code = 0x5f; break;
- case XK_ocircumflex: code = 0x60; break;
- case XK_adiaeresis: code = 0x7b; break;
- case XK_odiaeresis: code = 0x7c; break;
- case XK_udiaeresis: code = 0x7d; break;
- case XK_ucircumflex: code = 0x7e; break;
- }
- break;
-
- default: /* any character sets we don't recognize*/
- break;
- }
- code &= 0x7f; /* NRC in any case is 7-bit */
+ case '1': /* Alternate Character ROM standard characters */
+ case '2': /* Alternate Character ROM special graphics */
+ case 'B': /* ASCII set */
+ break;
+
+ case '0': /* special graphics (line drawing) */
+ break;
+
+ case '4': /* Dutch */
+ switch (code) {
+ MAP(0x23, XK_sterling);
+ MAP(0x40, XK_threequarters);
+ MAP(0x5b, XK_ydiaeresis);
+ MAP(0x5c, XK_onehalf);
+ MAP(0x5d, XK_bar); /* glyph is not ISO-8859-1 */
+ MAP(0x7b, XK_diaeresis);
+ MAP(0x7c, XK_f); /* glyph is not ISO-8859-1 */
+ MAP(0x7d, XK_onequarter);
+ MAP(0x7e, XK_acute);
+ }
+ break;
+
+ case 'C':
+ case '5': /* Finnish */
+ switch (code) {
+ MAP(0x5b, XK_Adiaeresis);
+ MAP(0x5c, XK_Odiaeresis);
+ MAP(0x5d, XK_Aring);
+ MAP(0x5e, XK_Udiaeresis);
+ MAP(0x60, XK_eacute);
+ MAP(0x7b, XK_adiaeresis);
+ MAP(0x7c, XK_odiaeresis);
+ MAP(0x7d, XK_aring);
+ MAP(0x7e, XK_udiaeresis);
+ }
+ break;
+
+ case 'R': /* French */
+ switch (code) {
+ MAP(0x23, XK_sterling);
+ MAP(0x40, XK_agrave);
+ MAP(0x5b, XK_degree);
+ MAP(0x5c, XK_ccedilla);
+ MAP(0x5d, XK_section);
+ MAP(0x7b, XK_eacute);
+ MAP(0x7c, XK_ugrave);
+ MAP(0x7d, XK_egrave);
+ MAP(0x7e, XK_diaeresis);
+ }
+ break;
+
+ case 'Q': /* French Canadian */
+ switch (code) {
+ MAP(0x40, XK_agrave);
+ MAP(0x5b, XK_acircumflex);
+ MAP(0x5c, XK_ccedilla);
+ MAP(0x5d, XK_ecircumflex);
+ MAP(0x5e, XK_icircumflex);
+ MAP(0x60, XK_ocircumflex);
+ MAP(0x7b, XK_eacute);
+ MAP(0x7c, XK_ugrave);
+ MAP(0x7d, XK_egrave);
+ MAP(0x7e, XK_ucircumflex);
+ }
+ break;
+
+ case 'K': /* German */
+ switch (code) {
+ MAP(0x40, XK_section);
+ MAP(0x5b, XK_Adiaeresis);
+ MAP(0x5c, XK_Odiaeresis);
+ MAP(0x5d, XK_Udiaeresis);
+ MAP(0x7b, XK_adiaeresis);
+ MAP(0x7c, XK_odiaeresis);
+ MAP(0x7d, XK_udiaeresis);
+ MAP(0x7e, XK_ssharp);
+ }
+ break;
+
+ case 'Y': /* Italian */
+ switch (code) {
+ MAP(0x23, XK_sterling);
+ MAP(0x40, XK_section);
+ MAP(0x5b, XK_degree);
+ MAP(0x5c, XK_ccedilla);
+ MAP(0x5d, XK_eacute);
+ MAP(0x60, XK_ugrave);
+ MAP(0x7b, XK_agrave);
+ MAP(0x7c, XK_ograve);
+ MAP(0x7d, XK_egrave);
+ MAP(0x7e, XK_igrave);
+ }
+ break;
+
+ case 'E':
+ case '6': /* Norwegian/Danish */
+ switch (code) {
+ MAP(0x40, XK_Adiaeresis);
+ MAP(0x5b, XK_AE);
+ MAP(0x5c, XK_Ooblique);
+ MAP(0x5d, XK_Aring);
+ MAP(0x5e, XK_Udiaeresis);
+ MAP(0x60, XK_adiaeresis);
+ MAP(0x7b, XK_ae);
+ MAP(0x7c, XK_oslash);
+ MAP(0x7d, XK_aring);
+ MAP(0x7e, XK_udiaeresis);
+ }
+ break;
+
+ case 'Z': /* Spanish */
+ switch (code) {
+ MAP(0x23, XK_sterling);
+ MAP(0x40, XK_section);
+ MAP(0x5b, XK_exclamdown);
+ MAP(0x5c, XK_Ntilde);
+ MAP(0x5d, XK_questiondown);
+ MAP(0x7b, XK_degree);
+ MAP(0x7c, XK_ntilde);
+ MAP(0x7d, XK_ccedilla);
+ }
+ break;
+
+ case 'H':
+ case '7': /* Swedish */
+ switch (code) {
+ MAP(0x40, XK_Eacute);
+ MAP(0x5b, XK_Adiaeresis);
+ MAP(0x5c, XK_Odiaeresis);
+ MAP(0x5d, XK_Aring);
+ MAP(0x5e, XK_Udiaeresis);
+ MAP(0x60, XK_eacute);
+ MAP(0x7b, XK_adiaeresis);
+ MAP(0x7c, XK_odiaeresis);
+ MAP(0x7d, XK_aring);
+ MAP(0x7e, XK_udiaeresis);
+ }
+ break;
+
+ case '=': /* Swiss */
+ switch (code) {
+ MAP(0x23, XK_ugrave);
+ MAP(0x40, XK_agrave);
+ MAP(0x5b, XK_eacute);
+ MAP(0x5c, XK_ccedilla);
+ MAP(0x5d, XK_ecircumflex);
+ MAP(0x5e, XK_icircumflex);
+ MAP(0x5f, XK_egrave);
+ MAP(0x60, XK_ocircumflex);
+ MAP(0x7b, XK_adiaeresis);
+ MAP(0x7c, XK_odiaeresis);
+ MAP(0x7d, XK_udiaeresis);
+ MAP(0x7e, XK_ucircumflex);
+ }
+ break;
+
+ default: /* any character sets we don't recognize */
+ break;
}
- return code;
+ code &= 0x7f; /* NRC in any case is 7-bit */
+ }
+ return code;
+#undef MAP
}
/*
* Translate a string to the display form. This assumes the font has the
* DEC graphic characters in cells 0-31, and otherwise is ISO-8859-1.
*/
-int xtermCharSetOut(IChar *buf, IChar *ptr, int leftset)
+int
+xtermCharSetOut(XtermWidget xw, IChar * buf, IChar * ptr, int leftset)
{
- IChar *s;
- register TScreen *screen = &term->screen;
- int count = 0;
- int rightset = screen->gsets[(int)(screen->curgr)];
-
- TRACE(("CHARSET GL=%c(G%d) GR=%c(G%d) SS%d:%s\n",
- leftset, screen->curgl,
- rightset, screen->curgr,
- screen->curss,
- visibleIChar(buf, (unsigned)(ptr - buf))));
-
- for (s = buf; s < ptr; ++s) {
- int eight = CharOf(E2A(*s));
- int seven = eight & 0x7f;
- int cs = (eight >= 128) ? rightset : leftset;
- int chr = eight;
-
- count++;
- switch (cs) {
- case 'A': /* United Kingdom set (or Latin 1) */
- if ((term->flags & NATIONAL)
- || (screen->vtXX_level <= 1)) {
- if (chr == 0x23)
- chr = XPOUND; /* UK pound sign*/
- } else {
- chr = (seven | 0x80);
- }
- break;
+ IChar *s;
+ TScreen *screen = TScreenOf(xw);
+ int count = 0;
+ int rightset = screen->gsets[(int) (screen->curgr)];
+
+#define MAP(from, to) case from: chr = to; break
+
+ TRACE(("CHARSET GL=%c(G%d) GR=%c(G%d) SS%d\n\t%s\n",
+ leftset, screen->curgl,
+ rightset, screen->curgr,
+ screen->curss,
+ visibleIChar(buf, (unsigned) (ptr - buf))));
+
+ for (s = buf; s < ptr; ++s) {
+ int eight = CharOf(E2A(*s));
+ int seven = eight & 0x7f;
+ int cs = (eight >= 128) ? rightset : leftset;
+ int chr = eight;
+
+ count++;
+#if OPT_WIDE_CHARS
+ /*
+ * This is only partly right - prevent inadvertant remapping of
+ * the replacement character and other non-8bit codes into bogus
+ * 8bit codes.
+ */
+ if (screen->utf8_mode) {
+ if (*s > 255)
+ continue;
+ }
+#endif
+ switch (cs) {
+ case 'A': /* United Kingdom set (or Latin 1) */
+ if ((xw->flags & NATIONAL)
+ || (screen->vtXX_level <= 1)) {
+ if (chr == 0x23) {
+#if OPT_WIDE_CHARS
+ chr = (screen->utf8_mode
+ ? 0xa3
+ : XTERM_POUND);
+#else
+ chr = XTERM_POUND;
+#endif
+ }
+ } else {
+ chr = (seven | 0x80);
+ }
+ break;
#if OPT_XMC_GLITCH
- case '?':
+ case '?':
#endif
- case '1': /* Alternate Character ROM standard characters */
- case '2': /* Alternate Character ROM special graphics */
- case 'B': /* ASCII set */
- break;
+ case '1': /* Alternate Character ROM standard characters */
+ case '2': /* Alternate Character ROM special graphics */
+ case 'B': /* ASCII set */
+ break;
- case '0': /* special graphics (line drawing) */
- if (seven > 0x5f && seven <= 0x7e) {
+ case '0': /* special graphics (line drawing) */
+ if (seven > 0x5f && seven <= 0x7e) {
#if OPT_WIDE_CHARS
- if (screen->utf8_mode)
- chr = dec2ucs((unsigned)(seven - 0x5f));
- else
+ if (screen->utf8_mode)
+ chr = dec2ucs((unsigned) (seven - 0x5f));
+ else
#endif
- chr = seven - 0x5f;
- } else {
- chr = seven;
- }
- break;
-
- case '4': /* Dutch */
- switch (chr = seven) {
- case 0x23: chr = XK_sterling; break;
- case 0x40: chr = XK_threequarters; break;
- case 0x5b: chr = XK_ydiaeresis; break;
- case 0x5c: chr = XK_onehalf; break;
- case 0x5d: chr = XK_bar; break;
- case 0x7b: chr = XK_diaeresis; break;
- case 0x7c: chr = XK_f; break;
- case 0x7d: chr = XK_onequarter; break;
- case 0x7e: chr = XK_acute; break;
- }
- break;
-
- case 'C':
- case '5': /* Finnish */
- switch (chr = seven) {
- case 0x5b: chr = XK_Adiaeresis; break;
- case 0x5c: chr = XK_Odiaeresis; break;
- case 0x5d: chr = XK_Aring; break;
- case 0x5e: chr = XK_Udiaeresis; break;
- case 0x60: chr = XK_eacute; break;
- case 0x7b: chr = XK_adiaeresis; break;
- case 0x7c: chr = XK_odiaeresis; break;
- case 0x7d: chr = XK_aring; break;
- case 0x7e: chr = XK_udiaeresis; break;
- }
- break;
-
- case 'R': /* French */
- switch (chr = seven) {
- case 0x23: chr = XK_sterling; break;
- case 0x40: chr = XK_agrave; break;
- case 0x5b: chr = XK_degree; break;
- case 0x5c: chr = XK_ccedilla; break;
- case 0x5d: chr = XK_section; break;
- case 0x7b: chr = XK_eacute; break;
- case 0x7c: chr = XK_ugrave; break;
- case 0x7d: chr = XK_egrave; break;
- case 0x7e: chr = XK_diaeresis; break;
- }
- break;
-
- case 'Q': /* French Canadian */
- switch (chr = seven) {
- case 0x40: chr = XK_agrave; break;
- case 0x5b: chr = XK_acircumflex; break;
- case 0x5c: chr = XK_ccedilla; break;
- case 0x5d: chr = XK_ecircumflex; break;
- case 0x5e: chr = XK_icircumflex; break;
- case 0x60: chr = XK_ocircumflex; break;
- case 0x7b: chr = XK_eacute; break;
- case 0x7c: chr = XK_ugrave; break;
- case 0x7d: chr = XK_egrave; break;
- case 0x7e: chr = XK_ucircumflex; break;
- }
- break;
-
- case 'K': /* German */
- switch (chr = seven) {
- case 0x40: chr = XK_section; break;
- case 0x5b: chr = XK_Adiaeresis; break;
- case 0x5c: chr = XK_Odiaeresis; break;
- case 0x5d: chr = XK_Udiaeresis; break;
- case 0x7b: chr = XK_adiaeresis; break;
- case 0x7c: chr = XK_odiaeresis; break;
- case 0x7d: chr = XK_udiaeresis; break;
- case 0x7e: chr = XK_ssharp; break;
- }
- break;
-
- case 'Y': /* Italian */
- switch (chr = seven) {
- case 0x23: chr = XK_sterling; break;
- case 0x40: chr = XK_section; break;
- case 0x5b: chr = XK_degree; break;
- case 0x5c: chr = XK_ccedilla; break;
- case 0x5d: chr = XK_eacute; break;
- case 0x60: chr = XK_ugrave; break;
- case 0x7b: chr = XK_agrave; break;
- case 0x7c: chr = XK_ograve; break;
- case 0x7d: chr = XK_egrave; break;
- case 0x7e: chr = XK_igrave; break;
- }
- break;
-
- case 'E':
- case '6': /* Norwegian/Danish */
- switch (chr = seven) {
- case 0x40: chr = XK_Adiaeresis; break;
- case 0x5b: chr = XK_AE; break;
- case 0x5c: chr = XK_Ooblique; break;
- case 0x5d: chr = XK_Aring; break;
- case 0x5e: chr = XK_Udiaeresis; break;
- case 0x60: chr = XK_adiaeresis; break;
- case 0x7b: chr = XK_ae; break;
- case 0x7c: chr = XK_oslash; break;
- case 0x7d: chr = XK_aring; break;
- case 0x7e: chr = XK_udiaeresis; break;
- }
- break;
-
- case 'Z': /* Spanish */
- switch (chr = seven) {
- case 0x23: chr = XK_sterling; break;
- case 0x40: chr = XK_section; break;
- case 0x5b: chr = XK_exclamdown; break;
- case 0x5c: chr = XK_Ntilde; break;
- case 0x5d: chr = XK_questiondown; break;
- case 0x7b: chr = XK_degree; break;
- case 0x7c: chr = XK_ntilde; break;
- case 0x7d: chr = XK_ccedilla; break;
- }
- break;
-
- case 'H':
- case '7': /* Swedish */
- switch (chr = seven) {
- case 0x40: chr = XK_Eacute; break;
- case 0x5b: chr = XK_Adiaeresis; break;
- case 0x5c: chr = XK_Odiaeresis; break;
- case 0x5d: chr = XK_Aring; break;
- case 0x5e: chr = XK_Udiaeresis; break;
- case 0x60: chr = XK_eacute; break;
- case 0x7b: chr = XK_adiaeresis; break;
- case 0x7c: chr = XK_odiaeresis; break;
- case 0x7d: chr = XK_aring; break;
- case 0x7e: chr = XK_udiaeresis; break;
- }
- break;
-
- case '=': /* Swiss */
- switch (chr = seven) {
- case 0x23: chr = XK_ugrave; break;
- case 0x40: chr = XK_agrave; break;
- case 0x5b: chr = XK_eacute; break;
- case 0x5c: chr = XK_ccedilla; break;
- case 0x5d: chr = XK_ecircumflex; break;
- case 0x5e: chr = XK_icircumflex; break;
- case 0x5f: chr = XK_egrave; break;
- case 0x60: chr = XK_ocircumflex; break;
- case 0x7b: chr = XK_adiaeresis; break;
- case 0x7c: chr = XK_odiaeresis; break;
- case 0x7d: chr = XK_udiaeresis; break;
- case 0x7e: chr = XK_ucircumflex; break;
- }
- break;
-
- default: /* any character sets we don't recognize*/
- count --;
- break;
- }
- /*
- * The state machine already treated DEL as a nonprinting and
- * nonspacing character. If we have DEL now, simply render
- * it as a blank.
- */
- if (chr == DEL)
- chr = ' ';
- *s = A2E(chr);
+ chr = seven - 0x5f;
+ } else {
+ chr = seven;
+ }
+ break;
+
+ case '4': /* Dutch */
+ switch (chr = seven) {
+ MAP(0x23, XK_sterling);
+ MAP(0x40, XK_threequarters);
+ MAP(0x5b, XK_ydiaeresis);
+ MAP(0x5c, XK_onehalf);
+ MAP(0x5d, XK_bar);
+ MAP(0x7b, XK_diaeresis);
+ MAP(0x7c, XK_f);
+ MAP(0x7d, XK_onequarter);
+ MAP(0x7e, XK_acute);
+ }
+ break;
+
+ case 'C':
+ case '5': /* Finnish */
+ switch (chr = seven) {
+ MAP(0x5b, XK_Adiaeresis);
+ MAP(0x5c, XK_Odiaeresis);
+ MAP(0x5d, XK_Aring);
+ MAP(0x5e, XK_Udiaeresis);
+ MAP(0x60, XK_eacute);
+ MAP(0x7b, XK_adiaeresis);
+ MAP(0x7c, XK_odiaeresis);
+ MAP(0x7d, XK_aring);
+ MAP(0x7e, XK_udiaeresis);
+ }
+ break;
+
+ case 'R': /* French */
+ switch (chr = seven) {
+ MAP(0x23, XK_sterling);
+ MAP(0x40, XK_agrave);
+ MAP(0x5b, XK_degree);
+ MAP(0x5c, XK_ccedilla);
+ MAP(0x5d, XK_section);
+ MAP(0x7b, XK_eacute);
+ MAP(0x7c, XK_ugrave);
+ MAP(0x7d, XK_egrave);
+ MAP(0x7e, XK_diaeresis);
+ }
+ break;
+
+ case 'Q': /* French Canadian */
+ switch (chr = seven) {
+ MAP(0x40, XK_agrave);
+ MAP(0x5b, XK_acircumflex);
+ MAP(0x5c, XK_ccedilla);
+ MAP(0x5d, XK_ecircumflex);
+ MAP(0x5e, XK_icircumflex);
+ MAP(0x60, XK_ocircumflex);
+ MAP(0x7b, XK_eacute);
+ MAP(0x7c, XK_ugrave);
+ MAP(0x7d, XK_egrave);
+ MAP(0x7e, XK_ucircumflex);
+ }
+ break;
+
+ case 'K': /* German */
+ switch (chr = seven) {
+ MAP(0x40, XK_section);
+ MAP(0x5b, XK_Adiaeresis);
+ MAP(0x5c, XK_Odiaeresis);
+ MAP(0x5d, XK_Udiaeresis);
+ MAP(0x7b, XK_adiaeresis);
+ MAP(0x7c, XK_odiaeresis);
+ MAP(0x7d, XK_udiaeresis);
+ MAP(0x7e, XK_ssharp);
+ }
+ break;
+
+ case 'Y': /* Italian */
+ switch (chr = seven) {
+ MAP(0x23, XK_sterling);
+ MAP(0x40, XK_section);
+ MAP(0x5b, XK_degree);
+ MAP(0x5c, XK_ccedilla);
+ MAP(0x5d, XK_eacute);
+ MAP(0x60, XK_ugrave);
+ MAP(0x7b, XK_agrave);
+ MAP(0x7c, XK_ograve);
+ MAP(0x7d, XK_egrave);
+ MAP(0x7e, XK_igrave);
+ }
+ break;
+
+ case 'E':
+ case '6': /* Norwegian/Danish */
+ switch (chr = seven) {
+ MAP(0x40, XK_Adiaeresis);
+ MAP(0x5b, XK_AE);
+ MAP(0x5c, XK_Ooblique);
+ MAP(0x5d, XK_Aring);
+ MAP(0x5e, XK_Udiaeresis);
+ MAP(0x60, XK_adiaeresis);
+ MAP(0x7b, XK_ae);
+ MAP(0x7c, XK_oslash);
+ MAP(0x7d, XK_aring);
+ MAP(0x7e, XK_udiaeresis);
+ }
+ break;
+
+ case 'Z': /* Spanish */
+ switch (chr = seven) {
+ MAP(0x23, XK_sterling);
+ MAP(0x40, XK_section);
+ MAP(0x5b, XK_exclamdown);
+ MAP(0x5c, XK_Ntilde);
+ MAP(0x5d, XK_questiondown);
+ MAP(0x7b, XK_degree);
+ MAP(0x7c, XK_ntilde);
+ MAP(0x7d, XK_ccedilla);
+ }
+ break;
+
+ case 'H':
+ case '7': /* Swedish */
+ switch (chr = seven) {
+ MAP(0x40, XK_Eacute);
+ MAP(0x5b, XK_Adiaeresis);
+ MAP(0x5c, XK_Odiaeresis);
+ MAP(0x5d, XK_Aring);
+ MAP(0x5e, XK_Udiaeresis);
+ MAP(0x60, XK_eacute);
+ MAP(0x7b, XK_adiaeresis);
+ MAP(0x7c, XK_odiaeresis);
+ MAP(0x7d, XK_aring);
+ MAP(0x7e, XK_udiaeresis);
+ }
+ break;
+
+ case '=': /* Swiss */
+ switch (chr = seven) {
+ MAP(0x23, XK_ugrave);
+ MAP(0x40, XK_agrave);
+ MAP(0x5b, XK_eacute);
+ MAP(0x5c, XK_ccedilla);
+ MAP(0x5d, XK_ecircumflex);
+ MAP(0x5e, XK_icircumflex);
+ MAP(0x5f, XK_egrave);
+ MAP(0x60, XK_ocircumflex);
+ MAP(0x7b, XK_adiaeresis);
+ MAP(0x7c, XK_odiaeresis);
+ MAP(0x7d, XK_udiaeresis);
+ MAP(0x7e, XK_ucircumflex);
+ }
+ break;
+
+ default: /* any character sets we don't recognize */
+ count--;
+ break;
}
- return count;
+ /*
+ * The state machine already treated DEL as a nonprinting and
+ * nonspacing character. If we have DEL now, simply render
+ * it as a blank.
+ */
+ if (chr == ANSI_DEL)
+ chr = ' ';
+ *s = A2E(chr);
+ }
+ TRACE(("%d\t%s\n",
+ count,
+ visibleIChar(buf, (unsigned) (ptr - buf))));
+ return count;
+#undef MAP
}