Date : Mon, 30 Jul 1984 06:44:00 MDT (Mon)
From : Richard Conn <RCONN@Simtel20.ARPA>
Subject: ZCPR3 Phase 2 ...
... is coming along quite nicely. It now includes DPROG, which stands
for Device PROGrammer. Under ZCPR2, we had CONFIG and TINIT which
were nice for programming a TVI950. Under ZCPR3, BOTH OF THESE are
replaced by one 3K interpreter called DPROG, and DPROG can program any
terminal or printer.
DPROG is a complete programming language in its own right. You can
define words to it (a word is a symbol up to 16 characters long) which
contain any combination of output format control instructions and text
strings and references to other words (words can be nested up to 128
levels deep). Once a word is defined, it can be named in an output
line, and its definition (including format controls) will be
translated and output to either your console, printer, or punch
device. For example:
;
; Sample DPROG programming file
;
; Define Basic Words
-esc (%c) "\E" ; the escape character
-ctrly "^Y" ; the character control-Y
-test (Char: %c %x %d\n) ; character test format
-normal_form (%c) ; normal single-character output format
;
; Use Words
;
"This is a test\n" test "ABC" normal_form "\nEnd of Test"
The output from the execution of the output line will be:
This is a test
Char: A 41 65
Char: B 42 66
Char: C 43 67
End of Test
Used in conjunction with both format definitions (where they
are output literally) and quoted strings (where they are output
according to the current format definition), the following escape
sequences apply:
^c Define control character (2-char sequence)
\b Backspace char
\d Delete char (DEL)
\e Escape char (ESC)
\l Line Feed Char (LF)
\n New Line char (CRLF pair)
\r Carriage Return char (CR)
\t Tab char (TAB)
\# Numeric value (forms are \d for decimal, \dH
for hex, \dq for octal, \dB for
binary: \1, \245, \33h, \0feH, \111b,
\77q, etc)
Additionally, the format expression is of the form
(<format text>)
where <format text> can contain any character sequence as well as
recognize the following output directives:
%c Output chars as ASCII characters
%d Output chars as floating decimal ASCII chars
%x Output chars as 2 hex ASCII chars
%2 Output chars as 2 decimal ASCII chars
%3 Output chars as 3 decimal ASCII chars
Any text can surround these output directives, and each
directive can be used as many times as desired in a format expression.
Once a format expression is given, it is used until a new expression
is defined. For example:
(%x %d ) "\12\10hA" (%c) "\12\10hA"
will output:
0C 12 10 16 41 65 ^L^PA
where ^L and ^P are the ASCII control-L and control-P characters.
Finally, to make all of this complete, you can direct output
to the console, printer, or punch at any time (for programming
whatever device you want to program), there are debugging commands
(pause to examine output, dump word definition table, dump format
expression), and you can set up as many *.DPG files that you want to
program a variety of functions. DPROG is a true ZCPR3 utility, and it
searches the path for the *.DPG files, so you can store all of your
useful programs in the ROOT directory and DPROG will find them.
DPROG is used by issuing a command of the form:
DPROG filename.typ <-- program from filename.typ
DPROG filename <-- program from filename.DPG
DPROG <-- program from STD.DPG
I currently have 6 different files to program my TVI950 for
working with assemblers, C, Pascal, dBASE II and Multiplan, Word Star
and Starindex, and standard definitions, and a 7th program file for a
TVI 970 (still being tested).
DPROG, of course, can be used within an alias, ZEX command
file, or any other ZCPR3 environment. For instance, the following
Word Star alias is reasonable:
IF NEC=$2
DEV L NEC <-- assign printer
WSN $1 <-- run NEC version of WS
ELSE
DEV L TTY <-- assign printer
DPROG CORRESP <-- program printer for
correspondence
WS $1 <-- run proper version of WS
FI
And so on ... comments?
Rick