Re: C++

"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