Artifact b97a4b89f1ac295e7cd7589e93b6ae383971ac990a3c2262b5588e18cfb3561e:
- File
r36/help/outmode.tex
— part of check-in
[152fb3bdbb]
at
2011-10-17 17:58:33
on branch master
— svn:eol-style, svn:executable and line endings for files
in historical/r36 treegit-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/trunk/historical@1480 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: schoepf@users.sourceforge.net, size: 8603) [annotate] [blame] [check-ins using] [more...]
\section{Outmoded Operations} \begin{Command}{ED} The \name{ed} command invokes a simple line editor for REDUCE input statements. \begin{Syntax} \name{ed} \meta{integer} or \name{ed} \end{Syntax} \name{ed} called with no argument edits the last input statement. If \meta{integer} is greater than or equal to the current line number, an error message is printed. Reenter a proper \name{ed} command or return to the top level with a semicolon. 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 \name{^}) 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 \name{>}. 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 \key{ESC} must be the last command before the carriage return. \begin{itemize} \item[b] Move pointer to beginning of current line. \item[d\meta{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 \meta{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. \item[e] End the current session, causing the edited expression to be reparsed by REDUCE. \item[f\meta{char}] Find the next occurrence of the character \meta{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. \item[i\meta{string}\key{ESC}] Insert \meta{string} in front of pointer. The \key{ESC} key is your delimiter for the input string. No other command may follow this one on the same line. \item[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. \item[l] Finish editing this line and move to the last previous line. An error message is printed if there is no previous line. \item[n] Finish editing this line and move to the next line. An error message is printed if there is no next line. \item[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. \item[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 \nameref{input} \name{ed} will find anything under the current number. \item[r\meta{char}] Replace the character at the pointer by \meta{char}. \item[s\meta{string}\key{ESC}] Search for the first occurrence of \meta{string} to the right of the pointer on the current line and move the pointer to its first character. The \key{ESC} 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. \item[x \meta{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. \item[- \meta{(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. \item[?] Display the Help menu, showing the commands and their actions. \end{itemize} \begin{Examples} \explanation{(Line numbers are shown in the following examples)} \\ 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: >> & \end{Examples} \begin{Comments} Note that REDUCE reparsed the procedure \name{dumb} and updated the definition. 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. 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. 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. 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 \name{( ) # ; ' `} 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. 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. Since the editor has no dependence on any window system, it can be used if you are running REDUCE without windows. \end{Comments} \end{Command} \begin{Command}{EDITDEF} The interactive editor \nameref{ed} may be used to edit a user-defined procedure that has not been compiled. \begin{Syntax} \name{editdef}(\name{identifier}) \end{Syntax} where \name{identifier} is the name of the procedure. When \name{editdef} is invoked, the procedure definition will be displayed in editing mode, and may then be edited and redefined on exiting from the editor using standard \nameref{ed} commands. \end{Command}