MAINEDIT User's Guide, Chapter 1

previous   next   top   contents   index   framed top   this page unframed


1. Basic Concepts

MAINEDIT is a versatile full-screen editor for general text preparation and review. MAINEDIT uses the MAINSAIL portable software technology to provide the same capabilities across a broad range of computing systems and terminals. It can be used to invoke other MAINSAIL modules without losing the context of an editing session. It is an integral part of the MAINSAIL display executive, which provides a powerful environment for program development and execution.

MAINEDIT provides two different interfaces: MAINED and MAINVI. MAINED is XIDAK's own editor, and provides full access to all the capabilities of MAINEDIT. MAINVI emulates vi, the popular UNIX editor.

1.1. Version

This version of the MAINEDIT User's Guide is current as of the proposed Version 16.30.1 of MAINSAIL (which has not yet been released).

This document is preliminary. Its contents have been updated to include information about the proposed 16.30.1 release, but the document has not been thoroughly proofread. Please contact XIDAK if you have any questions concerning this document or if you find any errors in it.

1.2. Changes to Commands

XIDAK reserves the right to create MAINEDIT commands for internal use only. Such commands are not documented here and are subject to change and/or removal without notice. MAINEDIT commands and the command sequences used to invoke MAINEDIT may change from release to release of MAINSAIL.

1.3. Using This Manual

This manual is divided into four parts: the MAINEDIT part, which tells how to start an editing session independent of whether MAINED or MAINVI is chosen, and one part each for MAINED and MAINVI commands.

This manual is designed to introduce MAINEDIT to a new user. Some familiarity with computers and computerized text editing is assumed. You should be comfortable with the concepts of files and directories, and know how to log on and off your computer system.

1.4. Notation Conventions

1.4.1. File Names

Some of the file name examples used in this manual may not be considered legal by the operating system of your computer. Because of the wide variation in operating systems, a comprehensive description of legal file names cannot be given here. Check with the manager of your computer system or read the user's guide for the system to find the file name syntax rules.

1.4.2. Special Keys

Throughout the manual, the notation <keyName> means to press the indicated key. For example, <sp> means press the space bar. Table 1–1 lists the key name abbreviations used in this manual, and their meanings. The actual keys to press are terminal-dependent.

Many terminals have keypads and other special keys not listed in Table 1–1. MAINED and MAINVI may map some of them to often-used functions such as cursor movement. See Appendix B for the mapping of such keys for your terminal.

Table 1–1. Key Name Abbreviations
<keyName> Meaning
<del> DELete (or rubout)
<eol> End Of Line (marked RETURN or ENTER on most keyboards)
<tab> horizontal TAB
<lf> LineFeed
<sp> SPace bar
<bs> Back Space
<ecm> Enter Command Mode
<abort> ABORT command
<esc> ESCape key

CTRL- prefixing a letter means press the CONTROL (or CTRL) key while typing the letter. For example, CTRL-C means to hold down the CONTROL key and type c or C.

1.4.3. Dialogues

In any illustration of a dialogue between a user and MAINEDIT, user input is underlined. Thus, the following:

File (foo.txt): demo-file.txt<eol>

means that MAINEDIT prompts with “File (foo.txt):”. The user responds with demo-file.txt<eol>. The <eol> means that input is terminated by pressing the <eol> key.

1.4.4. Command Descriptions

In the command descriptions, a lowercase n indicates any nonnegative number. For example, nK can represent 6K or 23K or even 0K. Omitted n is equivalent to 1, unless stated otherwise. Thus, K is the same as 1K.

A list of options in square brackets and separated by vertical bars, such as [C|W|L|P], means to select exactly one of the options. For example, D[C|W|L|P] represents the four different MAINED commands DC, DW, DL, and DP (Delete Character, Word, Line, and Page, respectively).

1.5. Files, Buffers, and Windows

MAINEDIT maintains one (or sometimes more than one) workspace called a buffer for each file edited during a MAINEDIT session. When a file is edited, a buffer is created and the contents of the file incrementally copied into it. The buffer name is formed from the file name by replacing every lowercase letter in the file name with the corresponding uppercase letter, so that the buffer name is entirely in upper case. The buffer may be examined and altered during the edit session, but the original file remains unaltered until its associated buffer is explicitly written. It is not necessary for a buffer to have an association with a file; however, if the contents of the buffer are to be saved at the end of a MAINEDIT session, such an association must be established.

Many MAINVI commands work slightly differently from the corresponding vi commands because vi do not have the same type of buffer as MAINEDIT. The MAINVI portions of this document describe the differences in detail.

