This commit was generated by cvs2svn to track changes on a CVS vendor
[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},
83 {"0xa0", 4}, {"0xa1", 4}, {"0xa2", 4}, {"0xa3", 4},
84 {"0xa4", 4}, {"0xa5", 4}, {"0xa6", 4}, {"0xa7", 4},
85 {"0xa8", 4}, {"0xa9", 4}, {"0xaa", 4}, {"0xab", 4},
86 {"0xac", 4}, {"0xad", 4}, {"0xae", 4}, {"0xaf", 4},
87 {"0xb0", 4}, {"0xb1", 4}, {"0xb2", 4}, {"0xb3", 4},
88 {"0xb4", 4}, {"0xb5", 4}, {"0xb6", 4}, {"0xb7", 4},
89 {"0xb8", 4}, {"0xb9", 4}, {"0xba", 4}, {"0xbb", 4},
90 {"0xbc", 4}, {"0xbd", 4}, {"0xbe", 4}, {"0xbf", 4},
91 {"0xc0", 4}, {"0xc1", 4}, {"0xc2", 4}, {"0xc3", 4},
92 {"0xc4", 4}, {"0xc5", 4}, {"0xc6", 4}, {"0xc7", 4},
93 {"0xc8", 4}, {"0xc9", 4}, {"0xca", 4}, {"0xcb", 4},
94 {"0xcc", 4}, {"0xcd", 4}, {"0xce", 4}, {"0xcf", 4},
95 {"0xd0", 4}, {"0xd1", 4}, {"0xd2", 4}, {"0xd3", 4},
96 {"0xd4", 4}, {"0xd5", 4}, {"0xd6", 4}, {"0xd7", 4},
97 {"0xd8", 4}, {"0xd9", 4}, {"0xda", 4}, {"0xdb", 4},
98 {"0xdc", 4}, {"0xdd", 4}, {"0xde", 4}, {"0xdf", 4},
99 {"0xe0", 4}, {"0xe1", 4}, {"0xe2", 4}, {"0xe3", 4},
100 {"0xe4", 4}, {"0xe5", 4}, {"0xe6", 4}, {"0xe7", 4},
101 {"0xe8", 4}, {"0xe9", 4}, {"0xea", 4}, {"0xeb", 4},
102 {"0xec", 4}, {"0xed", 4}, {"0xee", 4}, {"0xef", 4},
103 {"0xf0", 4}, {"0xf1", 4}, {"0xf2", 4}, {"0xf3", 4},
104 {"0xf4", 4}, {"0xf5", 4}, {"0xf6", 4}, {"0xf7", 4},
105 {"0xf8", 4}, {"0xf9", 4}, {"0xfa", 4}, {"0xfb", 4},
106 {"0xfc", 4}, {"0xfd", 4}, {"0xfe", 4}, {"0xff", 4},
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}