beautypg.com

Compaq DEC Text Processing Utility AA-PWCBD-TE User Manual

Page 122

background image

DEC Text Processing Utility Program Development
5.6 Using DECTPU Startup Files

Example 5–5 Source Code for Minimal Interface to DECTPU

! MINI.TPU - minimal DECTPU interface

PROCEDURE tpu$init_procedure

! Create a buffer and window for messages

message_buffer := CREATE_BUFFER ("Message Buffer");
SET (NO_WRITE, message_buffer);
SET (SYSTEM, message_buffer);
SET (EOB_TEXT, message_buffer, "");
message_window := CREATE_WINDOW (21, 4, OFF);
MAP (message_window, message_buffer);

! Create a buffer and window for SHOW

show_buffer := CREATE_BUFFER("Show Buffer");
SET (NO_WRITE, show_buffer);
SET (SYSTEM, show_buffer);
info_window := CREATE_WINDOW (1, 20, ON);

! Create a buffer and window for editing

main_buffer := CREATE_BUFFER ("Main Buffer");
main_window := CREATE_WINDOW (1, 20, ON);
MAP (main_window, main_buffer);

! Create an area on the screen for prompts

SET (PROMPT_AREA, 21, 1, NONE);

!Put the editing point in the main buffer

POSITION (main_buffer);
tpu$local_init;

ENDPROCEDURE;

PROCEDURE tpu$local_init

!Procedure to allow end users

!to add private extensions

ENDPROCEDURE;

! Define the minimal editing keys:

DEFINE_KEY ("SPLIT_LINE", RET_KEY);
DEFINE_KEY ("ERASE_CHARACTER(-1)", DEL_KEY);
DEFINE_KEY ("EXECUTE(READ_LINE(’DECTPU Statement: ’))", TAB_KEY);
DEFINE_KEY ("EXIT", Ctrl_Z_KEY);

! Create a section file and then quit

IF (get_info/system,("operating_system")=ULTRIX)
THEN

save(’/usr/user/jacki/mini.tpu_section’);

ELSE

save(’sys$login.mini);

ENDIF

QUIT;

! End of MINI.TPU

If you created the section file SYS$LOGIN:MINI.TPU$SECTION, you could use
the procedures and definitions in that file as an interface to DECTPU. To invoke
DECTPU with SYS$LOGIN:MINI.TPU$SECTION as the MINI section file, use
the following command:

$ EDIT/TPU/SECTION=SYS$LOGIN:MINI your_text.fil

You can define the logical name TPU$SECTION to point to your section file. By
default, DECTPU looks for a file that TPU$SECTION points to and reads that
file as the default section file.

5–22 DEC Text Processing Utility Program Development