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

Diff of /trunk/js/jsapi.h

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

revision 459 by siliconforks, Tue Dec 9 03:37:47 2008 UTC revision 460 by siliconforks, Sat Sep 26 23:15:22 2009 UTC
# Line 83  Line 83 
83  /* Objects, strings, and doubles are GC'ed. */  /* Objects, strings, and doubles are GC'ed. */
84  #define JSVAL_IS_GCTHING(v)     (!((v) & JSVAL_INT) &&                        \  #define JSVAL_IS_GCTHING(v)     (!((v) & JSVAL_INT) &&                        \
85                                   JSVAL_TAG(v) != JSVAL_BOOLEAN)                                   JSVAL_TAG(v) != JSVAL_BOOLEAN)
86  #define JSVAL_TO_GCTHING(v)     ((void *)JSVAL_CLRTAG(v))  
87  #define JSVAL_TO_OBJECT(v)      ((JSObject *)JSVAL_TO_GCTHING(v))  static JS_ALWAYS_INLINE void *
88  #define JSVAL_TO_DOUBLE(v)      ((jsdouble *)JSVAL_TO_GCTHING(v))  JSVAL_TO_GCTHING(jsval v)
89  #define JSVAL_TO_STRING(v)      ((JSString *)JSVAL_TO_GCTHING(v))  {
90  #define OBJECT_TO_JSVAL(obj)    ((jsval)(obj))      JS_ASSERT(JSVAL_IS_GCTHING(v));
91  #define DOUBLE_TO_JSVAL(dp)     JSVAL_SETTAG((jsval)(dp), JSVAL_DOUBLE)      return (void *) JSVAL_CLRTAG(v);
92  #define STRING_TO_JSVAL(str)    JSVAL_SETTAG((jsval)(str), JSVAL_STRING)  }
93    
94    static JS_ALWAYS_INLINE JSObject *
95    JSVAL_TO_OBJECT(jsval v)
96    {
97        JS_ASSERT(JSVAL_IS_OBJECT(v));
98        return (JSObject *) JSVAL_TO_GCTHING(v);
99    }
100    
101    static JS_ALWAYS_INLINE jsdouble *
102    JSVAL_TO_DOUBLE(jsval v)
103    {
104        JS_ASSERT(JSVAL_IS_DOUBLE(v));
105        return (jsdouble *) JSVAL_TO_GCTHING(v);
106    }
107    
108    static JS_ALWAYS_INLINE JSString *
109    JSVAL_TO_STRING(jsval v)
110    {
111        JS_ASSERT(JSVAL_IS_STRING(v));
112        return (JSString *) JSVAL_TO_GCTHING(v);
113    }
114    
115    static JS_ALWAYS_INLINE jsval
116    OBJECT_TO_JSVAL(JSObject *obj)
117    {
118        JS_ASSERT(((jsval) obj & JSVAL_TAGMASK) == JSVAL_OBJECT);
119        return (jsval) obj;
120    }
121    
122    static JS_ALWAYS_INLINE jsval
123    DOUBLE_TO_JSVAL(jsdouble *dp)
124    {
125        JS_ASSERT(((jsword) dp & JSVAL_TAGMASK) == 0);
126        return JSVAL_SETTAG((jsval) dp, JSVAL_DOUBLE);
127    }
128    
129    static JS_ALWAYS_INLINE jsval
130    STRING_TO_JSVAL(JSString *str)
131    {
132        return JSVAL_SETTAG((jsval) str, JSVAL_STRING);
133    }
134    
135  /* Lock and unlock the GC thing held by a jsval. */  /* Lock and unlock the GC thing held by a jsval. */
136  #define JSVAL_LOCK(cx,v)        (JSVAL_IS_GCTHING(v)                          \  #define JSVAL_LOCK(cx,v)        (JSVAL_IS_GCTHING(v)                          \
# Line 109  Line 150 
150  #define JSVAL_TO_INT(v)         ((jsint)(v) >> 1)  #define JSVAL_TO_INT(v)         ((jsint)(v) >> 1)
151  #define INT_TO_JSVAL(i)         (((jsval)(i) << 1) | JSVAL_INT)  #define INT_TO_JSVAL(i)         (((jsval)(i) << 1) | JSVAL_INT)
152    
153  /* Convert between boolean and jsval. */  /*
154  #define JSVAL_TO_BOOLEAN(v)     ((JSBool)((v) >> JSVAL_TAGBITS))   * A pseudo-boolean is a 29-bit (for 32-bit jsval) or 61-bit (for 64-bit jsval)
155  #define BOOLEAN_TO_JSVAL(b)     JSVAL_SETTAG((jsval)(b) << JSVAL_TAGBITS,     \   * value other than 0 or 1 encoded as a jsval whose tag is JSVAL_BOOLEAN.
156                                               JSVAL_BOOLEAN)   *
157     * JSVAL_VOID happens to be defined as a jsval encoding a pseudo-boolean, but
158     * embedders MUST NOT rely on this. All other possible pseudo-boolean values
159     * are implementation-reserved and MUST NOT be constructed by any embedding of
160     * SpiderMonkey.
161     */
162    #define JSVAL_TO_PSEUDO_BOOLEAN(v) ((JSBool) ((v) >> JSVAL_TAGBITS))
163    #define PSEUDO_BOOLEAN_TO_JSVAL(b)                                            \
164        JSVAL_SETTAG((jsval) (b) << JSVAL_TAGBITS, JSVAL_BOOLEAN)
165    
166    /*
167     * Well-known JS values.  The extern'd variables are initialized when the
168     * first JSContext is created by JS_NewContext (see below).
169     */
170    #define JSVAL_NULL              ((jsval) 0)
171    #define JSVAL_ZERO              INT_TO_JSVAL(0)
172    #define JSVAL_ONE               INT_TO_JSVAL(1)
173    #define JSVAL_FALSE             PSEUDO_BOOLEAN_TO_JSVAL(JS_FALSE)
174    #define JSVAL_TRUE              PSEUDO_BOOLEAN_TO_JSVAL(JS_TRUE)
175    #define JSVAL_VOID              PSEUDO_BOOLEAN_TO_JSVAL(2)
176    
177    
178    /* Convert between boolean and jsval, asserting that inputs are valid. */
179    static JS_ALWAYS_INLINE JSBool
180    JSVAL_TO_BOOLEAN(jsval v)
181    {
182        JS_ASSERT(v == JSVAL_TRUE || v == JSVAL_FALSE);
183        return JSVAL_TO_PSEUDO_BOOLEAN(v);
184    }
185    
186    static JS_ALWAYS_INLINE jsval
187    BOOLEAN_TO_JSVAL(JSBool b)
188    {
189        JS_ASSERT(b == JS_TRUE || b == JS_FALSE);
190        return PSEUDO_BOOLEAN_TO_JSVAL(b);
191    }
192    
193  /* A private data pointer (2-byte-aligned) can be stored as an int jsval. */  /* A private data pointer (2-byte-aligned) can be stored as an int jsval. */
194  #define JSVAL_TO_PRIVATE(v)     ((void *)((v) & ~JSVAL_INT))  #define JSVAL_TO_PRIVATE(v)     ((void *)((v) & ~JSVAL_INT))
# Line 159  Line 235 
235  #define JSFUN_FAST_NATIVE     0x0800    /* JSFastNative needs no JSStackFrame */  #define JSFUN_FAST_NATIVE     0x0800    /* JSFastNative needs no JSStackFrame */
236    
237  #define JSFUN_FLAGS_MASK      0x0ff8    /* overlay JSFUN_* attributes --  #define JSFUN_FLAGS_MASK      0x0ff8    /* overlay JSFUN_* attributes --
238                                             note that bit #15 is used internally                                             bits 12-15 are used internally to
239                                             to flag interpreted functions */                                             flag interpreted functions */
240    
241  #define JSFUN_STUB_GSOPS      0x1000    /* use JS_PropertyStub getter/setter  #define JSFUN_STUB_GSOPS      0x1000    /* use JS_PropertyStub getter/setter
242                                             instead of defaulting to class gsops                                             instead of defaulting to class gsops
# Line 180  Line 256 
256  #define JSFUN_GENERIC_NATIVE    JSFUN_LAMBDA  #define JSFUN_GENERIC_NATIVE    JSFUN_LAMBDA
257    
258  /*  /*
  * Well-known JS values.  The extern'd variables are initialized when the  
  * first JSContext is created by JS_NewContext (see below).  
  */  
 #define JSVAL_VOID              BOOLEAN_TO_JSVAL(2)  
 #define JSVAL_NULL              OBJECT_TO_JSVAL(0)  
 #define JSVAL_ZERO              INT_TO_JSVAL(0)  
 #define JSVAL_ONE               INT_TO_JSVAL(1)  
 #define JSVAL_FALSE             BOOLEAN_TO_JSVAL(JS_FALSE)  
 #define JSVAL_TRUE              BOOLEAN_TO_JSVAL(JS_TRUE)  
   
 /*  
259   * Microseconds since the epoch, midnight, January 1, 1970 UTC.  See the   * Microseconds since the epoch, midnight, January 1, 1970 UTC.  See the
260   * comment in jstypes.h regarding safe int64 usage.   * comment in jstypes.h regarding safe int64 usage.
261   */   */
# Line 564  Line 629 
629                                                     not backward compatible with                                                     not backward compatible with
630                                                     the comment-hiding hack used                                                     the comment-hiding hack used
631                                                     in HTML script tags. */                                                     in HTML script tags. */
 #define JSOPTION_NATIVE_BRANCH_CALLBACK \  
                                 JS_BIT(7)       /* the branch callback set by  
                                                    JS_SetBranchCallback may be  
                                                    called with a null script  
                                                    parameter, by native code  
                                                    that loops intensively.  
                                                    Deprecated, use  
                                                    JS_SetOperationCallback  
                                                    instead */  
