• Keine Ergebnisse gefunden

UPDATING DOCUMENT FORMAT PACKETS

Im Dokument Cat Editor (Seite 180-186)

B. O GENERAL DISCUSSION

9. DOCUMENT COMMANDS

9.2 UPDATING DOCUMENT FORMAT PACKETS

The word redoc can be used to integrate document format information specified by the Setup command into all document format packets contained within the current selection range.

9. 3 ROUTINES SUMMARY

9.3.0

Locked Document Routines

Doc lock - )

pronounced dahk' lahk )

Locks or unlocks all documents contained within the current selection, or which contain the current selection. Currently only whole document(s) may be locked/unlocked. DocLock's first action is to define the range of text to be locked/unlocked. The document format packet is encountered, getdpkt reads its contents into the #ctr1 array and the current value of its #lock field is

lockedtext? ( a -) f )

( pronounced lahkt' tekst kwes'chun ) Uses findchar to read the control/format information for the character at address ~ into the #ctrl array. Then checks the contents of the %lock field to see if the character lies in a region of locked text. If the text is locked, a true flag is returned.

undoclock - )

pronounced un I dahk lahk )

The undo operation for DocLock. undoclock's first action is to define the range of text to be locked/unlocked. The first

document separator located before the start of the selection will be used as the start of the locked/unlocked range and the first document separator located after the end of the selection will be used as the end of the locked/unlocked range.

Now undoclock may begin the locking/unlocking process.

undoclock steps through the range looking for all occurrences of Calc packets and document format packets. If a document format packet is encountered, the previous value of the packet's #lock field is obtained from the undo buffer and sets a local

lock/unlock flag.

getdpkt reads the packet contents into the #ctr1 array and the current value of its #lock field is stored in the undo buffer. Then, the #lock value is changed to either 10k (if the document is being locked) or markbl (if the document is being unlocked), and makedpkt writes out the changed document format packet.

If a Calc packet is to be locked, a &lockedcalc token will be placed in the packet. Otherwise, a &calc token will be placed in the packet.

After all Calc and document format packets have been properly updated, the undo operation is set to undoclock, all intervals which correspond to the affected range are marked as changed, the display is redrawn to show or hide the lock bars.

and the text is marked as dirty.

Local Leap Routines

adjustleaprange ( -)

( pronounced a-just' leep raynj

Shrinks the allowable leap range according to the current selection. The start of the leap range is set to the first document break before the start of the selection; the end of the leap range is set to the first document break after the end of the selection.

checklocallight -)

pronounced chek lo'kil lyte )

Checks the current leap range and sets the LOCAL indicator light accordingly. If leaping over the entire text range is currently possible (bor bot

=

eor eot

=

and), the LOCAL indicator is turned off. Otherwise, the "LOCAL" string is displayed in the indicator.

local/global - )

pronounced lo'kil slash glo'bil )

Toggles between local and global leaping. The current bor and eor values are saved in the undo buffer. The undo operation is set to undolocal/global. If the leap range is currently fully expanded, or if this is the first use of local/global in a

prerecorded Learn sequence, then adjustleaprange shrinks the leap area to the smallest allowable leap range which contains the current selection. Otherwise, the leap r8J'f-Te is fully expanded by setting bor bot

=

and eor eot

=.

The o~ and pop values are adjusted to fall within the new local leap area, checklocallight handles the LOCAL indicator light. and the text is marked as dirty.

undolocal/global -)

pronounced un-doo' lo'kil slash glo'bil ) Undo operation for local/global. The current bor and eor values are swapped with the bar and eor values saved in the undo buffer, the op and pop values are adjusted to fit within the new leap range, checklocallight handles the LOCAL indicator light, and the text is marked as dirty.

9.3.1 Document Format Packet Update Ro~'tines

findds a1 a2 -) a3-or-O

pronounced fynd' dee ess

Searches through the range of text which starts at address a1 and ends at address a2 for the first occurrence of a document

separator character. If a document separator character is found in the specified text range, its address, ~, is returned.

Otherwise, a 0 is returned. Used by redoc.

redoc - )

pronounced reel dahk )

Updates all document format packets in the current selection.

For each document format packet encountered, getdpkt places its current document state information into the #ctrl array and then getdocpkt updates the document state information with values from the set-up version of the document format information. makedpkt writes the updated document information in the #ctrl array back over the original format packet. After all document format packets have been updated, the affected intervals are marked as changed and the text is redisplayed.

10. LEAP

Introduction

The leap mechanism, which makes use of the two Leap keys (Leap Forward and Leap Backward), performs six basic operations:

1. Cursor placement (leaping from place to place in the text) 2. Display scrolling (using Shift-Leap)

3.

Creeping (tapping a Leap key to move the cursor forward or backward character-by-character)

4.

Spell Check Leap (pressing Undo while holding a Leap key down)

5.

Text selection (press both Leap keys to select)

6. Text movement (dragging)

Three of these operations are repeatable: Leap (Leap Again appears on the fronts of the Lea;> keys), Scrc .. l, and Spell Check Leap.

The routines used to implement the leap mechanism are primarily text search routines. In order to place the cursor at the

string-specified location in the text, the Leap routines must be able to find the strings in the text which match the user's leap string. An optimized text string search algorithm called the Boyer-Moore algori thm is used by t~:, "eap search rou tines to achieve maximum Leap performance.

Im Dokument Cat Editor (Seite 180-186)