The buffer name CMDLOG is special; see Chapter 17 of the MAINED User's Guide.

Buffers are displayed on the screen in areas called windows. At any given moment, a buffer may be either displayed or invisible. Invisible buffers can be made visible (i.e., windows are created for them) using the MAINED commands described in Chapter 10 of the MAINED User's Guide. MAINVI does not have complete sets of buffer and window manipulation commands of its own; however, it has a command that allows the MAINED commands to be given, as described in Chapter 3.

1.6. Front Ends and Back Ends

MAINEDIT is really a software package on which different front ends (ways of interpreting commands) and back ends (ways of displaying information) may be layered. The initial default front end is MAINED, and the initial default back end is TXTMGR. MAINVI is also a front end; MAINEDIT can be set up to change the default front end to one of these, or a front end can be specified when a buffer is created. The TXTMGR back end, which is for editing ordinary text files, is what is usually assumed in this manual, except in Appendix A, which describes the DATMGR back end. If you are using MAINEDIT in the usual fashion, you do not need to worry about different front ends and back ends after you have set up the default correctly. Occasionally during a MAINEDIT session you may see a prompt asking you for a front end or a back end; in most cases, you will want to accept the offered default.

1.7. Establishing the Default Front End

If you are using MAINVI, then before you use MAINEDIT for the first time, you should add the following lines to your parameter file, which in Version 16.20 of MAINSAIL is called v1620.prm. This file resides in your home directory (you can also create it on your current directory instead, if you want to have more than one parameter file). If you are using MAINVI, the file should contain the lines:

$GROUP $MAINEDIT
FRONTEND MAINVI

If using MAINED, you do not need add anything special to v1620.prm, since in the absence of a FRONTEND directive, MAINEDIT chooses MAINED to be the default front end. However, you may wish to set other editor parameters in the parameter file; in addition, you may want to create a file called eparms, which stores editor context information. Chapter 2 describes how MAINEDIT uses the two initialization files v1620.prm and eparms.

1.8. Invoking MAINEDIT

To begin using MAINEDIT, invoke MAINSAIL and execute the module EDIT. MAINEDIT can also be set up so that it can be invoked directly from your host operating system. If you do not know how to invoke MAINSAIL, ask your MAINSAIL representative for assistance, or consult the appropriate operating-system-specific MAINSAIL user's guide.

Invoking MAINEDIT is quite different from invoking vi. This requires some getting used to if you are familiar with vi; however, once you are in the editor environment, you will find that the MAINVI commands are pretty familiar.

1.8.1. File to Edit

MAINEDIT asks for the name of the file you want to edit. This can be an existing file that you want to examine or modify, or a new file that you want to create. For example, if you want to create a new file called foo.txt, respond to MAINEDIT as shown:

File to editfoo.txt<eol>

MAINEDIT normally remembers the names of your most recently edited files. If MAINEDIT has this information when you begin editing, it offers you in parentheses the name of the last file that you edited. This is the default file. You may accept this default by typing <eol>, or type in a different name. For example, to o edit old-file.txt:

File to edit (old-file.txt): <eol>

To edit foo.txt:

File to edit (old-file.txt): foo.txt<eol>

The name of the file you last edited is normally stored in a file called eparms; see Chapter 2. If MAINEDIT does not prompt with a default file name (either because there is no eparms file or the eparms file does not contain a default file name), you must type a file name to the “File to edit” prompt.

1.8.2. Display Module and Baud Rate

Since MAINEDIT can be used with many terminals, it must know what type of terminal you are using. A display module exists for each terminal supported by MAINEDIT. Your parameter file may contain the name of the display module for the terminal that you use most often. If this information is not available to MAINEDIT (i.e., is not present in the parameter file, or the parameter file does not exist), it asks you which display module to use. See Appendix B for descriptions of the display modules available as of the date of this writing.

If MAINEDIT does prompt for a display module, respond to the query with the name of the display module for your terminal, terminated with a carriage return. For example, if you are using a VT100 terminal:

Display modulevt100<eol>

In order to work correctly, some display terminals require extra characters (“padding”) to be sent following certain terminal commands. The number of extra characters following each command depends on the speed (“baud rate”) at which the terminal is operating. The baud rate you are using must be available to MAINEDIT so that the correct padding can be performed. When insufficient padding is supplied, many terminals lose characters and/or beep.