632  #define JSOPTION_DONT_REPORT_UNCAUGHT \  #define JSOPTION_DONT_REPORT_UNCAUGHT \
633                                  JS_BIT(8)       /* When returning from the                                  JS_BIT(8)       /* When returning from the
634                                                     outermost API call, prevent                                                     outermost API call, prevent
# Line 595  Line 651 
651                                                     that a null rval out-param                                                     that a null rval out-param
652                                                     will be passed to each call                                                     will be passed to each call
653                                                     to JS_ExecuteScript. */                                                     to JS_ExecuteScript. */
654    #define JSOPTION_UNROOTED_GLOBAL JS_BIT(13)     /* The GC will not root the
655                                                       contexts' global objects
656                                                       (see JS_GetGlobalObject),
657                                                       leaving that up to the
658                                                       embedding. */
659    
660  extern JS_PUBLIC_API(uint32)  extern JS_PUBLIC_API(uint32)
661  JS_GetOptions(JSContext *cx);  JS_GetOptions(JSContext *cx);
# Line 954  Line 1015 
1015  #define JSVAL_TO_TRACEABLE(v)   (JSVAL_TO_GCTHING(v))  #define JSVAL_TO_TRACEABLE(v)   (JSVAL_TO_GCTHING(v))
1016  #define JSVAL_TRACE_KIND(v)     (JSVAL_TAG(v) >> 1)  #define JSVAL_TRACE_KIND(v)     (JSVAL_TAG(v) >> 1)
1017    
 JS_STATIC_ASSERT(JSVAL_TRACE_KIND(JSVAL_OBJECT) == JSTRACE_OBJECT);  
 JS_STATIC_ASSERT(JSVAL_TRACE_KIND(JSVAL_DOUBLE) == JSTRACE_DOUBLE);  
 JS_STATIC_ASSERT(JSVAL_TRACE_KIND(JSVAL_STRING) == JSTRACE_STRING);  
   
