home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / FFB.ZIP / FFUTILS.ARC / ZIMMER.ARC / FUNKEY.SEQ < prev    next >
Encoding:
Text File  |  1988-01-11  |  1.9 KB  |  63 lines

  1. \ FUNKEY.SEQ    Function key functions                  by Tom Zimmer
  2.  
  3. ?dark
  4. .comment:
  5.   This file allows assigning functions to the keys F1 through F10.
  6.  
  7.   The following sequence will assign the F9 and F10 keys to perform
  8. the Forth functions B (Back screen), and N (Next screen):
  9.  
  10.          9 FN! B <enter>
  11.         10 FN! N <enter>
  12.  
  13.   After the above commands have been entered, you may press F9 when you
  14. want to display the previous screen in the current file, and F10 to
  15. display the next screen in the current file.
  16.  
  17.   The word .FN will display a list of the current function key
  18. assignments.
  19.  
  20.   The words FUNON and FUNOFF will enable and disable the function keys
  21. temporarily when their operation is not desired.
  22.  
  23. comment;
  24.  
  25.  
  26. create f#funcs ' noop dup , dup , dup , dup , dup ,
  27.                       dup , dup , dup , dup ,     ,
  28.  
  29. variable funflg         funflg off
  30.  
  31. : funon         funflg on ;
  32. : funoff        funflg off ;
  33.  
  34. : funkey        ( --- c1 )
  35.                 funflg @
  36.                 if      begin   udefers key dup 187 dup 9 + between
  37.                                 if      187 - 2* f#funcs + perform
  38.                                         0
  39.                                 else    true
  40.                                 then
  41.                         until
  42.                 else    udefers key
  43.                 then    ;
  44.  
  45. ' funkey is key
  46.  
  47. : fn!           ( n1 | name --- )
  48.                 1 max 10 min 1- 2* f#funcs + ' swap ! ;
  49.  
  50. : .fn           ( --- )
  51.                 cr ." Function key assignments, Functions are "
  52.                 funflg @ if ." ENABLED" else ." DISABLED" then
  53.                 f#funcs 10 0
  54.                 do      dup cr i 1+
  55.                         0 <# #s ascii F hold #> 8 over - spaces type ."  = "
  56.                         i 2* + @ >name .id
  57.                 loop    drop ;
  58.  
  59.  9 fn! B        \ define Function keys F9 and F10 to be B and N.
  60. 10 fn! N
  61. funon           \ Enable function keys
  62.  
  63.