Text Editor


Crossbow Documents
Opening Documents
Closing Documents
Saving Documents
Sharing DOS Documents
Comparing Documents
Document Information 
Printing
Edit Menu
Search Menu
Search Options
Multiple File Searches
Field Searches
Grep Searches
Patterns
Special Characters
Managing Windows


Crossbow Documents

Crossbow's editor is a text-only programmer's editor which operates on characters contained in document windows. Crossbow can manage up to eight open document windows, each having a Close Box, Title Bar, Zoom Box, Vertical Scroll Bar, Horizontal Scroll Bar, and Size Box with behaviors typical of a Macintosh program.

The remainder of the document window contains the text to be edited. Characters are typed into the edit window in front of the Insertion Point which shows up on the window as a flashing vertical bar. The Backspace key (delete on some keyboards) erases characters to the left of the insertion point. Set the insertion point, position the text using the scroll bars, then click the mouse at the desired spot to start editing.

Because Crossbow's editor is a programmer's editor, lines of text do not automatically wrap around to the next line at the edge of the edit window. You must use the return key to start a new line. Text displayed in Crossbow edit windows uses a custom version of 9 point Monaco with some characters modified to remove ambiguities (zero and upper case 'O', upper case 'I' and lower case 'l'). When Crossbow windows are first opened, they are sized to display exactly 80 characters on a line, a standard for assembly language programs.


Opening Documents

Crossbow edit windows are opened either directly, by launching from a document icon or choosing New or Open from the File menu, or indirectly, by matching a string in a multi-file search, encountering an error during assembly, or requesting listing or symbol table windows from an assembly.

Opening a Crossbow document from the Finder launches Crossbow with the selected document in an edit window directly behind the programs splash screen. The splash screen contains version and copyright information and disappears automatically after a few seconds. You may click the mouse button, or hit a key to dispose of it immediately.

Choosing New from Crossbow's File menu creates a new untitled window. Choosing Open from the File menu opens a file selection dialog displaying a list of all the 'TEXT' documents (described below) available in the currently selected folder.


Closing Documents

Crossbow has menu and mouse commands for closing one or all of the open edit windows. Clicking the close box or choosing Close from the File menu closes the front edit window. Holding down the option key while clicking a close box, choosing Close All Edit Windows from the Windows menu, or choosing Quit from File menu closes all of the open edit windows.

In closing single or multiple windows, those which have had changes since the last save will cause Crossbow to present a dialog box offering the option of saving the changes before closing, discarding the changes, or canceling the close.


Saving Documents

Crossbow has four menu commands for saving documents and an assembly option selection for auto-saving documents before an assembly. Files saved by any method from within Crossbow are saved as 'TEXT' documents and inherit the Crossbow document icon.

Crossbow's File menu contains three different document saving commands and a revert command to discard changes made since the last save. The Save command is disabled (gray) when a document is newly created or opened, and after changes are saved, and becomes enabled when changes are made to the document.

Choosing Save writes to disk any changes made to the document using the file name in the document window's title bar. New documents with the name "Untitled-X" cause an automatic invocation of Save As described below.

Choosing Save As opens a dialog box displaying a list of files and folders and a text entry box containing the current name of the document. After selecting the appropriate name and destination and clicking Save, the edit window's title will change to reflect the new document name.

Selecting a range of text in the front edit window enables the Save Selection As command which operates as described for Save As, but limits the amount of text saved to the characters that are currently selected. The default document name in the save dialog becomes the window title suffixed with the current date and time. Save Selection As does not affect the current document title or destination.

Revert discards any changes made to an edit window since the last save, after confirming the revert command with an alert box. To keep both versions, choose Save As with a different document name and reopen the old document with the original name.


Sharing DOS Documents

Crossbow has some built-in features to make it easier to share source files which must assemble on both Macintosh and PC platforms. Crossbow always automatically strips out the DOS linefeeds which appear as square boxes at the beginning of lines in some text editors. When you open a DOS file in crossbow, then save it with changes, the linefeeds are gone.