1018  struct JSTracer {  struct JSTracer {
1019      JSContext           *context;      JSContext           *context;
1020      JSTraceCallback     callback;      JSTraceCallback     callback;
# Line 1134  Line 1191 
1191      JSGC_MAX_MALLOC_BYTES   = 1,      JSGC_MAX_MALLOC_BYTES   = 1,
1192    
1193      /* Hoard stackPools for this long, in ms, default is 30 seconds. */      /* Hoard stackPools for this long, in ms, default is 30 seconds. */
1194      JSGC_STACKPOOL_LIFESPAN = 2      JSGC_STACKPOOL_LIFESPAN = 2,
1195    
1196        /*
1197         * The factor that defines when the GC is invoked. The factor is a
1198         * percent of the memory allocated by the GC after the last run of
1199         * the GC. When the current memory allocated by the GC is more than
1200         * this percent then the GC is invoked. The factor cannot be less
1201         * than 100 since the current memory allocated by the GC cannot be less
1202         * than the memory allocated after the last run of the GC.
1203         */
1204        JSGC_TRIGGER_FACTOR = 3,
1205    
1206        /* Amount of bytes allocated by the GC. */
1207        JSGC_BYTES = 4,
1208    
1209        /* Number of times when GC was invoked. */
1210        JSGC_NUMBER = 5,
1211    
1212        /* Max size of the code cache in bytes. */
1213        JSGC_MAX_CODE_CACHE_BYTES = 6
1214  } JSGCParamKey;  } JSGCParamKey;
1215    
1216  extern JS_PUBLIC_API(void)  extern JS_PUBLIC_API(void)
1217  JS_SetGCParameter(JSRuntime *rt, JSGCParamKey key, uint32 value);  JS_SetGCParameter(JSRuntime *rt, JSGCParamKey key, uint32 value);
1218    
1219    extern JS_PUBLIC_API(uint32)
1220    JS_GetGCParameter(JSRuntime *rt, JSGCParamKey key);
1221    
1222    extern JS_PUBLIC_API(void)
1223    JS_SetGCParameterForThread(JSContext *cx, JSGCParamKey key, uint32 value);
1224    
1225    extern JS_PUBLIC_API(uint32)
1226    JS_GetGCParameterForThread(JSContext *cx, JSGCParamKey key);
1227    
1228  /*  /*
1229   * Add a finalizer for external strings created by JS_NewExternalString (see   * Add a finalizer for external strings created by JS_NewExternalString (see
1230   * below) using a type-code returned from this function, and that understands   * below) using a type-code returned from this function, and that understands
# Line 1323  Line 1408 
1408  #define JSCLASS_NO_OPTIONAL_MEMBERS     0,0,0,0,0,0,0,0  #define JSCLASS_NO_OPTIONAL_MEMBERS     0,0,0,0,0,0,0,0
1409  #define JSCLASS_NO_RESERVED_MEMBERS     0,0,0  #define JSCLASS_NO_RESERVED_MEMBERS     0,0,0
1410    
 /* For detailed comments on these function pointer types, see jspubtd.h. */  
 struct JSObjectOps {  
     /* Mandatory non-null function pointer members. */  
     JSNewObjectMapOp    newObjectMap;  
     JSObjectMapOp       destroyObjectMap;  
     JSLookupPropOp      lookupProperty;  
     JSDefinePropOp      defineProperty;  
     JSPropertyIdOp      getProperty;  
     JSPropertyIdOp      setProperty;  
     JSAttributesOp      getAttributes;  
     JSAttributesOp      setAttributes;  
     JSPropertyIdOp      deleteProperty;  
     JSConvertOp         defaultValue;  
     JSNewEnumerateOp    enumerate;  
     JSCheckAccessIdOp   checkAccess;  
   
     /* Optionally non-null members start here. */  
     JSObjectOp          thisObject;  
     JSPropertyRefOp     dropProperty;  
     JSNative            call;  
     JSNative            construct;  
     JSXDRObjectOp       xdrObject;  
     JSHasInstanceOp     hasInstance;  
     JSSetObjectSlotOp   setProto;  
     JSSetObjectSlotOp   setParent;  
     JSTraceOp           trace;  
     JSFinalizeOp        clear;  
     JSGetRequiredSlotOp getRequiredSlot;  
     JSSetRequiredSlotOp setRequiredSlot;  
 };  
   
 struct JSXMLObjectOps {  
     JSObjectOps         base;  
     JSGetMethodOp       getMethod;  
     JSSetMethodOp       setMethod;  
     JSEnumerateValuesOp enumerateValues;  
     JSEqualityOp        equality;  
     JSConcatenateOp     concatenate;  
 };  
   
 /*  
  * Classes that expose JSObjectOps via a non-null getObjectOps class hook may  
  * derive a property structure from this struct, return a pointer to it from  
  * lookupProperty and defineProperty, and use the pointer to avoid rehashing  
  * in getAttributes and setAttributes.  
  *  
  * The jsid type contains either an int jsval (see JSVAL_IS_INT above), or an  
  * internal pointer that is opaque to users of this API, but which users may  
  * convert from and to a jsval using JS_ValueToId and JS_IdToValue.  
  */  
 struct JSProperty {  
     jsid id;  
 };  
   
1411  struct JSIdArray {  struct JSIdArray {
1412      jsint length;      jsint length;
1413      jsid  vector[1];    /* actually, length jsid words */      jsid  vector[1];    /* actually, length jsid words */
# Line 1406  Line 1437 
1437  #define JSRESOLVE_DETECTING     0x04    /* 'if (o.p)...' or '(o.p) ?...:...' */  #define JSRESOLVE_DETECTING     0x04    /* 'if (o.p)...' or '(o.p) ?...:...' */
1438  #define JSRESOLVE_DECLARING     0x08    /* var, const, or function prolog op */  #define JSRESOLVE_DECLARING     0x08    /* var, const, or function prolog op */
1439  #define JSRESOLVE_CLASSNAME     0x10    /* class name used when constructing */  #define JSRESOLVE_CLASSNAME     0x10    /* class name used when constructing */
1440    #define JSRESOLVE_WITH          0x20    /* resolve inside a with statement */
1441    
1442  extern JS_PUBLIC_API(JSBool)  extern JS_PUBLIC_API(JSBool)
1443  JS_PropertyStub(JSContext *cx, JSObject *obj, jsval id, jsval *vp);  JS_PropertyStub(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
# Line 1477  Line 1509 
1509   * frame when activated.   * frame when activated.
1510   */   */
1511  #define JS_FN(name,fastcall,nargs,flags)                                      \  #define JS_FN(name,fastcall,nargs,flags)                                      \
1512      {name, (JSNative)(fastcall), nargs,                                       \      JS_FS(name, (JSNative)(fastcall), nargs,                                  \
1513       (flags) | JSFUN_FAST_NATIVE | JSFUN_STUB_GSOPS, 0}            (flags) | JSFUN_FAST_NATIVE | JSFUN_STUB_GSOPS, 0)
1514    
1515  extern JS_PUBLIC_API(JSObject *)  extern JS_PUBLIC_API(JSObject *)
1516  JS_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto,  JS_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto,
# Line 1599  Line 1631 
1631                                     JSPropertyOp *getterp,                                     JSPropertyOp *getterp,
1632                                     JSPropertyOp *setterp);                                     JSPropertyOp *setterp);
1633    
1634    extern JS_PUBLIC_API(JSBool)
1635    JS_GetPropertyAttrsGetterAndSetterById(JSContext *cx, JSObject *obj,
1636                                           jsid id,
1637                                           uintN *attrsp, JSBool *foundp,
1638                                           JSPropertyOp *getterp,
1639                                           JSPropertyOp *setterp);
1640    
1641  /*  /*
1642   * Set the attributes of a property on a given object.   * Set the attributes of a property on a given object.
1643   *   *
# Line 1647  Line 1686 
1686  JS_LookupPropertyWithFlagsById(JSContext *cx, JSObject *obj, jsid id,  JS_LookupPropertyWithFlagsById(JSContext *cx, JSObject *obj, jsid id,
1687                                 uintN flags, JSObject **objp, jsval *vp);                                 uintN flags, JSObject **objp, jsval *vp);
1688    
1689    struct JSPropertyDescriptor {
1690        JSObject     *obj;
1691        uintN        attrs;
1692        JSPropertyOp getter;
1693        JSPropertyOp setter;
1694        jsval        value;
1695    };
1696    
1697    /*
1698     * Like JS_GetPropertyAttrsGetterAndSetterById but will return a property on
1699     * an object on the prototype chain (returned in objp). If data->obj is null,
1700     * then this property was not found on the prototype chain.
1701     */
1702    extern JS_PUBLIC_API(JSBool)
1703    JS_GetPropertyDescriptorById(JSContext *cx, JSObject *obj, jsid id, uintN flags,
1704                                 JSPropertyDescriptor *desc);
1705    
1706  extern JS_PUBLIC_API(JSBool)  extern JS_PUBLIC_API(JSBool)
1707  JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp);  JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp);
1708    
# Line 2167  Line 2223 
2223                       jsval *argv, jsval *rval);                       jsval *argv, jsval *rval);
2224    
2225  /*  /*
2226   * The maximum value of the operation limit to pass to JS_SetOperationCallback   * These functions allow setting an operation callback that will be called
2227   * and JS_SetOperationLimit.   * from the thread the context is associated with some time after any thread
2228     * triggered the callback using JS_TriggerOperationCallback(cx).
2229     *
2230     * In a threadsafe build the engine internally triggers operation callbacks
2231     * under certain circumstances (i.e. GC and title transfer) to force the
2232     * context to yield its current request, which the engine always
2233     * automatically does immediately prior to calling the callback function.
2234     * The embedding should thus not rely on callbacks being triggered through
2235     * the external API only.
2236     *
2237     * Important note: Additional callbacks can occur inside the callback handler
2238     * if it re-enters the JS engine. The embedding must ensure that the callback
2239     * is disconnected before attempting such re-entry.
2240   */   */
 #define JS_MAX_OPERATION_LIMIT ((uint32) 0x7FFFFFFF)  
   
 #define JS_OPERATION_WEIGHT_BASE 4096  
