acs.c revision 1.5 1 /* $NetBSD: acs.c,v 1.5 2000/04/12 21:33:35 jdc Exp $ */
2
3 /*
4 * Copyright (c) 2000 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Julian Coleman.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 #include "curses.h"
40 #include "curses_private.h"
41
42 chtype _acs_char[NUM_ACS];
43
44 /*
45 * __init_acs --
46 * Fill in the ACS characters. The 'ac' termcap entry is a list of
47 * character pairs - ACS definition then terminal representation.
48 */
49 void
50 __init_acs()
51 {
52 int count;
53 char *aofac; /* Address of 'ac' */
54 unsigned char acs, term;
55
56 /* Default value '+' for all ACS characters */
57 for (count=0; count < NUM_ACS; count++)
58 _acs_char[count]= '+';
59
60 /* Add the SUSv2 defaults (those that are not '+') */
61 ACS_RARROW = '>';
62 ACS_LARROW = '<';
63 ACS_UARROW = '^';
64 ACS_DARROW = 'v';
65 ACS_BLOCK = '#';
66 /* ACS_DIAMOND = '+'; */
67 ACS_CKBOARD = ':';
68 ACS_DEGREE = 39; /* ' */
69 ACS_PLMINUS = '#';
70 ACS_BOARD = '#';
71 ACS_LANTERN = '#';
72 /* ACS_LRCORNER = '+'; */
73 /* ACS_URCORNER = '+'; */
74 /* ACS_ULCORNER = '+'; */
75 /* ACS_LLCORNER = '+'; */
76 /* ACS_PLUS = '+'; */
77 ACS_HLINE = '-';
78 ACS_S1 = '-';
79 ACS_S9 = '_';
80 /* ACS_LTEE = '+'; */
81 /* ACS_RTEE = '+'; */
82 /* ACS_BTEE = '+'; */
83 /* ACS_TTEE = '+'; */
84 ACS_VLINE = '|';
85 ACS_BULLET = 'o';
86
87 if (AC == NULL)
88 return;
89
90 aofac = AC;
91
92 while (*aofac != '\0') {
93 if ((acs = *aofac) == '\0')
94 return;
95 if (++aofac == '\0')
96 return;
97 if ((term = *aofac) == '\0')
98 return;
99 /* Only add characters 1 to 127 */
100 if (acs < NUM_ACS)
101 _acs_char[acs] = term | __ALTCHARSET;
102 aofac++;
103 #ifdef DEBUG
104 __CTRACE("__init_acs: %c = %c\n", acs, term);
105 #endif
106 }
107
108 if (Ea != NULL)
109 tputs(Ea, 0, __cputchar);
110 }
111