- 5
- 0
- 约1.62万字
- 约 18页
- 2016-11-27 发布于河南
- 举报
SourceInsight Macro
Source insight 宏的使用
作者:颜庆
打开source insight 的base工程(菜单Project - Open Project),其中一个文件叫utils.em ,在这个文件里添加你自己的宏,然后在菜单option/key assignments中给相应的宏分配快捷键,就可以使用source insight 宏了。
下面是一些具体的宏的介绍。
autoexpand
把下面的代码拷贝到source insight的base工程中的utils.em文件中,然后在你自己的工程中,打开option/key assignments, 为autoexpand 这个宏分配快捷键,这里用的是ctrl + 1
?
使用:在source insight 中先键入一个关键字,比如for, 然后按下你的快捷键,宏就会帮你展开相应的代码, 如下图所示,这时你可以通过F3, F4跳到下一个“###”
insheaderdef
这个source insight宏可以自动给头文件加上头文件宏,它会自动获取文件名,自动添加与文件名对应的宏。
执行insheaderdef宏之前代码如下
执行insheaderdef宏之后代码如下
InsertIfdef
这个source insight宏可以自动给一段选中的代码加上宏开关
执行InsertIfdef宏之前选中若干行代码
执行InsertIfdef宏之后会有提示框让你输入宏,我们输入AEE_SIMULATOR
然后回车,代码如下:
MakeCode2Comments
把选中的代码前面加双斜杠“//”
执行宏之后:
MakeComments2Code
与上面一个宏的作用刚好相反
NeateanVarDeclaration
整理变量声明,让变量对齐,先选中若干行:
执行之后:
注意:这个宏默认地通过空格作为分隔符来对齐每一部分;另外,你要保证你的source insight 使用的字体是等宽字体Courier New,才能让字符对齐
修改字体方法: options - Document options - Screen Fonts
insfunheader
这个宏可以给函数自动加函数头注释
先让光标停留在某个函数体内:
执行宏,会弹出输入框,让你输入函数描述:
点OK之后:
/*附上宏定义文件*//* t357.em - a small collection of useful editing macros */
/******************************************************************************* InsFileHeader -- insert the information of file** modification history* --------------------* 01a, 23mar2003, added DESCRIPTION by t357* 01a, 05mar2003, t357 written* --------------------******************************************************************************//*-------------------------------------------------------------------------I N S E R T?? H E A D E R
Inserts a comment header block at the top of the current function.This actually works on any type of symbol, not just functions.
To use this, define an environment variable szMyName and set itto your email name. eg. set szMyName=raygr-------------------------------------------------------------------------*/
macro InsFileHeader(){
/*##################################################################################################################
原创力文档

文档评论(0)