Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/qed_manual/reference.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/qed_manual/reference.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/qed_manual/reference.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/qed_manual/reference.html on line 8

Reference Manual

The Syntax of Editor Commands

Editor commands are given in the form:

[line_range]C[argument]

where:

line_range
indicates which lines to act on
C
is a single character indicating the command to execute
argument
is command specific information

Line Range

The line range specifies which lines the command should operate on. It can consist of zero, one or two line addresses. If no range is specified then it will usually default to the current line. The current line is the line your cursor is on in the text area and will typically be updated by each command to reflect the last line it operated on. Check the section on each command for the exact behavior.

The following line range forms are allowed:

<None>
No line address — this causes the command to choose a default line address. If not stated otherwise in the documentation for a command, the default for will be the current line.
line
The command will operate only on the single line number line
line1,line2
The command will operate on all lines between line1 and line2, inclusive.
line1;line2
The command will set the current line to line1, then operate on all lines between line1 and line2, inclusive.
*
This form is a synonym for 1,$, which means line 1 to the last line in the file. The command will operate on all lines.
#
The command will operate on the tagged lines in the buffer.

The elements of a line range are line addresses line and are composed of:

number
This is an ordinary line number referring to the numberth line of the buffer.
$
This special character refers to the last line of the buffer.
.
This refers to the current line of the buffer.
@
This refers to the line occupying the currently defined center line.
&
This refers to the top line of your currently displayed screen.
%
This refers to the current line if you are in the text area and line zero if you are on the command line. It is often used in macros by the Zap (z) command to operate on the command line.
/pattern/
This is the address of the line which contains an instance of the specified pattern. The search for pattern will begin at the character after the cursor and will continue to the end of the buffer. If no match has been found by that time, and option wrap is on (w+), the search will wrap around to the beginning of the buffer and continue looking for pattern from line one. If no match is found in the entire buffer then an error will be issued. This line search sets the condition register TRUE if a match is found and FALSE if a match is not found.
?pattern?
This serves as the line address of the line which contains an instance of the specified pattern. The search for pattern will begin at the character before the cursor and will go backwards through the buffer wrapping around from the first to last line if necessary. If no match is found an error will be issued as above. This line search also sets the condition register to TRUE on a match and FALSE on no match.

Each line address above may be combined with other line addresses using the + and - characters to form expressions. For example:

.-5,.+5
will specify the five lines before and after the current line.
&;.+23
will specify all lines on the current screen.
?begin?,/end/
will specify all lines between the lines containing the previous begin and the next end.

If you specify a line address which is outside the buffer you will get an error and the command will not be executed. The special character | can be used to limit the preceding line addresses to lie within the buffer (between one and $). This is very useful in defining macros. The | operator sets the condition register FALSE if the line address falls outside the buffer and needs to be limited. For example:

&;.+23|

is a safer form of the example shown above.

Command Specification Character

Each major command consists of a single character which has been chosen to reflect its nature. For example, the character d was chosen for the delete command and the character w was chosen for the write command. This character must be in lower case.

If a command line is entered which contains a line_range but no command

44

then the current line is set to the last line address specified. In this case the cursor will move to line 44.

Right Arguments

Some commands require extra information to specify their operation. For example, the Move (m) command requires the specification of the destination line address:

{line1},{line2}m{line3}

Other commands like the Zap (z) command represent a class of commands which are specified by sub-command characters. For example:

zcd

is a zap cursor delete command. The cd is a subcommand of the zap command and will not be interpreted as the major commands c and d. This form of subcommand is used by several editor major commands.

Placing Multiple Commands On A Line

The editor allows you to place more than one command on a line. Each command on the line is executed sequentially from left to right. For example:

ob+ot+

will turn on option blank followed by option tab. The command:

1,4d$d

will delete lines one through four and then delete the last line. Note that the line range only applies to the command that it immediately precedes. Should an error occur on any command then execution will be halted and any following commands will not be executed.

Some editor commands consume all characters until the end of the line collecting their right argument. They must therefore be the last command on any line on which they occur. For example

e filename

consumes all characters until the end of the line collecting the filename.

Special Characters

The Full Screen Editor treats a small number of characters as special in certain situations. These characters are described in the following subsections. The only character you cannot save in your text is an ASCII NUL (hex 00).

The Linefeed Character (hex 0A)

The line separator character in QNX4 is a linefeed (hex 0A). Source files separate lines by a single linefeed character, not a carriage return. On input, whenever you enter a carriage return (hex 0D) it is mapped into a linefeed character.

When the editor reads a file it collects characters up until a linefeed, replaces the newline with a null (hex 00) and saves the collected characters as a line in your buffer. The point to note is that the linefeed is not saved. It is stripped on a read and added to the end of each line when the file is written.

In the definition of complex macros containing several lines, the lines may be separated by either a carriage return or a linefeed. The supplied macro file has adopted the convention of using the linefeed separator.

