]> git.wh0rd.org - ICEs.git/blame - 571482/jsxml.ii.3
more
[ICEs.git] / 571482 / jsxml.ii.3
CommitLineData
bd3239d2
MF
1typedef long unsigned int size_t;
2 typedef union {
3 } pthread_barrierattr_t;
4typedef long int ptrdiff_t;
5typedef unsigned int uint32_t;
6typedef unsigned long int uint64_t;
7typedef uint32_t JSUint32;
8typedef uint64_t JSUint64;
9 typedef int JSIntn;
10 typedef unsigned int JSUintn;
11 typedef JSIntn JSBool;
12 typedef JSUint64 uint64;
13 typedef JSUint32 uint32;
14typedef JSUintn uintN;
15extern "C" {
16 typedef struct {
17 } _IO_cookie_io_functions_t;
18 typedef struct JSString JSString;
19 typedef struct JSObject JSObject;
20 typedef union jsval_layout {
21 uint64 asBits;
22 } jsval_layout;
23 static
24jsval_layout
25 STRING_TO_JSVAL_IMPL(JSString * str) {
26 } typedef __attribute__ ((aligned(8))) uint64 jsval;
27 typedef ptrdiff_t jsid;
28 typedef JSUint32 jsuint;
29 typedef enum JSType {
30 JSTYPE_VOID, JSTYPE_OBJECT, JSTYPE_FUNCTION, JSTYPE_STRING,
31 JSTYPE_NUMBER, JSTYPE_BOOLEAN, JSTYPE_NULL, JSTYPE_XML,
32 JSTYPE_LIMIT
33 } JSType;
34 typedef enum JSProtoKey {
35 JSProto_Null = 0, JSProto_Object = 1, JSProto_Function =
36 2, JSProto_Array = 3, JSProto_Boolean = 4, JSProto_JSON =
37 5, JSProto_Date = 6, JSProto_Math = 7, JSProto_Number =
38 8, JSProto_String = 9, JSProto_RegExp = 10, JSProto_XML =
39 11, JSProto_Namespace = 12, JSProto_QName =
40 13, JSProto_Reflect = 14, JSProto_ASTNode =
41 15, JSProto_Error = 16, JSProto_InternalError =
42 17, JSProto_EvalError = 18, JSProto_RangeError =
43 19, JSProto_ReferenceError = 20, JSProto_SyntaxError =
44 21, JSProto_TypeError = 22, JSProto_URIError =
45 23, JSProto_Generator = 24, JSProto_Iterator =
46 25, JSProto_StopIteration = 26, JSProto_ArrayBuffer =
47 27, JSProto_Int8Array = 28, JSProto_Uint8Array =
48 29, JSProto_Int16Array = 30, JSProto_Uint16Array =
49 31, JSProto_Int32Array = 32, JSProto_Uint32Array =
50 33, JSProto_Float32Array = 34, JSProto_Float64Array =
51 35, JSProto_Uint8ClampedArray = 36, JSProto_Proxy =
52 37, JSProto_AnyName = 38, JSProto_LIMIT
53 } JSProtoKey;
54 typedef enum JSAccessMode {
55 JSACC_PROTO = 0, JSACC_PARENT = 1, JSACC_WATCH = 3, JSACC_READ =
56 4, JSACC_WRITE = 8, JSACC_LIMIT
57 } JSIterateOp;
58 typedef struct JSContext JSContext;
59 typedef struct JSTracer JSTracer;
60 typedef struct JSXDRState JSXDRState;
61 typedef JSBool(*JSEnumerateOp) (JSContext * cx, JSObject * obj);
62 typedef JSBool(*JSResolveOp) (JSContext * cx, JSObject * obj, jsid id);
63 typedef void (*JSFinalizeOp) (JSContext * cx, JSObject * obj);
64 typedef JSBool(*JSXDRObjectOp) (JSXDRState * xdr, JSObject ** objp);
65 typedef uint32(*JSMarkOp) (JSContext * cx, JSObject * obj, void *arg);
66 static
67JSBool JSID_IS_STRING(jsid
68 iden) {
69 }
70 static
71JSString *JSID_TO_STRING(jsid
72 iden)
73 {
74 }
75 typedef void (*JSClassInternal) ();
76 extern
77JSBool
78 JS_PropertyStub(JSContext * cx, JSObject * obj, jsid id,
79 jsval * vp);
80 extern
81JSBool
82 JS_StrictPropertyStub(JSContext * cx, JSObject * obj, jsid id,
83 JSBool strict, jsval * vp);
84 extern
85JSBool
86 JS_EnumerateStub(JSContext * cx, JSObject * obj);
87 extern
88JSBool
89 JS_ResolveStub(JSContext * cx, JSObject * obj, jsid id);
90 extern
91JSBool
92 JS_ConvertStub(JSContext * cx, JSObject * obj, JSType type,
93 jsval * vp);
94 extern
95void
96 JS_FinalizeStub(JSContext * cx, JSObject * obj);
97 typedef struct JSProperty JSProperty;
98 typedef struct JSLinearString JSLinearString;
99 typedef JSObject *(*JSObjectOp) (JSContext * cx, JSObject * obj);
100 typedef JSObject *(*JSIteratorOp) (JSContext * cx, JSObject * obj,
101 JSBool keysonly);
102}
103
104namespace js {
105 class Value {
106 public:
107void setNull()
108 {
109 }
110void setString(JSString
111 * str) {
112 data = STRING_TO_JSVAL_IMPL(str);
113 } jsval_layout data;
114 }
115 __attribute__ ((aligned(8)));
116 static
117Value UndefinedValue() {
118 }
119 static
120Value 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};
230namespace js {
231 static
232Value IdToValue(jsid id) {
233 if (JSID_IS_STRING(id))
234 return StringValue(JSID_TO_STRING(id));
235 } static
236jsval IdToJsval(jsid id) {
237 return Jsvalify(IdToValue(id));
238 }
239}
240
241extern const char js_XML_str[];
242extern const char js_AnyName_str[];
243inline JSBool js_IdIsIndex(jsid id, jsuint * indexp)
244{
245}
246
247namespace js {
248 class AutoGCRooter;
249} struct JSContext {
250 js::AutoGCRooter * autoGCRooters;
251};
252namespace js {
253 class AutoGCRooter {
254 public:AutoGCRooter(JSContext * cx,
255 ptrdiff_t tag):down(cx->autoGCRooters), tag(tag),
256 context(cx) {
257 cx->autoGCRooters = this;
258 } protected:AutoGCRooter * const down;
259 ptrdiff_t tag;
260 JSContext *const context;
261 };
262 class AutoArrayRooter:private AutoGCRooter {
263 public:AutoArrayRooter(JSContext * cx, size_t len,
264 Value * vec):AutoGCRooter(cx, len),
265 array(vec) {
266 } Value *array;
267 private:};
268}
269
270struct JSXMLArray {
271};
272struct JSXMLArrayCursor {
273};
274typedef enum JSXMLClass {
275 JSXML_CLASS_LIST, JSXML_CLASS_ELEMENT, JSXML_CLASS_ATTRIBUTE,
276 JSXML_CLASS_PROCESSING_INSTRUCTION, JSXML_CLASS_TEXT,
277 JSXML_CLASS_COMMENT, JSXML_CLASS_LIMIT
278} JSXMLElemVar;
279struct JSXML:js::gc::Cell {
280 uint32 xml_class;
281};
282namespace js {
283} using namespace js;
284Class js_AttributeNameClass = {
285 js_AnyName_str,
286 (1 << 6) |
287 (((JSObject::QNAME_CLASS_RESERVED_SLOTS) & (((JSUint32) 1 << (8)) -
288 1)) << 8) | (1 << ((8 +
289 8) +
290 3)) |
291 (1 << ((8 + 8) + 1)), PropertyStub, PropertyStub, PropertyStub,
292 StrictPropertyStub, EnumerateStub, ResolveStub, ConvertStub,
293 FinalizeStub
294};
295
296static JSObject *NewXMLAttributeName(JSContext * cx, JSLinearString * uri,
297 JSLinearString * prefix,
298 JSLinearString * localName)
299{
300}
301
302static JSBool GetXMLSettingFlags(JSContext * cx, uintN * flagsp)
303{
304 JSBool flag[4];
305 for (size_t n = 0; n < 4; ++n)
306 if (flag[n])
307 *flagsp |= ((JSUint32) 1 << (n));
308}
309
310static JSBool PutProperty(JSContext * cx, JSObject * obj, jsid id,
311 JSBool strict, jsval * vp)
312{
313 enum {
314 OBJ_ROOT, ID_ROOT, VAL_ROOT
315 };
316 JSXML *xml, *vxml, *rxml, *kid, *attr, *parent, *copy, *kid2, *match;
317 JSObject *vobj, *nameobj, *attrobj, *parentobj, *kidobj, *copyobj;
318 uint32 index, i, j, k, n, q, matchIndex;
319 jsval roots[3];
320 roots[ID_ROOT] = IdToJsval(id);
321 roots[VAL_ROOT] = *vp;
322 AutoArrayRooter tvr(cx, (sizeof(roots) / sizeof(roots)[0]),
323 Valueify(roots));
324 if (js_IdIsIndex(id, &index)) {
325 if (kid->xml_class == JSXML_CLASS_ATTRIBUTE) {
326 if (nameobj->getClass() != &js_AttributeNameClass) {
327 nameobj =
328 NewXMLAttributeName(cx,
329 nameobj->getNameURI(),
330 nameobj->
331 getNamePrefix(),
332 nameobj->
333 getQNameLocalName());
334 }
335 }
336 }
337}
338
339static void xml_finalize(JSContext * cx, JSObject * obj)
340{
341}
342
343static JSBool xml_lookupProperty(JSContext * cx, JSObject * obj, jsid id,
344 JSObject ** objp, JSProperty ** propp)
345{
346}
347
348static JSBool xml_defineProperty(JSContext * cx, JSObject * obj, jsid id,
349 const Value * v, PropertyOp getter,
350 StrictPropertyOp setter, uintN attrs)
351{
352 jsval tmp = Jsvalify(*v);
353 return PutProperty(cx, obj, id, false, &tmp);
354}
355
356static JSBool xml_getProperty(JSContext * cx, JSObject * obj,
357 JSObject * receiver, jsid id, Value * vp)
358{
359}
360
361static JSBool xml_setProperty(JSContext * cx, JSObject * obj, jsid id,
362 Value * vp, JSBool strict)
363{
364}
365
366static JSBool xml_getAttributes(JSContext * cx, JSObject * obj, jsid id,
367 uintN * attrsp)
368{
369}
370
371static JSBool xml_setAttributes(JSContext * cx, JSObject * obj, jsid id,
372 uintN * attrsp)
373{
374}
375
376static JSBool xml_deleteProperty(JSContext * cx, JSObject * obj, jsid id,
377 Value * rval, JSBool strict)
378{
379}
380
381JSBool xml_convert(JSContext * cx, JSObject * obj, JSType type, Value * rval)
382{
383}
384
385static JSBool xml_enumerate(JSContext * cx, JSObject * obj, JSIterateOp enum_op,
386 Value * statep, jsid * idp)
387{
388}
389
390static JSType xml_typeOf(JSContext * cx, JSObject * obj)
391{
392}
393
394static JSBool xml_hasInstance(JSContext * cx, JSObject * obj, const Value *,
395 JSBool * bp)
396{
397}
398
399static void xml_trace(JSTracer * trc, JSObject * obj)
400{
401}
402
403static JSBool xml_fix(JSContext * cx, JSObject * obj, bool * success,
404 AutoIdVector * props)
405{
406}
407
408static void xml_clear(JSContext * cx, JSObject * obj)
409{
410}
411
412Class js_XMLClass = {
413__null,
4140,
415__null,
416__null,
417__null,
418__null,
419__null,
420__null,
421__null,
422__null,
423__null,
424 __null, __null, __null, __null,
425__null,
426 ((JSMarkOp) (xml_trace)), {
427 __null, __null, __null, __null, __null}
428 , {
429__null,
430xml_defineProperty,
431__null,
432__null,
433__null,
434__null,
435__null,
436__null,
437__null,
438__null,
439__null,
440 __null,
441 __null
442}
443};