 |
» |
|
 |
|
 |

Copyright (c) Digital Equipment Corporation 1988. All rights reserved
LAYERED PRODUCT: VAX PLI V3.1 OP/SYS: VMS V5.0
SOURCE: Digital Customer Support Center
OVERVIEW:
This program demonstrates how to perform a SYS$QIO with an itemlist to
send an escape sequence to the terminal.
*** CAUTION ***
This sample program has been tested using VAX PLI V3.1 on VMS V5.0.
However, we cannot guarantee its effectiveness because of the
possibility of errors in transmitting or implementing it. It is meant
to be used as a template for writing your own program, and it may
require modification for use on your system.
PROGRAM NOTES:
This program sends an escape sequence to the terminal with a $QIO. The
terminal should return an escape sequence. From this escape sequence,
you can determine the type of terminal on which the program is running.
See the I/O User's Guide, Part 1 and Terminal User's Guide for your
particular terminal. The escape sequence to be sent to a particular
terminal type may differ from what is shown below in the prompt field.
Check your Terminal User's guide for the correct escape sequence.
NOTE: The program will also detect when a partial escape sequence is
sent back from the terminal.
When an item list is used with a $QIO, the function code can consist
of ONLY the following:
io$_readvblk|io$m_extend
PROGRAM SAMPLE:
qioterm: proc options(main);
%include $iodef;
%include $stsdef;
%include $ssdef;
%include $trmdef;
%include sys$assign;
%include sys$qio;
dcl x char(2);
dcl escr char(1) init(''); /* This is an escape character
equal to the value of 27.
It may appear as a '$'
depending on the editor used.
*/
dcl term char(11) init('sys$command');
dcl termch fixed bin(15) init(0);
dcl iosb(4) fixed bin(15);
dcl efn fixed bin(31) init(1);
dcl prompt char(4);
dcl func bit(16) aligned;
dcl p1 char(15) init(' ');
dcl timer fixed bin(31) init(5);
dcl overflow char(10);
dcl 1 itemlist,
2 part1,
3 bufflen1 fixed bin(15), /* specifying prompt string */
3 itemcode1 fixed bin(15) init(trm$_prompt),
3 buffaddr1 pointer,
3 rtnaddr1 fixed bin(31) init(0),
2 part2,
3 bufflen2 fixed bin(15) init(0), /* detect partial esc seq*/
3 itemcode2 fixed bin(15) init(trm$_esctrmovr),
3 buffdata fixed bin(31) init(10),
3 rtnaddr2 fixed bin(31) init(0),
2 part3,
3 bufflen3 fixed bin(15) init(0), /* set escape as terminator*/
3 itemcode3 fixed bin(15) init(trm$_modifiers),
3 buffdata3 bit(32) init(trm$m_tm_escape),
3 rtnaddr3 fixed bin(31) init(0);
buffaddr1 = addr(prompt);
bufflen1 = 4;
/* assign a channel to the terminal */
sts$value = SYS$ASSIGN(term,termch,,);
IF ^sts$success
then signal vaxcondition(sts$value);
/* set up the escape sequence to query the terminal */
prompt = escr||'[>c';
/* perform the qio to send the escape sequence to the terminal */
/* io$m_extend indicates that an item list will be sent as P5 */
func = io$_readvblk | io$m_extend;
sts$value = SYS$QIOW(efn,termch,func,iosb,,,p1,15,,,ref(itemlist),36);
if ^sts$success
then signal vaxcondition(sts$value);
if iosb(1) = ss$_timeout
then put skip list('timeout');
else if iosb(1) = ss$_partescape
then put skip list('partial escape sequence detected');
else if IOSB(1) ^=ss$_normal
then signal vaxcondition(iosb(1));
/* determine the terminal type based on the escape sequence returned */
x = substr(p1,4,2);
if x = '1;'
then put skip list('vt220');
else if x = '18'
then put skip list('vt330');
else if x = '19'
then put skip list('vt340');
else if x = '24'
then put skip list('vt320');
else put skip list('unknown');
put skip list('***end of processing***');
end qioterm;
|
buy online or call 1.800.AT.COMPAQ
|
|