/*!
* Processes physical and logical lines according to language specific rules.
* NOTE: all the blank lines +
*               whole line comments +
*               lines with compiler directives
*       should have been blanked from filemap by previous processing
*       before reaching this function
*
* \param fmap list of processed file lines
* \param result counter results
* \param fmapBak list of original file lines (same as fmap except it contains unmodified quoted strings)
*
* \return method status
*/
int CMakefileCounter::LanguageSpecificProcess(filemap* fmap, results* result, filemap* fmapBak)
{
	filemap::iterator fit, fitbak;
	string line, lineBak;
	string strLSLOC = "";
	string strLSLOCBak = "";
	unsigned int cnt = 0;
	string exclude = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_$";

	for (fit = fmap->begin(), fitbak = fmapBak->begin(); fit != fmap->end(); fit++, fitbak++)
	{
		line = fit->line;

		// insert blank at the beginning (for searching keywords)
		line = ' ' + line;
		lineBak = ' ' + fitbak->line;
	
		// do not process blank lines
		// blank line means blank_line/comment_line/directive
		if (!CUtil::CheckBlank(line))
		{
			LSLOC(result, line, fit->lineNumber, lineBak, strLSLOC, strLSLOCBak);

			if (print_cmplx)
			{
				cnt = 0;
				CUtil::CountTally(line, exec_name_list, cnt, 1, exclude, "", "", &result->exec_name_count);
			}
			result->exec_lines[PHY]++;
		}
	}
	return 1;
}
Example #2
0
/*!
* Processes physical and logical lines according to language specific rules.
* NOTE: all the blank lines +
*               whole line comments +
*               lines with compiler directives
*       should have been blanked from filemap by previous processing
*       before reaching this function
*
* \param fmap list of processed file lines
* \param result counter results
* \param fmapBak list of original file lines (same as fmap except it contains unmodified quoted strings)
*
* \return method status
*/
int CPythonCounter::LanguageSpecificProcess(filemap* fmap, results* result, filemap* fmapBak)
{
	unsigned int	paren_count			= 0;
	string			strLSLOC			= "";
	string			strLSLOCBak			= "";

	filemap::iterator fit, fitbak;
	string line, lineBak;
	UIntVector loopWhiteSpace;

	unsigned int cnt = 0;
	string exclude = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_$";

	for (fit = fmap->begin(), fitbak = fmapBak->begin(); fit != fmap->end(); fit++, fitbak++)
	{
		line = fit->line;
		lineBak = fitbak->line;

		// do not process blank lines
		// blank line means blank_line/comment_line/directive
		if (!CUtil::CheckBlank(line))
		{
			// does the ReplaceQuote get the continuation character \ replaced?
			LSLOC(result, line, fit->lineNumber, lineBak, strLSLOC, strLSLOCBak, paren_count, loopWhiteSpace);

			if (print_cmplx)
			{
				cnt = 0;
				CUtil::CountTally(line, exec_name_list, cnt, 1, exclude, "", "", &result->exec_name_count);
			}
		}
	}
	return 1;
}
Example #3
0
/*!
* Processes physical and logical lines according to language specific rules.
* NOTE: all the blank lines +
*               whole line comments +
*               lines with compiler directives
*       should have been blanked from filemap by previous processing
*       before reaching this function
*
* \param fmap list of processed file lines
* \param result counter results
* \param fmapBak list of original file lines (same as fmap except it contains unmodified quoted strings)
*
* \return method status
*/
int CCFScriptCounter::LanguageSpecificProcess(filemap* fmap, results* result, filemap* fmapBak)
{
	unsigned int	paren_count			= 0;
	bool			for_flag			= false;
	bool			found_forifwhile	= false;
	bool			found_while			= false;
	char			prev_char			= 0;
	bool			data_continue		= false;
	bool			inArrayDec			= false;
	string			strLSLOC			= "";
	string			strLSLOCBak			= "";
	unsigned int	openBrackets		= 0;

	filemap::iterator fit, fitbak;
	string line, lineBak;
	StringVector loopLevel;

	unsigned int phys_exec_lines = 0;
	unsigned int phys_data_lines = 0;
	unsigned int temp_lines = 0;
	unsigned int cnt = 0;

	// two strings used for string match
	string exclude = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_$";

	for (fit = fmap->begin(), fitbak = fmapBak->begin(); fit != fmap->end(); fit++, fitbak++)
	{
		line = fit->line;

		// insert blank at the beginning(for searching keywords
		line = ' ' + line;
		lineBak = ' ' + fitbak->line;

		// do not process blank lines
		// blank line means blank_line/comment_line/directive
		if (!CUtil::CheckBlank(line))
		{
			LSLOC(result, line, lineBak, strLSLOC, strLSLOCBak, paren_count, for_flag, found_forifwhile, found_while,
				prev_char, data_continue, temp_lines, phys_exec_lines, phys_data_lines, inArrayDec,
				openBrackets, loopLevel);

			if (isPrintKeyword)
			{
				cnt = 0;
				CUtil::CountTally(line, exec_name_list, cnt, 1, exclude, "", "", &result->exec_name_count, false);
			}

			result->exec_lines[PHY] += phys_exec_lines;
			phys_exec_lines = 0;

			result->data_lines[PHY] += phys_data_lines;
			phys_data_lines = 0;

		}
	}
	return 1;
}
/*!
* Processes physical and logical lines according to language specific rules.
*
* \param fmap list of processed file lines
* \param result counter results
* \param fmapBak list of original file lines (same as fmap except it contains unmodified quoted strings)
*
* \return method status
*/
int CCssCounter::LanguageSpecificProcess(filemap* fmap, results* result, filemap* /*fmapBak*/) 
{
	string  exclude = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_$";
	char	prev_char				= ' ';
	string	strLSLOC				= "";
	string	line					= "";
	unsigned int phys_exec_lines	= 0;
	unsigned int phys_data_lines	= 0;
	unsigned int cnt				= 0;

	// The fmap may not contain any lines (e.g. when the file was not found).
	// If this check is not performed, when the for loop starts on the second
	// line (see +1 below) an exception will occur.  Ideally this exception
	// will be passed up to CCodeCounter::CountSLOC and then be caught in
	// MainObject::ProcessSourceList resulting in the output "Unable to count
	// file".  However this exception causes a program crash in Microsoft
	// Visual Studio 2008.  Note that this check causes the exception not to
	// occur, and therefore the "Unable to count file" message not be be
	// displayed, but the more appropriate "unable to open file" message is
	// displayed with or without this check.
	if (fmap->size() == 0)
		return 1;

	// iterating line-by-line of the file
	for (filemap::iterator iter = fmap->begin(); iter != fmap->end(); iter++)
	{
		line = iter->line;

		// checking for a blank line
		if (!CUtil::CheckBlank(line))
		{
			// LSLOC call for the current line, which is not blank and does not contain non-css keywords
			LSLOC(result, line, iter->lineNumber, strLSLOC, prev_char, phys_exec_lines, phys_data_lines);

			if (print_cmplx)
			{
				cnt = 0;
				CUtil::CountTally(iter->line, exec_name_list, cnt, 1, exclude, "", "", &result->exec_name_count);
			}

			// update physical SLOC
			result->exec_lines[PHY] += phys_exec_lines;
			phys_exec_lines = 0;

			result->data_lines[PHY] += phys_data_lines;
			phys_data_lines = 0;
		}
	}
	return 1;
}
/*!
* Processes physical and logical lines according to language specific rules.
* NOTE: all the blank lines +
*               whole line comments +
*               lines with compiler directives
*       should have been blanked from filemap by previous processing
*       before reaching this function
*
* \param fmap list of processed file lines
* \param result counter results
* \param fmapBak list of original file lines (same as fmap except it contains unmodified quoted strings)
*
* \return method status
*/
int CAdaCounter::LanguageSpecificProcess(filemap* fmap, results* result, filemap* fmapBak)
{
	bool			found_accept	= false;
	string			strLSLOC		= "";
	string			strLSLOCBak		= "";
	unsigned int	cnt				= 0;
	unsigned int	loopLevel		= 0;

	filemap::iterator fit, fitbak;
	string line, lineBak, tmp;
	string exclude = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_$:";

	unsigned int l_paren_cnt = 0;
	bool l_foundblock, found_forifwhile, found_end, found_type, found_is;
	l_foundblock = found_forifwhile = found_end = found_is = false;

	for (fit = fmap->begin(), fitbak = fmapBak->begin(); fit != fmap->end(); fit++, fitbak++)
	{
		// insert blank at the beginning (for searching keywords)
		line = ' ' + fit->line;
		lineBak = ' ' + fitbak->line;

		if (!CUtil::CheckBlank(line))
		{
			// blank line means blank_line/comment_line/directive
			// call SLOC function to detect logical SLOC and add to result
			LSLOC(result, line, fit->lineNumber, lineBak, strLSLOC, strLSLOCBak, l_paren_cnt, l_foundblock,
				found_forifwhile, found_end, found_type, found_is, found_accept, loopLevel);

			cnt = 0;
			CUtil::CountTally(line, data_name_list, cnt, 1, exclude, "", "", NULL, false);

			// need to check also if the data line continues
			if (cnt > 0)
				result->data_lines[PHY]++;
			else
				result->exec_lines[PHY]++;

			if (print_cmplx)
			{
				cnt = 0;
				CUtil::CountTally(line, exec_name_list, cnt, 1, exclude, "", "", &result->exec_name_count, false);
			}
		}
	}
	return 1;
}
/*!
* Processes physical and logical lines according to language specific rules.
* NOTE: all the blank lines +
*               whole line comments +
*               lines with compiler directives
*       should have been blanked from filemap by previous processing
*       before reaching this function
*
* \param fmap list of processed file lines
* \param result counter results
* \param fmapBak list of original file lines (same as fmap except it contains unmodified quoted strings)
*
* \return method status
*/
int CCshCounter::LanguageSpecificProcess(filemap* fmap, results* result, filemap* fmapBak)
{
	filemap::iterator fit, fitbak;
	string line, lineBak;

	bool data_continue = false;
	string strLSLOC = "";
	string strLSLOCBak = "";
	string str;
	unsigned int phys_exec_lines = 0;
	unsigned int phys_data_lines = 0;
	unsigned int temp_lines = 0;
	unsigned int cnt = 0;
	unsigned int loopLevel = 0;
	string exclude = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_$";

	for (fit = fmap->begin(), fitbak = fmapBak->begin(); fit != fmap->end(); fit++, fitbak++)
	{
		line = fit->line;
		lineBak = fitbak->line;

		// do not process blank lines (blank_line/comment_line/directive)
		if (!CUtil::CheckBlank(line))
		{
			// process logical SLOC
			LSLOC(result, line, fit->lineNumber, lineBak, strLSLOC, strLSLOCBak, data_continue,
				temp_lines, phys_exec_lines, phys_data_lines, loopLevel);

			if (print_cmplx)
			{
				cnt = 0;
				CUtil::CountTally(line, exec_name_list, cnt, 1, exclude, "", "", &result->exec_name_count);
			}

			// update physical SLOC lines
			result->exec_lines[PHY] += phys_exec_lines;
			phys_exec_lines = 0;

			result->data_lines[PHY] += phys_data_lines;
			phys_data_lines = 0;
		}
	}
	return 1;
}
/*!
* Processes physical and logical lines according to language specific rules.
* NOTE: all the blank lines +
*               whole line comments +
*               lines with compiler directives
*       should have been blanked from filemap by previous processing
*       before reaching this function
*
* \param fmap list of processed file lines
* \param result counter results
* \param fmapBak list of original file lines (same as fmap except it contains unmodified quoted strings)
*
* \return method status
*/
int CRubyCounter::LanguageSpecificProcess(filemap* fmap, results* result, filemap* fmapBak)
{
	string strLSLOC    = "";
	string strLSLOCBak = "";

	filemap::iterator fit, fitbak;
	string line, lineBak;
	StringVector loopLevel;

	unsigned int cnt = 0;
	string exclude = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_$";
	delimiter = "";

	for (fit = fmap->begin(), fitbak = fmapBak->begin(); fit != fmap->end(); fit++, fitbak++)
	{
		line = fit->line;
		lineBak = fitbak->line;
	
		// do not process blank lines
		// blank line means blank_line/comment_line/directive
		if (!CUtil::CheckBlank(line))
		{
			LSLOC(result, line, lineBak, strLSLOC, strLSLOCBak);

			if (print_cmplx)
			{
				cnt = 0;
				CUtil::CountTally(" " + line, exec_name_list, cnt, 1, exclude, "", "", &result->exec_name_count);
			}

			// no data declaration in Ruby
			result->exec_lines[PHY]++;
		}
	}
	return 1;
}
/*!
* Processes physical and logical lines according to language specific rules.
* NOTE: all the blank lines +
*               whole line comments
*       should have been blanked from filemap by previous processing
*       before reaching this function
*
* \param fmap list of processed file lines
* \param result counter results
* \param fmapBak list of original file lines (same as fmap except it contains unmodified quoted strings)
*
* \return method status
*/
int CTagCounter::LanguageSpecificProcess(filemap* fmap, results* result, filemap* fmapBak)
{
    unsigned int cnt = 0;
    filemap::iterator fit, fitBak;
    string line, lineBak;
    size_t lineNumber = 0;
    string exclude = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_$";
    string strLSLOC, strLSLOCBak;
    char prev_char = 0;
    bool ok, data_continue = false;
    unsigned int phys_exec_lines = 0;
    unsigned int phys_data_lines = 0;
    unsigned int temp_lines = 0;

    size_t idx_start, quote_idx_start;
    char CurrentQuoteEnd = 0;
    bool quote_contd = false;
    QuoteStart = ">";
    QuoteEnd = "<";

    for (fit = fmap->begin(), fitBak = fmapBak->begin(); fit != fmap->end(); fit++, fitBak++)
    {
        if (!CUtil::CheckBlank(fit->line))
        {
            // replace "quotes" - string between close and open tags
            // must be processed after comments since comments start/end with same character as tag
            quote_idx_start = 0;
            idx_start = 0;
            if (quote_contd)
            {
                // replace quote until next character
                ReplaceQuote(fit->line, quote_idx_start, quote_contd, CurrentQuoteEnd);
            }
            if (!quote_contd)
            {
                while (idx_start < fit->line.length())
                {
                    quote_idx_start = FindQuote(fit->line, QuoteStart, quote_idx_start, QuoteEscapeFront);

                    if (quote_idx_start == string::npos)
                        break;

                    ReplaceQuote(fit->line, quote_idx_start, quote_contd, CurrentQuoteEnd);
                    if (quote_idx_start > idx_start)
                    {
                        // comment delimiter inside quote
                        idx_start = quote_idx_start;
                        continue;
                    }
                }
            }

            line = fit->line;
            lineBak = fitBak->line;
            lineNumber = fit->lineNumber;

            LSLOC(result, line, lineNumber, lineBak, strLSLOC, strLSLOCBak, prev_char,
                  data_continue, temp_lines, phys_exec_lines, phys_data_lines);

            if (print_cmplx)
            {
                cnt = 0;
                CountTagTally(line, exec_name_list, cnt, 1, exclude, "", "", &result->exec_name_count, false);
            }

            result->exec_lines[PHY] += phys_exec_lines;
            phys_exec_lines = 0;

            result->data_lines[PHY] += phys_data_lines;
            phys_data_lines = 0;
        }
    }
    QuoteStart = "";
    QuoteEnd = "";

    // capture closing tag
    if (strLSLOC.length() > 0)
    {
        bool trunc_flag = false;
        if (strLSLOCBak.length() == this->lsloc_truncate)
            trunc_flag = true;
        ok = result->addSLOC(strLSLOCBak, lineNumber, trunc_flag);

        cnt = 0;
        if (data_name_list.size() > 0)
            CUtil::CountTally(strLSLOC, data_name_list, cnt, 1, exclude, "", "", &result->data_name_count);

        if (data_continue || cnt > 0)
        {
            if (ok)
                result->data_lines[LOG]++;
            result->data_lines[PHY]++;
        }
        else
        {
            if (ok)
                result->exec_lines[LOG]++;

            // since physical data lines are recorded at next LSLOC, check if first line was a data line
            if (data_name_list.size() > 0)
            {
                fit = fmap->begin();
                cnt = 0;
                CUtil::CountTally(fit->line, data_name_list, cnt, 1, exclude, "", "", NULL);
                if (cnt > 0)
                    result->exec_lines[PHY]++;
            }
        }
    }
    return 0;
}
/*!
* Processes physical and logical lines according to language specific rules.
* NOTE: all the blank lines +
*               whole line comments +
*               lines with compiler directives
*       should have been blanked from filemap by previous processing
*       before reaching this function
*
* \param fmap list of processed file lines
* \param result counter results
* \param fmapBak list of original file lines (same as fmap except it contains unmodified quoted strings)
*
* \return method status
*/
int CFortranCounter::LanguageSpecificProcess(filemap* fmap, results* result, filemap* fmapBak)
{
	filemap::iterator fit, fitbak, fitNext = fmap->begin();
	string line, lineBak, lineNext;

	bool data_continue = false, fixed_continue = false;
	string strLSLOC = "";
	string strLSLOCBak = "";
	string str;
	unsigned int phys_exec_lines = 0;
	unsigned int phys_data_lines = 0;
	unsigned int temp_lines = 0;
	unsigned int cnt = 0;
	StringVector loopEnd;
	string exclude = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_$";

	for (fit = fmap->begin(), fitbak = fmapBak->begin(); fit != fmap->end(); fit++, fitbak++)
	{
		if (fitNext != fmap->end())
			fitNext++;
		line = fit->line;
		lineBak = fitbak->line;

		// do not process blank lines (blank_line/comment_line/directive)
		if (!CUtil::CheckBlank(line))
		{
			// get next line to check for fixed format continuation (non-blank and non-0 in col 6)
			lineNext = "";
			fixed_continue = false;
			if (fitNext != fmap->end())
			{
				lineNext = fitNext->line;
				if (!CUtil::CheckBlank(lineNext))
				{
					if (lineNext.length() > 6)
					{
						str = lineNext.substr(0, 5);
						if ((CUtil::CheckBlank(str) || CUtil::IsInteger(str)) &&
							lineNext[5] != ' ' && lineNext[5] != '0')
						{
							// fixed format continuation
							fixed_continue = true;
						}
					}
				}
			}

			// process logical SLOC
			LSLOC(result, line, fit->lineNumber, lineBak, strLSLOC, strLSLOCBak, fixed_continue,
				data_continue, temp_lines, phys_exec_lines, phys_data_lines, loopEnd);

			if (print_cmplx)
			{
				cnt = 0;
				CUtil::CountTally(line, exec_name_list, cnt, 1, exclude, "", "", &result->exec_name_count, false);
			}

			// update physical SLOC lines
			result->exec_lines[PHY] += phys_exec_lines;
			phys_exec_lines = 0;

			result->data_lines[PHY] += phys_data_lines;
			phys_data_lines = 0;
		}
	}
	return 1;
}
/*!
* Processes physical and logical lines according to language specific rules.
* NOTE: all the blank lines +
*               whole line comments +
*               lines with compiler directives
*       should have been blanked from filemap by previous processing
*       before reaching this function
*
* \param fmap list of processed file lines
* \param result counter results
* \param fmapBak list of original file lines (same as fmap except it contains unmodified quoted strings)
*
* \return method status
*/
int CPerlCounter::LanguageSpecificProcess(filemap* fmap, results* result, filemap* fmapBak)
{
	string strLSLOC;
	string strLSLOCBak;
	unsigned int l_paren_cnt = 0;
	bool l_forflag, found_forifwhile, found_while;
	char prev_char = 0;
	l_forflag = found_forifwhile = found_while = false;

	bool comment = false;
	unsigned int cnt = 0;
	size_t comPos = string::npos;
	size_t p;
	filemap::iterator fit, fitbak;
	string line, lineBak;
	string exclude = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
	bool data_continue = false;
	unsigned int phys_exec_lines = 0;
	unsigned int phys_data_lines = 0;
	unsigned int temp_lines = 0;
	unsigned int openBrackets = 0;
	StringVector loopLevel;

	for (fit = fmap->begin(), fitbak = fmapBak->begin(); fit != fmap->end(); fit++, fitbak++)
	{
		// insert blank at the beginning(for searching keywords)
		line = ' ' + fit->line;
		lineBak = ' ' + fitbak->line;
		size_t lineNumber = fit->lineNumber;

		if (!CUtil::CheckBlank(line))
		{
			if (comment == true)
			{
				p = line.find("\n");
				if (p != string::npos)
				{
					line.replace(0, p + 2, " ");
					lineBak.replace(0, p + 2, " ");
				}
				else
					continue;
			}

			comPos = line.find("#");
			if (comPos == string::npos)
				comment = false;
			else
			{
				comment = true;
				p = line.substr(comPos + 3).find("");
				if (p != string::npos)
				{
					line.replace(comPos, p - comPos + 1, " ");
					lineBak.replace(comPos, p - comPos + 1, " ");
					comment = false;
				}
				else
				{
					line.replace(comPos, line.size() - comPos, " ");
					lineBak.replace(comPos, lineBak.size() - comPos, " ");
				}
			}

			LSLOC(result, line, lineNumber, lineBak, strLSLOC, strLSLOCBak, l_paren_cnt, l_forflag, found_forifwhile,
				found_while, prev_char, data_continue, temp_lines, phys_exec_lines, phys_data_lines, openBrackets, loopLevel);

			if (print_cmplx)
			{
				cnt = 0;
				CUtil::CountTally(line, exec_name_list, cnt, 1, exclude, "", "", &result->exec_name_count);
			}

			result->exec_lines[PHY] += phys_exec_lines;
			phys_exec_lines = 0;

			result->data_lines[PHY] += phys_data_lines;
			phys_data_lines = 0;
		}
	}
	return 1;
}
/*!
* Processes physical and logical lines according to language specific rules.
* NOTE: all the blank lines +
*               whole line comments +
*               lines with compiler directives
*       should have been blanked from filemap by previous processing
*       before reaching this function
*
* \param fmap list of processed file lines
* \param result counter results
* \param fmapBak list of original file lines (same as fmap except it contains unmodified quoted strings)
*
* \return method status
*/
int CSqlCounter::LanguageSpecificProcess(filemap* fmap, results* result, filemap* fmapBak)
{
	size_t i, j, k, ind, nextInd;
	unsigned int sloc_count, dsloc_count, lineNum;
	string stmt, stmtBak, exec_keyword, data_keyword;
	filemap::iterator fit, fitbak;

	unsigned int data_count	= 0;
	unsigned int exec_count	= 0;
	bool	trunc_flag		= false;
	string	exclude			= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_$";
	string	line			= "";
	string	lineBak			= "";
	bool    data_continue	= false;
	string  strLSLOC		= "";
	string  strLSLOCBak		= "";
	size_t lineNumber;

	vector<string> nestedSql, nestedSqlBak;
	stack<size_t> pistack, ppstack;
	size_t mapi = 0, pi, pp;

	// process physical SLOC and capture embedded SLOC
	for (fit = fmap->begin(), fitbak = fmapBak->begin(); fit != fmap->end(); fit++, fitbak++)
	{
		// insert blank at the beginning(for searching keywords)
		line = ' ' + fit->line;
		lineBak = ' ' + fitbak->line;
		lineNumber = fit->lineNumber;

		if (CUtil::CheckBlank(line))
		{
			mapi++;
			continue;
		}

		// check physical lines
		exec_count = 0;
		CUtil::CountTally(line, exec_name_list, exec_count, 1, exclude, "", "", &result->exec_name_count, false);
		data_count = 0;
		CUtil::CountTally(line, data_name_list, data_count, 1, exclude, "", "", &result->data_name_count, false);
		if (exec_count > 0 || (data_count <= 0 && !data_continue))
		{
			data_continue = false;
			result->exec_lines[PHY]++;
		}
		else
		{
			data_continue = true;
			result->data_lines[PHY]++;
		}

		for (i = 1; i < line.length(); i++)
		{
			if (line[i] == '(')
			{
				pistack.push(mapi);
				ppstack.push(i - 1);
			}
			else if (line[i] == ')' && pistack.size() > 0)
			{
				// capture embedded SLOC
				pi = pistack.top();
				pp = ppstack.top();
				pistack.pop();
				ppstack.pop();
				if (pi == mapi)
				{
					stmt = fit->line.substr(pp, i - pp);
					stmtBak = fitbak->line.substr(pp, i - pp);
				}
				else
				{
					stmt = fmap->at(pi).line.substr(pp);
					stmtBak = fmapBak->at(pi).line.substr(pp);
					for (j = pi + 1; j < mapi; j++)
					{
						stmt += ' ' + fmap->at(j).line;
						stmtBak += ' ' + fmapBak->at(j).line;
					}
					stmt += ' ' + fit->line.substr(0, i);
					stmtBak += ' ' + fitbak->line.substr(0, i);
				}
				
				// check for executable statement keywords
				sloc_count = 0;
				dsloc_count = 0;
				CUtil::CountTally(stmt, exec_name_list, sloc_count, 1, exclude, "", "", NULL, false);
				if (sloc_count > 0)
				{
					// extract embedded SLOC from main content
					if (pi == mapi)
					{
						fit->line.erase(pp, i - pp);
						fitbak->line.erase(pp, i - pp);
						line.erase(pp + 1, i - pp - 1);
						lineBak.erase(pp + 1, i - pp - 1);
						i = pp + 1;
					}
					else
					{
						fmap->at(pi).line.erase(pp);
						fmapBak->at(pi).line.erase(pp);
						for (j = pi + 1; j < mapi; j++)
						{
							fmap->at(j).line.clear();
							fmapBak->at(j).line.clear();
						}
						fit->line.erase(0, i);
						fitbak->line.erase(0, i);
						line.erase(1, i - 1);
						lineBak.erase(1, i - 1);
						i = 1;
					}
					stmt = CUtil::TrimString(stmt.substr(1, stmt.length() - 2));
					stmtBak = CUtil::TrimString(stmtBak.substr(1, stmtBak.length() - 2));
					nestedSql.push_back(stmt);
					nestedSqlBak.push_back(stmtBak);
				}
				else
				{
					CUtil::CountTally(stmt, data_name_list, dsloc_count, 1, exclude, "", "", NULL, false);
					if (dsloc_count > 0)
					{
						// mark data keywords (not counted as LSLOC)
						for (j = 0; j < data_name_list.size(); j++)
						{
							ind = 0;
							nextInd = 0;
							data_keyword = data_name_list.at(j);
							while (ind != string::npos)
							{
								ind = CUtil::FindKeyword(stmt, data_keyword, nextInd, TO_END_OF_STRING, false);
								if (ind != string::npos)
								{
									stmt.replace(ind, 1, "$");
									nextInd = ind + 1;
								}
							}
							ind = pp;
							nextInd = pp;
							if (pi == mapi)
							{
								while (ind != string::npos)
								{
									ind = CUtil::FindKeyword(fit->line, data_keyword, nextInd, i - 1, false);
									if (ind != string::npos)
									{
										fit->line.replace(ind, 1, "$");
										nextInd = ind + 1;
									}
								}
							}
							else
							{
								while (ind != string::npos)
								{
									ind = CUtil::FindKeyword(fmap->at(pi).line, data_keyword, nextInd, TO_END_OF_STRING, false);
									if (ind != string::npos)
									{
										fmap->at(pi).line.replace(ind, 1, "$");
										nextInd = ind + 1;
									}
								}
								for (k = pi + 1; k < mapi; k++)
								{
									ind = 0;
									nextInd = 0;
									while (ind != string::npos)
									{
										ind = CUtil::FindKeyword(fmap->at(k).line, data_keyword, nextInd, TO_END_OF_STRING, false);
										if (ind != string::npos)
										{
											fmap->at(k).line.replace(ind, 1, "$");
											nextInd = ind + 1;
										}
									}
								}
								ind = 0;
								nextInd = 0;
								while (ind != string::npos)
								{
									ind = CUtil::FindKeyword(fit->line, data_keyword, nextInd, i - 1, false);
									if (ind != string::npos)
									{
										fit->line.replace(ind, 1, "$");
										nextInd = ind + 1;
									}
								}
							}
						}
					}
				}
			}
		}
		mapi++;
	}
	data_continue = false;

	// add embedded SLOC to file maps
	if (nestedSql.size() > 0)
	{
		lineNum = fmap->back().lineNumber;
		for (i = 0; i < nestedSql.size(); i++)
		{
			lineNum++;
			lineElement element(lineNum, nestedSql.at(i));
			fmap->push_back(element);
			lineElement elementBak(lineNum, nestedSqlBak.at(i));
			fmapBak->push_back(elementBak);
		}
		nestedSql.clear();
		nestedSqlBak.clear();
	}

	// process logical SLOC
	for (fit = fmap->begin(), fitbak = fmapBak->begin(); fit != fmap->end(); fit++, fitbak++)
	{
		// insert blank at the beginning(for searching keywords)
		line = ' ' + fit->line;
		lineBak = ' ' + fitbak->line;

		if (CUtil::CheckBlank(line))
			continue;
		lineNumber = fit->lineNumber;
		// process logical SLOC
		LSLOC(result, line, lineNumber, lineBak, strLSLOC, strLSLOCBak, data_continue);
	}
	if (strLSLOC.length() > 0)
	{
		if (result->addSLOC(strLSLOCBak, lineNumber, trunc_flag))
		{
			if (data_continue)
				result->data_lines[LOG]++;
			else
				result->exec_lines[LOG]++;
		}
		strLSLOC = strLSLOCBak = "";
		data_continue = false;
	}
	return 1;
}