This topic has been archived. It cannot be replied.
-
工作学习 / 学科技术讨论 / 请教script专家, 如何将 .c里的所有函数名提取出来形成.h? 我现在是用doxy,有点麻烦,最好是能用命令行,谢谢
-xw1196(眼高手低);
2009-10-14
(#5605483@0)
-
眼高手低地说一句:可以用regular expression,depending on the OS platform you may want to use Perl/Python or C# to search for all \w([\w \w]*) and remove the duplicate records, which is pretty easy at least in Python
-renjl0810(相信网络,相信Google);
2009-10-14
(#5605616@0)
-
谢谢先
-xw1196(眼高手低);
2009-10-14
(#5605679@0)
-
确实是眼高手低了:刚才找了一个.h文件看了一下(好多年没看过了)惭愧不已。如果你所感兴趣的只是生成函数声明的话确实不是什么难事,像我刚才说得那样就可以满足要求。但是如果你是指自动生成.h文件,包括类型定义(struct, class, etc),自动包含相应头文件(#include .h),全局变量定义等等,可能就比较麻烦了。所以,要看的具体需求而定。
-renjl0810(相信网络,相信Google);
2009-10-14
{163}
(#5605720@0)
-
谢谢谢谢,只是函数声明,经常写着写着就写下去了,回头声明函数觉得很烦, 正在试着用sed,你说的Python没摸过
-xw1196(眼高手低);
2009-10-14
(#5605887@0)
-
哈哈,sed 我没用过, Python也是新手(其实新手都谈不上,刚开始学).但是我觉得只要支持文件读写(一个用来读源文件另外一个用来写入函数声明)和regular expression,应该都不成问题.sed 虽然没用过但是我想这些基本功能应该还是有的.最差的情况下,像我说的,用Python, import re (regular expression module), findAll(), deduplciate and then write to a text file - you're done!
btw. a couple of days ago, when I was searching the Net to find out how to remove duplicate itmes within a list, I came across a Web page titled, "Life is short, you need Python" with the answer I need. Seriously, I really like the language. It's powerful, flexible, ....
-renjl0810(相信网络,相信Google);
2009-10-14
{417}
(#5606052@0)