Source Insight里头文件注释和函数头的注释
1.将下述代码拷贝入一个文件,扩展名为em
2.打开BASE工程,添加本文件,并重新同步
3.添加hh_InsertFuncHeader的快捷键,即为函数头注释,光标需要放在函数名那一行,否则无效
4.添加hh_InsertFileHeader的快捷键,即为文件头注释,且头文件(目前只是.h)和源文件(非.h文件)不同,头文件里有
macro hh_InsertFuncHeader()
{
hbuf = GetCurrentBuf()
szFunc = GetCurSymbol()
if (strlen(szFunc) == 0)
{
return
}
ln = GetSymbolLine(szFunc)
if (ln == "-1")
{
return
}
symbol = GetSymbolLocationFromLn(hbuf, ln)
if ((symbol == Nil) || (symbol.Type != "Function"))
{
return
}
szMyName = hh_get_author_name()
szTime = GetSysTime(1)
Day = szTime.Day
if (Day < 10)
{
Day = "0" # szTime.Day
}
Month = szTime.Month
if (Month < 10)
{
Month = "0" # szTime.Month
}
Year = szTime.Year
funcLen = strlen(szFunc)
hsyml = SymbolChildren(symbol)
cchild = SymListCount(hsyml)
InsBufLine(hbuf, ln++, "/*****************************************************************************/")
InsBufLine(hbuf, ln++, "/**")
InsBufLine(hbuf, ln++, "* \author @szMyName@")
InsBufLine(hbuf, ln++, "* \date @Year@/@Month@/@Day@")
InsBufLine(hbuf, ln++, "* \brief ")
ichild = 0
while (ichild < cchild)
{
childsym = SymListItem(hsyml, ichild)
if (childsym.type == "Parameter")
{
symNameLen = strlen(childsym.symbol)
name = strmid(childsym.symbol, funcLen+1, symNameLen)
InsBufLine(hbuf, ln++, "* \param " # name)
}
ichild = ichild + 1
}
SymListFree(hsyml)
InsBufLine(hbuf, ln++, "* \return ")
InsBufLine(hbuf, ln++, "* \remarks ")
InsBufLine(hbuf, ln++, "******************************************************************************/")
// put the insertion point inside the header comment
SetBufIns(hbuf, ln, 0)
}
macro hh_InsertFileHeader()
{
hbuf = GetCurrentBuf()
fullfileName = GetBufName(hbuf)
fileName = hh_GetFileNameFromFull(fullfileName)
szMyName = hh_get_author_name()
ln = 0
szTime = GetSysTime(1)
Year = szTime.Year
Month = szTime.Month
if (Month < 10)
{
Month = "0" # szTime.Month
}
Day = szTime.Day
if (Day < 10)
{
Day = "0" # szTime.Day
}
fileType = strmid(fileName, strlen(fileName)-2, strlen(fileName))
InsBufLine(hbuf, ln++, "/*****************************************************************************/")
InsBufLine(hbuf, ln++, "/**")
InsBufLine(hbuf, ln++, "* \file " # fileName)
InsBufLine(hbuf, ln++, "* \author " # szMyName)
InsBufLine(hbuf, ln++, "* \date @Year@/@Month@/@Day@")
InsBufLine(hbuf, ln++, "* \version V1")
InsBufLine(hbuf, ln++, "* \brief 文件描述")
InsBufLine(hbuf, ln++, "* \note Copyright (c) 2000-2020 XXXXX公司")
InsBufLine(hbuf, ln++, "* \remarks 修改日志")
InsBufLine(hbuf, ln++, "******************************************************************************/")
if (fileType == ".h")
{
ln = hh_InsertHeaderFileHeader(hbuf, fileName, ln)
}
else
{
ln = hh_InsertSourceFileHeader(hbuf, fileName, ln)
}
SetBufIns(hbuf, ln, 0)
}
macro hh_get_author_name()
{
var szMyName
szMyName = getenv(MYNAME)
if (szMyName == Nil)
{
szMyName = ask("What's your name?");
putenv(MYNAME, szMyName);
}
return szMyName
}
macro hh_InsertHeaderFileHeader(hbuf, fileName, ln)
{
hbuf = GetCurrentBuf()
szMyName = hh_get_author_name()
tmpFileName = toupper(fileName)
i=0
var upperFileName
while (i++ < strlen(tmpFileName))
{
ch = strmid(tmpFileName, i-1, i)
if (ch == ".")
{
upperFileName = cat(upperFileName, "_")
}
else
{
upperFileName = cat(upperFileName, ch)
}
}
upperFileName = cat("_", upperFileName)
upperFileName = cat(upperFileName, "_")
InsBufLine(hbuf, ln++, "#ifndef " # upperFileName)
InsBufLine(hbuf, ln++, "#define " # upperFileName)
InsBufLine(hbuf, ln++, "")
InsBufLine(hbuf, ln++, "/*****************************************************************************")
InsBufLine(hbuf, ln++, "* 头文件引用 *")
InsBufLine(hbuf, ln++, "*****************************************************************************/")
InsBufLine(hbuf, ln++, "#ifdef __cplusplus")
InsBufLine(hbuf, ln++, "extern \"C\"")
InsBufLine(hbuf, ln++, "{")
InsBufLine(hbuf, ln++, "#endif")
InsBufLine(hbuf, ln++, "")
InsBufLine(hbuf, ln++, "/*****************************************************************************")
InsBufLine(hbuf, ln++, "* 常量定义 *")
InsBufLine(hbuf, ln++, "*****************************************************************************/")
InsBufLine(hbuf, ln++, "")
InsBufLine(hbuf, ln++, "/*****************************************************************************")
InsBufLine(hbuf, ln++, "* 宏定义 *")
InsBufLine(hbuf, ln++, "*****************************************************************************/")
InsBufLine(hbuf, ln++, "")
InsBufLine(hbuf, ln++, "/*****************************************************************************")
InsBufLine(hbuf, ln++, "* 全局数据类型定义 *")
InsBufLine(hbuf, ln++, "*****************************************************************************/")
InsBufLine(hbuf, ln++, "")
InsBufLine(hbuf, ln++, "/*****************************************************************************")
InsBufLine(hbuf, ln++, "* 全局变量声明 *")
InsBufLine(hbuf, ln++, "*****************************************************************************/")
InsBufLine(hbuf, ln++, "")
InsBufLine(hbuf, ln++, "/*****************************************************************************")
InsBufLine(hbuf, ln++, "* 全局函数声明 *")
InsBufLine(hbuf, ln++, "*****************************************************************************/")
InsBufLine(hbuf, ln++, "")
InsBufLine(hbuf, ln++, "#ifdef __cplusplus")
InsBufLine(hbuf, ln++, "}")
InsBufLine(hbuf, ln++, "#endif")
InsBufLine(hbuf, ln++, "#endif")
InsBufLine(hbuf, ln++, "")
return ln
}
macro hh_InsertSourceFileHeader(hbuf, fileName, ln)
{
hbuf = GetCurrentBuf()
szMyName = hh_get_author_name()
InsBufLine(hbuf, ln++, "/*****************************************************************************")
InsBufLine(hbuf, ln++, "* 头文件引用 *")
InsBufLine(hbuf, ln++, "*****************************************************************************/")
InsBufLine(hbuf, ln++, "")
InsBufLine(hbuf, ln++, "/*****************************************************************************")
InsBufLine(hbuf, ln++, "* 局部常量定义 *")
InsBufLine(hbuf, ln++, "*****************************************************************************/")
InsBufLine(hbuf, ln++, "")
InsBufLine(hbuf, ln++, "/*****************************************************************************")
InsBufLine(hbuf, ln++, "* 局部宏定义 *")
InsBufLine(hbuf, ln++, "*****************************************************************************/")
InsBufLine(hbuf, ln++, "")
InsBufLine(hbuf, ln++, "/*****************************************************************************")
InsBufLine(hbuf, ln++, "* 局部数据类型定义 *")
InsBufLine(hbuf, ln++, "*****************************************************************************/")
InsBufLine(hbuf, ln++, "")
InsBufLine(hbuf, ln++, "/*****************************************************************************")
InsBufLine(hbuf, ln++, "* 局部函数声明 *")
InsBufLine(hbuf, ln++, "*****************************************************************************/")
InsBufLine(hbuf, ln++, "")
InsBufLine(hbuf, ln++, "/*****************************************************************************")
InsBufLine(hbuf, ln++, "* 局部变量定义 *")
InsBufLine(hbuf, ln++, "*****************************************************************************/")
InsBufLine(hbuf, ln++, "")
InsBufLine(hbuf, ln++, "/*****************************************************************************")
InsBufLine(hbuf, ln++, "* 全局变量定义 *")
InsBufLine(hbuf, ln++, "*****************************************************************************/")
InsBufLine(hbuf, ln++, "")
InsBufLine(hbuf, ln++, "/*****************************************************************************")
InsBufLine(hbuf, ln++, "* 全局函数定义 *")
InsBufLine(hbuf, ln++, "*****************************************************************************/")
InsBufLine(hbuf, ln++, "")
InsBufLine(hbuf, ln++, "/*****************************************************************************")
InsBufLine(hbuf, ln++, "* 局部函数定义 *")
InsBufLine(hbuf, ln++, "*****************************************************************************/")
InsBufLine(hbuf, ln++, "")
return ln
}
macro hh_GetFileNameFromFull(fullfileName)
{
len = strlen(fullfileName)
i = len
while (i-- > 0)
{
ch = strmid(fullfileName, i, i+1)
if (ch == "\\")
{
return strmid(fullfileName, i+1, len)
}
}
return ""
}
Source Insight里头文件注释和函数头的注释的更多相关文章
- VA中用文件头注释和函数头注释Suggestions
写C++代码,不能不用VA,这里贴两个我最常用的注释Suggestions. [1.File Header 文件头注释] /*** @file $FILE_BASE$.$FILE_EXT$* ...
- Visual Studio+VAssistX自动添加注释,函数头注释,文件头注释
转载:http://blog.csdn.net/xzytl60937234/article/details/70455777 在VAssistX中为C++提供了比较规范注释模板,用这个注释模板为编写的 ...
- Source Insight新建工程文件
options->document options ->document type ->c source file 下 //添加 “.S”结尾的汇编语言支持 project -& ...
- 代码阅读工具:Source Navigator和Source Insight
(摘自http://www.cnblogs.com/yc_sunniwell/archive/2010/08/25/1808322.html) 一.Source Insight实用技巧: Source ...
- 2016-10-17: source insight插件
使用快捷键注释,单行注释,多行注释,#if 0注释 将文件 mycomment.em点此下载放到sourceinsight的Base工程的路径下(一般是在C:\Documents and Settin ...
- source insight插件
直使用sourceinsight编辑C/C++代码,sourceinsight是一个非常好用的编辑工具可以任意定位,跳转,回退,本人一直 使用该工具做C/C++开发,sourceinsight能够满足 ...
- [SourceInsight].source insight 使用技巧
转自:https://www.veryarm.com/140428.html 1 开胃菜-初级应用 1.1 选择美丽的界面享受工作 虽然不能以貌取人,但似乎从来没有人责备以貌取软件的.SI的华丽界 ...
- 给Source Insight做个外挂系列之一--发现Source Insight
一提到外挂程序,大家肯定都不陌生,QQ就有很多个版本的去广告外挂,很多游戏也有用于扩展功能或者作弊的工具,其中很多也是以外挂的形式提供的.外挂和插件的区别在于插件通常依赖于程序的支持,如果程序不支持插 ...
- Source Insight 插件
一提到外挂程序,大家肯定都不陌生,QQ就有很多个版本的去广告外挂,很多游戏也有用于扩展功能或者作弊的工具,其中很多也是以外挂的形式提供的.外挂和插件的区别在于插件通常依赖于程序的支持,如果程序不支持插 ...
随机推荐
- LeetCode:149_Max Points on a line | 寻找一条直线上最多点的数量 | Hard
题目:Max Points on a line Given n points on a 2D plane, find the maximum number of points that lie on ...
- iOS-实现后台长时间运行
前言 一般APP在按下Home键被挂起后,这时APP的 backgroundTimeRemaining 也就是后台运行时间大约只有3分钟,如果在退出APP后,过十几二十二分钟或者更长时间再回到APP, ...
- tomcat-四种运行模式和三种部署模式(优化)
四中运行模式如下: 1-bio: 传统的Java I/O操作,同步且阻塞IO. 2-nio: JDK1.4开始支持,同步阻塞或同步非阻塞IO 3-aio(nio.2): JDK7开始支持,异步非阻塞I ...
- Flask源码复习之路由
构建路由规则 一个 web 应用不同的路径会有不同的处理函数,路由就是根据请求的 URL 找到对应处理函数的过程. 在执行查找之前,需要有一个规则列表,它存储了 url 和处理函数的对应关系.最容易想 ...
- 机器视觉编程作业02(00)EM算法
任务:对图像进行边缘检测 思路: )将图像的灰度数值进行0-255的维度统计: )EM算法分析出几个核心显示区块的灰度: )使用通用的边界检测算法(具体哪一种待定). 编辑于2017.12.24 15 ...
- UFLDL 教程学习笔记(一)神经网络
UFLDL(Unsupervised Feature Learning and Deep Learning)Tutorial 是由 Stanford 大学的 Andrew Ng 教授及其团队编写的一套 ...
- swaggerui集成oauth implicit
swaggerui集成oauth implicit 添加引用 Swashbuckle.AspNetCore IdentityServer4.AccessTokenValidation 预先准备好Ide ...
- 第四章:Android架构
我们对android有了个大致的了解,知道如何搭建android的环境及简单地写一个HelloWorld程序,而且知道一个android项目包括哪些文件夹和文件及相应的作用.本篇将站在顶级的高度——架 ...
- Jwt Token 安全策略使用 ECDSA 椭圆曲线加密算法签名/验证
椭圆曲线密码学(Elliptic curve cryptography),简称 ECC,是一种建立公开密钥加密的算法,也就是非对称加密,ECDH 与 ECDSA 是基于 ECC 的算法.类似的还有 R ...
- Android开源系列:仿网易Tab分类排序控件实现
前言 产品:网易新闻那个Tab排序好帅. 开发:哦~ 然后这个东东在几天后就出现了..... (PS:差不多一年没回来写博客了~~~~(>_<)~~~~,顺便把名字从 enjoy风铃 修改 ...