/* $XConsortium: Lookup.c,v 1.15 95/06/08 23:20:39 gildea Exp $ */ /* $XFree86: xc/lib/Xmu/Lookup.c,v 3.2 1996/08/13 11:26:12 dawes Exp $ */ /* Copyright (c) 1988, 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include #include #define XK_LATIN1 #define XK_PUBLISHING #include #ifdef __STDC__ #define Const const #else #define Const /**/ #endif /* bit (1<> 8) == kset)) { count = 1; switch (keysymSet) { case sKana: buffer[0] = (symbol & 0xff); if (buffer[0] == 0x7e) count = 0; break; case sCyrillic: buffer[0] = cyrillic[symbol & 0x7f]; break; case sGreek: buffer[0] = greek[symbol & 0x7f]; if (!buffer[0]) count = 0; break; default: buffer[0] = (symbol & 0xff); break; } } else if ((keysymSet != 0) && (count == 1) && (((unsigned char *)buffer)[0] == symbol) && (symbol & 0x80) && !(latin1[symbol & 0x7f] & (1 << kset))) { if ((keysymSet == sHebrew) && (symbol == XK_multiply)) buffer[0] = 0xaa; else if ((keysymSet == sHebrew) && (symbol == XK_division)) buffer[0] = 0xba; else if ((keysymSet == sCyrillic) && (symbol == XK_section)) buffer[0] = 0xfd; else if ((keysymSet == sX0201) && (symbol == XK_yen)) buffer[0] = 0x5c; else count = 0; } else if (count != 0) { if ((keysymSet == sX0201) && ((symbol == XK_backslash) || (symbol == XK_asciitilde))) count = 0; } else if (((symbol >> 8) == sLatin2) && (symbol & 0x80) && (latin2[symbol & 0x7f] & (1 << kset))) { buffer[0] = (symbol & 0xff); count = 1; } else if ((keysymSet == sGreek) && ((symbol == XK_leftsinglequotemark) || (symbol == XK_rightsinglequotemark))) { buffer[0] = symbol - (XK_leftsinglequotemark - 0xa1); count = 1; } return count; } /* produces ISO 8859-1 encoding plus ASCII control */ int XmuLookupLatin1 (event, buffer, nbytes, keysym, status) register XKeyEvent *event; char *buffer; int nbytes; KeySym *keysym; XComposeStatus *status; { return XLookupString(event, buffer, nbytes, keysym, status); } /* produces ISO 8859-2 encoding plus ASCII control */ int XmuLookupLatin2 (event, buffer, nbytes, keysym, status) register XKeyEvent *event; char *buffer; int nbytes; KeySym *keysym; XComposeStatus *status; { return XmuLookupString(event, buffer, nbytes, keysym, status, sLatin2); } /* produces ISO 8859-3 encoding plus ASCII control */ int XmuLookupLatin3 (event, buffer, nbytes, keysym, status) register XKeyEvent *event; char *buffer; int nbytes; KeySym *keysym; XComposeStatus *status; { return XmuLookupString(event, buffer, nbytes, keysym, status, sLatin3); } /* produces ISO 8859-4 encoding plus ASCII control */ int XmuLookupLatin4 (event, buffer, nbytes, keysym, status) register XKeyEvent *event; char *buffer; int nbytes; KeySym *keysym; XComposeStatus *status; { return XmuLookupString(event, buffer, nbytes, keysym, status, sLatin4); } /* produces ISO 8859-1 GL plus Katakana plus ASCII control */ int XmuLookupKana (event, buffer, nbytes, keysym, status) register XKeyEvent *event; char *buffer; int nbytes; KeySym *keysym; XComposeStatus *status; { return XmuLookupString(event, buffer, nbytes, keysym, status, sKana); } /* produces JIS X0201-1976 (8-bit) */ int XmuLookupJISX0201 (event, buffer, nbytes, keysym, status) register XKeyEvent *event; char *buffer; int nbytes; KeySym *keysym; XComposeStatus *status; { return XmuLookupString(event, buffer, nbytes, keysym, status, sX0201); } /* produces ISO 8859-6 encoding plus ASCII control */ int XmuLookupArabic (event, buffer, nbytes, keysym, status) register XKeyEvent *event; char *buffer; int nbytes; KeySym *keysym; XComposeStatus *status; { return XmuLookupString(event, buffer, nbytes, keysym, status, sArabic); } /* produces ISO/IEC 8859-5 encoding plus ASCII control */ int XmuLookupCyrillic (event, buffer, nbytes, keysym, status) register XKeyEvent *event; char *buffer; int nbytes; KeySym *keysym; XComposeStatus *status; { return XmuLookupString(event, buffer, nbytes, keysym, status, sCyrillic); } /* produces ISO 8859-7 encoding plus ASCII control */ int XmuLookupGreek (event, buffer, nbytes, keysym, status) register XKeyEvent *event; char *buffer; int nbytes; KeySym *keysym; XComposeStatus *status; { return XmuLookupString(event, buffer, nbytes, keysym, status, sGreek); } /* XXX this character set needs work */ int XmuLookupAPL (event, buffer, nbytes, keysym, status) register XKeyEvent *event; char *buffer; int nbytes; KeySym *keysym; XComposeStatus *status; { return XmuLookupString(event, buffer, nbytes, keysym, status, sAPL); } /* produces ISO 8859-8 encoding plus ASCII control */ int XmuLookupHebrew (event, buffer, nbytes, keysym, status) register XKeyEvent *event; char *buffer; int nbytes; KeySym *keysym; XComposeStatus *status; { return XmuLookupString(event, buffer, nbytes, keysym, status, sHebrew); }