To force Crossbow to reinsert the linefeeds when saving, you have to follow the DOS file naming convention, which up to eight alpha-numeric filename characters, followed by up to three alpha-numeric extension characters. In addition, for Crossbow to insert the linefeeds, all alphabetical characters in the filename must be in upper case.


Comparing Documents

The Compare Windows command tries to re-synchronize to the next matching block after finding a mismatch. Crossbow considers text to be re-synchronized after 32 consecutive characters from both files match. After selecting Compare Windows, each window will have the mismatching characters selected. To view differences quickly, choose side-by-side from the Windows menu, the command-M to find the difference, then choose shift-command-M to toggle the active window and see the selection range.


Document Information

From the File menu, choose Get Info to display the number of lines, number of characters, and the free space available for editing. Get Info also allows you to lock a file to prevent accidental changes to files.


Printing Documents

The File menu contains three commands that deal with printing documents. Each printed page contains a boldface two line header showing the documents name, page number and date all separated from the body of the text by one blank line.

Document Name                            Page 1
Tuesday, November 15, 1988 2:15pm
First Line of Text

Crossbow prints with the same modified Monaco-9 font used for the screen display. Prints from a LaserWriter look best using the Font Substitution option from the Macintosh page setup dialog box, and Crossbow prints LaserWriter pages in reverse order.

Page Setup opens a dialog which allows selection of various printing options such as paper size, orientation, scaling, and printer effects. Normal assembly language text files will probably print best using tall orientation, while assembly print listings will probably want to use landscape orientation to display the extra long lines containing the code and location information.

The Print command opens a dialog box requesting information about the paper source, page range, and number of copies. Since the most common response to the print dialog is a click on the OK button, Crossbow bypasses the print dialog if the option key is pressed while choosing the Print command.

The Print Selection command works as described for the Print command, but becomes enabled only when a range of text is selected and prints only the characters that are currently selected.


Edit Menu

Crossbow supports the standard set of Macintosh cut and paste operations using the clipboard to transfer text between different documents and even different applications. Crossbow also adds several editing enhancements to simplify working with assembly language source programs.

Edit Menu

Editing changes occur either at the insertion point, which is the flashing vertical bar, or inside a selection range, which is a block of text displayed in a highlighted format. The insertion point is positioned using either the mouse, the enter key, or the cursor keys. Clicking the mouse inside an edit window sets the insertion point at the current mouse location. Crossbow remembers the four most recent mouse click locations, and hitting the enter key quickly repositions the insertion point to these four points sequentially. A selection range is selected by click-dragging the mouse over a block of text.

The cursor keys move the insertion point up or down, a line at a time, or left or right a character at a time. Holding down the command key while hitting a cursor key moves the insertion point to the top or bottom of the text, or to the beginning or end of the line. Holding down the shift key while hitting a cursor key extends the selection range by a line or character.

The Undo menu command restores the text to its state just prior to the last editing operation. Most, but not all, editing commands can be undone, and the text of the undo command in the menu changes to describe what will be undone. When the Edit menu displays Can't Undo in gray letters, the last operation cannot be undone.

Cut
deletes the text in the selection range from the edit window and copies it to the clipboard for later pasting to a Crossbow or other document. Copy copies the text in the selection range to the clipboard. Paste, in an edit window, inserts the contents of the clipboard at the current selection point, or overwrites the selection range with the clipboard contents. In the Terminal Window, Paste sends the text in the clipboard to the serial port using the options specified by the ASCII file transfer preferences. Clear simply deletes the currently selected text from the front-most window.

Paste Date & Time inserts the current date and time from the Macintosh internal clock at the selection point using an abbreviated format, for example: Tue, Nov 7, 1995, 5:27 PM. Hold down the shift key to paste using the long format, for example: Tuesday, November 7, 1995, 5:27 PM.

Shift Left and Shift Right move the block of text in the selection range one space to the right or left. When shifting right, Crossbow determines the optimum combination of tab and space characters to use for the fill.

Invert Case changes upper case characters to lower case, and lower case characters to upper case. When the selection range specifies a block of text, all of the characters in the block change case. Invert case at the selection point changes the case of the character in front of the insertion point, then advances the cursor one position to the right. Holding down the shift key while selecting Invert Case forces all character to upper case. To change an entire block to lower case, use shift Invert Case followed by Invert Case.

