A sample dectpu procedures, A.1 line-mode editor, Example a–1 line-mode editing – Compaq DEC Text Processing Utility AA-PWCBD-TE User Manual
Page 131: Sample dectpu procedures
A
Sample DECTPU Procedures
The following DECTPU procedures are samples of how to use DECTPU to
perform certain tasks. These procedures show one way of using DECTPU; there
may be other, more efficient ways to perform the same task. Make changes to
these procedures to accommodate your style of editing.
For these procedures to compile and execute correctly, you must make sure that
there are no conflicts between these sample procedures and your interface. This
appendix contains the following types of procedures:
1.
Line-mode editor
2.
Translation of control characters
3.
Restoring terminal width before exiting from DECTPU
4.
DCL command procedure to run DECTPU from a subprocess
A.1 Line-Mode Editor
Example A–1 shows a portion of an editing interface that uses line mode rather
than screen displays for editing tasks. You can use this mode of editing for batch
jobs or for running DECTPU on terminals that do not support screen-oriented
editing.
Example A–1 Line-Mode Editing
! Portion of a line mode editor for DECTPU
!
input_file := GET_INFO (COMMAND_LINE, "file_name");
! Set up main
main_buffer := CREATE_BUFFER ("MAIN", input_file);
! buffer from input
POSITION (BEGINNING_OF (main_buffer));
! file
!
LOOP
! Continuously loop until QUIT
cmd := READ_LINE ("*");
IF cmd = ""
THEN
cmd_char := "N";
ELSE
cmd_char := SUBSTR (cmd, 1, 1);
CHANGE_CASE (cmd_char, UPPER);
ENDIF;
CASE cmd_char FROM "I" TO "T"
! Only accepting I,L,N,Q,T
(continued on next page)
Sample DECTPU Procedures A–1