14th(1) General Commands Manual 4th(1)
2
3
4
6 4th - a portable Forth compiler supporting a (modified) subset of
7 ANS-Forth
8
10 4th [options] [file] [file | argument .. argument]
11
12 4thx [file] [argument .. argument]
13
15 4th is a menudriven bytecode compiler, virtual machine, decompiler,
16 line editor, RPN calculator and C-source generator rolled into one
17 small program. You can use it to create portable bytecode programs,
18 standalone executables or as a scripting language or a Forth-to-C
19 translator. For details read the manual.
20
22 m enter interactive mode
23
24 e edit a 4tH screenfile
25
26 c load a sourcefile (.4th) and compile it
27
28 l load an objectfile (.hx)
29
30 d decompile a 4tH program
31
32 g generate a C sourcefile (default: out.c)
33
34 s save a 4tH program (default: out.hx)
35
36 x execute a 4tH program
37
38 v enter verbose mode
39
40 q suppress copyright message
41
43 n D Delete line n but hold it in PAD. Line 15 becomes free as all
44 statements move up 1 line.
45
46 n E Erase line n with blanks.
47
48 n I Insert the text from PAD at line n, moving the old line n and
49 following lines down. Line 15 is lost.
50
51 n H Hold line n at PAD (used by system more often than by user).
52
53 n R Replace line n with the text in PAD.
54
55 n S Spread at line n. Line n and following lines move down 1 line.
56 Line n becomes blank. Line 15 is lost.
57
58 n T Display line n and copy it to PAD.
59
60 n P text
61 Put 'text' at line n, overwriting its previous contents.
62
63 n LIST List screen n and select it for editing: if screen n is not the
64 current screen, it will request to load from memory.
65
66 n CLEAR
67 Clear screen n with blanks and select it for editing.
68
69 n INSERT
70 Insert screen n. The current screen n and all screens following
71 it are moved down. The last screen is lost. Clear screen n with
72 blanks and select it for editing. FLUSH Used at the end of an
73 editing session to save the current screen to memory.
74
75 UNDO Used to reload the current screen again, thus undoing all
76 changes since the last flush (triggered by CLEAR, FLUSH or
77 LIST).
78
79 FLUSH Write updated screen to memory.
80
81 L List the current screen. The cursor line is relisted after the
82 screen listing to show the cursor position.
83
84 n M Move the cursor by n characters and the cursor line. The posi‐
85 tion of the cursor on its line is shown by a ^ (caret).
86
87 n W Wipe n characters to the left of the cursor.
88
89 TOP Position the cursor at the start of the screen.
90
91 B Used after F to back up the cursor by the length of the most
92 recent text.
93
94 C text Copy in text to the cursor line at the cursor position.
95
96 F text Search forward from the current cursor position until string
97 'text' is found. The cursor is left at the end of the string and
98 the cursor line printed. If the string is not found an error
99 message is given and the cursor repositioned to the top of the
100 screen.
101
102 N Find the next occurrence of the string found by an F command
103
104 TILL text
105 Delete on the cursor line from the cursor till the end of string
106 text.
107
108 X text Find and delete the next occurrence of the string 'text'.
109
110 EXPORT file
111 Saves the current contents of all screens to text-file 'file'.
112 No flushing is done.
113
114 WRITE Saves the current contents of all screens to the block-file. No
115 flushing is done.
116
117 WQ Flushes the current screen and saves the current contents of all
118 screens to the block-file.
119
120 Q Quits the editor without saving.
121
123 *.4th; text files containing 4tH source (script)
124 *.scr; block files containing 4tH source (script)
125 *.hx; Hcode eXecutables (bytecode)
126 *.c; C source files
127
129 DIR4TH If non-null the full pathname (including the trailing slash) for
130 the 4tH root directory. Used only by the compiler.
131
133 To compile a 4tH program and save the object code:
134
135 4th csv source.4th [object.hx]
136
137 To compile a 4tH program and execute it:
138
139 4th cx source.4th
140
141 To decompile object code:
142
143 4th ld object.hx
144
145 To convert object code to C source:
146
147 4th lg object.hx [source.c]
148
149 To load and execute object code:
150
151 4th lx object.hx [arguments]
152
153 To load and execute object code without arguments:
154
155 4th object.hx
156
157 To edit a 4tH screenfile:
158
159 4th e source.scr
160
161 To enter interactive mode:
162
163 4th m source.scr
164
165 To enter interactive mode (without a screenfile):
166
167 4th
168
170 4tH was written by Hans Bezemer <the.beez.speaks@gmail.com>
171
173 gforth(1)
174
175
176
177Hans Bezemer 3.61.2 4th(1)