Set Tabs & Indent opens a dialog box with options for changing Tab Spacing and Auto Indent settings. Tabs in Crossbow documents occur at even multiples of the value specified in the Tab Spacing box, which must be between one and 64.

Auto Indent, when checked, causes return characters to move the insertion point to the same indent level of the line immediately above. Assembly source programs generally have more lines without labels than with, and Auto Indent will save a keystroke for each new line without a label. Holding down the shift key while hitting return does a one-time toggle of the Auto Indent setting.

Both tab spacing and auto indent settings are saved with each Crossbow document when the OK button is clicked. The Save button sets the default behavior for new files and text files not created by Crossbow.

Comment Selection inserts a semi-colon in front of each line in the selection range. Shifted Comment Selection removes one semi-colon (if present) from the front of each line in the selection range.


Search Menu

The search menu commands and equivalent command keys provide access to Crossbow's extensive search and replace capabilities.

Search Menu

The Find selection opens the Find dialog box which allows you to specify the various search and replace options which are described below. After filling in the appropriate dialog fields and clicking the OK button, Crossbow begins searching from the current insertion point. When a match is found, Crossbow positions the selection range to encompass the matched text and scrolls the text so that the beginning of the match is visible. If no match is found and Multiple File search is selected, Crossbow will automatically start searching the next file.

Enter Selection provides a shorthand method to filling in the search fields in preparation for a search. Enter Selection copies the current selection range into the Find: box, or into the Change To: box if the shift key is held down.

Find Again repeats the search using the previously defined search criteria and beginning at either the current insertion point, or at the end of the current selection range (to allow repeated finds). Multiple File searches switch to the next file at the end of the current text.

Replace replaces the currently selected text with the text in the Change To: box. If there is no selected text, Replace simply inserts the text from the Change To: box at the insertion point. If the Change To: box is empty, Replace simply deletes the current selection range.

Replace and Find Again replaces the current selection range with the text in the Change To: box, then searches for the next match beginning at the end of the newly inserted text.

Replace All substitutes all occurrences of the text in the Find: box with the contents of the Change To: box, starting at the current insertion point, and continuing to the end of the source file. In Multiple File searches, Replace All replaces all occurrences for all files in the search list.

Replace All CANNOT BE UNDONE!!!

The Find dialog box controls the search criteria and search behavior. The Find button closes the dialog box and begins the first search at the current window's insertion point. The Don't Find button closes the dialog and keeps the dialog options, but does not start a search. Cancel closes the search dialog and restores the options to the settings held when the dialog opened. Save Options closes the dialog, makes the current find options into Crossbow's default startup options, then begins the search.

The Find: and Change To: boxes hold the text for search and replace, respectively. Hold down the command key to enter the return or tab characters as search or replace literals. Both text boxes support full cut and paste, but only by using command key equivalents.

Choose Goto Line from the Search menu to position the insertion point at a line number you specify in the Goto Line dialog. The Goto Line dialog initially contains the line number of the last line displayed in the current edit window.


Search Options:

Search Options

The Whole Words check box, when checked, forces Crossbow to match only character strings which are whole words. In Crossbow, words are made up only of upper and lower case characters, digits, and the underscore character, everything else is considered a word separator.

The Wrap Around check box, when checked, causes Crossbow to start looking from the beginning of a file after reaching the end. The Ignore Case check box tells Crossbow to treat upper and lower case characters as the same. The Grep check box lets Crossbow use an advanced wild card search and replace technique described below.


Multiple File:

The Multiple File: check box instructs Crossbow to search and replace in more than one file. After checking Multiple File:, Crossbow enables the Open Windows and Include List radio buttons, defaulting to Open Windows searching, which limits the multi-file search to all of Crossbow's open edit windows.

