summaryrefslogtreecommitdiff
path: root/ipl/mprogs/playev.icn
blob: 7fdf595d31efc0957218220d3eebee29c6f22ce0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
############################################################################
#
#	File:     playev.icn
#
#	Subject:  Program to play back events
#
#	Author:   Ralph E. Griswold
#
#	Date:     August 16, 1994
#
############################################################################
#
#   This file is in the public domain.
#
############################################################################
#
#  This program plays back events saved by recordev.  Since recordev
#  uses image() for recording, some information may be lost.
#
#  This program is called as
#
#	playev em <history
#
#  where history is a file produced by recordev.
#
############################################################################
#
#  Requires:   Version 9.0 MT Icon with event monitoring
#
############################################################################
#
#  Links: evinit, ivalue
#
############################################################################

link evinit
link ivalue

procedure main(args)
   local mask, prog

   prog := load(pop(args), args) | stop("*** cannot EM")

   variable("&eventsource", prog) := &current | stop("no eventsource?")

   mask := @prog				# activate EM to get its mask

   while &eventcode := read() do {
      &eventcode := ivalue(&eventcode)		# can fail
      &eventvalue := read() | break
      if find(&eventcode, mask) then {
         &eventvalue := ivalue(&eventvalue)	# can fail
         mask := event(, , prog)		# pass event; get mask back
         }
      }

   cofail(prog)

end