Cfunctions - automatically make C header files

cfunctions (pronounced `see-functions') is a C utility for extracting function prototypes and global variables from C files.

Try it!

Try running cfunctions on a C file.

cfunctions takes C files and extracts global information such as function prototypes and external variable declarations from them.

This is useful for

cfunctions's default behaviour is to run as a filter (pipe) reading a C file from standard input and writing to standard output. It can also read files from the command line, and make complete header files, with a banner at the top, a preprocessor wrapper, and copying of verbatim material such as typedefs, macros or struct definitions automatically generated.

cfunctions can also optionally make GNU C style `extern inline' functions by copying the inline functions into the header file, with a normal prototype for the case of non-GNU C compilers.

cfunctions cuts down on the cost of making header files and maintaining them compared to hand-editing.

One can also use it to make forward declarations for static functions, etc. by using it as a pipe. It can also make a tag table from the C file.

cfunctions can be controlled by command-line switches and by directives in the C files themselves.

Version

The current version is 0.28

Download

cfunctions can be downloaded from http://sourceforge.net/projects/cfunctions/.

Version control repository

There is a "git" repository for cfunctions. This repository does not contain header files which are generated by Cfunctions itself, so it is not possible to compile these sources. It is necessary to have a working version of Cfunctions in order to build it. People who wish to develop Cfunctions should download it from sourceforge.net to create a working version, and build it, before forking the repository.

Mailing list

There is a mailing list for this program at http://groups.google.com/group/cfunctions. It is possible to mail to the list at cfunctions@googlegroups.com. New versions are announced on the mailing list.

Bugs or problems

Bugs and all problems should be reported to the maintainer via email, or to the mailing list.

How to use cfunctions

Please see the online manual.

README

The following text is the README from the latest version of cfunctions.

WHAT IS CFUNCTIONS?

Cfunctions (pronounced "see-functions") is a C programming utility
which makes C header files (files ending in ".h") from C program files
(files ending in ".c"). It does this by extracting function
prototypes, global variables and tag tables from C files. 

For example, if you input 

int y;

int example (int a)
{
  printf ("%i\n");
  return a;
}

cfunctions will output

extern int y;
int example (int a );

a declaration and a function prototype for a header (".h") file.

Cfunctions is particularly useful for programmers working with ANSI C
because it saves the trouble of repeatedly updating header files with
function prototypes after modifying the C program files.

THIS IS A TEST RELEASE

Please note: This is a test (pre-release) version of the program.
Unfortunately you can expect to find bugs, some of which are
documented. If possible please report the bugs to the maintainer.

LICENCE

Cfunctions is distributed under the GNU General Public Licence.  See
the file `COPYING'.

INSTALLATION

To build Cfunctions, run the script `./configure' and then do `make'
in the directory where this file ("README") is.  To install
Cfunctions, do `make install'.

If the script `configure' does not work on your system, try installing
according to the instructions in the documentation.

DOCUMENTATION

Documentation in the GNU texinfo format is in the file
`cfunctions.texi', in info format in `cfunctions.info' and html format
in `cfunctions.html' and `cfunctions_toc.html' (the table of
contents). There is also a Unix-style "man" page.

CHANGES FROM PREVIOUS VERSIONS

If you have used an earlier version of Cfunctions, the file NEWS lists
significant user-visible changes, starting from the latest version.

SUPPORT/HELP

If you need support or help with Cfunctions, contact the maintainer.

MAINTAINER

Please look in the file "VERSION" in this directory for the
maintainer's email address.  Please report any bugs or installation
problems to the maintainer.


See also

The following open-source projects have a similar goal to Cfunctions.

Makeheaders

Makeheaders by D. Richard Hipp, also author of the SQLite software, creates a header file from a C file in a similar way to Cfunctions. It also works for C++ files.

Ask and answer questions on C in the new C forum

Copyright © Ben Bullock 2009-2012. All rights reserved. For comments, questions, and corrections, please email Ben Bullock (ben.bullock@lemoda.net) / Privacy / Disclaimer