BSD 4 development
[unix-history] / usr / src / cmd / apl / asciiterm.c
CommitLineData
85f85275
BJ
1#include "apl.h"
2
3asciich() {
4 extern unsigned char *iline;
5 extern struct asoperbox charconv[OPERBOXSIZE];
6 register D,E,F,I;
7
8 F = *iline++;
9 if ( ( F == '.') && ( digit(*iline) == 0 ) ) {
10 D = (int)*iline++;
11 E = (int)*iline++;
12 for (I = 0; I <= OPERBOXSIZE;I++) {
13 if (( D== (charconv[I].letters[0]) ) &&
14 ( E== (charconv[I].letters[1]) ) ) {
15 F = charconv[I].returnchar;
16 goto out;
17 }
18 }
19 --iline;--iline;
20 }
21out: return(F);
22};
23
24/* eventually this should be replaces with arrays that hae a better */
25/* method of selecting and returning the lexical value, but */
26/* for now, this is a quick implementation */
27/* */
28/* use char as subscript from ascii - get apl character hopefully */
29/* for character conversion from ascii to apl char set --- */
30/* see files write2.c and write3.c for more recent version */
31
32struct asoperbox charconv[OPERBOXSIZE] = {
33/* ascii mnemonic ( from HP APL ascii char mnemonics and */
34/* equivalent apl character value. */
35/* all are two lowercase letters preceeded by a dot. */
36/* letters for identifiers are lowercase or uppercase */
37/* lowercase corresponding to apl uppercase and */
38/* uppercase corresponding to apl underscored letters. */
39
40"sg", /* unary SGN */ '@',
41"le", /* less than or equal */ '$',
42"ge", /* greater than or equal*/ '^',
43"ne", /* not equal */ '*',
44"om", /* omega ( not used ) */ 'W',
45"ep", /* epsilon */ 'E',
46"rh", /* shape (rho) */ 'R',
47"nt", /* not ( also '~' ) */ 'T',
48"tk", /* take ( also '^' ) */ 'Y',
49"dr", /* drop */ 'U',
50"it", /* iota */ 'I',
51"ci", /* circular function */ 'O',
52"al", /* alpha ( not used ) */ 'A',
53"cl", /* maximum ( ceiling ) */ 'S',
54"fl", /* minimum ( floor ) */ 'D',
55"dl", /* del ( not used ) */ 'G',
56"de", /* upside down del */ 'H',
57"jt", /* small circle ( null )*/ 'J',
58"qd", /* quad */ 'L',
59"ss", /* right U ( not used ) */ 'Z',
60"sc", /* left U ( not used ) */ 'X',
61"si", /* Down U */ 'C',
62"su", /* U ( not used ) */ 'V',
63"[^", /* upside-down del */ 'H',
64"bv", /* decode ( base ) */ 'B',
65"rp", /* encode ( rep ) */ 'N',
66"br", /* residue ( mod ) */ 'M',
67"sp", /* assignment */ '[',
68"go", /* goto */ ']',
69"or", /* or */ '(',
70"nn", /* nand */ 0205,
71"nr", /* nor */ 0206,
72"lg", /* log */ 0207,
73"rv", /* reversal */ 0217,
74"tr", /* transpose */ 0212,
75"rb", /* reverse bar */ 0214,
76"cb", /* comma bar ( not used)*/ 0,
77"sb", /* slash bar */ 0200,
78"bb", /* blackslash bar */ 0201,
79"gu", /* grade up */ 0215,
80"gd", /* grade down */ 0216,
81"qq", /* quote quad */ 0202,
82"dm", /* domino */ 0214,
83"lm", /* lamp */ 0204,
84"ib", /* i - beam */ 0213,
85"ex", /* execute ( not used ) */ 0,
86"fr", /* format( not used ) */ 0,
87"di", /* diamond ( not used ) */ 0,
88"ot", /* out ( not used ) */ 0,
89"ld", /* locked del (not used)*/ 0,
90"[a", /* alias for 'A' */ 0220,
91"[b", /* alias for 'B' */ 0221,
92"[c", /* alias for 'C' */ 0222,
93"[d", /* alias for 'D' */ 0223,
94"[e", /* alias for 'E' */ 0224,
95"[f", /* alias for 'F' */ 0225,
96"[g", /* alias for 'G' */ 0226,
97"[h", /* alias for 'H' */ 0227,
98"[i", /* alias for 'I' */ 0230,
99"[j", /* alias for 'J' */ 0231,
100"[k", /* alias for 'K' */ 0232,
101"[l", /* alias for 'L' */ 0233,
102"[m", /* alias for 'M' */ 0234,
103"[n", /* alias for 'N' */ 0235,
104"[o", /* alias for 'O' */ 0236,
105"[p", /* alias for 'P' */ 0237,
106"[q", /* alias for 'Q' */ 0240,
107"[r", /* alias for 'R' */ 0241,
108"[s", /* alias for 'S' */ 0242,
109"[t", /* alias for 'T' */ 0243,
110"[u", /* alias for 'U' */ 0244,
111"[v", /* alias for 'V' */ 0245,
112"[w", /* alias for 'W' */ 0246,
113"[x", /* alias for 'X' */ 0247,
114"[y", /* alias for 'Y' */ 0250,
115"[z", /* alias for 'Z' */ 0251
116};