2241    
2242  /*  extern JS_PUBLIC_API(JSOperationCallback)
2243   * Set the operation callback that the engine calls periodically after  JS_SetOperationCallback(JSContext *cx, JSOperationCallback callback);
  * the internal operation count reaches the specified limit.  
  *  
  * When operationLimit is JS_OPERATION_WEIGHT_BASE, the callback will be  
  * called at least after each backward jump in the interpreter. To minimize  
  * the overhead of the callback invocation we suggest at least  
  *  
  *   100 * JS_OPERATION_WEIGHT_BASE  
  *  
  * as a value for operationLimit.  
  */  
 extern JS_PUBLIC_API(void)  
 JS_SetOperationCallback(JSContext *cx, JSOperationCallback callback,  
                         uint32 operationLimit);  
   
 extern JS_PUBLIC_API(void)  
 JS_ClearOperationCallback(JSContext *cx);  
2244    
2245  extern JS_PUBLIC_API(JSOperationCallback)  extern JS_PUBLIC_API(JSOperationCallback)
2246  JS_GetOperationCallback(JSContext *cx);  JS_GetOperationCallback(JSContext *cx);
2247    
 /*  
  * Get the operation limit associated with the operation callback. This API  
  * function may be called only when the result of JS_GetOperationCallback(cx)  
  * is not null.  
  */  
 extern JS_PUBLIC_API(uint32)  
 JS_GetOperationLimit(JSContext *cx);  
   
 /*  
  * Change the operation limit associated with the operation callback. This API  
  * function may be called only when the result of JS_GetOperationCallback(cx)  
  * is not null.  
  */  
