]> git.wh0rd.org Git - ICEs.git/blob - 571482/jsxml.ii.6
more
[ICEs.git] / 571482 / jsxml.ii.6
1 typedef long unsigned int size_t;
2 typedef long int ptrdiff_t;
3 typedef unsigned int uint32_t;
4 typedef unsigned long int uint64_t;
5 typedef uint32_t JSUint32;
6 typedef uint64_t JSUint64;
7 typedef int JSIntn;
8 typedef JSIntn JSBool;
9 typedef JSUint64 uint64;
10 typedef JSUint32 uint32;
11 extern "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
30 namespace js {
31         class Value {
32               public:
33 void setString(JSString * str) {
34                         data = STRING_TO_JSVAL_IMPL(str);
35                 } 
36 jsval_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 };
61 namespace 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
70 inline JSBool js_IdIsIndex(jsid id, jsuint * indexp)
71 {
72 }
73
74 namespace js {
75         class AutoGCRooter;
76 } struct JSContext {
77         js::AutoGCRooter * autoGCRooters;
78 };
79 namespace 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
97 typedef enum JSXMLClass {
98 JSXML_CLASS_ATTRIBUTE
99 } JSXMLElemVar;
100 struct JSXML:js::gc::Cell {
101         uint32 xml_class;
102 };
103 using namespace js;
104 Class js_AttributeNameClass;
105 static JSObject *NewXMLAttributeName(
106                                      JSLinearString * localName)
107 {
108 }
109
110 static 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
136 JSBool xml_defineProperty(JSContext * cx, JSObject * obj, jsid id,
137                           const Value * v)
138 {
139         jsval tmp = Jsvalify(*v);
140         return PutProperty(
141 cx, 
142 obj, id, false, &tmp);
143 }