From 6ab0c0f5bf14ed9c15370407b9ee7e0b4b089ae1 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Sun, 27 Jan 2013 23:51:56 +0000 Subject: Initial upstream version 9.4.3 --- ipl/progs/fnctab.icn | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 ipl/progs/fnctab.icn (limited to 'ipl/progs/fnctab.icn') diff --git a/ipl/progs/fnctab.icn b/ipl/progs/fnctab.icn new file mode 100644 index 0000000..669e379 --- /dev/null +++ b/ipl/progs/fnctab.icn @@ -0,0 +1,67 @@ +############################################################################ +# +# File: fnctab.icn +# +# Subject: Program to list function usage +# +# Author: Ralph E. Griswold +# +# Date: June 18, 1994 +# +############################################################################ +# +# This file is in the public domain. +# +############################################################################ +# +# This program processes an MVT token file and tabulates the usage +# of functions. +# +# Since function usage cannot be determined completely from static +# analysis, the results should be viewed with this limitation in mind. +# +############################################################################ + +procedure main() + local fncset, fnctab, line, count, name, total + + fncset := set() # set for the names of all functions + fnctab := table(0) # table to tabulate function count + + total := 0 + + every insert(fncset, function()) + delete(fncset, "args") # ad hoc -- usual not used as functions + delete(fncset, "name") + + while line := read() | stop("*** didn't find variable references") do { + line ? { + if ="Variable references:" then break + } + } + + + while line := trim(read()) do { + line ? { + if tab(upto(&digits)) then { + count := tab(many(&digits)) + tab(upto(&letters)) + name := tab(0) + if name == "" then break + if member(fncset, name) then { + fnctab[name] +:= count + total +:= count + } + } + } + } + + fnctab := sort(fnctab, 4) + + while count := pull(fnctab) do + write(left(pull(fnctab), 14), right(count, 8)) + + write() + write("total ", right(total, 8)) + +end -- cgit v1.2.3