⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jsapi.h

📁 java script test programing source code
💻 H
📖 第 1 页 / 共 5 页
字号:
 * with the following flags.  Failure to use JSCLASS_GLOBAL_FLAGS won't break * anything except the ECMA-262 "original prototype value" behavior, which was * broken for years in SpiderMonkey.  In other words, without these flags you * get backward compatibility. */#define JSCLASS_GLOBAL_FLAGS \    (JSCLASS_IS_GLOBAL | JSCLASS_HAS_RESERVED_SLOTS(JSProto_LIMIT))/* Fast access to the original value of each standard class's prototype. */#define JSCLASS_CACHED_PROTO_SHIFT      (JSCLASS_HIGH_FLAGS_SHIFT + 8)#define JSCLASS_CACHED_PROTO_WIDTH      8#define JSCLASS_CACHED_PROTO_MASK       JS_BITMASK(JSCLASS_CACHED_PROTO_WIDTH)#define JSCLASS_HAS_CACHED_PROTO(key)   ((key) << JSCLASS_CACHED_PROTO_SHIFT)#define JSCLASS_CACHED_PROTO_KEY(clasp) (((clasp)->flags                      \                                          >> JSCLASS_CACHED_PROTO_SHIFT)      \                                         & JSCLASS_CACHED_PROTO_MASK)/* Initializer for unused members of statically initialized JSClass structs. */#define JSCLASS_NO_OPTIONAL_MEMBERS     0,0,0,0,0,0,0,0#define JSCLASS_NO_RESERVED_MEMBERS     0,0,0,0,0/* 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;    JSMarkOp            mark;    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;};struct JSIdArray {    jsint length;    jsid  vector[1];    /* actually, length jsid words */};extern JS_PUBLIC_API(void)JS_DestroyIdArray(JSContext *cx, JSIdArray *ida);extern JS_PUBLIC_API(JSBool)JS_ValueToId(JSContext *cx, jsval v, jsid *idp);extern JS_PUBLIC_API(JSBool)JS_IdToValue(JSContext *cx, jsid id, jsval *vp);/* * The magic XML namespace id is int-tagged, but not a valid integer jsval. * Global object classes in embeddings that enable JS_HAS_XML_SUPPORT (E4X) * should handle this id specially before converting id via JSVAL_TO_INT. */#define JS_DEFAULT_XML_NAMESPACE_ID ((jsid) JSVAL_VOID)/* * JSNewResolveOp flag bits. */#define JSRESOLVE_QUALIFIED     0x01    /* resolve a qualified property id */#define JSRESOLVE_ASSIGNING     0x02    /* resolve on the left of assignment */#define JSRESOLVE_DETECTING     0x04    /* 'if (o.p)...' or '(o.p) ?...:...' */#define JSRESOLVE_DECLARING     0x08    /* var, const, or function prolog op */#define JSRESOLVE_CLASSNAME     0x10    /* class name used when constructing */extern JS_PUBLIC_API(JSBool)JS_PropertyStub(JSContext *cx, JSObject *obj, jsval id, jsval *vp);extern JS_PUBLIC_API(JSBool)JS_EnumerateStub(JSContext *cx, JSObject *obj);extern JS_PUBLIC_API(JSBool)JS_ResolveStub(JSContext *cx, JSObject *obj, jsval id);extern JS_PUBLIC_API(JSBool)JS_ConvertStub(JSContext *cx, JSObject *obj, JSType type, jsval *vp);extern JS_PUBLIC_API(void)JS_FinalizeStub(JSContext *cx, JSObject *obj);struct JSConstDoubleSpec {    jsdouble        dval;    const char      *name;    uint8           flags;    uint8           spare[3];};/* * To define an array element rather than a named property member, cast the * element's index to (const char *) and initialize name with it, and set the * JSPROP_INDEX bit in flags. */struct JSPropertySpec {    const char      *name;    int8            tinyid;    uint8           flags;    JSPropertyOp    getter;    JSPropertyOp    setter;};struct JSFunctionSpec {    const char      *name;    JSNative        call;#ifdef MOZILLA_1_8_BRANCH    uint8           nargs;    uint8           flags;    uint16          extra;#else    uint16          nargs;    uint16          flags;    uint32          extra;      /* extra & 0xFFFF:                                   number of arg slots for local GC roots                                   extra >> 16:                                   reserved, must be zero */#endif};extern JS_PUBLIC_API(JSObject *)JS_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto,             JSClass *clasp, JSNative constructor, uintN nargs,             JSPropertySpec *ps, JSFunctionSpec *fs,             JSPropertySpec *static_ps, JSFunctionSpec *static_fs);#ifdef JS_THREADSAFEextern JS_PUBLIC_API(JSClass *)JS_GetClass(JSContext *cx, JSObject *obj);#define JS_GET_CLASS(cx,obj) JS_GetClass(cx, obj)#elseextern JS_PUBLIC_API(JSClass *)JS_GetClass(JSObject *obj);#define JS_GET_CLASS(cx,obj) JS_GetClass(obj)#endifextern JS_PUBLIC_API(JSBool)JS_InstanceOf(JSContext *cx, JSObject *obj, JSClass *clasp, jsval *argv);extern JS_PUBLIC_API(JSBool)JS_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);extern JS_PUBLIC_API(void *)JS_GetPrivate(JSContext *cx, JSObject *obj);extern JS_PUBLIC_API(JSBool)JS_SetPrivate(JSContext *cx, JSObject *obj, void *data);extern JS_PUBLIC_API(void *)JS_GetInstancePrivate(JSContext *cx, JSObject *obj, JSClass *clasp,                      jsval *argv);extern JS_PUBLIC_API(JSObject *)JS_GetPrototype(JSContext *cx, JSObject *obj);extern JS_PUBLIC_API(JSBool)JS_SetPrototype(JSContext *cx, JSObject *obj, JSObject *proto);extern JS_PUBLIC_API(JSObject *)JS_GetParent(JSContext *cx, JSObject *obj);extern JS_PUBLIC_API(JSBool)JS_SetParent(JSContext *cx, JSObject *obj, JSObject *parent);extern JS_PUBLIC_API(JSObject *)JS_GetConstructor(JSContext *cx, JSObject *proto);/* * Get a unique identifier for obj, good for the lifetime of obj (even if it * is moved by a copying GC).  Return false on failure (likely out of memory), * and true with *idp containing the unique id on success. */extern JS_PUBLIC_API(JSBool)JS_GetObjectId(JSContext *cx, JSObject *obj, jsid *idp);extern JS_PUBLIC_API(JSObject *)JS_NewObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent);extern JS_PUBLIC_API(JSBool)JS_SealObject(JSContext *cx, JSObject *obj, JSBool deep);extern JS_PUBLIC_API(JSObject *)JS_ConstructObject(JSContext *cx, JSClass *clasp, JSObject *proto,                   JSObject *parent);extern JS_PUBLIC_API(JSObject *)JS_ConstructObjectWithArguments(JSContext *cx, JSClass *clasp, JSObject *proto,                                JSObject *parent, uintN argc, jsval *argv);extern JS_PUBLIC_API(JSObject *)JS_DefineObject(JSContext *cx, JSObject *obj, const char *name, JSClass *clasp,                JSObject *proto, uintN attrs);extern JS_PUBLIC_API(JSBool)JS_DefineConstDoubles(JSContext *cx, JSObject *obj, JSConstDoubleSpec *cds);extern JS_PUBLIC_API(JSBool)JS_DefineProperties(JSContext *cx, JSObject *obj, JSPropertySpec *ps);extern JS_PUBLIC_API(JSBool)JS_DefineProperty(JSContext *cx, JSObject *obj, const char *name, jsval value,                  JSPropertyOp getter, JSPropertyOp setter, uintN attrs);/* * Determine the attributes (JSPROP_* flags) of a property on a given object. * * If the object does not have a property by that name, *foundp will be * JS_FALSE and the value of *attrsp is undefined. */extern JS_PUBLIC_API(JSBool)JS_GetPropertyAttributes(JSContext *cx, JSObject *obj, const char *name,                         uintN *attrsp, JSBool *foundp);/* * The same, but if the property is native, return its getter and setter via * *getterp and *setterp, respectively (and only if the out parameter pointer * is not null). */extern JS_PUBLIC_API(JSBool)JS_GetPropertyAttrsGetterAndSetter(JSContext *cx, JSObject *obj,                                   const char *name,                                   uintN *attrsp, JSBool *foundp,                                   JSPropertyOp *getterp,                                   JSPropertyOp *setterp);/* * Set the attributes of a property on a given object. * * If the object does not have a property by that name, *foundp will be * JS_FALSE and nothing will be altered. */extern JS_PUBLIC_API(JSBool)JS_SetPropertyAttributes(JSContext *cx, JSObject *obj, const char *name,                         uintN attrs, JSBool *foundp);extern JS_PUBLIC_API(JSBool)JS_DefinePropertyWithTinyId(JSContext *cx, JSObject *obj, const char *name,                            int8 tinyid, jsval value,                            JSPropertyOp getter, JSPropertyOp setter,                            uintN attrs);extern JS_PUBLIC_API(JSBool)JS_AliasProperty(JSContext *cx, JSObject *obj, const char *name,                 const char *alias);extern JS_PUBLIC_API(JSBool)JS_HasProperty(JSContext *cx, JSObject *obj, const char *name, JSBool *foundp);extern JS_PUBLIC_API(JSBool)JS_LookupProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp);extern JS_PUBLIC_API(JSBool)JS_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, const char *name,                           uintN flags, jsval *vp);extern JS_PUBLIC_API(JSBool)JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp);extern JS_PUBLIC_API(JSBool)JS_GetMethodById(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,                 jsval *vp);extern JS_PUBLIC_API(JSBool)JS_GetMethod(JSContext *cx, JSObject *obj, const char *name, JSObject **objp,             jsval *vp);extern JS_PUBLIC_API(JSBool)JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp);extern JS_PUBLIC_API(JSBool)JS_DeleteProperty(JSContext *cx, JSObject *obj, const char *name);extern JS_PUBLIC_API(JSBool)JS_DeleteProperty2(JSContext *cx, JSObject *obj, const char *name,                   jsval *rval);extern JS_PUBLIC_API(JSBool)JS_DefineUCProperty(JSContext *cx, JSObject *obj,                    const jschar *name, size_t namelen, jsval value,                    JSPropertyOp getter, JSPropertyOp setter,                    uintN attrs);/* * Determine the attributes (JSPROP_* flags) of a property on a given object. * * If the object does not have a property by that name, *foundp will be * JS_FALSE and the value of *attrsp is undefined. */extern JS_PUBLIC_API(JSBool)JS_GetUCPropertyAttributes(JSContext *cx, JSObject *obj,                           const jschar *name, size_t namelen,                           uintN *attrsp, JSBool *foundp);/* * The same, but if the property is native, return its getter and setter via * *getterp and *setterp, respectively (and only if the out parameter pointer * is not null). */extern JS_PUBLIC_API(JSBool)JS_GetUCPropertyAttrsGetterAndSetter(JSContext *cx, JSObject *obj,                                     const jschar *name, size_t namelen,                                     uintN *attrsp, JSBool *foundp,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -