https://github.com/eriknyquist/cheaders
C header file generator
https://github.com/eriknyquist/cheaders
automation c python python3
Last synced: about 2 months ago
JSON representation
C header file generator
- Host: GitHub
- URL: https://github.com/eriknyquist/cheaders
- Owner: eriknyquist
- License: apache-2.0
- Created: 2019-06-16T02:49:03.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-16T03:01:04.000Z (about 7 years ago)
- Last Synced: 2025-02-28T16:44:34.735Z (over 1 year ago)
- Topics: automation, c, python, python3
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
C header file generator
#######################
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
---------------------
.. code:: c
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
---------------------
.. code:: c
/*
* 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 */