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: 01/16 Comment utilities

========== CSplit: Version 2.0 ==========
========== CSplit: Begin part 1/16 ==========
========== CSplit: Begin file CMTCONVR.TXT ==========
This is the new release of my comment utilities, a C version of which was
already in a previous SNIPPETS release. There is not much documentation
-- I hope the code speaks for itself.
The "heart" of the program is implemented as a finite state machine which
parses the source files and also is an abstract base class for all the
utilities.
There are five utilities:
  CMTCONVR - comment converter: converts C++ comments to C comments.
  CMTCOUNT - comment counter: checks the balance of /* */ and counts
             code lines, commented lines and comment ratio.
  CMTREMOV - comment remover: removes comments from a source file
             (output file contains plain code)
  CMTXTRAC - comment extractor: extracts comments from source file
             (output file contains all comments)
  C2HTML   - C/C++ to HTML: creates a HTML file from C/C++ source
             file. Code is formatted as bold, and comments are in
             italics.
The package contains also a test file, CMTTESTS.C which has a bunch of
different styles of commenting -- some of which are quite perverse :-)
As a bonus there are also Java versions of the same utilities. See how
easy it is to translate your programs to Java when your objects are
carefully designed :-)
        // Albert                      email: jla@to.icl.fi
========== CSplit: End file CMTCONVR.TXT ==========
========== CSplit: Begin file C2HTML.H ==========
/*
 * C2HTML.H
 * C/C++ to HTML converter class.
 *
 * ver 1.0, 28 Mar 1997
 *
 * Public domain by:
 *   Jari Laaksonen
 *   Arkkitehdinkatu 30 A 2
 *   FIN-33720 Tampere
 *   FINLAND
 *
 *   Fidonet : 2:221/360.20
 *   Internet: jla@to.icl.fi
 */
#ifndef _C2HTML_H_
#define _C2HTML_H_
#include "cmtparsr.h"
class C2Html : public CommentParser
{
public:
protected:
    virtual void processActions (Event theEvent);
private:
    void checkHtmlChar();
};
#endif // _C2HTML_H_
========== CSplit: End file C2HTML.H ==========
========== CSplit: Begin file CMTCONVR.H ==========
/*
 * CMTCONVR.H
 * Comment converter class.
 *
 * ver 1.0, 30 Jun 1996
 *
 * ver 1.1, 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
 */
#ifndef _CMTCONVR_H_
#define _CMTCONVR_H_
#include "cmtparsr.h"
class CommentConverter : public CommentParser
{
public:
protected:
    virtual void processActions (Event theEvent);
};
#endif // _CMTCONVR_H_
========== CSplit: End file CMTCONVR.H ==========
========== CSplit: Begin file CMTCOUNT.H ==========
/*
 * CMTCOUNT.H
 * Comment counter class.
 *
 * ver 1.0, 30 Jun 1996
 *
 * ver 1.1, 10 Jul 1996
 *   added code lines count, total counts.
 *
 * 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
 */
#ifndef _CMTCOUNT_H_
#define _CMTCOUNT_H_
#include "cmtparsr.h"
class CommentCounter : public CommentParser
{
public:
    CommentCounter()
        : CommentParser()
        , tot_cpp_comments(0)
        , tot_cmt_lines(0)
        , tot_lines(0)
        , tot_code_lines(0)
    {
        reset();
    }
========== CSplit: End part 1/16 crc: c929 ==========
        // 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™.