]> git.wh0rd.org - ICEs.git/blob - 571482/jsxml.ii
more
[ICEs.git] / 571482 / jsxml.ii
1 typedef union {
2 long int asBits;
3 } jsval_layout;
4 static jsval_layout STRING_TO_JSVAL_IMPL() {}
5
6 typedef __attribute__ ((aligned(8))) long int jsval;
7 class Value {
8 public:
9 void setString() {
10 data = STRING_TO_JSVAL_IMPL();
11 }
12 jsval_layout data;
13 } __attribute__ ((aligned(8)));
14
15 static Value StringValue()
16 {
17 Value v;
18 v.setString();
19 return v;
20 }
21
22 static const jsval & Jsvalify(const Value & v)
23 {
24 return (const jsval &)v;
25 }
26
27 static Value *Valueify(jsval *v)
28 {
29 return (Value *) v;
30 }
31
32 struct JSObject {
33 void getQNameLocalName();
34 };
35 static Value IdToValue(int id)
36 {
37 if (id)
38 return StringValue();
39 }
40
41 static jsval IdToJsval(int id)
42 {
43 return Jsvalify(IdToValue(id));
44 }
45
46 class AutoGCRooter;
47 struct JSContext {
48 AutoGCRooter *autoGCRooters;
49 };
50 class AutoGCRooter {
51 public:
52 AutoGCRooter(JSContext *cx) {}
53 };
54 class AutoArrayRooter:AutoGCRooter {
55 public:
56 AutoArrayRooter(JSContext *cx, Value *vec):AutoGCRooter(cx)
57 {
58 array = vec;
59 cx->autoGCRooters = this;
60 }
61 Value *array;
62 };
63
64 static void PutProperty(JSContext *cx, int id, jsval *vp)
65 {
66 JSObject *nameobj;
67 jsval roots[3];
68 roots[1] = IdToJsval(id);
69 roots[2] = *vp;
70 AutoArrayRooter tvr(cx, Valueify(roots));
71 nameobj->getQNameLocalName();
72 }
73
74 void xml_defineProperty(JSContext *cx, int id, const Value *v)
75 {
76 jsval tmp = Jsvalify(*v);
77 PutProperty(cx, id, &tmp);
78 }