beautypg.com

1 simple programs, 2 complex programs, Example 5–1 show (summary) display – Compaq DEC Text Processing Utility AA-PWCBD-TE User Manual

Page 102

background image

DEC Text Processing Utility Program Development
5.1 Creating DECTPU Programs

You can use executable statements either within procedures or outside
procedures. You must place all procedure declarations before any executable
statements that are not in procedures.

You can enter DECTPU statements from within EVE by using the EVE
command TPU. For more information on using this command, see the
Extensible Versatile Editor Reference Manual.

5.1.1 Simple Programs

The following statement is an example of a simple program:

SHOW (SUMMARY);

The preceding statement, entered after the appropriate prompt from your editor,
causes DECTPU to execute the program associated with the SHOW (SUMMARY)
statement. If you use EVE with a user-written command file, your screen may
display text similar to Example 5–1.

Example 5–1 SHOW (SUMMARY) Display

DECTPU V3.1

1993-08-17 08:37

Journal file:

Section file name: EVE$SECTION

Ident: V3.1

Date: 17-AUG-1993 08:49

Activated from: TPU$SECTION

Created by: DECTPU V3.1

1993-08-17 08:37

Extension: SCREEN_UPDATER

Ident: DECTPU V3.1

1993-08-17 08:37

Timer Message:

working

24 System buffers and 1 User buffer

5.1.2 Complex Programs

When writing complex DECTPU programs, avoid the following practices:

Creating large procedures

Creating large number of procedures

Including a large number of executable statements that are not within
procedures

These practices, if carried to extremes, can cause the parser stack to overflow.

The DECTPU parser currently allows a maximum stack depth of 1000 syntax
tree nodes. When the parser first encounters a DECTPU statement, the parser
assigns each token in the statement to a syntax tree node. For example, the
statement ‘‘a := 1’’ contains three tokens, each of which occupies a syntax tree
node. After the parser parses this statement, only the assignment statement
remains on the stack of nodes. The a and the 1 are subtrees to the assignment
syntax tree node.

The most common cause of stack overflow, which is signaled by the status TPU$_
STACKOVER, is creating one or more large procedures whose statements occupy
too many syntax tree nodes. To make your program manageable by the parser,
break the large procedures into smaller ones.

5–2 DEC Text Processing Utility Program Development