version 1.22, 2006/04/09 08:04:22
|
version 1.27, 2007/07/01 18:32:11
|
Line 1
|
Line 1
|
/* direct key io driver |
/* direct key io driver |
|
|
Copyright (C) 1995,1996,1997,1998,1999,2002,2003 Free Software Foundation, Inc. |
Copyright (C) 1995,1996,1997,1998,1999,2002,2003,2006 Free Software Foundation, Inc. |
|
|
This file is part of Gforth. |
This file is part of Gforth. |
|
|
Line 475 void prep_terminal ()
|
Line 475 void prep_terminal ()
|
} /* added by MdG */ |
} /* added by MdG */ |
|
|
setlocale(LC_ALL, ""); |
setlocale(LC_ALL, ""); |
|
setlocale(LC_NUMERIC, "C"); |
|
|
/* Try to keep this function from being INTerrupted. We can do it |
/* Try to keep this function from being INTerrupted. We can do it |
on POSIX and systems with BSD-like signal handling. */ |
on POSIX and systems with BSD-like signal handling. */ |
Line 621 long key_avail (FILE * stream)
|
Line 622 long key_avail (FILE * stream)
|
{ |
{ |
int tty = fileno (stream); |
int tty = fileno (stream); |
fd_set selin; |
fd_set selin; |
static int now[2] = { 0 , 0 }; |
static long int now[2] = { 0 , 0 }; |
int res; |
int res; |
|
|
setvbuf(stream, NULL, _IONBF, 0); |
setvbuf(stream, NULL, _IONBF, 0); |
Line 645 Cell getkey(FILE * stream)
|
Line 646 Cell getkey(FILE * stream)
|
Cell result; |
Cell result; |
unsigned char c; |
unsigned char c; |
|
|
|
setvbuf(stream, NULL, _IONBF, 0); |
if(!terminal_prepped && stream == stdin) |
if(!terminal_prepped && stream == stdin) |
prep_terminal(); |
prep_terminal(); |
|
|
Line 652 Cell getkey(FILE * stream)
|
Line 654 Cell getkey(FILE * stream)
|
return result==0 ? EOF : c; |
return result==0 ? EOF : c; |
} |
} |
|
|
|
#ifdef STANDALONE |
|
void emit_char(char x) |
|
{ |
|
putc(x, stdout); |
|
} |
|
|
|
void type_chars(char *addr, unsigned int l) |
|
{ |
|
fwrite(addr, l, 1, stdout); |
|
} |
|
#endif |
|
|
#ifdef TEST |
#ifdef TEST |
|
|
#include <time.h> |
#include <time.h> |