home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-05-03 | 93.1 KB | 3,516 lines |
- ::::::::::
- a970.dis
- ::::::::::
- --
- -- Distribution file for A970
- -- This programs the TVI 970 and was written in Ada
- --
-
- --
- -- Documentation
- -- Prologue
- -- Runoff source, Runoff output, and DEC Help file
- --
- a970.pro
- p970.rno
- p970.doc
- p970.hlp
-
- --
- -- Pascal Source
- --
- p970.pas
-
- --
- -- Ada Source
- --
- a970.ada
- ::::::::::
- a970.pro
- ::::::::::
-
- -------- SIMTEL20 Ada Software Repository Prologue ------------
- -- -*
- -- Unit name : A970 (P970, or PROG970)
- -- Version : 1.7
- -- Author : Freeman Moore
- -- : TI Ada Technology Branch
- -- : PO Box 801, MS 8006
- -- : McKinney, TX 75069
- -- DDN Address : FMOORE%TI-EG at CSNET-RELAY
- -- Copyright : (c) N/A
- -- Date created : 26 Apr 85
- -- Release date : 26 Apr 85
- -- Last update : 26 Apr 85
- -- Machine/System Compiled/Run on : DG MV 10000 (ROLM ADE)
- -- DEC VAX 11/785 (DEC Ada)
- -- -*
- ---------------------------------------------------------------
- -- -*
- -- Keywords : TVI970 Terminal, Terminal, Terminal Programming
- ----------------:
- --
- -- Abstract :
- ----------------:
- --
- -- PROG970 in Pascal, by Rick Conn
- -- converted to Ada by Freeman Moore, April 1985
- --
- -- The purpose of PROG970 is to Program the TVI 970 terminal from
- -- a file, setting a variety of its features. These features include
- -- the following:
- --
- -- o User Message Line
- -- o Function Keys
- -- o Cursor Type
- -- o Key Click
- -- o 25th Line Display
- -- o Answerback Sequence
- -- o Programmable Keys
- -- o Personal Messages
- -- o Other User-Definable Char Sequences
- --
- -- -*
- ------------------ Revision history ---------------------------
- -- -*
- -- DATE VERSION AUTHOR HISTORY
- -- 4/26/85 1.7 Freeman Moore Initial Release
- -- -*
- ------------------ Distribution and Copyright -----------------
- -- -*
- -- This prologue must be included in all copies of this software.
- --
- -- This software is released to the Ada community.
- -- This software is released to the Public Domain (note:
- -- software released to the Public Domain is not subject
- -- to copyright protection).
- -- Restrictions on use or distribution: NONE
- -- -*
- ------------------ Disclaimer ---------------------------------
- -- -*
- -- This software and its documentation are provided "AS IS" and
- -- without any expressed or implied warranties whatsoever.
- -- No warranties as to performance, merchantability, or fitness
- -- for a particular purpose exist.
- --
- -- Because of the diversity of conditions and hardware under
- -- which this software may be used, no warranty of fitness for
- -- a particular purpose is offered. The user is advised to
- -- test the software thoroughly before relying on it. The user
- -- must assume the entire risk and liability of using this
- -- software.
- --
- -- In no event shall any person or organization of people be
- -- held responsible for any direct, indirect, consequential
- -- or inconsequential damages or lost profits.
- -- -*
- -------------------END-PROLOGUE--------------------------------
- ::::::::::
- p970.rno
- ::::::::::
- .headers on
- .title _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ P970 - A Utility for Programming the TVI 970
- .RIGHT MARGIN +15
- .LEFT MARGIN +15
- .ap
- .tab stops 5,10,15,20,25,30,35,40,45,50,55,60
- .skip 5
- .CENTER +15; P970 Version 1.6
- .skip 1
- .CENTER +15; A Utility for Programming the TVI 970
- .skip 1
- .CENTER +15; by Richard Conn
- .skip 3
- The purpose of P970 is to program the user's TVI 970 computer
- terminal based on commands in a text file. The following operations
- on the TVI 970 can be performed by this program:
- .skip 1
- .nf
- 1. Define the content of the
- User Message on the 25th line
- 2. Select the 25th line
- 3. Engage/Disengage Key Click
- 4. Program the 16 Function Keys
- 5. Select the Cursor Type
- 6. Program the Answerback Sequence
- 7. Program the Programmable Keys
- 8. Output any text to the terminal
- .fill
- .skip 3
- .CENTER +15; ^& Running the P970 Program \&
- P970 performs its function by reading a text file (which may be
- created with any VAX/VMS editor) and sending command sequences to the user's
- TVI 970 based on P970 commands in the text file.
- A symbol should be defined (via your LOGIN.COM file) which
- looks something like this:
- .skip 1
- .CENTER +15; P970:=="$USER1:[ACSL.TOOLS.P970]P970 "
- .skip 1
- As per the norm, you may define the symbol name ('P970') as you desire.
- Note the leading dollar sign (_$) -- it is an important part of this symbol
- and must not be omitted. It is sometimes useful to keep all of your P970
- command files in one directory, and, consequently, it is convenient to have
- a command which runs P970 on files which come from this directory by
- default. My default directory is [CONN.P970], and I store all of my P970
- files here. A symbol, H970 (for Home 970), is defined as follows:
- .skip 1
- .CENTER +15; H970:=="$USER1:[ACSL.TOOLS.P970]P970 [CONN.P970]"
- .skip 1
- The command
- .skip 1
- .CENTER +15; "H970 LOGIN.970"
- .skip 1
- is expanded into
- .skip 1
- .CENTER +15; "$USER1:[ACSL.TOOLS.P970]P970 [CONN.P970]LOGIN.970"
- .skip 1
- Once the symbol is defined, the program is invoked in one of
- two ways:
- .skip 1
- .nf
- P970 <-- run program; user is prompted for file
- P970 file <-- run program on specified file
- (same for H970)
- .fill
- .skip 3
- .CENTER +15; ^& File Structure \&
- The file read by P970 is simply an ASCII text file (which can
- be prepared by any conventional text editor under VAX/VMS). Each line
- of the file begins with a command letter ('A', 'C', 'E',
- 'F', 'K', 'L', 'O', 'P', 'U',
- or ';') followed by command-specific information. When a line is
- encountered which does not begin with one of these characters, processing
- is halted (end of command set is assumed).
- For all commands, the case of the command letter and any options
- which follow it are not significant. Case is only significant
- in the text fields of selected commands.
- .skip 3
- .CENTER +15; ^& Potential User Problems \&
- .skip 1
- 1. VAX/VMS Automatic Line Wrapping
- Your VAX/VMS environment should be set up with NOWRAP as a terminal
- characteristic if your output strings are very long. P970 uses two techniques,
- depending on the command used, to generate output to the terminal. One
- technique simply outputs the characters as presented in the P970 command
- file. The other technique involves translating each
- character into a sequence of ASCII-code digits and outputting up to three
- digits
- followed by a semicolon for each character. Consequently, the output using
- this second technique, as is found in the User Message command and others,
- can become quite long, and if WRAP is set
- on your terminal characteristics, the message will be cut short when the
- number of characters output equals the number of columns on your terminal.
- To enable NOWRAP on your terminal, have your LOGIN.COM file
- issue the following command:
- .skip 1
- .CENTER +15; _"SET TERMINAL/NOWRAP_"
- .skip 2
- 2. Output Buffer Size
- The next limitation you may
- encounter is the size of the output buffer used by P970.
- A maximum of 4096 characters is permitted in an output stream
- before the buffer will overflow and a message to this effect will appear
- on your screen. Many successive uses of the O (literal output)
- command could cause this overflow to happen. This problem can be corrected by
- interjecting a command like:
- .skip 1
- O_^M_^J
- .skip 1
- in your command file. _^M is a carriage return, _^J is a line feed, and
- the two combine to generate the New Line code which flushes the buffer
- (actually, _^J is probably the only character needed, but _^M _^J looks
- better on your terminal).
- .skip 3
- .CENTER +15; ^& Comments \&
- Any line in the file beginning with a semicolon (_;) is a comment
- line, and the entire line is ignored.
- .skip 3
- .CENTER +15; ^& Text Output Convention \&
- Functions 1 (define User Message), 4 (program function keys),
- 6 (program answerback message), 7 (program programmable keys),
- and 8 (output text to terminal)
- permit the user to output text to the terminal. P970 provides for some
- convenience to the user in that escape sequences are available which allow
- any character within the 128-character ASCII character set to be included
- in this text. This is particularly useful when the function keys are being
- programmed with escape sequences, such as clear screen.
- .test page 10
- The escape sequences available to the P970 programmer are:
- .skip 1
- .nf
- _^c - output control char (uparrow, char)
- _\D - output DELETE char (7F Hex)
- _\E - output ESCAPE char (1B Hex)
- _\c - output following char literally
- '_\_^' outputs '_^'
- '_\_\' outputs '_\'
- .fill
- .skip 1
- For example, to include a carriage return character in
- a text sequence, the two-character combination '_^M' or '_^m' is available.
- To output the clear screen sequence to the TVI 970, the characters
- '_\E[2J' will output ESCAPE, '[', '2', and 'J' to do this.
- Any character following an uparrow (_^) or backslash (_\) will
- be capitalized if it is lower-case alphabetic.
- Any 7-bit value in the ASCII-128 character set can be generated
- by using this output convention. The following table summarizes how to
- do this.
- .skip 1
- .test page 22
- .nf
- Character Required
- Desired Character
- Hex ASCII Sequence
- --------- --------
- 00 NUL _^@
- 01 SOH _^A
- ... ..
- 1A SUB _^Z
- 1B ESC _^[ (note: _\E also works)
- 1C FS _^_\
- 1D GS _^]
- 1E RS _^_^
- 1F US _^__
- 20 SP
- 21 _! _!
- ... ..
- 7E _~ _~
- 7F DEL _\D (note: special sequence)
- .fill
- .skip 1
- Note that a delete character (_\D) is useful in programming
- the function keys in that this character is used in function key
- sequences to chain one function key to another.
- .skip 3
- .test page 15
- .CENTER +15; ^& P970 Commands \&
- .skip 2
- This section lists the nine P970 commands in alphabetical order.
- The commands covered in this section are:
- .skip 1
- .tab stops 8,16,24,32,40,48,56
- .NO FILL
- Command Function Performed
- ------- -------- ---------
- A<text> Program the Answerback Sequence
- Ccr Select the Cursor Type
- E<text> End Command Lines
- Fst n <text> Program a Function Key
- Kk Engage/Disengage Key Click
- Ll Select the 25th Line
- O<text> Output any Text to the Terminal
- P n <text> Program the Programmable Keys
- U<text> Load the User Message
- .fill
- .tab stops 5,10,15,20,25,30,35,40,45,50,55,60
- .skip 2
- .test page 10
- 1. ^& A - Program the Answerback Sequence \&
- .skip 1
- Syntax:
- A<text>
- .skip 1
- Comments:
- The answerback sequence is transmitted to the computer by
- striking Control-BREAK. This sequence is at most 24 characters long,
- and it is the user's responsibility to insure that he does not place more
- than 24 characters in this sequence.
- .skip 1
- Examples:
- .NO FILL
- Ac McACSL_^M_^M
- -- program the answerback key with a
- connect command to McACSL
- .fill
- .skip 2
- .test page 10
- 2. ^& C - Select the Cursor Type \&
- .skip 1
- Syntax:
- .nf
- Ccr
- c = 'B' for block (defaults to underline)
- r = 'S' for steady (defaults to blinking)
- .fill
- .skip 1
- Comments:
- The C command selects the cursor type. If both the 'S' and
- 'B' options are selected, their order is not significant.
- .skip 1
- Examples:
- .nf
- C <-- select blinking underline
- CS <-- select steady underline
- CB <-- select blinking block
- CBS <-- select steady block
- .fill
- .skip 2
- .test page 10
- 3. ^& E - Exit P970 Command Series \&
- .skip 1
- Syntax:
- E<any text>
- .skip 1
- Comments:
- The E command signals the end of the P970 command lines in
- the file. Any subsequent lines following the line beginning with
- the letter 'E' are ignored. Any text following the E command is
- ignored.
- .skip 1
- Examples:
- E <-- End of Command Lines
- .skip 2
- .test page 15
- 4. ^& F - Program the 16 Function Keys \&
- .skip 1
- Syntax:
- .nf
- Fst n <text>
- s = 'S' if function key is to be shifted;
- omitting the character 'S' selects the
- non-shifted function key
- t = 'L' if text is transmitted to terminal only;
- omitting the character 'L' selects
- transmission of the text to the computer
- n = number of function key (1 to 16)
- <text> = text of function key
- .fill
- .skip 1
- Comments:
- The function key definition command allows the programmer to
- define text strings to be sent to the remote computer or executed locally
- by the terminal.
- In sending text strings to the remote computer, it is frequently
- useful to terminate the text strings in certain ways, namely with a carriage
- return or a space. To do this, the escape sequences come in handy. The
- characters '_^M' or '_^m' represent the carriage return, and '_\_ ' represents
- a space.
- In sending commands to the terminal, it is frequently useful to
- be able to define the ESCAPE character. The sequence '_\E' represents the
- ESCAPE character. Also, the sequence '_\D' represents the DELETE character
- (if you ever need it).
- See the section on ^& Text Output Convention \& for more detail.
- If both 'S' and 'L' options are given, the order in which they
- are presented is not significant.
- .skip 1
- .test page 10
- Examples:
- .nf
- F 1 dir_^M <-- function key 1 (unshifted) sends
- 'dir' followed by a carriage
- return to the computer
- Fs 1 dir_\ <-- function key 1 (shifted) sends
- 'dir' followed by a space
- to the computer
- FL 2 _\E[2J <-- function key 2 sends ESCAPE
- followed by '[2J' to the
- terminal
- .fill
- .skip 2
- .test page 10
- 5. ^& K - Engage/Disengage Key Click \&
- .skip 1
- Syntax:
- .nf
- Kk
- k = 'Y' to enable key click
- k = anything else to disable key click
- .fill
- .skip 1
- Comments:
- The key click is enabled or disabled by this command.
- .skip 1
- Examples:
- .nf
- K <-- disable key click
- Ky <-- enable key click
- .fill
- .skip 2
- .test page 10
- 6. ^& L - Select the 25th Line \&
- .skip 1
- Syntax:
- .nf
- Ll
- l = 'U' selects the User Message
- l = 'S' selects the Status Message
- l = anything else blanks out the 25th line
- .fill
- .skip 1
- Comments:
- The L command selects the 25th line. Since it is executed
- as soon as it is encountered, the L command may also be used to blank
- out the message line, load it, and then enable it when the processing
- is done.
- .skip 1
- .test page 10
- Examples:
- .skip 1
- .nf
- 1. Sequence --
- L <-- blank out 25th line
- Umy message <-- store 'my message' in User Msg
- LU <-- enable User Msg on 25th line
- 2. Sequence --
- LS <-- enable status msg on 25th line
- .fill
- .skip 2
- .test page 10
- 7. ^& O - Output any Text to the Terminal \&
- .skip 1
- Syntax:
- O<text>
- .skip 1
- Comments:
- The O command simply outputs the following text to the
- user's terminal. Any escape sequence
- not covered by the other commands can be sent to the terminal rather easily.
- .skip 1
- Examples:
- .nf
- O_\E[2J <-- clear screen
- OHello, world <-- print message
- .fill
- .skip 2
- .test page 10
- 8. ^& P - Program the Programmable Keys \&
- .skip 1
- Syntax:
- P n <text>
- .skip 1
- Comments:
- The P command programs the programmable key indicated with
- the indicated character sequence. It is the user's responsibility to
- ensure that the character sequence fits within the key's buffer.
- Any escape sequence
- not covered by the other commands can be sent to the terminal rather easily.
- The value of "n" is the PS number of the key (from 0 to 62).
- Refer to pages 99-100 of the TVI 970 Operator's Manual
- (Programming the Programmable Keys) for details on these
- values.
- .skip 1
- .test page 5
- Examples:
- .skip 1
- .nf
- P 24 _^B <-- change left arrow to _^B
- P 19 _\EV <-- change shifted up arrow to ESC V
- .fill
- .skip 2
- .test page 10
- 9. ^& U - Set the User Message on the 25th Line \&
- .skip 1
- Syntax:
- U<text>
- .skip 1
- Comments:
- The text immediately following the letter U is output into the user
- message. The L command must also select the User Message for this output
- to appear on the screen (see the L command below).
- Your VAX/VMS environment should be set up with NOWRAP as a terminal
- characteristic if your User Message is very long. P970 uses the "normal"
- technique of generating the User Message, which involves translating each
- character into a sequence of ASCII digits and outputting up to three digits
- followed by a semicolon for each character. Consequently, the output to
- program a User Message tends to become quite long, and if WRAP is set
- on your terminal characteristics, the message will be cut short when the
- number of characters output equals the number of columns on your terminal.
- However, even with NOWRAP enabled, the next limitation is the size of the
- output buffer. This limitation allows on the order of 40 characters
- maximum in the User Message.
- To enable NOWRAP on your terminal, have your LOGIN.COM file
- issue the following command: _"SET TERMINAL/NOWRAP_"
- .skip 1
- Examples:
- .nf
- Umy message <-- store 'my message' in user line
- .fill
- .page
- .skip 4
- .CENTER +15; ^& Sample Configuration Files \&
- .skip 3
- FILE 1:
- .skip 2
- .test page 22
- .nf
- ; User line blank, keyclick off, define user message,
- ; set 25th line to user message
- L
- K
- uD Dir ChDir Who
- Lu
- ; Define function keys
- F 1 d_^M
- Fs 1 d_\
- F 2 dir_^M
- F 3 cd_\
- F 4 who_^M
- fL 16 _\E[0U
- fsL 16 _\E[0V
- ; Define cursor
- C
- ; Print message
- O_\E[2J Welcome, Rick
- ; Done
- E
- .fill
- .skip 3
- .test page 22
- FILE 2:
- .skip 2
- .nf
- ; Define user message line
- U1=Dir 2=CD 3=Who
- ; Define function keys
- Fn 1 d_^m
- fs 1 d_\
- fn 2 cd_\
- fs 2 pwd_^M
- fn 3 who_^m
- ; Define cursor
- cb
- ; Done
- e
- These lines which follow the E command may
- contain any text desired by the user
- .fill
- .skip 3
- .test page 30
- FILE 3:
- .skip 2
- .nf
- ; TVI 970 configuration file for Rick Conn
- ; Set the Answerback message:
- Ac mcacsl_^M_^M
- ; Program the user message:
- L
- u1=D 2=Dir 3=CD 4=Who
- Lu
- ; Turn off key click
- K
- ; Define Function Keys
- ; 1 = d<CR>
- ; 1 shifted = d<SP>
- ; 2 = dir<CR>
- ; 3 = cd<SP>
- ; 4 = who<CR>
- ; 15 = smooth scroll
- ; 15 shifted = jump scroll
- ; 16 = advance to next page
- ; 16 shifted = backup to last page
- F 1 d_^M
- Fs 1 d_\
- F 2 dir_^M
- F 3 cd_\
- F 4 who_^M
- FL 15 _\E[_?4h
- FLS 15 _\E[_?4l
- fL 16 _\E[0U
- fsL 16 _\E[0V
- ; Set Cursor to Blinking Underline
- C
- ; Clear Screen and Print Message
- O_\E[2J Welcome, Rick
- ; Done
- E
- .fill
- ::::::::::
- p970.doc
- ::::::::::
-
-
-
-
-
-
- P970 Version 1.6
-
-
-
- A Utility for Programming the TVI 970
-
-
-
- by Richard Conn
-
-
-
-
-
-
-
-
-
- The purpose of P970 is to program the user's TVI 970
-
- computer terminal based on commands in a text file. The
-
- following operations on the TVI 970 can be performed by this
-
- program:
-
-
-
- 1. Define the content of the
-
- User Message on the 25th line
-
- 2. Select the 25th line
-
- 3. Engage/Disengage Key Click
-
- 4. Program the 16 Function Keys
-
- 5. Select the Cursor Type
-
- 6. Program the Answerback Sequence
-
- 7. Program the Programmable Keys
-
- 8. Output any text to the terminal
-
-
-
-
-
-
-
- Running the P970 Program
- _______ ___ ____ _______
-
-
-
- P970 performs its function by reading a text file
-
- (which may be created with any VAX/VMS editor) and sending
-
- command sequences to the user's TVI 970 based on P970
-
- commands in the text file.
-
-
-
- A symbol should be defined (via your LOGIN.COM file)
-
- which looks something like this:
-
-
-
- P970:=="$USER1:[ACSL.TOOLS.P970]P970 "
-
-
-
- As per the norm, you may define the symbol name ('P970') as
-
- you desire. Note the leading dollar sign ($) -- it is an
-
- important part of this symbol and must not be omitted. It
-
- is sometimes useful to keep all of your P970 command files
-
- in one directory, and, consequently, it is convenient to
-
- have a command which runs P970 on files which come from this
-
- directory by default. My default directory is [CONN.P970],
-
- and I store all of my P970 files here. A symbol, H970 (for
-
- Home 970), is defined as follows:
-
-
-
- H970:=="$USER1:[ACSL.TOOLS.P970]P970 [CONN.P970]"
-
-
-
- The command
-
-
-
- "H970 LOGIN.970"
-
-
-
- is expanded into
-
- P970 - A Utility for Programming the TVI 970 Page 2
-
-
-
-
-
- "$USER1:[ACSL.TOOLS.P970]P970 [CONN.P970]LOGIN.970"
-
-
-
-
-
- Once the symbol is defined, the program is invoked in
-
- one of two ways:
-
-
-
- P970 <-- run program; user is prompted for file
-
- P970 file <-- run program on specified file
-
- (same for H970)
-
-
-
-
-
-
-
- File Structure
- ____ _________
-
-
-
- The file read by P970 is simply an ASCII text file
-
- (which can be prepared by any conventional text editor under
-
- VAX/VMS). Each line of the file begins with a command
-
- letter ('A', 'C', 'E', 'F', 'K', 'L', 'O', 'P', 'U', or ';')
-
- followed by command-specific information. When a line is
-
- encountered which does not begin with one of these
-
- characters, processing is halted (end of command set is
-
- assumed). For all commands, the case of the command letter
-
- and any options which follow it are not significant. Case
-
- is only significant in the text fields of selected commands.
-
-
-
-
-
-
-
- Potential User Problems
- _________ ____ ________
-
-
-
- 1. VAX/VMS Automatic Line Wrapping
-
-
-
- Your VAX/VMS environment should be set up with NOWRAP
-
- as a terminal characteristic if your output strings are very
-
- long. P970 uses two techniques, depending on the command
-
- used, to generate output to the terminal. One technique
-
- simply outputs the characters as presented in the P970
-
- command file. The other technique involves translating each
-
- character into a sequence of ASCII-code digits and
-
- outputting up to three digits followed by a semicolon for
-
- each character. Consequently, the output using this second
-
- technique, as is found in the User Message command and
-
- others, can become quite long, and if WRAP is set on your
-
- terminal characteristics, the message will be cut short when
-
- the number of characters output equals the number of columns
-
- on your terminal.
-
-
-
- To enable NOWRAP on your terminal, have your LOGIN.COM
-
- file issue the following command:
-
-
-
- "SET TERMINAL/NOWRAP"
-
-
-
-
-
- 2. Output Buffer Size
-
- P970 - A Utility for Programming the TVI 970 Page 3
-
-
-
-
-
- The next limitation you may encounter is the size of
-
- the output buffer used by P970. A maximum of 4096
-
- characters is permitted in an output stream before the
-
- buffer will overflow and a message to this effect will
-
- appear on your screen. Many successive uses of the O
-
- (literal output) command could cause this overflow to
-
- happen. This problem can be corrected by interjecting a
-
- command like:
-
-
-
-
-
- O^M^J
-
-
-
- in your command file. ^M is a carriage return, ^J is a line
-
- feed, and the two combine to generate the New Line code
-
- which flushes the buffer (actually, ^J is probably the only
-
- character needed, but ^M ^J looks better on your terminal).
-
-
-
-
-
-
-
- Comments
- ________
-
-
-
- Any line in the file beginning with a semicolon (;) is
-
- a comment line, and the entire line is ignored.
-
-
-
-
-
-
-
- Text Output Convention
- ____ ______ __________
-
-
-
- Functions 1 (define User Message), 4 (program function
-
- keys), 6 (program answerback message), 7 (program
-
- programmable keys), and 8 (output text to terminal) permit
-
- the user to output text to the terminal. P970 provides for
-
- some convenience to the user in that escape sequences are
-
- available which allow any character within the 128-character
-
- ASCII character set to be included in this text. This is
-
- particularly useful when the function keys are being
-
- programmed with escape sequences, such as clear screen.
-
-
-
- The escape sequences available to the P970 programmer
-
- are:
-
-
-
- ^c - output control char (uparrow, char)
-
- \D - output DELETE char (7F Hex)
-
- \E - output ESCAPE char (1B Hex)
-
- \c - output following char literally
-
- '\^' outputs '^'
-
- '\\' outputs '\'
-
-
-
-
-
- For example, to include a carriage return character in
-
- a text sequence, the two-character combination '^M' or '^m'
-
- is available. To output the clear screen sequence to the
-
- TVI 970, the characters '\E[2J' will output ESCAPE, '[',
-
- '2', and 'J' to do this.
-
- P970 - A Utility for Programming the TVI 970 Page 4
-
-
-
-
-
- Any character following an uparrow (^) or backslash (\)
-
- will be capitalized if it is lower-case alphabetic.
-
-
-
- Any 7-bit value in the ASCII-128 character set can be
-
- generated by using this output convention. The following
-
- table summarizes how to do this.
-
-
-
- Character Required
-
- Desired Character
-
- Hex ASCII Sequence
-
- --------- --------
-
- 00 NUL ^@
-
- 01 SOH ^A
-
- ... ..
-
- 1A SUB ^Z
-
- 1B ESC ^[ (note: \E also works)
-
- 1C FS ^\
-
- 1D GS ^]
-
- 1E RS ^^
-
- 1F US ^_
-
- 20 SP
-
- 21 ! !
-
- ... ..
-
- 7E ~ ~
-
- 7F DEL \D (note: special sequence)
-
-
-
-
-
- Note that a delete character (\D) is useful in
-
- programming the function keys in that this character is used
-
- in function key sequences to chain one function key to
-
- another.
-
-
-
-
-
-
-
- P970 Commands
- ____ ________
-
-
-
-
-
-
-
- This section lists the nine P970 commands in
-
- alphabetical order. The commands covered in this section
-
- are:
-
-
-
- Command Function Performed
-
- ------- -------- ---------
-
- A<text> Program the Answerback Sequence
-
- Ccr Select the Cursor Type
-
- E<text> End Command Lines
-
- Fst n <text> Program a Function Key
-
- Kk Engage/Disengage Key Click
-
- Ll Select the 25th Line
-
- O<text> Output any Text to the Terminal
-
- P n <text> Program the Programmable Keys
-
- U<text> Load the User Message
-
- P970 - A Utility for Programming the TVI 970 Page 5
-
-
-
-
-
- 1. A - Program the Answerback Sequence
- _ _ _______ ___ __________ ________
-
-
-
- Syntax:
-
-
-
- A<text>
-
-
-
- Comments:
-
-
-
- The answerback sequence is transmitted to the computer
-
- by striking Control-BREAK. This sequence is at most 24
-
- characters long, and it is the user's responsibility to
-
- insure that he does not place more than 24 characters in
-
- this sequence.
-
-
-
- Examples:
-
- Ac McACSL^M^M
-
- -- program the answerback key with a
-
- connect command to McACSL
-
-
-
-
-
- 2. C - Select the Cursor Type
- _ _ ______ ___ ______ ____
-
-
-
- Syntax:
-
- Ccr
-
- c = 'B' for block (defaults to underline)
-
- r = 'S' for steady (defaults to blinking)
-
-
-
- Comments:
-
-
-
- The C command selects the cursor type. If both the 'S'
-
- and 'B' options are selected, their order is not
-
- significant.
-
-
-
- Examples:
-
- C <-- select blinking underline
-
- CS <-- select steady underline
-
- CB <-- select blinking block
-
- CBS <-- select steady block
-
-
-
-
-
- 3. E - Exit P970 Command Series
- _ _ ____ ____ _______ ______
-
-
-
- Syntax:
-
-
-
- E<any text>
-
-
-
- Comments:
-
-
-
- The E command signals the end of the P970 command lines
-
- in the file. Any subsequent lines following the line
-
- beginning with the letter 'E' are ignored. Any text
-
- following the E command is ignored.
-
-
-
- Examples:
-
- P970 - A Utility for Programming the TVI 970 Page 6
-
-
-
-
-
- E <-- End of Command Lines
-
-
-
-
-
- 4. F - Program the 16 Function Keys
- _ _ _______ ___ __ ________ ____
-
-
-
- Syntax:
-
- Fst n <text>
-
- s = 'S' if function key is to be shifted;
-
- omitting the character 'S' selects the
-
- non-shifted function key
-
- t = 'L' if text is transmitted to terminal only;
-
- omitting the character 'L' selects
-
- transmission of the text to the computer
-
- n = number of function key (1 to 16)
-
- <text> = text of function key
-
-
-
- Comments:
-
-
-
- The function key definition command allows the
-
- programmer to define text strings to be sent to the remote
-
- computer or executed locally by the terminal.
-
-
-
- In sending text strings to the remote computer, it is
-
- frequently useful to terminate the text strings in certain
-
- ways, namely with a carriage return or a space. To do this,
-
- the escape sequences come in handy. The characters '^M' or
-
- '^m' represent the carriage return, and '\ ' represents a
-
- space.
-
-
-
- In sending commands to the terminal, it is frequently
-
- useful to be able to define the ESCAPE character. The
-
- sequence '\E' represents the ESCAPE character. Also, the
-
- sequence '\D' represents the DELETE character (if you ever
-
- need it).
-
-
-
- See the section on Text Output Convention for more
- ____ ______ __________
-
- detail.
-
-
-
- If both 'S' and 'L' options are given, the order in
-
- which they are presented is not significant.
-
-
-
- Examples:
-
- F 1 dir^M <-- function key 1 (unshifted) sends
-
- 'dir' followed by a carriage
-
- return to the computer
-
- Fs 1 dir\ <-- function key 1 (shifted) sends
-
- 'dir' followed by a space
-
- to the computer
-
- FL 2 \E[2J <-- function key 2 sends ESCAPE
-
- followed by '[2J' to the
-
- terminal
-
-
-
-
-
- P970 - A Utility for Programming the TVI 970 Page 7
-
-
-
-
-
- 5. K - Engage/Disengage Key Click
- _ _ ________________ ___ _____
-
-
-
- Syntax:
-
- Kk
-
- k = 'Y' to enable key click
-
- k = anything else to disable key click
-
-
-
- Comments:
-
-
-
- The key click is enabled or disabled by this command.
-
-
-
- Examples:
-
- K <-- disable key click
-
- Ky <-- enable key click
-
-
-
-
-
- 6. L - Select the 25th Line
- _ _ ______ ___ ____ ____
-
-
-
- Syntax:
-
- Ll
-
- l = 'U' selects the User Message
-
- l = 'S' selects the Status Message
-
- l = anything else blanks out the 25th line
-
-
-
- Comments:
-
-
-
- The L command selects the 25th line. Since it is
-
- executed as soon as it is encountered, the L command may
-
- also be used to blank out the message line, load it, and
-
- then enable it when the processing is done.
-
-
-
- Examples:
-
-
-
- 1. Sequence --
-
- L <-- blank out 25th line
-
- Umy message <-- store 'my message' in User Msg
-
- LU <-- enable User Msg on 25th line
-
- 2. Sequence --
-
- LS <-- enable status msg on 25th line
-
-
-
-
-
- 7. O - Output any Text to the Terminal
- _ _ ______ ___ ____ __ ___ ________
-
-
-
- Syntax:
-
-
-
- O<text>
-
-
-
- Comments:
-
-
-
- The O command simply outputs the following text to the
-
- user's terminal. Any escape sequence not covered by the
-
- other commands can be sent to the terminal rather easily.
-
-
-
- Examples:
-
- O\E[2J <-- clear screen
-
- P970 - A Utility for Programming the TVI 970 Page 8
-
-
-
-
-
- OHello, world <-- print message
-
-
-
-
-
- 8. P - Program the Programmable Keys
- _ _ _______ ___ ____________ ____
-
-
-
- Syntax:
-
-
-
- P n <text>
-
-
-
- Comments:
-
-
-
- The P command programs the programmable key indicated
-
- with the indicated character sequence. It is the user's
-
- responsibility to ensure that the character sequence fits
-
- within the key's buffer. Any escape sequence not covered by
-
- the other commands can be sent to the terminal rather
-
- easily.
-
-
-
- The value of "n" is the PS number of the key (from 0 to
-
- 62). Refer to pages 99-100 of the TVI 970 Operator's Manual
-
- (Programming the Programmable Keys) for details on these
-
- values.
-
-
-
- Examples:
-
-
-
- P 24 ^B <-- change left arrow to ^B
-
- P 19 \EV <-- change shifted up arrow to ESC V
-
-
-
-
-
- 9. U - Set the User Message on the 25th Line
- _ _ ___ ___ ____ _______ __ ___ ____ ____
-
-
-
- Syntax:
-
-
-
- U<text>
-
-
-
- Comments:
-
-
-
- The text immediately following the letter U is output
-
- into the user message. The L command must also select the
-
- User Message for this output to appear on the screen (see
-
- the L command below).
-
-
-
- Your VAX/VMS environment should be set up with NOWRAP
-
- as a terminal characteristic if your User Message is very
-
- long. P970 uses the "normal" technique of generating the
-
- User Message, which involves translating each character into
-
- a sequence of ASCII digits and outputting up to three digits
-
- followed by a semicolon for each character. Consequently,
-
- the output to program a User Message tends to become quite
-
- long, and if WRAP is set on your terminal characteristics,
-
- the message will be cut short when the number of characters
-
- output equals the number of columns on your terminal.
-
- However, even with NOWRAP enabled, the next limitation is
-
- the size of the output buffer. This limitation allows on
-
- the order of 40 characters maximum in the User Message.
-
- P970 - A Utility for Programming the TVI 970 Page 9
-
-
-
-
-
- To enable NOWRAP on your terminal, have your LOGIN.COM
-
- file issue the following command: "SET TERMINAL/NOWRAP"
-
-
-
- Examples:
-
- Umy message <-- store 'my message' in user line
-
- P970 - A Utility for Programming the TVI 970 Page 10
-
-
-
-
-
- Sample Configuration Files
- ______ _____________ _____
-
-
-
-
-
-
-
- FILE 1:
-
-
-
-
-
- ; User line blank, keyclick off, define user message,
-
- ; set 25th line to user message
-
- L
-
- K
-
- uD Dir ChDir Who
-
- Lu
-
- ; Define function keys
-
- F 1 d^M
-
- Fs 1 d\
-
- F 2 dir^M
-
- F 3 cd\
-
- F 4 who^M
-
- fL 16 \E[0U
-
- fsL 16 \E[0V
-
- ; Define cursor
-
- C
-
- ; Print message
-
- O\E[2J Welcome, Rick
-
- ; Done
-
- E
-
-
-
-
-
-
-
- FILE 2:
-
-
-
-
-
- ; Define user message line
-
- U1=Dir 2=CD 3=Who
-
- ; Define function keys
-
- Fn 1 d^m
-
- fs 1 d\
-
- fn 2 cd\
-
- fs 2 pwd^M
-
- fn 3 who^m
-
- ; Define cursor
-
- cb
-
- ; Done
-
- e
-
- These lines which follow the E command may
-
- contain any text desired by the user
-
-
-
-
-
-
-
- P970 - A Utility for Programming the TVI 970 Page 11
-
-
-
-
-
- FILE 3:
-
-
-
-
-
- ; TVI 970 configuration file for Rick Conn
-
- ; Set the Answerback message:
-
- Ac mcacsl^M^M
-
- ; Program the user message:
-
- L
-
- u1=D 2=Dir 3=CD 4=Who
-
- Lu
-
- ; Turn off key click
-
- K
-
- ; Define Function Keys
-
- ; 1 = d<CR>
-
- ; 1 shifted = d<SP>
-
- ; 2 = dir<CR>
-
- ; 3 = cd<SP>
-
- ; 4 = who<CR>
-
- ; 15 = smooth scroll
-
- ; 15 shifted = jump scroll
-
- ; 16 = advance to next page
-
- ; 16 shifted = backup to last page
-
- F 1 d^M
-
- Fs 1 d\
-
- F 2 dir^M
-
- F 3 cd\
-
- F 4 who^M
-
- FL 15 \E[?4h
-
- FLS 15 \E[?4l
-
- fL 16 \E[0U
-
- fsL 16 \E[0V
-
- ; Set Cursor to Blinking Underline
-
- C
-
- ; Clear Screen and Print Message
-
- O\E[2J Welcome, Rick
-
- ; Done
-
- E
-
- ::::::::::
- p970.hlp
- ::::::::::
- 1 P970
- COMMAND NAME: P970 or H970
- SYNTAX:
- P970 filename.typ
- or H970 filename.typ
- PURPOSE:
- P970 programs various attributes of the Televideo 970 terminal
- according to commands in the indicated file. The command "P970" looks
- for the file in the current (or indicated directory), while the command
- "H970" looks for the file in the directory [CONN.P970]. A directory
- prefix should not be used with the H970 command.
-
- EXAMPLES:
- P970 setup1.970
- -- program the TVI970 from the file SETUP1.970 in
- the current directory
- H970 login.970
- -- program the TVI970 from the file LOGIN.970 in [CONN.P970]
-
- 2 COMMANDS
-
- The following is a brief summary of the commands which may be
- placed into a text file which is later read by P970 to program the terminal.
- Details on these commands are available elsewhere in this HELP file.
-
- Command Function
- ------- --------
- ;<text> Comment Line
- A<text> Load Answerback Message
- Ccr Cursor Type Selection
- Fst n <text> Load Function Key
- KY or K Enable/Disable Key Click
- LU, LS, or L Select User Message, Status Message or Blank Message
- O<text> Output any text
- P n <text> Program the Programmable Keys
- U<text> Load User Message
- E<text> End of P970 Command Lines
-
- See the P970 manual for details with examples of each of these
- commands.
-
- 1 E
- P970 Command: E
- Syntax: E<text>
- Function:
- E indicates the end of the P970 command lines. Any text which
- follows the letter E and any lines which follow the line containing this
- command are flushed.
-
- 1 U
- P970 Command: U
- Syntax: U<text>
- Function:
- U stores the text which immediately follows it in the User
- Message.
- The LU command has to be issued to turn on the User Message.
-
- 1 L
- P970 Command: L
- Syntax: Ll
- l=U to select User Message
- l=S to select Status Message
- l=other to select blank message
- Function:
- L selects which of the three message lines will appear on the 25th
- line of the screen.
-
- 1 K
- P970 Command: K
- Syntax: Kk
- k=Y to enable Key Click
- k=other to disable Key Click
- Function:
- K enables and disables the key click at the user's terminal.
-
- 1 F
- P970 Command: F
- Syntax: Fst n <text>
- s=S if function key is shifted; omitting the char 'S'
- selects the non-shifted function key
- t=L to transmit the key string to the terminal only (local);
- omitting the char 'L' transmits the key string
- to the computer
- n=# (number of function key, from 1 to 16); this is required
- <text> is the text to store in the function key
- Function:
- F stores text in the function keys. Any ASCII character from 0
- to 127 (7-bit ASCII) may be stored by this command.
-
- 1 C
- P970 Command: C
- Syntax: Ccr
- c=B for block cursor; omitting the char 'B' selects an
- underline cursor
- r=S for steady cursor; omitting the char 'S' selects a
- blinking cursor
- Function:
- C selects the cursor type.
-
- 1 A
- P970 Command: A
- Syntax: A<text>
- Function:
- A programs the answerback sequence. This sequence is sent to
- the computer by striking Control-BREAK. It is at most 24 chars long.
-
- 1 P
- P970 Command: P
- Syntax: P n <text>
- n=# (programmable key number, from 0 to 62)
- Function:
- P stores the text into the programmable key indicated by 'n'.
- The number of characters which may be stored varies with the key selected.
- See the section on "Personalizing the 970" - "Programming the Keys" in
- your TVI 970 manual for further details on key numbers and char sequence
- lengths.
-
- 1 O
- P970 Command: O
- Syntax: O<text>
- Function:
- O outputs the following text to the terminal with a minimum
- of interpretation. Functions such as clear screen and message display
- can be performed using this command.
-
- 1 TEXT
-
- Several P970 commands, namely A, F, O, P and U, have an argument
- which is a sequence of characters (indicated by <text> in the syntax
- descriptions in this HELP file). Any 7-bit ASCII character may be
- represented in this text. The following rules apply:
-
- ^c (uparrow, char) - output control char
- \D - output DELETE char (7F Hex)
- \E - output ESCAPE char (1B Hex)
- \c - output char 'c' literally
- '\^' outputs '^'
- '\\' outputs '\'
-
- Any character following an uparrow (^) or backslash (\)
- will be capitalized if it is lower-case alphabetic. See the section
- on CHARS for a summary of all possible characters which can be output.
-
- 1 CHARS
-
- Character Required This table summarizes the character
- Desired Character sequences required to output any of
- Hex ASCII Sequence the 128 7-bit ASCII characters.
- --------- ---------
- 00 NUL ^@
- 01 SOH ^A
- ... ..
- 1A SUB ^Z
- 1B ESC ^[ (note: \E also works)
- 1C FS ^\
- 1D GS ^]
- 1E RS ^^
- 1F US ^_
- 20 SP
- 21 ! !
- ... ..
- 7E ~ ~
- 7F DEL \D (note: special sequence)
- ::::::::::
- p970.pas
- ::::::::::
- program prog970 (input, output);
- {
- PROG970.PAS by Rick Conn
-
- The purpose of PROG970 is to Program the TVI 970 terminal from a file,
- setting a variety of its features. These features include
- the following:
-
- o User Message Line
- o Function Keys
- o Cursor Type
- o Key Click
- o 25th Line Display
- o Answerback Sequence
- o Programmable Keys
- o Personal Messages
- o Other User-Definable Char Sequences
-
- PROG970 is divided into three major modules and one initialization
- and command selection mainline. The three major modules are:
-
- 1. Support Routines
- -- provide low-level I/O et al
- -- routines are dependent and ordered
- 2. Routines for Terminal Output of Functions
- -- function-specific routines, such as
- program function key n with string s
- -- routines are independent; order is alphabetical
- -- routines in module 1 called for support
- 3. Command Processing Routines
- -- process command options and data for
- specific commands
- -- routines are independent; order is alphabetical
- -- routines in modules 1 and 2 called for support
-
- }
-
- const
- version = 1.6; { version number }
- str_length = 255; { max length of strings }
- prompt_length = 17; { length of prompt string }
- delete = chr(127); { DELETE character }
- escape = chr(27); { ESCAPE character }
- cr = chr(13); { CARRIAGE RETURN character }
- literal = '\'; { following char is accepted literally }
- control = '^'; { control char is represented }
- lit_esc = 'E'; { literal code for ESC char (\E) }
- lit_del = 'D'; { literal code for DEL char (\D) }
-
- type
- str = packed array [1..str_length] of char;
- prompt_str = packed array [1..prompt_length] of char;
- cptr = ^char;
- var
- message : str;
- infile, fo : TEXT;
-
- procedure lib$get_foreign (%descr line1 : str; %descr line2 : prompt_str);
- extern;
-
- {----------------------------------------------------------------}
- {
- 1. Support Routines
- STOP_ALL
- UP
- TOUPPER
- DIGOUT
- CHAROUT
- PRINT_MESSAGE
- GET_MESSAGE
- GET_CHAR
- }
-
- procedure stop_all;
- {
- STOP_ALL halts execution of the program when an EOF condition
- is detected prematurely. It prints an appropriate error message.
-
- Inputs: None
- Outputs: None
- Side Effects: None (program is halted)
- }
- begin
- writeln;
- writeln ('Premature End of File on Input File');
- halt
- ;
- end;
-
-
- procedure up;
- {
- UP moves cursor up one line so screen info is not lost by
- running P970.
-
- Inputs: None
- Outputs: None
- Side Effects: None (cursor moves up)
- }
- begin
- write(fo, escape, 'M'); { \E M moves cursor up one line }
- end;
-
-
- function toupper (ch : char) : char;
- {
- TOUPPER capitalizes the input character, if necessary.
-
- Inputs: CH = char to capitalize
- Outputs: TOUPPER = capitalized output
- Side Effects: None
- }
- begin
- if (ord('a') <= ord(ch)) AND (ord(ch) <= ord('z')) then
- toupper := chr(ord(ch) - ord('a') + ord('A'))
- else
- toupper := ch;
- end; { TOUPPER }
-
-
- procedure digout (dig : integer);
- {
- DIGOUT outputs the digit (whose value must be in the range from
- 0 to 9) to the terminal as a single ASCII character (from '0' to
- '9').
-
- Inputs: DIG = integer from 0 to 9
- Outputs: None (char is printed)
- Side Effects: None
- }
- begin
- write(fo, chr(dig + ord('0')) );
- end; { DIGOUT }
-
-
- procedure charout (ch : char);
- {
- CHAROUT outputs the character to the terminal as up to three
- ASCII digit characters. These characters represent the ASCII
- code value of the input character. For example, 'A' = 65 decimal,
- so CHAROUT('A') outputs '65'.
-
- Inputs: CH = char to output
- Outputs: None (digit chars are printed)
- Side Effects: None
- }
- var
- ch_val : integer;
- leading_zero : boolean;
- begin
- ch_val := ord(ch);
- leading_zero := TRUE;
-
- if (ch_val > 99) then begin { process 100's }
- leading_zero := FALSE;
- digout (ch_val div 100); { output 100's digit }
- ch_val := ch_val - (ch_val div 100)*100; { take away 100's }
- end;
-
- if (ch_val > 9) then begin { process 10's }
- digout (ch_val div 10); { output 10's digit }
- ch_val := ch_val - (ch_val div 10)*10; { take away 10's }
- end
- else if (NOT leading_zero) then write(fo,'0'); { output embedded '0' }
-
- digout (ch_val); { output 1's }
- end; { CHAROUT }
-
-
- procedure print_message;
- {
- PRINT_MESSAGE prints the message contained in the array MESSAGE
- to the screen.
-
- Inputs: MESSAGE = string passed globally
- Outputs: None (string is printed)
- Side Effects: None
- }
- var
- ctrl, idx : integer;
-
- begin
- idx := 1;
- while (message[idx] <> chr(0)) do begin
- case message[idx] of
- control : begin { control char processing }
- idx := idx + 1; { next char }
- ctrl := ord(toupper(message[idx])) - ord('@');
- charout (chr(ctrl));
- end;
- literal : begin { literal char follows }
- idx := idx + 1; { next char }
- case toupper(message[idx]) of
- lit_del : charout (delete);
- lit_esc : charout (escape);
- OTHERWISE charout (message[idx]);
- end;
- end;
- OTHERWISE charout (message[idx]); { output char }
- end; { case message[idx] }
- idx := idx + 1;
- if (message[idx] <> chr(0)) then write (fo,';'); { separator }
- end;
- end; { PRINT_MESSAGE }
-
-
- procedure get_message;
- {
- GET_MESSAGE clears the message buffer and reads a line
- of text from the keyboard into it.
-
- Inputs: None (keyboard)
- Outputs: MESSAGE (global) = user input followed by NULLs
- Side Effects: None
- }
- var
- idx : integer;
- begin
- if EOF(infile) then for idx:=1 to str_length do message[idx]:=' '
- else readln (infile, message);
- idx := str_length;
- while ((message[idx] = ' ') AND (idx <> 1)) do begin
- message[idx] := chr(0); { NULL fill at end }
- idx := idx - 1;
- end;
- if (message[idx] = literal) then begin { last char was a space }
- idx := idx + 1;
- message[idx] := ' ';
- end;
- end; { GET_MESSAGE }
-
-
- function get_char : char;
- {
- GET_CHAR inputs a line from the user and returns only the first
- character of it (non-blank).
-
- Inputs: None (keyboard)
- Outputs: Char returned
- Side Effects: None
- }
- var
- message_save : str;
- idx : integer;
- begin
- for idx := 1 to str_length do message_save[idx] := message[idx];
- get_message;
- idx := 1;
- while (message[idx] = ' ') do idx := idx + 1; { skip to non-blank }
- get_char := message[idx]; { set return char }
- for idx := 1 to str_length do message[idx] := message_save[idx];
- end; { GET_CHAR }
-
- {----------------------------------------------------------------}
- {
- 2. Routines for Terminal Output of Functions
- ANSWER_BACK
- CURSOR
- FUNCTION_KEY
- KEY_CLICK
- LINE_TYPE
- OTHER_TEXT
- PERSONAL_MESSAGE
- PROGRAM_KEYS (not yet used)
- USER_LINE
- }
-
- procedure answer_back;
- {
- ANSWER_BACK programs the answer-back string with the message
- contained in the message buffer. It is assumed that the message
- is 24 characters or less.
-
- Inputs: MESSAGE (global) = string to be placed in message line
- Outputs: None (Message is stored)
- Side Effects: None
- }
- begin
- write (fo, escape); { send ESCAPE char }
- write (fo, '\72;'); { store Answer Back Message }
- print_message; { output message }
- writeln(fo); up; { new line to end sequence }
- end; { USER_LINE }
-
-
-
- procedure cursor (ctype : char);
- {
- CURSOR programs the cursor type.
-
- Inputs: CTYPE = cursor type ('0'=blinking block, '1'=steady block,
- '2'=blinking underline, '3'=steady underline)
- Outputs: None (cursor is set)
- Side Effects: None
- }
- begin
- write (fo, escape); { ESCAPE char }
- write (fo, '[3;'); { set cursor }
- write (fo, ctype); { cursor type }
- write (fo, 'z'); { done }
- end; { CURSOR }
-
-
- procedure function_key (key : integer; shifted, xmit : boolean);
- {
- FUNCTION_KEY programs a function key with the string contained
- in MESSAGE.
-
- Inputs: MESSAGE (global) = message to go into function key
- KEY = number of function key (1 to 16)
- SHIFTED = is function key shifted (T/F)?
- XMIT = transmit string to computer (T/F)?
- Outputs: None (key is programmed)
- Side Effects: None
- }
- begin
- write (fo, escape); { send ESCAPE char }
- write (fo, '|'); { programming function key }
- if (shifted) then charout (chr(key+16)) { shifted key number }
- else charout (chr(key)); { unshifted key number }
- write (fo, ';'); { separator }
- if (xmit) then write (fo, '1') { full duplex - send to computer only }
- else write (fo, '2'); { local }
- write (fo, ';'); { separator }
- print_message; { send message }
- writeln(fo); up; { new line to end sequence }
- end; { FUNCTION_KEY }
-
-
- procedure key_click (click : boolean);
- {
- KEY_CLICK turns on the key click if CLICK is TRUE or off the
- key click if CLICK is FALSE.
-
- Inputs: CLICK = T if key click ON, F if key click OFF
- Outputs: None
- Side Effects: None (key click is affected)
- }
- begin
- if (click) then begin { turn on key click }
- write (fo, escape);
- writeln (fo, '[6;0z'); up;
- end
- else begin { turn off key click }
- write (fo, escape);
- writeln (fo, '[6;1z'); up;
- end;
- end; { KEY_CLICK }
-
-
- procedure line_type (selection : integer);
- {
- LINE_TYPE selects the 25th line as blank, status, or user
- message.
-
- Inputs: SELECTION = type (0=blank, 1=status, 2=user message)
- Outputs: None
- Side Effects: None (line type is selected)
- }
- begin
- write (fo, escape); { ESCAPE char }
- write (fo, '[0;'); { prefix }
- write (fo, chr(selection + ord('0'))); { digit char '0', '1', '2' }
- writeln (fo, 'z'); up;
- end; { LINE_TYPE }
-
-
- procedure other_text;
- {
- OTHER_TEXT simply echoes the text which follows the O command
- as-is (with escape sequence processing).
-
- Inputs: None
- Outputs: None
- Side Effects: None (text is sent to terminal)
- }
- var
- idx : integer;
- chx : char;
- begin
- idx := 1;
- repeat
- case toupper(message[idx]) of
- control : begin { output control char }
- idx := idx + 1;
- chx := toupper(message[idx]);
- chx := chr(ord(chx)-ord('@'));
- write (fo, chx);
- end;
- literal : begin { output literal char }
- idx := idx + 1;
- chx := message[idx];
- case toupper(chx) of
- lit_del : write (fo, delete);
- lit_esc : write (fo, escape);
- OTHERWISE write (fo, chx);
- end;
- end;
- OTHERWISE write (fo, message[idx]);
- end;
- idx := idx + 1;
- until (message[idx] = chr(0));
- end; { OTHER_TEXT }
-
- procedure personal_message (msg : integer);
- {
- PERSONAL_MESSAGE loads a personal message into the terminal.
- It is the user's responsibility to ensure that the personal
- message does not exceed 9 characters in length.
-
- Inputs: MESSAGE (global) = message to go into terminal
- MSG = Personal Message Number (0 to 7)
- Outputs: None (message is programmed)
- Side Effects: None
- }
- begin
- write (fo, escape); { send ESCAPE char }
- write (fo, '^'); { personal message }
- charout (chr(msg+64)); { PS number for message }
- write (fo, ';'); { separator }
- print_message; { send message }
- writeln(fo); up; { new line to end sequence }
- end; { PERSONAL_MESSAGE }
-
- procedure program_keys (ps : integer);
- {
- PROGRAM_KEYS programs a user-programmable key with a character
- sequence. It is the programmer's responsibility to ensure that
- no more than the maximum number of bytes allowed for a particular
- key are transmitted into it.
-
- Inputs: MESSAGE (global) = message to go into prog key
- PS = Ps value which identifies key
- Outputs: None (key is programmed)
- Side Effects: None
- }
- begin
- write (fo, escape); { send ESCAPE char }
- write (fo, '\'); { programming key }
- charout (chr(ps)); { key identifier }
- write (fo, ';'); { separator }
- print_message; { send message }
- writeln(fo); up; { new line to end sequence }
- end; { PROGRAM_KEYS }
-
-
- procedure user_line (double : boolean);
- {
- USER_LINE programs the User's Message Line on the TVI 970 with
- the string contained in MESSAGE. If DOUBLE is TRUE, the message
- appears as double-width.
-
- Inputs: MESSAGE (global) = string to be placed in message line
- DOUBLE = is double-width text to be output (T/F)?
- Outputs: None (Message is stored)
- Side Effects: None
- }
- begin
- write (fo, escape); { send ESCAPE char }
- write (fo, '^'); { store User Line Message }
- if (double) then begin { enable double-width chars }
- write (fo, ' '); { space to position cursor }
- write (fo, escape); { goto double-width }
- write (fo, '[5;1z');
- end;
- print_message; { output message }
- if (double) then begin { enable single-width chars }
- write (fo, escape); { goto single-width }
- write (fo, '[5;0z');
- end;
- writeln(fo); up; { new line to end sequence }
- end; { USER_LINE }
-
- {----------------------------------------------------------------}
- {
- 3. Command Processing Routines
- PROCESS_ANSWER_BACK
- PROCESS_CURSOR_TYPE
- PROCESS_FCT_KEY
- PROCESS_KEY_CLICK
- PROCESS_LINE_TYPE
- PROCESS_OTHER_TEXT
- PROCESS_PERSONAL_MESSAGE
- PROCESS_PROGRAM_KEYS (not yet used)
- PROCESS_USER_LINE
- }
-
- procedure process_answer_back;
- {
- PROCESS_ANSWER_BACK reads in the answer back message
- and programs the terminal with it.
-
- Inputs: None
- Outputs: None (message is programmed)
- Side Effects: None
- }
- begin
- get_message; { input message }
- answer_back; { send sequence }
- end; { PROCESS_ANSWER_BACK }
-
-
- procedure process_cursor_type;
- {
- PROCESS_CURSOR_TYPE programs the type of cursor, as selected
- from the file input. Syntax:
-
- Ccr
- where:
- c = B for Block (vs Underline) Cursor
- r = S for Steady (vs Blinking) Cursor
- }
- var
- opt : char;
- idx, ctype : integer;
- begin
- ctype := 2; { cursor is blinking underline }
- get_message; { read line into message buffer }
- idx := 1; { 1st char }
- repeat
- opt := toupper (message[idx]); { get next char }
- idx := idx + 1;
- case opt of
- 'B' : ctype := ctype - 2; { block cursor }
- 'S' : ctype := ctype + 1; { steady cursor }
- OTHERWISE ; { NULL statement }
- end; { case MESSAGE[IDX] }
- until (opt = chr(0));
- cursor (chr(ctype + ord('0'))); { set cursor }
- end; { PROCESS_CURSOR_TYPE }
-
-
- procedure process_fct_key;
- {
- PROCESS_FCT_KEY programs a function key. Syntax:
- Fst n text
- where:
- s = S if fct key is shifted
- t = L if local execution of key (term only)
- n = function key number (1-16)
- text = text of key
-
- Inputs: None
- Outputs: None
- Side Effects: None (Fct Key is programmed)
- }
- var
- shifted, xmit : boolean;
- opt : char;
- key_number : integer;
- begin
- xmit := TRUE; { default is xmit to computer }
- shifted := FALSE; { default is not shifted fct key }
- repeat
- if EOF(infile) then stop_all
- else read (infile, opt); { get next char }
- opt := toupper (opt); { capitalize }
- case opt of
- 'L' : xmit := FALSE; { don't xmit to computer }
- 'S' : shifted := TRUE; { shift fct key }
- OTHERWISE ; { NULL statement }
- end; { case OPT }
- until (opt = ' ');
- if EOF(infile) then stop_all;
- read (infile, key_number); { get number of key }
- if EOF(infile) then stop_all;
- read (infile, opt); { flush following char }
- get_message; { input text }
- function_key (key_number, shifted, xmit);
- end; { PROCESS_FCT_KEY }
-
-
- procedure process_key_click;
- {
- PROCESS_KEY_CLICK turns on and off the key click. Syntax:
- Kk
- where:
- k = Y if key click on (otherwise off)
-
- Inputs: None
- Outputs: None
- Side Effects: None (key click is affected)
- }
- var
- click : boolean;
- begin
- get_message;
- if (toupper(message[1]) = 'Y') then click := TRUE
- else click := FALSE;
- key_click (click);
- end; { PROCESS_KEY_CLICK }
-
-
- procedure process_line_type;
- {
- PROCESS_LINE_TYPE selects the type of line displayed at the
- 25th line. Syntax:
- Ll
- where:
- l = U if user, S if status (default is blank)
-
- Inputs: None
- Outputs: None
- Side Effects: None (line is set)
- }
- var
- ltype : integer;
- begin
- get_message; { input text }
- case toupper(message[1]) of
- 'U' : ltype := 2;
- 'S' : ltype := 1;
- OTHERWISE ltype := 0;
- end;
- line_type (ltype); { set line type }
- end; { PROCESS_LINE_TYPE }
-
-
- procedure process_other_text;
- {
- PROCESS_OTHER_TEXT sends the text following the command
- to the terminal with escape processing. Syntax:
- O<text>
-
- Inputs: None
- Outputs: None
- Side Effects: None (text is sent to terminal)
- }
- begin
- get_message; { input text }
- other_text; { output text }
- end; { PROCESS_OTHER_TEXT }
-
-
- procedure process_personal_message;
- {
- PROCESS_PERSONAL_MESSAGE programs one of the personal messages
- with a new character string. The user is responsible for
- ensuring that the string is not too long for the message's buffer.
- Syntax:
- M n text
- where:
- n = Message Number (0 to 7)
- text = text for message
-
- Inputs: None
- Outputs: None
- Side Effects: None (Message is programmed)
- }
- var
- opt : char;
- msg_number : integer;
- begin
- if EOF(infile) then stop_all;
- read (infile, msg_number); { get number of message }
- if EOF(infile) then stop_all;
- read (infile, opt); { flush following char }
- get_message; { input text }
- personal_message (msg_number);
- end; { PROCESS_PERSONAL_MESSAGE }
-
-
- procedure process_program_keys;
- {
- PROCESS_PROGRAM_KEYS programs one of the programmable keys
- with a new character string. The user is responsible for
- ensuring that the string is not too long for the key's buffer.
- Syntax:
- P n text
- where:
- n = Ps value of key (0 to 62)
- text = text for key
-
- Inputs: None
- Outputs: None
- Side Effects: None (Key is programmed)
- }
- var
- opt : char;
- key_number : integer;
- begin
- if EOF(infile) then stop_all;
- read (infile, key_number); { get number of key }
- if EOF(infile) then stop_all;
- read (infile, opt); { flush following char }
- get_message; { input text }
- program_keys (key_number);
- end; { PROCESS_PROGRAM_KEYS }
-
-
- procedure process_user_line;
- {
- PROCESS_USER_LINE inputs the user line and programs the terminal
- with it. Syntax:
- U<text>
-
- Inputs: None
- Outputs: None
- Side Effects: MESSAGE (global) is changed
- }
- begin
- get_message; { input user line }
- user_line (FALSE); { program line with normal width chars }
- end; { PROCESS_USER_LINE }
-
-
- {----------------------------------------------------------------}
- { 4. Mainline }
-
- var
- cmd : char;
- fkey : integer;
- fname : str;
- prompt : prompt_str;
- value
- prompt := '$_P970 Filename? ';
-
- begin { Mainline }
- writeln ('P970 Version ', version:3:1);
- lib$get_foreign (fname, prompt); { get file name from command line }
- open(infile, fname, OLD); { open command file }
- reset(infile); { rewind command file for input }
- open(fo,'SYS$OUTPUT', NEW, 4096); { open output file }
- rewrite(fo);
- repeat
- if EOF(infile) then cmd := 'E'
- else read (infile, cmd); { get command letter }
- cmd := toupper (cmd); { convert to upper case }
- case cmd of
- ' ' : get_message;
- 'A' : process_answer_back;
- 'C' : process_cursor_type;
- 'E' : cmd := 'Z';
- 'F' : process_fct_key;
- 'K' : process_key_click;
- 'L' : process_line_type;
-
- { Personal Messages Not Implemented because of error in manual }
- { 'M' : process_personal_message; }
-
- 'O' : process_other_text;
- 'P' : process_program_keys;
- 'U' : process_user_line;
- 'Z' : cmd := 'Z';
- ';' : get_message;
- OTHERWISE begin
- write ('Invalid Command: '); writeln (cmd);
- get_message;
- end;
- end;
- until (cmd = 'Z');
- end. { PROG970 }
- ::::::::::
- a970.ada
- ::::::::::
-
- with TEXT_IO;
-
- procedure PROG970 is
- --
- -- PROG970 in Pascal, by Rick Conn
- -- converted to Ada by Freeman Moore, April 1985
- --
- -- The purpose of PROG970 is to Program the TVI 970 terminal from a file,
- -- setting a variety of its features. These features include
- -- the following:
- --
- -- o User Message Line
- -- o Function Keys
- -- o Cursor Type
- -- o Key Click
- -- o 25th Line Display
- -- o Answerback Sequence
- -- o Programmable Keys
- -- o Personal Messages
- -- o Other User-Definable Char Sequences
- --
- -- PROG970 is divided into three major modules and one initialization
- -- and command selection mainline. The three major modules are:
- --
- -- 1. Support Routines
- -- -- provide low-level I/O et al
- -- -- routines are dependent and ordered
- -- 2. Routines for Terminal Output of Functions
- -- -- function-specific routines, such as
- -- program function key n with string s
- -- -- routines are independent; order is alphabetical
- -- -- routines in module 1 called for support
- -- 3. Command Processing Routines
- -- -- process command options and data for
- -- specific commands
- -- -- routines are independent; order is alphabetical
- -- -- routines in modules 1 and 2 called for support
- --
- --
-
- VERSION : constant STRING := "1.7"; -- version number
- SYS_OUTPUT : constant string := "SYS$OUTPUT"; -- user's terminal
- STR_LENGTH : constant := 255; -- max length of strings
- PROMPT_LENGTH : constant := 17; -- length of prompt string
- DELETE : constant CHARACTER := ASCII.DEL; -- DELETE character
- ESCAPE : constant CHARACTER := ASCII.ESC; -- ESCAPE character
- CR : constant CHARACTER := ASCII.CR; -- CARRIAGE RETURN character
- --
- NUL : constant CHARACTER := ASCII.NUL; -- used for end of string
- LITERAL : constant CHARACTER := '\'; -- following char is accepted
- -- literally
- CONTROL : constant CHARACTER := '^'; -- control char is represented
- LIT_ESC : constant CHARACTER := 'E'; -- literal code for ESC char
- -- (\E)
- LIT_DEL : constant CHARACTER := 'D'; -- literal code for DEL char
- -- (\D)
-
- HALT : exception;
-
- subtype STR is STRING (1 .. STR_LENGTH);
- subtype PROMPT_STR is STRING (1 .. PROMPT_LENGTH);
-
- MESSAGE : STR;
- INFILE : TEXT_IO.FILE_TYPE;
- FO : TEXT_IO.FILE_TYPE;
-
- CMD : CHARACTER;
- FKEY : INTEGER;
- FNAME : STR;
- FNAME_LENGTH : INTEGER;
- PROMPT : constant PROMPT_STR := "$_A970 Filename? ";
-
- package INT_IO is new TEXT_IO.INTEGER_IO (INTEGER);
-
- ------------------------------------------------------------------
- --
- -- 1. Support Routines
- -- STOP_ALL
- -- UP
- -- TOUPPER
- -- DIGOUT
- -- CHAROUT
- -- PRINT_MESSAGE
- -- GET_MESSAGE
- -- GET_CHAR
- --
-
- procedure STOP_ALL is
- --
- -- STOP_ALL halts execution of the program when an EOF condition
- -- is detected prematurely. It prints an appropriate error message.
- --
- -- Inputs: None
- -- Outputs: None
- -- Side Effects: None (program is halted)
- --
- begin
- TEXT_IO.NEW_LINE;
- TEXT_IO.PUT_LINE ("Premature End of File on Input File");
- raise HALT;
- end STOP_ALL;
-
-
- procedure UP is
- --
- -- UP moves cursor up one line so screen info is not lost by
- -- running P970.
- --
- -- Inputs: None
- -- Outputs: None
- -- Side Effects: None (cursor moves up)
- --
- begin
- TEXT_IO.PUT (FO, ESCAPE & 'M'); -- \E M moves cursor up one line
- end UP;
-
-
- function TOUPPER (CH : CHARACTER) return CHARACTER is
- --
- -- TOUPPER capitalizes the input character, if necessary.
- --
- -- Inputs: CH = char to capitalize
- -- Outputs: TOUPPER = capitalized output
- -- Side Effects: None
- --
- TEMP_CHAR : CHARACTER;
- begin
- if (CHARACTER'POS ('a') <= CHARACTER'POS (CH)) and
- (CHARACTER'POS (CH) <= CHARACTER'POS ('z')) then
- TEMP_CHAR := CHARACTER'VAL
- (CHARACTER'POS (CH) - CHARACTER'POS ('a') +
- CHARACTER'POS ('A'));
- else
- TEMP_CHAR := CH;
- end if;
-
- return TEMP_CHAR;
- end TOUPPER;
-
-
- procedure CHAROUT (CH : CHARACTER) is
- --
- -- CHAROUT outputs the character to the terminal as up to three
- -- ASCII digit characters. These characters represent the ASCII
- -- code value of the input character. For example, 'A' = 65 decimal,
- -- so CHAROUT('A') outputs '65'.
- --
- -- Inputs: CH = char to output
- -- Outputs: None (digit chars are printed)
- -- Side Effects: None
- --
- CH_VAL : INTEGER := CHARACTER'POS (CH);
- begin
-
- INT_IO.PUT (FO, CH_VAL, 1);
-
- end CHAROUT;
-
-
- procedure PRINT_MESSAGE is
- --
- -- PRINT_MESSAGE prints the message contained in the array MESSAGE
- -- to the screen.
- --
- -- Inputs: MESSAGE = string passed globally
- -- Outputs: None (string is printed)
- -- Side Effects: None
- --
-
- CTRL, IDX : INTEGER;
-
- begin
- IDX := 1;
-
- while (MESSAGE (IDX) /= NUL) loop
- case MESSAGE (IDX) is
- when CONTROL => -- control char processing
- IDX := IDX + 1; -- next char
- CTRL := CHARACTER'POS (TOUPPER (MESSAGE (IDX))) -
- CHARACTER'POS ('@');
- CHAROUT (CHARACTER'VAL (CTRL));
-
- when LITERAL => -- literal char follows
- IDX := IDX + 1; -- next char
- case TOUPPER (MESSAGE (IDX)) is
- when LIT_DEL => CHAROUT (DELETE);
- when LIT_ESC => CHAROUT (ESCAPE);
- when others => CHAROUT (MESSAGE (IDX));
- end case;
-
- when others => CHAROUT (MESSAGE (IDX)); -- output char
- end case;
- --
- IDX := IDX + 1;
-
- if (MESSAGE (IDX) /= NUL) then
- TEXT_IO.PUT (FO, ';'); -- separator
- --
- end if;
- end loop;
- end PRINT_MESSAGE;
-
-
- procedure GET_MESSAGE is
- --
- -- GET_MESSAGE clears the message buffer and reads a line
- -- of text from the keyboard into it.
- --
- -- Inputs: None (keyboard)
- -- Outputs: MESSAGE (global) = user input followed by NULLs
- -- Side Effects: None
- --
-
- IDX : INTEGER;
- begin
- MESSAGE := (1 .. STR_LENGTH => ' ');
-
- if not TEXT_IO.END_OF_FILE (INFILE) then
- TEXT_IO.GET_LINE (INFILE, MESSAGE, IDX);
- end if;
-
- IDX := STR_LENGTH;
-
- while ((MESSAGE (IDX) = ' ') and (IDX /= 1)) loop
- MESSAGE (IDX) := NUL; -- NULL fill at end
- IDX := IDX - 1;
- end loop;
-
- if (MESSAGE (IDX) = LITERAL) then
- -- last char was a space
- IDX := IDX + 1;
- MESSAGE (IDX) := ' ';
- end if;
- end GET_MESSAGE;
-
-
- function GET_CHAR return CHARACTER is
- --
- -- GET_CHAR inputs a line from the user and returns only the first
- -- character of it (non-blank).
- --
- -- Inputs: None (keyboard)
- -- Outputs: Char returned
- -- Side Effects: None
- --
-
- MESSAGE_SAVE : STR;
- IDX : INTEGER;
- TEMP_CHAR : CHARACTER;
- begin
- MESSAGE_SAVE := MESSAGE;
- GET_MESSAGE;
- IDX := 1;
-
- while (MESSAGE (IDX) = ' ') loop
- IDX := IDX + 1; -- skip to non-blank
- end loop;
-
- TEMP_CHAR := MESSAGE (IDX); -- set return char
- MESSAGE := MESSAGE_SAVE;
- return TEMP_CHAR;
- end GET_CHAR;
-
- ----------------------------------------------------------------
- --
- -- 2. Routines for Terminal Output of Functions
- -- ANSWER_BACK
- -- CURSOR
- -- FUNCTION_KEY
- -- KEY_CLICK
- -- LINE_TYPE
- -- OTHER_TEXT
- -- PERSONAL_MESSAGE
- -- PROGRAM_KEYS (not yet used)
- -- USER_LINE
- --
-
- procedure ANSWER_BACK is
- --
- -- ANSWER_BACK programs the answer-back string with the message
- -- contained in the message buffer. It is assumed that the message
- -- is 24 characters or less.
- --
- -- Inputs: MESSAGE (global) = string to be placed in message line
- -- Outputs: None (Message is stored)
- -- Side Effects: None
- --
- begin
- TEXT_IO.PUT (FO, ESCAPE); -- send ESCAPE char
- TEXT_IO.PUT (FO, "\72;"); -- store Answer Back Message
- PRINT_MESSAGE; -- output message
- TEXT_IO.NEW_LINE (FO);
- UP; -- new line to end sequence
- end ANSWER_BACK;
-
-
-
- procedure CURSOR (CTYPE : CHARACTER) is
- --
- -- CURSOR programs the cursor type.
- --
- -- Inputs: CTYPE = cursor type ('0'=blinking block, '1'=steady block,
- -- '2'=blinking underline, '3'=steady underline)
- -- Outputs: None (cursor is set)
- -- Side Effects: None
- --
- begin
- TEXT_IO.PUT (FO, ESCAPE); -- ESCAPE char
- TEXT_IO.PUT (FO, "[3;"); -- set cursor
- TEXT_IO.PUT (FO, CTYPE); -- cursor type
- TEXT_IO.PUT (FO, 'z'); -- done
- end CURSOR;
-
-
- procedure FUNCTION_KEY (KEY : INTEGER; SHIFTED, XMIT : BOOLEAN) is
- --
- -- FUNCTION_KEY programs a function key with the string contained
- -- in MESSAGE.
- --
- -- Inputs: MESSAGE (global) = message to go into function key
- -- KEY = number of function key (1 to 16)
- -- SHIFTED = is function key shifted (T/F)?
- -- XMIT = transmit string to computer (T/F)?
- -- Outputs: None (key is programmed)
- -- Side Effects: None
- --
- begin
- TEXT_IO.PUT (FO, ESCAPE); -- send ESCAPE char
- TEXT_IO.PUT (FO, '|'); -- programming function key
- if (SHIFTED) then
- CHAROUT (CHARACTER'VAL (KEY + 16)); -- shifted key number
- --
- else
- CHAROUT (CHARACTER'VAL (KEY)); -- unshifted key number
- end if;
-
- TEXT_IO.PUT (FO, ';'); -- separator
- if (XMIT) then
- TEXT_IO.PUT (FO, '1'); -- full duplex - send to computer
- -- only
- else
- TEXT_IO.PUT (FO, '2'); -- local
- end if;
-
- TEXT_IO.PUT (FO, ';'); -- separator
- PRINT_MESSAGE; -- send message
- TEXT_IO.NEW_LINE (FO);
- UP; -- new line to end sequence
- end FUNCTION_KEY;
-
-
- procedure KEY_CLICK (CLICK : BOOLEAN) is
- --
- -- KEY_CLICK turns on the key click if CLICK is TRUE or off the
- -- key click if CLICK is FALSE.
- --
- -- Inputs: CLICK = T if key click ON, F if key click OFF
- -- Outputs: None
- -- Side Effects: None (key click is affected)
- --
- begin
- if (CLICK) then
- -- turn on key click
- TEXT_IO.PUT (FO, ESCAPE);
- TEXT_IO.PUT_LINE (FO, "[6;0z");
- UP;
- else
- -- turn off key click
- TEXT_IO.PUT (FO, ESCAPE);
- TEXT_IO.PUT_LINE (FO, "[6;1z");
- UP;
- end if;
- end KEY_CLICK;
-
-
- procedure LINE_TYPE (SELECTION : INTEGER) is
- --
- -- LINE_TYPE selects the 25th line as blank, status, or user
- -- message.
- --
- -- Inputs: SELECTION = type (0=blank, 1=status, 2=user message)
- -- Outputs: None
- -- Side Effects: None (line type is selected)
- --
- begin
- TEXT_IO.PUT (FO, ESCAPE); -- ESCAPE char
- TEXT_IO.PUT (FO, "[0;"); -- prefix
- TEXT_IO.PUT (FO, CHARACTER'VAL (SELECTION + CHARACTER'POS ('0'))); -- digit char '0', '1', '2'
- TEXT_IO.PUT_LINE (FO, "z");
- UP;
- end LINE_TYPE;
-
-
- procedure OTHER_TEXT is
- --
- -- OTHER_TEXT simply echoes the text which follows the O command
- -- as-is (with escape sequence processing).
- --
- -- Inputs: None
- -- Outputs: None
- -- Side Effects: None (text is sent to terminal)
- --
-
- IDX : INTEGER;
- CHX : CHARACTER;
- begin
- IDX := 1;
-
- loop
- case TOUPPER (MESSAGE (IDX)) is
- when CONTROL => -- output control char
- IDX := IDX + 1;
- CHX := TOUPPER (MESSAGE (IDX));
- CHX := CHARACTER'VAL
- (CHARACTER'POS (CHX) - CHARACTER'POS ('@'));
- TEXT_IO.PUT (FO, CHX);
-
- when LITERAL => -- output literal char
- IDX := IDX + 1;
- CHX := MESSAGE (IDX);
-
- case TOUPPER (CHX) is
- when LIT_DEL => TEXT_IO.PUT (FO, DELETE);
- when LIT_ESC => TEXT_IO.PUT (FO, ESCAPE);
- when others => TEXT_IO.PUT (FO, CHX);
- end case;
-
- when others => TEXT_IO.PUT (FO, MESSAGE (IDX));
- end case;
-
- IDX := IDX + 1;
- exit when (MESSAGE (IDX) = NUL);
- end loop;
- end OTHER_TEXT;
-
- procedure PERSONAL_MESSAGE (MSG : INTEGER) is
- --
- -- PERSONAL_MESSAGE loads a personal message into the terminal.
- -- It is the user's responsibility to ensure that the personal
- -- message does not exceed 9 characters in length.
- --
- -- Inputs: MESSAGE (global) = message to go into terminal
- -- MSG = Personal Message Number (0 to 7)
- -- Outputs: None (message is programmed)
- -- Side Effects: None
- --
- begin
- TEXT_IO.PUT (FO, ESCAPE); -- send ESCAPE char
- TEXT_IO.PUT (FO, '^'); -- personal message
- CHAROUT (CHARACTER'VAL (MSG + 64)); -- PS number for message
- TEXT_IO.PUT (FO, ';'); -- separator
- PRINT_MESSAGE; -- send message
- TEXT_IO.NEW_LINE (FO);
- UP; -- new line to end sequence
- end PERSONAL_MESSAGE;
-
- procedure PROGRAM_KEYS (PS : INTEGER) is
- --
- -- PROGRAM_KEYS programs a user-programmable key with a character
- -- sequence. It is the programmer's responsibility to ensure that
- -- no more than the maximum number of bytes allowed for a particular
- -- key are transmitted into it.
- --
- -- Inputs: MESSAGE (global) = message to go into prog key
- -- PS = Ps value which identifies key
- -- Outputs: None (key is programmed)
- -- Side Effects: None
- --
- begin
- TEXT_IO.PUT (FO, ESCAPE); -- send ESCAPE char
- TEXT_IO.PUT (FO, '\'); -- programming key
- CHAROUT (CHARACTER'VAL (PS)); -- key identifier
- TEXT_IO.PUT (FO, ';'); -- separator
- PRINT_MESSAGE; -- send message
- TEXT_IO.NEW_LINE (FO);
- UP; -- new line to end sequence
- end PROGRAM_KEYS;
-
-
- procedure USER_LINE (DOUBLE : BOOLEAN) is
- --
- -- USER_LINE programs the User's Message Line on the TVI 970 with
- -- the string contained in MESSAGE. If DOUBLE is TRUE, the message
- -- appears as double-width.
- --
- -- Inputs: MESSAGE (global) = string to be placed in message line
- -- DOUBLE = is double-width text to be output (T/F)?
- -- Outputs: None (Message is stored)
- -- Side Effects: None
- --
- begin
- TEXT_IO.PUT (FO, ESCAPE); -- send ESCAPE char
- TEXT_IO.PUT (FO, '^'); -- store User Line Message
- if (DOUBLE) then
- -- enable double-width chars
- TEXT_IO.PUT (FO, ' '); -- space to position cursor
- TEXT_IO.PUT (FO, ESCAPE); -- goto double-width
- TEXT_IO.PUT (FO, "[5;1z");
- end if;
-
- PRINT_MESSAGE; -- output message
- if (DOUBLE) then
- -- enable single-width chars
- TEXT_IO.PUT (FO, ESCAPE); -- goto single-width
- TEXT_IO.PUT (FO, "[5;0z");
- end if;
-
- TEXT_IO.NEW_LINE (FO);
- UP; -- new line to end sequence
- end USER_LINE;
-
- ------------------------------------------------------------------
- --
- -- 3. Command Processing Routines
- -- PROCESS_ANSWER_BACK
- -- PROCESS_CURSOR_TYPE
- -- PROCESS_FCT_KEY
- -- PROCESS_KEY_CLICK
- -- PROCESS_LINE_TYPE
- -- PROCESS_OTHER_TEXT
- -- PROCESS_PERSONAL_MESSAGE
- -- PROCESS_PROGRAM_KEYS (not yet used)
- -- PROCESS_USER_LINE
- --
-
- procedure PROCESS_ANSWER_BACK is
- --
- -- PROCESS_ANSWER_BACK reads in the answer back message
- -- and programs the terminal with it.
- --
- -- Inputs: None
- -- Outputs: None (message is programmed)
- -- Side Effects: None
- --
- begin
- GET_MESSAGE; -- input message
- ANSWER_BACK; -- send sequence
- end PROCESS_ANSWER_BACK;
-
-
- procedure PROCESS_CURSOR_TYPE is
- --
- -- PROCESS_CURSOR_TYPE programs the type of cursor, as selected
- -- from the file input. Syntax:
- --
- -- Ccr
- -- where:
- -- c = B for Block (vs Underline) Cursor
- -- r = S for Steady (vs Blinking) Cursor
- --
-
- OPT : CHARACTER;
- IDX, CTYPE : INTEGER;
- begin
- CTYPE := 2; -- cursor is blinking underline
- GET_MESSAGE; -- read line into message buffer
- IDX := 1; -- 1st char
- loop
- OPT := TOUPPER (MESSAGE (IDX)); -- get next char
- IDX := IDX + 1;
-
- case OPT is
- when 'B' => CTYPE := CTYPE - 2; -- block cursor
- when 'S' => CTYPE := CTYPE + 1; -- steady cursor
- when others => null; -- NULL statement
- end case;
- -- case MESSAGE(IDX)
- exit when OPT = NUL;
- end loop;
-
- CURSOR (CHARACTER'VAL (CTYPE + CHARACTER'POS ('0'))); -- set cursor
- end PROCESS_CURSOR_TYPE;
-
-
- procedure PROCESS_FCT_KEY is
- --
- -- PROCESS_FCT_KEY programs a function key. Syntax:
- -- Fst n text
- -- where:
- -- s = S if fct key is shifted
- -- t = L if local execution of key (term only)
- -- n = function key number (1-16)
- -- text = text of key
- --
- -- Inputs: None
- -- Outputs: None
- -- Side Effects: None (Fct Key is programmed)
- --
-
- SHIFTED, XMIT : BOOLEAN;
- OPT : CHARACTER;
- KEY_NUMBER : INTEGER;
- begin
- XMIT := TRUE; -- default is xmit to computer
- SHIFTED := FALSE; -- default is not shifted fct key
- loop
- if TEXT_IO.END_OF_FILE (INFILE) then
- STOP_ALL;
- else
- TEXT_IO.GET (INFILE, OPT); -- get next char
- end if;
-
- OPT := TOUPPER (OPT); -- capitalize
- case OPT is
- when 'L' => XMIT := FALSE; -- don't xmit to computer
- when 'S' => SHIFTED := TRUE; -- shift fct key
- when others => null; -- NULL statement
- end case;
- -- case OPT
- exit when (OPT = ' ');
- end loop;
-
- if TEXT_IO.END_OF_FILE (INFILE) then
- STOP_ALL;
- end if;
-
- INT_IO.GET (INFILE, KEY_NUMBER); -- get number of key
- if TEXT_IO.END_OF_FILE (INFILE) then
- STOP_ALL;
- end if;
-
- TEXT_IO.GET (INFILE, OPT); -- flush following char
- GET_MESSAGE; -- input text
- FUNCTION_KEY (KEY_NUMBER, SHIFTED, XMIT);
- end PROCESS_FCT_KEY;
-
-
- procedure PROCESS_KEY_CLICK is
- --
- -- PROCESS_KEY_CLICK turns on and off the key click. Syntax:
- -- Kk
- -- where:
- -- k = Y if key click on (otherwise off)
- --
- -- Inputs: None
- -- Outputs: None
- -- Side Effects: None (key click is affected)
- --
-
- CLICK : BOOLEAN;
- begin
- GET_MESSAGE;
-
- if (TOUPPER (MESSAGE (1)) = 'Y') then
- CLICK := TRUE;
- else
- CLICK := FALSE;
- end if;
-
- KEY_CLICK (CLICK);
- end PROCESS_KEY_CLICK;
-
-
- procedure PROCESS_LINE_TYPE is
- --
- -- PROCESS_LINE_TYPE selects the type of line displayed at the
- -- 25th line. Syntax:
- -- Ll
- -- where:
- -- l = U if user, S if status (default is blank)
- --
- -- Inputs: None
- -- Outputs: None
- -- Side Effects: None (line is set)
- --
-
- LTYPE : INTEGER;
- begin
- GET_MESSAGE; -- input text
- case TOUPPER (MESSAGE (1)) is
- when 'U' => LTYPE := 2;
- when 'S' => LTYPE := 1;
- when others => LTYPE := 0;
- end case;
-
- LINE_TYPE (LTYPE); -- set line type
- end PROCESS_LINE_TYPE;
-
-
- procedure PROCESS_OTHER_TEXT is
- --
- -- PROCESS_OTHER_TEXT sends the text following the command
- -- to the terminal with escape processing. Syntax:
- -- O<text>
- --
- -- Inputs: None
- -- Outputs: None
- -- Side Effects: None (text is sent to terminal)
- --
- begin
- GET_MESSAGE; -- input text
- OTHER_TEXT; -- output text
- end PROCESS_OTHER_TEXT;
-
-
- procedure PROCESS_PERSONAL_MESSAGE is
- --
- -- PROCESS_PERSONAL_MESSAGE programs one of the personal messages
- -- with a new character string. The user is responsible for
- -- ensuring that the string is not too long for the message's buffer.
- -- Syntax:
- -- M n text
- -- where:
- -- n = Message Number (0 to 7)
- -- text = text for message
- --
- -- Inputs: None
- -- Outputs: None
- -- Side Effects: None (Message is programmed)
- --
-
- OPT : CHARACTER;
- MSG_NUMBER : INTEGER;
- begin
- if TEXT_IO.END_OF_FILE (INFILE) then
- STOP_ALL;
- end if;
-
- INT_IO.GET (INFILE, MSG_NUMBER); -- get number of message
- if TEXT_IO.END_OF_FILE (INFILE) then
- STOP_ALL;
- end if;
-
- TEXT_IO.GET (INFILE, OPT); -- flush following char
- GET_MESSAGE; -- input text
- PERSONAL_MESSAGE (MSG_NUMBER);
- end PROCESS_PERSONAL_MESSAGE;
-
-
- procedure PROCESS_PROGRAM_KEYS is
- --
- -- PROCESS_PROGRAM_KEYS programs one of the programmable keys
- -- with a new character string. The user is responsible for
- -- ensuring that the string is not too long for the key's buffer.
- -- Syntax:
- -- P n text
- -- where:
- -- n = Ps value of key (0 to 62)
- -- text = text for key
- --
- -- Inputs: None
- -- Outputs: None
- -- Side Effects: None (Key is programmed)
- --
-
- OPT : CHARACTER;
- KEY_NUMBER : INTEGER;
- begin
- if TEXT_IO.END_OF_FILE (INFILE) then
- STOP_ALL;
- end if;
-
- INT_IO.GET (INFILE, KEY_NUMBER); -- get number of key
- if TEXT_IO.END_OF_FILE (INFILE) then
- STOP_ALL;
- end if;
-
- TEXT_IO.GET (INFILE, OPT); -- flush following char
- GET_MESSAGE; -- input text
- PROGRAM_KEYS (KEY_NUMBER);
- end PROCESS_PROGRAM_KEYS;
-
-
- procedure PROCESS_USER_LINE is
- --
- -- PROCESS_USER_LINE inputs the user line and programs the terminal
- -- with it. Syntax:
- -- U<text>
- --
- -- Inputs: None
- -- Outputs: None
- -- Side Effects: MESSAGE (global) is changed
- --
- begin
- GET_MESSAGE; -- input user line
- USER_LINE (FALSE); -- program line with normal width chars
- end PROCESS_USER_LINE;
-
-
- ------------------------------------------------------------------
- -- 4. Mainline
-
- begin
- -- Mainline
- TEXT_IO.PUT_LINE ("P970 Version " & VERSION);
- TEXT_IO.PUT (PROMPT);
- TEXT_IO.GET_LINE (FNAME, FNAME_LENGTH);
- -- open command file
- TEXT_IO.OPEN (INFILE, TEXT_IO.IN_FILE, FNAME (1 .. FNAME_LENGTH));
- TEXT_IO.CREATE (FO, TEXT_IO.OUT_FILE, SYS_OUTPUT); -- open output file
-
- loop
- if TEXT_IO.END_OF_FILE (INFILE) then
- CMD := 'E';
- else
- TEXT_IO.GET (INFILE, CMD); -- get command letter
- end if;
-
- CMD := TOUPPER (CMD); -- convert to upper case
- case CMD is
- when ' ' => GET_MESSAGE;
-
- when 'A' => PROCESS_ANSWER_BACK;
-
- when 'C' => PROCESS_CURSOR_TYPE;
-
- when 'E' => CMD := 'Z';
-
- when 'F' => PROCESS_FCT_KEY;
-
- when 'K' => PROCESS_KEY_CLICK;
-
- when 'L' => PROCESS_LINE_TYPE;
-
- -- Personal Messages Not Implemented because of error in manual
- -- 'M' => process_personal_message;
-
- when 'O' => PROCESS_OTHER_TEXT;
-
- when 'P' => PROCESS_PROGRAM_KEYS;
-
- when 'U' => PROCESS_USER_LINE;
-
- when 'Z' => CMD := 'Z';
-
- when ';' => GET_MESSAGE;
-
- when others =>
- TEXT_IO.PUT ("Invalid Command: ");
- TEXT_IO.PUT (CMD);
- TEXT_IO.NEW_LINE;
- GET_MESSAGE;
- end case;
-
- exit when (CMD = 'Z');
- end loop;
-
- exception
- when HALT =>
- null;
- end PROG970;