Selaa lähdekoodia

Now basically functioning on ANSI-supporting consoles.

tags/v0.9.3
Michael Brown 18 vuotta sitten
vanhempi
commit
edbdce6e3d

+ 51
- 0
src/hci/mucurses/ansi_screen.c Näytä tiedosto

@@ -0,0 +1,51 @@
1
+#include <curses.h>
2
+#include <console.h>
3
+
4
+unsigned short _COLS = 80;
5
+unsigned short _LINES = 25;
6
+
7
+static void ansiscr_init ( struct _curses_screen *scr __unused ) {
8
+}
9
+
10
+static void ansiscr_exit ( struct _curses_screen *scr __unused ) {
11
+}
12
+
13
+static void ansiscr_movetoyx ( struct _curses_screen *scr __unused,
14
+			       unsigned int y, unsigned int x ) {
15
+	/* ANSI escape sequence to update cursor position */
16
+	printf ( "\033[%d;%dH", ( y + 1 ), ( x + 1 ) );
17
+}
18
+
19
+static void ansiscr_putc ( struct _curses_screen *scr, chtype c ) {
20
+	unsigned int character = ( c & A_CHARTEXT );
21
+	attr_t attrs = ( c & ( A_ATTRIBUTES | A_COLOR ) );
22
+	int bold = ( attrs & A_BOLD );
23
+	attr_t cpair = PAIR_NUMBER ( attrs );
24
+	short fcol;
25
+	short bcol;
26
+
27
+	if ( attrs != scr->attrs ) {
28
+		scr->attrs = attrs;
29
+		pair_content ( cpair, &fcol, &bcol );
30
+		/* ANSI escape sequence to update character attributes */
31
+		printf ( "\033[0;%d;3%d;4%dm", ( bold ? 1 : 22 ), fcol, bcol );
32
+	}
33
+	putchar ( character );
34
+}
35
+
36
+static int ansiscr_getc ( struct _curses_screen *scr __unused ) {
37
+	return getchar();
38
+}
39
+
40
+static bool ansiscr_peek ( struct _curses_screen *scr __unused ) {
41
+	return iskey();
42
+}
43
+
44
+SCREEN _ansi_screen = {
45
+	.init		= ansiscr_init,
46
+	.exit		= ansiscr_exit,
47
+	.movetoyx	= ansiscr_movetoyx,
48
+	.putc		= ansiscr_putc,
49
+	.getc		= ansiscr_getc,
50
+	.peek		= ansiscr_peek,
51
+};

+ 49
- 35
src/hci/mucurses/colour.c Näytä tiedosto

@@ -1,14 +1,13 @@
1 1
 #include <curses.h>
2 2
 
3
-/**
4
- * Indicates whether the underlying terminal device is capable of
5
- * having colours redefined
6
- *
7
- * @ret bool	returns boolean
8
- */
9
-bool can_change_colour ( void ) {
10
-	return (bool)TRUE;
11
-}
3
+struct colour_pair {
4
+	short fcol;
5
+	short bcol;
6
+};
7
+
8
+static struct colour_pair cpairs[COLOUR_PAIRS] = {
9
+	[0] = { COLOUR_WHITE, COLOUR_BLACK },
10
+};
12 11
 
13 12
 /**
14 13
  * Identify the RGB components of a given colour value
@@ -20,31 +19,46 @@ bool can_change_colour ( void ) {
20 19
  * @ret rc	return status code
21 20
  */
