2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 // $XConsortium: docparser.C /main/4 1996/08/21 15:51:05 drk $
25 #include "DocParser.h"
27 #include "PathTable.h"
30 #include "StyleSheet.h"
31 #include "StyleSheetExceptions.h"
32 #include "VariableTable.h"
36 Renderer *gRenderer = 0;
37 class TestRenderer : public Renderer
46 FeatureSet *initialize();
47 unsigned int BeginElement(const Element &element,
48 const FeatureSet &featureset,
49 const FeatureSet &complete,
50 const FeatureSet &parentComplete);
52 void data(const char *data, unsigned int size);
54 void EndElement(const Symbol &element_name);
58 TestRenderer::initialize()
60 return new FeatureSet;
63 TestRenderer::BeginElement(const Element &element,
64 const FeatureSet &localset,
65 const FeatureSet &complete,
66 const FeatureSet &/* parentComplete */)
68 ON_DEBUG(cerr << "TestRenderer::BeginElement()" << endl);
70 ON_DEBUG(cerr << localset<< endl);
71 ON_DEBUG(cerr << complete << endl);
73 if (localset.lookup(gSymTab->intern("ignore")))
76 cout << element << endl;
78 return 0 ; // do not ignore
81 TestRenderer::data(const char * data, unsigned int /* size */)
83 ON_DEBUG(cerr << "TestRenderer::data()" << endl);
87 TestRenderer::EndElement(const Symbol &name)
89 ON_DEBUG(cerr << "TestRenderer::EndElement(" << name << ')' << endl);
90 cout << "</" << name << '>';
93 styleerror(char *errorstr)
98 // extern FILE *stylein;
99 extern int styleparse();
101 extern PathTable *gPathTab;
102 extern VariableTable *gVariableTable ;
104 extern istream *g_stylein;
106 main(int argc, char **argv)
112 ifstream stylestream(argv[1]);
113 g_stylein = &stylestream;
114 g_stylein->unsetf(ios::skipws);
119 TestRenderer renderer ;
120 Resolver resolver(*gPathTab, renderer);
121 DocParser docparser(resolver);
122 docparser.parse(cin);
126 cerr << "docparser.C: exception thrown" << endl;