I've updated the script to also support scanning the source using the 
"cxref" tool.

Here's an updated version of the script and patch.  The output looks like 
this:

perl lib_deps.pl object exceptions.o global_setup.o interpreter.o parrot.o register.o 
core_ops.o core_ops_prederef.o memory.o packfile.o stacks.o string.o encoding.o 
chartype.o runops_cores.o trace.o pmc.o key.o platform.o jit.o resources.o rx.o 
rxstacks.o embed.o warnings.o misc.o io/io.o io/io_stdio.o io/io_unix.o io/io_win32.o 
classes/default.o classes/array.o classes/perlint.o classes/perlstring.o 
classes/perlnum.o classes/perlarray.o classes/perlundef.o classes/perlhash.o 
classes/parrotpointer.o classes/intqueue.o encodings/singlebyte.o encodings/utf8.o 
encodings/utf16.o encodings/utf32.o chartypes/unicode.o chartypes/usascii.o
Found 1836 symbols defined within the 45 supplied object files.
Found 55 external symbols
Of these, 16 are not defined by ANSI C89:
    close
    creat64
    dlclose
    dlerror
    dlopen
    dlsym
    fopen64
    gettimeofday
    isatty
    lseek64
    mmap64
    open64
    read
    sleep
    stat64
    write
perl lib_deps.pl source all_source
Running cxref (pass 1)
Running cxref (pass 2)
Found 178 functions which are defined and called within the 100 supplied source files.
Found 54 external functions which were called.
Of these, 15 are not defined by ANSI C89:
    close:
        io/io_unix.c:PIO_unix_close
        io/io_unix.c:PIO_unix_open
    creat:
        io/io_unix.c:PIO_unix_open
    dlclose:
        platform.c:Parrot_dlclose
        platforms/generic.c:Parrot_dlclose
    dlerror:
        platform.c:Parrot_dlerror
        platforms/generic.c:Parrot_dlerror
    dlopen:
        platform.c:Parrot_dlopen
        platforms/generic.c:Parrot_dlopen
    dlsym:
        platform.c:Parrot_dlsym
        platforms/generic.c:Parrot_dlsym
    gettimeofday:
        platform.c:Parrot_floatval_time
        platforms/generic.c:Parrot_floatval_time
    isatty:
        io/io_unix.c:PIO_unix_isatty
    lseek:
        io/io_unix.c:PIO_unix_seek
        io/io_unix.c:PIO_unix_tell
    mmap:
        embed.c:Parrot_readbc
        pdump.c:main
    open:
        embed.c:Parrot_readbc
        io/io_unix.c:PIO_unix_open
        pdump.c:main
    read:
        core_ops.c:Parrot_read_i_i
        core_ops.c:Parrot_read_i_ic
        core_ops.c:Parrot_read_n_i
        core_ops.c:Parrot_read_n_ic
        core_ops.c:Parrot_read_s_i_i
        core_ops.c:Parrot_read_s_i_ic
        core_ops.c:Parrot_read_s_ic_i
        core_ops.c:Parrot_read_s_ic_ic
        core_ops_prederef.c:Parrot_read_i_i
        core_ops_prederef.c:Parrot_read_i_ic
        core_ops_prederef.c:Parrot_read_n_i
        core_ops_prederef.c:Parrot_read_n_ic
        core_ops_prederef.c:Parrot_read_s_i_i
        core_ops_prederef.c:Parrot_read_s_i_ic
        core_ops_prederef.c:Parrot_read_s_ic_i
        core_ops_prederef.c:Parrot_read_s_ic_ic
        embed.c:Parrot_readbc
        io/io_unix.c:PIO_unix_read
    sleep:
        platform.c:Parrot_sleep
        platforms/generic.c:Parrot_sleep
    stat:
        embed.c:Parrot_readbc
        pdump.c:main
    write:
        core_ops.c:Parrot_write_i_i
        core_ops.c:Parrot_write_i_ic
        core_ops.c:Parrot_write_i_n
        core_ops.c:Parrot_write_i_nc
        core_ops.c:Parrot_write_i_s
        core_ops.c:Parrot_write_i_sc
        core_ops.c:Parrot_write_ic_i
        core_ops.c:Parrot_write_ic_ic
        core_ops.c:Parrot_write_ic_n
        core_ops.c:Parrot_write_ic_nc
        core_ops.c:Parrot_write_ic_s
        core_ops.c:Parrot_write_ic_sc
        core_ops_prederef.c:Parrot_write_i_i
        core_ops_prederef.c:Parrot_write_i_ic
        core_ops_prederef.c:Parrot_write_i_n
        core_ops_prederef.c:Parrot_write_i_nc
        core_ops_prederef.c:Parrot_write_i_s
        core_ops_prederef.c:Parrot_write_i_sc
        core_ops_prederef.c:Parrot_write_ic_i
        core_ops_prederef.c:Parrot_write_ic_ic
        core_ops_prederef.c:Parrot_write_ic_n
        core_ops_prederef.c:Parrot_write_ic_nc
        core_ops_prederef.c:Parrot_write_ic_s
        core_ops_prederef.c:Parrot_write_ic_sc
        io/io_unix.c:PIO_unix_write

The following non-ansi system includes are used:
    dlfcn.h, included by:
        platform.c
        platforms/generic.c
    fcntl.h, included by:
        include/parrot/parrot.h
    sys/mman.h, included by:
        include/parrot/parrot.h
    sys/stat.h, included by:
        include/parrot/parrot.h
    sys/time.h, included by:
        include/parrot/parrot.h
        platform.c
        platforms/generic.c
    sys/types.h, included by:
        include/parrot/parrot.h
    unistd.h, included by:
        include/parrot/parrot.h

Attachment: lib_deps.pl
Description: lib_deps.pl

Index: Makefile.in
===================================================================
RCS file: /home/perlcvs/parrot/Makefile.in,v
retrieving revision 1.130
diff -u -r1.130 Makefile.in
--- Makefile.in	5 Feb 2002 09:20:07 -0000	1.130
+++ Makefile.in	8 Feb 2002 06:06:43 -0000
@@ -149,6 +149,13 @@
 $(TEST_PROG): test_main$(O) $(GEN_HEADERS) $(O_FILES) lib/Parrot/OpLib/core.pm lib/Parrot/PMC.pm
 	$(LD) ${ld_out}$(TEST_PROG) $(LDFLAGS) $(O_FILES) test_main$(O) $(C_LIBS)
 
+lib_deps_object: $(O_FILES)
+	$(PERL) lib_deps.pl object $(O_FILES)
+
+lib_deps_source: $(GENERAL_H_FILES)
+	$(PERL) lib_deps.pl source all_source
+
+lib_deps: lib_deps_object lib_deps_source
 
 ###############################################################################
 #

Reply via email to