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