SUBROUTINE REMOTE_AST C C This AST routine is entered when the read request for the remote C terminal completes. It then writes the data read from the remote C to the local terminal and the log file (if any). C INCLUDE 'COM.INC/NOLIST' EXTERNAL LOCAL_WRITE_AST STATUS_CODE = RIOSB(1) ! Copy the status code. NBYTES = RIOSB(2) ! and the byte count. IF (INTERRUPT_TYPED) GO TO 9999 C C Check the I/O status. C IF (STATUS_CODE .EQ. SS$_ABORT) GO TO 100 IF (NBYTES .EQ. 0) GO TO 9900 ! Nothing read, nothing to write. IF (.NOT. STATUS_CODE) THEN IF (STATUS_CODE .NE. SS$_TIMEOUT) THEN CALL CHECK_STATUS('REMOTE_READ_AST',STATUS_CODE) GO TO 9900 ! Continue ... ENDIF ENDIF C C Copy incoming characters to the logfile buffer. C CALL WRITE_LOGFILE(RBUFFER,NBYTES) C C When running in slave mode (no local terminal), we simply set the C receiver not busy and wakeup the mainline to rearm the remote read. C IF (SLAVE_MODE) GO TO 9900 ! Set receiver not busy/wakeup mainline C C Echo character(s) from the remote at the local terminal. C STATUS = SYS$QIO(%VAL(LEFN_OUT),%VAL(LCHAN_OUT), 1 %VAL(IO$_WRITELBLK + IO$M_NOFORMAT), 1 XLIOSB,LOCAL_WRITE_AST,,RBUFFER,%VAL(NBYTES),,,,) IF (.NOT. STATUS) THEN CALL CHECK_STATUS('LOCAL_WRITE_QIO',STATUS) GO TO 9900 ENDIF 100 RETURN C C On errors, set the receiver not busy, and wakeup the mainline. C 9900 RECEIVER_BUSY = .FALSE. ! Set receiver not busy. 9999 CALL WAKE_UP() ! Wakeup the mainline code. RETURN END SUBROUTINE LOCAL_AST C C This AST routine is entered when the local read completes. C The character(s) read are then written to the remote system. C If local echo is enabled, the characters are also written to C the log file (if any). C INCLUDE 'COM.INC/NOLIST' XMITTER_BUSY = .FALSE. ! Set transmitter not busy. STATUS_CODE = LIOSB(1) ! Copy the status code. NBYTES = LIOSB(2) ! and the byte count. C C If the read failed, don't write to the remote. C IF (STATUS_CODE .EQ. SS$_ABORT) GO TO 500 IF (NBYTES .EQ. 0) GO TO 500 ! Nothing read, nothing to write. IF (.NOT. STATUS_CODE) THEN CALL CHECK_STATUS('LOCAL_QIO',STATUS_CODE) GO TO 500 ! And continue .. ENDIF C C Next we check for the interrupt character to escape to Vaxnet C command level. When the interrupt character is detected, the C INTERRUPT_TYPED flag is set, and we wake up the mainline which C then detects the interrupt character has been typed. C C If BREAK character detection is enabled and we detect the BREAK C character, we send the BREAK signal to the remote system. C C We also check for the XOFF/XON characters used to stop/resume C output to the terminal. If the SUSPEND_OUTPUT flag is .TRUE. C then REMOTE_READ routine will not issue any reads to prevent C the terminal from being overrun. C DO 100 I=1,NBYTES IF (LBUFFER(I) .EQ. INTERRUPT_CHAR(1)) THEN INTERRUPT_TYPED = .TRUE. ! Show interrupt was typed. GO TO 500 ! And continue ... ELSEIF (BREAK_IS_ENABLED) THEN IF (LBUFFER(I) .EQ. BREAK_CHAR(1)) THEN CALL SEND_BREAK() ! Send the BREAK signal. GO TO 500 ! And continue ... ENDIF ELSEIF (LBUFFER(I) .EQ. XOFF) THEN SUSPEND_OUTPUT = .TRUE. ! Stop output to the terminal. ELSEIF (LBUFFER(I) .EQ. XON) THEN SUSPEND_OUTPUT = .FALSE. ! Resume output to the terminal. ENDIF 100 CONTINUE C C If doing local echoing, all incoming characters from the local C terminal are copied to the logfile buffer to simulate echoing C from the remote system. C IF (LOCAL_ECHO) CALL WRITE_LOGFILE(LBUFFER,NBYTES) C C Write the characters read to the remote system. C STATUS = SYS$QIO(%VAL(REFN_OUT),%VAL(RCHAN_OUT), 1 %VAL(IO$_WRITELBLK + IO$M_NOFORMAT), 1 XRIOSB,,,LBUFFER,%VAL(NBYTES),,,,) CALL CHECK_STATUS('REMOTE_WRITE_QIO',STATUS) C C Wake up the main line to reactivate the local read. C 500 CALL WAKE_UP() ! Wake up the mainline. RETURN END SUBROUTINE LOCAL_WRITE_AST C C This AST routine is entered when the write request to the local C terminal completes. This routine was added to synchonize the C remote reads. Without this routine, remote reads were completing C faster than local writes which eventually exceeded the buffered C I/O quota. Now, the next remote read will not be issued until C the local write completes. C INCLUDE 'COM.INC/NOLIST' RECEIVER_BUSY = .FALSE. ! Set receiver not busy. STATUS_CODE = XLIOSB(1) ! Copy the status code. C C If interrupt not typed, check the I/O status return. C IF (.NOT. INTERRUPT_TYPED) THEN IF (STATUS_CODE .NE. SS$_ABORT) THEN CALL CHECK_STATUS ('LOCAL_WRITE_AST', STATUS_CODE) ENDIF CALL WAKE_UP() ! Wakeup the mainline code. ENDIF RETURN END