SourceInsight【生成函数头】


/************************************************************************ 
 功能描述:生成函数注释例子 
 参数说明: 
 原理说明: 
 返 回 值:环形缓冲区指针 
 作    者:肖鑫 2014-05-17 创建函数
*************************************************************************/ 
macro InsertFunctionHeader()
{
	// Get the owner's name from the environment variable: MYNAME.
	// If the variable doesn't exist, then the owner field is skipped.
	szMyName = getenv(MYNAME)
	if ("" == szMyName)
	{
		szMyName = "(set env MYNAME=YourName)"
	}

	/* 获取系统时间,将月转换为两位字符串,将日转换为两位字符串 */
	szTime = GetSysTime(1)
	ulYear = szTime.Year
	ulMonth = szTime.Month
	if (ulMonth < 10)
	{
		ulMonth = "0@ulMonth@"
	}
	ulDay = szTime.Day
	if (ulDay < 10)
	{
		ulDay = "0@ulDay@"
	}

	// Get a handle to the current file buffer and the name
	// and location of the current symbol where the cursor is.
	hbuf = GetCurrentBuf()
	szFunc = GetCurSymbol()
	ln = GetSymbolLine(szFunc)

	/* Record the start line */
	beginLn = ln

	// begin assembling the title string
	sz = "/************************************************************************"
	InsBufLine(hbuf, ln, sz)

	ln = ln + 1
	sz = " 功能描述:"
	InsBufLine(hbuf, ln, sz)

	ln = ln + 1
	sz = " 参数说明:"
	InsBufLine(hbuf, ln, sz)

	ln = ln + 1
	sz = " 原理说明:"
	InsBufLine(hbuf, ln, sz)

	ln = ln + 1
	sz = " 返 回 值:"
	InsBufLine(hbuf, ln, sz)

	ln = ln + 1
	sz = " 作    者:@szMyName@ @ulYear@-@ulMonth@-@ulDay@ 创建函数"
	InsBufLine(hbuf, ln, sz)

	ln = ln + 1
	sz = "*************************************************************************/ "
	InsBufLine(hbuf, ln, sz)

	/* 将当前光标移至功能描述的后面 */
	SetBufIns(hbuf, beginLn + 1, 11)
}


你可能感兴趣的:(SourceInsight【生成函数头】)