Source Insight几个有用的宏有哪些?
//代码检视信息
macro ReviewFunction()
{
var filename //review文件的名称
filename = "Review.txt"
var hbuf//review文件的缓冲区
hbuf = OpenBuf (filename)
if(hbuf==hNil )
hbuf = NewBuf (filename)
var hcurbuf
hcurbuf = GetCurrentBuf ()
var strcurname
strcurname = GetBufName (hcurbuf)//当前监视文件的名称
var dwline
dwline = GetBufLnCur (hcurbuf)
dwline = cat("第",dwline)
dwline = cat(dwline,"行")
var strReview
strReview = Ask("输入监视意见")
AppendBufLine (hbuf, strcurname)
AppendBufLine (hbuf, dwline)
AppendBufLine (hbuf, strReview)
SaveBuf (hbuf)
//AddFileToProj(GetCurrentProj (), filename)
// "localx" is displayed with "Ref to Local" style
}
//添加函数描述信息
macro AddFunctionComment()
{
var hcurbuf
hcurbuf = GetCurrentBuf ()
var strcurname
strcurname = GetBufName (hcurbuf)//当前监视文件的名称
var isymMax
var isym
isymMax = GetBufSymCount (hcurbuf)
isym = 0
var dwline
dwline = GetBufLnCur (hcurbuf)
var symname
symname = GetCurSymbol ()
// while (isym < isymMax)
// {
// symname = GetBufSymName (hcurbuf, isym)
InsBufLine (hcurbuf, dwline, " /** ")
InsBufLine (hcurbuf, dwline+1, " */")
var strReview
strReview = Ask(symname#"函数功能描述")
strReview = cat(" *",strReview)
InsBufLine (hcurbuf, dwline+1, strReview)
// isym = isym + 1
// }
dwline = dwline+2
var hsyml
var cchild
var ichild
var childsym
var symbol
symbol = GetSymbolLocation(symname)
if (symbol == "")
{
Msg (symname # " was not found")
return
}
hsyml = SymbolChildren(symbol)
cchild = SymListCount(hsyml)
ichild = 0
var flag
flag = 0
var strbuf
strbuf=" *"
while (ichild < cchild)
{
childsym = SymListItem(hsyml, ichild)
if(childsym.Type =="Parameter")
{
var s
//SymbolLeafName (childsym.Symbol)
s =strmid (childsym.Symbol, strlen(symname)+1, strlen (childsym.Symbol))
strReview = Ask(s#"参数含义")
strReview =cat(":",strReview)
strReview =cat(s, strReview)
strReview =cat(" */@param ",strReview)
if(flag==0)
{
strbuf = strReview
flag = 1
}
else
{
InsBufLine (hcurbuf, dwline, strReview)
dwline = dwline+1;
}
}
ichild = ichild + 1
}
InsBufLine (hcurbuf, dwline, strbuf)
dwline = dwline+1;
strReview = Ask("返回值含义")
strReview =cat(":",strReview)
// strReview =cat(childsym.Symbol, strReview)
strReview =cat(" */@retval :",strReview)
InsBufLine (hcurbuf, dwline, strReview)
}
//添加文件头描述信息
macro AddFileHeader()
{
var hcurbuf
hcurbuf = GetCurrentBuf ()
var strcurname
strcurname = GetBufName (hcurbuf)//当前监视文件的名称
InsBufLine (hcurbuf, 0, "/** ")
InsBufLine (hcurbuf, 1, " */")
var strcurname
strcurname = GetBufName (hcurbuf)//当前监视文件的名称
var strfilename
var ilen
ilen = strlen(strcurname)
while(strcurname[ilen-1] !="//")
{
ilen =ilen -1
}
strcurname =strmid (strcurname, ilen, strlen(strcurname))
InsBufLine (hcurbuf, 1, " * /@file "#strcurname)
InsBufLine (hcurbuf, 2, " *")
szMyName = getenv(MYNAME)
InsBufLine (hcurbuf, 3, " * /@author @szMyName@")
InsBufLine (hcurbuf, 4, " *")
fLocalTime = GetSysTime(1)
InsBufLine (hcurbuf, 5, " * /@date "#(fLocalTime.year)#"-"#(fLocalTime.month)#"-"#(fLocalTime.day))
InsBufLine (hcurbuf, 6, " *")
InsBufLine (hcurbuf, 7, " * /@version 1.0 ")
InsBufLine (hcurbuf, 8, " *")
InsBufLine (hcurbuf, 9, " * /@note Editor: vc7.1, vim 6.3.7, gcc 3.3.4 ")
InsBufLine (hcurbuf, 10, " *")
InsBufLine (hcurbuf, 11, " * /@note Platform: Linux Kernel 2.6.16")
}
本文地址:http://www.45fan.com/bcdm/69115.html