source insight 添加注释,添加环境变
来源:互联网 发布:算法考题 编辑:程序博客网 时间:2024/06/10 06:35
在写程序的时候有时候需要添加函数注释或者头文件注释,在source insight中可以通过宏定义快捷键一键添加注释模板。但是需要添加环境变量,这里一开始没有明白是什么意思,后来搜索到了。添加环境变量:就是在我们电脑里设置环境变量,之所以要添加是因为source insight 注释中要提取名字。这里是两个函数:
添加函数注释:
macro MyInsertHeader(){ // Get the owner's name from the environment variable: MYNAME. // If the variable doesn't exist, then the owner field is skipped. szMyName = getenv(MYNAME) // Get a handle to the current file buffer and the name // and location of the current symbol where the cursor is. hbuf = GetCurrentBuf() szFunc = GetCurSymbol() ln = GetSymbolLine(szFunc) InsBufLine(hbuf, ln, "/************************************************************"); ln = ln +1 // begin assembling the title string sz = "** 函数名称: " /* convert symbol name to T E X T L I K E T H I S */ cch = strlen(szFunc) ich = 0 while (ich < cch) { ch = szFunc[ich] if (ich > 0) if (isupper(ch)) sz = cat(sz, " ") else sz = cat(sz, " ") sz = Cat(sz, toupper(ch)) ich = ich + 1 } InsBufLine(hbuf, ln, sz) ln = ln + 1 InsBufLine(hbuf, ln, "** 功能描述: ") ln = ln + 1 InsBufLine(hbuf, ln, "** 输入参数:") ln = ln + 1 InsBufLine(hbuf, ln, "** 输出参数: ") ln = ln + 1 InsBufLine(hbuf, ln, "** 返 回 值 :") ln = ln + 1 /* if owner variable exists, insert Owner: name */ if (strlen(szMyName) > 0) { InsBufLine(hbuf, ln, "** 作 者 : @szMyName@") } else { InsBufLine(hbuf, ln, "** 作 者 : ") } ln = ln + 1 // Get current time szTime = GetSysTime(1) Day = szTime.Day Month = szTime.Month Year = szTime.Year if (Day < 10) szDay = "0@Day@" else szDay = Day InsBufLine(hbuf, ln, "** 日 期 : @Year@年@Month@月@szDay@日") ln = ln + 1 InsBufLine(hbuf, ln, "** 版 本 : 1.0") ln = ln + 1 InsBufLine(hbuf, ln, "** 修改日期 版本号 修改人 修改内容") ln = ln + 1 InsBufLine(hbuf, ln, "**************************************************************/")}
以下是添加头文件注释宏:
macro MyInsertFileHeader(){ szMyName = getenv(MYNAME) hbuf = GetCurrentBuf() InsBufLine(hbuf, 0, "/***************************************************************************") InsBufLine(hbuf, 1, "** 版权所有: Desay Copyright (c) 2016-2026 ******************** ") filename = GetBufName(hbuf) InsBufLine(hbuf, 2, "** 文件名称: @filename@") InsBufLine(hbuf, 3, "** 文件标识: ") InsBufLine(hbuf, 4, "** 内容摘要: ") InsBufLine(hbuf, 5, "** 当前版本: v1.0") /* if owner variable exists, insert Owner: name */ if (strlen(szMyName) > 0) { sz = "** 作 者 : @szMyName@" } else { sz = "** 作 者 :" } InsBufLine(hbuf, 6, sz) // Get current time szTime = GetSysTime(1) Day = szTime.Day Month = szTime.Month Year = szTime.Year if (Day < 10) szDay = "0@Day@" else szDay = Day InsBufLine(hbuf, 7, "** 完成日期: @Year@年@Month@月@szDay@日") InsBufLine(hbuf, 8, "** 修改记录: ") InsBufLine(hbuf, 9, "** 修改记录: ") InsBufLine(hbuf, 10, "** 修改日期: ") InsBufLine(hbuf, 11, "** 版本号 : ") InsBufLine(hbuf, 12, "** 修改人 : ") InsBufLine(hbuf, 13, "** 修改内容: ") InsBufLine(hbuf, 14, "***************************************************************************/")}
以上添加完就可以配置快捷方式,具体操作方式看另一篇文章就可以了。
添加环境变量:计算机->右键属性->(左上角)高级系统设置->环境变量->(在用户环境变量中)新建->变量名:MYNAME,变量值:XXX(你的名字)
需要注意:
1、设置完成环境变量后,需要重启source insight ,以上配置才起作用,至少我的电脑是这样的。
2、环境变量的具体位置,不同系统可能不同,我是w7,具体根据自己的实际系统找到即可。
3、添加函数注释的时候首先要先写出函数的名字,再用快捷键添加函数注释,不然不报错。
1 0
- source insight 添加注释,添加环境变
- source insight 添加注释快捷方式
- Source Insight添加快键键注释
- Source Insight中快速添加注释
- 给source insight添加doxygen注释风格
- source insight 宏 添加函数注释
- Source Insight 注释快捷键的宏添加
- source insight 添加文件类型
- Source Insight 自动添加的注释信息如何设置的
- 利用Source Insight宏语言脚本添加注释
- 给Source Insight添加块注释宏、全部选择宏
- 利用Source Insight宏语言脚本添加注释
- 在source insight中添加自己的单行注释命令
- 利用Source Insight宏语言脚本添加注释
- Source Insight通过快捷按键添加多种代码注释
- source insight 添加宏定义
- source Insight 添加 VC 库
- 为source insight添加Makefile
- Centos 7.2 Node.js 安装
- Android 百度地图+Fragment冲突
- socket编程的同步、异步与阻塞、非阻塞示例
- Apple Pay市场再扩大: 全面登陆加拿大地区
- 20160511 GreenPlum7 分区表
- source insight 添加注释,添加环境变
- 图像基本变换---直方图
- 多重继承——菱形继承(二义性)
- Dart入门—集合类型
- socket编程的同步、异步与阻塞、非阻塞示例详解之二
- Android辅助工具01
- google分享审请AppID、AppSecret注意问题
- 图像基本变换---图像形态学算法(膨胀+腐蚀+开运算+闭运算)
- pgSQL substring(一):删除字段中除数字之外的字段