home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 168.img / XTMK42-2.ZIP / XT3270.XTS < prev    next >
Encoding:
Text File  |  1990-03-06  |  1.8 KB  |  81 lines

  1. /*
  2.  
  3.     Copyright (c) 1987, Digital Communications Associates, Inc.
  4.     All rights reserved.
  5.  
  6.     This library is for emulation of the IRMA Basica subroutines
  7.     in CASL.
  8.  
  9.     Procedure:
  10.  
  11.     WaitXclock    Wait on the X-clock to go away for good
  12.  
  13.             Note that the TimerValue variable may be increased
  14.             or decreased if this routine does not wait enough
  15.             or waits too long.
  16.  
  17.     WaitString    Wait for a string to appear on the screen
  18.  
  19.             parameters:  wait_str - string to wait for
  20.                      wait_timer - how long to wait
  21.  
  22.             Returns FOUND_STR as string if found, else null if
  23.             not found.
  24. */
  25.  
  26.     global string FOUND_STR
  27.  
  28. proc WaitXclock
  29.  
  30.     TimerValue = 50            /* Increase to wait longer
  31.                        Decrease to shorten wait time */
  32.     if device = "MODEM" then {
  33.         case terminal of
  34.             "FTTERM":    TermString = "X" : TermColumn = 10
  35.             "TYMNET78":    TermString = "L" : TermColumn = 59
  36.             default:    TermString = "X" : TermColumn = 8
  37.         endcase
  38.     }
  39.     else TermString = "X" : TermColumn = 8
  40.  
  41.     Xclock = WinString(0FEh, TermColumn, 1, 16)
  42.  
  43. label WaitX
  44.     while Xclock = TermString
  45.         wait 1 tick
  46.         Xclock = WinString(0FEh, TermColumn, 1, 16)
  47.         wend
  48.  
  49.     stime = Systime + TimerValue
  50.     repeat
  51.         wait 1 tick
  52.         Xclock = WinString(0FEh, TermColumn, 1, 16)
  53.         if Xclock = TermString then jump WaitX
  54.     until stime = Systime
  55.  
  56. endproc
  57.  
  58.  
  59. proc    WaitString takes wait_str, wait_timer
  60.  
  61.     FOUND_STR = wait_str            /* assume we'll find it */
  62.  
  63.     maxtime = (intval (wait_timer)) * 10    /* convert to ticks */
  64.     timecnt = 0
  65.  
  66.     while maxtime > timecnt
  67.             for x = 0 to 23
  68.                 if (instr(winstring((x),0,80,16),wait_str)) <> 0 then goto WaitStrEnd
  69.             next x
  70.             wait 1 tick
  71.             timecnt = timecnt + 1
  72.     wend
  73.  
  74.     FOUND_STR = ""            /* didn't find it, return null */
  75.  
  76. label   WaitStrEnd
  77.  
  78. endproc
  79.  
  80.  
  81.