Selecting the Include List radio button causes Crossbow to present a list of text files which have the extension ".Inc". Include lists are created automatically by the assembler when the Create Include List option is selected from the Assembly Options dialog in the Assemble menu. Include lists are text files in which each line contains a full pathname specification of the file to be read(no more than 64 characters). Each pathname must be preceded with a bullet character ('·', option-8 from the keyboard), and the include file must be named with ".Inc" as the last four characters.


Field Search:

The Field Search: check box enables field limited searching with any combination of search fields. Field searching limits matches to only those fields checked in the find dialog.

      Labels Opcodes Operands     Comments
        reset   ldaa    #B'11100000     ; disable rupts
                staa    RP5CR           ; no mr & no halt
                lds     #STACK          ; initialize system stack
                ldx     #STIRAM         ; clears DATA section
        _clrdat clr     0,x             ; clear one byte
                inx                     ; point to next byte
                cpx     #ENIRAM         ; compare end of DATA
                bls     _clrdat         ; loop if



Grep Search

Crossbow allows you to perform complex search and replace functions using the Grep option in the Find dialog box. The name Grep comes from a Unix string searching program which uses a similar pattern matching technique. When searching with the Grep option checked, Crossbow treats the string in the Find: box as a template which defines the search criteria. The find template, called a pattern, uses a combination of literal characters and several special characters to define a generally broader set of strings to apply to the search.


Patterns

In the simplest form, Grep searching works just like an ordinary search: the pattern in the Find: box contains a string of one or more characters, which must exactly match the same characters in the same order in the text. Like ordinary searches, but with a few exceptions described below, Grep searches are influenced by other options selected in the Find dialog.

Unlike an ordinary search, patterns in a Grep search may contain special characters expanding the range of strings which can be matched by the find pattern. Complex search patterns can be made up of sub-patterns, and sub-patterns can be 'remembered' for further use in the search pattern, or as replacement text in the Change To: box. Also, unlike an ordinary search, patterns defined in a Grep search are restricted to matching strings contained on a single line, although strings in the Change To: box can cause the replacement text to span several lines.


Special Characters

