See ChangeLog entry 2001-08-17 16:10 UTC-0400 David G. Holm <dholm@jsd-llc.com>

This commit is contained in:
David G. Holm
2001-08-17 20:13:27 +00:00
parent f047a9927f
commit b3bc60ac46
3 changed files with 51 additions and 12 deletions

View File

@@ -1,3 +1,16 @@
2001-08-17 16:10 UTC-0400 David G. Holm <dholm@jsd-llc.com>
Update from "Fergus McDonald" <listsub@qvolution.com>:
* source/rtl/gtstd/gtstd.c
* tests/gtstdtst.c
+ Added conditional functionality for MS C compiler to use io and
conio libs to map stdin in the same manner as already implemented
for unix version (i.e. no blocking). That is, if stdin is coming
from console, inkey() returns 0 if no key waiting, and if stdin is
coming from a file, inkey() returns each char of file and then
always returns 0 once EOF is reached.
2001-08-17 20:15 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
*doc/en/compiler.txt

View File

@@ -60,6 +60,11 @@
#if defined( OS_UNIX_COMPATIBLE )
#include <unistd.h> /* read() function requires it */
#include <termios.h>
#else
#if defined(_MSC_VER)
#include <io.h>
#include <conio.h>
#endif
#endif
/* Add time function for BEL flood throttling.. */
@@ -87,6 +92,11 @@ static ULONG s_ulCrLf;
static struct termios startup_attributes;
#endif
#if defined(_MSC_VER)
static BOOL s_bStdinConsole;
#endif
void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Init()"));
@@ -110,18 +120,22 @@ void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr )
}
#endif
#if defined(_MSC_VER)
s_bStdinConsole = _isatty(0);
#endif
s_uiDispCount = 0;
s_iRow = 0;
s_iCol = 0;
#if defined(OS_UNIX_COMPATIBLE)
// #if defined(OS_UNIX_COMPATIBLE)
s_uiMaxRow = 24;
s_uiMaxCol = 80;
#else
s_uiMaxRow = 32767;
s_uiMaxCol = 32767;
#endif
// #else
// s_uiMaxRow = 32767;
// s_uiMaxCol = 32767;
// #endif
s_uiCursorStyle = SC_NORMAL;
s_bBlink = FALSE;
@@ -174,7 +188,18 @@ int hb_gt_ReadKey( HB_inkey_enum eventmask )
if( ! read( STDIN_FILENO, &ch, 1 ) )
ch = 0;
#else
ch = 0;
#if defined(_MSC_VER)
if( s_bStdinConsole )
{
if( _kbhit() ) ch = _getch();
}
else
{
if(! _eof(0) ) _read(0, &ch, 1);
}
#endif
#endif
/* TODO: */

View File

@@ -4,18 +4,14 @@
/* gtstd test */
func PosNow()
?? "[" + alltrim(str(row())) + "," + alltrim(str(col())) + "]"
return NIL
func Main()
local n
PosNow()
?? "Output test. First line, no newlines."
? "Press RETURN to continue."
while inkey(0) <> 13 ; enddo
? "Press a key to continue: "
?? inkey(0)
? "This is row " + alltrim(str(row()))
@@ -56,3 +52,8 @@ func Main()
next
return NIL
func PosNow()
?? "[" + alltrim(str(row())) + "," + alltrim(str(col())) + "]"
return NIL