]>
Commit | Line | Data |
---|---|---|
bd3239d2 MF |
1 | typedef union jsval_layout { |
2 | unsigned long int asBits; | |
3 | } jsval_layout; | |
4 | static jsval_layout STRING_TO_JSVAL_IMPL(void * str) { | |
5 | } | |
6 | typedef __attribute__ ((aligned(8))) unsigned long int jsval; | |
7 | typedef struct JSLinearString JSLinearString; | |
8 | ||
9 | namespace js {} | |
10 | using namespace js; | |
11 | ||
12 | namespace js { | |
13 | class Value { | |
14 | public:void setString() { | |
15 | data = STRING_TO_JSVAL_IMPL(0); | |
16 | } jsval_layout data; | |
17 | } __attribute__ ((aligned(8))); | |
18 | static Value StringValue() { | |
19 | Value v; | |
20 | v.setString(); | |
21 | return v; | |
22 | } | |
23 | static const jsval & Jsvalify(const Value & v) { | |
24 | return (const jsval &)v; | |
25 | } | |
26 | static Value *Valueify(jsval * v) { | |
27 | return (Value *) v; | |
28 | } | |
29 | struct Class { | |
30 | }; | |
31 | namespace gc { | |
32 | struct Cell { | |
33 | }; | |
34 | }} struct | |
35 | JSObject:js::gc:: | |
36 | Cell | |
37 | { | |
38 | Class * getClass() const { | |
39 | } inline JSLinearString *getQNameLocalName() const; | |
40 | }; | |
41 | namespace js { | |
42 | static Value IdToValue(long int id) { | |
43 | if (id) | |
44 | return StringValue(); | |
45 | } static jsval IdToJsval(long int id) { | |
46 | return Jsvalify(IdToValue(id)); | |
47 | } | |
48 | } | |
49 | ||
50 | inline int js_IdIsIndex(long int id, unsigned int * indexp) | |
51 | { | |
52 | } | |
53 | ||
54 | namespace js { | |
55 | class AutoGCRooter; | |
56 | } struct JSContext { | |
57 | AutoGCRooter * autoGCRooters; | |
58 | }; | |
59 | namespace js { | |
60 | class AutoGCRooter { | |
61 | public:AutoGCRooter(JSContext * cx, | |
62 | long int tag):down(cx->autoGCRooters), tag(tag), | |
63 | context(cx) { | |
64 | cx->autoGCRooters = this; | |
65 | } protected:AutoGCRooter * const down; | |
66 | long int tag; | |
67 | JSContext *const context; | |
68 | }; | |
69 | class AutoArrayRooter:private AutoGCRooter { | |
70 | public:AutoArrayRooter(JSContext * cx, long unsigned int len, | |
71 | Value * vec):AutoGCRooter(cx, len), | |
72 | array(vec) { | |
73 | } Value *array; | |
74 | private:}; | |
75 | } | |
76 | ||
77 | typedef enum JSXMLClass { | |
78 | JSXML_CLASS_ATTRIBUTE | |
79 | } JSXMLElemVar; | |
80 | struct | |
81 | JSXML:js:: | |
82 | gc:: | |
83 | Cell { | |
84 | unsigned int xml_class; | |
85 | }; | |
86 | Class js_AttributeNameClass; | |
87 | static JSObject *NewXMLAttributeName(JSLinearString * localName) | |
88 | { | |
89 | } | |
90 | ||
91 | static void PutProperty(JSContext * cx, | |
92 | long int id, | |
93 | jsval * vp) | |
94 | { | |
95 | JSObject *nameobj; | |
96 | jsval roots[3]; | |
97 | roots[1] = IdToJsval(id); | |
98 | roots[2] = *vp; | |
99 | AutoArrayRooter tvr(cx, 0, Valueify(roots)); | |
100 | NewXMLAttributeName(nameobj-> | |
101 | getQNameLocalName()); | |
102 | } | |
103 | ||
104 | void xml_defineProperty( | |
105 | JSContext * cx, | |
106 | long int id, | |
107 | const Value * v) | |
108 | { | |
109 | jsval tmp = Jsvalify(*v); | |
110 | PutProperty(cx, id, &tmp); | |
111 | } |