home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
reviewed
/
volume01
/
cextract
/
part01
/
cextract.doc
< prev
next >
Wrap
Text File
|
1991-07-08
|
12KB
|
397 lines
CEXTRACT(1) USER COMMANDS CEXTRACT(1)
NAME
cextract, cextdoc - C prototype/documentation extractor
SYNOPSIS
cextract [ -Q# ] [ +AaPpNnx ] [ -o _o_u_t_f_i_l_e ] [ -Hstring -v
-V ] [[ -options ] _f_i_l_e_n_a_m_e... ]
cextdoc [ -Q# ] [ +AaNnx ] [ -o _o_u_t_f_i_l_e ] [ -v -V ] [[
-options ] _f_i_l_e_n_a_m_e... ]
DESCRIPTION
_C_E_X_T_R_A_C_T is used to extract the function descriptions (aka
prototypes) from a list of C source files and send them out
to the standard output or a specified file. It may also be
used to generate basic documentation for a list of C source
files.
The specific reason this program was written was to provide
a method of automatically generating header files, contain-
ing prototypes, for all of the functions used throughout a
multi-file project.
Along with the standard C preprocessing options, -D, -I, and
-U, there are options which allow more control of what form
the output will take.
To allow for conditional processing, _c_e_x_t_r_a_c_t automatically
predefines the __CEXTRACT__ identifier. Preprocessor com-
mands, such as "#if", "#ifdef" and "#ifndef" may then be
used to control what code is parsed by _c_e_x_t_r_a_c_t. If the
_c_e_x_t_d_o_c command is used, the program will also define
__CEXTDOC__.
The _c_e_x_t_r_a_c_t program also supports the use of customization
files. A system configuration file will be read, and then
any ".cextrc" file in the user's home directory, and finally
any ".cextrc" file in the current directory. For a descrip-
tion of the format of the customization file, see the
_c_e_x_t_r_c(5) manual page.
COMMAND LINE OPTIONS
The _c_e_x_t_r_a_c_t and _c_e_x_t_d_o_c programs support both long and
short command line options. Also, a `+' sign before an
option description means that it can be either on or off,
with a `+' prefix enabling that option or a `-' prefix disa-
bling it. The prefix of "no-" ("no" on VMS systems) is also
supported for disabling an option.
Most command line arguments can be used anywhere on the com-
mand line, but there are a few which must be used before any
file parsing begins [such as the -N, -n and -x options], and
one which can only be the first argument on the command line
Sun Release 4.1 Last change: 3 July 1991 1
CEXTRACT(1) USER COMMANDS CEXTRACT(1)
[the -Q flag].
+A, +sort-all
Sort the output, listing all functions in alphabetical
order. This option is not compatible with the +C flag,
since functions are sorted over the entire spectrum,
not just for each file.
+a, +sort-by-files
Sort the output, listing functions alphabetically for
each file. Since this option sorts each file
separately, it is compatible with the +C flag, unlike
the +A option. For _c_e_x_t_r_a_c_t, the default is to not do
any sorting, while the _c_e_x_t_d_o_c default is to sort by
files.
+C, +first-comments
Capture the first comment encountered in each file and
include it in the generated output. [default off]
+c, +comments, +yank-comments
Take the comment immediately preceding the function
declaration and send it as output along with the func-
tion prototype. [default on]
-Dexpression, -define=expression
Define a macro, as per the C "#define" preprocessor
statement.
+E, +externs
Place the string 'extern' before each function proto-
type. [default on]
+F, +filename
Prepend the name of the file to the initial comment
when it is processed. This flag requires the -C
option. [default off]
-f#%%, -font-#-%%
Specify what fonts are to be used when generating troff
documentation output. The font name is a one or two
character troff name which will be interpreted later by
the troff processor. Four fonts are used: `1' or `t'
which is used only for the title words "Function:" and
"File:" [default value of "C", Courier]; `2' or `c'
which is used for comments [default value of "CO",
Courier Oblique]; `3' or `n' which is used for the
function name [default value of "B", Times Bold]; and
`4' or `p' for the parameter list [default value of
"R", Times Roman]. Note that the `#' character indi-
cates the type being adjusted, and "%%" indicates the
one or two character font name.
Sun Release 4.1 Last change: 3 July 1991 2
CEXTRACT(1) USER COMMANDS CEXTRACT(1)
-Hstring, -header-string=string
During the normal extraction mode, enclose the output
within the sequence "#ifndef string", "#define string",
..., "#endif /* string */". This method is used with
many system header files and prevents the header file
from being parsed more than once. If this option is
not used, the output will be enclosed within a "#ifndef
__CEXTRACT__", "#endif /* __CEXTRACT__ */" sequence
instead.
-Idir, -include=dir
Add the directory "dir" to the search path for include
files accessed via the "#include" preprocessor state-
ment. This flag is passed on to the C preprocessor.
+m, +multi-comments, +multiple-comments
If the -c flag is set, look for a "block" of multiple
comments, instead of a single comment. Comments with
more than one newline in between are considered
separate. [default off]
-N, -roff-mode, -troff-mode
Enable documentation mode, sending output as -ms troff
format.
-n, -doc-mode
Enable documentation mode, sending output as normal
text. This is the default mode of the _c_e_x_t_d_o_c program.
-o outfile, -output-file outfile, -output-file=outfile
Send output to the specified file instead of the stan-
dard output. The file name need not immediately follow
the `-o' flag, but it must be the first non-option
argument. Warning: This will overwrite any existing
file of the same name.
+P, +dual-output
In extraction mode, generate both styles of C proto-
types, separated by using "#ifdef" and "#else" state-
ments to test for __STDC__. This option must precede
any file arguments. [default on]
+p, +ansi-code
Produce output in ANSI C prototype format; otherwise,
produce old-style declarations. This option must pre-
cede any file arguments. [default off]
-qfile, -config-file=file
Read in the specified file and parse it for customiza-
tion commands.
-Q#, -read-config=#
Sun Release 4.1 Last change: 3 July 1991 3
CEXTRACT(1) USER COMMANDS CEXTRACT(1)
An octal digit specifies which configuration files
should be read; 1 for the system configuration file, 2
for the $HOME/.cextrc file and 4 for the ".cextrc" file
in the current directory. Add values to read multiple
files. If no number is specified, a 0 is assumed.
This option must be the very first argument on the com-
mand line. [default value of 7 reads all three files]
+r, +remove-names, +discard-names
Do not include the variable names within in prototypes.
+S, +show-all, +show-anyway
If the -p flag is off, output the prototype list any-
way, but enclosed within comments. If the -P flag is
set, comments and commented prototypes should also be
duplicated within the non-ANSI portion of the output.
[default on]
+s, +statics
Do not ignore static functions when searching for func-
tion declarations. [default off]
-T#, -tab-width=#
Specify the tab width used during documentation output.
If no value is given, or a value of zero is given, tabs
are passed though unformatted.
-Uname, -undefine=name
Undefine a macro. If "-Dname" was specified in a pre-
vious argument, it is removed from the argument list;
otherwise, this option is passed on to the C preproces-
sor.
-V, -settings
Show the current settings of the various program
options.
-v, -version-info
Display the version number of the program.
-x, -extract-mode
Run _c_e_x_t_r_a_c_t or _c_e_x_t_d_o_c as a prototype extractor. This
is the default mode for _c_e_x_t_r_a_c_t.
COPYRIGHT
The code is freely distributable and there are no restric-
tions other than the fact that it not be used for monetary
gain and that copyright notices must be kept intact.
Both _c_e_x_t_r_a_c_t and _c_e_x_t_d_o_c 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.
Sun Release 4.1 Last change: 3 July 1991 4
CEXTRACT(1) USER COMMANDS CEXTRACT(1)
FILES
/usr/local/lib/cext.config, $HOME/.cextrc, .cextrc
The list of configuration files, and the order in which
they are read in.
SEE ALSO
cc(1), cextrc(5)
AUTHORS
Adam Bryant
adb@cs.bu.edu
initial VMS port by John Carr
jrcarr@iup.bitnet
VMS
On VMS systems, only the longer command line options are
available, and the '/' character is used to specify command
line options.
BUGS
1) This isn't a full compiler, so it won't give very helpful
syntax error messages. [This is a feature, really! :-)}
2) Because it uses the C preprocessor, macros in parameter
lists are always expanded to the actual (perhaps unreadable)
value. This will still be correct, but it tends to make the
generated output non-portable. The varargs and FILE defini-
tions are already checked for and properly replaced since on
most systems they are macros. Use the "replace" configura-
tion file command to handle other macros properly.
3) As far as I know, there is no way to tell the normal VMS
C compiler not to strip out comments. This renders the com-
ment extraction and documentation mode portions rather use-
less to VMS sites.
4) Might barf on extremely large or extremely complex code.
I have tried to be sure that I could parse any C function
declaration I could think of, but I no doubt forgot some-
thing.
5) Using the `+r' flag might be risky with more complex
declarations, since they may become ambiguous without the
variable name.
6) Cextract cannot handle a function returning a "struct" or
a pointer to such where the full struct declaration is done
when the function itself is declared.
7) currently, only one replacement can be handled at a time.
So, if a type and a variable replacement can take place,
Sun Release 4.1 Last change: 3 July 1991 5
CEXTRACT(1) USER COMMANDS CEXTRACT(1)
only the first one detected will be handled.
If any other bugs are detected, please notify the author.
Sun Release 4.1 Last change: 3 July 1991 6