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

📄 jsapi.h

📁 java script test programing source code
💻 H
📖 第 1 页 / 共 5 页
字号:
JS_RemoveArgumentFormatter(JSContext *cx, const char *format);#endif /* JS_ARGUMENT_FORMATTER_DEFINED */extern JS_PUBLIC_API(JSBool)JS_ConvertValue(JSContext *cx, jsval v, JSType type, jsval *vp);extern JS_PUBLIC_API(JSBool)JS_ValueToObject(JSContext *cx, jsval v, JSObject **objp);extern JS_PUBLIC_API(JSFunction *)JS_ValueToFunction(JSContext *cx, jsval v);extern JS_PUBLIC_API(JSFunction *)JS_ValueToConstructor(JSContext *cx, jsval v);extern JS_PUBLIC_API(JSString *)JS_ValueToString(JSContext *cx, jsval v);extern JS_PUBLIC_API(JSBool)JS_ValueToNumber(JSContext *cx, jsval v, jsdouble *dp);/* * Convert a value to a number, then to an int32, according to the ECMA rules * for ToInt32. */extern JS_PUBLIC_API(JSBool)JS_ValueToECMAInt32(JSContext *cx, jsval v, int32 *ip);/* * Convert a value to a number, then to a uint32, according to the ECMA rules * for ToUint32. */extern JS_PUBLIC_API(JSBool)JS_ValueToECMAUint32(JSContext *cx, jsval v, uint32 *ip);/* * Convert a value to a number, then to an int32 if it fits by rounding to * nearest; but failing with an error report if the double is out of range * or unordered. */extern JS_PUBLIC_API(JSBool)JS_ValueToInt32(JSContext *cx, jsval v, int32 *ip);/* * ECMA ToUint16, for mapping a jsval to a Unicode point. */extern JS_PUBLIC_API(JSBool)JS_ValueToUint16(JSContext *cx, jsval v, uint16 *ip);extern JS_PUBLIC_API(JSBool)JS_ValueToBoolean(JSContext *cx, jsval v, JSBool *bp);extern JS_PUBLIC_API(JSType)JS_TypeOfValue(JSContext *cx, jsval v);extern JS_PUBLIC_API(const char *)JS_GetTypeName(JSContext *cx, JSType type);/************************************************************************//* * Initialization, locking, contexts, and memory allocation. */#define JS_NewRuntime       JS_Init#define JS_DestroyRuntime   JS_Finish#define JS_LockRuntime      JS_Lock#define JS_UnlockRuntime    JS_Unlockextern JS_PUBLIC_API(JSRuntime *)JS_NewRuntime(uint32 maxbytes);extern JS_PUBLIC_API(void)JS_DestroyRuntime(JSRuntime *rt);extern JS_PUBLIC_API(void)JS_ShutDown(void);JS_PUBLIC_API(void *)JS_GetRuntimePrivate(JSRuntime *rt);JS_PUBLIC_API(void)JS_SetRuntimePrivate(JSRuntime *rt, void *data);#ifdef JS_THREADSAFEextern JS_PUBLIC_API(void)JS_BeginRequest(JSContext *cx);extern JS_PUBLIC_API(void)JS_EndRequest(JSContext *cx);/* Yield to pending GC operations, regardless of request depth */extern JS_PUBLIC_API(void)JS_YieldRequest(JSContext *cx);extern JS_PUBLIC_API(jsrefcount)JS_SuspendRequest(JSContext *cx);extern JS_PUBLIC_API(void)JS_ResumeRequest(JSContext *cx, jsrefcount saveDepth);#ifdef __cplusplusJS_END_EXTERN_Cclass JSAutoRequest {  public:    JSAutoRequest(JSContext *cx) : mContext(cx), mSaveDepth(0) {        JS_BeginRequest(mContext);    }    ~JSAutoRequest() {        JS_EndRequest(mContext);    }    void suspend() {        mSaveDepth = JS_SuspendRequest(mContext);    }    void resume() {        JS_ResumeRequest(mContext, mSaveDepth);    }  protected:    JSContext *mContext;    jsrefcount mSaveDepth;#if 0  private:    static void *operator new(size_t) CPP_THROW_NEW { return 0; };    static void operator delete(void *, size_t) { };#endif};JS_BEGIN_EXTERN_C#endif#endif /* JS_THREADSAFE */extern JS_PUBLIC_API(void)JS_Lock(JSRuntime *rt);extern JS_PUBLIC_API(void)JS_Unlock(JSRuntime *rt);extern JS_PUBLIC_API(JSContextCallback)JS_SetContextCallback(JSRuntime *rt, JSContextCallback cxCallback);extern JS_PUBLIC_API(JSContext *)JS_NewContext(JSRuntime *rt, size_t stackChunkSize);extern JS_PUBLIC_API(void)JS_DestroyContext(JSContext *cx);extern JS_PUBLIC_API(void)JS_DestroyContextNoGC(JSContext *cx);extern JS_PUBLIC_API(void)JS_DestroyContextMaybeGC(JSContext *cx);extern JS_PUBLIC_API(void *)JS_GetContextPrivate(JSContext *cx);extern JS_PUBLIC_API(void)JS_SetContextPrivate(JSContext *cx, void *data);extern JS_PUBLIC_API(JSRuntime *)JS_GetRuntime(JSContext *cx);extern JS_PUBLIC_API(JSContext *)JS_ContextIterator(JSRuntime *rt, JSContext **iterp);extern JS_PUBLIC_API(JSVersion)JS_GetVersion(JSContext *cx);extern JS_PUBLIC_API(JSVersion)JS_SetVersion(JSContext *cx, JSVersion version);extern JS_PUBLIC_API(const char *)JS_VersionToString(JSVersion version);extern JS_PUBLIC_API(JSVersion)JS_StringToVersion(const char *string);/* * JS options are orthogonal to version, and may be freely composed with one * another as well as with version. * * JSOPTION_VAROBJFIX is recommended -- see the comments associated with the * prototypes for JS_ExecuteScript, JS_EvaluateScript, etc. */#define JSOPTION_STRICT         JS_BIT(0)       /* warn on dubious practice */#define JSOPTION_WERROR         JS_BIT(1)       /* convert warning to error */#define JSOPTION_VAROBJFIX      JS_BIT(2)       /* make JS_EvaluateScript use                                                   the last object on its 'obj'                                                   param's scope chain as the                                                   ECMA 'variables object' */#define JSOPTION_PRIVATE_IS_NSISUPPORTS \                                JS_BIT(3)       /* context private data points                                                   to an nsISupports subclass */#define JSOPTION_COMPILE_N_GO   JS_BIT(4)       /* caller of JS_Compile*Script                                                   promises to execute compiled                                                   script once only; enables                                                   compile-time scope chain                                                   resolution of consts. */#define JSOPTION_ATLINE         JS_BIT(5)       /* //@line number ["filename"]                                                   option supported for the                                                   XUL preprocessor and kindred                                                   beasts. */#define JSOPTION_XML            JS_BIT(6)       /* EMCAScript for XML support:                                                   parse <!-- --> as a token,                                                   not backward compatible with                                                   the comment-hiding hack used                                                   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 */#define JSOPTION_DONT_REPORT_UNCAUGHT \                                JS_BIT(8)       /* When returning from the                                                   outermost API call, prevent                                                   uncaught exceptions from                                                   being converted to error                                                   reports */extern JS_PUBLIC_API(uint32)JS_GetOptions(JSContext *cx);extern JS_PUBLIC_API(uint32)JS_SetOptions(JSContext *cx, uint32 options);extern JS_PUBLIC_API(uint32)JS_ToggleOptions(JSContext *cx, uint32 options);extern JS_PUBLIC_API(const char *)JS_GetImplementationVersion(void);extern JS_PUBLIC_API(JSObject *)JS_GetGlobalObject(JSContext *cx);extern JS_PUBLIC_API(void)JS_SetGlobalObject(JSContext *cx, JSObject *obj);/* * Initialize standard JS class constructors, prototypes, and any top-level * functions and constants associated with the standard classes (e.g. isNaN * for Number). * * NB: This sets cx's global object to obj if it was null. */extern JS_PUBLIC_API(JSBool)JS_InitStandardClasses(JSContext *cx, JSObject *obj);/* * Resolve id, which must contain either a string or an int, to a standard * class name in obj if possible, defining the class's constructor and/or * prototype and storing true in *resolved.  If id does not name a standard * class or a top-level property induced by initializing a standard class, * store false in *resolved and just return true.  Return false on error, * as usual for JSBool result-typed API entry points. * * This API can be called directly from a global object class's resolve op, * to define standard classes lazily.  The class's enumerate op should call * JS_EnumerateStandardClasses(cx, obj), to define eagerly during for..in * loops any classes not yet resolved lazily. */extern JS_PUBLIC_API(JSBool)JS_ResolveStandardClass(JSContext *cx, JSObject *obj, jsval id,                        JSBool *resolved);extern JS_PUBLIC_API(JSBool)JS_EnumerateStandardClasses(JSContext *cx, JSObject *obj);/* * Enumerate any already-resolved standard class ids into ida, or into a new * JSIdArray if ida is null.  Return the augmented array on success, null on * failure with ida (if it was non-null on entry) destroyed. */extern JS_PUBLIC_API(JSIdArray *)JS_EnumerateResolvedStandardClasses(JSContext *cx, JSObject *obj,                                    JSIdArray *ida);extern JS_PUBLIC_API(JSBool)JS_GetClassObject(JSContext *cx, JSObject *obj, JSProtoKey key,                  JSObject **objp);extern JS_PUBLIC_API(JSObject *)JS_GetScopeChain(JSContext *cx);extern JS_PUBLIC_API(void *)JS_malloc(JSContext *cx, size_t nbytes);extern JS_PUBLIC_API(void *)JS_realloc(JSContext *cx, void *p, size_t nbytes);extern JS_PUBLIC_API(void)JS_free(JSContext *cx, void *p);extern JS_PUBLIC_API(char *)JS_strdup(JSContext *cx, const char *s);extern JS_PUBLIC_API(jsdouble *)JS_NewDouble(JSContext *cx, jsdouble d);extern JS_PUBLIC_API(JSBool)JS_NewDoubleValue(JSContext *cx, jsdouble d, jsval *rval);extern JS_PUBLIC_API(JSBool)JS_NewNumberValue(JSContext *cx, jsdouble d, jsval *rval);/* * A JS GC root is a pointer to a JSObject *, JSString *, or jsdouble * that * itself points into the GC heap (more recently, we support this extension: * a root may be a pointer to a jsval v for which JSVAL_IS_GCTHING(v) is true). * * Therefore, you never pass JSObject *obj to JS_AddRoot(cx, obj).  You always * call JS_AddRoot(cx, &obj), passing obj by reference.  And later, before obj * or the structure it is embedded within goes out of scope or is freed, you * must call JS_RemoveRoot(cx, &obj). * * Also, use JS_AddNamedRoot(cx, &structPtr->memberObj, "structPtr->memberObj") * in preference to JS_AddRoot(cx, &structPtr->memberObj), in order to identify * roots by their source callsites.  This way, you can find the callsite while * debugging if you should fail to do JS_RemoveRoot(cx, &structPtr->memberObj) * before freeing structPtr's memory. */extern JS_PUBLIC_API(JSBool)JS_AddRoot(JSContext *cx, void *rp);#ifdef NAME_ALL_GC_ROOTS#define JS_DEFINE_TO_TOKEN(def) #def#define JS_DEFINE_TO_STRING(def) JS_DEFINE_TO_TOKEN(def)#define JS_AddRoot(cx,rp) JS_AddNamedRoot((cx), (rp), (__FILE__ ":" JS_TOKEN_TO_STRING(__LINE__))#endifextern JS_PUBLIC_API(JSBool)JS_AddNamedRoot(JSContext *cx, void *rp, const char *name);extern JS_PUBLIC_API(JSBool)JS_AddNamedRootRT(JSRuntime *rt, void *rp, const char *name);

⌨️ 快捷键说明

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