========== CSplit: Version 2.0 ==========
========== CSplit: Begin part 9/16 ==========
}
printf ("==================================================\n");
}
char *psz;
char szSearchPath[260];
while (argc--)
{
// Must do a subdirectory search.
if (bSubdirs || strchr (*argv, '\\') || strchr (*argv, ':'))
{
psz = (char *) (*argv + (strlen (*argv) - 1));
while (*psz != '\\' && *psz != ':' && psz != *argv)
--psz;
if (psz == *argv)
{
strcpy (szSearchPath, ".");
strcpy (fileMask, *argv);
}
else
{
if (*psz == '\\')
{
*psz++ = '\0';
strcpy (fileMask, psz);
strcpy (szSearchPath, *argv);
}
else // The case when we have ':'
{
psz++;
strcpy (fileMask, psz);
*psz = '\0';
strcpy (szSearchPath, *argv);
}
}
}
else
{
strcpy (szSearchPath, ".");
strcpy (fileMask, *argv);
}
forAllMatch (obj, &nFiles, szSearchPath);
argv++;
}
if (! bBalance)
{
long ratio = 1000 * obj.getTotCommentLines() / obj.getTotLines();
printf (
"\n"
"Totals:\n"
"Files C++ cmts Cmt lin Cod lin Tot lin Cmt/Lin ratio\n"
"=========================================================\n"
"%5d %9lu %8lu %8lu %8lu %10ld.%ld %%\n",
nFiles,
obj.getTotCppComments(),
obj.getTotCommentLines(),
obj.getTotCodeLines(),
obj.getTotLines(),
ratio / 10,
ratio % 10
);
}
if (bHtml)
{
printf (
"\n"
"\n"
);
}
return 0;
}
========== CSplit: End file CMTCOUNT.CPP ==========
========== CSplit: Begin file CMTPARSR.CPP ==========
/*
* CMTPARSR.CPP
* Implementation of the comment parser.
*
* ver 1.0, 30 Jun 1996
*
* ver 1.1, 10 Dec 1996
* added logState(), changed init and unInit functions.
* bug: did not change itsState to NormalInput after NL in
* state StarInCppComment.
*
* ver 1.2, 28 Mar 1997
* Some method names changed.
*
* Public domain by:
* Jari Laaksonen
* Arkkitehdinkatu 30 A 2
* FIN-33720 Tampere
* FINLAND
*
* Fidonet : 2:221/360.20
* Internet: jla@to.icl.fi
*/
#include
#include "cmtparsr.h"
static char CannotOpen[] = "Cannot open %s for %sput\n\n";
/* CommentParser::init
* initialization function which takes the program's command line
* arguments and opens the input file and optionally the output file.
*/
int CommentParser::init (int argc, char **argv)
{
if (argc < 2)
{
return 0;
}
if (0 == init (argv[1]))
{
return 0;
}
if (argc == 3)
{
if (stricmp (argv[1], argv[2]) == 0)
{
// input and output files cannot be the same,
// output goes to stdout instead.
OutFile = stdout;
}
else
{
if ((OutFile = fopen (argv[2], "w")) == NULL)
{
fprintf (stderr, CannotOpen, argv[2], "out");
// if cannot open, output goes to stdout instead.
OutFile = stdout;
}
else
bOutFile = 1;
}
}
return 1;
========== CSplit: End part 9/16 crc: 6ffc ==========
// Albert email: jla@to.icl.fi
--- GoldED/2 2.50+
---------------
* Origin: Albert's Point/2 in Finland, Europe (2:221/360.20)
|