Re: Comments & Code together?

"Andrew M. Bishop" <amb@gedanken.demon.co.uk>
13 Jun 1996 20:10:26 -0400

          From comp.compilers

Related articles
Comments & Code together? mwh@gradin.cis.upenn.edu (1996-06-08)
Re: Comments & Code together? darius@phidani.be (Darius Blasbans) (1996-06-13)
Re: Comments & Code together? amb@gedanken.demon.co.uk (Andrew M. Bishop) (1996-06-13)
| List of all articles for this month |

From: "Andrew M. Bishop" <amb@gedanken.demon.co.uk>
Newsgroups: comp.compilers
Date: 13 Jun 1996 20:10:26 -0400
Organization: Compilers Central
References: 96-06-037
Keywords: parse, C

Michael Hicks <mwh@gradin.cis.upenn.edu> wrote:
> I am working on a program that will insert hypertext into .c files
> so that function calls will be "linked" to their definitions. To use one
> of the yacc C grammars floating around requires that the .c file be
> preprocessed first, thus eliminating all comments, #define's, etc., which
> is undesirable. Are there any C grammars out there that allow for
> preprocessing AND compilation to go on simultaneously? If not, does
> anyone have any suggestions as to how I could preprocess the file, parse
> it to insert hypertext links, and then reintroduce the missing comments,
> #define's, etc.?


I have written a program that will parse C source code files and
produce an HTML/LaTeX cross-reference of all of the functions and
variables and their usage etc. This works by using the comments in the
source as the text to accompany the cross references.


Now I know that this is not quite what you asked for but the program
does have in it a pre-processor/parser combination that may be of
interest to you.


: Cxref Version 1.1
: =================
:
: Produce LaTeX or HTML documentation including cross-references from C
: program source code.
:
: Works for ANSI C, including a few gcc extensions.
:
:
: The documentation for the program is produced from comments in the code that
: are appropriatly formatted. The cross referencing comes from the code itself
: and requires no extra work.
:
: The documentation is produced for each of the following:
:
: Files - A comment that applies to the whole file.
: Functions - A comment for the function, including a description of
: each of the arguments and the return value.
: Variables - A comment for each of a group of variables and/or
: individual variables.
: #include - A comment for each included file.
: #define - A comment for each pre-processor symbol definition, and
: for macro arguments.
: Type definitions - A comment for each defined type and for each element of a
: structure or union type.
:
: Any or all of these comments can be present in suitable places in the
: source code.
:
:
: The cross referencing is performed for the following items
:
: Files - The files that the current file is included in
: (even when included via other files).
:
: #includes - Files included in the current file.
: - Files included by these files etc.
:
: Variables - The location of the definition of external variables.
: - The files that have visibility of global variables.
: - The files / functions that use the variable.
:
: Functions - The file that the function is prototyped in.
: - The functions that the function calls.
: - The functions that call the function.
: - The files and functions that reference the function.
: - The variables that are used in the function.
:
: Each of these items is cross referenced in the output.
:
: This program has been tested on the following systems:
: Linux 1.[123].x, SunOS 4.1.x, Solaris 2.x, HPUX 10.x
:
: The complete version 1.1
: cxref-1.1.tgz, 210317 Bytes, a gzipped tar file of C source code.
:
: Available from ftp.demon.co.uk in the /pub/unix/unix/tools directory
: (to be re-organised to /pub/unix/tools in the future).


Andrew.
--
----------------------------------------------------------------------
Andrew M. Bishop amb@gedanken.demon.co.uk
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.