C cross referencer request - (nf)

olson at fortune.UUCP olson at fortune.UUCP
Wed Dec 21 14:07:02 AEST 1983


#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.



More information about the Comp.unix.wizards mailing list