插入文件注释代码实现
macro InsertFileComment() { hbuf = GetCurrentBuf() ln = 0 szName = "pengchao" szContent = ""; SysTime = GetSysTime(1) szYear=SysTime.Year InsBufLine(hbuf, ln + 0, "/********************************************************************************") InsBufLine(hbuf, ln + 1, "") InsBufLine(hbuf, ln + 2, " **** Copyright (C), @szYear@, xx xx xx xx info&tech Co., Ltd. ****") InsBufLine(hbuf, ln + 3, "") InsBufLine(hbuf, ln + 4, " ********************************************************************************") sz = GetFileName(GetBufName (hbuf)) InsBufLine(hbuf, ln + 5, " * File Name : @sz@") InsBufLine(hbuf, ln + 6, " * Author : @szName@") SysTime = GetSysTime(1) sz=SysTime.Year sz1=SysTime.month sz3=SysTime.day if (sz1 < 10) { szMonth = "0@sz1@" } else { szMonth = sz1 } if (sz3 < 10) { szDay = "0@sz3@" } else { szDay = sz3 } InsBufLine(hbuf, ln + 7, " * Date : @sz@-@szMonth@-@szDay@") szTmp = " * Description : " nlnDesc = ln iLen = strlen (szContent) InsBufLine(hbuf, ln + 8, " * Description : @szContent@") InsBufLine(hbuf, ln + 9, " * Version : 1.0") InsBufLine(hbuf, ln + 10," * Function List :") InsBufLine(hbuf, ln + 11," * ") //插入函数列表 InsBufLine(hbuf, ln + 12, " * Record :") InsBufLine(hbuf, ln + 13, " * 1.Date : @sz@-@szMonth@-@szDay@") InsBufLine(hbuf, ln + 14, " * Author : @szName@") InsBufLine(hbuf, ln + 15, " * Modification: Created file") InsBufLine(hbuf, ln + 16, "") InsBufLine(hbuf, ln + 17, "*************************************************************************************************************/") InsBufLine(hbuf, ln + 18, "") if(iLen != 0) { return } //如果没有功能描述内容则提示输入 //szContent = Ask("Description") SetBufIns(hbuf,nlnDesc + 14,0) DelBufLine(hbuf,nlnDesc +10) //注释输出处理,自动换行 CommentContent(hbuf,nlnDesc + 10," Description : ",szContent,0) }