File r37/lisp/csl/html/r37_0680.html artifact 08a558d0a2 part of check-in 237b3683c0



<A NAME=ED>

<TITLE>ED</TITLE></A>
<b><a href=r37_idx.html>INDEX</a></b><p><p>



<B>ED</B> _ _ _  _ _ _  _ _ _  _ _ _ <B>command</B><P>
<P>
 
The <em>ed</em> command invokes a simple line editor for REDUCE input 
statements. 
<P>
<P>
 <P> <H3> 
syntax: </H3>
<em>ed</em>&lt;integer&gt; or <em>ed</em> 
<P>
<P>
<P>
<em>ed</em>called with no argument edits the last input statement. If 
&lt;integer&gt; is greater than or equal to the current line number, an error 
message is printed. Reenter a proper <em>ed</em> command or return to the 
top level with a semicolon. 
<P>
<P>
The editor formats REDUCE's version of the desired input statement, 
dividing it into lines at semicolons and dollar signs. The statement is 
printed at the beginning of the edit session. The editor works on one 
line at a time, and has a pointer (shown by <em>^</em>) to the current 
character of that line. When the session begins, the pointer is at the 
left hand side of the first line. The editing prompt is <em>&gt;</em>. 
<P>
<P>
The following commands are available. They may be entered in either upper 
or lower case. All commands are activated by the carriage return, which 
also prints out the current line after changes. Several commands can be 
placed on a single line, except that commands terminated by an <em>ESC</em> 
must be the last command before the carriage return. 
<P>
<P>
 _ _ _ b 
Move pointer to beginning of current line. 
<P>
<P>
 _ _ _ d&lt;digit&gt; 
Delete current character and next (digit-1) characters. An error message 
is printed if anything other than a single digit follows d. If there are 
fewer than &lt;digit&gt; characters left on the line, all but the final 
dollar sign or semicolon is removed. To delete a line completely, use the 
k command. 
<P>
<P>
 _ _ _ e 
End the current session, causing the edited expression to be reparsed by 
REDUCE. 
<P>
<P>
 _ _ _ f&lt;char&gt; 
Find the next occurrence of the character &lt;char&gt; to the right of the 
pointer on the current line and move the pointer to it. If the character is 
not found, an error message is printed and the pointer remains in its 
original position. Other lines are not searched. The f command is not 
case-sensitive. 
<P>
<P>
 _ _ _ i&lt;string&gt;<em>ESC</em> 
Insert &lt;string&gt; in front of pointer. The <em>ESC</em> key is your 
delimiter for the input string. No other command may follow this one on 
the same line. 
<P>
<P>
 _ _ _ k 
Kill rest of the current line, including the semicolon or dollar sign 
terminator. If there are characters remaining on the current line, and it 
is the last line of the input statement, a semicolon is added to the line 
as a terminator for REDUCE. If the current line is now empty, one of the 
following actions is performed: If there is a following line, it becomes 
the current line and the pointer is placed at its first character. If the 
current line was the final line of the statement, and there is a previous 
line, the previous line becomes the current line. If the current line was 
the only line of the statement, and it is empty, a single semicolon is 
inserted for REDUCE to parse. 
<P>
<P>
 _ _ _ l 
Finish editing this line and move to the last previous line. An error message 
is printed if there is no previous line. 
<P>
<P>
 _ _ _ n 
Finish editing this line and move to the next line. An error message is 
printed if there is no next line. 
<P>
<P>
 _ _ _ p 
Print out all the lines of the statement. Then a dotted line is printed, and 
the current line is reprinted, with the pointer under it. 
<P>
<P>
 _ _ _ q 
Quit the editing session without saving the changes. If a semicolon is 
entered after q, a new line prompt is given, otherwise REDUCE prompts you 
for another command. Whatever you type in to the prompt appearing after 
the q is entered is stored as the input for the line number in which you 
called the edit. Thus if you enter a semicolon, neither 
<A HREF=r37_0232.html>input</A> 
<em>ed</em> will find anything under the current number. 
<P>
<P>
 _ _ _ r&lt;char&gt; 
Replace the character at the pointer by &lt;char&gt;. 
<P>
<P>
 _ _ _ s&lt;string&gt;<em>ESC</em> 
