UNIX%ames-vmsb@sri-unix.UUCP (12/13/83)
does anyone know where I can get a program that produces cross-reference
listings of C programs (or collections of files of C programs) ?
replying to the net would probably be a good idea.
Thanks,
Creon Levit
NASA Ames Research Centerdpk%brl-vgr@sri-unix.UUCP (12/15/83)
From: Doug Kingston <dpk@brl-vgr> On Berkeley VMUNIX systems, you can get a cross listing with the "ctags" program by using the -x option. (4.1, 4.1c, and 4.2BSD) -Doug-
msc@qubix.UUCP (Mark Callow) (12/20/83)
The System V program "cxref" will compile and run with only one tiny
change under both 4.1bsd and 4.2bsd. It looks for /bin/sort. On
bsd systems it's /usr/bin/sort.
Personally I find that Berkeley's ctags(1) program serves most of the
purposes for which I used to use cross-references and it's much easier
than thumbing through printed listings and typing file names.
--
From the Tardis of Mark Callow
msc@qubix.UUCP, decwrl!qubix!msc@Berkeley.ARPA
...{decvax,ucbvax,ihnp4}!decwrl!qubix!msc, ...{ittvax,amd70}!qubix!mscolson@fortune.UUCP (12/21/83)
#R:sri-arpa:-1461300:fortune:11600035:000:2588
fortune!olson Dec 20 19:22:00 1983
I have written a function cross-referencer for C which works fairly
well. If you are interested, send me mail. If there is enough
interest, I will post it to net.sources. The man page follows.
-=- -=- -=- -=- -=- -=- -=- -=- -=- -=- -=- -=- -=- -=-
crossref(local) UNIX Programmer's Manual crossref(local)
NAME
crossref - make a function cross reference listing for C
programs
SYNOPSIS
crossref [-o file] [file ...]
DESCRIPTION
crossref produces a function cross reference for C programs.
The -o option specifies output to the given file, otherwise
output goes to stdout. 0 or more filenames may be given,
files that can't be read are skipped, and processing contin-
ues with the next file. If no files are given crossref reads
the standard input.
crossref requires that function declarations start in column
1. Macro functions are also handled. Functions declared as
type function_name(params)
or
type
function_name(params)
are both recognized (where 'type' may be null). White space
is allowed between the name and the '('.
SAMPLE OUTPUT
ASSERT()
/lpr/malloc.c, 140, 211, 212, 217, 226, 228, 260, 269,
289, 290, 293, 317, 404
/lpr/lprint.c, 110, 115
ASSERT(p):#define /lpr/malloc.c, 125, 136
creat()
/lpr/malloc.c, 57
free()
/lpr/malloc.c, 320
free(ap):[int] /lpr/malloc.c, 283
malloc()
/lpr/malloc.c, 322
malloc(nbytes):unsigned char * /lpr/malloc.c, 195
/lpr/malloc.c, 120
Note that the line showing the declaration of a function
follows the list of files where it is referenced. The func-
tion name on the declaration line is followed by a ':', and
it's declared type. If no type is declared, it is impli-
citly declared as 'int', and marked with ':[int]'.
Functions referenced many times have the line # listing
split at column 80, and indented 2 spaces (shown shorter
here so it fits on the man page). If the function is refer-
enced in more than one file, each file starts on a new line.
Functions that have no declaration are presumably declared
Printed 12/20/83 Fortune 1
crossref(local) UNIX Programmer's Manual crossref(local)
in another file, or are library routines.
AUTHOR
Dave Olson, loosely based on an example in the book 'The
Unix System' by S. Bourne.gwyn%brl-vld@sri-unix.UUCP (12/21/83)
From: Doug Gwyn (VLD/VMB) <gwyn@brl-vld> "cxref" produces very nice cross-references for collected C files. This utility comes with UNIX System V, or with my UNIX System V user/programmer environment for 4.2BSD. I noticed that the sources were based on a USG 3.0 PCC, so I upgraded them and INTEGRATED cxref FULLY into the master UNIX System V pcc/lint/cxref sources. I hope someone at Western Electric is listening!
olson@fortune.UUCP (12/22/83)
#R:sri-arpa:-1461300:fortune:11600037:000:90 fortune!olson Dec 22 12:03:00 1983 There have been enough requests that I have decided to post it to net.sources Dave Olson