GNU FORTH 有编辑器吗?

Does GNU FORTH have an editor?

Starting FORTH 的第 3 章说,

Now that you've made a block "current", you can list it by simply typing the word L. Unlike LIST, L does not want to be proceeded by a block number; instead it lists the current block.

当我运行180 LIST时,我得到

Screen 180 not modified     
0                                                                 
...                                                             
15                                                                 
 ok

但是当我运行L时,我得到一个错误

:30: Undefined word
>>>L<<<
Backtrace:
F0876E99A68 throw 
F0876EAFDE0 no.extensions 
F0876E99D28 interpreter-notfound1 

我做错了什么?

原来这些是"Editor Commands"书上说的,

For Those Whose EDITOR Doesn't Follow These Rules

The FORTH-79 Standard does not specify editor commands. Your system may use a different editor; if so, check your systems documentation

我认为 gforth 根本不支持内部编辑器。所以LTIPFEDR都是大概不受支持。

不,GNU Forth 没有内部编辑器;我用 Vim :)

gforth 与 emacs 很好地集成在一起。在我的 xemacs 中,默认情况下,任何名为 *.fs 的文件都被视为 FORTH 源。 "C-h m",像往常一样,给出可用的命令。

是的,gForth 支持内部 (BLOCK) 编辑器。开始前进

  1. 类型:use blocked.fb(演示页面)
  2. 类型:1 load
  3. 输入editor
  4. words会显示编辑器字样,

    s b n bx nx qx dl il f y r d i t 'par 'line 'rest c a m  ok
    
  5. 键入 0 l 以列出描述编辑器的屏幕 0,

    Screen 0 not modified     
     0 \ some comments on this simple editor                 29aug95py
     1 m marks current position        a goes to marked position       
     2 c moves cursor by n chars       t goes to line n and inserts    
     3 i inserts                       d deletes marked area           
     4 r replaces marked area          f search and mark               
     5 il insert a line                dl delete a line                
     6 qx gives a quick index          nx gives next index             
     7 bx gives previous index                                         
     8 n goes to next screen           b goes to previous screen       
     9 l goes to screen n              v goes to current screen        
    10 s searches until screen n       y yank deleted string           
    11                                                                 
    12 Syntax and implementation style a la PolyFORTH                  
    13 If you don't like it, write a block editor mode for Emacs!      
    14                                                                 
    15                                                                 
     ok
    

创建您自己的块文件

创建您自己的新块文件myblocks.fb

  1. 类型:use blocked.fb
  2. 类型:1 load
  3. 输入editor

然后

  1. 输入use myblocks.fb
  2. 1 load 将显示 BLOCK #1(第 0 行到第 15 行。16 行,每行 64 个字符)
  3. 1 t 将突出显示第 1 行
  4. 键入 i this is text 以 [i] 插入第 1 行
  5. 编辑当前块后键入 flush 以便将块 #1 写入文件 myblocks.fb

有关详细信息,请参阅 gForth Blocks