summaryrefslogtreecommitdiff
path: root/ipl/progs/icalls.icn
blob: 3a9d03cc2a11913e2e13cbd020dc42b39193bda7 (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
############################################################################
#
#	File:     icalls.icn
#
#	Subject:  Program to tabulate Icon calls
#
#	Author:   Ralph E. Griswold
#
#	Date:     November 25, 1992
#
############################################################################
#
#   This file is in the public domain.
#
############################################################################
#
#  This program processes trace output and tabulates calls of procedures
#
############################################################################

procedure main()
   local procs, name, args

   procs := table()

   every !&input ? {
      while tab(find("| ") + 2)			# get rid of level bars
      if name := tab(upto('(')) then {		# if call
         move(1)
         args := tab(-1)
         /procs[name] := table(0)		# new table if necessary
         procs[name][args] +:= 1
         }
      }

   procs := sort(procs, 3)

   while write(get(procs)) do {			# write the procedure name
      write()
      args := sort(get(procs), 3)		# sorted arguments
      while write(left(get(args), 20), right(get(args),6))
      write()
      }

end