The baud rate is approximately ten times the number of characters transmitted per second to the terminal; e.g., 9600 baud is roughly 960 characters per second. The most common baud rates are 150, 300, 1200, 4800, 9600, and 19200.

MAINEDIT assumes a default baud rate, so by default it does not prompt for the baud rate. The default baud rate may be altered by modifying the parameter file as described in Section 2.1.6.

Baud rate is usually irrelevant to bitmap displays.

If you have defaults for a display module but are temporarily using a terminal other than the default, you can override the default by typing a comma after the file name (and before the <eol>) when you respond to the File to edit question. This tells MAINEDIT to prompt for the display module instead of using the defaults. Type the name of the display module (or just <eol> to use the default display module).

For example, to edit old-file.txt, using HEATH instead of VT100, running at the default baud rate:

File to edit (old-file.txt): ,<eol>
Display module (vt100): heath<eol>

To edit foo.txt, using HEATH instead of VT100 at the default baud rate:

File to edit (old-file.txt): foo.txt,<eol>
Display module (vt100): heath<eol>

If you want to override the default baud rate, you can follow the display module name itself with a comma. In this case, you are prompted for something called the terminal port (for which you should normally take the default; see Appendix A of the MAINED User's Guide for what this really means) and the baud rate. For example, assuming no default display module is present in your parameter file, and you want to specify a VT100 at 9600 baud:

File to edit (old-file.txt): <eol>
Display modulevt100,<eol>
Terminal port<eol>
Baud rate (1200): 9600<eol>

After all the prompts have been answered, MAINEDIT clears your display screen. If your screen is not cleared, MAINEDIT is probably using the wrong display module for your terminal. If the screen is cleared but characters are subsequently lost from the display, the baud rate you have specified may be incorrect. If either problem occurs, you must exit to the operating system or the MAINEX asterisk prompt and restart the editor, this time specifying the correct display module and baud rate. If you do not know what baud rate you are using, try accepting the default; if the screen does not update properly, try again with a higher baud rate.

1.8.3. New File

If MAINEDIT cannot open a file with the name that you typed, it asks whether you want a new file created with this name. Respond with Y (or y; no trailing <eol>) to create and edit a new file:

New file foo.txt (Yes or No)? Y

Type N (or n) to indicate that you really did not mean to create a new file (for example, if you misspelled the file name). MAINEDIT prompts for another file name:

Filecorrect-name.txt<eol>

This dialogue continues until either a file is found with the name you specify, or you agree that you want a new file created.

1.9. MAINEDIT with Command Line Arguments

MAINEDIT can be invoked with arguments on the MAINEX, MAINEDIT, or MAINDEBUG command line according to the syntax:

edit {fileName {displayModule {baudRate {frontEnd {backEnd}}}}}

fileName specifies the initial file name. MAINEDIT prompts for the display module if none is specified on the command line or in the parameter file. If specified, frontEnd and backEnd override the default front end for the first buffer created; normally, MAINEDIT does not prompt for the front end and back end. MAINEDIT can be made to prompt for the front end and back end if they are not specified on the command line and fileName ends with two commas.

For example, the following command line causes MAINEDIT to prompt for the display module and baud rate and also the front and back end:

edit foo,,

The following example prompts for the front and back end:

edit foo,, sunxterm 0

The following example does not prompt for anything, and accepts the default front and back ends:

edit foo sunxterm 0

The following example uses MAINVI as the initial front end and prompts for the back end:

edit foo,, sunxterm 0 mainvi

The following example uses MAINVI for the initial front end and TXTMGR for the initial back end and does not prompt for anything:

edit foo sunxterm 0 mainvi txtmgr

1.10. Screen Format

MAINEDIT now fills the display screen with text from the file you are editing. If the file is new, the effect is the same as if the file contained a single blank line. The following shows a default MAINED screen format (the MAINVI format is slightly different, and does not have the colon borders).

Figure 1–2. MAINEDIT Screen Format
                                            <-message line
-
MAINED--2.3----C----FOO.TXT--------------- <--status line
:
This is some of the text contained in the:
:
file "foo.txt". The first line of the    :
:
screen happens to be line three of page  :
:
two of the file.                         :
PAGE 3 -----                       --- PAGE <----page mark
:
At this pointpage 3 starts.            :
:                                         :
:
This is the last line of "foo.txt".      :
E                                           <---buffer end
E
E

1.10.1. Message Line

The message line (sometimes also called the command line or the top line), which is at the top of the screen (which is not where vi puts it, but is where MAINVI puts it), is used for error and warning messages, prompting, and user responses. When reading long lines from the message row, MAINEDIT clears the line and redisplays the last ten characters (left-justified) before echoing the next input character if the echoed character would have been beyond the end of the message row. Control characters (and other non-printing characters) echoed on the message line appear as asterisks (the * character).

1.10.2. Status Line

The status line shows information about the current window. There is one status line per window. Initially there is only one window on the screen; multiple windows and the MAINED commands for manipulating them are described in Chapter 9 of the MAINED User's Guide.

The information displayed in the status line for MAINED includes the page and line number of the top line of the window, the mode, and the buffer name. “P.2 L.89”, for example, means that the first line in the window is the eighty-ninth line of the second page of the buffer (pages and lines are numbered starting with one). The next character (C, E, I, or O) indicates the current mode (Command, Escape, Insert, or Overstrike). Upon entry, command mode is in effect. Modes are explained in Section 1.3 of the MAINED User's Guide.

Status lines for front ends other than MAINED may be slightly different, and are described in the front-end-specific portions of this document.

When you first invoke the editor, the buffer name displayed is the name as the file you specified upon entering the editor converted to upper case.

1.10.3. Page Marks

The line in Figure 1–2 that reads:

PAGE 3 -----                       --- PAGE

is called a page mark.

A page is a body of text bounded by end-of-page characters or by the beginning or end of the file. The end-of-page character is system-dependent (it is the MAINSAIL eop character). On most ASCII systems this character is a CTRL-L (or formfeed). An end-of-page character, when printed by a line printer, usually causes the paper to be advanced to a new page. When displayed by MAINEDIT, it appears as a page mark.

1.10.4. Other Special Characters

Non-displayable and other special characters (such as control or escape characters) that occur in a file are displayed on most terminals as an asterisk (*). The actual value of such a character can be determined by positioning the cursor at the character and issuing the = command. See Section 13.4 of the MAINED User's Guide.

1.10.5. Cursor

The cursor indicates where editing takes place. The form of the cursor depends on your terminal; it is commonly a solid or blinking underbar or box. When you wish to insert or delete text at a particular place, you must (for most commands in most front ends) move the cursor to that point.

1.11. Tabs

When MAINEDIT reads from a file into a buffer, it pads each tab character with enough additional tabs to fill out to the next tab stop. This allows MAINEDIT to keep one character in its internal data structure for each character position on the screen. For the purposes of reading and writing files, a tab stop is defined at every eighth column. During the edit session, a tab in a buffer is treated as if it were a space (for exceptions, see Chapter 4 of the MAINED User's Guide and Section 16.3.1).

Whenever a buffer is written to a file, each sequence of tabs that extends to a tab stop is replaced with a single tab. The net result is that tabs that have not been moved or altered during the edit session are preserved in the output file.

1.12. End-of-Line Characters: Carriage Returns and Linefeeds

Different computer systems have different conventions for the sequence of characters that end a line. Many systems (e.g., UNIX) follow the convention that an end-of-line is signaled by just a linefeed (LF) character. Other systems follow the convention (the “CRLF convention”) that an end-of-line consists of a carriage return (CR) character followed by a linefeed. On systems that follow the LF convention, carriage return is discarded on input when it precedes a linefeed. This lets you read files that have come from a system that obeys the CRLF convention without having to translate them explicitly first.

1.13. Finishing the Edit Session

When you are ready to end your edit session, type the appropriate exit command for the front end (e.g., QF in MAINED, :wq in MAINVI). If you have made unsaved changes to any buffer, MAINEDIT prompts in the message line to ask if you want the buffer saved:

Write buffer FOO.BAR (Yes No)?

If you type Y or y in response, MAINEDIT writes the buffer into a file. If you type N or n, MAINEDIT does not write the buffer. This means that none of your changes since you last saved the buffer is recorded, so be careful that this is what you really want.

The name of the output file is normally the same as the name of the input file (you can change the name to be used for the output file by using the MAINED Q.F command described in Chapter 10 of the MAINED User's Guide). If you are editing a file that has version numbers, a new version is created for the output file. Otherwise, you are prompted whether to delete the existing file, so that the new file can replace it. If you say no (N), then you are prompted for a new file name to be used for the output file.

If you try to save a file that has been modified since the last time the editor saved it, the editor asks you to confirm whether to overwrite the file.

Before returning control to the operating system or MAINEX prompt, MAINEDIT blanks the screen.


previous   next   top   contents   index   framed top   this page unframed

MAINEDIT User's Guide, Chapter 1