Browse Source

Now basically functioning on ANSI-supporting consoles.

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
edbdce6e3d

+ 51
- 0
src/hci/mucurses/ansi_screen.c View File

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 View File

1
 #include <curses.h>
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
  * Identify the RGB components of a given colour value
13
  * Identify the RGB components of a given colour value
20
  * @ret rc	return status code
19
  * @ret rc	return status code
21
  */
20
  */
22
 int colour_content ( short colour, short *red, short *green, short *blue ) {
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
 	return OK;
63
 	return OK;
50
 }
64
 }

+ 2
- 3
src/hci/mucurses/kb.c View File

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

+ 15
- 7
src/hci/mucurses/mucurses.c View File

1
+#include <console.h>
1
 #include <curses.h>
2
 #include <curses.h>
2
 #include "mucurses.h"
3
 #include "mucurses.h"
3
 
4
 
13
 	.ori_x = 0,
14
 	.ori_x = 0,
14
 	.curs_y = 0,
15
 	.curs_y = 0,
15
 	.curs_x = 0,
16
 	.curs_x = 0,
16
-	.scr = curscr,
17
+	.scr = &_ansi_screen,
17
 };
18
 };
18
 
19
 
19
 /*
20
 /*
20
  *  Primitives
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
  * Write a single character rendition to a window
35
  * Write a single character rendition to a window
25
  *
36
  *
30
 void _wputch ( WINDOW *win, chtype ch, int wrap ) {
41
 void _wputch ( WINDOW *win, chtype ch, int wrap ) {
31
 	/* make sure we set the screen cursor to the right position
42
 	/* make sure we set the screen cursor to the right position
32
 	   first! */
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
 	win->scr->putc(win->scr, ch);
45
 	win->scr->putc(win->scr, ch);
