]> git.wh0rd.org - ICEs.git/blobdiff - 571482/jsxml.ii.6
more
[ICEs.git] / 571482 / jsxml.ii.6
diff --git a/571482/jsxml.ii.6 b/571482/jsxml.ii.6
new file mode 100644 (file)
index 0000000..5e26983
--- /dev/null
@@ -0,0 +1,143 @@
+typedef long unsigned int size_t;
+typedef long int ptrdiff_t;
+typedef unsigned int uint32_t;
+typedef unsigned long int uint64_t;
+typedef uint32_t JSUint32;
+typedef uint64_t JSUint64;
+typedef int JSIntn;
+typedef JSIntn JSBool;
+typedef JSUint64 uint64;
+typedef JSUint32 uint32;
+extern "C" {
+       typedef struct JSString JSString;
+       typedef union jsval_layout {
+               uint64 asBits;
+       } jsval_layout;
+       static jsval_layout STRING_TO_JSVAL_IMPL(JSString * str) {
+       } typedef __attribute__ ((aligned(8))) uint64 jsval;
+       typedef ptrdiff_t jsid;
+       typedef JSUint32 jsuint;
+       typedef enum JSType {
+                   JSTYPE_LIMIT
+       } JSType;
+       static JSBool JSID_IS_STRING(jsid iden) {
+       }
+       static JSString *JSID_TO_STRING(jsid iden) {
+       }
+       typedef struct JSLinearString JSLinearString;
+}
+
+namespace js {
+       class Value {
+             public:
+void setString(JSString * str) {
+                       data = STRING_TO_JSVAL_IMPL(str);
+               } 
+jsval_layout data;
+       }
+       __attribute__ ((aligned(8)));
+       static Value StringValue(JSString * str) {
+               Value v;
+               v.setString(str);
+               return v;
+       }
+       static inline const jsval & Jsvalify(const Value & v) {
+               return (const jsval &)v;
+       }
+       static inline Value *Valueify(jsval * v) {
+               return (Value *) v;
+       }
+       struct Class {
+       };
+       namespace gc {
+               struct Cell {
+               };
+}} struct JSObject:js::gc::Cell {
+       js::Class * getClass() const {
+       } inline JSLinearString *getNamePrefix() const;
+       inline JSLinearString *getNameURI() const;
+       inline JSLinearString *getQNameLocalName() const;
+};
+namespace js {
+       static Value IdToValue(jsid id) {
+               if (JSID_IS_STRING(id))
+                       return StringValue(JSID_TO_STRING(id));
+       } static jsval IdToJsval(jsid id) {
+               return Jsvalify(IdToValue(id));
+       }
+}
+
+inline JSBool js_IdIsIndex(jsid id, jsuint * indexp)
+{
+}
+
+namespace js {
+       class AutoGCRooter;
+} struct JSContext {
+       js::AutoGCRooter * autoGCRooters;
+};
+namespace js {
+       class AutoGCRooter {
+             public:AutoGCRooter(JSContext * cx,
+                            ptrdiff_t tag):down(cx->autoGCRooters), tag(tag),
+                   context(cx) {
+                       cx->autoGCRooters = this;
+             } protected:AutoGCRooter * const down;
+               ptrdiff_t tag;
+               JSContext *const context;
+       };
+       class AutoArrayRooter:private AutoGCRooter {
+             public:AutoArrayRooter(JSContext * cx, size_t len,
+                               Value * vec):AutoGCRooter(cx, len),
+                   array(vec) {
+               } Value *array;
+      private:};
+}
+
+typedef enum JSXMLClass {
+JSXML_CLASS_ATTRIBUTE
+} JSXMLElemVar;
+struct JSXML:js::gc::Cell {
+       uint32 xml_class;
+};
+using namespace js;
+Class js_AttributeNameClass;
+static JSObject *NewXMLAttributeName(
+                                    JSLinearString * localName)
+{
+}
+
+static JSBool PutProperty(JSContext * cx, JSObject * obj, jsid id,
+                         JSBool strict, jsval * vp)
+{
+       enum {
+               OBJ_ROOT, ID_ROOT, VAL_ROOT
+       };
+       JSXML *xml; JSXML *vxml; JSXML *rxml; JSXML *kid; JSXML *attr; JSXML *parent; JSXML *copy; JSXML *kid2; JSXML *match;
+       JSObject *vobj; JSObject *nameobj; JSObject *attrobj; JSObject *parentobj; JSObject *kidobj; JSObject *copyobj;
+       uint32 index; uint32 i; uint32 j; uint32 k; uint32 n; uint32 q; uint32 matchIndex;
+       jsval roots[3];
+       roots[ID_ROOT] = IdToJsval(id);
+       roots[VAL_ROOT] = *vp;
+       AutoArrayRooter tvr(cx, 0,
+                           Valueify(roots));
+       if (js_IdIsIndex(id, &index)) {
+               if (kid->xml_class == JSXML_CLASS_ATTRIBUTE) {
+                       if (nameobj->getClass() != &js_AttributeNameClass) {
+                               nameobj =
+                                   NewXMLAttributeName(
+                                                       nameobj->
+                                                       getQNameLocalName());
+                       }
+               }
+       }
+}
+
+JSBool xml_defineProperty(JSContext * cx, JSObject * obj, jsid id,
+                         const Value * v)
+{
+       jsval tmp = Jsvalify(*v);
+       return PutProperty(
+cx, 
+obj, id, false, &tmp);
+}