source: trunk/third/x3270/apl.c @ 9081

Revision 9081, 5.9 KB checked in by ghudson, 28 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r9080, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2 * Copyright 1993, 1994, 1995 by Paul Mattes.
3 *  Permission to use, copy, modify, and distribute this software and its
4 *  documentation for any purpose and without fee is hereby granted,
5 *  provided that the above copyright notice appear in all copies and that
6 *  both that copyright notice and this permission notice appear in
7 *  supporting documentation.
8 */
9
10/*
11 *      apl.c
12 *              This module handles APL-specific actions.
13 */
14
15#include <X11/Intrinsic.h>
16#define XK_APL
17#define XK_GREEK
18#define XK_TECHNICAL
19#include <X11/keysym.h>
20
21#include "aplc.h"
22
23
24/*
25 * APL keysym translation.
26 *
27 * This code looks a little odd because of how an APL font is implemented.
28 * An APL font has APL graphics in place of the various accented letters and
29 * special symbols in a regular font.  APL keysym translation consists of
30 * taking the keysym name for an APL symbol (these names are meaningful only to
31 * x3270) and translating it into the keysym for the regular symbol that the
32 * desired APL symbol _replaces_.
33 *
34 * For example, an APL font has the APL "jot" symbol where a regular font has
35 * the "registered" symbol.  So we take the keysym name "jot" and translate it
36 * into the keysym XK_registered.  When the XK_registered symbol is displayed
37 * with an APL font, it appears as a "jot".
38 *
39 * The specification of which APL symbols replace which regular symbols is in
40 * IBM GA27-3831, 3174 Establishment Controller Character Set Reference.
41 *
42 * In addition, several standard characters have different names for APL,
43 * for example, "period" becomes "dot".  These are included in the table as
44 * well.
45 */
46
47static struct {
48        char *name;
49        KeySym keysym;
50        int is_ge;
51} axl[] = {
52        { "Aunderbar",          XK_nobreakspace,        1 },
53        { "Bunderbar",          XK_acircumflex,         1 },
54        { "Cunderbar",          XK_adiaeresis,          1 },
55        { "Dunderbar",          XK_agrave,              1 },
56        { "Eunderbar",          XK_aacute,              1 },
57        { "Funderbar",          XK_atilde,              1 },
58        { "Gunderbar",          XK_aring,               1 },
59        { "Hunderbar",          XK_ccedilla,            1 },
60        { "Iunderbar",          XK_ntilde,              1 },
61        { "Junderbar",          XK_eacute,              1 },
62        { "Kunderbar",          XK_ecircumflex,         1 },
63        { "Lunderbar",          XK_ediaeresis,          1 },
64        { "Munderbar",          XK_egrave,              1 },
65        { "Nunderbar",          XK_iacute,              1 },
66        { "Ounderbar",          XK_icircumflex,         1 },
67        { "Punderbar",          XK_idiaeresis,          1 },
68        { "Qunderbar",          XK_igrave,              1 },
69        { "Runderbar",          XK_ssharp,              1 },
70        { "Sunderbar",          XK_Acircumflex,         1 },
71        { "Tunderbar",          XK_Adiaeresis,          1 },
72        { "Uunderbar",          XK_Agrave,              1 },
73        { "Vunderbar",          XK_Aacute,              1 },
74        { "Wunderbar",          XK_Atilde,              1 },
75        { "Xunderbar",          XK_Aring,               1 },
76        { "Yunderbar",          XK_Ccedilla,            1 },
77        { "Zunderbar",          XK_Ntilde,              1 },
78        { "alpha",              XK_asciicircum,         1 },
79        { "bar",                XK_minus,               0 },
80        { "bracketleft",        XK_Yacute,              1 },
81        { "bracketright",       XK_diaeresis,           1 },
82        { "circle",             XK_cedilla,             1 },
83        { "circlebar",          XK_Ograve,              1 },
84        { "circleslope",        XK_otilde,              1 },
85        { "circlestar",         XK_Ugrave,              1 },
86        { "circlestile",        XK_ograve,              1 },
87        { "colon",              XK_colon,               0 },
88        { "comma",              XK_comma,               0 },
89        { "del",                XK_bracketleft,         1 },
90        { "delstile",           XK_udiaeresis,          1 },
91        { "delta",              XK_bracketright,        1 },
92        { "deltastile",         XK_ugrave,              1 },
93        { "deltaunderbar",      XK_Udiaeresis,          1 },
94        { "deltilde",           XK_Ucircumflex,         1 },
95        { "diaeresis",          XK_Ecircumflex,         1 },
96        { "diaeresisdot",       XK_Odiaeresis,          1 },
97        { "diamond",            XK_oslash,              1 },
98        { "dieresis",           XK_Ecircumflex,         1 },
99        { "dieresisdot",        XK_Odiaeresis,          1 },
100        { "divide",             XK_onehalf,             1 },
101        { "dot",                XK_period,              0 },
102        { "downarrow",          XK_guillemotright,      1 },
103        { "downcaret",          XK_Igrave,              1 },
104        { "downcarettilde",     XK_ocircumflex,         1 },
105        { "downshoe",           XK_questiondown,        1 },
106        { "downstile",          XK_thorn,               1 },
107        { "downtack",           XK_ETH,                 1 },
108        { "downtackjot",        XK_Uacute,              1 },
109        { "downtackup",         XK_onesuperior,         1 },
110        { "downtackuptack",     XK_onesuperior,         1 },
111        { "epsilon",            XK_sterling,            1 },
112        { "epsilonunderbar",    XK_Iacute,              1 },
113        { "equal",              XK_equal,               0 },
114        { "equalunderbar",      XK_backslash,           1 },
115        { "greater",            XK_greater,             0 },
116        { "iota",               XK_yen,                 1 },
117        { "iotaunderbar",       XK_Egrave,              1 },
118        { "jot",                XK_registered,          1 },
119        { "leftarrow",          XK_currency,            1 },
120        { "leftbracket",        XK_Yacute,              1 },
121        { "leftparen",          XK_parenleft,           0 },
122        { "leftshoe",           XK_masculine,           1 },
123        { "lefttack",           XK_Icircumflex,         1 },
124        { "less",               XK_less,                0 },
125        { "multiply",           XK_paragraph,           1 },
126        { "notequal",           XK_acute,               1 },
127        { "notgreater",         XK_eth,                 1 },
128        { "notless",            XK_THORN,               1 },
129        { "omega",              XK_copyright,           1 },
130        { "overbar",            XK_mu,                  1 },
131        { "plus",               XK_plus,                0 },
132        { "plusminus",          XK_AE,                  1 },
133        { "quad",               XK_degree,              1 },
134        { "quaddivide",         XK_Oacute,              1 },
135        { "quadjot",            XK_Ediaeresis,          1 },
136        { "quadquote",          XK_uacute,              1 },
137        { "quadslope",          XK_oacute,              1 },
138        { "query",              XK_question,            0 },
139        { "quote",              XK_apostrophe,          0 },
140        { "quotedot",           XK_ucircumflex,         1 },
141        { "rho",                XK_periodcentered,      1 },
142        { "rightarrow",         XK_plusminus,           1 },
143        { "rightbracket",       XK_diaeresis,           1 },
144        { "rightparen",         XK_parenright,          0 },
145        { "rightshoe",          XK_ordfeminine,         1 },
146        { "righttack",          XK_Idiaeresis,          1 },
147        { "semicolon",          XK_semicolon,           0 },
148        { "slash",              XK_slash,               0 },
149        { "slashbar",           XK_twosuperior,         1 },
150        { "slope",              XK_onequarter,          1 },
151        { "slopebar",           XK_Ocircumflex,         1 },
152        { "slopequad",          XK_oacute,              1 },
153        { "splat",              XK_ae,                  1 },
154        { "squad",              XK_odiaeresis,          1 },
155        { "star",               XK_asterisk,            0 },
156        { "stile",              XK_multiply,            1 },
157        { "tilde",              XK_Ooblique,            1 },
158        { "times",              XK_paragraph,           1 },
159        { "underbar",           XK_underscore,          0 },
160        { "uparrow",            XK_guillemotleft,       1 },
161        { "upcaret",            XK_Eacute,              1 },
162        { "upcarettilde",       XK_hyphen,              1 },
163        { "upshoe",             XK_exclamdown,          1 },
164        { "upshoejot",          XK_ydiaeresis,          1 },
165        { "upstile",            XK_yacute,              1 },
166        { "uptack",             XK_macron,              1 },
167        { "uptackjot",          XK_Otilde,              1 },
168        { 0, 0 }
169};
170
171/*
172 * Translation from APL ksysym names to indirect APL keysyms.
173 */
174KeySym
175APLStringToKeysym(s, is_gep)
176char *s;
177int *is_gep;
178{
179        register int i;
180
181        if (strncmp(s, "apl_", 4))
182                return NoSymbol;
183        s += 4;
184        for (i = 0; axl[i].name; i++)
185                if (!strcmp(axl[i].name, s)) {
186                        *is_gep = axl[i].is_ge;
187                        return axl[i].keysym;
188                }
189        return NoSymbol;
190}
Note: See TracBrowser for help on using the repository browser.