1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1997 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*LINTLIBRARY*/
#include <stdlib.h>
#include <sys/types.h>
#include "curses_inc.h"
/*
* When the keyboard can send more than eight bits, offsets array
* should be changed from chars to shorts.
* The offsets MUST match what is in curses.h.
*/
static unsigned char offsets[][2] = {
{ '`', '*' }, /* ACS_DIAMOND */
{ 'a', ':' }, /* ACS_CKBOARD */
{ 'f', '\'' }, /* ACS_DEGREE */
{ 'g', '#' }, /* ACS_PLMINUS */
{ 'o', '-' }, /* ACS_S1 */
{ 'q', '-' }, /* ACS_HLINE */
{ 's', '_' }, /* ACS_S9 */
{ 'x', '|' }, /* ACS_VLINE */
{ '~', 'o' }, /* ACS_BULLET */
{ ',', '<' }, /* ACS_LARROW */
{ '+', '>' }, /* ACS_RARROW */
{ '.', 'v' }, /* ACS_DARROW */
{ '-', '^' }, /* ACS_UARROW */
{ 'h', '#' }, /* ACS_BOARD */
{ 'i', '#' }, /* ACS_LANTERN */
{ '0', '#' }, /* ACS_BLOCK */
};
int
init_acs(void)
{
chtype *nacsmap;
char *cp;
int i = sizeof (offsets) / 2, to_get, must_output;
#ifdef _VR3_COMPAT_CODE
if ((nacsmap = cur_term->_acs32map = (chtype *)
malloc(sizeof (chtype) * 0400)) == NULL)
#else /* _VR3_COMPAT_CODE */
if ((nacsmap = cur_term->_acsmap = (chtype *)
malloc(sizeof (chtype) * 0400)) == NULL)
#endif /* _VR3_COMPAT_CODE */
{
#ifdef _VR3_COMPAT_CODE
bad:
#endif /* _VR3_COMPAT_CODE */
term_errno = TERM_BAD_MALLOC;
#ifdef DEBUG
strcpy(term_parm_err, "init_acs");
#endif /* DEBUG */
return (ERR);
}
/* Default acs chars for regular ASCII terminals are plus signs. */
memSset(nacsmap, (chtype) '+', 0400);
/*
* Now load in defaults for some of the characters which have close
* approximations in the normal ascii set.
*/
while (i-- > 0)
nacsmap[offsets[i][0]] = offsets[i][1];
/* Now do mapping for terminals own ACS, if any */
if ((cp = acs_chars) != 0)
while (*cp) {
to_get = *cp++; /* to get this ... */
must_output = *cp++; /* must output this ... */
#ifdef DEBUG
if (outf)
fprintf(outf, "acs %d, was %d, now %d\n",
to_get, nacsmap[to_get], must_output);
#endif /* DEBUG */
nacsmap[to_get] = ( must_output & 0xFF ) | A_ALTCHARSET;
}
acs_map = nacsmap;
#ifdef _VR3_COMPAT_CODE
if (_y16update) {
_ochtype *n16acsmap;
if ((n16acsmap = cur_term->_acsmap = (_ochtype *)
malloc(sizeof (_ochtype) * 0400)) == NULL) {
goto bad;
}
for (i = 0; i < 0400; i++)
/*LINTED*/
n16acsmap[i] = _TO_OCHTYPE(nacsmap[i]);
#undef acs_map
acs_map = n16acsmap;
}
#endif /* _VR3_COMPAT_CODE */
return (OK);
}
|