home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / funkey.seq < prev    next >
Encoding:
Text File  |  1988-09-22  |  2.2 KB  |  73 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. comment:
  26.  
  27.         !!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  28.  
  29.         Function keys WILL interfere with the editor, or any program that
  30.         uses function keys for other things. BE SURE to do a FUNOFF before
  31.         starting the editor.
  32.  
  33. comment;
  34.  
  35.  
  36. create f#funcs ' noop dup , dup , dup , dup , dup ,
  37.                       dup , dup , dup , dup ,     ,
  38.  
  39. variable funflg         funflg off
  40.  
  41. : funon         funflg on ;
  42. : funoff        funflg off ;
  43.  
  44. : funkey        ( --- c1 )
  45.                 funflg @
  46.                 if      begin   defers key dup 187 dup 9 + between
  47.                                 if      187 - 2* f#funcs + perform
  48.                                         0
  49.                                 else    true
  50.                                 then
  51.                         until
  52.                 else    defers key
  53.                 then    ;
  54.  
  55. ' funkey is key
  56.  
  57. : fn!           ( n1 | name --- )
  58.                 1 max 10 min 1- 2* f#funcs + ' swap ! ;
  59.  
  60. : .fn           ( --- )
  61.                 cr ." Function key assignments, Functions are "
  62.                 funflg @ if ." ENABLED" else ." DISABLED" then
  63.                 f#funcs 10 0
  64.                 do      dup cr i 1+
  65.                         0 <# #s ascii F hold #> 8 over - spaces type ."  = "
  66.                         i 2* + @ >name .id
  67.                 loop    drop ;
  68.  
  69.  9 fn! B        \ define Function keys F9 and F10 to be B and N.
  70. 10 fn! N
  71. funon           \ Enable function keys
  72.  
  73.