Updated: 11 December 1998 |
OpenVMS User's Manual
Previous | Contents | Index |
The prompt for the command file name shows, in brackets, the default command file that EVE uses if you press the Return key at the prompt without typing a file name. This default is one of the following:
You can set your preferred default command file --- that is, the command file you want EVE to create or update without having to specify the file each time you save attributes. For example, the following command sets your default command file as MYCOM in your current directory:
Command: SET DEFAULT COMMAND FILE MYCOM |
If you want to save in a command file rather than in a section file, you should also use the SET NOSECTION FILE PROMPTING command. Then, when you save attributes, EVE asks whether to save in a command file without first asking whether to save in a section file.
Typically, when you use SET DEFAULT COMMAND FILE, you specify the command file you are going to use at startup for future editing sessions. The command does not determine the command file to be executed when you invoke EVE, but only the command file in which you save attributes and menu definitions.
For more information about creating and using command files, see the
EVE online help topic called Command Files.
A.3.8 Saving EVE Default Attributes
The SAVE SYSTEM ATTRIBUTES command saves EVE default settings and menu entries in a section file or command file. Thus, if you set several attributes and defined or undefined menu entries, you can use SAVE SYSTEM ATTRIBUTES to restore the standard EVE settings and menus to your section file or command file.
SAVE SYSTEM ATTRIBUTES does not change the settings currently in effect
--- for example, it does not enable free cursor motion or invisible
tabs --- but saves only the EVE defaults in a section file or command
file.
A.4 Using DECTPU Within EVE
You can use DECTPU within EVE to create DECTPU command files and to use the DECTPU debugging package.
File creation switches and qualifiers determine whether DECTPU creates a buffer when it does not find the input file. The processing results of using this qualifier depend on the DECTPU application you are using.
In EVE, files are created by default. If the input file does not exist,
EVE uses the input file name and file type to create the buffer name.
If you do not specify an input file, EVE creates a buffer named Main.
A.4.1 Creating DECTPU Command Files
To create DECTPU command files, use the /CREATE or /NOCREATE qualifiers, as follows:
$ EDIT/TPU /CREATE (default) $ EDIT/TPU /NOCREATE |
Use the /NOCREATE qualifier to avoid invoking the editor in case you mistype the input file specification or to edit only an existing file.
If EVE does not find an input file you have specified, it terminates the editing session and returns you to the system level, as in the following example:
$ EDIT/TPU NEW.DAT /NOCREATE Input file does not exist: NEW.DAT; |
Debug switches and qualifiers determine whether DECTPU runs a debug file. A debug file is useful for testing procedures for an application that you are creating.
To edit the code in the file you are debugging, follow these rules:
The debugger that is supplied with DECTPU is in SYS$SHARE:TPU$DEBUG.TPU. This file provides commands to manipulate variables and to control program execution.
There are two ways to specify a debug file of your own:
$ EDIT/TPU MYPROCS.TPU /DEBUG=MYDEBUG |
For more information about the DECTPU debugging package, read the
comments in the source file or see the DEC Text Processing Utility Reference Manual.
A.5 Using DECTPU Procedures to Extend EVE
The EVE editor is built on the DEC Text Processing Utility (DECTPU). With the EVE command TPU, you can enter any DECTPU statement or series of statements that can be expressed on one command line.
To enter a DECTPU command, enter the command TPU followed by the DECTPU statement you want to execute. For example, to execute the DECTPU statement APPEND_LINE, which places the current line at the end of the previous line, enter the following command string:
Command: TPU APPEND_LINE |
For more information about the TPU command, type HELP TPU. See the
DEC Text Processing Utility Reference Manual for a complete list of DECTPU statements and procedures.
A.5.1 Writing DECTPU Procedures
Because EVE is an editor written in the DECTPU programming language, you can extend EVE functions by writing procedures in DECTPU. This section assumes that you are familiar with the DECTPU programming language described in the DEC Text Processing Utility Reference Manual.
Before you begin writing DECTPU procedures to modify EVE, Compaq recommends that you study the EVE source code, which is stored in SYS$EXAMPLE:EVE$*.TPU. (The wildcard character (*) in the file specification indicates that EVE source code is stored in many files.) These files are put together by using EVE$BUILD. Variables and statements in your procedures should be consistent with EVE variables and statements so that you can avoid making changes that adversely affect EVE operations.
You can write procedures in the DECTPU programming language that are, in effect, new EVE commands. When you write new EVE command procedures, follow these rules:
This is an example of a global variable definition for command parameters:
EVE$ARG1_ADD := "INTEGER"; |
EVE$ARG1_HELLO := "STRING"; |
The integer variables are required.
A.5.2 Compiling DECTPU Procedures
The EXTEND EVE command enables you to compile a DECTPU procedure without leaving EVE. To compile the procedure that the cursor is in, use the EXTEND THIS command. To compile one procedure, enter the command EXTEND EVE and the name of the procedure you want to compile. To compile all procedures in a file, enter the command EXTEND EVE * (which is the same as the EVE command EXTEND ALL). If you miss a message from the compiler, use the command BUFFER MESSAGES to read the messages stored in the Messages buffer.
The following example illustrates how to create and compile DECTPU procedures to define an ADD command, a HELLO command, and the parameters for both commands. Invoke EVE to edit the file MYPROCEDURES.TPU and insert the following text into the file:
! Procedure to add two integers and display the result in the ! message window PROCEDURE EVE_ADD (A1, A2) LOCAL TEMP, N1, N2; IF NOT EVE$PROMPT_NUMBER (A1, N1, "First number to add: ", "No number specified.") THEN RETURN (FALSE); ENDIF; IF NOT EVE$PROMPT_NUMBER (A2, N2, "Second number to add: ", "No number specified.") THEN RETURN (FALSE); ENDIF; TEMP := N1 + N2; MESSAGE (STR (N1) + " + " + STR (N2) + " = " + STR (TEMP)); RETURN (TRUE); ENDPROCEDURE; PROCEDURE EVE_HELLO (MY_NAME) LOCAL THE_NAME; IF EVE$PROMPT_STRING (MY_NAME, THE_NAME, "Name: ", "We haven't met") THEN MESSAGE ("Hello " + THE_NAME); RETURN (TRUE); ELSE RETURN (FALSE); ENDIF; ENDPROCEDURE; EVE$ARG1_ADD := "INTEGER"; EVE$ARG2_ADD := "INTEGER"; |
Use the syntax shown in the file MYPROCEDURES.TPU to put the definitions for the two parameter variables in your TPU$LOCAL_INIT procedure.
To compile the procedures you have entered into MYPROCEDURES.TPU, press
the Do key, type EXTEND EVE *, and press the Return key. If you are
going to use the newly compiled commands in the current editing
session, you must execute TPU$LOCAL_INIT by entering the command TPU
TPU$LOCAL_INIT.
A.6 Creating Section Files
A section file contains key definitions, learn sequences, and compiled DECTPU statements and procedures in binary form. Because section files are in binary form, they set up the editing environment very quickly, but you cannot display or edit a binary file. Use a section file to implement editing features that are not likely to change from one editing session to another. The default file type for section files is .TPU$SECTION.
EVE requires a section file for startup. By default, EVE uses the section file EVE$SECTION.TPU$SECTION located in directory SYS$SHARE. This default section file defines the editing keys, shown in Figure 8-1 and Figure 8-2, as well as the standard EVE commands.
Rather than use the default section file, you can create a modified section file that contains the standard EVE functions as well as your own key definitions, learn sequences, and editing functions. You can create a section file in two ways:
To use a section file, specify the section file name with the /SECTION qualifier on the EVE command line. For example, the following command invokes EVE with a section file named MY_SECTION.TPU$SECTION, located in directory ALEXIS on a disk called WORK1:
$ EDIT/TPU/SECTION=WORK1:[ALEXIS]MY_SECTION |
By default, DECTPU uses the section file whose logical name is TPU$SECTION. If you define this logical name in your LOGIN.COM file, DECTPU automatically uses your section file when you invoke EVE. For example:
$ DEFINE TPU$SECTION WORK1:[ALEXIS]MY_SECTION.TPU$SECTION |
Use the EVE command SHOW SUMMARY to display the name of the current section file.
EVE executes a section file before a command file or an initialization
file. Therefore, definitions in the command file and initialization
file override section file definitions. When you want to set the
characteristics of the editing environment, use either a command file
or an initialization file. EVE executes these commands upon startup, so
the appearance of the buffer and the editing mode is adjusted according
to your definition.
A.7 Creating Command Files
A command file is a source program that contains DECTPU procedures and executable statements. A DECTPU procedure is a set of related DECTPU statements that are executed when the procedure name is invoked. The statements and procedures define what happens when you press a key or enter a command. The default file type for command files is .TPU.
When you use an EVE command, you are actually invoking a compiled DECTPU procedure. For example, the EVE command SET KEYPAD EDT invokes the EVE_SET_KEYPAD_EDT procedure in the standard EVE section file.
EVE executes a command file after a section file. For this reason, any key definitions or procedures defined in a command file override those in a section file.
There are two different ways to use a command file. A command file can
create an editing environment that is independent of the section file,
or a command file can be used to produce a new section file.
A.7.1 Setting Editing Defaults
Whenever you want to set editing defaults, use a command file because EVE executes the statements in the command file (or initialization file) at startup and applies the new defaults. See Section A.8 for a list of commands that set the editing environment. For example, you can use one command file to set up margins and tabs and a header for a memo and another command file to set tabs suitable for writing a financial report.
To create a command file, invoke EVE and specify a file name with the file type .TPU, such as MY_COMMAND.TPU. Once in the editor, enter DECTPU statements and procedures.
If you intend to use a command file to create a section file, conclude the file with the SAVE and QUIT statements and include a file specification for the section file, as shown in EVE Command File. To convert the command file to a section file, invoke EVE with the /COMMAND qualifier. For example:
$ EDIT/TPU/COMMAND=MY_COMMANDS |
One advantage of creating a section file from a command file is that a
command file can be easily edited. This is especially important when
you want to add DECTPU procedures or add a large number of key
definitions.
A.7.2 Adding Functions to the EVE Editor
To use a command file to set the characteristics of the editing environment and add functions to the standard EVE editor, again invoke EVE with the /COMMAND qualifier. For example:
$ EDIT/TPU/COMMAND=DATA_SETUP |
EVE again executes the statements in the command file but because there is no SAVE statement, the compiled procedures and key definitions are not saved.
If you do not include a command qualifier, EVE searches for the file
specified by the logical name TPU$COMMAND. You can define this logical
name in your LOGIN.COM file. If this file is not found, DECTPU then
searches for a file named TPU$COMMAND.TPU in the current directory.
A.7.2.1 Rules for Writing Command Files
Keep in mind the following rules and suggestions when writing command files:
SET LEFT MARGIN 10 |
The DECTPU format is as follows:
eve_set_left_margin(10); |
The following example shows a command file that modifies EVE to be more like the EDT editor. This file creates a personal section file named MY_SECTION.TPU$SECTION.
!********************************************************************* !Command file making EVE more like EDT !and implementing personal customizations !********************************************************************* !Procedure to delete a line and close the gap left by the deletion (1) PROCEDURE EVE_ZAPLINE EVE_END_OF_LINE; EVE_ERASE_START_OF_LINE; (2) EVE_DELETE; ENDPROCEDURE !Procedure to move the cursor to the beginning of the next paragraph: PROCEDURE EVE_NEXT_PARAGRAPH (3) LOCAL PAT1, THE_RANGE; PAT1 := line_begin + line_begin + ARB (1); THE_RANGE := SEARCH_QUIETLY (PAT1, forward, exact); IF THE_RANGE <> 0 THEN POSITION (END_OF (THE_RANGE)); RETURN (TRUE); (4) ELSE RETURN (FALSE); ENDIF; ENDPROCEDURE !Procedure to make EVE behave more like EDT PROCEDURE EVE_MIMIC_EDT EVE_SET_KEYPAD_EDT; EVE_SET_CURSOR_BOUND; EVE_SET_LEFT_MARGIN(10); (5) ENDPROCEDURE !Procedure to transpose two characters PROCEDURE EVE_TRANSPOSE LOCAL WHACK; WHACK := ERASE_CHARACTER (1); MOVE_HORIZONTAL (1); COPY_TEXT (WHACK); RETURN (TRUE); ENDPROCEDURE !Procedure to make both the screen width and the right margin narrow PROCEDURE EVE_NARROW_SCREEN EVE_SET_WIDTH (80); EVE_SET_RIGHT_MARGIN (79); ENDPROCEDURE; !Procedure to make both the screen width and the right margin wide PROCEDURE EVE_WIDE_SCREEN EVE_SET_WIDTH (132); EVE_SET_RIGHT_MARGIN (131); ENDPROCEDURE; !Procedure to toggle screen width and right margin from !the current setting to the other setting, for example to !change to wide if narrow, change to narrow if wide PROCEDURE EVE_CHANGE_WIDTH (6) IF GET_INFO (SCREEN, "width") <> 80 THEN EVE_NARROW_SCREEN; ELSE EVE_WIDE_SCREEN; ENDIF; ENDPROCEDURE; PROCEDURE TPU$LOCAL_INIT (7) EVE_MIMIC_EDT; (8) EVE$DEFINE_KEY ("EVE_NEXT_PARAGRAPH", CTRL_P_KEY, "Next Para", EVE$X_USER_KEYS); (9) EVE$DEFINE_KEY("EVE_ZAPLINE", KEY_NAME ("O", SHIFT_KEY), "Zap Line", EVE$X_USER_KEYS); (10) EVE$DEFINE_KEY ("EVE_TWO_WINDOWS", F17, "Two Windows", EVE$X_USER_KEYS); (11) EVE$DEFINE_KEY ("EVE_OTHER_WINDOW", CTRL_G_KEY, "Other Window", EVE$X_USER_KEYS); (12) EVE$DEFINE_KEY ("EVE_GET_FILE('')", KEY_NAME (KP6, SHIFT_KEY), "Get File", EVE$X_USER_KEYS); (13) EVE$DEFINE_KEY ("EVE_TRANSPOSE", KEY_NAME (F20, SHIFT_KEY), "Transpose", EVE$X_USER_KEYS); (14) ENDPROCEDURE TPU$LOCAL_INIT; (15) SAVE ("WORK:[LINCOLN]MY_SECTION.TPU$SECTION"); (16) QUIT; (17) |
As you examine the example, note the following:
Previous | Next | Contents | Index |
Copyright © Compaq Computer Corporation 1998. All rights reserved. Legal |
6489PRO_052.HTML
|