티스토리 뷰

sourceinsight macro 주석

참고 :

참고할 macro 사용법

http://www.sourceinsight.com/public/macros/

comment macro

매크로 기능 설명: toggle comments
매크로를 실행하면 code의 맨 앞에 // 주석이 달린다.
그리고 맨앞에 // 주석이 달려있는 code는 다시 // 를 없애도록 되어 있다.
여러 줄을 한번에 하는 것도 가능하다.

아래사항을 복사해서 .em 으로 하고 base project 에 추가하면 된다.
macro function 의 이름이 macro 이름이 된다.

\-------------------------------------------------------------------------------------  

/\* InstertComment:  

  insert comments at the first column of the line you select.  

 [gaedduck@gmail.com](mailto:gaedduck@gmail.com)  
\*/  
macro InsertComment()  
{  
   env = GetProgramEnvironmentInfo()  
   szMyName = env.UserName  
   szMyOrganization = env.UserOrganization  

   hbufCur = GetCurrentBuf() /\* current file you see on the window \*/  
   lnCur = GetBufLnCur(hbufCur)    /\* current line \*/  
   lengthCur = GetBufLineLength(hbufCur, lnCur)  


   szComment = "//"  

   hwnd = GetCurrentWnd()  
   selection = GetWndSel(hwnd)  
   //selection.lnFirst  

    newLine = ""  
   i = selection.lnFirst  
   while(i <= selection.lnLast){  
        /\* Uncommnet \*/  
        line = GetBufLine(hbufCur, i)  
        linelen = strlen(line)  
        if (linelen > 0 ){  
            if(line\[0\] == "/" && line\[1\] =="/"){  
                newLine = strmid(line, 2, linelen)  
                DelBufLine(hbufCur, i)                    /\* delete the current line \*/  
                InsBufLine(hbufCur, i, newLine)    /\* insert the new line without comment \*/  
                i = i +1  
                continue  
            }  
        }  

        /\* Commnet \*/  
        SetBufIns(hbufCur, i, 0)                        /\* set the insertion point \*/  
        SetBufSelText(hbufCur, szComment)    /\* insert the comment \*/  

        i = i +1  
   }  


}
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함