问题
Chapter 3 of Starting FORTH says,
Now that you've made a block "current", you can list it by simply typing the word
L
. UnlikeLIST
,L
does not want to be proceeded by a block number; instead it lists the current block.
When I run 180 LIST
, I get
Screen 180 not modified
0
...
15
ok
But when I run L
, I get an error
:30: Undefined word
>>>L<<<
Backtrace:
$7F0876E99A68 throw
$7F0876EAFDE0 no.extensions
$7F0876E99D28 interpreter-notfound1
What am I doing wrong?
回答1:
Yes, gForth supports an internal (BLOCK) editor. Start gforth
- type:
use blocked.fb
(a demo page) - type:
1 load
- type
editor
words
will show the editor words,s b n bx nx qx dl il f y r d i t 'par 'line 'rest c a m ok
type
0 l
to list screen 0 which describes the editor,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
Creating your own block file
To create your own new block file myblocks.fb
- type:
use blocked.fb
- type:
1 load
- type
editor
Then
- type
use myblocks.fb
1 load
will show BLOCK #1 (lines 0 till 15. 16 Lines of 64 characters each)1 t
will highlight line 1- Type
i this is text
to [i]nsert into line 1 - After the current BLOCK is edited type
flush
in order to write BLOCK #1 to the filemyblocks.fb
For more information see, gForth Blocks
回答2:
gforth is well integrated with emacs. In my xemacs here, by default any file called *.fs is considered FORTH source. "C-h m", as usual, gives the available commands.
回答3:
It turns out these are "Editor Commands" the book says,
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
I don't believe gforth supports an internal editor at all. So L
, T
, I
, P
, F
, E
, D
, R
are all presumably unsupported.
回答4:
No, GNU Forth doesn't have an internal editor; I use Vim :)
来源:https://stackoverflow.com/questions/48837115/does-gnu-forth-have-an-editor