Browse Source

Use iskey() and getchar() to interact with console, rather than object

abstraction.
tags/v0.9.3
Michael Brown 18 years ago
parent
commit
2ed2b2efe8
3 changed files with 5 additions and 19 deletions
  1. 3
    2
      src/hci/mucurses/kb.c
  2. 0
    15
      src/include/curses.h
  3. 2
    2
      src/tests/curses_scr.c

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

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

+ 0
- 15
src/include/curses.h View File

@@ -46,21 +46,6 @@ typedef struct _curses_screen {
46 46
 	 * @v c		character to be written
47 47
 	 */
48 48
 	void ( * putc ) ( struct _curses_screen *scr, chtype c );
49
-	/**
50
-	 * Pop a character from the keyboard input stream
51
-	 *
52
-	 * @v scr	screen on which to operate
53
-	 * @ret c	popped character
54
-	 */
55
-	int ( * getc ) ( struct _curses_screen *scr );
56
-	/**
57
-	 * Checks to see whether a character is waiting in the input stream
58
-	 *
59
-	 * @v scr	screen on which to operate
60
-	 * @ret TRUE	character waiting in stream
61
-	 * @ret FALSE	no character waiting in stream
62
-	 */
63
-	bool ( *peek ) ( struct _curses_screen *scr );
64 49
 } SCREEN;
65 50
 
66 51
 /** Curses Window struct */

+ 2
- 2
src/tests/curses_scr.c View File

@@ -83,6 +83,6 @@ SCREEN _curscr = {
83 83
 	.exit = _exit_screen,
84 84
 	.movetoyx = _movetoyx,
85 85
 	.putc = _putc,
86
-	.getc = _getc,
87
-	.peek = _peek,
86
+	//	.getc = _getc,
87
+	//	.peek = _peek,
88 88
 };

Loading…
Cancel
Save