home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / ipl / progs / icalls.icn < prev    next >
Text File  |  2000-07-29  |  1KB  |  48 lines

  1. ############################################################################
  2. #
  3. #    File:     icalls.icn
  4. #
  5. #    Subject:  Program to tabulate Icon calls
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     November 25, 1992
  10. #
  11. ############################################################################
  12. #
  13. #   This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  This program processes trace output and tabulates calls of procedures
  18. #
  19. ############################################################################
  20.  
  21. procedure main()
  22.    local procs, name, args
  23.  
  24.    procs := table()
  25.  
  26.    every !&input ? {
  27.       while tab(find("| ") + 2)            # get rid of level bars
  28.       if name := tab(upto('(')) then {        # if call
  29.          move(1)
  30.          args := tab(-1)
  31.          /procs[name] := table(0)        # new table if necessary
  32.          procs[name][args] +:= 1
  33.          }
  34.       }
  35.  
  36.    procs := sort(procs, 3)
  37.  
  38.    while write(get(procs)) do {            # write the procedure name
  39.       write()
  40.       args := sort(get(procs), 3)        # sorted arguments
  41.       while write(left(get(args), 20), right(get(args),6))
  42.       write()
  43.       }
  44.  
  45. end
  46.  
  47.    
  48.