summaryrefslogtreecommitdiffstats
path: root/lib/libncurses/lib_acs.c
blob: 640ab897099baa200f33f6fb024228f15236bd6d (plain)
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

/* This work is copyrighted. See COPYRIGHT.OLD & COPYRIGHT.NEW for   *
*  details. If they are missing then this copy is in violation of    *
*  the copyright conditions.                                        */


#include "curses.priv.h"
#include "terminfo.h"
#include <string.h>

/* line graphics */


chtype acs_map[128];

void init_acs()
{

/*
 ACS_ULCORNER	(acs_map['l'])
 ACS_LLCORNER	(acs_map['m'])
 ACS_URCORNER	(acs_map['k'])
 ACS_LRCORNER	(acs_map['j'])
 ACS_RTEE	(acs_map['u'])
 ACS_LTEE	(acs_map['t'])
 ACS_BTEE	(acs_map['v'])
 ACS_TTEE	(acs_map['w'])
 ACS_HLINE	(acs_map['q'])
 ACS_VLINE	(acs_map['x'])
 ACS_PLUS	(acs_map['n'])
 ACS_S1		(acs_map['o'])	scan line 1
 ACS_S9		(acs_map['s'])	scan line 9
 ACS_DIAMOND	(acs_map['`'])	diamond 
 ACS_CKBOARD	(acs_map['a'])	checker board (stipple) 
 ACS_DEGREE	(acs_map['f'])	degree symbol 
 ACS_PLMINUS	(acs_map['g'])	plus/minus
 ACS_BULLET	(acs_map['~'])	bullet
 ACS_LARROW	(acs_map[','])	arrow pointing left
 ACS_RARROW	(acs_map['+'])	arrow pointing right
 ACS_DARROW	(acs_map['.'])	arrow pointing down
 ACS_UARROW	(acs_map['-'])	arrow pointing up 
 ACS_BOARD	(acs_map['h'])	board of squares 
 ACS_LANTERN	(acs_map['I'])	lantern symbol 
 ACS_BLOCK	(acs_map['0'])	solid square block
*/

	T(("initializing ACS map"));

	acs_map['l'] = acs_map['m'] = acs_map['k'] = acs_map['j'] = 
	acs_map['u'] = acs_map['t'] = acs_map['v'] = acs_map['w'] = (chtype)'+' & A_CHARTEXT;
	acs_map['q'] = (chtype)'-' & A_CHARTEXT;
	acs_map['x'] = (chtype)'|' & A_CHARTEXT;
	acs_map['n'] = (chtype)'+' & A_CHARTEXT;
	acs_map['o'] = (chtype)'~' & A_CHARTEXT;
	acs_map['s'] = (chtype)'_' & A_CHARTEXT;
	acs_map['`'] = (chtype)'+' & A_CHARTEXT;
	acs_map['a'] = (chtype)':' & A_CHARTEXT;
	acs_map['f'] = (chtype)'\'' & A_CHARTEXT;
	acs_map['g'] = (chtype)'#' & A_CHARTEXT;
	acs_map['~'] = (chtype)'o' & A_CHARTEXT;
	acs_map[','] = (chtype)'<' & A_CHARTEXT;
	acs_map['+'] = (chtype)'>' & A_CHARTEXT;
	acs_map['.'] = (chtype)'v' & A_CHARTEXT;
	acs_map['-'] = (chtype)'^' & A_CHARTEXT;
	acs_map['h'] = (chtype)'#' & A_CHARTEXT;
	acs_map['I'] = (chtype)'#' & A_CHARTEXT;
	acs_map['0'] = (chtype)'#' & A_CHARTEXT;

	if (ena_acs != NULL)
		putp(ena_acs);

	if (acs_chars != NULL) {
	    int i = 0;
	    int length = strlen(acs_chars);
	    
		while (i < length) 
			switch (acs_chars[i]) {
			case 'l':case 'm':case 'k':case 'j':
			case 'u':case 't':case 'v':case 'w':
			case 'q':case 'x':case 'n':case 'o':
			case 's':case '`':case 'a':case 'f':
			case 'g':case '~':case ',':case '+':
			case '.':case '-':case 'h':case 'I':
			case '0': 
				acs_map[(unsigned int)(unsigned char)acs_chars[i]] = 
					(acs_chars[++i] & A_CHARTEXT) | A_ALTCHARSET;
			default:
				i++;
				break;
			}
	}
#ifdef TRACE
	else {
		T(("acsc not defined, using default mapping"));
	}
#endif
}

OpenPOWER on IntegriCloud