16.8 String editing commands. 4tH 4tH Forth compiler
광고
광고
CHAPTER 16. EDITOR MANUAL
16.7
Commands to position the cursor
n M n W
TOP
354
Move the cursor by n characters and the cursor line. The position of the cursor on its line is shown by a ^ (caret).
Wipe n characters to the left of the cursor.
Position the cursor at the start of the screen.
16.8
String editing commands
B
C text
F text
N
TlLL text
X text
Used after F to back up the cursor by the length of the most recent text.
Copy in text to the cursor line at the cursor position.
Search forward from the current cursor position until string ’text’ is found. The cursor is left at the end of the string and the cursor line printed. If the string is not found an error message is given and the cursor repositioned to the top of the screen.
Find the next occurrence of the string found by an F command
Delete on the cursor line from the cursor till the end of string text.
Find and delete the next occurrence of the string ’text’.
16.9
Saving and exiting
WRITE
WQ
Saves the current contents of all screens to the block-file. No flushing is done.
Flushes the current screen and saves the current contents of all screens to the block-file.
Q Quits the editor without saving.
EXPORT name Saves the current contents of all screens to the text-file with the name
’name’. No flushing is done.
16.10
Calculator mode
The calculator mode is a simulation of what is known as the "Forth calculator mode". You can use it to try out a host of 4tH words in interactive mode. It also serves nicely as a deskcalculator. You can freely mix editor and calculator commands.
We tried to include as many 4tH words as possible, although we had to modify some due to the limitations imposed by the system. There are eight pre-defined user-variables called
"A." though "H.". You can use these variables like any other user-variable.
You cannot declare new variables or make any colon-definitions in interactive mode. If you are unclear how to use the built-in calculator please refer to the Primer and the Glossary.
By convention, calculator mode uses "OK" as the prompt. The following table shows you which commands are available:
CHAPTER 16. EDITOR MANUAL
E
DITOR
4
T
H
EQUIVALENT
E
DITOR
.
.r
drop dup rot swap over
A.
B.
-
*
+ th
/ q quit bye
-
*
+ th
/ quit quit quit
.
.r
drop dup rot swap over variable a. a.
variable b. b.
G.
H.
!
+!
C.
D.
E.
F.
variable c. c.
variable d. d.
variable e. e.
variable f. f.
variable g. g.
variable h. h.
!
+!
( <string>) ( <string>) cr cr time char time char
[char] emit
[char] emit
4
T
H
EQUIVALENT rshift depth cells
1+ cell+
1cellspace spaces
2*
2/
/mod
*/
*/mod abs negate invert min max or and xor lshift
@
?
base!
decimal
@
?
base !
decimal octal binary octal
2 base !
.( <string>) .( <string>) mod mod abs negate invert min max or and xor lshift rshift depth cells
1+ cell+
1cellspace spaces
2*
2/
/mod
*/
*/mod
Table 16.2: DC commands
355
다운로드
광고