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