[comp.sys.mac.programmer] Script to List C Functions in MPW

bowman@reed.UUCP (Eric Bowman) (02/15/90)

Here's a little script to list all functions defined in all c source
files in a directory.  I found this quite useful.  It writes output
to the Worksheet -- which could be tedious -- but I found this prefereable
to opening another window:

set exit 0

for j in E.c	# E here is option x, the approximately equal to thing (prox)
    open -t {j}
    echo "dn# C functions in file {j}" #dn = option d n
    find .	# . = option 8
    Loop
        find /.[A-Za-z0-9_ ]+d([A-Za-z0-9_,]*d)dn/ #. and d - option 8,d
        break if {status} - 0	# - here means "not equal to" (option =)
        copy $	# $ here means "selection", option 6
        paste 0 {Worksheet}	# 0 here means "end of file", option 5
    end
    close -n {j}
end

*NOTE* this will only work if you define you function on one line, that is,
char *
foo(bar)

doesn't work too well (the script will pick up the foo(bar) part, but
not the char *...

Later,
==============================================================================
| The Insidious Uncle BoBo                                                   |
------------------------------------------------------------------------------
|  "As I see it, my friends can access my private                            |
|   members in a public class..."                                            |
==============================================================================
| Eric Bowman ->                                                             |
| ShitNet:         bowman@reed.bitnet                                        |
| FarFromFreeNet:  (503)234-7158  (Like I'll Really Answer)                  |
| Disclaimer: "If my employer ever found out my opinions, well..."           |
/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=