]> git.wh0rd.org - ICEs.git/blame - 571482/jsxml.ii.6
more
[ICEs.git] / 571482 / jsxml.ii.6
CommitLineData
bd3239d2
MF
1typedef long unsigned int size_t;
2typedef long int ptrdiff_t;
3typedef unsigned int uint32_t;
4typedef unsigned long int uint64_t;
5typedef uint32_t JSUint32;
6typedef uint64_t JSUint64;
7typedef int JSIntn;
8typedef JSIntn JSBool;
9typedef JSUint64 uint64;
10typedef JSUint32 uint32;
11extern "C" {
12 typedef struct JSString JSString;
13 typedef union jsval_layout {
14 uint64 asBits;
15 } jsval_layout;
16 static jsval_layout STRING_TO_JSVAL_IMPL(JSString * str) {
17 } typedef __attribute__ ((aligned(8))) uint64 jsval;
18 typedef ptrdiff_t jsid;
19 typedef JSUint32 jsuint;
20 typedef enum JSType {
21 JSTYPE_LIMIT
22 } JSType;
23 static JSBool JSID_IS_STRING(jsid iden) {
24 }
25 static JSString *JSID_TO_STRING(jsid iden) {
26 }
27 typedef struct JSLinearString JSLinearString;
28}
29
30namespace js {
31 class Value {
32 public:
33void setString(JSString * str) {
34 data = STRING_TO_JSVAL_IMPL(str);
35 }
36jsval_layout data;
37 }
38 __attribute__ ((aligned(8)));
39 static Value StringValue(JSString * str) {
40 Value v;
41 v.setString(str);
42 return v;
43 }
44 static inline const jsval & Jsvalify(const Value & v) {
45 return (const jsval &)v;
46 }
47 static inline Value *Valueify(jsval * v) {
48 return (Value *) v;
49 }
50 struct Class {
51 };
52 namespace gc {
53 struct Cell {
54 };
55}} struct JSObject:js::gc::Cell {
56 js::Class * getClass() const {
57 } inline JSLinearString *getNamePrefix() const;
58 inline JSLinearString *getNameURI() const;
59 inline JSLinearString *getQNameLocalName() const;
60};
61namespace js {
62 static Value IdToValue(jsid id) {
63 if (JSID_IS_STRING(id))
64 return StringValue(JSID_TO_STRING(id));
65 } static jsval IdToJsval(jsid id) {
66 return Jsvalify(IdToValue(id));
67 }
68}
69
70inline JSBool js_IdIsIndex(jsid id, jsuint * indexp)
71{
72}
73
74namespace js {
75 class AutoGCRooter;
76} struct JSContext {
77 js::AutoGCRooter * autoGCRooters;
78};
79namespace js {
80 class AutoGCRooter {
81 public:AutoGCRooter(JSContext * cx,
82 ptrdiff_t tag):down(cx->autoGCRooters), tag(tag),
83 context(cx) {
84 cx->autoGCRooters = this;
85 } protected:AutoGCRooter * const down;
86 ptrdiff_t tag;
87 JSContext *const context;
88 };
89 class AutoArrayRooter:private AutoGCRooter {
90 public:AutoArrayRooter(JSContext * cx, size_t len,
91 Value * vec):AutoGCRooter(cx, len),
92 array(vec) {
93 } Value *array;
94 private:};
95}
96
97typedef enum JSXMLClass {
98JSXML_CLASS_ATTRIBUTE
99} JSXMLElemVar;
100struct JSXML:js::gc::Cell {
101 uint32 xml_class;
102};
103using namespace js;
104Class js_AttributeNameClass;
105static JSObject *NewXMLAttributeName(
106 JSLinearString * localName)
107{
108}
109
110static JSBool PutProperty(JSContext * cx, JSObject * obj, jsid id,
111 JSBool strict, jsval * vp)
112{
113 enum {
114 OBJ_ROOT, ID_ROOT, VAL_ROOT
115 };
116 JSXML *xml; JSXML *vxml; JSXML *rxml; JSXML *kid; JSXML *attr; JSXML *parent; JSXML *copy; JSXML *kid2; JSXML *match;
117 JSObject *vobj; JSObject *nameobj; JSObject *attrobj; JSObject *parentobj; JSObject *kidobj; JSObject *copyobj;
118 uint32 index; uint32 i; uint32 j; uint32 k; uint32 n; uint32 q; uint32 matchIndex;
119 jsval roots[3];
120 roots[ID_ROOT] = IdToJsval(id);
121 roots[VAL_ROOT] = *vp;
122 AutoArrayRooter tvr(cx, 0,
123 Valueify(roots));
124 if (js_IdIsIndex(id, &index)) {
125 if (kid->xml_class == JSXML_CLASS_ATTRIBUTE) {
126 if (nameobj->getClass() != &js_AttributeNameClass) {
127 nameobj =
128 NewXMLAttributeName(
129 nameobj->
130 getQNameLocalName());
131 }
132 }
133 }
134}
135
136JSBool xml_defineProperty(JSContext * cx, JSObject * obj, jsid id,
137 const Value * v)
138{
139 jsval tmp = Jsvalify(*v);
140 return PutProperty(
141cx,
142obj, id, false, &tmp);
143}