X-Git-Url: https://git.wh0rd.org/?p=ICEs.git;a=blobdiff_plain;f=571482%2Fjsxml.ii.5;fp=571482%2Fjsxml.ii.5;h=5bf5e3bfb3c61693e34a5bd8732c3aa342a5c4c1;hp=0000000000000000000000000000000000000000;hb=bd3239d2bbe0de3a200b266503e3330b1e391489;hpb=dbff64cb4b7530861c2309c794efdd4e0cf47a23 diff --git a/571482/jsxml.ii.5 b/571482/jsxml.ii.5 new file mode 100644 index 0000000..5bf5e3b --- /dev/null +++ b/571482/jsxml.ii.5 @@ -0,0 +1,249 @@ +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 unsigned int JSUintn; +typedef JSIntn JSBool; +typedef JSUint64 uint64; +typedef JSUint32 uint32; +typedef JSUintn uintN; +extern "C" { + typedef struct JSString JSString; + typedef struct JSObject JSObject; + 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_VOID, JSTYPE_OBJECT, JSTYPE_FUNCTION, JSTYPE_STRING, + JSTYPE_NUMBER, JSTYPE_BOOLEAN, JSTYPE_NULL, JSTYPE_XML, + JSTYPE_LIMIT + } JSType; + typedef enum JSAccessMode { + JSACC_PROTO = 0, JSACC_PARENT = 1, JSACC_WATCH = 3, JSACC_READ = + 4, JSACC_WRITE = 8, JSACC_LIMIT + } JSIterateOp; + typedef struct JSContext JSContext; + typedef struct JSTracer JSTracer; + typedef struct JSXDRState JSXDRState; + typedef JSBool(*JSEnumerateOp) (JSContext * cx, JSObject * obj); + typedef JSBool(*JSResolveOp) (JSContext * cx, JSObject * obj, jsid id); + typedef void (*JSFinalizeOp) (JSContext * cx, JSObject * obj); + typedef JSBool(*JSXDRObjectOp) (JSXDRState * xdr, JSObject ** objp); + typedef uint32(*JSMarkOp) (JSContext * cx, JSObject * obj, void *arg); + static JSBool JSID_IS_STRING(jsid iden) { + } + static JSString *JSID_TO_STRING(jsid iden) { + } + typedef void (*JSClassInternal) (); + typedef struct JSProperty JSProperty; + typedef struct JSLinearString JSLinearString; + typedef JSObject *(*JSObjectOp) (JSContext * cx, JSObject * obj); + typedef JSObject *(*JSIteratorOp) (JSContext * cx, JSObject * obj, + JSBool keysonly); +} + +namespace js { + class Value { + public:void setNull() { + } 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; + } + typedef JSBool(*Native) (JSContext * cx, uintN argc, Value * vp); + typedef JSBool(*PropertyOp) (JSContext * cx, JSObject * obj, jsid id, + Value * vp); + typedef JSBool(*StrictPropertyOp) (JSContext * cx, JSObject * obj, + jsid id, JSBool strict, Value * vp); + typedef JSBool(*ConvertOp) (JSContext * cx, JSObject * obj, JSType type, + Value * vp); + typedef JSBool(*NewEnumerateOp) (JSContext * cx, JSObject * obj, + JSIterateOp enum_op, Value * statep, + jsid * idp); + typedef JSBool(*HasInstanceOp) (JSContext * cx, JSObject * obj, + const Value * v, JSBool * bp); + typedef JSBool(*CheckAccessOp) (JSContext * cx, JSObject * obj, jsid id, + JSAccessMode mode, Value * vp); + typedef JSBool(*EqualityOp) (JSContext * cx, JSObject * obj, + const Value * v, JSBool * bp); + typedef JSBool(*DefinePropOp) (JSContext * cx, JSObject * obj, jsid id, + const Value * value, PropertyOp getter, + StrictPropertyOp setter, uintN attrs); + typedef JSBool(*PropertyIdOp) (JSContext * cx, JSObject * obj, + JSObject * receiver, jsid id, + Value * vp); + typedef JSBool(*StrictPropertyIdOp) (JSContext * cx, JSObject * obj, + jsid id, Value * vp, + JSBool strict); + typedef JSBool(*DeleteIdOp) (JSContext * cx, JSObject * obj, jsid id, + Value * vp, JSBool strict); + typedef JSBool(*LookupPropOp) (JSContext * cx, JSObject * obj, jsid id, + JSObject ** objp, JSProperty ** propp); + typedef JSBool(*AttributesOp) (JSContext * cx, JSObject * obj, jsid id, + uintN * attrsp); + typedef JSType(*TypeOfOp) (JSContext * cx, JSObject * obj); + typedef void (*TraceOp) (JSTracer * trc, JSObject * obj); + typedef JSObject *(*ObjectOp) (JSContext * cx, JSObject * obj); + typedef void (*FinalizeOp) (JSContext * cx, JSObject * obj); + class AutoIdVector; + typedef JSBool(*FixOp) (JSContext * cx, JSObject * obj, bool * fixed, + AutoIdVector * props); + struct ClassExtension { + EqualityOp equality; + JSObjectOp outerObject; + JSObjectOp innerObject; + JSIteratorOp iteratorObject; + void *unused; + }; + struct ObjectOps { + js::LookupPropOp lookupProperty; + js::DefinePropOp defineProperty; + js::PropertyIdOp getProperty; + js::StrictPropertyIdOp setProperty; + js::AttributesOp getAttributes; + js::AttributesOp setAttributes; + js::DeleteIdOp deleteProperty; + js::NewEnumerateOp enumerate; + js::TypeOfOp typeOf; + js::TraceOp trace; + js::FixOp fix; + js::ObjectOp thisObject; + js::FinalizeOp clear; + }; + struct Class { + const char *name; + uint32 flags; + PropertyOp addProperty; + PropertyOp delProperty; + PropertyOp getProperty; + StrictPropertyOp setProperty; + JSEnumerateOp enumerate; + JSResolveOp resolve; + ConvertOp convert; + JSFinalizeOp finalize; + JSClassInternal reserved0; + CheckAccessOp checkAccess; + Native call; + Native construct; + JSXDRObjectOp xdrObject; + HasInstanceOp hasInstance; + JSMarkOp mark; + ClassExtension ext; + ObjectOps ops; + }; + 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_LIST, JSXML_CLASS_ELEMENT, JSXML_CLASS_ATTRIBUTE, + JSXML_CLASS_PROCESSING_INSTRUCTION, JSXML_CLASS_TEXT, + JSXML_CLASS_COMMENT, JSXML_CLASS_LIMIT +} JSXMLElemVar; +struct JSXML:js::gc::Cell { + uint32 xml_class; +}; +using namespace js; +Class js_AttributeNameClass; + +static JSObject *NewXMLAttributeName(JSContext * cx, JSLinearString * uri, + JSLinearString * prefix, + JSLinearString * localName) +{ +} + +static JSBool PutProperty(JSContext * cx, JSObject * obj, jsid id, + JSBool strict, jsval * vp) +{ + enum { + OBJ_ROOT, +ID_ROOT, VAL_ROOT + }; + JSXML *xml, *vxml, *rxml, *kid, *attr, *parent, *copy, *kid2, *match; + JSObject *vobj, *nameobj, *attrobj, *parentobj, *kidobj, *copyobj; + uint32 index, i, j, k, n, q, matchIndex; + jsval roots[3]; + roots[ID_ROOT] = IdToJsval(id); + roots[VAL_ROOT] = *vp; + AutoArrayRooter tvr(cx, (sizeof(roots) / sizeof(roots)[0]), + Valueify(roots)); + if (js_IdIsIndex(id, &index)) { + if (kid->xml_class == JSXML_CLASS_ATTRIBUTE) { + if (nameobj->getClass() != &js_AttributeNameClass) { + nameobj = + NewXMLAttributeName(cx, + nameobj->getNameURI(), + nameobj-> + getNamePrefix(), + 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); +}