10 SUB Dev_Line_Scan(INTEGER EchoVal, & STRING Scan$_Type, & INTEGER KbdTime, & INTEGER TT_Chan, & STRING Output$_S, & INTEGER Buff_Len, & LONG SYS_STATUS) ! ! Dev_Line_Scan-- This Procedure uses the SYS$QIO and SYS$QIOW functions to ! poll a device and read the device's output one Line at a time. ! Scan$_Type is a string of 4 characters; the only character of any ! importance is the first one. DevScan interprets this first character ! as follows: ! 's', 'S': scan the device with a specified timeout ! 'w', 'W': wait for a character no timeout ! 'f', 'F': same as scan but with no interpretation of DEL, ^U, or ^R ! 'p', 'P': QIO Read with Timed, Typeahead purge, and temporary pass all ! 'c', 'C': Scan with Type Ahead purge. ! OTHERWISE ! It enables SCAN ! ! KbdTime is the number of seconds to wait for timeout if applicable. ! ! KbdChan is the channel number of the device to be read. ! ! Output$_S is the Character read during a succesful read operation. ! ! SYS_STATUS is the status of the read, a 1 indicates a succesful read. ! DECLARE INTEGER & Term, & KbdType, & KbdWait, & KbdScan, & KbdPass, & KbdNoFilter, & KbdPurge, & Kbdfunct DECLARE STRING & Ch, & TCh MAP (IO_BLOCK) WORD IO_STATUS & ,IO_COUNT & ,LONG DEV_INFO MAP (IO_BLOCK) STRING IOSB = 8 EXTERNAL INTEGER FUNCTION SYS$QIOW EXTERNAL LONG CONSTANT SS$_NORMAL EXTERNAL LONG CONSTANT SS$_TIMEOUT EXTERNAL INTEGER CONSTANT IO$M_NOECHO EXTERNAL INTEGER CONSTANT IO$M_TIMED EXTERNAL INTEGER CONSTANT IO$M_NOFILTR EXTERNAL INTEGER CONSTANT IO$M_PURGE EXTERNAL INTEGER CONSTANT IO$_TTYREADALL EXTERNAL INTEGER CONSTANT IO$_READLBLK EXTERNAL INTEGER CONSTANT IO$_READVBLK EXTERNAL INTEGER CONSTANT IO$_READPBLK Buff_Len = LEN(Output$_S) Output$_S = SPACE$(Buff_Len) IF EchoVal THEN KbdWait = IO$_ReadVBlk ! wait for Char -- With echo ELSE KbdWait = IO$_ReadVBlk + IO$M_NoEcho ! wait for Char -- No echo END IF KbdScan = KbdWait + IO$M_Timed ! if no char then continue KbdPurge = KbdScan + IO$M_Purge ! Scan and Purge Type ahead KbdNoFilter = KbdScan + IO$M_NoFiltr ! KbdScan & Pass ^U, ^R, KbdPass = IO$_TTYReadAll + IO$M_Timed + IO$M_NoEcho !Temporary PassAll SELECT LEFT$(Scan$_Type,1%) CASE = "s", "S" KbdType = KbdScan CASE = "w", "W" KbdType = KbdWait CASE = "f", "F" KbdType = KbdNoFilter CASE = "c", "C" KbdType = KbdPurge CASE = "p", "P" KbdType = KbdPass CASE ELSE KbdType = KbdScan END SELECT SYS_STATUS = 0 SYS_STATUS = SYS$QIOW(,TT_Chan BY VALUE, & KbdType BY VALUE, & IOSB BY REF,,, & Output$_S BY REF, & Buff_Len BY VALUE, & KbdTime BY VALUE,,,) Buff_Len = IO_Count IF (IO_STATUS = SS$_TIMEOUT) THEN SYS_STATUS = IO_STATUS IO_Status = SS$_Normal END IF END SUB