Annotation of sbbs/javascript/include/mozilla/js/jspubtd.h, revision 1.1.1.1

1.1       root        1: /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
                      2:  *
                      3:  * The contents of this file are subject to the Netscape Public
                      4:  * License Version 1.1 (the "License"); you may not use this file
                      5:  * except in compliance with the License. You may obtain a copy of
                      6:  * the License at http://www.mozilla.org/NPL/
                      7:  *
                      8:  * Software distributed under the License is distributed on an "AS
                      9:  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
                     10:  * implied. See the License for the specific language governing
                     11:  * rights and limitations under the License.
                     12:  *
                     13:  * The Original Code is Mozilla Communicator client code, released
                     14:  * March 31, 1998.
                     15:  *
                     16:  * The Initial Developer of the Original Code is Netscape
                     17:  * Communications Corporation.  Portions created by Netscape are
                     18:  * Copyright (C) 1998 Netscape Communications Corporation. All
                     19:  * Rights Reserved.
                     20:  *
                     21:  * Contributor(s): 
                     22:  *
                     23:  * Alternatively, the contents of this file may be used under the
                     24:  * terms of the GNU Public License (the "GPL"), in which case the
                     25:  * provisions of the GPL are applicable instead of those above.
                     26:  * If you wish to allow use of your version of this file only
                     27:  * under the terms of the GPL and not to allow others to use your
                     28:  * version of this file under the NPL, indicate your decision by
                     29:  * deleting the provisions above and replace them with the notice
                     30:  * and other provisions required by the GPL.  If you do not delete
                     31:  * the provisions above, a recipient may use your version of this
                     32:  * file under either the NPL or the GPL.
                     33:  */
                     34: 
                     35: #ifndef jspubtd_h___
                     36: #define jspubtd_h___
                     37: /*
                     38:  * JS public API typedefs.
                     39:  */
                     40: #include "jstypes.h"
                     41: #include "jscompat.h"
                     42: 
                     43: JS_BEGIN_EXTERN_C
                     44: 
                     45: /* Scalar typedefs. */
                     46: typedef uint16    jschar;
                     47: typedef int32     jsint;
                     48: typedef uint32    jsuint;
                     49: typedef float64   jsdouble;
                     50: typedef jsword    jsval;
                     51: typedef jsword    jsid;
                     52: typedef int32     jsrefcount;   /* PRInt32 if JS_THREADSAFE, see jslock.h */
                     53: 
                     54: /*
                     55:  * Run-time version enumeration.  See jsconfig.h for compile-time counterparts
                     56:  * to these values that may be selected by the JS_VERSION macro, and tested by
                     57:  * #if expressions.
                     58:  */
                     59: typedef enum JSVersion {
                     60:     JSVERSION_1_0     = 100,
                     61:     JSVERSION_1_1     = 110,
                     62:     JSVERSION_1_2     = 120,
                     63:     JSVERSION_1_3     = 130,
                     64:     JSVERSION_1_4     = 140,
                     65:     JSVERSION_ECMA_3  = 148,
                     66:     JSVERSION_1_5     = 150,
                     67:     JSVERSION_DEFAULT = 0,
                     68:     JSVERSION_UNKNOWN = -1
                     69: } JSVersion;
                     70: 
                     71: #define JSVERSION_IS_ECMA(version) \
                     72:     ((version) == JSVERSION_DEFAULT || (version) >= JSVERSION_1_3)
                     73: 
                     74: /* Result of typeof operator enumeration. */
                     75: typedef enum JSType {
                     76:     JSTYPE_VOID,                /* undefined */
                     77:     JSTYPE_OBJECT,              /* object */
                     78:     JSTYPE_FUNCTION,            /* function */
                     79:     JSTYPE_STRING,              /* string */
                     80:     JSTYPE_NUMBER,              /* number */
                     81:     JSTYPE_BOOLEAN,             /* boolean */
                     82:     JSTYPE_LIMIT
                     83: } JSType;
                     84: 
                     85: /* JSObjectOps.checkAccess mode enumeration. */
                     86: typedef enum JSAccessMode {
                     87:     JSACC_PROTO  = 0,           /* XXXbe redundant w.r.t. id */
                     88:     JSACC_PARENT = 1,           /* XXXbe redundant w.r.t. id */
                     89:     JSACC_IMPORT = 2,           /* import foo.bar */
                     90:     JSACC_WATCH  = 3,           /* a watchpoint on object foo for id 'bar' */
                     91:     JSACC_READ   = 4,           /* a "get" of foo.bar */
                     92:     JSACC_WRITE  = 8,           /* a "set" of foo.bar = baz */
                     93:     JSACC_LIMIT
                     94: } JSAccessMode;
                     95: 
                     96: #define JSACC_TYPEMASK          (JSACC_WRITE - 1)
                     97: 
                     98: /*
                     99:  * This enum type is used to control the behavior of a JSObject property
                    100:  * iterator function that has type JSNewEnumerate.
                    101:  */
                    102: typedef enum JSIterateOp {
                    103:     JSENUMERATE_INIT,       /* Create new iterator state */
                    104:     JSENUMERATE_NEXT,       /* Iterate once */
                    105:     JSENUMERATE_DESTROY     /* Destroy iterator state */
                    106: } JSIterateOp;
                    107: 
                    108: /* Struct typedefs. */
                    109: typedef struct JSClass           JSClass;
                    110: typedef struct JSConstDoubleSpec JSConstDoubleSpec;
                    111: typedef struct JSContext         JSContext;
                    112: typedef struct JSErrorReport     JSErrorReport;
                    113: typedef struct JSFunction        JSFunction;
                    114: typedef struct JSFunctionSpec    JSFunctionSpec;
                    115: typedef struct JSIdArray         JSIdArray;
                    116: typedef struct JSProperty        JSProperty;
                    117: typedef struct JSPropertySpec    JSPropertySpec;
                    118: typedef struct JSObject          JSObject;
                    119: typedef struct JSObjectMap       JSObjectMap;
                    120: typedef struct JSObjectOps       JSObjectOps;
                    121: typedef struct JSRuntime         JSRuntime;
                    122: typedef struct JSRuntime         JSTaskState;  /* XXX deprecated name */
                    123: typedef struct JSScript          JSScript;
                    124: typedef struct JSString          JSString;
                    125: typedef struct JSXDRState       JSXDRState;
                    126: typedef struct JSExceptionState  JSExceptionState;
                    127: typedef struct JSLocaleCallbacks JSLocaleCallbacks;
                    128: 
                    129: /* JSClass (and JSObjectOps where appropriate) function pointer typedefs. */
                    130: 
                    131: /*
                    132:  * Add, delete, get or set a property named by id in obj.  Note the jsval id
                    133:  * type -- id may be a string (Unicode property identifier) or an int (element
                    134:  * index).  The *vp out parameter, on success, is the new property value after
                    135:  * an add, get, or set.  After a successful delete, *vp is JSVAL_FALSE iff
                    136:  * obj[id] can't be deleted (because it's permanent).
                    137:  */
                    138: typedef JSBool
                    139: (* JS_DLL_CALLBACK JSPropertyOp)(JSContext *cx, JSObject *obj, jsval id,
                    140:                                  jsval *vp);
                    141: 
                    142: /*
                    143:  * This function type is used for callbacks that enumerate the properties of
                    144:  * a JSObject.  The behavior depends on the value of enum_op:
                    145:  *
                    146:  *  JSENUMERATE_INIT
                    147:  *    A new, opaque iterator state should be allocated and stored in *statep.
                    148:  *    (You can use PRIVATE_TO_JSVAL() to tag the pointer to be stored).
                    149:  *
                    150:  *    The number of properties that will be enumerated should be returned as
                    151:  *    an integer jsval in *idp, if idp is non-null, and provided the number of
                    152:  *    enumerable properties is known.  If idp is non-null and the number of
                    153:  *    enumerable properties can't be computed in advance, *idp should be set
                    154:  *    to JSVAL_ZERO.
                    155:  *
                    156:  *  JSENUMERATE_NEXT
                    157:  *    A previously allocated opaque iterator state is passed in via statep.
                    158:  *    Return the next jsid in the iteration using *idp.  The opaque iterator
                    159:  *    state pointed at by statep is destroyed and *statep is set to JSVAL_NULL
                    160:  *    if there are no properties left to enumerate.
                    161:  *
                    162:  *  JSENUMERATE_DESTROY
                    163:  *    Destroy the opaque iterator state previously allocated in *statep by a
                    164:  *    call to this function when enum_op was JSENUMERATE_INIT.
                    165:  *
                    166:  * The return value is used to indicate success, with a value of JS_FALSE
                    167:  * indicating failure.
                    168:  */
                    169: typedef JSBool
                    170: (* JS_DLL_CALLBACK JSNewEnumerateOp)(JSContext *cx, JSObject *obj,
                    171:                                      JSIterateOp enum_op,
                    172:                                      jsval *statep, jsid *idp);
                    173: 
                    174: /*
                    175:  * The old-style JSClass.enumerate op should define all lazy properties not
                    176:  * yet reflected in obj.
                    177:  */
                    178: typedef JSBool
                    179: (* JS_DLL_CALLBACK JSEnumerateOp)(JSContext *cx, JSObject *obj);
                    180: 
                    181: /*
                    182:  * Resolve a lazy property named by id in obj by defining it directly in obj.
                    183:  * Lazy properties are those reflected from some peer native property space
                    184:  * (e.g., the DOM attributes for a given node reflected as obj) on demand.
                    185:  *
                    186:  * JS looks for a property in an object, and if not found, tries to resolve
                    187:  * the given id.  If resolve succeeds, the engine looks again in case resolve
                    188:  * defined obj[id].  If no such property exists directly in obj, the process
                    189:  * is repeated with obj's prototype, etc.
                    190:  *
                    191:  * NB: JSNewResolveOp provides a cheaper way to resolve lazy properties.
                    192:  */
                    193: typedef JSBool
                    194: (* JS_DLL_CALLBACK JSResolveOp)(JSContext *cx, JSObject *obj, jsval id);
                    195: 
                    196: /*
                    197:  * Like JSResolveOp, but flags provide contextual information as follows:
                    198:  *
                    199:  *  JSRESOLVE_QUALIFIED   a qualified property id: obj.id or obj[id], not id
                    200:  *  JSRESOLVE_ASSIGNING   obj[id] is on the left-hand side of an assignment
                    201:  *
                    202:  * The *objp out parameter, on success, should be null to indicate that id
                    203:  * was not resolved; and non-null, referring to obj or one of its prototypes,
                    204:  * if id was resolved.
                    205:  *
                    206:  * This hook instead of JSResolveOp is called via the JSClass.resolve member
                    207:  * if JSCLASS_NEW_RESOLVE is set in JSClass.flags.
                    208:  *
                    209:  * Setting JSCLASS_NEW_RESOLVE and JSCLASS_NEW_RESOLVE_GETS_START further
                    210:  * extends this hook by passing in the starting object on the prototype chain
                    211:  * via *objp.  Thus a resolve hook implementation may define the property id
                    212:  * being resolved in the object in which the id was first sought, rather than
                    213:  * in a prototype object whose class led to the resolve hook being called.
                    214:  *
                    215:  * When using JSCLASS_NEW_RESOLVE_GETS_START, the resolve hook must therefore
                    216:  * null *objp to signify "not resolved".  With only JSCLASS_NEW_RESOLVE and no
                    217:  * JSCLASS_NEW_RESOLVE_GETS_START, the hook can assume *objp is null on entry.
                    218:  * This is not good practice, but enough existing hook implementations count
                    219:  * on it that we can't break compatibility by passing the starting object in
                    220:  * *objp without a new JSClass flag.
                    221:  */
                    222: typedef JSBool
                    223: (* JS_DLL_CALLBACK JSNewResolveOp)(JSContext *cx, JSObject *obj, jsval id,
                    224:                                    uintN flags, JSObject **objp);
                    225: 
                    226: /*
                    227:  * Convert obj to the given type, returning true with the resulting value in
                    228:  * *vp on success, and returning false on error or exception.
                    229:  */
                    230: typedef JSBool
                    231: (* JS_DLL_CALLBACK JSConvertOp)(JSContext *cx, JSObject *obj, JSType type,
                    232:                                 jsval *vp);
                    233: 
                    234: /*
                    235:  * Finalize obj, which the garbage collector has determined to be unreachable
                    236:  * from other live objects or from GC roots.  Obviously, finalizers must never
                    237:  * store a reference to obj.
                    238:  */
                    239: typedef void
                    240: (* JS_DLL_CALLBACK JSFinalizeOp)(JSContext *cx, JSObject *obj);
                    241: 
                    242: /*
                    243:  * Used by JS_AddExternalStringFinalizer and JS_RemoveExternalStringFinalizer
                    244:  * to extend and reduce the set of string types finalized by the GC.
                    245:  */
                    246: typedef void
                    247: (* JS_DLL_CALLBACK JSStringFinalizeOp)(JSContext *cx, JSString *str);
                    248: 
                    249: /*
                    250:  * The signature for JSClass.getObjectOps, used by JS_NewObject's internals
                    251:  * to discover the set of high-level object operations to use for new objects
                    252:  * of the given class.  All native objects have a JSClass, which is stored as
                    253:  * a private (int-tagged) pointer in obj->slots[JSSLOT_CLASS].  In contrast,
                    254:  * all native and host objects have a JSObjectMap at obj->map, which may be
                    255:  * shared among a number of objects, and which contains the JSObjectOps *ops
                    256:  * pointer used to dispatch object operations from API calls.
                    257:  *
                    258:  * Thus JSClass (which pre-dates JSObjectOps in the API) provides a low-level
                    259:  * interface to class-specific code and data, while JSObjectOps allows for a
                    260:  * higher level of operation, which does not use the object's class except to
                    261:  * find the class's JSObjectOps struct, by calling clasp->getObjectOps.
                    262:  *
                    263:  * If this seems backwards, that's because it is!  API compatibility requires
                    264:  * a JSClass *clasp parameter to JS_NewObject, etc.  Most host objects do not
                    265:  * need to implement the larger JSObjectOps, and can share the common JSScope
                    266:  * code and data used by the native (js_ObjectOps, see jsobj.c) ops.
                    267:  */
                    268: typedef JSObjectOps *
                    269: (* JS_DLL_CALLBACK JSGetObjectOps)(JSContext *cx, JSClass *clasp);
                    270: 
                    271: /*
                    272:  * JSClass.checkAccess type: check whether obj[id] may be accessed per mode,
                    273:  * returning false on error/exception, true on success with obj[id]'s last-got
                    274:  * value in *vp, and its attributes in *attrsp.  As for JSPropertyOp above, id
                    275:  * is either a string or an int jsval.
                    276:  *
                    277:  * See JSCheckAccessIdOp, below, for the JSObjectOps counterpart, which takes
                    278:  * a jsid (a tagged int or aligned, unique identifier pointer) rather than a
                    279:  * jsval.  The native js_ObjectOps.checkAccess simply forwards to the object's
                    280:  * clasp->checkAccess, so that both JSClass and JSObjectOps implementors may
                    281:  * specialize access checks.
                    282:  */
                    283: typedef JSBool
                    284: (* JS_DLL_CALLBACK JSCheckAccessOp)(JSContext *cx, JSObject *obj, jsval id,
                    285:                                     JSAccessMode mode, jsval *vp);
                    286: 
                    287: /*
                    288:  * Encode or decode an object, given an XDR state record representing external
                    289:  * data.  See jsxdrapi.h.
                    290:  */
                    291: typedef JSBool
                    292: (* JS_DLL_CALLBACK JSXDRObjectOp)(JSXDRState *xdr, JSObject **objp);
                    293: 
                    294: /*
                    295:  * Check whether v is an instance of obj.  Return false on error or exception,
                    296:  * true on success with JS_TRUE in *bp if v is an instance of obj, JS_FALSE in
                    297:  * *bp otherwise.
                    298:  */
                    299: typedef JSBool
                    300: (* JS_DLL_CALLBACK JSHasInstanceOp)(JSContext *cx, JSObject *obj, jsval v,
                    301:                                     JSBool *bp);
                    302: 
                    303: /*
                    304:  * Function type for JSClass.mark and JSObjectOps.mark, called from the GC to
                    305:  * scan live GC-things reachable from obj's private data structure.  For each
                    306:  * such thing, a mark implementation must call
                    307:  *
                    308:  *    JS_MarkGCThing(cx, thing, name, arg);
                    309:  *
                    310:  * The trailing name and arg parameters are used for GC_MARK_DEBUG-mode heap
                    311:  * dumping and ref-path tracing.  The mark function should pass a (typically
                    312:  * literal) string naming the private data member for name, and it must pass
                    313:  * the opaque arg parameter through from its caller.
                    314:  *
                    315:  * For the JSObjectOps.mark hook, the return value is the number of slots at
                    316:  * obj->slots to scan.  For JSClass.mark, the return value is ignored.
                    317:  *
                    318:  * NB: JSMarkOp implementations cannot allocate new GC-things (JS_NewObject
                    319:  * called from a mark function will fail silently, e.g.).
                    320:  */
                    321: typedef uint32
                    322: (* JS_DLL_CALLBACK JSMarkOp)(JSContext *cx, JSObject *obj, void *arg);
                    323: 
                    324: /* JSObjectOps function pointer typedefs. */
                    325: 
                    326: /*
                    327:  * Create a new subclass of JSObjectMap (see jsobj.h), with the nrefs and ops
                    328:  * members initialized from the same-named parameters, and with the nslots and
                    329:  * freeslot members initialized according to ops and clasp.  Return null on
                    330:  * error, non-null on success.
                    331:  *
                    332:  * JSObjectMaps are reference-counted by generic code in the engine.  Usually,
                    333:  * the nrefs parameter to JSObjectOps.newObjectMap will be 1, to count the ref
                    334:  * returned to the caller on success.  After a successful construction, some
                    335:  * number of js_HoldObjectMap and js_DropObjectMap calls ensue.  When nrefs
                    336:  * reaches 0 due to a js_DropObjectMap call, JSObjectOps.destroyObjectMap will
                    337:  * be called to dispose of the map.
                    338:  */
                    339: typedef JSObjectMap *
                    340: (* JS_DLL_CALLBACK JSNewObjectMapOp)(JSContext *cx, jsrefcount nrefs,
                    341:                                      JSObjectOps *ops, JSClass *clasp,
                    342:                                      JSObject *obj);
                    343: 
                    344: /*
                    345:  * Generic type for an infallible JSObjectMap operation, used currently by
                    346:  * JSObjectOps.destroyObjectMap.
                    347:  */
                    348: typedef void
                    349: (* JS_DLL_CALLBACK JSObjectMapOp)(JSContext *cx, JSObjectMap *map);
                    350: 
                    351: /*
                    352:  * Look for id in obj and its prototype chain, returning false on error or
                    353:  * exception, true on success.  On success, return null in *propp if id was
                    354:  * not found.  If id was found, return the first object searching from obj
                    355:  * along its prototype chain in which id names a direct property in *objp, and
                    356:  * return a non-null, opaque property pointer in *propp.
                    357:  *
                    358:  * If JSLookupPropOp succeeds and returns with *propp non-null, that pointer
                    359:  * may be passed as the prop parameter to a JSAttributesOp, as a short-cut
                    360:  * that bypasses id re-lookup.  In any case, a non-null *propp result after a
                    361:  * successful lookup must be dropped via JSObjectOps.dropProperty.
                    362:  *
                    363:  * NB: successful return with non-null *propp means the implementation may
                    364:  * have locked *objp and added a reference count associated with *propp, so
                    365:  * callers should not risk deadlock by nesting or interleaving other lookups
                    366:  * or any obj-bearing ops before dropping *propp.
                    367:  */
                    368: typedef JSBool
                    369: (* JS_DLL_CALLBACK JSLookupPropOp)(JSContext *cx, JSObject *obj, jsid id,
                    370:                                    JSObject **objp, JSProperty **propp
                    371: #if defined JS_THREADSAFE && defined DEBUG
                    372:                                  , const char *file, uintN line
                    373: #endif
                    374:                                   );
                    375: 
                    376: /*
                    377:  * Define obj[id], a direct property of obj named id, having the given initial
                    378:  * value, with the specified getter, setter, and attributes.  If the propp out
                    379:  * param is non-null, *propp on successful return contains an opaque property
                    380:  * pointer usable as a speedup hint with JSAttributesOp.  But note that propp
                    381:  * may be null, indicating that the caller is not interested in recovering an
                    382:  * opaque pointer to the newly-defined property.
                    383:  *
                    384:  * If propp is non-null and JSDefinePropOp succeeds, its caller must be sure
                    385:  * to drop *propp using JSObjectOps.dropProperty in short order, just as with
                    386:  * JSLookupPropOp.
                    387:  */
                    388: typedef JSBool
                    389: (* JS_DLL_CALLBACK JSDefinePropOp)(JSContext *cx, JSObject *obj,
                    390:                                    jsid id, jsval value,
                    391:                                    JSPropertyOp getter, JSPropertyOp setter,
                    392:                                    uintN attrs, JSProperty **propp);
                    393: 
                    394: /*
                    395:  * Get, set, or delete obj[id], returning false on error or exception, true
                    396:  * on success.  If getting or setting, the new value is returned in *vp on
                    397:  * success.  If deleting without error, *vp will be JSVAL_FALSE if obj[id] is
                    398:  * permanent, and JSVAL_TRUE if id named a direct property of obj that was in
                    399:  * fact deleted, or if id names no direct property of obj (id could name a
                    400:  * prototype property, or no property in obj or its prototype chain).
                    401:  */
                    402: typedef JSBool
                    403: (* JS_DLL_CALLBACK JSPropertyIdOp)(JSContext *cx, JSObject *obj, jsid id,
                    404:                                    jsval *vp);
                    405: 
                    406: /*
                    407:  * Get or set attributes of the property obj[id].  Return false on error or
                    408:  * exception, true with current attributes in *attrsp.  If prop is non-null,
                    409:  * it must come from the *propp out parameter of a prior JSDefinePropOp or
                    410:  * JSLookupPropOp call.
                    411:  */
                    412: typedef JSBool
                    413: (* JS_DLL_CALLBACK JSAttributesOp)(JSContext *cx, JSObject *obj, jsid id,
                    414:                                    JSProperty *prop, uintN *attrsp);
                    415: 
                    416: /*
                    417:  * JSObjectOps.checkAccess type: check whether obj[id] may be accessed per
                    418:  * mode, returning false on error/exception, true on success with obj[id]'s
                    419:  * last-got value in *vp, and its attributes in *attrsp.
                    420:  */
                    421: typedef JSBool
                    422: (* JS_DLL_CALLBACK JSCheckAccessIdOp)(JSContext *cx, JSObject *obj, jsid id,
                    423:                                       JSAccessMode mode, jsval *vp,
                    424:                                       uintN *attrsp);
                    425: 
                    426: /*
                    427:  * A generic type for functions mapping an object to another object, or null
                    428:  * if an error or exception was thrown on cx.  Used by JSObjectOps.thisObject
                    429:  * at present.
                    430:  */
                    431: typedef JSObject *
                    432: (* JS_DLL_CALLBACK JSObjectOp)(JSContext *cx, JSObject *obj);
                    433: 
                    434: /*
                    435:  * A generic type for functions taking a context, object, and property, with
                    436:  * no return value.  Used by JSObjectOps.dropProperty currently (see above,
                    437:  * JSDefinePropOp and JSLookupPropOp, for the object-locking protocol in which
                    438:  * dropProperty participates).
                    439:  */
                    440: typedef void
                    441: (* JS_DLL_CALLBACK JSPropertyRefOp)(JSContext *cx, JSObject *obj,
                    442:                                     JSProperty *prop);
                    443: 
                    444: /*
                    445:  * Function type for JSObjectOps.setProto and JSObjectOps.setParent.  These
                    446:  * hooks must check for cycles without deadlocking, and otherwise take special
                    447:  * steps.  See jsobj.c, js_SetProtoOrParent, for an example.
                    448:  */
                    449: typedef JSBool
                    450: (* JS_DLL_CALLBACK JSSetObjectSlotOp)(JSContext *cx, JSObject *obj,
                    451:                                       uint32 slot, JSObject *pobj);
                    452: 
                    453: /*
                    454:  * Get and set a required slot, one that should already have been allocated.
                    455:  * These operations are infallible, so required slots must be pre-allocated,
                    456:  * or implementations must suppress out-of-memory errors.  The native ops
                    457:  * (js_ObjectOps, see jsobj.c) access slots reserved by including a call to
                    458:  * the JSCLASS_HAS_RESERVED_SLOTS(n) macro in the JSClass.flags initializer.
                    459:  *
                    460:  * NB: the slot parameter is a zero-based index into obj->slots[], unlike the
                    461:  * index parameter to the JS_GetReservedSlot and JS_SetReservedSlot API entry
                    462:  * points, which is a zero-based index into the JSCLASS_RESERVED_SLOTS(clasp)
                    463:  * reserved slots that come after the initial well-known slots: proto, parent,
                    464:  * class, and optionally, the private data slot.
                    465:  */
                    466: typedef jsval
                    467: (* JS_DLL_CALLBACK JSGetRequiredSlotOp)(JSContext *cx, JSObject *obj,
                    468:                                         uint32 slot);
                    469: 
                    470: typedef void
                    471: (* JS_DLL_CALLBACK JSSetRequiredSlotOp)(JSContext *cx, JSObject *obj,
                    472:                                         uint32 slot, jsval v);
                    473: 
                    474: /* Typedef for native functions called by the JS VM. */
                    475: 
                    476: typedef JSBool
                    477: (* JS_DLL_CALLBACK JSNative)(JSContext *cx, JSObject *obj, uintN argc,
                    478:                              jsval *argv, jsval *rval);
                    479: 
                    480: /* Callbacks and their arguments. */
                    481: 
                    482: typedef enum JSGCStatus {
                    483:     JSGC_BEGIN,
                    484:     JSGC_END,
                    485:     JSGC_MARK_END,
                    486:     JSGC_FINALIZE_END
                    487: } JSGCStatus;
                    488: 
                    489: typedef JSBool
                    490: (* JS_DLL_CALLBACK JSGCCallback)(JSContext *cx, JSGCStatus status);
                    491: 
                    492: typedef JSBool
                    493: (* JS_DLL_CALLBACK JSBranchCallback)(JSContext *cx, JSScript *script);
                    494: 
                    495: typedef void
                    496: (* JS_DLL_CALLBACK JSErrorReporter)(JSContext *cx, const char *message,
                    497:                                     JSErrorReport *report);
                    498: 
                    499: typedef struct JSErrorFormatString {
                    500:     const char *format;
                    501:     uintN argCount;
                    502: } JSErrorFormatString;
                    503: 
                    504: typedef const JSErrorFormatString *
                    505: (* JS_DLL_CALLBACK JSErrorCallback)(void *userRef, const char *locale,
                    506:                                    const uintN errorNumber);
                    507: 
                    508: #ifdef va_start
                    509: #define JS_ARGUMENT_FORMATTER_DEFINED 1
                    510: 
                    511: typedef JSBool
                    512: (* JS_DLL_CALLBACK JSArgumentFormatter)(JSContext *cx, const char *format,
                    513:                                         JSBool fromJS, jsval **vpp,
                    514:                                         va_list *app);
                    515: #endif
                    516: 
                    517: typedef JSBool 
                    518: (* JS_DLL_CALLBACK JSLocaleToUpperCase)(JSContext *cx, JSString *src,
                    519:                                         jsval *rval);
                    520: 
                    521: typedef JSBool
                    522: (* JS_DLL_CALLBACK JSLocaleToLowerCase)(JSContext *cx, JSString *src,
                    523:                                         jsval *rval);
                    524: 
                    525: typedef JSBool
                    526: (* JS_DLL_CALLBACK JSLocaleCompare)(JSContext *cx,
                    527:                                     JSString *src1, JSString *src2,
                    528:                                     jsval *rval);
                    529: 
                    530: /*
                    531:  * Security protocol types.
                    532:  */
                    533: typedef struct JSPrincipals JSPrincipals;
                    534: 
                    535: /*
                    536:  * XDR-encode or -decode a principals instance, based on whether xdr->mode is
                    537:  * JSXDR_ENCODE, in which case *principalsp should be encoded; or JSXDR_DECODE,
                    538:  * in which case implementations must return a held (via JSPRINCIPALS_HOLD),
                    539:  * non-null *principalsp out parameter.  Return true on success, false on any
                    540:  * error, which the implementation must have reported.
                    541:  */
                    542: typedef JSBool
                    543: (* JS_DLL_CALLBACK JSPrincipalsTranscoder)(JSXDRState *xdr,
                    544:                                            JSPrincipals **principalsp);
                    545: 
                    546: JS_END_EXTERN_C
                    547: 
                    548: #endif /* jspubtd_h___ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.