全国旗舰校区

不同学习城市 同样授课品质

北京

深圳

上海

广州

郑州

大连

武汉

成都

西安

杭州

青岛

重庆

长沙

哈尔滨

南京

太原

沈阳

合肥

贵阳

济南

下一个校区
就在你家门口
+
当前位置:首页  >  技术干货

Python C代码统计工具代码的效果验证

发布时间:2023-11-07 19:26:47
发布人:xqq

为验证上篇文章的代码实现,建立lctest调试目录。该目录下包含line.c及和《为C函数自动添加跟踪语句》一文中的test.c文件。其中,line.c内容如下:

#include

/*{{{comment*/

/***********

Multiline

Comment

***********/

inttest(inta/*comment*/,intb)

{

inta2;intb2;//comment

a2=1;

b2=2;

}

/*{{{test3*/

inttest3(inta,

intb)/*test2hasbeendeleted,

sothisistest3.*/

{inta3=1;intb3=2;

if(a3)

{/*comment*/

a3=0;

}

//comment

b3=0;

}

/*}}}*/

//comment//comment

/*FALSE*/#ifM_DEFINED

#errorDefination!

#endif

以不同的命令行参数运行CLineCounter.py,输出如下:

E:\PyTest>CLineCounter.py

FileLinesCodeLinesCommentLinesEmptyLines

77531811

E:\PyTest>CLineCounter.py0

FileLinesCodeLinesCommentLinesEmptyLines

77531811

E:\PyTest>CLineCounter.py1

FileLinesCodeLinesCommentLinesEmptyLinesFileName

3319154E:\PyTest\lctest\line.c

443437E:\PyTest\lctest\test.c

77531811

经人工校验,统计信息正确。

接着,在实际工程中运行pythonCLineCounter.py1,截取部分运行输出如下:

[wangxiaoyuan_@localhost~]$pythonCLineCounter.py1

FileLinesCodeLinesCommentLinesEmptyLinesFileName

99215824/sdb1/wangxiaoyuan/include/Dsl_Alloc.h

120792824/sdb1/wangxiaoyuan/include/Dsl_Backtrace.h

........................

139892426/sdb1/wangxiaoyuan/source/Dsl_Tbl_Map.c

6174816478/sdb1/wangxiaoyuan/source/Dsl_Test_Suite.c

79756916982/sdb1/wangxiaoyuan/source/xDSL_Common.c

154501043732502538

以上内容为大家介绍了PythonC代码统计工具代码的效果验证,希望对大家有所帮助,如果想要了解更多Python相关知识,请关注IT培训机构:千锋教育。

python培训

相关文章

Python decimal 模块

Python decimal 模块

2023-11-07
Python random 模块

Python random 模块

2023-11-07
Python 爬虫之pyspider

Python 爬虫之pyspider

2023-11-07
Python 数组ndarray

Python 数组ndarray

2023-11-07

最新文章

武汉新媒体行业公司排名

武汉新媒体行业公司排名

2023-11-01
武汉新媒体就业现状好吗

武汉新媒体就业现状好吗

2023-11-01
武汉全媒体行业发展现状及趋势

武汉全媒体行业发展现状及趋势

2023-10-31
武汉全媒体现状

武汉全媒体现状

2023-10-31
在线咨询 免费试学 教程领取