]> git.wh0rd.org - ICEs.git/blame - 571482/jsxml.ii
more
[ICEs.git] / 571482 / jsxml.ii
CommitLineData
bd3239d2
MF
1typedef union {
2 long int asBits;
3} jsval_layout;
4static jsval_layout STRING_TO_JSVAL_IMPL() {}
5
6typedef __attribute__ ((aligned(8))) long int jsval;
7class Value {
8 public:
9 void setString() {
10 data = STRING_TO_JSVAL_IMPL();
11 }
12 jsval_layout data;
13} __attribute__ ((aligned(8)));
14
15static Value StringValue()
16{
17 Value v;
18 v.setString();
19 return v;
20}
21
22static const jsval & Jsvalify(const Value & v)
23{
24 return (const jsval &)v;
25}
26
27static Value *Valueify(jsval *v)
28{
29 return (Value *) v;
30}
31
32struct JSObject {
33 void getQNameLocalName();
34};
35static Value IdToValue(int id)
36{
37 if (id)
38 return StringValue();
39}
40
41static jsval IdToJsval(int id)
42{
43 return Jsvalify(IdToValue(id));
44}
45
46class AutoGCRooter;
47struct JSContext {
48 AutoGCRooter *autoGCRooters;
49};
50class AutoGCRooter {
51 public:
52 AutoGCRooter(JSContext *cx) {}
53};
54class 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
64static 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
74void xml_defineProperty(JSContext *cx, int id, const Value *v)
75{
76 jsval tmp = Jsvalify(*v);
77 PutProperty(cx, id, &tmp);
78}