!*! Updated on 01-Dec-93 at 12:37 AM by James A. Jarboe I V; edit time: 0:20:35
!************************************************************************
!                                                                       *
! CLRTOI.BAS - Tests the CLRTOI.SBR to Clear Timeout in Progress flag.  *
!                                                                       *
!************************************************************************
! Must have CLRTOI.SBR from the AMUS Network.
! Place CLRTOI.SBR in BAS: or load into user or system memory.
!
! CLRTOI - Clears the time out in progress flag for an ESP user.
!          This subroutine can be very usefull for reseting the timeout
!          in progress condition.
!          Some users use the Timeout feature of ESP, but don't use
!          SIGNIN which resets the Timeout in progress flag. Most
!          notably what happens is the next time the user enters an
!          ESP program it automatically times out.
!          CLRTOI.SBR used at the beginning of a program will reset
!          this condition so the user does not automatically end out
!          of an ESP program when they have just started when they
!          have previously timed out.
! CLRTOI - Also has some other neat uses as is shown in this program.
!
++include BAS:SYSSTD.BSI                ! Get Standard ESP STUFF.
!
!*******************************
!                              *
!     SETUSR opcode defs.      *
!                              *
!*******************************
!
       MAP1 SU'FLG,    F, 6, 1         ! Set user flags.
       MAP1 SU'RDS,    F, 6, 2         ! Set user read security.
       MAP1 SU'WTS,    F, 6, 3         ! Set user write security.
       MAP1 SU'DFP,    F, 6, 4         ! Set default printer.
       MAP1 SU'TMO,    F, 6, 5         ! Set time-out period in seconds.
       MAP1 SU'TOC,    F, 6, 6         ! Set time-out character.
       MAP1 SU'NAM,    F, 6, 7         ! Set user name.
       MAP1 SU'BCL,    F, 6, 8         ! Set default background color.
       MAP1 SU'FCL,    F, 6, 9         ! Set default foreground color.
       MAP1 SU'CMP,    F, 6, 10        ! Set SIGNIN company number.
       MAP1 SU'MNU,    F, 6, 11        ! Set SIGNIN menu item number.
       MAP1 SU'CNM,    F, 6, 12        ! Set company name.
       MAP1 SU'HLP,    F, 6, 13        ! Set default help file.
       MAP1 SU'IIF,    F, 6, 14        ! Set indirect input file.
       MAP1 SU'LVL,    F, 6, 15        ! Set user level.
       MAP1 SU'EXP,    F, 6, 16        ! Set user experience.
       MAP1 SU'IIS,    F, 6, 17        ! Set indirect input string.
       MAP1 SU'CII,    F, 6, 18        ! Clear indirect input levels.
       MAP1 SU'III,    F, 6, 19        ! Set indirect input iteration.
       MAP1 SU'KRF,    F, 6, 20        ! Set keystroke record file name.
       MAP1 SU'CKR,    F, 6, 21        ! Close keystroke record level(s).
       MAP1 SU'PAG,    F, 6, 22        ! Set PAGE glossary item value.
       MAP1 SU'ACM,    F, 6, 10000     ! Accumulator base value.

MAP1 TIMAMT, F, 6, 5                    ! Time out time, (5 seconds.)
MAP1 TIMCHR, F, 6, 3                    ! Time out character (CTRL-C)
MAP1 ITERAT, F, 6                       ! Number of iterations.

! Init Terminal.
!
       XCALL CLRTOI                    ! Preclear timeout in progress.
       XCALL INITRM, "Testing Time-out","James A. Jarboe IV"

! Fetch Screen.
!
       XCALL FETCH, "CLRTOI.SCR", SCREEN, X
       IF X goto BAD'SCREEN

! Set user for Timeout time and timeout character.
!
       XCALL SETUSR, SU'TMO, TIMAMT    ! Set Timeout time.
       XCALL SETUSR, SU'TOC, TIMCHR    ! Set timeout character.
       XCALL SETVAL, SCREEN, 2, TIMAMT ! Show timeout time on screen.

       CHAR = ESP'BEGLIN               ! Preset edit character.
       FIELD = 1                       ! Preset field.

! The loop!
!
LOOP:
       XCALL GTSCR, SCREEN, CHAR, FIELD  ! Get user input or wait.

! MENU Key Exit.
!
       IF (CHAR and 255) = ESP'MENU goto OUTOF

! EXECUTE key Process.
!
       IF (CHAR and 255) = ESP'EXECUTE goto EXECUTE

! Timeout - update screen.
!
       IF (CHAR and 255) = TIMCHR call UPDATE

! Always loop.
!
       GOTO LOOP


UPDATE:
       ITERAT = ITERAT + 1               ! Bump iterations.
       XCALL SETVAL, SCREEN, 3, ITERAT   ! Set value to screen.
       XCALL CLRTOI                      ! Clear timeout in progress.
       CHAR = ESP'BEGLIN                 ! Reset edit character.
       RETURN                            ! and do me again.

EXECUTE:
       XCALL ERRDSP, "User Pressed EXECUTE..Now Leaving"
       GOTO OUTOF

MENU:
       XCALL ERRDSP, "User Pressed MENU..Now Leaving"
       GOTO OUTOF

BAD'SCREEN:
       XCALL ERRDSP, "Problem Loading CLRTOI.SCR"
       GOTO OUTOF

ERR'ROUTINE:
       XCALL ERRDSP, "Basic Problem"
       GOTO OUTOF

OUTOF:
       XCALL INITRM
       END