beautypg.com

5 using section files – Compaq DEC Text Processing Utility AA-PWCBD-TE User Manual

Page 119

background image

DEC Text Processing Utility Program Development

5.6 Using DECTPU Startup Files

5.6.5 Using Section Files

A section file is the binary form of a program that implements a DECTPU-based
editor or application. It is a collection of compiled DECTPU procedure definitions,
variable definitions, and key bindings. The advantage of using a binary file is
that the source code does not have to be compiled each time you invoke the editor
or application, so startup performance is improved.

5.6.5.1 Creating and Processing a New Section File

To create a section file, begin by writing a program in the DECTPU language.
The program must adhere to all the programming conventions discussed
throughout this manual. For examples of programs used to create a section
file, see the files in the directory SYS$EXAMPLES. This directory contains the
sources used to create the EVE section file. To see a list of the EVE source files,
type the following:

$ DIR SYS$EXAMPLES:EVE$*.TPU

If you cannot find these files on your system, see your system manager.

When writing the DECTPU program that implements your application, place your
initializing statements in a procedure named TPU$INIT_PROCEDURE. Such
statements might create buffers, create windows, associate windows with buffers,
set up screen attributes, initialize variables, define how the journal facility works,
and so on. You can put the procedure TPU$INIT_PROCEDURE anywhere
in the procedure declaration portion of your program. DECTPU executes
TPU$INIT_PROCEDURE before executing the command file (if there is one).
For more information on DECTPU’s initialization sequence, see Section 5.6.4.

Place any statements that implement or handle initialization files in a procedure
named TPU$INIT_POSTPROCEDURE. DECTPU executes this procedure
after both the TPU$INIT_PROCEDURE and the command file have been
executed. This enables commands or definitions in the initialization file to modify
commands or definitions in the command file. EVE defines both TPU$INIT_
PROCEDURE and TPU$INIT_POSTPROCEDURE procedures. For more
information on how EVE implements initialization files, see Section 5.6.7.

After you put the desired DECTPU procedures and statements into the
program that implements your application, end your program with the following
statements:

A statement that contains the SAVE built-in procedure. SAVE is the
mechanism by which you store all currently defined procedures, variables,
and bound keys in binary form.

The QUIT built-in procedure. QUIT ends the DECTPU session.

For more information on SAVE and QUIT, see the descriptions of these built-ins
in the DEC Text Processing Utility Reference Manual. For examples of files that
use these statements, see Example 5–4 and Example 5–5.

To compile your program into a section file, invoke DECTPU but do not supply
as a parameter the name of a file to be edited. Use the /NOSECTION qualifier
to indicate that no existing section file should be loaded. Use the /COMMAND
qualifier to specify the file that contains your program. For example, to create a
section file from a program in a file called my_application.tpu, enter the following
at the DCL prompt:

$ EDIT/TPU/NOSECTION/COMMAND=my_application.tpu

DEC Text Processing Utility Program Development 5–19