Diff for /gforth/ekey.fs between versions 1.6 and 1.11

version 1.6, 2002/06/02 10:31:28 version 1.11, 2004/12/31 13:23:57
Line 1 Line 1
 \ ekey etc.  \ ekey etc.
   
 \ Copyright (C) 1999 Free Software Foundation, Inc.  \ Copyright (C) 1999,2002,2003,2004 Free Software Foundation, Inc.
   
 \ This file is part of Gforth.  \ This file is part of Gforth.
   
Line 117  table constant esc-sequences \ and prefi Line 117  table constant esc-sequences \ and prefi
 create ekey-buffer 8 chars allot  create ekey-buffer 8 chars allot
 2variable ekey-buffered  2variable ekey-buffered
   
 27 constant #esc  [IFUNDEF] #esc  27 Constant #esc  [THEN]
   
 : esc-prefix ( -- u )  : esc-prefix ( -- u )
     key? if      key? if
Line 211  set-current Line 211  set-current
 : ekey>char ( u -- u false | c true ) \ facility-ext e-key-to-char  : ekey>char ( u -- u false | c true ) \ facility-ext e-key-to-char
     dup 256 u< ;      dup 256 u< ;
   
 : esc? ( -- flag ) recursive  ' key? alias ekey? ( -- flag )
     key? 0=  
     if  
         false exit  
     then  
     key ekey-buffered char-append-buffer  
     ekey-buffered 2@ esc-sequences search-wordlist  
     if  
         ['] esc-prefix =  
         if  
             esc? exit  
         then  
     then  
     true ;  
   
 : ekey? ( -- flag ) \ facility-ext e-key-question  \  : esc? ( -- flag ) recursive
     \G Return @code{true} if a keyboard event is available (use  \      key? 0=
     \G @code{ekey} to receive the event), @code{false} otherwise.  \      if
     key?  \       false exit
     if  \      then
         key dup #esc =  \      key ekey-buffered char-append-buffer
         if  \      ekey-buffered 2@ esc-sequences search-wordlist
             clear-ekey-buffer esc?  \      if
             ekey-buffered 2@ unkeys  \       ['] esc-prefix =
         else  \       if
             true  \           esc? exit
         then  \       then
         swap unkey  \      then
     else  \      true ;
         false  
     then ;  \  : ekey? ( -- flag ) \ facility-ext e-key-question
   \      \G Return @code{true} if a keyboard event is available (use
   \      \G @code{ekey} to receive the event), @code{false} otherwise.
   \      key?
   \      if
   \       key dup #esc =
   \       if
   \           clear-ekey-buffer esc?
   \           ekey-buffered 2@ unkeys
   \       else
   \           true
   \       then
   \       swap unkey
   \      else
   \       false
   \      then ;
   
 \ : test-ekey?  \ : test-ekey?
 \     begin  \     begin

Removed from v.1.6  
changed lines
  Added in v.1.11


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