acs.c revision 1.1.2.1 1 /* $NetBSD: acs.c,v 1.1.2.1 2000/03/05 23:25:56 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
41 chtype _acs_char[NUM_ACS];
42
43 /*
44 * __init_acs --
45 * Fill in the ACS characters. The 'ac' termcap entry is a list of
46 * character pairs - ACS definition then terminal representation.
47 */
48 void
49 __init_acs()
50 {
51 int count;
52 char *aofac; /* Address of 'ac' */
53 char acs, term;
54
55 /* Default value '+' for all ACS characters */
56 for (count=0; count < NUM_ACS; count++)
57 _acs_char[count]= '+';
58
59 /* Add the SUSv2 defaults (those that are not '+') */
60 ACS_RARROW = '>';
61 ACS_LARROW = '<';
62 ACS_UARROW = '^';
63 ACS_DARROW = 'v';
64 ACS_BLOCK = '#';
65 /* ACS_DIAMOND = '+'; */
66 ACS_CKBOARD = ':';
67 ACS_DEGREE = 39; /* ' */
68 ACS_PLMINUS = '#';
69 ACS_BOARD = '#';
70 ACS_LANTERN = '#';
71 /* ACS_LRCORNER = '+'; */
72 /* ACS_URCORNER = '+'; */
73 /* ACS_ULCORNER = '+'; */
74 /* ACS_LLCORNER = '+'; */
75 /* ACS_PLUS = '+'; */
76 ACS_HLINE = '-';
77 ACS_S1 = '-';
78 ACS_S9 = '_';
79 /* ACS_LTEE = '+'; */
80 /* ACS_RTEE = '+'; */
81 /* ACS_BTEE = '+'; */
82 /* ACS_TTEE = '+'; */
83 ACS_VLINE = '|';
84 ACS_BULLET = 'o';
85
86 if (AC == NULL)
87 return;
88
89 aofac = AC;
90
91 while (*aofac != '\0') {
92 if ((acs = *aofac) == '\0')
93 return;
94 if (++aofac == '\0')
95 return;
96 if ((term = *aofac) == '\0')
97 return;
98 if (acs > 0) /* Only add characters 1 to 127 */
99 _acs_char[acs] = term | __ALTCHARSET;
100 aofac++;
101 #ifdef DEBUG
102 __CTRACE("__init_acs: %c = %c\n", acs, term);
103 #endif
104 }
105
106 if (Ea != NULL)
107 tputs(Ea, 0, __cputchar);
108 }
109