36
 	if ( ++(win->curs_x) - win->width == 0 ) {
46
 	if ( ++(win->curs_x) - win->width == 0 ) {
37
 		if ( wrap == WRAP ) {
47
 		if ( wrap == WRAP ) {
63
 		win->curs_x--;
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
 
121
 
113
 	win->curs_y = y;
122
 	win->curs_y = y;
114
 	win->curs_x = x;
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
 	return OK;
125
 	return OK;
118
 }
126
 }

+ 6
- 4
src/hci/mucurses/mucurses.h View File

10
 #define WRAP 0
10
 #define WRAP 0
11
 #define NOWRAP 1
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
 #endif /* _MUCURSES_H */
20
 #endif /* _MUCURSES_H */

+ 5
- 5
src/hci/mucurses/winattrs.c View File

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

+ 10
- 1
src/hci/mucurses/wininit.c View File

14
 WINDOW *initscr ( void ) {
14
 WINDOW *initscr ( void ) {
15
 	/* determine console size */
15
 	/* determine console size */
16
 	/* initialise screen */
16
 	/* initialise screen */
17
-	curscr->init( curscr );
17
+	stdscr->scr->init( stdscr->scr );
18
 	stdscr->height = LINES;
18
 	stdscr->height = LINES;
19
 	stdscr->width = COLS;
19
 	stdscr->width = COLS;
20
 	werase( stdscr );
20
 	werase( stdscr );
21
 
21
 
22
 	return stdscr;
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 View File

28
 
28
 
29
 /** Curses SCREEN object */
29
 /** Curses SCREEN object */
30
 typedef struct _curses_screen {
30
 typedef struct _curses_screen {
31
+	/** Current attribute */
32
+	attr_t attrs;
33
+
31
 	void ( *init ) ( struct _curses_screen *scr );
34
 	void ( *init ) ( struct _curses_screen *scr );
32
 	void ( *exit ) ( struct _curses_screen *scr );
35
 	void ( *exit ) ( struct _curses_screen *scr );
33
 	/**
36
 	/**
46
 	 * @v c		character to be written
49
 	 * @v c		character to be written
47
 	 */
50
 	 */
48
 	void ( * putc ) ( struct _curses_screen *scr, chtype c );
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
 } SCREEN;
67
 } SCREEN;
50
 
68
 
51
 /** Curses Window struct */
69
 /** Curses Window struct */
69
 } WINDOW;
87
 } WINDOW;
70
 
88
 
71
 extern WINDOW _stdscr;
89
 extern WINDOW _stdscr;
72
-extern SCREEN _curscr;
73
 extern unsigned short _COLS;
90
 extern unsigned short _COLS;
74
 extern unsigned short _LINES;
91
 extern unsigned short _LINES;
75
-extern unsigned int _COLOURS;
76
-extern unsigned int _COLOUR_PAIRS;
77
 
92
 
78
 #define stdscr ( &_stdscr )
93
 #define stdscr ( &_stdscr )
79
-#define curscr ( &_curscr )
80
 #define COLS _COLS
94
 #define COLS _COLS
81
 #define LINES _LINES
95
 #define LINES _LINES
82
-#define COLORS _COLOURS
83
-#define COLOR_PAIRS _COLOUR_PAIRS
84
 
96
 
85
 #define MUCURSES_BITS( mask, shift ) (( mask ) << (shift))
97
 #define MUCURSES_BITS( mask, shift ) (( mask ) << (shift))
86
 #define CPAIR_SHIFT	8
98
 #define CPAIR_SHIFT	8
87
 #define ATTRS_SHIFT	16
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
 #define A_COLOR		A_COLOUR
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
 #define ACS_ULCORNER	'+'
141
 #define ACS_ULCORNER	'+'
122
 #define ACS_LLCORNER	'+'
142
 #define ACS_LLCORNER	'+'
123
 #define ACS_URCORNER	'+'
143
 #define ACS_URCORNER	'+'
152
 #define COLOUR_MAGENTA	5
172
 #define COLOUR_MAGENTA	5
153
 #define COLOUR_CYAN	6
173
 #define COLOUR_CYAN	6
154
 #define COLOUR_WHITE	7
174
 #define COLOUR_WHITE	7
175
+#define COLOURS		7
155
 
176
 
156
 #define COLOUR_FG	30
177
 #define COLOUR_FG	30
157
 #define COLOUR_BG	40
178
 #define COLOUR_BG	40
166
 #define COLOR_MAGENTA	COLOUR_MAGENTA
187
 #define COLOR_MAGENTA	COLOUR_MAGENTA
167
 #define COLOR_YELLOW	COLOUR_YELLOW
188
 #define COLOR_YELLOW	COLOUR_YELLOW
168
 #define COLOR_WHITE	COLOUR_WHITE
189
 #define COLOR_WHITE	COLOUR_WHITE
190
+#define COLORS		COLOURS
169
 
191
 
170
 /*
192
 /*
171
  * KEY code constants
193
  * KEY code constants
281
 /*extern int border ( chtype, chtype, chtype, chtype, chtype, chtype, chtype,
303
 /*extern int border ( chtype, chtype, chtype, chtype, chtype, chtype, chtype,
282
   chtype );*/
304
   chtype );*/
283
 extern int box ( WINDOW *, chtype, chtype );
305
 extern int box ( WINDOW *, chtype, chtype );
284
-extern bool can_change_colour ( void );
306
+//extern bool can_change_colour ( void );
285
 #define can_change_color() can_change_colour()
307
 #define can_change_color() can_change_colour()
286
 extern int cbreak ( void ); 
308
 extern int cbreak ( void ); 
287
 //extern int clrtobot ( void );
309
 //extern int clrtobot ( void );
289
 extern int colour_content ( short, short *, short *, short * );
311
 extern int colour_content ( short, short *, short *, short * );
290
 #define color_content( c, r, g, b ) colour_content( (c), (r), (g), (b) )
312
 #define color_content( c, r, g, b ) colour_content( (c), (r), (g), (b) )
291
 //extern int colour_set ( short, void * );
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
 extern int copywin ( const WINDOW *, WINDOW *, int, int, int, 
315
 extern int copywin ( const WINDOW *, WINDOW *, int, int, int, 
294
 		     int, int, int, int );
316
 		     int, int, int, int );
295
 extern int curs_set ( int );
317
 extern int curs_set ( int );
316
 //extern int getnstr ( char *, int );
338
 //extern int getnstr ( char *, int );
317
 //extern int getstr ( char * );
339
 //extern int getstr ( char * );
318
 extern int halfdelay ( int );
340
 extern int halfdelay ( int );
319
-extern bool has_colors ( void );
341
+//extern bool has_colors ( void );
320
 extern bool has_ic ( void );
342
 extern bool has_ic ( void );
321
 extern bool has_il ( void );
343
 extern bool has_il ( void );
322
 //extern int hline ( chtype, int );
344
 //extern int hline ( chtype, int );
405
 extern int overlay ( const WINDOW *, WINDOW * );
427
 extern int overlay ( const WINDOW *, WINDOW * );
406
 extern int overwrite ( const WINDOW *, WINDOW * );
428
 extern int overwrite ( const WINDOW *, WINDOW * );
407
 extern int pair_content ( short, short *, short * );
429
 extern int pair_content ( short, short *, short * );
408
-extern int PAIR_NUMBER ( int );
409
 //extern int pechochar ( WINDOW *, chtype );
430
 //extern int pechochar ( WINDOW *, chtype );
410
 //extern int pnoutrefresh ( WINDOW *, int, int, int, int, int, int );
431
 //extern int pnoutrefresh ( WINDOW *, int, int, int, int, int, int );
411
 //extern int prefresh ( WINDOW *, int, int, int, int, int, int );
432
 //extern int prefresh ( WINDOW *, int, int, int, int, int, int );
445
 extern int slk_touch ( void );
466
 extern int slk_touch ( void );
446
 extern int standend ( void );
467
 extern int standend ( void );
447
 extern int standout ( void );
468
 extern int standout ( void );
448
-extern int start_colour ( void );
469
+//extern int start_colour ( void );
449
 #define start_color() start_colour()
470
 #define start_color() start_colour()
450
 //extern WINDOW *subpad ( WINDOW *, int, int, int, int );
471
 //extern WINDOW *subpad ( WINDOW *, int, int, int, int );
451
 extern WINDOW *subwin ( WINDOW *, int, int, int, int );
472
 extern WINDOW *subwin ( WINDOW *, int, int, int, int );
492
 extern int wclrtobot ( WINDOW * );
513
 extern int wclrtobot ( WINDOW * );
493
 extern int wclrtoeol ( WINDOW * );
514
 extern int wclrtoeol ( WINDOW * );
494
 extern void wcursyncup ( WINDOW * );
515
 extern void wcursyncup ( WINDOW * );
495
-//extern int wcolor_set ( WINDOW *, short, void * );
516
+extern int wcolour_set ( WINDOW *, short, void * );
496
 #define wcolor_set(w,s,v) wcolour_set((w),(s),(v))
517
 #define wcolor_set(w,s,v) wcolour_set((w),(s),(v))
497
 extern int wdelch ( WINDOW * );
518
 extern int wdelch ( WINDOW * );
498
 extern int wdeleteln ( WINDOW * );
519
 extern int wdeleteln ( WINDOW * );
574
 	return wborder ( stdscr, ls, rs, ts, bs, tl, tr, bl, br );
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
 static inline int clrtobot ( void ) {
602
 static inline int clrtobot ( void ) {
578
 	return wclrtobot( stdscr );
603
 	return wclrtobot( stdscr );
579
 }
604
 }
582
 	return wclrtoeol( stdscr );
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
 static inline int delch ( void ) {
614
 static inline int delch ( void ) {
586
 	return wdelch ( stdscr );
615
 	return wdelch ( stdscr );
587
 }
616
 }
606
 	return wgetnstr ( stdscr, str, -1 );
635
 	return wgetnstr ( stdscr, str, -1 );
607
 }
636
 }
608
 
637
 
638
+static inline bool has_colors ( void ) {
639
+	return TRUE;
640
+}
641
+
609
 static inline int hline ( chtype ch, int n ) {
642
 static inline int hline ( chtype ch, int n ) {
610
 	return whline ( stdscr, ch, n );
643
 	return whline ( stdscr, ch, n );
611
 }
644
 }
745
 #define standend() wstandend( stdscr )
778
 #define standend() wstandend( stdscr )
746
 #define standout() wstandout( stdscr )
779
 #define standout() wstandout( stdscr )
747
 
780
 
781
+static inline int start_colour ( void ) {
782
+	return OK;
783
+}
784
+
748
 static inline int vline ( chtype ch, int n ) {
785
 static inline int vline ( chtype ch, int n ) {
749
 	return wvline ( stdscr, ch, n );
786
 	return wvline ( stdscr, ch, n );
750
 }
787
 }

Loading…
Cancel
Save