Latest versions of this class can always be found at
http://josefine.ben.tuwien.ac.at/~mfischer/developing/php/rtf/rtfclass.phps
Testing suite is available at
http://josefine.ben.tuwien.ac.at/~mfischer/developing/php/rtf/

// the only variable which should be accessed from the outside
var $out; // output data stream (depends on which $wantXXXXX is set to true
var $outstyles; // htmlified styles (generated after parsing if wantHTML
var $styles; // if wantHTML, stylesheet definitions are put in here

// internal parser variables --------------------------------
// control word variables
var $cword; // holds the current (or last) control word, depending on $cw
var $cw; // are we currently parsing a control word ?
var $cfirst; // could this be the first character ? so watch out for control symbols

var $flags = array(); // parser flags

var $queue; // every character which is no sepcial char, not belongs to a control word/symbol; is generally considered being 'plain'

$this->flags["fonttbl_current_write"] = ""; // on group close, no more fontdefinition will be written to this id
// this is not really the right way to do it !
// of course a '}' not necessarily donates a fonttable end; a fonttable
// group at least *can* contain sub-groups
// therefore an stacked approach is heavily needed
$this->flags["fonttbl"] = false; // no matter what you do, if a group closes, its fonttbl definition is closed too

How this parser (is supposed) to work:
======================================
This parse simple starts at the beginning of the rtf core stream, catches every
controlling character {,} and \, automatically builds control words and control
symbols during his livetime, trashes every other character into the plain text
queue
*/
function parse() {

$this->parserInit();

$i = 0;
$this->cw= false; // flag if control word is currently parsed
$this->cfirst = false;// first control character ?
$this->cword = ""; // last or current control word ( depends on $this->cw