next up previous index
Next: SysFailMgr Up: Chapter 4: Modifications to Previous: Chapter 4: Modifications to   Index

TextTools Replacement

The changes to the TextTools have turned it into a much more powerful general I/O manager. The TextTools now intrinsically handle pipes and redirection, and you can install custom drivers for TextTools to use. Also, the TextTools have had their old slot-dependence removed; the parameter that used to refer to 'slot' in the original texttools calls now refers to a driver number. A summary of driver numbers (including those that come pre-installed into GNO) are as follows:

0 null device driver
1 serial driver (for printer port compatibility)
2 serial driver (for modem port compatibility)
3 console driver (Pascal-compatible 80-column text screen)
4-5 user installed

See Chapter 3 GNO/ME Character Devices, for information on configuring these drivers.

There are also new device types in the TextTools; the complete list of supported device types and what their slotNum's (from SetInputDevice, SetOutputDevice, etc) mean is as follows:

Type
Use
slotNum

0

Used to be BASIC text drivers. These are no longer supported under GNO/ME, and setting I/O to a BASIC driver actually selects a Pascal driver.
Not applicable.
1
Pascal text driver. This is one of the drivers specified in /etc/ttys or built-in to GNO/ME.
Driver number as listed above.
2
RAM-based Driver (documented in ToolBox Reference Volume 2)
Pointer to the RAM-based driver's jump table.
3
File redirection
refNum (file descriptor) of the file to access through TextTools.

The new console driver supports all the features of the old 80-column Pascal firmware, and adds a few extensions, with one exception -- the codes that switched between 40 and 80 columns modes are not supported. It is not compatible with the GS/OS ``.console'' driver. The control codes supported are as follows:

Hex ASCII Action
01 CTRL-A Set cursor to flashing block
02 CTRL-B Set cursor to flashing underscore
03 CTRL-C Begin ``Set Text Window'' sequence
05 CTRL-E Cursor on
06 CTRL-F Cursor off
07 CTRL-G Perform FlexBeep
08 CTRL-H Move left one character
09 CTRL-I Tab
0A CTRL-J Move down a line
0B CTRL-K Clear to EOP (end of screen)
0C CTRL-L Clear screen, home cursor
0D CTRL-M Move cursor to left edge of line
0E CTRL-N Normal text
0F CTRL-O Inverse text
11 CTRL-Q Insert a blank line at the current cursor position
12 CTRL-R Delete the line at the current cursor position.
15 CTRL-U Move cursor right one character
16 CTRL-V Scroll display down one line
17 CTRL-W Scroll display up one line
18 CTRL-X Normal text, mousetext off
19 CTRL-Y Home cursor
1A CTRL-Z Clear entire line
1B CTRL-[ MouseText on
1C CTRL-\ Move cursor one character to the right
1D CTRL-] Clear to end of line
1E CTRL-^ Goto XY
1F CTRL-_ Move up one line

(Note: the Apple IIgs Firmware Reference incorrectly has codes 05 and 06 reversed. The codes listed here are correct for both GNO/ME and the Apple IIgs 80-column firmware.)

FlexBeep is a custom beep routine that doesn't turn off interrupts for the duration of the noise as does the default Apple IIgs beep. This means that the beep could sound funny from time to time, but it allows other processes to keep running. We also added two control codes to control what kind of cursor is used. There are two types available as in most text-based software; they are underscore for 'insert' mode, and block for 'overstrike'. You may, of course, use whichever cursor you like. For example, a communications program won't have need of insert mode, so it can leave the choice up to the user.

The Set Text Window sequence (begun by a $03 code) works as follows:

    CTRL-C '[' LEFT RIGHT TOP BOTTOM

CTRL-C is of course hex $03, and '[' is the open bracket character ($5B). TOP, BOTTOM, LEFT, and RIGHT are single-byte ASCII values that represent the margin settings. Values for TOP and BOTTOM range from 0 to 23; LEFT and RIGHT range from 0 to 79. TOP must be numerically less than BOTTOM; LEFT must be less than RIGHT. Any impossible settings are ignored, and defaults are used instead. The extra '[' in the sequence helps prevent the screen from becoming confused in the event that random data is printed to the screen.

After a successful Set Text Window sequence, only the portion of the screen inside the 'window' will be accessible, and only the window will scroll; any text outside the window is not affected.

The cursor blinks at a rate defined by the Control Panel/Options/Cursor Flash setting. Far left is no blinking (solid), and far right is extremely fast blinking.

ReadLine ($240C) now sports a complete line editor unlike the old TextTools version. Following is a list of the editor commands.

EOL Terminates input (EOL is a parameter to the _ReadLine call).
LEFT-ARROW Move cursor to the left.
RIGHT-ARROW Move cursor to right. It won't go past rightmost character.
DELETE Delete the character to the left of the cursor.
CTRL-D Delete character under the cursor.
OA-D Delete character under the cursor.
OA-E Toggles between overwrite and insert mode.

ReadChar ($220C) has also been changed. The character returned may now contain the key modification flags ($C025) in the upper byte and the character typed in the lower byte. This is still compatible with the old TextTools ReadChar. To get the keyMod flags, call SetInGlobals ($090C) and set the upper byte of the AND mask to $FF. Typical parameters for SetInGlobals to get this information are: ANDmask = $FF7F, ORmask = $0000.

The default I/O masks have also been changed. They are now ANDmask = $00FF, ORmask = $0000. They are set this way to extend the range of data that can be sent through TextTools. GNO/ME Character drivers do not, like the previous TextTools driver, require the hi-bit to be set.

The new TextTools are completely reentrant. This means that any number of processes may be executing TextTools calls at the same time, increasing system performance somewhat. The TextTools are also the only toolset which is not mutexed.

The GNO/ME console driver also supports flow-control in the form of Control-S and Control-Q. Control-S is used to stop screen output, and Control-Q is used to resume screen output.


next up previous index
Next: SysFailMgr Up: Chapter 4: Modifications to Previous: Chapter 4: Modifications to   Index
Feedback