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

========== CSplit: Version 2.0 ==========
========== CSplit: Begin part 5/16 ==========
            else
                SlashPrinted = 0;
            break;
        case FOUND_BACKSLASH:           // Escaped character.
            backsl = 1;
            rc = 0;
            break;
        default:                        // No, just a slash...
            print ('/');                // Print the previous slash.
            if (backsl)
            {
                print ('\\');           // Print the previous backslash.
                backsl = 0;
            }
            if (nl)
            {
                print ('\n');           // Print the previous newline.
                nl = 0;
            }
            break;
        }
        break;
    case StarInCComment:
        switch (theEvent)
        {
        case FOUND_SLASH:               // End of C comment.
            checkHtmlChar();
            rc = 0;
            print ("");
            SlashPrinted = 0;           // End of comment, clear flag.
            break;
        }
        break;
    case StarInCppComment:
        if (theEvent == FOUND_NL)
        {
            SlashPrinted = 0;           // End of comment, clear flag.
        }
        break;
    case InCppComment:
        if (theEvent == FOUND_NL)
        {
            print ("");
            SlashPrinted = 0;           // End of comment, clear flag.
        }
        break;
    }
    if (rc)
        checkHtmlChar();
}
int   main (int argc, char **argv)
{
    C2Html obj;
    if (0 == obj.init (argc, argv))
    {
        fprintf (stderr, "USAGE: C2HTML InFile [OutFile]\n");
    }
    else
    {
        struct tm   *tm;
        time_t      timer;
        timer = time(NULL);
        tm = localtime(&timer);
        char str[256];
        // print some header information first.
        sprintf (str,
            "\n"
            "\n"
            "Source file: %s \n"
            "\n"
            ,
            STR_VERSION,
            tm->tm_mday, tm->tm_mon + 1, 1900 + tm->tm_year,
            tm->tm_hour, tm->tm_min,
            argv[1]
        );
        obj.print (str);
        obj.run();
        obj.print (
            "\n"
            "\n"
        );
        obj.unInit();
        fprintf (stderr, "\nOK! %lu lines processed. Last state = %d\n",
            obj.getLines(), obj.getLastState()
        );
    }
    return 0;
}
========== CSplit: End file C2HTML.CPP ==========
========== CSplit: Begin file CMTCONVR.CPP ==========
/*
 * CMTCONVR.CPP
 * Implementation of comment converter.
 *
 * ver 1.0, 30 Jun 1996
 *
 * ver 1.1, 28 Mar 1997
 *   bug: did not add ending " x/" after NL in state StarInCppComment.
 *   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 "cmtconvr.h"
void CommentConverter::processActions (Event theEvent)
{
    switch (itsState)
    {
    case BeginComment:
        if (theEvent == FOUND_SLASH)    // Yes, it's a C++ comment...
        {
            changeChar ('*');           // ...change to C-style.
        }
        break;
    case InCppComment:
        switch (theEvent)
        {
========== CSplit: End part 5/16 crc: 110d ==========
        // 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™.