--- sbbs/include/mozilla/js/jsprvtd.h 2018/04/24 16:41:23 1.1 +++ sbbs/include/mozilla/js/jsprvtd.h 2018/04/24 16:42:02 1.1.1.2 @@ -56,6 +56,32 @@ #include "jspubtd.h" +/* Internal identifier (jsid) macros. */ +#define JSID_ATOM 0x0 +#define JSID_INT 0x1 +#define JSID_OBJECT 0x2 +#define JSID_TAGMASK 0x3 +#define JSID_TAG(id) ((id) & JSID_TAGMASK) +#define JSID_SETTAG(id,t) ((id) | (t)) +#define JSID_CLRTAG(id) ((id) & ~(jsid)JSID_TAGMASK) + +#define JSID_IS_ATOM(id) (JSID_TAG(id) == JSID_ATOM) +#define JSID_TO_ATOM(id) ((JSAtom *)(id)) +#define ATOM_TO_JSID(atom) ((jsid)(atom)) +#define ATOM_JSID_TO_JSVAL(id) ATOM_KEY(JSID_TO_ATOM(id)) + +#define JSID_IS_INT(id) ((id) & JSID_INT) +#define JSID_TO_INT(id) ((jsint)(id) >> 1) +#define INT_TO_JSID(i) (((jsint)(i) << 1) | JSID_INT) +#define INT_JSID_TO_JSVAL(id) (id) +#define INT_JSVAL_TO_JSID(v) (v) + +#define JSID_IS_OBJECT(id) (JSID_TAG(id) == JSID_OBJECT) +#define JSID_TO_OBJECT(id) ((JSObject *) JSID_CLRTAG(id)) +#define OBJECT_TO_JSID(obj) ((jsid)(obj) | JSID_OBJECT) +#define OBJECT_JSID_TO_JSVAL(id) OBJECT_TO_JSVAL(JSID_CLRTAG(id)) +#define OBJECT_JSVAL_TO_JSID(v) OBJECT_TO_JSID(JSVAL_TO_OBJECT(v)) + /* Scalar typedefs. */ typedef uint8 jsbytecode; typedef uint8 jssrcnote; @@ -65,11 +91,11 @@ typedef uint32 jsatomid; typedef struct JSArgumentFormatMap JSArgumentFormatMap; typedef struct JSCodeGenerator JSCodeGenerator; typedef struct JSDependentString JSDependentString; -typedef struct JSGCLockHashEntry JSGCLockHashEntry; -typedef struct JSGCRootHashEntry JSGCRootHashEntry; typedef struct JSGCThing JSGCThing; +typedef struct JSGenerator JSGenerator; typedef struct JSParseNode JSParseNode; typedef struct JSSharpObjectMap JSSharpObjectMap; +typedef struct JSThread JSThread; typedef struct JSToken JSToken; typedef struct JSTokenPos JSTokenPos; typedef struct JSTokenPtr JSTokenPtr; @@ -90,9 +116,14 @@ typedef struct JSRegExpStatics JSRe typedef struct JSScope JSScope; typedef struct JSScopeOps JSScopeOps; typedef struct JSScopeProperty JSScopeProperty; -typedef struct JSStackFrame JSStackFrame; typedef struct JSStackHeader JSStackHeader; +typedef struct JSStringBuffer JSStringBuffer; typedef struct JSSubString JSSubString; +typedef struct JSXML JSXML; +typedef struct JSXMLNamespace JSXMLNamespace; +typedef struct JSXMLQName JSXMLQName; +typedef struct JSXMLArray JSXMLArray; +typedef struct JSXMLArrayCursor JSXMLArrayCursor; /* "Friend" types used by jscntxt.h and jsdbgapi.h. */ typedef enum JSTrapStatus { @@ -104,8 +135,8 @@ typedef enum JSTrapStatus { } JSTrapStatus; typedef JSTrapStatus -(* JS_DLL_CALLBACK JSTrapHandler)(JSContext *cx, JSScript *script, jsbytecode *pc, - jsval *rval, void *closure); +(* JS_DLL_CALLBACK JSTrapHandler)(JSContext *cx, JSScript *script, + jsbytecode *pc, jsval *rval, void *closure); typedef JSBool (* JS_DLL_CALLBACK JSWatchPointHandler)(JSContext *cx, JSObject *obj, jsval id, @@ -115,56 +146,53 @@ typedef JSBool typedef void (* JS_DLL_CALLBACK JSNewScriptHook)(JSContext *cx, const char *filename, /* URL of script */ - uintN lineno, /* line script starts */ + uintN lineno, /* first line */ JSScript *script, JSFunction *fun, void *callerdata); /* called just before script destruction */ typedef void -(* JS_DLL_CALLBACK JSDestroyScriptHook)(JSContext *cx, - JSScript *script, +(* JS_DLL_CALLBACK JSDestroyScriptHook)(JSContext *cx, + JSScript *script, void *callerdata); typedef void -(* JS_DLL_CALLBACK JSSourceHandler)(const char *filename, uintN lineno, - jschar *str, size_t length, +(* JS_DLL_CALLBACK JSSourceHandler)(const char *filename, uintN lineno, + jschar *str, size_t length, void **listenerTSData, void *closure); /* -* This hook captures high level script execution and function calls -* (JS or native). -* It is used by JS_SetExecuteHook to hook top level scripts and by -* JS_SetCallHook to hook function calls. -* It will get called twice per script or function call: -* just before execution begins and just after it finishes. In both cases -* the 'current' frame is that of the executing code. -* -* The 'before' param is JS_TRUE for the hook invocation before the execution -* and JS_FALSE for the invocation after the code has run. -* -* The 'ok' param is significant only on the post execution invocation to -* signify whether or not the code completed 'normally'. -* -* The 'closure' param is as passed to JS_SetExecuteHook or JS_SetCallHook -* for the 'before'invocation, but is whatever value is returned from that -* invocation for the 'after' invocation. Thus, the hook implementor *could* -* allocate a stucture in the 'before' invocation and return a pointer -* to that structure. The pointer would then be handed to the hook for -* the 'after' invocation. Alternately, the 'before' could just return the -* same value as in 'closure' to cause the 'after' invocation to be called -* with the same 'closure' value as the 'before'. -* -* Returning NULL in the 'before' hook will cause the 'after' hook to -* NOT be called. -*/ - + * This hook captures high level script execution and function calls (JS or + * native). It is used by JS_SetExecuteHook to hook top level scripts and by + * JS_SetCallHook to hook function calls. It will get called twice per script + * or function call: just before execution begins and just after it finishes. + * In both cases the 'current' frame is that of the executing code. + * + * The 'before' param is JS_TRUE for the hook invocation before the execution + * and JS_FALSE for the invocation after the code has run. + * + * The 'ok' param is significant only on the post execution invocation to + * signify whether or not the code completed 'normally'. + * + * The 'closure' param is as passed to JS_SetExecuteHook or JS_SetCallHook + * for the 'before'invocation, but is whatever value is returned from that + * invocation for the 'after' invocation. Thus, the hook implementor *could* + * allocate a structure in the 'before' invocation and return a pointer to that + * structure. The pointer would then be handed to the hook for the 'after' + * invocation. Alternately, the 'before' could just return the same value as + * in 'closure' to cause the 'after' invocation to be called with the same + * 'closure' value as the 'before'. + * + * Returning NULL in the 'before' hook will cause the 'after' hook *not* to + * be called. + */ typedef void * (* JS_DLL_CALLBACK JSInterpreterHook)(JSContext *cx, JSStackFrame *fp, JSBool before, JSBool *ok, void *closure); typedef void -(* JS_DLL_CALLBACK JSObjectHook)(JSContext *cx, JSObject *obj, JSBool isNew, +(* JS_DLL_CALLBACK JSObjectHook)(JSContext *cx, JSObject *obj, JSBool isNew, void *closure); typedef JSBool