The NUL Character (hex 00)

The NUL character (hex 00) is used internally by the editor to delimit strings. It is therefore not possible to save this character in your buffer. Should you attempt to enter this character, the line (text or command) will be truncated at that point.

The Meta Characters (@$^^&.*[)

When option meta-characters is on (m+), then these characters have a very special meaning when used within patterns (they are special only within patterns). The period (.) for example will match any character, not just a period. The meaning of these characters is explained in the section on pattern matching.

The Backslash Character (\)

The escape character on the command line is the backslash. When it precedes a meta character in a pattern it causes that character to be taken literally. That character loses any special significance it might have normally had.

Following a backslash by two hexadecimal characters in a pattern or translate string results in a single character with the hexadecimal value specified. For example \0A is the single character whose hexadecimal value is 0A (a linefeed character).

The Tab Character (hex 09)

When displayed on your screen this character will be expanded into the necessary number of spaces to move to the next tab stop. Tab stops are fixed at every four columns with the first stop set on column five. You can display tabs by turning on option tabs display (ot+).

Tabs are not treated with any special significance internally. They only affect your display and your cursor movement on the display. You can not position your cursor on the expanded spaces following the tab, only the tab character itself or the real character following it.

The Command Character (hex FF)

On input, the character with hexadecimal value FF will cause all characters up until the next record separator (newline) to be collected (no echo) in a hidden buffer, then executed as a command. Any current text on the command line is not affected. This character is used heavily by the translate command when defining macros for the various cursor and function command keys.

This character is only special on input. You can place a hexadecimal FF character in your text by using the substitute command and a \ff escape. e.g. to replace “C” with the hexadecimal character FF:

s/C/\ff/

The Recall Character (hex FE)

On input, the character with hexadecimal value FE will recall to the command line the last command typed. This character is used by the F9 and F10 function keys.

You can place this character in your text by using the substitute command as above.

The Keyboard Input Character (hex FD)

When this character is encountered in a macro, the editor will accept a character from the keyboard. If several characters occur in a row, a maximum of that number of characters will be accepted. Entering a carriage return will always terminate input (skipping any remaining FD's) and the carriage return will be discarded.

The Macro Disable Character (hex A3)

On input, the character with hexadecimal value A3 will prevent the next character from being expanded should a translate be in effect for it. For example, the Home key has a hexadecimal value of A0, but is translated on input into the three character string:

<command char>1<newline>

If you would like to prevent this expansion (to enter the key's value) then you should proceed it with the - key on the numeric keypad which generates the code for the Macro Disable character. You can of course enter the Macro Disable character itself by typing the - key twice.

The Condition Register

The editor maintains a special register called the condition register which is set to TRUE or FALSE by some of the editor commands. This register can be tested by the Branch (b) command and the Until (u) command to perform conditional execution of editor commands. These commands are commonly used in macros.

Delete Buffers

The Editor maintains a buffer for deleted characters and another buffer for deleted lines.

The Character Delete Buffer

The character delete buffer is arranged as a stack 256 characters long. Adding a character to a full buffer will cause the oldest character to be lost. In this manner the most recent 256 characters are kept.

The editor maintains primitive commands for:

These primitives are provided by subcommands of the Zap (z) command.

The saving of the last deleted character via the Del key is performed by a macro which saves the character under the cursor in the character delete buffer before deleting it. Likewise, the restoration of a deleted character via the Ctrl-Ins key combination is based upon a macro which inserts the last character placed in the delete buffer before the current cursor position.

The Line Delete Buffer

The editor maintains another buffer in parallel with your text buffer called the line delete buffer. This buffer has the same structure as your text buffer, however, it can not be displayed or directly operated on by the editor's many commands. Each time you delete a line via the Delete (d) command it is moved from your text buffer into your line delete buffer. You can restore deleted lines using the special forms of the Append (a) and Insert (i) commands which can move lines from the delete buffer back to your text buffer.

The moving of lines between the two buffers is slightly more complicated than is indicated above and is best explained by an example.

If you were to delete 5 lines, one at a time (say via the F3 key) it would be nice if you could undelete them one at a time so that the last line deleted was the first line restored. This is particularly nice when you delete one line too many and just want to restore the last one, not all of them. Conversely, if you were to delete a group of 100 lines as a block (say via a tagged delete) you do not want to have to restore them one at a time but want them restored as a block as well. The above two scenarios describe, from a user's point of view, the editor's implementation of the line delete buffer. Associated with the buffer is a flag which indicates whether the buffer contains a series of single line deletes or one block delete. To avoid confusion, the editor will purge the line delete buffer before adding in the following circumstances.

Put simply, if you delete lines one at a time, they are undeleted one at a time and if you delete a block of lines they are undeleted as a block. Mixing blocks or types is prevented by purging before adding, if necessary.

When working with a very large buffer it is possible for the editor to run out of memory. When this happens it will purge the delete buffer in an attempt to free up some space. You will be warned of this by a message on the command line which you must clear (like an error) by typing a carriage return. Deleting all lines in a file, then attempting to edit another large file will often generate this message. In this case you have all of the original file in memory in the line delete buffer and are trying to read another large file into the text buffer. They may not both fit!

Break Handling

The editor will terminate any operation gracefully at the earliest possible moment after the Break key is typed. As a result of the break, any operation may be incomplete on the range of lines specified for a command, however, no line will be left in a partially modified state. Should you break out of an Edit (e), Read (r), or Write (w) command you may only move a subset of the lines into or out of your buffer to the specified file.

After servicing the Break the editor will leave you in command state.

The Pattern Matcher

The editor has a very powerful pattern matching facility which will match the class of patterns known as regular expressions. Patterns are used for line searches and by the Global (g) and Substitute (s) commands. It is the editor's pattern matching facility that gives it flexibility in writing powerful macros. For example, the Ctrl left and right arrow keys are implemented by a pattern which searches for the next or previous word in your text. We will attempt to describe the patterns accepted by the editor in a very rigorous manner. It is assumed that option meta characters is on (m+) during the definition of your pattern. If it is off (m-) then the editor will only recognize the class of patterns represented by (1) and (2) below.

  1. The simplest pattern is a single character. Such a pattern matches the given character in either upper or lower case, unless option dual is on (d+) to make the pattern matcher differentiate between cases.
  2. Patterns arranged adjacently form a single pattern. For example: /abc/ matches any string “abc”.
  3. The character ^ (caret) specifies a pattern which matches the null string at the beginning of the line. Thus a line search of: /^charm/ would match the string “charm” at the beginning of a line.
  4. The character $ specifies a pattern which matches the null string at the end of the line. Thus a line search of: /charm$/ would match the string “charm” at the end of a line.
  5. The character . (dot) specifies a pattern which matches any character. Thus a line search of: /charm./ would match the string “charm” followed by any character on a line.
  6. Any pattern followed by a * defines a pattern which matches a string of zero or more occurrences of that pattern. Thus: /b*/ matches the strings “b”, “bb”, “bbb”, etc. In addition, since *-patterns will match zero occurrences of a given pattern, “/b*/” will also match “”. The pattern matcher will match a * construction with the longest sequence matching the given pattern beginning in a given column; for example, if a line contains the string “bbbbbb”, /b*/ will match all six b's as a unit, not individually.
  7. The construction @(number) is a pattern which matches the null string immediately before the numberth column on the line. Thus a line search of: @(10)charm would match the string “charm” starting in character position ten on the line.

    If number is zero or the character . (dot) then this pattern will match the null string before the current cursor position in the text area.

    If number is the character t then this pattern will match the null string before the next tab stop. This can be used to turn runs of spaces into tabs. See the Substitute (s) command.

  8. The construction [string] matches any one character in string and no other. Thus: /[0123456789]/ is a pattern which will match a single digit. Characters in the square brackets are taken literally, without their special meanings; so /[.]/ will match the character . and no other. A sequence of characters may be specified by separating the lower and upper character by a dash (-). For example: /[a-z0-9]/ is a pattern which will match any letter or any digit. To match a “-” you may protect it with the backslash (\) character.
  9. The construction [^string] matches any one character that is not in string. Thus: /[^^0-9]/ is a pattern which will match any character that is not a digit.
  10. A null pattern (//) is equivalent to the pattern most recently specified within the editor. This feature is convenient for searching through a file for a particular string. For example, if you are looking for the string “hello” you could specify: /hello/ the first time and: // on subsequent searches. An even quicker method of performing this task would use the F9 key to simply re-execute your line search.
  11. Any character preceded by the backslash character (\) loses its special meaning. Thus: /\\\^^\.\$/ would match the string “\^^.$”.

Some Pattern Examples

Match the string “hello” anywhere on a line:

/hello/

Match the string “hello” at the start of a line:

/^hello/

Match the string “hello” at the end of a line:

/hello$/

Match a line containing only the string “hello”:

/^hello$/

Match all trailing blanks (including zero) on a line:

/  *$/

Match all characters (including zero) on a line:

/^.*$/

Match a number like “3”, “862”, etc:

/[0-9][0-9]*/

Match a C language identifier:

/[a-z_][a-z_0-9]*/

Match a digit in column ten:

/@(10)[0-9]/

Match an empty line:

/^^$/

Match a line containing only blanks:

/^^*$/

Match a line starting with a period followed by a name (such as a command in the QNX2 DOC markup language):

/^\.[a-z][a-z]*/

Command Reference:

The pages following detail the all available editor commands, in alphabetical order.


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/qed_manual/reference.html on line 625

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/qed_manual/reference.html on line 625