1 03/03/83  qedx, qx
  2 
  3 Syntax:  qx {-control_args} {macro_path} {macro_args}
  4 
  5 
  6 Function:  The qedx editor is used to create and edit ASCII segments.
  7 This description summarizes the editing requests and addressing
  8 features provided by qedx.  Complete tutorial information on qedx is
  9 available in the qedx Text Editor Users' Guide, Order No.  CG40.
 10 
 11 
 12 Arguments:
 13 macro_path
 14    specifies the pathname of a segment from which the editor is to take
 15    its initial instructions.  Such a set of instructions is commonly
 16    referred to as a macro.  The editor automatically concatenates the
 17    suffix qedx to path to obtain the complete pathname of the segment
 18    containing the qedx instructions.  The editor executes the qedx
 19    requests contained in the specified segment and then waits for you
 20    to type further requests.   If macro_path is omitted, the editor
 21    waits for you to type a qedx request.  The archive component
 22    pathname convention (::) is accepted.
 23 
 24 
 25 macro_args
 26    are optional arguments that are appended, each as a separate line,
 27    to the buffer named args (the first optional argument becomes the
 28    first line in the buffer and the last optional argument becomes the
 29    last line).  Arguments are used in conjunction with a macro
 30    specified by the macro_path argument.
 31 
 32 
 33 Control arguments:
 34 -pathname path, -pn path
 35    causes qedx to read the segment specified by path into buffer 0,
 36    simulating "r path", before executing a macro (see macro_path).
 37    This control argument must precede macro_path.  If no macro is
 38    specified, the user is placed in the editor request loop.  The
 39    archive component pathname convention (::) is accepted.
 40 -no_rw_path
 41    prevents the user from making read (r) or write (w) requests with a
 42    pathname.  All read and write requests affect the pathname specified
 43    by the -pathname control argument.  The -no_rw_path control argument
 44    is intended to be used within exec_coms which are providing a
 45    limited environment; the user is prevented from examining or
 46    altering segments other than the one specified with -pathname.
 47 
 48 
 49 Notes:  You can create and edit any number of segments with a single
 50 invocation of the editor as long as the contents of the buffer are
 51 deleted before work is started on each new segment.
 52 
 53 
 54 Notes on addressing:  Most editing requests are preceded by an address
 55 specifying the line or lines in the buffer on which the request is to
 56 operate.  Lines in the buffer can be addressed by absolute line number;
 57 relative line number, i.e., relative to the "current" line (+2 means
 58 the line that is two lines ahead of the current line, -2 means the line
 59 that is two lines behind); and context (locate the line containing /any
 60 string between these slashes/).  Current line is denoted by period (.);
 61 last line of buffer, by dollar sign ($).
 62 
 63 
 64 Notes on regular expressions:  The following characters have
 65 specialized meanings when used in a regular expression.  A regular
 66 expression is the character string between delimiters, such as in a
 67 substitute request, or a search string.  You can reinvoke the last used
 68 regular expression by giving a null regular expression (//).
 69 *
 70    signifies any number (or none) of the preceding character.
 71 ^
 72    when used as the first character of a regular expression, signifies
 73    the (imaginary) character preceding the first character on a line.
 74 $
 75    when used as the last character of a regular expression, signifies
 76    the (imaginary) character following the last character on a line.
 77 .
 78    matches any character on a line.
 79 
 80 
 81 List of escape sequence requests:
 82 \f
 83    exits from input mode and terminates the input request; returns the
 84    user in edit mode.  It is used constantly when editing a document,
 85    and is the key to understanding the difference between input mode
 86    and edit mode.
 87 \c
 88    suppresses the meaning of the escape sequence or special character
 89    following it.
 90 \b(X)
 91    redirects editor stream to read subsequent input from buffer X.
 92 \r
 93    temporarily redirects the input stream to read a single line from
 94    your terminal.
 95 
 96 
 97 Notes on requests:  In the list given below, editor requests are
 98 divided into four categories:  input requests, basic edit requests,
 99 extended edit requests, and buffer requests.  The input requests and
100 basic edit requests are sufficient to allow a user to create and edit
101 segments.  The extended requests give the user the ability to execute
102 commands in the Multics system without leaving the editor and also to
103 effect global changes.  Because the extended requests are, in general,
104 more difficult to use properly, they should be learned only after
105 mastering the input and basic edit requests.  The buffer requests
106 require a knowledge of auxiliary buffers.  (Since the nothing and
107 comment requests are generally used in macros, they are included with
108 the buffer requests.)  The buffer requests, used with any of the other
109 requests, and special escape sequences allow the user to make qedx
110 function as an interpretive programming language through the use of
111 macros.
112 
113 
114 The character given in parentheses is the actual character used to
115 invoke the request in qedx and does not always bear a relation to the
116 name of the request.  The second part of each entry shows the format,
117 default in parentheses, and brief description.  For the value of ADR,
118 see "Notes on Addressing" above; for the value of regexp, see "Notes on
119 Regular Expressions" above.
120 
121 
122 List of input requests:
123    These requests enter input mode and must be terminated with \f.
124 append (a)
125    ADRa (.a)
126       Enter input mode, append lines typed from the terminal after a
127       specified line.
128 change (c)
129    ADR1,ADR2c (.,.c)
130       Enter input mode, replace the specified line or lines with
131       lines typed from the terminal.
132 insert (i)
133    ADRi (.i)
134       Enter input mode, insert lines typed from the terminal before a
135       specified line.
136 
137 
138 List of basic edit requests:
139 delete (d)
140    ADR1,ADR2d (.,.d)
141       Delete specified line or lines from the buffer.
142 print (p)
143    ADR1,ADR2p (.,.p)
144       Print specified line or lines on the terminal; special case print
145       needs address only.
146 print-line-number (=)
147    ADR= (.=)
148       Print line number of specified line.
149 
150 
151 quit (q)
152    q  exits the editor but first checks for modified buffers.  If any
153       modified buffers are present, qedx will display their status and
154       ask for permission to exit.  If permission is granted, all
155       changes made to those buffers since they were last written will
156       be lost.
157 quit-force (qf) (Q)
158    qf exits the editor without checking for modified buffers.  If any
159       modified buffers are present, all changes made to those buffers
160       since they were last written will be lost.
161 
162 
163 read (r)
164    ADRr {path} ($r path)
165       appends the contents of the segment named path after the
166       specified line.  The archive component pathname convention (::)
167       is accepted.  If path is ommitted, a default pathname is used if
168       possible.  See "Notes of default pathnames" below for more
169       information.
170 substitute (s)
171    ADR1,ADR2s/regexp/string/ (.,.s/regexp/string/)
172       substitute every string matching regexp in the line(s) with
173       string.  If string contains &, & is replaced by the characters
174       which matched regexp.  First character after s is delimiter; it
175       can be any character not in either regexp or string.  Strings
176       matching regexp do not overlap and the result of substitution is
177       not rescanned.
178 
179 
180 write (w)
181    ADR1,ADR2w {path} (1,$w path)
182       writes the specified lines of the buffer into the segment named
183       path.  The archive component pathname convention (::) is not
184       accepted.  If path is ommitted, a default pathname is used if
185       possible; however, if the default pathname identifies an archive
186       component, an error message is printed.  See "Notes on default
187       pathnames" below for more information.
188 
189 
190 List of extended edit requests:
191 execute (e)
192    e <command line>
193       passes the remainder of a request line to the Multics command
194       processor without leaving the qedx editor.
195 global (g)
196    ADR1,ADR2gX/regexp/ (1,$gX/regexp/)
197       perform operation on lines that contain a match for regexp; X can
198       be d for delete, p for print, or = for print line numbers.
199 exclude (v)
200    ADR1,ADR2vX/regexp/ (1,$vX/regexp/)
201       perform operation on lines that do not contain a match for
202       regexp; X can be d for delete, p for print, or = for print line
203       numbers.
204 
205 
206 List of buffer requests:
207 buffer (b)
208    b(X)
209       switches all subsequent editor operations to the specified
210       buffer X.
211 move (m)
212    ADR1,ADR2m(X) (.,.m(X))
213       move line(s) from current buffer into buffer named X; destroy
214       old contents of buffer X.
215 status (x)
216    x
217       prints a summary status of all buffers currently in use.
218 
219 
220 nothing (n)
221    ADRn (.n)
222       does not perform a task; addresses a line with no other action.
223 comment (")
224    ADR" (.")
225       ignores rest of line; used for comments.
226 
227 
228 Notes on default pathnames: qedx maintains a default pathname for each
229 buffer.  This default pathname is used whenever a read (r) or write (w)
230 request is given without a pathname.
231 
232 Initially, the default pathname for a buffer is null; ie: any attempt
233 to read or write without a pathname results in an error message.
234 Whenever a read request is issued with a pathname and the buffer is
235 empty, qedx saves that pathname as the default for the buffer.
236 Whenever, a write request is issued with a pathname which writes the
237 entire contents of the buffer (ie: no address range is given), qedx
238 saves that pathname as the default for the buffer.
239 
240 
241 If a read request is given when the buffer is not empty or a write
242 request is given which does not write the entire buffer, qedx will
243 consider the default pathname of that buffer to no longer be
244 trustworthy.  The next use of the read or write requests without a
245 pathname in that buffer will cause qedx to ask for permission to use
246 the default pathname.  If permission is given, qedx will once again
247 consider the pathname to be trustworthy.
248 
249 
250 For example, given the following sequence --
251 
252      qedx
253      r first
254      r second
255      w
256 
257 qedx will ask for permission to write the buffer to the segment named
258 "first" because the "r second" request was issued when the buffer was
259 not empty.
260 
261 
262 On the other hand, if the following sequence were given --
263 
264      qedx
265      r first
266      <editing requests>
267      1,$d
268      r second
269      <editing requests>
270      w
271 
272 qedx will write the buffer to the segment named "second" without asking
273 permission because the buffer was empty when the "r second" request was
274 given.
275 
276 
277 Notes on spacing: The following rules govern the use of spaces in
278 editor requests.
279 1. Spaces are taken as literal text when appearing inside of regular
280    expressions.  Thus, /the n/ is not the same as /then/.
281 2. Spaces cannot appear in numbers, e.g., if 13 is written as 1 3, it
282    is interpreted as 1+3 or 4.
283 3. Spaces within addresses except as indicated above are ignored.
284 4. The treatment of spaces in the body of an editor request depends on
285    the nature of the request.
286 
287 
288 Responses from the editor:  In general, the editor does not respond
289 with output on the terminal unless explicitly requested to do so (e.g.,
290 with a print or print line number request).  The editor does not
291 comment when you enter or exit from the editor or change to and from
292 input and edit modes.  The use of frequent print requests is
293 recommended for new users of the qedx editor.  If you inadvertently
294 request a large amount of terminal output from the editor and wish to
295 abort the output without abandoning all previous editing, you can issue
296 the quit signal (by pressing the proper key on your terminal, e.g.,
297 BREAK, ATTN, INTERRUPT), and, after the quit response, you can reenter
298 the editor by invoking the program_interrupt (pi) command.  This action
299 causes the editor to abandon its printout, but leaves the value of "."
300 as if the printout had gone to completion.
301 
302 
303 If an error is encountered by the editor, an error message is printed
304 on your terminal and any editor requests already input (i.e., read
305 ahead from the terminal) are discarded.
306 
307 If you interrupt an invocation of qedx (eg: via use of the quit signal)
308 and invoke qedx again before using the "start", "program_interrupt", or
309 "release" commands, qedx will inform you that you have one or more
310 suspended invocations and ask if you wish to continue.  If you answer
311 "?" to this query, qedx will print an explanation of the implications
312 of answering "yes" to this query along with our recommendation of the
313 proper response to this situation.
314 
315 
316 Notes on macro usage:  You can place elaborate editor request sequences
317 (called macros) into auxiliary buffers and then use the editor as an
318 interpretive language.  This use of qedx requires a fairly detailed
319 understanding of the editor.  To invoke a qedx macro from command
320 level, you merely place your macro in a segment that has the letters
321 qedx as the last component of its name, then type:
322 
323 !  qedx macro_path macro_args
324 
325 
326 Notes on I/O switches:  While most users interact with the qedx editor
327 through a terminal, the editor is designed to accept input through the
328 user_input I/O switch and transmit output through the user_output I/O
329 switch.  These switches can be controlled (using the iox_ subroutine
330 described in the MPM Subroutines) to interface with other devices/files
331 in addition to the user's terminal.  For convenience, the qedx editor
332 description assumes that the user's input/output device is a terminal.