Skip to main content

C file header generator

Project description

This tool reads a C source file (.c) and generates the text for the corresponding header file, with function declarations for any non-static function definitions found in the provided C file.

Installation

pip install cheaders

Usage

Execute cheaders through the python interpreter as a module:

python -m cheaders source_file.c

Example output

The following example shows what is generated for a sample .c file. The sample file is called ulist_.c, and contains the following code:

Example C source file

int myfunction(int intvar, float floatvar)
{
        // Do important stuff
        return 0;
}


void myotherfunction(int intvar, float floatvar, char long_name_variable)
{
        // Do other important stuff
}

The header file that will be generated, with doxygen comments enabled (the default) looks like this:

Generated header file

/*
 * myfile.h
 *
 * (Description here)
 *
 */


#ifndef MYFILE_H
#define MYFILE_H


/**
 * (Description)
 *
 * @param   intvar      (description)
 * @param   floatvar    (description)
 *
 * @return  (description)
 */
int myfunction(int intvar, float floatvar);


/**
 * (Description)
 *
 * @param   intvar              (description)
 * @param   floatvar            (description)
 * @param   long_name_variable  (description)
 */
void myotherfunction(int intvar, float floatvar, char long_name_variable);


#endif /* MYFILE_H */

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

cheaders-1.0.0-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

cheaders-1.0.0-py2-none-any.whl (5.2 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page