portable definitions for KEY and EKEY? 
Author Message
 portable definitions for KEY and EKEY?

Because of recent discussions about defining KEY (or dpANS's EKEY) in a
portable fashion, I thought I'd post the following excerpt from the
comp.lang.c FAQ list.  It may of interest to those trying to create
Forth-in-C systems, and/or those just trying to port Forth to different
platforms.

Quote:
>16.1:   How can I read a single character from the keyboard without
>        waiting for a newline?

>A:      Contrary to popular belief and many people's wishes, this is not
>        a C-related question.  (Nor are closely-related questions
>        concerning the echo of keyboard input.)  The delivery of
>        characters from a "keyboard" to a C program is a function of the
>        operating system in use, and has not been standardized by the C
>        language.  Some versions of curses have a cbreak() function
>        which does what you want.  Under UNIX, use ioctl to play with
>        the terminal driver modes (CBREAK or RAW under "classic"
>        versions; ICANON, c_cc[VMIN] and c_cc[VTIME] under System V or
>        Posix systems).  Under MS-DOS, use getch().  Under VMS, try the
>        Screen Management (SMG$) routines.  Under other operating
>        systems, you're on your own.  Beware that some operating systems

                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Quote:
>        make this sort of thing impossible, because character collection

         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Quote:
>        into input lines is done by peripheral processors not under

         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Quote:
>        direct control of the CPU running your program.

         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sounds like it would not be possible to port Forth (or any other
interactive language) to such a platform.  Although there may be enough
laxity in the dpANS definition of KEY to make this a non-problem, I'm
not really sure.

Quote:
>        Operating system specific questions are not appropriate for
>        comp.lang.c .  Many common questions are answered in
>        frequently-asked questions postings in such groups as
>        comp.unix.questions and comp.os.msdos.programmer .  Note that
>        the answers are often not unique even across different variants
>        of a system; bear in mind when answering system-specific
>        questions that the answer that applies to your system may not
>        apply to everyone else's.

This, of course, applies to comp.lang.forth as well.  However, the
question is, of course, of interest to Forth programmers just as it is
to C programmers, even if it's not, strictly speaking, a language
related topic.

Quote:
>        References: PCS Sec. 10 pp. 128-9, Sec. 10.1 pp. 130-1.

--
Chris Waters    | I think, there- | "Never look a gift horse in the mouth"



Tue, 09 Jan 1996 10:37:34 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. KEY , EKEY , AND EKEY>CHAR

2. KEY and EKEY

3. KEY and EKEY

4. Key and EKey

5. Interesting definition of "portable"

6. alt, shift, cntl key bind not-portable?

7. Exclude Nulls (in Key definition): what is Null?

8. dbaseIV Definition Keys

9. Partial field Key Definitions - ODBC

10. losing function key definitions after exec

11. IDLE-EKEY?

12. EKEY in gforth in DOS

 

 
Powered by phpBB® Forum Software