Moved ttyfree() to ifdef broken. See my reply on the sio change.
[unix-history] / usr.bin / vi / ascii.c
CommitLineData
1e64b3ba
JH
1/*-
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35static char sccsid[] = "@(#)ascii.c 8.5 (Berkeley) 11/29/93";
36#endif /* not lint */
37
38#include <sys/types.h>
39
40#include "vi.h"
41
42CHNAME const asciiname[UCHAR_MAX + 1] = {
43 {"^@", 2}, {"^A", 2}, {"^B", 2}, {"^C", 2},
44 {"^D", 2}, {"^E", 2}, {"^F", 2}, {"^G", 2},
45 {"^H", 2}, {"^I", 2}, {"^J", 2}, {"^K", 2},
46 {"^L", 2}, {"^M", 2}, {"^N", 2}, {"^O", 2},
47 {"^P", 2}, {"^Q", 2}, {"^R", 2}, {"^S", 2},
48 {"^T", 2}, {"^U", 2}, {"^V", 2}, {"^W", 2},
49 {"^X", 2}, {"^Y", 2}, {"^Z", 2}, {"^[", 2},
50 {"^\\", 2}, {"^]", 2}, {"^^", 2}, {"^_", 2},
51 {" ", 1}, {"!", 1}, {"\"", 1}, {"#", 1},
52 {"$", 1}, {"%", 1}, {"&", 1}, {"'", 1},
53 {"(", 1}, {")", 1}, {"*", 1}, {"+", 1},
54 {",", 1}, {"-", 1}, {".", 1}, {"/", 1},
55 {"0", 1}, {"1", 1}, {"2", 1}, {"3", 1},
56 {"4", 1}, {"5", 1}, {"6", 1}, {"7", 1},
57 {"8", 1}, {"9", 1}, {":", 1}, {";", 1},
58 {"<", 1}, {"=", 1}, {">", 1}, {"?", 1},
59 {"@", 1}, {"A", 1}, {"B", 1}, {"C", 1},
60 {"D", 1}, {"E", 1}, {"F", 1}, {"G", 1},
61 {"H", 1}, {"I", 1}, {"J", 1}, {"K", 1},
62 {"L", 1}, {"M", 1}, {"N", 1}, {"O", 1},
63 {"P", 1}, {"Q", 1}, {"R", 1}, {"S", 1},
64 {"T", 1}, {"U", 1}, {"V", 1}, {"W", 1},
65 {"X", 1}, {"Y", 1}, {"Z", 1}, {"[", 1},
66 {"\\", 1}, {"]", 1}, {"^", 1}, {"_", 1},
67 {"`", 1}, {"a", 1}, {"b", 1}, {"c", 1},
68 {"d", 1}, {"e", 1}, {"f", 1}, {"g", 1},
69 {"h", 1}, {"i", 1}, {"j", 1}, {"k", 1},
70 {"l", 1}, {"m", 1}, {"n", 1}, {"o", 1},
71 {"p", 1}, {"q", 1}, {"r", 1}, {"s", 1},
72 {"t", 1}, {"u", 1}, {"v", 1}, {"w", 1},
73 {"x", 1}, {"y", 1}, {"z", 1}, {"{", 1},
74 {"|", 1}, {"}", 1}, {"~", 1}, {"^?", 2},
75 {"0x80", 4}, {"0x81", 4}, {"0x82", 4}, {"0x83", 4},
76 {"0x84", 4}, {"0x85", 4}, {"0x86", 4}, {"0x87", 4},
77 {"0x88", 4}, {"0x89", 4}, {"0x8a", 4}, {"0x8b", 4},
78 {"0x8c", 4}, {"0x8d", 4}, {"0x8e", 4}, {"0x8f", 4},
79 {"0x90", 4}, {"0x91", 4}, {"0x92", 4}, {"0x93", 4},
80 {"0x94", 4}, {"0x95", 4}, {"0x96", 4}, {"0x97", 4},
81 {"0x98", 4}, {"0x99", 4}, {"0x9a", 4}, {"0x9b", 4},
82 {"0x9c", 4}, {"0x9d", 4}, {"0x9e", 4}, {"0x9f", 4},
2a5a4d58
AC
83 {"\xa0", 1}, {"\xa1", 1}, {"\xa2", 1}, {"\xa3", 1},
84 {"\xa4", 1}, {"\xa5", 1}, {"\xa6", 1}, {"\xa7", 1},
85 {"\xa8", 1}, {"\xa9", 1}, {"\xaa", 1}, {"\xab", 1},
86 {"\xac", 1}, {"\xad", 1}, {"\xae", 1}, {"\xaf", 1},
87 {"\xb0", 1}, {"\xb1", 1}, {"\xb2", 1}, {"\xb3", 1},
88 {"\xb4", 1}, {"\xb5", 1}, {"\xb6", 1}, {"\xb7", 1},
89 {"\xb8", 1}, {"\xb9", 1}, {"\xba", 1}, {"\xbb", 1},
90 {"\xbc", 1}, {"\xbd", 1}, {"\xbe", 1}, {"\xbf", 1},
91 {"\xc0", 1}, {"\xc1", 1}, {"\xc2", 1}, {"\xc3", 1},
92 {"\xc4", 1}, {"\xc5", 1}, {"\xc6", 1}, {"\xc7", 1},
93 {"\xc8", 1}, {"\xc9", 1}, {"\xca", 1}, {"\xcb", 1},
94 {"\xcc", 1}, {"\xcd", 1}, {"\xce", 1}, {"\xcf", 1},
95 {"\xd0", 1}, {"\xd1", 1}, {"\xd2", 1}, {"\xd3", 1},
96 {"\xd4", 1}, {"\xd5", 1}, {"\xd6", 1}, {"\xd7", 1},
97 {"\xd8", 1}, {"\xd9", 1}, {"\xda", 1}, {"\xdb", 1},
98 {"\xdc", 1}, {"\xdd", 1}, {"\xde", 1}, {"\xdf", 1},
99 {"\xe0", 1}, {"\xe1", 1}, {"\xe2", 1}, {"\xe3", 1},
100 {"\xe4", 1}, {"\xe5", 1}, {"\xe6", 1}, {"\xe7", 1},
101 {"\xe8", 1}, {"\xe9", 1}, {"\xea", 1}, {"\xeb", 1},
102 {"\xec", 1}, {"\xed", 1}, {"\xee", 1}, {"\xef", 1},
103 {"\xf0", 1}, {"\xf1", 1}, {"\xf2", 1}, {"\xf3", 1},
104 {"\xf4", 1}, {"\xf5", 1}, {"\xf6", 1}, {"\xf7", 1},
105 {"\xf8", 1}, {"\xf9", 1}, {"\xfa", 1}, {"\xfb", 1},
106 {"\xfc", 1}, {"\xfd", 1}, {"\xfe", 1}, {"\xff", 1},
1e64b3ba
JH
107};
108
109char *
110charname(sp, ch)
111 SCR *sp;
112 ARG_CHAR_T ch;
113{
114 return (sp->gp->cname[ch & UCHAR_MAX].name);
115}