W3C home > Mailing lists > Public > html-tidy@w3.org > October to December 2001

Re: C++

From: Lee Passey <lee@novonyx.com>
Date: Tue, 02 Oct 2001 12:34:16 -0600
Message-ID: <3BBA08A8.F8EF9B1F@novonyx.com>
To: "html-tidy@w3.org" <html-tidy@w3.org>

"Rick Cameron" wrote:

> Hi, Lee
> Did you create C++ classes, or did you just get the source to compile as
> C++?
I actually created C++ classes.  Interestingly, with all the structure
pointers being passed around, it almost looked like tidy was originally
written in C++ and then back-ported to C.  In my first cut, some of the
fundamental classes are Node, Attibute, AttVal (attribute/value pairs),
Tag, Lexer, Style, and StreamIn/StreamOut.

> If classes, did you manage to eliminate all globals, so the classes can be
> used in a multithreaded environment? Did you separate out the parsing code
> so it can be used independently?

The global variable question is an interesting one; I made some changes
to global variables, but I was not thinking about multi-threading at the
time.  As near as I can tell, there are two types of global variables in
tidy: configuration boolean flags and default values (generally declared
in config.c), and dictionary tables such as Tag and Attribute. 
Configuration variables are altered from their default values by command
line options or by parsing a config file.  This code I have not yet
touched.  Other global tables were initialized by explicit "init" calls
(e.g., InitAttrs, InitTags).  For these types of variables I created a
class with a single global instance whose only role was to initialize
static variables in the corresponding class (e.g. Attribute, Tag). 
Thus, construction and destruction of these global variables occurs
automatically when the program begins (before main() is called) or ends,
and then only once.  Whether or not these changes satisfies the demands
of a multi-threaded application or not is still an open question. 
Perhaps you can help me out there.

As stated in an earlier message, my goal is to segregate the code (to
the extent possible) into parsing, cleaning, and printing (or output)
parts.  This first pass did that to some extent, but much more detailed
analysis will be required before I am comfortable claiming that the goal
has been acheived.
> If the answer to all these questions is 'yes', I'd be very interested!
> Thanks
> - rick cameron
> -----Original Message-----
> From: Lee Passey [mailto:lee@novonyx.com]
> Sent: Thu, 27 September 2001 7:59
> To: html-tidy@w3.org
> Subject: C++
> I have recently successfully completed a conversion of tidy to C++.  Is
> anyone interested?
Received on Tuesday, 2 October 2001 14:31:01 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:51 UTC