Now type edit
.
You will see the source code to block 18 and the number 0018 will be displayed in a faint background watermark on the screen, indicating the block being viewed and edited. The editor control panel hint map is displayed in the lower right part of the screen.
The editor control panel hint map, displayed in the lower right part of the screen, is as follows:
"s" enter white comments all in the small font (Do not use, will go away!) "c" enter white comments with the first character in the small font and the rest in the big font (Do not use, will go away!) "t" enter white comment text in lower case only. "y" enter yellow text. "r" enter red word, then switch to green text. "g" enter green text. "x" toggle odd/even source/shadow code/comment blocks "c" cycle color white-yellow-green word before cursor "d" Start find-function based on word before cursor. If red or magenta, find reference.
If a number, edit that block. Otherwise, find definition. "f" repeat last 'find' "j" jump to last edited block "l" move cursor left "u" move cursor up (eight left) "d" move cursor down (eight right) "r" move cursor right "a" enter grey address word "b" enter blue word "k" copy (similar to "x" cut but does not delete the word) "-" decrement edited block number by two "m" enter magenta text (variables) "c" enter cyan text "+" increment edited block number by two "X" delete the current word (cut for paste) "." exit editor to Interpreter "i" insert word (paste from buffer)
e
or enter a new block number and type edit
. The editor may also be entered using the vocabulary for finding source, described later below.
The cursor resembles a pac-man character poised to munch the word to the left when the "X" (delete word) key is pressed. Strings of text can be cut by repeatedly pressing or holding the "X" key. The cursor can be moved to a different location on that block, or to a different block, and inserted with the "i" key.
Left, Up, Down, and Right keys under the fingers of the right hand move the cursor. The cursor cannot be moved above the top of the screen but it can be moved below the bottom of the screen. If the cursor is not visible hold down the Up key. It should always appear eventually.
"l" move cursor left "u" move cursor up (eight left) "d" move cursor down (eight right) "r" move cursor rightNote that the Up and Down keys do not make precise up and down movements and only move eight words to the left or right respectively if possible.
Words that have been deleted with the "X" key can be re-inserted with the "i" key after the cursor has been moved.
To return to the Editor from any text entry mode, use the method defined by the keyboard in use.
"s" In old systems, enter CAPITALIZED white comments. This feature has been deprecated, please do not use it. "c" In old systems, enter Camelcase white comments. This feature has been deprecated, please do not use it. "t" enter white comments in lower case.In current colorForth systems, decimal and hex numbers may be entered as comments; this facilitates the commenting of most compiled or interpretive code if desired.
When source is compressed using save
the deprecated tags for capitalized and Camelcase comments are converted to lower case comments.
Numbers can be entered in green or yellow mode. Numbers can be entered in decimal or hex mode. Hex numbers will appear in a darker green or darker yellow than decimal numbers, and may be italicized when the display medium permits.
If one intends to enter a number but enters a character string that resembles a number instead, it cannot be visually distinguished from a decimal number as it will be the same shade of yellow or green. But when you load the block unless you have actually defined a red word or magenta variable with a name that can be confused for a number, which is generally not a good idea in the first place, you will get a compiler error message that it did not recognize the string (that looked like a number) as a defined name.
There is a Forth wordlist and a macro wordlist in the colorForth compiler and the macro wordlist is searched first during compilation. Words in the macro wordlist act like "immediate" word in traditional Forth. Macros are executed at compile time when referenced in green. To compile a call to a macro, rather than to execute it at compile time, reference that macro with a cyan word.
if
are compiled, but because they are in the macro wordlist and act like immediate words, they are executed at compile time like words written explicitly in yellow.
A transition from green words to yellow words and back to green words is interpreted by the compiler as follows: The transition from green to yellow marks the transition from compilation mode to interpretation mode as would be indicated by the ANS Forth word "[" and the transition from yellow to green is interpreted by the compiler to mean a transition from interpretation mode to compile mode, and the compilation of a literal as would be indicated by the ANS Forth phrase "] LITERAL"
After entering a red word the editor will change the color of the text or numbers being entered into green because the red word is the name of the compiled, green code that follows.
When selecting magenta, and a magenta variable name is added to a block, a green number with the value 0 will be added after the magenta name. The magenta word when executed places the address of the location of the green number on that block on the parameter stack. One interesting feature of colorForth is that this address is in fact the address of a cell in the source, specifically the cell from which the green zero is being displayed. The variable, and its value, are part of the source and when you save the source you also save the values of variables! Display a block containing a variable and change the variable using the interpreter. You will see the green number in the source display change immediately! Note: colorForth has historically required that references to variables must always be in yellow; the code compiled for a green variable reference is incorrect. We have not gotten around to fixing this yet.
Cyan words are like postponed words in ANS Forth. A macro is executed immediately by the compiler when encountered as a green word. When a macro is referenced as a cyan word, the compiler does not execute the macro but compiles a call to it.
cr br indent
etc. or execute custom
commands while viewing a screen. The word seeb
on block
648 is "see blue" and when yellow will execute at boot time and
make blue words visible in the editor. If seeb
on block
648 is white then blue words will not be visible but will execute
when a block is displayed. After the system has booted, you may execute seeb
at any time to toggle the display of blue words on or off.
"k" copy (similar to "x" cut but does not delete the word) "X" delete the current word (cut for paste) "i" insert word (paste from buffer)Each depression of the cut or copy button pushes a copy of the word or number to the left of the cursor into this stack buffer, leaving the cursor to the left of where the word or number is (or was before it was deleted.) Each depression of the paste button pops the top word or number from this stack buffer and inserts it at the cursor position, moving the cursor to the right.
edit
as was described earlier. For local navigation the Editor supplies the following:
"x" toggle odd/even source/shadow code/comment blocks "j" jump to last edited block "-" decrement edited block number by two "+" increment edited block number by twoThe "j" key alternates between the last two blocks that you edited with the word
edit
. The traditional variable blk
contains the number of the current block being edited, and is unchanged when you exit the editor. blk 1 +
is the number of the block that was current the last time edit
was used. In addition to alternating the displayed block, the "j" key alternates these two values in blk
.
The "x" key toggles between odd and even blocks while editing. Even numbered blocks are intended for source code and odd numbered blocks, called shadows, are intended for documentation. Since odd numbered blocks are not normally compiled, red, yellow, green, cyan, or magenta words on those blocks are intended to be comments only and may be used as desired to enhance readability, with the understanding that shadow blocks are not normally loaded.
The "+" and "-" keys on the editor keyboard map move two blocks up or two blocks down. The editor will not decrement the block number to be edited below 18. More advanced navigation is supplied by the Search Utility; see below.
blk
. Then, exit the editor; put a destination source block number on the stack, and type copy
. The first block, and its accompanying shadow, will be copied to the destination.
If you want to edit the copied block just type e
as blk
will now be set to the number of the destination block.
find def from literal
.
When a search is started, we begin at block 18 (except in the case of from
) and scan forward looking for the particular target. If it is not found, we remain silently in the Interpreter. If it is found, we enter the Editor with the cursor set at (immediately to the right of) the target.
Once a search has been started, it may be continued from the point of the last target found by using the "f" control panel key, if in the Editor, or by typing f
in the Interpreter. In either case, a successful find will display a block, while a failure to find will be as though you had done nothing at all.
When continuation is begun using the word f
in the Interpreter, searching resumes at the point of last find in that same search. When continuing using the "f" control panel button in the Editor, the search resumes at the current cursor position in the current block, so you have more control in this case.
The searches continue up to the end of your disk image as defined by the three variables at the start of block 18. Do not attempt to change these variables at this point in your study!
The searches automatically consider only blocks of the same sort (source or shadow) as the block in which the search was started or continued. Thus, searches normally start with source only; they will never consider shadows unless you force them to using the word from
with an odd block number, or by using the Editor's "f" key while looking at a shadow. To search all shadows, start a search normally, then edit block 19 and use the Editor's "f" key to continue.
find
awaits a word from the keyboard and starts a new search for that word. It will find all instances of that word as a definition (red or magenta), reference (green, yellow, blue, or cyan), or any sort of comment.
def
awaits a word from the keyboard and starts a new search for that word, as a definition (red or magenta) only.
from
takes a number from the stack for use as starting block. It then awaits a word from the keyboard and starts a new search for that word, in any form as in find
using this starting block.
literal
takes a number from the stack and starts a new search for that value as a green or yellow number, matching its numerical value (regardless of whether displayed as decimal or as hex.)
f
continues the most recently started search immediately after the point at which the last target was found in that search.
Written by Jeff Fox and friends.