C file header generatior
cheaders的Python项目详细描述
此工具读取C源文件(.c)并为相应的 头文件,包含任何非静态函数定义的函数声明 在提供的C文件中找到。
安装
pip install cheaders
用法
通过python解释器作为模块执行cheaders:
python -m cheaders source_file.c
示例输出
下面的示例显示了为样本.c文件生成的内容。这个 示例文件名为ulist_.c,包含以下代码:
示例c源文件
intmyfunction(intintvar,floatfloatvar){// Do important stuff return0;}voidmyotherfunction(intintvar,floatfloatvar,charlong_name_variable){// Do other important stuff }
将生成的头文件,启用了doxygen注释 默认)如下:
生成的头文件
/* * myfile.h * * (Description here) * */#ifndef MYFILE_H #define MYFILE_H /** * (Description) * * @param intvar (description) * @param floatvar (description) * * @return (description) */intmyfunction(intintvar,floatfloatvar);/** * (Description) * * @param intvar (description) * @param floatvar (description) * @param long_name_variable (description) */voidmyotherfunction(intintvar,floatfloatvar,charlong_name_variable);#endif /* MYFILE_H */