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")

}

 

  • 0
    点赞
  • 0
    收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
评论 1

打赏作者

wangjinhu

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值