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

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

46
 	 * @v c		character to be written
46
 	 * @v c		character to be written
47
 	 */
47
 	 */
48
 	void ( * putc ) ( struct _curses_screen *scr, chtype c );
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
 } SCREEN;
49
 } SCREEN;
65
 
50
 
66
 /** Curses Window struct */
51
 /** Curses Window struct */

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

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

Loading…
Cancel
Save