Commit | Line | Data |
---|---|---|
8e9db35f PB |
1 | /* $Id$ */ |
2 | /*************************************************************** | |
3 | ** I/O subsystem for PForth for WIN32 systems. | |
4 | ** | |
5 | ** Author: Phil Burk | |
6 | ** Copyright 1994 3DO, Phil Burk, Larry Polansky, David Rosenboom | |
7 | ** | |
8 | ** The pForth software code is dedicated to the public domain, | |
9 | ** and any third party may reproduce, distribute and modify | |
10 | ** the pForth software code or any derivative works thereof | |
11 | ** without any compensation or license. The pForth software | |
12 | ** code is provided on an "as is" basis without any warranty | |
13 | ** of any kind, including, without limitation, the implied | |
14 | ** warranties of merchantability and fitness for a particular | |
15 | ** purpose and their equivalents under the laws of any jurisdiction. | |
16 | ** | |
17 | **************************************************************** | |
18 | ** 941004 PLB Extracted IO calls from pforth_main.c | |
19 | ***************************************************************/ | |
20 | ||
21 | #include "../pf_all.h" | |
22 | ||
23 | #include <conio.h> | |
24 | ||
25 | /* Use console mode I/O so that KEY and ?TERMINAL will work. */ | |
26 | #if defined(WIN32) || defined(__NT__) | |
27 | int sdTerminalOut( char c ) | |
28 | { | |
29 | #if defined(__WATCOMC__) | |
30 | return putch((char)(c)); | |
31 | #else | |
32 | return _putch((char)(c)); | |
33 | #endif | |
34 | } | |
35 | ||
36 | /* Needed cuz _getch() does not echo. */ | |
37 | int sdTerminalEcho( char c ) | |
38 | { | |
39 | #if defined(__WATCOMC__) | |
40 | return putch((char)(c)); | |
41 | #else | |
42 | return _putch((char)(c)); | |
43 | #endif | |
44 | } | |
45 | ||
46 | int sdTerminalIn( void ) | |
47 | { | |
48 | return _getch(); | |
49 | } | |
50 | ||
51 | int sdQueryTerminal( void ) | |
52 | { | |
53 | return _kbhit(); | |
54 | } | |
55 | ||
56 | int sdTerminalFlush( void ) | |
57 | { | |
58 | #ifdef PF_NO_FILEIO | |
59 | return -1; | |
60 | #else | |
61 | return fflush(PF_STDOUT); | |
62 | #endif | |
63 | } | |
64 | ||
65 | void sdTerminalInit( void ) | |
66 | { | |
67 | } | |
68 | ||
69 | void sdTerminalTerm( void ) | |
70 | { | |
71 | } | |
72 | #endif |