home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / fish / telecom / vlt_455 / rexx / marginbell.vlt < prev    next >
Text File  |  1991-02-12  |  1KB  |  53 lines

  1. /** MarginBell.vlt
  2. *
  3. *   Example program to intercept keystrokes.
  4. *   This one implements a margin bell at 72 colums
  5. *
  6. **/
  7.  
  8. margincol = 72
  9. /*
  10. *   Open a port
  11. */
  12. mp = openport(MARGIN_BELL)
  13. /*
  14. *   Tell VLT to send us stuff
  15. */
  16. "wedge keystrokes MARGIN_BELL"
  17. /*
  18. *   Loop until quitflag is 1, waiting for packets
  19. */
  20. do forever
  21.    if quitflag = 1 then leave
  22.    t = waitpkt(MARGIN_BELL)
  23. /*
  24. *   We got a number of packets. Loop over all of them.
  25. */
  26.    do ff = 1
  27.       p = getpkt(MARGIN_BELL)
  28.       if c2d(p) = 0 then leave ff
  29.       line = getarg(p)
  30.       t = reply(p, 1)
  31. /*
  32. *   Got something. Find out what...
  33. */
  34.       parse var line command code qual iaddr char .
  35. /*
  36. *   If we got an "esc", quit.
  37. */
  38.       if char = '1B'x then do
  39.          quitflag = 1
  40.          "$1: BEEP; delay .7; BEEP; delay .7; BEEP"
  41.       end
  42. /*
  43. *   Else check the current cursor x position. Send VLT a BEEP command if it
  44. *   is at the margin column.
  45. */
  46.       else do
  47.          "extract x"
  48.          if VLT.x = margincol then "BEEP"
  49.       end
  50.    end
  51. end
  52.  
  53.