home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
reviewed
/
volume01
/
cextract
/
part00
next >
Wrap
Internet Message Format
|
1991-07-08
|
6KB
From: adb@cs.bu.edu (Adam Bryant)
Subject: C prototyper / header file generator
Environment: UNIX, VMS
Tested Environments:
VAX/VMS
VAX 8700/VMS
VAX/BSD 4.3
IBM-RT/AOS 4.3
DECstation/Ultrix 3.1
IBM PS-2/AIX 1.2
MAC/AUX
Sun 4/SunOS 4.1.1
Sun 3/SunOS 4.0.3, 4.1.1
SGI/IRIX 3.3
Apollo DN10000/Domain OS 10.2.p
Dates:
Submission Received: April 15 1991
Reviews Returned: April 29 1991
Revised Submission Received: May 3 1991
Reviews Returned: May 17 1991
Revised Submission Received: May 23 1991
Reviews Returned: June 5 1991
Revised Submission Received: June 18 1991
Reviews Returned: July 2 1991
Revised Submission Received: July 5 1991
Accepted: July 6 1991
Author's Summary:
-----------------
This package is cextract, version 1, patchlevel 2. This is the first
official release and is being distributed through the newsgroup
comp.sources.reviewed.
The cextract/cextdoc program is copyright 1991 by Adam Bryant.
The code is freely distributable and there are no restrictions other
than the fact that it not be used for monetary gain and that copyright
notices must be kept intact.
The program may be used to generate proprietary source code or
documentation, but its own source code may not be used as a part of any
proprietary programs.
This package contains a C prototype extractor. I know what you are
thinking... "Not another one!". But, I found a need for one, and more
importantly, a small one that could run on as many systems as possible.
Cextract is ideal for generating header files for large multi-file C
programs, and will provide an automated method for generating all of the
prototypes for all of the functions in such a program.
Cextract also functions as a rudimentary documentation extractor,
generating a sorted list of all functions and their locations.
The main advantages that I find with this program over other prototyping
programs:
- smaller. [You can distribute it with your own packages so that other
programmers can rebuild your header files.]
- fully written in C. [You don't need a lex or yacc compiler to get
this going.]
- more portable. [As far as I know, it only requires that the system
has a C preprocessor for it to work.] I have even provided support for
VMS systems, although I wish the compiler on that system allowed the
comments to be retained.
- reads either ANSI or K&R C code and outputs either K&R or ANSI [or
both!] function definitions.
- can catch all #define statements within the parameter list and replace
before output, if needed. [such as "#define FILE struct _iobuf"] This
feature is provided to account for adjustments caused by the C
preprocessor.
- automatically catches and replaces FILE and varargs stuff.
- has a built in documentation extraction program.
Likely disadvantages:
- It is not a fully implemented compiler, so it might not complain if it
is reading invalid C code.
- Might barf on extremely complex code.
- could probably be a little faster. [any speed up suggestions are
welcome]
- with heavily conditional (#ifdef'ed) code, it might not be able to
generate a "generic" header file which would work for all possible code
permutations.
Reviewers' Comments:
--------------------
I have tested this program on a VAX running BSD 4.3, an IBM RT/PC
running AOS 4.3, a DECstation running Ultrix 3.1, an IBM PS/2 running
AIX 1.2, and a Mac running A/UX. It compiles and passes its test with
no problems on all of these systems.
The package provides a fast, portable method for extracting function
declarations. The features that I find most useful include its
ability to surround the declarations with #ifdef directives that
control when they are used (or that prevent reuse), and its ability to
produce both ANSI and non-ANSI declarations and to put in an #ifdef to
cause the ANSI declarations to be used only when appropriate.
---------------------------------------------------------------
Cextract is a nice tool, that extracts routine headers of a C program
into an .h file. Both ANSI-C and K&R C are supported. It has many
extra facilities, but unfortunately most of them require a C
preprocessor which does not strip of comments like VAX-C does. I
look forward to using it. cextract was reviewed on VAX/VMS.
---------------------------------------------------------------
Cextract eases production of interface files by extracting
prototypes in ANSI and non-ANSI styles. Can extract leading comments as
well, and can generate the skeleton for code documentation.
---------------------------------------------------------------
`Cextract' is an extremely useful utility for managing software
written in C. It extracts function headings from source files
and makes prototypes of them, to make a header file suitable for
inclusion by other source files. The documentation option
produces output suitable for printing. There are numerous
switches for handling comments, ANSI/non-ANSI declarations,
sorting of the prototypes, and so on. The `-H' option is
particularly useful in dealing with large software projects.
The program was tested on Sun, VAX, and Apollo systems, and
performed as expected. (A note for Apollo users: the SYSFLG
option in the Makefile should be set to -DBSD -U__STDC__, because
the Apollo C compiler thinks that it is ANSI C - but we know
better!)
I strongly recommend the use of `cextract' for any size of
project! (I particularly wish to praise the author for his
speedy action in dealing with the reviewers' comments.)
Author's Comments on the Review Process
---------------------------------------
When I first submitted cextract to comp.sources.reviewed I thought it
was a bit rough, but even so, ready for the net. I figured that it was
fairly portable and that any rough edges to it or minor bugs could be
ironed out when bug reports and patches started coming in. Well, the
reviewers saw through my laziness and made sure that I turned in a
finished product.
Not only did they discover bugs that hadn't turned up in months of use
by myself and others, they came up with excellent improvement
suggestions that inspired me to redesign much of the code and greatly
improve the overall quality. Hopefully everyone will be able to
recognize that the review process was able to greatly enhance this
program beyond what even I had imagined it capable of.