22 21
 int colour_content ( short colour, short *red, short *green, short *blue ) {
23
-	/* we do not have a particularly large range of colours (3
24
-	   primary, 3 secondary and black), so let's just put in a
25
-	   basic switch... */
26
-	switch(colour) {
27
-	case COLOUR_BLACK:
28
-		*red = 0; *green = 0; *blue = 0;
29
-		break;
30
-	case COLOUR_BLUE:
31
-		*red = 0; *green = 0; *blue = 1000;
32
-		break;
33
-	case COLOUR_GREEN:
34
-		*red = 0; *green = 1000; *blue = 0;
35
-		break;
36
-	case COLOUR_CYAN:
37
-		*red = 0; *green = 1000; *blue = 1000;
38
-		break;
39
-	case COLOUR_RED:
40
-		*red = 1000; *green = 0; *blue = 0;
41
-		break;
42
-	case COLOUR_MAGENTA:
43
-		*red = 1000; *green = 0; *blue = 1000;
44
-		break;
45
-	case COLOUR_YELLOW:
46
-		*red = 1000; *green = 1000; *blue = 0;
47
-		break;
48
-	}
22
+	*red = ( ( colour & COLOUR_RED ) ? 1 : 0 );
23
+	*green = ( ( colour & COLOUR_GREEN ) ? 1 : 0 );
24
+	*blue = ( ( colour & COLOUR_BLUE ) ? 1 : 0 );
25
+	return OK;
26
+}
27
+
28
+/**
29
+ * Initialise colour pair
30
+ *
31
+ * @v pair	colour pair number
32
+ * @v fcol	foreground colour
33
+ * @v bcol	background colour
34
+ */
35
+int init_pair ( short pair, short fcol, short bcol ) {
36
+	struct colour_pair *cpair;
37
+
38
+	if ( ( pair < 1 ) || ( pair >= COLOUR_PAIRS ) )
39
+		return ERR;
40
+	
41
+	cpair = &cpairs[pair];
42
+	cpair->fcol = fcol;
43
+	cpair->bcol = bcol;
44
+	return OK;
45
+}
46
+
47
+/**
48
+ * Get colours of colour pair
49
+ *
50
+ * @v pair	colour pair number
51
+ * @ret fcol	foreground colour
52
+ * @ret bcol	background colour
53
+ */
54
+int pair_content ( short pair, short *fcol, short *bcol ) {
55
+	struct colour_pair *cpair;
56
+
57
+	if ( ( pair < 0 ) || ( pair >= COLOUR_PAIRS ) )
58
+		return ERR;
59
+	
60
+	cpair = &cpairs[pair];
61
+	*fcol = cpair->fcol;
62
+	*bcol = cpair->bcol;
49 63
 	return OK;
50 64
 }

+ 2
- 3
src/hci/mucurses/kb.c Näytä tiedosto

@@ -1,7 +1,6 @@
1 1
 #include <curses.h>
2 2
 #include <stddef.h>
3 3
 #include <timer.h>
4
-#include <console.h>
5 4
 #include "mucurses.h"
6 5
 
7 6
 /** @file
@@ -38,7 +37,7 @@ int _wgetc ( WINDOW *win ) {
38 37
 		return ERR;
39 38
 
40 39
 	timer = INPUT_DELAY_TIMEOUT;
41
-	while ( ! iskey() ) {
40
+	while ( ! win->scr->peek( win->scr ) ) {
42 41
 		if ( m_delay == 0 ) // non-blocking read
43 42
 			return ERR;
44 43
 		if ( timer > 0 ) {  // time-limited blocking read
@@ -48,7 +47,7 @@ int _wgetc ( WINDOW *win ) {
48 47
 		} else { return ERR; } // non-blocking read
49 48
 	}
50 49
 
51
-	c = getchar();
50
+	c = win->scr->getc( win->scr );
52 51
 
53 52
 	if ( m_echo && ( c >= 32 && c <= 126 ) ) // printable ASCII characters
54 53
 		_wputch( win, (chtype) ( c | win->attrs ), WRAP );

+ 15
- 7
src/hci/mucurses/mucurses.c Näytä tiedosto

@@ -1,3 +1,4 @@
1
+#include <console.h>
1 2
 #include <curses.h>
2 3
 #include "mucurses.h"
3 4
 
@@ -13,13 +14,23 @@ WINDOW _stdscr = {
13 14
 	.ori_x = 0,
14 15
 	.curs_y = 0,
15 16
 	.curs_x = 0,
16
-	.scr = curscr,
17
+	.scr = &_ansi_screen,
17 18
 };
18 19
 
19 20
 /*
20 21
  *  Primitives
21 22
  */
