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.
A.5.3 Specifying a Debug File
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.6 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.
A.6.1 Entering DECTPU Commands
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.6.2 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, Digital
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.
A.6.3 Rules for Writing EVE Command Procedures
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.6.5 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.
A.6.6 Example: Creating DECTPU Procedures
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.7 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.
A.7.1 Startup Section Files
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.
A.7.2 Modifying Section Files
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.
A.7.5 Section Files Execution
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.8 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.
A.8.1 Command File Usage
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.8.2 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.9 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.
A.8.3 Converting Command Files
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 Section A.8.7. To convert the command file to a section file, invoke EVE with the /COMMAND qualifier. For example:
$ EDIT/TPU/COMMAND=MY_COMMANDSEVE executes the commands in the file and saves the compiled procedures and key definitions in the TPU$SECTION file that you name in the SAVE statement. The QUIT statement terminates the editor, returning control to the DCL prompt. At this point, you have a new section file. Therefore, on invoking EVE, the editor automatically reads the section file that you have defined in your LOGIN.COM or in your SYSLOGIN directory.
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.8.4 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.
A.8.5 Default Files Specification
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.8.6 Rules for Writing Command Files
Keep in mind the following rules and suggestions when writing command files:
SET LEFT MARGIN 10
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:
Rather than defining keys or setting the characteristics of an editing session interactively, you can put EVE commands and key definitions in an initialization file. You can execute an initialization file when invoking EVE or during an editing session by using the execute procedure (@) command. For example,
Command: @SETUP_INIT
The following rules apply when creating initialization files:
This is an example of an initialization file:
SET TABS EVERY 5 SET LEFT MARGIN 15 SET RIGHT MARGIN 75 OVERSTRIKE MODE DEFINE KEY=Ctrl/D ERASE WORD DEFINE KEY=GOLD W START OF LINE DEFINE KEY=KP5 FILL PARAGRAPH ! !Binds the EDT forward function (KP4 on !EDT keypad) to GOLD F ! DEFINE KEY=GOLD F EDT KP4
You can specify an initialization file with the /INITIALIZATION qualifier, defined as EVE$INIT in your LOGIN.COM file or named EVE$INIT.EVE in your SYS$LOGIN directory. The following command invokes EVE with the initialization file named MY_INIT:
$ EDIT/TPU/INIT=WORK1:[ALEXIS]MY_INIT
By default, DECTPU uses the initialization file whose logical name is EVE$INIT. If you define this logical name in your LOGIN.COM file, DECTPU automatically uses your initialization file when you invoke EVE. For example, you could insert the following command in your LOGIN.COM file:
$ DEFINE EVE$INIT WORK1:[ALEXIS]MY_INIT.EVE
When EVE starts up, it looks first for a section file, then for a
command file, and finally for an initialization file. Because an
initialization file is executed after a section file and a command
file, the definitions in an initialization file override those in a
section file or a command file. For this reason, place commands that
define the editing environment in either your command file or your
initialization file.
A.9.5 Commands That Define the Environment
Commands that define the environment include the following:
You can save key definitions, learn sequences, and DECTPU procedures in
a startup file. With a startup file, you can save all the modifications
you have made to EVE so you do not have to recreate your modifications
at each editing session.
A.10.1 Types of Startup Files
EVE has three types of startup files:
6489P039.HTM OSSG Documentation 22-NOV-1996 13:17:36.21
Copyright © Digital Equipment Corporation 1996. All Rights Reserved.