Disable all code related to libXp
[oweals/cde.git] / cde / programs / dtinfo / DtMmdb / StyleSheet / testparser.C
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
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)
10  * any later version.
11  *
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
16  * details.
17  *
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
22  */
23 // $XConsortium: testparser.C /main/4 1996/08/21 15:51:08 drk $
24
25 #include "PathTable.h"
26 #include "Debug.h"
27 #include "Const.h"
28 #include "StyleSheetExceptions.h"
29 #include "VariableTable.h"
30 #include "StyleSheet.h"
31 #include "Resolver.h"
32
33 Renderer* gRenderer = 0;
34       
35 extern int styleparse();
36 extern int stylerestart(FILE*);
37 extern FILE *stylein;
38
39 test1()
40 {
41    BitVector v1(33, 0);
42    v1.setBitTo(0, 1);
43    v1.setBitTo(1, 1);
44    v1.setBitTo(5, 1);
45    v1.setBitTo(32, 1);
46    debug(cerr, v1);
47    v1.shiftRightOneBit();
48
49    BitVector v2(33, 0);
50    v2.setBitTo(3, 1);
51    debug(cerr, v2);
52   
53    MESSAGE(cerr, "v2 | v1");
54    v2 |= v1;
55    debug(cerr, v2);
56   
57    BitVector v3(33, 0);
58    v3.setBitTo(8, 1);
59    debug(cerr, v3);
60    v3 &= v1;
61    MESSAGE(cerr, "v3 & v1");
62    debug(cerr, v3);
63   
64    BitVector v4(33, 0);
65    v4.setBitTo(1, 1);
66    v4.setBitTo(8, 1);
67    debug(cerr, v4);
68    v4 ^= v1;
69    MESSAGE(cerr, "v4 ^ v1");
70    debug(cerr, v4);
71 }
72
73
74 test2( char* argv[] )
75 {
76    SSPath t(argv[1], false);
77
78    SSPath p(argv[2], true);
79
80
81    EncodedPath et(&t);
82    EncodedPath ep(&p, true);
83
84    debug(cerr, ep.match(et, 0, 0));
85 }
86
87 test3( int argc, char* argv[] )
88 {
89 /*
90    PathTable pt;
91    SSPath *px;
92
93    for ( int i=1; i<argc-1; i++ ) {
94        px = new SSPath(argv[i], (FeatureSet*)i);
95        pt.addPathFeatureSet(px);
96    }
97
98
99    SSPath pq(argv[argc-2], false);
100
101    debug(cerr, int(pt.getFeatureSet(pq)));
102 */
103 }
104
105 test4( int argc, char* argv[] )
106 {
107    if ( argc >= 2 ) {
108       stylein = fopen(argv[1], "r");
109       if ( stylein == 0 ) {
110          MESSAGE(cerr, "open file failed");
111          return 1;
112       }
113       styleparse();
114
115       debug(cerr, *gVariableTable);
116
117       debug(cerr, *gPathTab);
118
119       fclose(stylein);
120    } else
121       MESSAGE(cerr, "no file argument");
122 }
123
124 struct XmappingTable_t {
125    char* FeatureName;
126    char* SubFeatureNameList;
127    char  Value; // d: directly from the value()
128                 // i: indrectly from the value()
129    char* Source; // l: local FeatureSet
130                  // p: parent FeatureSet
131                  // c: Combined FeatureSet
132                  // can be a list of l, p, c
133    char* LoutBeginTag;
134 };
135
136 main( int argc, char* argv[] )
137 {
138
139    INIT_EXCEPTIONS();
140
141    StyleSheet ss;
142
143    if ( strcmp(argv[1], "test1") == 0 )
144      test1;
145    else
146    if ( strcmp(argv[1], "test2") == 0 )
147      test2(&argv[1]);
148    else
149    if ( strcmp(argv[1], "test3") == 0 )
150      test3(argc-1, &argv[1]);
151    else
152    if ( strcmp(argv[1], "test4") == 0 )
153      test4(argc-1, &argv[1]);
154 }
155
156 void styleerror( char* errorstr )
157 {
158    MESSAGE(cerr, errorstr);
159    return;
160 }
161