18.10.2013 Views

V4N4 - Complang

V4N4 - Complang

V4N4 - Complang

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

QTF (continued from page 21)<br />

variables. (I used execution variables<br />

just to avoid confusing things).<br />

Using the Commands<br />

To enter the Editor, type the word<br />

n write<br />

where “n” is the number of the block<br />

you want to edit. If there’s anything in<br />

the block already, it will be typed out.<br />

Since our formatter application re-<br />

quires a continuous stream of text<br />

within each block (no embedded car-<br />

riage returns), the Editor decides<br />

where to end each line on the display<br />

- actually, the first occurrence of a<br />

blank after the 55th character on each<br />

line. (Remember, the Editor formats<br />

the contents of the screen differently<br />

than the formatter will display your<br />

text.)<br />

The cursor will appear just after the<br />

last character displayed, or, if the<br />

block is empty, at the home position.<br />

The number of characters in the block<br />

(the current “length”) will appear in<br />

the lower right hand corner.<br />

You can use the cursor movement<br />

keys to position the cursor to any<br />

character that actually exists in the<br />

block. You can move it backwards or<br />

up, but not forward or down (beyond<br />

the “length”), until you enter more<br />

text. If you move the cursor all the way<br />

back to the beginning of a line, it will<br />

then skip up to the end of the next line<br />

above - not to the 79th column, but<br />

to the blank space that follows the last<br />

word on the line. And you can only<br />

move the cursor forward as far as the<br />

last character in each line (the space),<br />

then it will drop to the beginning of<br />

the next line.<br />

While in command mode you can<br />

also get into Enter Mode, Replace<br />

Mode, or Delete Mode by pressing<br />

“e,” “r,” and “d” respectively.<br />

Table 1 shows all the commands that<br />

are available as keystrokes in Com-<br />

mand Mode.<br />

Enter Mode<br />

Press the “e” key while in Com-<br />

mand Mode to begin entering text.<br />

The words “ENTERING MODE” will<br />

appear in the upper right-hand corner.<br />

In this mode, all the alphanumeric<br />

keys on your keyboard will be con-<br />

sidered characters you want to enter,<br />

not commands.<br />

I’ve already discussed the Editor’s<br />

two approaches to the IIO problem in<br />

Enter mode. But with either approach<br />

the Editor’s wrap-around strategy ap-<br />

plies. This means you don’t press<br />

“return” at the end of each line; you<br />

just keep typing and the editor will<br />

worry about line breaks. Press return<br />

only when you want to get back to<br />

Command Mode.<br />

If you make a mistake while in Enter<br />

Mode, press the backspace key. You<br />

can even backspace past the beginning<br />

of a displayed line and up to the end<br />

of the previous line, just like with cur-<br />

sor movements.<br />

In either the Burst or Continuous<br />

versions of Enter Mode, you can<br />

backspace all the way back to the<br />

beginning of the block, thereby<br />

deleting all such text.<br />

As you enter text, make sure the<br />

length in the lower right hand corner<br />

doesn’t exceed 1024, or you’ll lose the<br />

end of your text. I recommend that<br />

you only fill blocks about 2/3 full, to<br />

leave room for later insertions.<br />

Delete Mode<br />

I’ve also covered Delete Mode in<br />

the discussion on the 110 alternatives<br />

earlier. For either version, just “X”<br />

over the string to be deleted. Press-<br />

ing the return key joins the parts<br />

of the text on either side of the de-<br />

letion.<br />

While in Delete Mode, the only valid<br />

keystrokes are “x,” upper case “X” for<br />

fast deletions, backspace and return.<br />

Any other key will emit a beep.<br />

A quick way to clear everything<br />

Table 2 Editor-related FORTH commands<br />

from the cursor to the end of the<br />

screen is the “cntrl-c” key. Since this<br />

is a dangerous command, it requires<br />

holding down the “control” key and<br />

the “c” simultaneously. You can clear<br />

the entire contents of a screen with the<br />

combination “a” “cntrl-c” (the “a” key<br />

homes the cursor to the beginning of<br />

the screen).<br />

Replace Mode<br />

Use this mode when you want to<br />

correct text without moving any text<br />

forward (as in insert) or backward (as<br />

in delete). For example, to change the<br />

word “most” to “many,” simply move<br />

the cursor to the “0,” then enter<br />

Replace Mode by typing “r.” Then<br />

type “any.” Be sure to hit “return”<br />

when you’re done replacing!<br />

The “Take” Command<br />

The ‘It” (for Take) key takes the<br />

string you just “x”ed out, and inserts<br />

it wherever the cursor is now. In com-<br />

bination with “x,” you can use this<br />

command to move any length of text<br />

from one place to another, even from<br />

one block to another. Use it to swap<br />

phrases, sentences, paragraphs, etc.<br />

You can also use “t” if you need<br />

multiple copies of the same string,<br />

without having to retype it each time.<br />

Just “x” out the string, then press “t”<br />

to take it back, then press “t” again to<br />

take a second copy, and again as many<br />

times as you need. This technique<br />

works because “x” saves the text that<br />

you delete in a buffer. The “t” com-<br />

mand copies whatever is in that buf-<br />

fer into your block.<br />

If you need to transfer a LOT of text<br />

from the end of one block to another<br />

block, or even copy an entire block,<br />

re-enters the Editor, using the block most recently displayed<br />

re-enters the Editor, using the next block<br />

re-enters the Editor, using one block back<br />

enters the Editor, displaying your document’s loadblock. When you press<br />

return to exit, Ib returns to the block you were originally editing. You must<br />

first identify your loadblock with the phrase n loadblock ! where “n” is the<br />

number of your loadblock.<br />

FORTH Dimensions 99 Volume IV, No. 4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!