home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / command.seq < prev    next >
Encoding:
Text File  |  1987-12-04  |  934 b   |  30 lines

  1. \ COMMAND.SEQ   Allow Forth commands to be entered      by Tom Zimmer
  2.  
  3. comment:
  4.  
  5.   Allows Forth commands to be entered while within a program, without
  6. destroying the current program environment.
  7.  
  8.   COMMAND will provide a Forth interpreter while in a program.
  9.  
  10.   Press Enter on an empty line to return when you are done entering
  11. commands.
  12.  
  13.   Use RET to return if you enter a typing error in the command line.
  14.  
  15. comment;
  16.  
  17. : ret           ( --- )
  18.                 sp0 @ 80 + @ 12345 - abort" Not COMMAND nested."
  19.                 sp0 @ 160 + sp!
  20.                 SP0 ! rp0 ! rp! >IN !   DUP SPAN ! #TIB ! 'tib ! ;
  21.  
  22. : COMMAND       ( --- )
  23.                 'TIB @ SPAN @ >IN @ rp@ rp0 @ SP0 @
  24.                 sp@ dup rp0 ! dup rp! 160 - dup 'tib ! dup sp0 ! sp!
  25.                 12345 sp0 @ 80 + !
  26.                 BEGIN   CR .S ." ->" QUERY #TIB @
  27.                 WHILE   INTERPRET
  28.                 REPEAT  ret ;
  29.  
  30.