]> git.wh0rd.org - ICEs.git/blob - 571482/jsxml.ii.2
more
[ICEs.git] / 571482 / jsxml.ii.2
1 typedef long unsigned int size_t;
2 extern "C" {
3 extern "C" {
4 typedef union {
5 } pthread_barrierattr_t;
6 }} typedef long int ptrdiff_t;
7 typedef unsigned int uint32_t;
8 typedef unsigned long int uint64_t;
9 typedef uint32_t JSUint32;
10 typedef uint64_t JSUint64;
11 extern "C" {
12 typedef int JSIntn;
13 typedef unsigned int JSUintn;
14 typedef JSIntn JSBool;
15 typedef JSUint64 uint64;
16 typedef JSUint32 uint32;
17 } typedef JSUintn uintN;
18 extern "C" {
19 typedef struct {
20 } _IO_cookie_io_functions_t;
21 typedef struct JSString JSString;
22 typedef struct JSObject JSObject;
23 typedef union jsval_layout {
24 uint64 asBits;
25 } jsval_layout;
26 static
27 __attribute__ ((always_inline)) inline jsval_layout
28 STRING_TO_JSVAL_IMPL(JSString * str) {
29 } typedef __attribute__ ((aligned(8))) uint64 jsval;
30 typedef ptrdiff_t jsid;
31 typedef JSUint32 jsuint;
32 typedef enum JSType {
33 JSTYPE_VOID, JSTYPE_OBJECT, JSTYPE_FUNCTION, JSTYPE_STRING,
34 JSTYPE_NUMBER, JSTYPE_BOOLEAN, JSTYPE_NULL, JSTYPE_XML,
35 JSTYPE_LIMIT
36 } JSType;
37 typedef enum JSProtoKey {
38 JSProto_Null = 0, JSProto_Object = 1, JSProto_Function =
39 2, JSProto_Array = 3, JSProto_Boolean = 4, JSProto_JSON =
40 5, JSProto_Date = 6, JSProto_Math = 7, JSProto_Number =
41 8, JSProto_String = 9, JSProto_RegExp = 10, JSProto_XML =
42 11, JSProto_Namespace = 12, JSProto_QName =
43 13, JSProto_Reflect = 14, JSProto_ASTNode =
44 15, JSProto_Error = 16, JSProto_InternalError =
45 17, JSProto_EvalError = 18, JSProto_RangeError =
46 19, JSProto_ReferenceError = 20, JSProto_SyntaxError =
47 21, JSProto_TypeError = 22, JSProto_URIError =
48 23, JSProto_Generator = 24, JSProto_Iterator =
49 25, JSProto_StopIteration = 26, JSProto_ArrayBuffer =
50 27, JSProto_Int8Array = 28, JSProto_Uint8Array =
51 29, JSProto_Int16Array = 30, JSProto_Uint16Array =
52 31, JSProto_Int32Array = 32, JSProto_Uint32Array =
53 33, JSProto_Float32Array = 34, JSProto_Float64Array =
54 35, JSProto_Uint8ClampedArray = 36, JSProto_Proxy =
55 37, JSProto_AnyName = 38, JSProto_LIMIT
56 } JSProtoKey;
57 typedef enum JSAccessMode {
58 JSACC_PROTO = 0, JSACC_PARENT = 1, JSACC_WATCH = 3, JSACC_READ =
59 4, JSACC_WRITE = 8, JSACC_LIMIT
60 } JSIterateOp;
61 typedef struct JSContext JSContext;
62 typedef struct JSTracer JSTracer;
63 typedef struct JSXDRState JSXDRState;
64 typedef JSBool(*JSEnumerateOp) (JSContext * cx, JSObject * obj);
65 typedef JSBool(*JSResolveOp) (JSContext * cx, JSObject * obj, jsid id);
66 typedef void (*JSFinalizeOp) (JSContext * cx, JSObject * obj);
67 typedef JSBool(*JSXDRObjectOp) (JSXDRState * xdr, JSObject ** objp);
68 typedef uint32(*JSMarkOp) (JSContext * cx, JSObject * obj, void *arg);
69 static
70 __attribute__ ((always_inline)) inline JSBool JSID_IS_STRING(jsid
71 iden) {
72 }
73 static
74 __attribute__ ((always_inline)) inline JSString *JSID_TO_STRING(jsid
75 iden)
76 {
77 }
78 typedef void (*JSClassInternal) ();
79 extern
80 __attribute__ ((visibility("default"))) JSBool
81 JS_PropertyStub(JSContext * cx, JSObject * obj, jsid id,
82 jsval * vp);
83 extern
84 __attribute__ ((visibility("default"))) JSBool
85 JS_StrictPropertyStub(JSContext * cx, JSObject * obj, jsid id,
86 JSBool strict, jsval * vp);
87 extern
88 __attribute__ ((visibility("default"))) JSBool
89 JS_EnumerateStub(JSContext * cx, JSObject * obj);
90 extern
91 __attribute__ ((visibility("default"))) JSBool
92 JS_ResolveStub(JSContext * cx, JSObject * obj, jsid id);
93 extern
94 __attribute__ ((visibility("default"))) JSBool
95 JS_ConvertStub(JSContext * cx, JSObject * obj, JSType type,
96 jsval * vp);
97 extern
98 __attribute__ ((visibility("default"))) void
99 JS_FinalizeStub(JSContext * cx, JSObject * obj);
100 typedef struct JSProperty JSProperty;
101 typedef struct JSLinearString JSLinearString;
102 typedef JSObject *(*JSObjectOp) (JSContext * cx, JSObject * obj);
103 typedef JSObject *(*JSIteratorOp) (JSContext * cx, JSObject * obj,
104 JSBool keysonly);
105 }
106
107 namespace js {
108 class Value {
109 public:__attribute__ ((always_inline)) inline void setNull()
110 {
111 } __attribute__ ((always_inline)) inline void setString(JSString
112 * str) {
113 data = STRING_TO_JSVAL_IMPL(str);
114 } jsval_layout data;
115 }
116 __attribute__ ((aligned(8)));
117 static __attribute__ ((always_inline)) inline Value UndefinedValue() {
118 }
119 static
120 __attribute__ ((always_inline)) inline Value StringValue(JSString *
121 str) {
122 Value v;
123 v.setString(str);
124 return v;
125 }
126 static inline const jsval & Jsvalify(const Value & v) {
127 return (const jsval &)v;
128 }
129 static inline Value *Valueify(jsval * v) {
130 return (Value *) v;
131 }
132 typedef JSBool(*Native) (JSContext * cx, uintN argc, Value * vp);
133 typedef JSBool(*PropertyOp) (JSContext * cx, JSObject * obj, jsid id,
134 Value * vp);
135 typedef JSBool(*StrictPropertyOp) (JSContext * cx, JSObject * obj,
136 jsid id, JSBool strict, Value * vp);
137 typedef JSBool(*ConvertOp) (JSContext * cx, JSObject * obj, JSType type,
138 Value * vp);
139 typedef JSBool(*NewEnumerateOp) (JSContext * cx, JSObject * obj,
140 JSIterateOp enum_op, Value * statep,
141 jsid * idp);
142 typedef JSBool(*HasInstanceOp) (JSContext * cx, JSObject * obj,
143 const Value * v, JSBool * bp);
144 typedef JSBool(*CheckAccessOp) (JSContext * cx, JSObject * obj, jsid id,
145 JSAccessMode mode, Value * vp);
146 typedef JSBool(*EqualityOp) (JSContext * cx, JSObject * obj,
147 const Value * v, JSBool * bp);
148 typedef JSBool(*DefinePropOp) (JSContext * cx, JSObject * obj, jsid id,
149 const Value * value, PropertyOp getter,
150 StrictPropertyOp setter, uintN attrs);
151 typedef JSBool(*PropertyIdOp) (JSContext * cx, JSObject * obj,
152 JSObject * receiver, jsid id,
153 Value * vp);
154 typedef JSBool(*StrictPropertyIdOp) (JSContext * cx, JSObject * obj,
155 jsid id, Value * vp,
156 JSBool strict);
157 typedef JSBool(*DeleteIdOp) (JSContext * cx, JSObject * obj, jsid id,
158 Value * vp, JSBool strict);
159 typedef JSBool(*LookupPropOp) (JSContext * cx, JSObject * obj, jsid id,
160 JSObject ** objp, JSProperty ** propp);
161 typedef JSBool(*AttributesOp) (JSContext * cx, JSObject * obj, jsid id,
162 uintN * attrsp);
163 typedef JSType(*TypeOfOp) (JSContext * cx, JSObject * obj);
164 typedef void (*TraceOp) (JSTracer * trc, JSObject * obj);
165 typedef JSObject *(*ObjectOp) (JSContext * cx, JSObject * obj);
166 typedef void (*FinalizeOp) (JSContext * cx, JSObject * obj);
167 class AutoIdVector;
168 typedef JSBool(*FixOp) (JSContext * cx, JSObject * obj, bool * fixed,
169 AutoIdVector * props);
170 static const PropertyOp PropertyStub = (PropertyOp) JS_PropertyStub;
171 static const StrictPropertyOp StrictPropertyStub =
172 (StrictPropertyOp) JS_StrictPropertyStub;
173 static const JSEnumerateOp EnumerateStub = JS_EnumerateStub;
174 static const JSResolveOp ResolveStub = JS_ResolveStub;
175 static const ConvertOp ConvertStub = (ConvertOp) JS_ConvertStub;
176 static const JSFinalizeOp FinalizeStub = JS_FinalizeStub;
177 struct ClassExtension {
178 EqualityOp equality;
179 JSObjectOp outerObject;
180 JSObjectOp innerObject;
181 JSIteratorOp iteratorObject;
182 void *unused;
183 };
184 struct ObjectOps {
185 js::LookupPropOp lookupProperty;
186 js::DefinePropOp defineProperty;
187 js::PropertyIdOp getProperty;
188 js::StrictPropertyIdOp setProperty;
189 js::AttributesOp getAttributes;
190 js::AttributesOp setAttributes;
191 js::DeleteIdOp deleteProperty;
192 js::NewEnumerateOp enumerate;
193 js::TypeOfOp typeOf;
194 js::TraceOp trace;
195 js::FixOp fix;
196 js::ObjectOp thisObject;
197 js::FinalizeOp clear;
198 };
199 struct Class {
200 const char *name;
201 uint32 flags;
202 PropertyOp addProperty;
203 PropertyOp delProperty;
204 PropertyOp getProperty;
205 StrictPropertyOp setProperty;
206 JSEnumerateOp enumerate;
207 JSResolveOp resolve;
208 ConvertOp convert;
209 JSFinalizeOp finalize;
210 JSClassInternal reserved0;
211 CheckAccessOp checkAccess;
212 Native call;
213 Native construct;
214 JSXDRObjectOp xdrObject;
215 HasInstanceOp hasInstance;
216 JSMarkOp mark;
217 ClassExtension ext;
218 ObjectOps ops;
219 };
220 namespace gc {
221 struct Cell {
222 };
223 }} struct JSObject:js::gc::Cell {
224 js::Class * getClass() const {
225 } static const uint32 QNAME_CLASS_RESERVED_SLOTS = 3;
226 inline JSLinearString *getNamePrefix() const;
227 inline JSLinearString *getNameURI() const;
228 inline JSLinearString *getQNameLocalName() const;
229 };
230 namespace js {
231 static __attribute__ ((always_inline)) inline Value IdToValue(jsid id) {
232 if (JSID_IS_STRING(id))
233 return StringValue(JSID_TO_STRING(id));
234 } static __attribute__ ((always_inline)) inline jsval IdToJsval(jsid id) {
235 return Jsvalify(IdToValue(id));
236 }
237 }
238
239 extern const char js_XML_str[];
240 extern const char js_AnyName_str[];
241 inline JSBool js_IdIsIndex(jsid id, jsuint * indexp)
242 {
243 }
244
245 namespace js {
246 class AutoGCRooter;
247 } struct JSContext {
248 js::AutoGCRooter * autoGCRooters;
249 };
250 namespace js {
251 class AutoGCRooter {
252 public:AutoGCRooter(JSContext * cx,
253 ptrdiff_t tag):down(cx->autoGCRooters), tag(tag),
254 context(cx) {
255 cx->autoGCRooters = this;
256 } protected:AutoGCRooter * const down;
257 ptrdiff_t tag;
258 JSContext *const context;
259 };
260 class AutoArrayRooter:private AutoGCRooter {
261 public:AutoArrayRooter(JSContext * cx, size_t len,
262 Value * vec):AutoGCRooter(cx, len),
263 array(vec) {
264 } Value *array;
265 private:};
266 }
267
268 struct JSXMLArray {
269 };
270 struct JSXMLArrayCursor {
271 };
272 typedef enum JSXMLClass {
273 JSXML_CLASS_LIST, JSXML_CLASS_ELEMENT, JSXML_CLASS_ATTRIBUTE,
274 JSXML_CLASS_PROCESSING_INSTRUCTION, JSXML_CLASS_TEXT,
275 JSXML_CLASS_COMMENT, JSXML_CLASS_LIMIT
276 } JSXMLElemVar;
277 struct JSXML:js::gc::Cell {
278 uint32 xml_class;
279 };
280 namespace js {
281 } using namespace js;
282 __attribute__ ((visibility("default")))
283 Class js_AttributeNameClass = {
284 js_AnyName_str,
285 (1 << 6) |
286 (((JSObject::QNAME_CLASS_RESERVED_SLOTS) & (((JSUint32) 1 << (8)) -
287 1)) << 8) | (1 << ((8 +
288 8) +
289 3)) |
290 (1 << ((8 + 8) + 1)), PropertyStub, PropertyStub, PropertyStub,
291 StrictPropertyStub, EnumerateStub, ResolveStub, ConvertStub,
292 FinalizeStub
293 };
294
295 static JSObject *NewXMLAttributeName(JSContext * cx, JSLinearString * uri,
296 JSLinearString * prefix,
297 JSLinearString * localName)
298 {
299 }
300
301 static JSBool GetXMLSettingFlags(JSContext * cx, uintN * flagsp)
302 {
303 JSBool flag[4];
304 for (size_t n = 0; n < 4; ++n)
305 if (flag[n])
306 *flagsp |= ((JSUint32) 1 << (n));
307 }
308
309 static JSBool PutProperty(JSContext * cx, JSObject * obj, jsid id,
310 JSBool strict, jsval * vp)
311 {
312 enum {
313 OBJ_ROOT, ID_ROOT, VAL_ROOT
314 };
315 JSXML *xml, *vxml, *rxml, *kid, *attr, *parent, *copy, *kid2, *match;
316 JSObject *vobj, *nameobj, *attrobj, *parentobj, *kidobj, *copyobj;
317 uint32 index, i, j, k, n, q, matchIndex;
318 jsval roots[3];
319 roots[ID_ROOT] = IdToJsval(id);
320 roots[VAL_ROOT] = *vp;
321 AutoArrayRooter tvr(cx, (sizeof(roots) / sizeof(roots)[0]),
322 Valueify(roots));
323 if (js_IdIsIndex(id, &index)) {
324 if (kid->xml_class == JSXML_CLASS_ATTRIBUTE) {
325 if (nameobj->getClass() != &js_AttributeNameClass) {
326 nameobj =
327 NewXMLAttributeName(cx,
328 nameobj->getNameURI(),
329 nameobj->
330 getNamePrefix(),
331 nameobj->
332 getQNameLocalName());
333 }
334 }
335 }
336 }
337
338 static void xml_finalize(JSContext * cx, JSObject * obj)
339 {
340 }
341
342 static JSBool xml_lookupProperty(JSContext * cx, JSObject * obj, jsid id,
343 JSObject ** objp, JSProperty ** propp)
344 {
345 }
346
347 static JSBool xml_defineProperty(JSContext * cx, JSObject * obj, jsid id,
348 const Value * v, PropertyOp getter,
349 StrictPropertyOp setter, uintN attrs)
350 {
351 jsval tmp = Jsvalify(*v);
352 return PutProperty(cx, obj, id, false, &tmp);
353 }
354
355 static JSBool xml_getProperty(JSContext * cx, JSObject * obj,
356 JSObject * receiver, jsid id, Value * vp)
357 {
358 }
359
360 static JSBool xml_setProperty(JSContext * cx, JSObject * obj, jsid id,
361 Value * vp, JSBool strict)
362 {
363 }
364
365 static JSBool xml_getAttributes(JSContext * cx, JSObject * obj, jsid id,
366 uintN * attrsp)
367 {
368 }
369
370 static JSBool xml_setAttributes(JSContext * cx, JSObject * obj, jsid id,
371 uintN * attrsp)
372 {
373 }
374
375 static JSBool xml_deleteProperty(JSContext * cx, JSObject * obj, jsid id,
376 Value * rval, JSBool strict)
377 {
378 }
379
380 JSBool xml_convert(JSContext * cx, JSObject * obj, JSType type, Value * rval)
381 {
382 }
383
384 static JSBool xml_enumerate(JSContext * cx, JSObject * obj, JSIterateOp enum_op,
385 Value * statep, jsid * idp)
386 {
387 }
388
389 static JSType xml_typeOf(JSContext * cx, JSObject * obj)
390 {
391 }
392
393 static JSBool xml_hasInstance(JSContext * cx, JSObject * obj, const Value *,
394 JSBool * bp)
395 {
396 }
397
398 static void xml_trace(JSTracer * trc, JSObject * obj)
399 {
400 }
401
402 static JSBool xml_fix(JSContext * cx, JSObject * obj, bool * success,
403 AutoIdVector * props)
404 {
405 }
406
407 static void xml_clear(JSContext * cx, JSObject * obj)
408 {
409 }
410
411 __attribute__ ((visibility("default")))
412 Class js_XMLClass = {
413 js_XML_str,
414 (1 << 0) | (1 << ((8 + 8) + 3)) | ((JSProto_XML) << ((8 + 8) + 8)),
415 PropertyStub, PropertyStub, PropertyStub, StrictPropertyStub,
416 EnumerateStub, ResolveStub, xml_convert, xml_finalize, __null,
417 __null, __null, __null, __null, xml_hasInstance,
418 ((JSMarkOp) (xml_trace)), {
419 __null, __null, __null, __null, __null}
420 , {
421 xml_lookupProperty, xml_defineProperty, xml_getProperty,
422 xml_setProperty, xml_getAttributes, xml_setAttributes,
423 xml_deleteProperty, xml_enumerate, xml_typeOf, __null, xml_fix,
424 __null, xml_clear}
425 };