/[jscoverage]/trunk/js/jsprvtd.h
ViewVC logotype

Diff of /trunk/js/jsprvtd.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 332 by siliconforks, Thu Oct 23 19:03:33 2008 UTC revision 460 by siliconforks, Sat Sep 26 23:15:22 2009 UTC
# Line 55  Line 55 
55   */   */
56    
57  #include "jspubtd.h"  #include "jspubtd.h"
58    #include "jsutil.h"
59    
60  /* Internal identifier (jsid) macros. */  /* Internal identifier (jsid) macros. */
61    
# Line 93  Line 94 
94  typedef struct JSGCThing            JSGCThing;  typedef struct JSGCThing            JSGCThing;
95  typedef struct JSGenerator          JSGenerator;  typedef struct JSGenerator          JSGenerator;
96  typedef struct JSNativeEnumerator   JSNativeEnumerator;  typedef struct JSNativeEnumerator   JSNativeEnumerator;
97  typedef struct JSParseContext       JSParseContext;  typedef struct JSCompiler           JSCompiler;
98  typedef struct JSParsedObjectBox    JSParsedObjectBox;  typedef struct JSFunctionBox        JSFunctionBox;
99    typedef struct JSObjectBox          JSObjectBox;
100  typedef struct JSParseNode          JSParseNode;  typedef struct JSParseNode          JSParseNode;
101  typedef struct JSPropCacheEntry     JSPropCacheEntry;  typedef struct JSPropCacheEntry     JSPropCacheEntry;
102    typedef struct JSProperty           JSProperty;
103  typedef struct JSSharpObjectMap     JSSharpObjectMap;  typedef struct JSSharpObjectMap     JSSharpObjectMap;
104  typedef struct JSTempValueRooter    JSTempValueRooter;  typedef struct JSTempValueRooter    JSTempValueRooter;
105  typedef struct JSThread             JSThread;  typedef struct JSThread             JSThread;
106    typedef struct JSThreadData         JSThreadData;
107  typedef struct JSToken              JSToken;  typedef struct JSToken              JSToken;
108  typedef struct JSTokenPos           JSTokenPos;  typedef struct JSTokenPos           JSTokenPos;
109  typedef struct JSTokenPtr           JSTokenPtr;  typedef struct JSTokenPtr           JSTokenPtr;
110  typedef struct JSTokenStream        JSTokenStream;  typedef struct JSTokenStream        JSTokenStream;
111    typedef struct JSTraceMonitor       JSTraceMonitor;
112  typedef struct JSTreeContext        JSTreeContext;  typedef struct JSTreeContext        JSTreeContext;
113  typedef struct JSTryNote            JSTryNote;  typedef struct JSTryNote            JSTryNote;
114  typedef struct JSWeakRoots          JSWeakRoots;  typedef struct JSWeakRoots          JSWeakRoots;
# Line 124  Line 129 
129  typedef struct JSStackHeader        JSStackHeader;  typedef struct JSStackHeader        JSStackHeader;
130  typedef struct JSStringBuffer       JSStringBuffer;  typedef struct JSStringBuffer       JSStringBuffer;
131  typedef struct JSSubString          JSSubString;  typedef struct JSSubString          JSSubString;
132    typedef struct JSTraceableNative    JSTraceableNative;
133  typedef struct JSXML                JSXML;  typedef struct JSXML                JSXML;
134  typedef struct JSXMLArray           JSXMLArray;  typedef struct JSXMLArray           JSXMLArray;
135  typedef struct JSXMLArrayCursor     JSXMLArrayCursor;  typedef struct JSXMLArrayCursor     JSXMLArrayCursor;
# Line 238  Line 244 
244      JSTempValueTrace    trace;      JSTempValueTrace    trace;
245      JSScopeProperty     *sprop;      JSScopeProperty     *sprop;
246      JSWeakRoots         *weakRoots;      JSWeakRoots         *weakRoots;
247      JSParseContext      *parseContext;      JSCompiler          *compiler;
248      JSScript            *script;      JSScript            *script;
249      jsval               *array;      jsval               *array;
250  } JSTempValueUnion;  } JSTempValueUnion;
# Line 249  Line 255 
255      JSTempValueUnion    u;      JSTempValueUnion    u;
256  };  };
257    
258    /* JSObjectOps function pointer typedefs. */
259    
260    /*
261     * Look for id in obj and its prototype chain, returning false on error or
262     * exception, true on success.  On success, return null in *propp if id was
263     * not found.  If id was found, return the first object searching from obj
264     * along its prototype chain in which id names a direct property in *objp, and
265     * return a non-null, opaque property pointer in *propp.
266     *
267     * If JSLookupPropOp succeeds and returns with *propp non-null, that pointer
268     * may be passed as the prop parameter to a JSAttributesOp, as a short-cut
269     * that bypasses id re-lookup.  In any case, a non-null *propp result after a
270     * successful lookup must be dropped via JSObjectOps.dropProperty.
271     *
272     * NB: successful return with non-null *propp means the implementation may
273     * have locked *objp and added a reference count associated with *propp, so
274     * callers should not risk deadlock by nesting or interleaving other lookups
275     * or any obj-bearing ops before dropping *propp.
276     */
277    typedef JSBool
278    (* JSLookupPropOp)(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
279                       JSProperty **propp);
280    
281    /*
282     * Define obj[id], a direct property of obj named id, having the given initial
283     * value, with the specified getter, setter, and attributes.  If the propp out
284     * param is non-null, *propp on successful return contains an opaque property
285     * pointer usable as a speedup hint with JSAttributesOp.  But note that propp
286     * may be null, indicating that the caller is not interested in recovering an
287     * opaque pointer to the newly-defined property.
288     *
289     * If propp is non-null and JSDefinePropOp succeeds, its caller must be sure
290     * to drop *propp using JSObjectOps.dropProperty in short order, just as with
291     * JSLookupPropOp.
292     */
293    typedef JSBool
294    (* JSDefinePropOp)(JSContext *cx, JSObject *obj, jsid id, jsval value,
295                       JSPropertyOp getter, JSPropertyOp setter, uintN attrs,
296                       JSProperty **propp);
297    
298    /*
299     * Get, set, or delete obj[id], returning false on error or exception, true
300     * on success.  If getting or setting, the new value is returned in *vp on
301     * success.  If deleting without error, *vp will be JSVAL_FALSE if obj[id] is
302     * permanent, and JSVAL_TRUE if id named a direct property of obj that was in
303     * fact deleted, or if id names no direct property of obj (id could name a
304     * prototype property, or no property in obj or its prototype chain).
305     */
306    typedef JSBool
307    (* JSPropertyIdOp)(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
308    
309    /*
310     * Get or set attributes of the property obj[id].  Return false on error or
311     * exception, true with current attributes in *attrsp.  If prop is non-null,
312     * it must come from the *propp out parameter of a prior JSDefinePropOp or
313     * JSLookupPropOp call.
314     */
315    typedef JSBool
316    (* JSAttributesOp)(JSContext *cx, JSObject *obj, jsid id, JSProperty *prop,
317                       uintN *attrsp);
318    
319    /*
320     * JSObjectOps.checkAccess type: check whether obj[id] may be accessed per
321     * mode, returning false on error/exception, true on success with obj[id]'s
322     * last-got value in *vp, and its attributes in *attrsp.
323     */
324    typedef JSBool
325    (* JSCheckAccessIdOp)(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
326                          jsval *vp, uintN *attrsp);
327    
328    /*
329     * A generic type for functions taking a context, object, and property, with
330     * no return value.  Used by JSObjectOps.dropProperty currently (see above,
331     * JSDefinePropOp and JSLookupPropOp, for the object-locking protocol in which
332     * dropProperty participates).
333     */
334    typedef void
335    (* JSPropertyRefOp)(JSContext *cx, JSObject *obj, JSProperty *prop);
336    
337    /*
338     * Get and set a required slot, one that should already have been allocated.
339     * These operations are infallible, so required slots must be pre-allocated,
340     * or implementations must suppress out-of-memory errors.  The native ops
341     * (js_ObjectOps, see jsobj.c) access slots reserved by including a call to
342     * the JSCLASS_HAS_RESERVED_SLOTS(n) macro in the JSClass.flags initializer.
343     *
344     * NB: the slot parameter is a zero-based index into obj slots, unlike the
345     * index parameter to the JS_GetReservedSlot and JS_SetReservedSlot API entry
346     * points, which is a zero-based index into the JSCLASS_RESERVED_SLOTS(clasp)
347     * reserved slots that come after the initial well-known slots: proto, parent,
348     * class, and optionally, the private data slot.
349     */
350    typedef jsval
351    (* JSGetRequiredSlotOp)(JSContext *cx, JSObject *obj, uint32 slot);
352    
353    typedef JSBool
354    (* JSSetRequiredSlotOp)(JSContext *cx, JSObject *obj, uint32 slot, jsval v);
355    
356  /*  /*
357   * The following determines whether JS_EncodeCharacters and JS_DecodeBytes   * The following determines whether JS_EncodeCharacters and JS_DecodeBytes
358   * treat char[] as utf-8 or simply as bytes that need to be inflated/deflated.   * treat char[] as utf-8 or simply as bytes that need to be inflated/deflated.

Legend:
Removed from v.332  
changed lines
  Added in v.460

  ViewVC Help
Powered by ViewVC 1.1.24