Artifact 08a558d0a2357497f206b90ce6a8224db14a4736b5a993ef24db77fc57914059:
- Executable file
r37/lisp/csl/html/r37_0680.html
— part of check-in
[f2fda60abd]
at
2011-09-02 18:13:33
on branch master
— Some historical releases purely for archival purposes
git-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/trunk/historical@1375 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: arthurcnorman@users.sourceforge.net, size: 8814) [annotate] [blame] [check-ins using] [more...]
<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><integer> or <em>ed</em> <P> <P> <P> <em>ed</em>called with no argument edits the last input statement. If <integer> 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>></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<digit> 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 <digit> 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<char> Find the next occurrence of the character <char> 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<string><em>ESC</em> Insert <string> 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<char> Replace the character at the pointer by <char>. <P> <P> _ _ _ s<string><em>ESC</em> Search for the first occurrence of <string> 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 <or space> 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> _ _ _ - <(minus)> 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: >>x**2 + y; X^{2} + Y 3: >>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: >>procedure dumb(a); >>write a; DUMB 5: >>dumb(17); 17 6: >>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: >>dumb(17); 27 8: >> </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>