========== CSplit: Version 2.0 ==========
========== CSplit: Begin part 7/16 ==========
|| itsPrevState == InCComment)
break;
default:
if (c)
code_lines++;
}
if (open_comment > close_comment)
{
cmt_lines++;
}
c = 0;
}
switch (itsState)
{
case NormalInput:
switch (theEvent)
{
case FOUND_SLASH:
case FOUND_NL:
case FOUND_WHITESPACE:
break;
default:
c++;
}
break;
case BeginComment:
switch (theEvent)
{
case FOUND_SLASH: // Yes, it's a C++ comment.
cpp_comments++;
cmt_lines++;
break;
case FOUND_STAR: // Yes, it's a C comment.
open_comment++;
cmt_lines++;
break;
}
break;
case StarInCComment:
switch (theEvent)
{
case FOUND_SLASH: // End of C comment.
close_comment++;
break;
}
break;
}
}
int processFile (CommentCounter &obj, char *pszFile)
{
if (0 == obj.init (pszFile))
{
return 0;
}
else
{
obj.run();
obj.unInit();
if (! bTotalsOnly)
{
char *p = pszFile;
if (*p == '.')
p++;
if (*p == '.')
p++;
if (*p == '\\')
p++;
if (bBalance)
{
printf ("%s\t%4d/%-4d %s\n",
p,
obj.getOpenComment(),
obj.getCloseComment(),
obj.getOpenComment() != obj.getCloseComment() ? "*" \
\
: " "
);
}
else
{
long ratio = 1000 * obj.getCommentLines() / \
\
obj.getLines();
printf ("%s\n%8lu %8lu %8lu %8lu %10ld.%ld %%\n",
p,
obj.getCppComments(),
obj.getCommentLines(),
obj.getCodeLines(),
obj.getLines(),
ratio / 10,
ratio % 10
);
}
}
obj.sumTotals();
obj.reset();
}
return 1;
}
// Go through each file that match the file mask.
// Do subdirectory search if requested.
int forAllMatch (CommentCounter &obj, int *pnFiles, char *szSearchPath)
{
FFbuff *pBuff;
int rc;
char szNewPath[260];
pBuff = new FFbuff;
if (!pBuff)
{
return -1;
}
// Recursively process all subdirectory.
if (szSearchPath[strlen (szSearchPath) - 1] == ':')
strcat (szSearchPath, "*.*");
else
strcat (szSearchPath, "\\*.*");
// Subdirectory search requested.
if (bSubdirs)
{
rc = pBuff->FindFirst (szSearchPath, FFbuff::ATTR_DIRECTORY);
if (rc)
{
delete pBuff;
return rc;
========== CSplit: End part 7/16 crc: 116f ==========
// Albert email: jla@to.icl.fi
--- GoldED/2 2.50+
---------------
* Origin: Albert's Point/2 in Finland, Europe (2:221/360.20)
|