]> git.wh0rd.org - ICEs.git/blobdiff - 571482/jsxml.ii.8
more
[ICEs.git] / 571482 / jsxml.ii.8
diff --git a/571482/jsxml.ii.8 b/571482/jsxml.ii.8
new file mode 100644 (file)
index 0000000..6704715
--- /dev/null
@@ -0,0 +1,77 @@
+typedef union jsval_layout {
+long int asBits;
+} jsval_layout;
+static jsval_layout STRING_TO_JSVAL_IMPL(void *str)
+{}
+
+typedef __attribute__ ((aligned(8))) unsigned long int jsval;
+       class Value {
+             public:void setString()
+{
+       data = STRING_TO_JSVAL_IMPL(0);
+} jsval_layout data;
+       } __attribute__ ((aligned(8)));
+
+       static Value StringValue() {
+               Value v;
+               v.setString();
+               return v;
+       }
+       static const jsval & Jsvalify(const Value & v) {
+               return (const jsval &)v;
+       }
+       static Value *Valueify(jsval * v) {
+               return (Value *) v;
+       }
+
+       struct JSObject {
+               void getQNameLocalName();
+       };
+       static Value IdToValue(int id) {
+               if (id)
+                       return StringValue();
+       }
+       static jsval IdToJsval(int id) {
+               return Jsvalify(IdToValue(id));
+       }
+
+class AutoGCRooter;
+struct JSContext {
+       AutoGCRooter *autoGCRooters;
+};
+
+       class AutoGCRooter {
+      public:
+AutoGCRooter(JSContext * cx
+):down(cx->autoGCRooters),
+                   context(cx) {
+                       cx->autoGCRooters = this;
+             } 
+protected:
+AutoGCRooter * const down;
+               JSContext *const context;
+       };
+       class AutoArrayRooter:
+private AutoGCRooter {
+             public:
+AutoArrayRooter(JSContext *cx,
+                               Value *vec): AutoGCRooter(cx),
+                   array(vec) {
+               } Value *array;
+};
+
+static void PutProperty(JSContext *cx, int id, jsval *vp)
+{
+       JSObject *nameobj;
+       jsval roots[3];
+       roots[1] = IdToJsval(id);
+       roots[2] = *vp;
+       AutoArrayRooter tvr(cx, Valueify(roots));
+       nameobj->getQNameLocalName();
+}
+
+void xml_defineProperty(JSContext *cx, int id, const Value *v)
+{
+       jsval tmp = Jsvalify(*v);
+       PutProperty(cx, id, &tmp);
+}