Diff for /gforth/doc/gforth.ds between versions 1.180 and 1.181

version 1.180, 2007/06/09 15:55:44 version 1.181, 2007/06/16 20:19:38
Line 332  Other I/O Line 332  Other I/O
 * String Formats::              How Forth stores strings in memory  * String Formats::              How Forth stores strings in memory
 * Displaying characters and strings::  Other stuff  * Displaying characters and strings::  Other stuff
 * Terminal output::             Cursor positioning etc.  * Terminal output::             Cursor positioning etc.
 * Input::                       Input  * Single-key input::            
   * Line input and conversion::   
 * Pipes::                       How to create your own pipes  * Pipes::                       How to create your own pipes
 * Xchars and Unicode::          Non-ASCII characters  * Xchars and Unicode::          Non-ASCII characters
   
Line 7798  of @code{base}. Line 7799  of @code{base}.
 @end itemize  @end itemize
   
 You can read numbers into your programs with the words described in  You can read numbers into your programs with the words described in
 @ref{Input}.  @ref{Line input and conversion}.
   
 @node Interpret/Compile states, Interpreter Directives, Number Conversion, The Text Interpreter  @node Interpret/Compile states, Interpreter Directives, Number Conversion, The Text Interpreter
 @subsection Interpret/Compile states  @subsection Interpret/Compile states
Line 8725  doc-block-included Line 8726  doc-block-included
 * String Formats::              How Forth stores strings in memory  * String Formats::              How Forth stores strings in memory
 * Displaying characters and strings::  Other stuff  * Displaying characters and strings::  Other stuff
 * Terminal output::             Cursor positioning etc.  * Terminal output::             Cursor positioning etc.
 * Input::                       Input  * Single-key input::            
   * Line input and conversion::   
 * Pipes::                       How to create your own pipes  * Pipes::                       How to create your own pipes
 * Xchars and Unicode::          Non-ASCII characters  * Xchars and Unicode::          Non-ASCII characters
 @end menu  @end menu
Line 9021  definition of @code{my-char}. Line 9023  definition of @code{my-char}.
 @end itemize  @end itemize
   
   
 @node Terminal output, Input, Displaying characters and strings, Other I/O  @node Terminal output, Single-key input, Displaying characters and strings, Other I/O
 @subsection Terminal output  @subsection Terminal output
 @cindex output to terminal  @cindex output to terminal
 @cindex terminal output  @cindex terminal output
Line 9047  Note that on non-terminals you should us Line 9049  Note that on non-terminals you should us
 @code{page}, to get a form feed.  @code{page}, to get a form feed.
   
   
 @node Input, Pipes, Terminal output, Other I/O  @node Single-key input, Line input and conversion, Terminal output, Other I/O
 @subsection Input  @subsection Single-key input
 @cindex input  @cindex single-key input
 @cindex I/O - see input  @cindex input, single-key
 @cindex parsing a string  
   If you want to get a single printable character, you can use
 For ways of storing character strings in memory see @ref{String Formats}.  @code{key}; to check whether a character is available for @code{key},
   you can use @code{key?}.
 @comment TODO examples for >number >float accept key key? pad parse word refill  
 @comment then index them  
   
   
 doc-key  doc-key
 doc-key?  doc-key?
   
   If you want to process a mix of printable and non-printable
   characters, you can do that with @code{ekey} and friends.  @code{Ekey}
   produces a keyboard event that you have to convert into a character
   with @code{ekey>char} or into a key identifier with @code{ekey>fkey}.
   
   Typical code for using EKEY looks like this:
   
   @example
   ekey ekey>char if ( c )
     ... \ do something with the character
   else ekey>fkey if ( key-id )
     case
       k-up                                  of ... endof
       k-f1                                  of ... endof
       k-left k-shift-mask or k-ctrl-mask or of ... endof
       ...
     endcase
   else ( keyboard-event )
     drop \ just ignore an unknown keyboard event type
   then then
   @end example
   
 doc-ekey  doc-ekey
 doc-ekey>char  doc-ekey>char
   doc-ekey>fkey
 doc-ekey?  doc-ekey?
   
 Gforth recognizes various keys available on ANSI terminals (in MS-DOS  The key identifiers for cursor keys are:
 you need the ANSI.SYS driver to get that behaviour).  These are the  
 keyboard events produced by various common keys:  
   
 doc-k-left  doc-k-left
 doc-k-right  doc-k-right
Line 9080  doc-k-next Line 9101  doc-k-next
 doc-k-insert  doc-k-insert
 doc-k-delete  doc-k-delete
   
 The function keys (aka keypad keys) are:  The key identifiers for function keys (aka keypad keys) are:
   
 doc-k1  doc-k-f1
 doc-k2  doc-k-f2
 doc-k3  doc-k-f3
 doc-k4  doc-k-f4
 doc-k5  doc-k-f5
 doc-k6  doc-k-f6
 doc-k7  doc-k-f7
 doc-k8  doc-k-f8
 doc-k9  doc-k-f9
 doc-k10  doc-k-f10
 doc-k11  doc-k-f11
 doc-k12  doc-k-f12
   
 Note that K11 and K12 are not as widely available.  The shifted  Note that @code{k-f11} and @code{k-f12} are not as widely available.
 function keys are also not very widely available:  
   You can combine these key identifiers with masks for various shift keys:
 doc-s-k1  
 doc-s-k2  doc-k-shift-mask
 doc-s-k3  doc-k-ctrl-mask
 doc-s-k4  doc-k-alt-mask
 doc-s-k5  
 doc-s-k6  Note that, even if a Forth system has @code{ekey>fkey} and the key
 doc-s-k7  identifier words, the keys are not necessarily available or it may not
 doc-s-k8  necessarily be able to report all the keys and all the possible
 doc-s-k9  combinations with shift masks.  Therefore, write your programs in such
 doc-s-k10  a way that they are still useful even if the keys and key combinations
 doc-s-k11  cannot be pressed or are not recognized.
 doc-s-k12  
   Examples: Older keyboards often do not have an F11 and F12 key.  If
   you run Gforth in an xterm, the xterm catches a number of combinations
   (e.g., @key{Shift-Up}), and never passes it to Gforth.  Finally,
   Gforth currently does not recognize and report combinations with
   multiple shift keys (so the @key{shift-ctrl-left} case in the example
   above would never be entered).
   
   Gforth recognizes various keys available on ANSI terminals (in MS-DOS
   you need the ANSI.SYS driver to get that behaviour); it works by
   recognizing the escape sequences that ANSI terminals send when such a
   key is pressed.  If you have a terminal that sends other escape
   sequences, you will not get useful results on Gforth.  Other Forth
   systems may work in a different way.
   
   
   @node  Line input and conversion, Pipes, Single-key input, Other I/O
   @subsection Line input and conversion
   @cindex line input from terminal
   @cindex input, linewise from terminal
   @cindex convertin strings to numbers
   @cindex I/O - see input
   
   For ways of storing character strings in memory see @ref{String Formats}.
   
   @comment TODO examples for >number >float accept key key? pad parse word refill
   @comment then index them
   
 Words for inputting one line from the keyboard:  Words for inputting one line from the keyboard:
   
Line 9132  doc-expect Line 9179  doc-expect
 doc-span  doc-span
   
   
 @node Pipes, Xchars and Unicode, Input, Other I/O  @node Pipes, Xchars and Unicode, Line input and conversion, Other I/O
 @subsection Pipes  @subsection Pipes
 @cindex pipes, creating your own  @cindex pipes, creating your own
   

Removed from v.1.180  
changed lines
  Added in v.1.181


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>