22 23
 
24
+/**
25
+ * Update cursor position
26
+ *
27
+ * @v *win	window in which to update position
28
+ */
29
+static void _wupdcurs ( WINDOW *win ) {
30
+	win->scr->movetoyx ( win->scr, win->ori_y + win->curs_y,
31
+			     win->ori_x + win->curs_x );
32
+}
33
+
23 34
 /**
24 35
  * Write a single character rendition to a window
25 36
  *
@@ -30,8 +41,7 @@ WINDOW _stdscr = {
30 41
 void _wputch ( WINDOW *win, chtype ch, int wrap ) {
31 42
 	/* make sure we set the screen cursor to the right position
32 43
 	   first! */
33
-	win->scr->movetoyx( win->scr, win->ori_y + win->curs_y,
34
-				      win->ori_x + win->curs_x );
44
+	_wupdcurs(win);
35 45
 	win->scr->putc(win->scr, ch);
36 46
 	if ( ++(win->curs_x) - win->width == 0 ) {
37 47
 		if ( wrap == WRAP ) {
@@ -63,8 +73,7 @@ void _wcursback ( WINDOW *win ) {
63 73
 		win->curs_x--;
64 74
 	}
65 75
 
66
-	win->scr->movetoyx( win->scr, win->ori_y + win->curs_y,
67
-   			     	      win->ori_x + win->curs_x );
76
+	_wupdcurs(win);
68 77
 }
69 78
 
70 79
 /**
@@ -112,7 +121,6 @@ int wmove ( WINDOW *win, int y, int x ) {
112 121
 
113 122
 	win->curs_y = y;
114 123
 	win->curs_x = x;
115
-	win->scr->movetoyx( win->scr, win->ori_y + win->curs_y, 
116
-			    	      win->ori_x + win->curs_x );
124
+	_wupdcurs(win);
117 125
 	return OK;
118 126
 }

+ 6
- 4
src/hci/mucurses/mucurses.h Näytä tiedosto

@@ -10,9 +10,11 @@
10 10
 #define WRAP 0
11 11
 #define NOWRAP 1
12 12
 
13
-void _wputch ( WINDOW *win, chtype ch, int wrap );
14
-void _wputchstr ( WINDOW *win, const chtype *chstr, int wrap, int n );
15
-void _wputstr ( WINDOW *win, const char *str, int wrap, int n );
16
-void _wcursback ( WINDOW *win );
13
+extern SCREEN _ansi_screen;
14
+
15
+extern void _wputch ( WINDOW *win, chtype ch, int wrap );
16
+extern void _wputchstr ( WINDOW *win, const chtype *chstr, int wrap, int n );
17
+extern void _wputstr ( WINDOW *win, const char *str, int wrap, int n );
18
+extern void _wcursback ( WINDOW *win );
17 19
 
18 20
 #endif /* _MUCURSES_H */

+ 5
- 5
src/hci/mucurses/winattrs.c Näytä tiedosto

@@ -64,7 +64,7 @@ int wattrset ( WINDOW *win, int attrs ) {
64 64
 int wattr_get ( WINDOW *win, attr_t *attrs, short *pair, 
65 65
 		void *opts __unused ) {
66 66
 	*attrs = win->attrs & A_ATTRIBUTES;
67
-	*pair = (short)(( win->attrs & A_COLOR ) >> CPAIR_SHIFT);
67
+	*pair = PAIR_NUMBER ( win->attrs );
68 68
 	return OK;
69 69
 }
70 70
 
@@ -107,7 +107,7 @@ int wattr_on ( WINDOW *win, attr_t attrs,
107 107
  */
108 108
 int wattr_set ( WINDOW *win, attr_t attrs, short cpair, 
109 109
 		void *opts __unused ) {
110
-	wattrset( win, attrs | ( ( (unsigned short)cpair ) << CPAIR_SHIFT ) );
110
+	wattrset( win, attrs | COLOUR_PAIR ( cpair ) );
111 111
 	return OK;
112 112
 }
113 113
 
@@ -121,11 +121,11 @@ int wattr_set ( WINDOW *win, attr_t attrs, short cpair,
121 121
  */
122 122
 int wcolour_set ( WINDOW *win, short colour_pair_number, 
123 123
 		  void *opts __unused ) {
124
-	if ( ( unsigned short )colour_pair_number > COLORS )
124
+	if ( ( unsigned short )colour_pair_number > COLOUR_PAIRS )
125 125
 		return ERR;
126 126
 
127
-	win->attrs = ( (unsigned short)colour_pair_number << CPAIR_SHIFT ) |
128
-		( win->attrs & A_ATTRIBUTES );
127
+	win->attrs = ( ( win->attrs & A_ATTRIBUTES ) |
128
+		       COLOUR_PAIR ( colour_pair_number ) );
129 129
 	return OK;
130 130
 }
131 131
 

+ 10
- 1
src/hci/mucurses/wininit.c Näytä tiedosto

@@ -14,10 +14,19 @@
14 14
 WINDOW *initscr ( void ) {
15 15
 	/* determine console size */
16 16
 	/* initialise screen */
17
-	curscr->init( curscr );
17
+	stdscr->scr->init( stdscr->scr );
18 18
 	stdscr->height = LINES;
19 19
 	stdscr->width = COLS;
20 20
 	werase( stdscr );
21 21
 
22 22
 	return stdscr;
23 23
 }
24
+
25
+/**
26
+ * Finalise console environment
27
+ *
28
+ */
29
+int endwin ( void ) {
30
+	stdscr->scr->exit( stdscr->scr );
31
+	return OK;
32
+}

+ 79
- 42
src/include/curses.h Näytä tiedosto

@@ -28,6 +28,9 @@ typedef uint32_t attr_t;
28 28
 
29 29
 /** Curses SCREEN object */
30 30
 typedef struct _curses_screen {
31
+	/** Current attribute */
32
+	attr_t attrs;
33
+
31 34
 	void ( *init ) ( struct _curses_screen *scr );
32 35
 	void ( *exit ) ( struct _curses_screen *scr );
33 36
 	/**
@@ -46,6 +49,21 @@ typedef struct _curses_screen {
46 49
 	 * @v c		character to be written
47 50
 	 */
48 51
 	void ( * putc ) ( struct _curses_screen *scr, chtype c );
52
+	/**
53
+	 * Pop a character from the keyboard input stream
54
+	 *
55
+	 * @v scr	screen on which to operate
56
+	 * @ret c	popped character
57
+	 */
58
+	int ( * getc ) ( struct _curses_screen *scr );
59
+	/**
60
+	 * Checks to see whether a character is waiting in the input stream
61
+	 *
62
+	 * @v scr	screen on which to operate
63
+	 * @ret TRUE	character waiting in stream
64
+	 * @ret FALSE	no character waiting in stream
65
+	 */
66
+	bool ( *peek ) ( struct _curses_screen *scr );
49 67
 } SCREEN;
50 68
 
51 69
 /** Curses Window struct */
@@ -69,55 +87,57 @@ typedef struct _curses_window {
69 87
 } WINDOW;
70 88
 
71 89
 extern WINDOW _stdscr;
72
-extern SCREEN _curscr;
73 90
 extern unsigned short _COLS;
74 91
 extern unsigned short _LINES;
75
-extern unsigned int _COLOURS;
76
-extern unsigned int _COLOUR_PAIRS;
77 92
 
78 93
 #define stdscr ( &_stdscr )
79
-#define curscr ( &_curscr )
80 94
 #define COLS _COLS
81 95
 #define LINES _LINES
82
-#define COLORS _COLOURS
83
-#define COLOR_PAIRS _COLOUR_PAIRS
84 96
 
85 97
 #define MUCURSES_BITS( mask, shift ) (( mask ) << (shift))
86 98
 #define CPAIR_SHIFT	8
87 99
 #define ATTRS_SHIFT	16
88 100
 
89
-#define A_DEFAULT	( 1UL - 1UL )
90
-#define A_ALTCHARSET	MUCURSES_BITS( 1UL, ATTRS_SHIFT + 0 )
91
-#define A_BLINK		MUCURSES_BITS( 1UL, ATTRS_SHIFT + 1 )
92
-#define A_BOLD		MUCURSES_BITS( 1UL, ATTRS_SHIFT + 2 )
93
-#define A_DIM		MUCURSES_BITS( 1UL, ATTRS_SHIFT + 3 )
94
-#define A_INVIS		MUCURSES_BITS( 1UL, ATTRS_SHIFT + 4 )
95
-#define A_PROTECT	MUCURSES_BITS( 1UL, ATTRS_SHIFT + 5 )
96
-#define A_REVERSE	MUCURSES_BITS( 1UL, ATTRS_SHIFT + 6 )
97
-#define A_STANDOUT	MUCURSES_BITS( 1UL, ATTRS_SHIFT + 7 )
98
-#define A_UNDERLINE	MUCURSES_BITS( 1UL, ATTRS_SHIFT + 8 )
99
-
100
-#define WA_ALTCHARSET	A_ALTCHARSET
101
-#define WA_BLINK	A_BLINK
102
-#define WA_BOLD		A_BOLD
103
-#define WA_DIM		A_DIM
104
-#define WA_INVIS	A_INVIS
105
-#define WA_PROTECT	A_PROTECT
106
-#define WA_REVERSE	A_REVERSE
107
-#define WA_STANDOUT	A_STANDOUT
108
-#define WA_UNDERLINE	A_UNDERLINE
109
-#define WA_HORIZONTAL	MUCURSES_BITS( 1UL, ATTRS_SHIFT + 9 )
110
-#define WA_VERTICAL	MUCURSES_BITS( 1UL, ATTRS_SHIFT + 10 )
111
-#define WA_LEFT		MUCURSES_BITS( 1UL, ATTRS_SHIFT + 11 )
112
-#define WA_RIGHT	MUCURSES_BITS( 1UL, ATTRS_SHIFT + 12 )
113
-#define WA_LOW		MUCURSES_BITS( 1UL, ATTRS_SHIFT + 13 )
114
-#define WA_TOP		MUCURSES_BITS( 1UL, ATTRS_SHIFT + 14 )
115
-
116
-#define A_ATTRIBUTES	( MUCURSES_BITS( 1UL, ATTRS_SHIFT ) - 1UL )
117
-#define A_CHARTEXT	( MUCURSES_BITS( 1UL, 0 ) - 1UL )
118
-#define A_COLOUR	MUCURSES_BITS( ( 1UL << 8 ) - 1UL, CPAIR_SHIFT )
101
+#define WA_DEFAULT	( 0x0000 << ATTRS_SHIFT )
102
+#define WA_ALTCHARSET	( 0x0001 << ATTRS_SHIFT )
103
+#define WA_BLINK	( 0x0002 << ATTRS_SHIFT )
104
+#define WA_BOLD		( 0x0004 << ATTRS_SHIFT )
105
+#define WA_DIM		( 0x0008 << ATTRS_SHIFT )
106
+#define WA_INVIS	( 0x0010 << ATTRS_SHIFT )
107
+#define WA_PROTECT	( 0x0020 << ATTRS_SHIFT )
108
+#define WA_REVERSE	( 0x0040 << ATTRS_SHIFT )
109
+#define WA_STANDOUT	( 0x0080 << ATTRS_SHIFT )
110
+#define WA_UNDERLINE	( 0x0100 << ATTRS_SHIFT )
111
+#define WA_HORIZONTAL	( 0x0200 << ATTRS_SHIFT )
112
+#define WA_VERTICAL	( 0x0400 << ATTRS_SHIFT )
113
+#define WA_LEFT		( 0x0800 << ATTRS_SHIFT )
114
+#define WA_RIGHT	( 0x1000 << ATTRS_SHIFT )
115
+#define WA_LOW		( 0x2000 << ATTRS_SHIFT )
116
+#define WA_TOP		( 0x4000 << ATTRS_SHIFT )
117
+
118
+#define A_DEFAULT	WA_DEFAULT
119
+#define A_ALTCHARSET	WA_ALTCHARSET
120
+#define A_BLINK		WA_BLINK
121
+#define A_BOLD		WA_BOLD
122
+#define A_DIM		WA_DIM
123
+#define A_INVIS		WA_INVIS
124
+#define A_PROTECT	WA_PROTECT
125
+#define A_REVERSE	WA_REVERSE
126
+#define A_STANDOUT	WA_STANDOUT
127
+#define A_UNDERLINE	WA_UNDERLINE
128
+
129
+#define A_ATTRIBUTES	( 0xffff << ATTRS_SHIFT )
130
+#define A_CHARTEXT	( 0xff )
131
+#define A_COLOUR	( 0xff << CPAIR_SHIFT )
119 132
 #define A_COLOR		A_COLOUR
120 133
 
134
+#define COLOUR_PAIR(n)	( (n) << CPAIR_SHIFT )
135
+#define COLOR_PAIR(n)	COLOUR_PAIR(n)
136
+#define PAIR_NUMBER(attrs) ( ( (attrs) & A_COLOUR ) >> CPAIR_SHIFT )
137
+
138
+#define COLOUR_PAIRS	4 /* Arbitrary limit */
139
+#define COLOR_PAIRS	COLOUR_PAIRS
140
+
121 141
 #define ACS_ULCORNER	'+'
122 142
 #define ACS_LLCORNER	'+'
123 143
 #define ACS_URCORNER	'+'
@@ -152,6 +172,7 @@ extern unsigned int _COLOUR_PAIRS;
152 172
 #define COLOUR_MAGENTA	5
153 173
 #define COLOUR_CYAN	6
154 174
 #define COLOUR_WHITE	7
175
+#define COLOURS		7
155 176
 
156 177
 #define COLOUR_FG	30
157 178
 #define COLOUR_BG	40
@@ -166,6 +187,7 @@ extern unsigned int _COLOUR_PAIRS;
166 187
 #define COLOR_MAGENTA	COLOUR_MAGENTA
167 188
 #define COLOR_YELLOW	COLOUR_YELLOW
168 189
 #define COLOR_WHITE	COLOUR_WHITE
190
+#define COLORS		COLOURS
169 191
 
170 192
 /*
171 193
  * KEY code constants
@@ -281,7 +303,7 @@ extern int beep ( void );
281 303
 /*extern int border ( chtype, chtype, chtype, chtype, chtype, chtype, chtype,
282 304
   chtype );*/
283 305
 extern int box ( WINDOW *, chtype, chtype );
284
-extern bool can_change_colour ( void );
306
+//extern bool can_change_colour ( void );
285 307
 #define can_change_color() can_change_colour()
286 308
 extern int cbreak ( void ); 
287 309
 //extern int clrtobot ( void );
@@ -289,7 +311,7 @@ extern int cbreak ( void );
289 311
 extern int colour_content ( short, short *, short *, short * );
290 312
 #define color_content( c, r, g, b ) colour_content( (c), (r), (g), (b) )
291 313
 //extern int colour_set ( short, void * );
292
-//#define color_set( cpno, opts ) colour_set( (cpno), (opts) )
314
+#define color_set( cpno, opts ) colour_set( (cpno), (opts) )
293 315
 extern int copywin ( const WINDOW *, WINDOW *, int, int, int, 
294 316
 		     int, int, int, int );
295 317
 extern int curs_set ( int );
@@ -316,7 +338,7 @@ extern chtype getbkgd ( WINDOW * );
316 338
 //extern int getnstr ( char *, int );
317 339
 //extern int getstr ( char * );
318 340
 extern int halfdelay ( int );
319
-extern bool has_colors ( void );
341
+//extern bool has_colors ( void );
320 342
 extern bool has_ic ( void );
321 343
 extern bool has_il ( void );
322 344
 //extern int hline ( chtype, int );
@@ -405,7 +427,6 @@ extern int notimeout ( WINDOW *, bool );
405 427
 extern int overlay ( const WINDOW *, WINDOW * );
406 428
 extern int overwrite ( const WINDOW *, WINDOW * );
407 429
 extern int pair_content ( short, short *, short * );
408
-extern int PAIR_NUMBER ( int );
409 430
 //extern int pechochar ( WINDOW *, chtype );
410 431
 //extern int pnoutrefresh ( WINDOW *, int, int, int, int, int, int );
411 432
 //extern int prefresh ( WINDOW *, int, int, int, int, int, int );
@@ -445,7 +466,7 @@ extern int slk_set ( int, const char *, int );
445 466
 extern int slk_touch ( void );
446 467
 extern int standend ( void );
447 468
 extern int standout ( void );
448
-extern int start_colour ( void );
469
+//extern int start_colour ( void );
449 470
 #define start_color() start_colour()
450 471
 //extern WINDOW *subpad ( WINDOW *, int, int, int, int );
451 472
 extern WINDOW *subwin ( WINDOW *, int, int, int, int );
@@ -492,7 +513,7 @@ extern int wborder ( WINDOW *, chtype, chtype, chtype, chtype, chtype, chtype,
492 513
 extern int wclrtobot ( WINDOW * );
493 514
 extern int wclrtoeol ( WINDOW * );
494 515
 extern void wcursyncup ( WINDOW * );
495
-//extern int wcolor_set ( WINDOW *, short, void * );
516
+extern int wcolour_set ( WINDOW *, short, void * );
496 517
 #define wcolor_set(w,s,v) wcolour_set((w),(s),(v))
497 518
 extern int wdelch ( WINDOW * );
498 519
 extern int wdeleteln ( WINDOW * );
@@ -574,6 +595,10 @@ static inline int border ( chtype ls, chtype rs, chtype ts, chtype bs,
574 595
 	return wborder ( stdscr, ls, rs, ts, bs, tl, tr, bl, br );
575 596
 }
576 597
 
598
+static inline bool can_change_colour ( void ) {
599
+	return FALSE;
600
+}
601
+
577 602
 static inline int clrtobot ( void ) {
578 603
 	return wclrtobot( stdscr );
579 604
 }
@@ -582,6 +607,10 @@ static inline int clrtoeol ( void ) {
582 607
 	return wclrtoeol( stdscr );
583 608
 }
584 609
 
610
+static inline int colour_set ( short colour_pair_number, void *opts ) {
611
+	return wcolour_set ( stdscr, colour_pair_number, opts );
612
+}
613
+
585 614
 static inline int delch ( void ) {
586 615
 	return wdelch ( stdscr );
587 616
 }
@@ -606,6 +635,10 @@ static inline int getstr ( char *str ) {
606 635
 	return wgetnstr ( stdscr, str, -1 );
607 636
 }
608 637
 
638
+static inline bool has_colors ( void ) {
639
+	return TRUE;
640
+}
641
+
609 642
 static inline int hline ( chtype ch, int n ) {
610 643
 	return whline ( stdscr, ch, n );
611 644
 }
@@ -745,6 +778,10 @@ static inline int slk_refresh ( void ) {
745 778
 #define standend() wstandend( stdscr )
746 779
 #define standout() wstandout( stdscr )
747 780
 
781
+static inline int start_colour ( void ) {
782
+	return OK;
783
+}
784
+
748 785
 static inline int vline ( chtype ch, int n ) {
749 786
 	return wvline ( stdscr, ch, n );
750 787
 }

Loading…
Peruuta
Tallenna