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
60
61
62
63
64
65
66
67
68
69
70
71
|
############################################################################
#
# File: ostrip.icn
#
# Subject: Program to show virtual-machine op-code strip
#
# Author: Ralph E. Griswold
#
# Date: March 26, 2002
#
############################################################################
#
# This file is in the public domain.
#
############################################################################
#
# This program produces a listing of virtual machine codes and the events
# that occur between them.
#
# The following option is supported:
#
# -o s direct output to file s; default &output
#
############################################################################
#
# Requires: MT Icon and event monitoring
#
############################################################################
#
# Links: evinit, evsyms, opnames, options
#
############################################################################
link evinit
link evsyms
link opnames
link options
$include "evdefs.icn"
procedure main(args)
local codes, esmap, opmap, opcode, opts, output
opts := options(args, "o:")
output := open(\opts["o"], "w") | &output
EvInit(args) | stop("*** cannot load SP")
opmap := opnames()
esmap := evsyms()
opcode := cset(E_Opcode)
while EvGet(opcode) do { # get to first "real" op-code
if opmap[integer(&eventvalue)] == "Invoke" then {
writes(output, "Invoke |")
break()
}
}
while EvGet() do {
if &eventcode === E_Opcode then {
write(output)
writes(output, left(opmap[integer(&eventvalue)], 10), "|")
}
else writes(output, " ", esmap[&eventcode])
}
write(output)
end
|