Search for the first occurrence of &lt;string&gt; to the right of the 
pointer on the current line and move the pointer to its first character. 
The <em>ESC</em> key is your delimiter for the input string. The s function 
does not search other lines of the statement. If the string is not found, 
an error message is printed and the pointer remains in its original 
position. The s command is not case-sensitive. No other command may 
follow this one on the same line. 
<P>
<P>
 _ _ _ x &lt;or space&gt; 
Move the pointer one character to the right. If the pointer is already at 
the end of the line, an error message is printed. 
<P>
<P>
 _ _ _ - &lt;(minus)&gt; 
Move the pointer one character to the left. If the pointer is already at the 
beginning of the line, an error message is printed. 
<P>
<P>
 _ _ _ ? 
Display the Help menu, showing the commands and their actions. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<P><PRE><TT></TT></PRE><P>(Line numbers are shown in the following examples)<P>
<PRE><TT> 

2: &gt;&gt;x**2 + y; 

X^{2} + Y 

3: &gt;&gt;ed 2; 

  X**2 + Y; 

  ^ 

For help, type '?' 

?-                  (Enter three spaces and key{Return}) 

  X**2 + Y; 

     ^ 

?- r5 

  X**5 + Y; 

     ^ 

?- fY 

  X**5 + Y; 

	 ^ 

?- iabc (Terminate with key{ESC} and key{Return}) 

  X**5 + abcY; 

	    ^ 

?- ---- 

  X**5 + abcY; 

	^ 

?- fbd2 

  X**5 + aY; 

	  ^ 

?- b 

  X**5 + aY; 

  ^ 

?- e 

AY + X^{5} 

4: &gt;&gt;procedure dumb(a); 

&gt;&gt;write a; 

DUMB 

5: &gt;&gt;dumb(17); 

17 

6: &gt;&gt;ed 4; 

  PROCEDURE DUMB (A); 

  ^ 

WRITE A; 

?- fArBn 

  WRITE A; 

  ^ 

?- ibegin scalar a; a := b + 10; (Type a space, key{ESC}, and key{Return}) 

  begin scalar a; a := b + 10; WRITE A; 

?- f;i end key{ESC}, key{Return} 

  begin scalar b; b := a + 10; WRITE A end; 

					  ^ 

?- p 

 PROCEDURE DUMB (B); 

 begin scalar b; b := a + 10; WRITE A end; 

 -  -  -  -  -  -  -  -  -  - 

  begin scalar b; b := a + 10; WRITE A end; 

					  ^ 

?- e 

DUMB 

7: &gt;&gt;dumb(17); 

27 

8: &gt;&gt; 

</TT></PRE><P> 
<P>
<P>
Note that REDUCE reparsed the procedure <em>dumb</em> and updated the 
definition. 
<P>
<P>
Since REDUCE divides the expression to be edited into lines at semicolons or 
dollar sign terminators, some lines may occupy more than one line of screen 
space. If the pointer is directly beneath the last line of text, it 
refers to the top line of text. If there is a blank line between the 
last line of text and the pointer, it refers to the second line 
of text, and likewise for cases of greater than two lines of text. In other 
words, the entire REDUCE statement up to the next terminator is printed, even 
if it runs to several lines, then the pointer line is printed. 
<P>
<P>
You can insert new statements which contain semicolons of their own into the 
current line. They are run into the current line where you placed them 
until you edit the statement again. REDUCE will understand the set of 
statements if the syntax is correct. 
<P>
<P>
If you leave out needed closing brackets when you exit the editor, a message 
is printed allowing you to redo the edit (you can edit the previous line 
number and return to where you were). If you leave out a closing 
double-quotation mark, an error message is printed, and the editing must be 
redone from the original version; the edited version has been destroyed. 
Most syntax errors which you inadvertently leave in an edited statement are 
caught as usual by the REDUCE parser, and you will be able to re-edit the 
statement. 
<P>
<P>
When the editor processes a previous statement for your editing, escape 
characters are removed. Most special characters that you may use in 
identifiers are printed in legal fashion, prefixed by the exclamation 
point. Be sure to treat the special character and its escape as a pair in 
your editing. The characters <em>( ) # ; ' `</em> are different. Since 
they have special meaning in Lisp, they are double-escaped in the editor. 
It is unwise to use these characters inside identifiers anyway, due to the 
probability of confusion. 
<P>
<P>
If you see a Lisp error message during editing, the edit has been aborted. 
Enter a semicolon and you will see a new line prompt. 
<P>
<P>
Since the editor has no dependence on any window system, it can be used if you 
are running REDUCE without windows. 
<P>
<P>
<P>


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]