TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ALL
from: JARI LAAKSONEN
date: 1997-03-28 21:57:00
subject: 06/16 Comment utilities

========== CSplit: Version 2.0 ==========
========== CSplit: Begin part 6/16 ==========
        case END_OF_FILE:           // EOF: if we are still in C++ \
\
comment
        case FOUND_NL:              // End of C++ comment...
            print (" */");          // ...put ending C-comment mark.
            break;
        }
        break;
    case StarInCppComment:
        switch (theEvent)
        {
        // End of C comment -- add space to prevent nested C comment.
        // For example: "// /*comment*/"
        //     becomes: "/* /*comment* / */"
        case FOUND_SLASH:
            print (' ');
            break;
        case FOUND_NL:              // End of C++ comment...
            print (" */");          // ...put ending C-comment mark.
            break;
        }
        break;
    }
    printChar();
}
int   main (int argc, char **argv)
{
    CommentConverter obj;
    if (0 == obj.init (argc, argv))
    {
        fprintf (stderr, "USAGE: CMTCONVR InFile [OutFile]\n");
    }
    else
    {
        obj.run();
        obj.unInit();
    }
    return 0;
}
========== CSplit: End file CMTCONVR.CPP ==========
========== CSplit: Begin file CMTCOUNT.CPP ==========
/*
 * CMTCOUNT.CPP
 * Implementation of comment counter.
 *
 * ver 1.0, 30 Jun 1996
 *
 * ver 1.1, 10 Jul 1996
 *   added code lines count, total counts,
 *   changed cmd line arg handling.
 *
 * ver 1.2, 10 Dec 1996
 *   added subdirectory recursion.
 *
 * ver 1.3, 28 Mar 1997
 *   C++ comment count changed to unsigned long.
 *   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 
#include 
#ifdef __OS2__
#define  INCL_NOPMAPI
#define  INCL_DOS
#define  INCL_DOSERRORS
#include 
#if defined (__WATCOMC__) && defined (__386__)
#ifndef __32BIT__
#define __32BIT__
#endif
#endif
#endif
#include "ffbuff.h"
#include "cmtcount.h"
static const char * const STR_VERSION = "1.3";
static char fileMask[255];
static int  bSubdirs = 0;
static int  bBalance = 0;
static int  bTotalsOnly = 0;
static int  bHtml = 0;
void CommentCounter::reset()
{
    code_lines =
    cmt_lines = 0L;
    cpp_comments =
    open_comment =
    close_comment = 0;
}
void CommentCounter::sumTotals()
{
    tot_cpp_comments += cpp_comments;
    tot_cmt_lines    += cmt_lines;
    tot_lines        += getLines();
    tot_code_lines   += code_lines;
}
void CommentCounter::processActions (Event theEvent)
{
    static int c = 0;
    if (theEvent == FOUND_NL)
    {
        switch (itsState)
        {
        case BeginComment:
            code_lines++;
            break;
        case InCppComment:
            if (c)
                code_lines++;
            break;
        case InCComment:
        case StarInCComment:
            break;
        case InsideEscape:
            if (itsPrevState == InCppComment)
                cmt_lines++;
            if (itsPrevState == InCppComment
========== CSplit: End part 6/16 crc: b429 ==========
        // Albert                      email: jla@to.icl.fi
--- GoldED/2 2.50+
---------------
* Origin: Albert's Point/2 in Finland, Europe (2:221/360.20)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.