2248  extern JS_PUBLIC_API(void)  extern JS_PUBLIC_API(void)
2249  JS_SetOperationLimit(JSContext *cx, uint32 operationLimit);  JS_TriggerOperationCallback(JSContext *cx);
2250    
2251  /*  extern JS_PUBLIC_API(void)
2252   * Note well: JS_SetBranchCallback is deprecated. It is similar to  JS_TriggerAllOperationCallbacks(JSRuntime *rt);
  *  
  *   JS_SetOperationCallback(cx, callback, 4096, NULL);  
  *  
  * except that the callback will not be called from a long-running native  
  * function when JSOPTION_NATIVE_BRANCH_CALLBACK is not set and the top-most  
  * frame is native.  
  */  
 extern JS_PUBLIC_API(JSBranchCallback)  
 JS_SetBranchCallback(JSContext *cx, JSBranchCallback cb);  
2253    
2254  extern JS_PUBLIC_API(JSBool)  extern JS_PUBLIC_API(JSBool)
2255  JS_IsRunning(JSContext *cx);  JS_IsRunning(JSContext *cx);
# Line 2431  Line 2458 
2458  typedef JSBool (* JSONWriteCallback)(const jschar *buf, uint32 len, void *data);  typedef JSBool (* JSONWriteCallback)(const jschar *buf, uint32 len, void *data);
2459    
2460  /*  /*
2461   * JSON.stringify as specificed by ES3.1 (draft)   * JSON.stringify as specified by ES3.1 (draft)
2462   */   */
2463  JS_PUBLIC_API(JSBool)  JS_PUBLIC_API(JSBool)
2464  JS_Stringify(JSContext *cx, jsval *vp, JSObject *replacer,  JS_Stringify(JSContext *cx, jsval *vp, JSObject *replacer, jsval space,
2465               JSONWriteCallback callback, void *data);               JSONWriteCallback callback, void *data);
2466    
2467  /*  /*
# Line 2444  Line 2471 
2471  JS_TryJSON(JSContext *cx, jsval *vp);  JS_TryJSON(JSContext *cx, jsval *vp);
2472    
2473  /*  /*
2474   * JSON.parse as specificed by ES3.1 (draft)   * JSON.parse as specified by ES3.1 (draft)
2475   */   */
2476  JS_PUBLIC_API(JSONParser *)  JS_PUBLIC_API(JSONParser *)
2477  JS_BeginJSONParse(JSContext *cx, jsval *vp);  JS_BeginJSONParse(JSContext *cx, jsval *vp);
# Line 2453  Line 2480 
2480  JS_ConsumeJSONText(JSContext *cx, JSONParser *jp, const jschar *data, uint32 len);  JS_ConsumeJSONText(JSContext *cx, JSONParser *jp, const jschar *data, uint32 len);
2481    
2482  JS_PUBLIC_API(JSBool)  JS_PUBLIC_API(JSBool)
2483  JS_FinishJSONParse(JSContext *cx, JSONParser *jp);  JS_FinishJSONParse(JSContext *cx, JSONParser *jp, jsval reviver);
2484    
2485  /************************************************************************/  /************************************************************************/
2486    
# Line 2586  Line 2613 
2613  #define JSREG_GLOB      0x02    /* global exec, creates array of matches */  #define JSREG_GLOB      0x02    /* global exec, creates array of matches */
2614  #define JSREG_MULTILINE 0x04    /* treat ^ and $ as begin and end of line */  #define JSREG_MULTILINE 0x04    /* treat ^ and $ as begin and end of line */
2615  #define JSREG_STICKY    0x08    /* only match starting at lastIndex */  #define JSREG_STICKY    0x08    /* only match starting at lastIndex */
2616    #define JSREG_FLAT      0x10    /* parse as a flat regexp */
2617    
2618  extern JS_PUBLIC_API(JSObject *)  extern JS_PUBLIC_API(JSObject *)
2619  JS_NewRegExpObject(JSContext *cx, char *bytes, size_t length, uintN flags);  JS_NewRegExpObject(JSContext *cx, char *bytes, size_t length, uintN flags);

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

  ViewVC Help
Powered by ViewVC 1.1.24