The following characters all have special meaning inside a Grep pattern, although the meaning may be modified by the context of the pattern. In the descriptions that follow, we will use '©' to designate any character, '§' to designate any string, and '¶' to designate any pattern. The special character summary will be followed by more detailed explanations of each usage.

      Character:    Matches:
        ©               itself, except as shown below
        .               any character except end of line
        [§]             any character in string §
        [^§]            any character NOT in string §
        [©-©]           any character between © and © inclusive
        \<¶\>           whatever ¶ matches if ¶ is whole word
        \(¶\)           whatever ¶ matches and defines sub-pattern
        \1..\9          one of the sub-patterns defined above
        \©              ©, except as shown above (\.='.',\\='\')
        ¶*              zero or more occurrences of the pattern ¶
        ^¶              ¶ only at beginning of line
        ¶$              ¶ only at end of line


© "Itself"

With the exception of the special characters shown above, every character defines a pattern matching itself. With the Ignore Case option checked, alphabetic characters match corresponding characters in either upper or lower case.

\© "Itself"

With the exception of "()<>123456789", any character prefaced with a backslash defines a pattern matching itself. The backslash provide a convenient method to include special Grep characters as literals in the search pattern. For example, "\?" matches "?", "\." matches ".", "\\" matches "\", and "\Z" matches "Z".

. Period

The special character '.' matches any character except the carriage-return character at the end of a line.
abc
def
ghi

In the three line example containing abc, def, ghi, choosing Grep with just a period in the Find: box will first match a, then b, c, d, e, f, g, h, and i with each repetition of the Find Again command. Changing the find pattern to two consecutive periods '..' matches first ab, then de, and finally gh. The c on the first line doesn't match because the next search starts immediately following the last match (ab) and the end of line character between the c and the d prevent a match. Finding for "d..", "de.", "d.f", ".ef", "..f", or ".e." will match def.

[ ] Brackets

A string of characters enclosed in square brackets defines a pattern matching any character from the string. For example, the search string "[-0123456789]" will match any decimal digit or the minus sign, while the search string "[0123456789ABCDEFabcdef]" will match any hexadecimal digit. Grep provides a convenient shorthand for specifying a range of contiguous characters by using the minus sign between two characters, allowing the search strings in the previous example to be replaced with "[-0-9]" and "[0-9A-Fa-f]". The leading minus sign in the first search string is not considered a special character because it is not between two characters. Trailing minus signs are treated similarly.

A string of characters enclosed in square brackets and prefaced with a circumflex (^) defines a pattern matching any character not contained in the string. For example, the search string "[^_]" will find any character except the underscore, the search string "[^A-Za-z]" will find any non-alphabetic character.

\< \> Whole Words

Patterns and sub-patterns bracketed with "\<" and "\>" only match strings which are whole words. Whole words must begin and end with an underscore, letter, or digit, and must be separated from other characters with anything but an underscore, letter, or digit. For example, the pattern "be" would match "Better to be or not to be.", while the pattern "\<be\>" would only match "Better to be or not to be." Leaving the "Partial Words" option unchecked is the same as bracketing the entire Find: pattern between "\<" and "\>".

* Repeat

A pattern followed by "*" matches zero or more consecutive occurrences of the pattern. For example, "m*" in a case-insensitive, partial word search matches the bold m's in "Mom's mumms are mmmmm good" and it also matches all of the empty strings between characters. Matching an empty string means the find ends with the insertion point positioned in front of the next character, with no selection range highlighted. Performing the same search with whole word search finds only the word "mmmmm".

The search string ".*" matches entire lines from the current insertion point to the end of the line, but not including the end of line character. The search string "(.*)" matches only strings enclosed in parenthesis.

\( \) Define Sub-Pattern

These special characters delimit a portion of the search string for later use either at a position further on in the search string, or in the replacement text in the Change To: box. The mechanism for referencing sub-patterns is described next.

\1..\9 Reference Sub-Pattern

Each sub-pattern defined with '\(' and '\)' is associated with a number between one and nine in the order encountered in the search string, and may be referenced by prefacing the number with a backslash. For example, the search string "a\(bcd\)ef\(gh\)ijk" looks for "abcdefghijk", and at the same time defines two sub-patterns "bcd" and "gh" which may be referenced by "\1" and "\2" respectively.

^ Beginning of Line

A search pattern prefaced by '^ ' will only match strings that occur at the beginning of a line. For example, the search string "^ \<[^ :]*\>:" will only find labels which start at the beginning of a line and which end with a colon.

$ End of Line

A search pattern suffixed with '$' will only match strings that occur at the end of a line. For example, the search string "[  ][  ]*$" contains both a space character and a tab character (use command-tab to enter the tab character) between each set of brackets, and will find any extra white space at the end of a line.


Managing Windows

To help reduce the confusion caused by up to eight open windows, Crossbow offers a menu specifically for organizing multiple windows.

Window Manager

The first two Windows menu commands operate on all the open edit windows. Close All Edit Windows closes all open edit windows, prompting for save confirmation if any changes have been made since the last save. Save All Edit Windows saves changes made to all of the open edit windows.

The next five items handle the placement of the windows on the screen.

Stack sizes the terminal and edit windows to full screen height minus the space needed to show each window's title bar, sizes all the windows to display 80 columns across, places the terminal window on the bottom, and then arranges the windows from front to back in the order in which they were opened

Side by Side
lines up the two front-most windows side by side to fill the display screen with the front window ending up on the left. All other windows remain unaffected.

Top & Bottom lines up the two front-most windows one above the other to fill the display screen with the front window at the top. All other windows remain unaffected.

Three Across works just like Side by Side but uses the three front-most windows.

Development sets up Crossbow for typical development with an edit window at the top, terminal window below, and the MultiFinder Desktop drive icons visible on the right of the screen. Development automatically opens a terminal window if necessary and requests a file to open if there are no open edit windows. Responding with Cancel to the file prompt sets up Development with a new untitled window.

The last items in the Windows menu begin with Locate Terminal Window and continue with a list of the open edit windows. Selecting Locate Terminal Window brings the terminal window to the front, or opens one if necessary. Selecting one of the other Locate items brings the corresponding edit window to the front.


Previous         Next        Contents