PROGRAMS - running FRED programs.

FRED can work interactively, but it can also run programs written in advance. A FRED program is essentially a buffer containing FRED commands.

The easiest way to execute a FRED program is to put commands into a buffer, then type


where bufname is the buffer that holds the commands. This will have almost the same effect as if you typed in all the commands that are stored in bufname. The difference is that a few commands can only be executed from a buffer (e.g. some of the J commands) and that some commands act somewhat differently when they are executed from a buffer. These differences are explained in the descriptions of individual commands.

A FRED program can also be executed as a separate TSS command. You do not have to know anything about FRED to be able to use a FRED program that someone else has written. To invoke a FRED program in this way, type

fred filename arg1 arg2 ...

When FRED executes a buffer in this second way, it first sets up a few special buffers:

The file specified by filename is next read into a buffer named (.). If the file name cannot be found under the current catalog, FRED tries to find it under


(where userid is your own userid). If this also fails, FRED searches under


If none of these succeed in finding the required file, FRED gives you an error message.

If the file is found and read into buffer (.), the buffer will be executed by being placed into FRED's input stream. Note that FRED executes your init file before executing the buffer program. For this reason, you should make sure that the options set by the init file agree with those expected by the buffer program, or else you must see to it that your buffer programs set their own options before they begin further processing.

Because FRED searches for files under /fred/filename and library/fred/filename as well as the file name itself, a user can build a collection of subroutines under a private catalog called /fred and can also gain access to public subroutines under library/fred.

Writing programs in FRED can be a complicated process. In "expl fred bootstrap", we present an example of one such program. The code given there is the FRED bootstrapper, the actual FRED program that interprets the fred filename command line described above and invokes the specified program. We remind you that a good deal more information about writing buffer programs is available in the FRED Buffer Guide.

Copyright © 1998, Thinkage Ltd.