

Command files are text files containing the source of nu/TPU procedure
definitions and statements. Most larger command files are compiled and saved as
section files for later execution.
Command files are generally used for two purposes. First, a command file can
be used to create a section file. (Section files are discussed later in this
overview.) Second, a command file can be used to add personal customizations to a
common section file.
The first use of command files is demonstrated with the following code. This
code creates a minimal editing interface.
! A mini interface for nu/TPU
!
procedure tpu$init_procedure
!
! create buffer and window for messages
scr_length := GET_INFO (SCREEN, ‘visible_length’);
message_buffer := CREATE_BUFFER (“Message Buffer”);
SET (NO_WRITE, message_buffer);
SET (SYSTEM, message_buffer);
message_window := CREATE_WINDOW ((scr_length -2), 3, OFF);
MAP (message_window, message_buffer);
!
! create 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, (scr_length -3), ON);
!
! create buffer and window for editing
main_buffer := CREATE_BUFFER (“Main Buffer”);
main_window := CREATE_WINDOW (1, (scr_length -4), ON);
SET (EOB_TEXT, main_buffer, “[eob]”);
MAP (main_window, main_buffer);
!
! create an area on the screen for prompts
SET (PROMPT_AREA, (scr_length -3), 1, NONE);
!
! put cursor in the main buffer
POSITION (main_buffer);
endprocedure
!
! define minimal editing keys
DEFINE_KEY (“MOVE_HORIZONTAL(1)”, RIGHT, “Right”);
DEFINE_KEY (“MOVE_HORIZONTAL(-1)”, LEFT, “Left”);
DEFINE_KEY (“MOVE_VERTICAL(-1)”, UP, “Up”);
DEFINE_KEY (“MOVE_VERTICAL(1)”, DOWN, “Down”);
DEFINE_KEY (“SPLIT_LINE”, RET_KEY, “Return”);
DEFINE_KEY (“ERASE_CHARACTER(-1)”, DEL_KEY, “Delete”);
DEFINE_KEY (“EXIT”, CTRL_Z_KEY, “Exit”);
DEFINE_KEY (“EXECUTE (READ_LINE (‘TPU command:’))”, CTRL_B_KEY, “Command”);
!
! create section file and quit
SAVE (“mini.ini”);
QUIT;
! end of file
Even though there isn’t much in the above command file, it creates a whole new
interface for nu/TPU.
If the command file shown above is stored on disk as MINI.TPU, it is loaded,
compiled, and used with the following operating system commands:
UNIX/DOS: TPU -nosection -command=mini.tpu
VMS: EDIT/TPU/nosection/command=mini.tpu
UNIX/DOS: TPU -sec=./mini.ini editfile.nam
VMS: EDIT/TPU/sec=[]mini.ini editfile.nam
nu/TPU reads the source code, compiles it, and produces the necessary section
file, which it SAVEs to disk as MINI.INI. Once that’s complete, nu/TPU QUITs
back to the operating system.
The entire program is used to create a minimalist version of a TPU section
file. TPU$INIT_PROCEDURE is the primary workhorse of the nu/TPU interface. This is
the only procedure nu/TPU looks for when it starts up. If the
TPU$INIT_PROCEDURE is not found, the editor will not start.
The top block of code, the one labeled “! create buffer and window for
messages,” creates the bottom window. The “! create buffer and window for SHOW” block
creates a buffer used to hold the information nu/TPU sends back during SHOW
built-in procedure calls. The third block places the MAIN buffer, the buffer where
nu/TPU starts working, on the screen and is the code which creates the larger,
top window of the editor. The “! create an area on the screen for prompts”
code tells nu/TPU where to place the command prompt.
The code which exists outside of the PROCEDURE... ENDPROCEDURE block, the “!
define minimal editing keys” block, is executed after the procedure block is
compiled and provides editing key assignments. Again, note that these keys are for
a minimalist nu/TPU work session. Finally, the code SAVEs itself into a
section file and QUITs the nu/TPU work session. Files like the above aren’t for use
with the si or EVE interface’s EXTEND commands. The above command file is the starting
block for building new editing interfaces.
The second use of a command file is to create custom definitions for an
existing editing interface. An example of a command file used to remap the standard si or EVE key functions is shown below.
! a command file used to customize the keyboard
!
DEFINE_KEY (“EVE_STORE_TEXT”, F7);
DEFINE_KEY (“EVE_INSERT_HERE”, F8);
DEFINE_KEY (“EVE_TOP”, E2);
DEFINE_KEY (“EVE_BOTTOM”, E4);
DEFINE_KEY (“HELP”, F20);
DEFINE_KEY (“EXECUTE (READ_LINE (”My command line:"))", F19);
This slight redefinition from the standard nu/TPU keyboard layout can be used
to create a totally unique work environment for the user. Further, each user
can have his own customization routine creating unique nu/TPU definitions, while
all run from the same nu/TPU engine and section file.
Command Files