home *** CD-ROM | disk | FTP | other *** search
- IV. SED, THE EDITOR
-
-
-
- SED is a sequential file text editor implemented in F-PC by Tom
- Zimmer. The editor is WordStar compatible from a cursor control
- key stand point, with the keypad functions fully supported, along
- with some function keys. Full search, replace, and global replace
- are provided, along with copy and paste of text segments within a
- file as well as between files.
-
- SED was developed to provide an easy way to create and modify
- source and documentation files for building substantial
- application packages in F-PC. You can enter the editor from F-PC
- and return to F-PC with very few key strokes so that program can be
- modified and tested quickly. It has the convenience of the block
- based F83 source loading mechanism, but not limited by the small
- block size. It also has the advantage of using standard
- sequential text file common to most DOS word processors.
-
- SED allocates a 64K byte segment to store text file in RAM. The
- file is edited in RAM and saved back to disk when returning to
- F-PC. However, when a source file is compiled, the source code is
- extacted from the RAM storage one line at a time and compiled line
- by line. Thus complilation is very fast, averaged to about 10,000
- lines per minute.
-
- Due to the fact that a 64K byte segment is allocated for text
- during editing, SED handles files up to 64K bytes. As files
- generally should be used as a mechanism for modularizing source
- code, it is a bad style and poor design to allow source files to
- grow bigger than 10K bytes. The purpose of SED is not for general
- word processing but for program development, although one can do
- substantial text manipulation with it, up to 64K byte limit. Yes.
- Tom got rid of BLOCK. But in a sense, BLOCK creeps back, 64 times
- bigger.
-
-
-
- 1. SELECTING A FILE TO EDIT
-
-
-
- To enter the editor for an editing session, type the following:
-
- SED <filespec> <enter>
-
- A filename can be specified on the command line when starting SED,
- and may include a directory specification. If no file name is
- given after SED, the editor will request a file name. If the file
- does not exist, a new file will be created for entering fresh
- text. If the file extension is not specified, SED uses the .SEQ
- extension as default. The editor then clear the screen and
- displays the top 20 lines of the file in a window like display as
- shown in Figure 1. A line can be as long as 128 characters, of
- which only 72 are visible in the window.
-
- The top line of the display shows the current edit status,
- starting with INSERT/OVERWRITE status, which is also shown by a
- thicker cursor for insert mode. The current Column and Line
- number are then displayed, followed by the page number, total
- lines in file and total characters in file. The directory path
- and the name of the current file under editing appear at the
- bottom of the display 1.
-
- A new file selection mechanism has been added. When you are being
- asked to enter a new filename, if you press ENTER without entering
- a filename, a window will pop up allowing you to select a file
- from the directory. If you are in a sub-directory when the window
- appears, then a file named "." and a file named ".." will appear
- at the top of the file list. These files, along with any
- directories below the current directory, will display a graphic
- "infinity" symbol "∞" to the right of the filename. If you press
- <return> while positioned on the "." name you will select the ROOT
- directory. The ".." name will pop up one level of directory, and
- any other name with the "infinity" symbol next to it will step you
- down one level to that directory. You can move between files in
- the list, with the keypad arrow keys, and select a file by
- pressing ENTER. Escape can be used to abort file selection.
- While in the pop up file selection mode, you can also set the
- current drive by pressing a letter key between A and G. This
- drive must exist and have a disk in it, or a system error will
- result. The path and the current drive is displayed in the lower
- right. The path can be changed by pressing the "\" key, then
- typing the new path followed by the return key.
-
- Pressing ESC key terminates the editing session and returns to
- F-PC, after saving the modified text to disk.
-
- Pressing F1 function key will replace the display with a help
- screen as in Figure 2, showing variaous control keys for editing
- functions in the WORDSTAR style.
-
- SED is designed to use most WORDSTAR control keys to move the
- cursor and manipulate the text. However, on an IBM-PC, it is most
- convenient to use the cursor keys to position the cursor and then
- insert new text or type over old text. It is very easy to master
- this editor without much effort. The F1 help screen is always
- ready for consultation. For more sophisticated operations, refer
- to Section 3 for details.
-
- To re-enter SED and edit the currently openned text file, type
-
- ED
-
- in F-PC without a file specification. SED will display the text
- with the cursor positioned at the position when you left the last
- editing session. When the source file was compiled and an error
- was detected, ED will place the cursor on the first character of
- the offending word so that you can examine the situation and make
- appropriate correction. This way SED is tightly integrated into
- F-PC as seamless as the block editor in F83.
-
-
-
- 2. WORDSTART KEY FUNCTIONS
-
-
-
- SED tries somewhat half heartedly to be WordStar compatible. The
- cursor movement keys, Control A,S,D,F,E,X,C,R,W and Z have been
- maintained, as have the delete keys Control G,T,Y, and Del.
-
-
- KEY DEFINITION INDEX
-
-
- Control keys
-
- A Previous word.
- B ..
- C Next page, Page Down.
- D Right one character.
- E Previous line, Up Line.
- F Forward, Next word.
- G Delete the character UNDER the cursor.
- H Move left one character non-destructively.
- I Same as TAB.
- J ..
- K ..
- L ..
- M Like the <return> key.
- N Split line at cursor. See also Alt-N (join line).
- O ..
- P ..
- Q ..
- R Previous page, Page Up.
- S Left one character.
- T Delete the word to the right.
- U Update, save changes up to this moment.
- V Insert/ Overwrite mode toggle.
- W Scroll screen down.
- X Next line, Down Line.
- Y Cut/Delete the current Line.
- Z Scroll the screen up.
-
- Keypad Functions
-
- ESC Exit SED and Save changes.
- Shift-ESC Exit SED and Don't save changes.
- Home Goto beginning of line.
- End Goto end of line.
- PgUp Go back towards beginning of document 12
- lines.
- PgDn Go towards end of document 12 lines.
- Ctrl-Home Go to First line of document.
- Ctrl-End Goto last line of document.
- Ins Toggle between Insert and Overwrite mode.
- Del Delete the character under the cursor.
-
- Alternate Keys
-
- A ..
- B ..
- C Insert the next key pressed into the document.
- D ..
- E ..
- F ..
- G ..
- H ..
- I ..
- J ..
- K Expand imbedded TAB characters to spaces.
- L ..
- M ..
- N Join Lines, the inverse of Control N.
- O ..
- P ..
- Q ..
- R ..
- S ..
- T Set the TAB key to expand to the current column.
- U Word Undelete, undeletes the last 10 words or so.
- V Import a file, pops up a selection window.
- W Write entire file to a new file.
- X Export lines from mark to cursor.
- Y Un-delete lines.
- Z ..
-
- Function Keys
-
- F1 ..
- F2 ..
- F3 Mark line, for copy lines, and export lines.
- F4 ..
- F5 Get a line from the mark.
- F6 Search, prompts for search text.
- F7 ..
- F8 Replace, prompts for replace text, must do F6
- first.
- F9 ..
- F10 ..
-
- Alt-F1 ..
- Alt-F2 ..
- Alt-F3 ..
- Alt-F4 ..
- Alt-F5 ..
- Alt-F6 Search for same text again, no prompt.
- Alt-F7 ..
- Alt-F8 Replace with same text again, no prompt and do
- Alt-F6.
- Alt-F9 ..
- Alt-F10 ..
-
- Shift-F6
- Search for text backwards, CaSe sensitive.
- Shift-F8
- Replace all occurrences, use after F6 and F8.
-
- Shift-Alt-F6
- Search for same text again, no prompt Case
- sensitive.
- Shift-Alt-F8
- Replace with same text again, no prompt Case
- sensitive.
-
-
-
- 3. GLOSSARY OF EDITING OPERATIONS
-
-
-
- Copying Lines F3 & F5
-
- Lines can be copied from one place in a file to another, with the
- Mark-F3, and Copy Line-F5 commands. Move to the first line of the
- block of text you wish to copy, and Mark the start of the copy
- with Mark-F3, now move to the place where you want to copy the
- text to, and press Copy-F5 once for each line you want to copy.
-
- Delete and Un-Delete lines Control-Y & Alt-Y
-
- Lines can be deleted with Ctrl-Y, and un-deleted with Alt-Y. Any
- lines which are deleted are saved in a line delete buffer which
- currently has room for 50 lines. This is also the number of line
- deletes which can be un-deleted.
-
- Exporting a block of Text Alt-X and Shift Alt-X
-
- SED can export lines of text to another file. With Alt-X, first
- go to the first line of text you want to export, and press F3 mark
- to mark the start of the block export. Then move to the last line
- of text you want to export, and press Alt-X. This will cause all
- of the lines between and including the start and end line to be
- written out to the file TEMP.SEQ. To specify a different filename
- to export to, press Shift-Alt-X, instead of Alt-X, and you will be
- prompted for a name to write to. See also "Importing a File".
-
- Exporting to another file Alt-W
-
- The current edit file can be written out to another file. By
- pressing Alt-W, you will be asked for the name of the file to
- write out to. The entire file contents in memory will be written
- out to the new filename. If you want to export a small amount of
- text to another file, you can use the Alt-X Export function.
-
- HELP, on line F1
-
- Press F1 for on-line help on the various commands available.
-
- Importing a File Alt-V
-
- Text which has been exported with the Alt-X (export) command to
- the TEMP.SEQ file can be imported with Alt-V, the import command.
- If you want to import a file other than TEMP.SEQ, you can press
- Shift-Alt-V, and a window will pop-up for you to select a file
- from. If you press Esc during the import, or while in the file
- selection window, the import operation will be aborted. See also
- "Exporting a block of Text".
-
- Inserting Special characters in SED Alt-C char
-
- The Alt-C function allows any single character which can be
- generated by the keyboard to be inserted into SED. Simply press
- Alt-C followed by the key you want to insert. Function keys are
- mapped to characters above 127, so they will show up as graphics
- characters.
-
- Left Margin Ctrl-L
-
- The left margin on the screen defaults to column zero, but when
- printed, defaults to 2 spaces, so it is not normally necessary to
- insert a left margin. However, when TAB is pressed, the left
- margin on screen is expanded by 8 characters. Any subsequent
- lines typed in will maintain this margin. The left margin can be
- set at any column position. Move the cursor to the column where
- you want the left margin set and press Ctrl-L.
-
- MACROS and F-PC Alt-M, Alt-1..5
-
- SED does not have macros built into it, but a file is provided
- called MACROS.SEQ, which implements macros in Forth that can be
- used in SED. These macros work exactly the same as they work in
- ZED. That is, you use Alt-M to start defining a macro, followed
- by one of the Alt-1 to Alt-5 keys for the macro you are defining.
- Next you enter any keys you want included in the macro, and
- finally press Alt-M again to complete the macro definition. To
- perform a macro, simply press one of the Alt-1 through Alt-5 keys
- by it self, and the keys saved will be performed.
-
- Marker, Page Break (a down pointing arrow head)
-
- The down pointing arrow head symbol is used by SED to mark the
- first line of a NEW page, so you will notice this symbol appears
- at the left edge of the screen at the top of the document.
-
- Marker, End of File (an up pointing arrow head)
-
- The up pointing arrow head symbol is used by SED to mark the last
- line of text in the file.
-
- Printing Documents Alt-P
-
- Printing can be initiated Alt-P. It will take you to a screen
- where you can set the printing parameters, like first and last
- page to print, copies to print, etc. These values default to the
- most common situation, which is to print all of a document once.
- To start printing, press "P", or press ESC to abort.
-
- Reading Foreign documents Alt-K Tab expansion
-
- If you want to read a text file from an editor which imbeds Tabs,
- you will see this character " " in many places in the file when
- you first start editing it. If you do see these Tab characters,
- press Alt-K, and these characters will be expanded to spaces
- properly. This process will increase the size of the file
- somewhat, so if you are doing this to a very large file, you may
- run out of the 64000 character memory space available. WordStar
- document files will need to passed through a conversion utility
- before being edited by SED.
-
- You can import a Forth BLOCK file by specifying the file and
- extension on the file prompt line. SED will not find any line
- feeds in the file, so it will automatically split the file at 64
- characters per line After this is done, trailing blanks will be
- stripped from each line, and trailing blank lines will be removed
- from the file. The resulting file will be much smaller, typically
- 50 percent or less. The original file is not modified, and the
- new file is created with the extension ".TMP".
-
- Replacing Text F8-Replace & Alt-F8
-
- After a Search has been done, you can replace the text found.
- Press F8. You will be asked for a replacement string, which will
- be used to replace the found text, when return is pressed. To
- search for the next occurrence of the same text, press Alt-F6, and
- to replace the next found occurrence with the same replacement
- text, press Alt-F8.
-
- Replacing All Occurrences of Text Shift-F8
-
- Having already performed a Search (F6) and Replace (F8) once, you
- can replace all occurrences of search text with replacement text
- by pressing Shift-F8.
-
- Searching for Text F6-Search & Alt-F6
-
- You can look for any sequence of characters in SED with the
- Search-F6 key. When F6 is pressed, you are asked to enter a text
- string to look for. SED will look for that string of characters
- when you press <return>. When SED searches for text, it ignores
- the case of the letters. If you want SED to look at the CaSe of
- the text it searches, hold down SHIFT while pressing <return>.
- This search is much faster. To search for another occurrence of
- the same text string, press Alt-F6 (or SHIFT Alt-F6 if you want
- only an exact match). See also the earlier section on Replacing
- Text.
-
- Searching for Text Backwards Shift-F6
-
- Having already done a search using F6 above, you can also search
- backwards with Shift-F6, which searches backwards from the cursor
- with a CaSe sensitive search.
-
- The straight key, F6 or F8 will perform the specified operation,
- with a prompt for a text string parameter. The operation is
- performed with a case insensitive search. That is, "CaSe" is the
- same as "case".
-
- The Alt-F6 or Alt-F8 performs the same function, but with the same
- text string as was entered with the non-Alt key. Again, the search
- is case insensitive.
-
- Holding down Shift while pressing return on F6, Alt-F6 or Alt-F8
- will cause the search to be done CASE SENSITIVE. That is, "CaSe"
- is NOT the same as "case".
-
- And finally, pressing Shift-F8, WITHOUT ALT, causes a global
- replace all occurrences to be performed. While the above may seem
- confusing at first, it provides a lot of flexibility and power for
- search and replace operations. Try these commands on a junk file
- until you become familiar with their operation.
-
- Tab setting Alt-T
-
- Set the TAB key to tab to the current column, if you are on column
- 4, TABS will occur at column 4, 8, 12, 16, etc.
-
-
-