|
|
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 jsfun_h___ ! 36: #define jsfun_h___ ! 37: /* ! 38: * JS function definitions. ! 39: */ ! 40: #include "jsprvtd.h" ! 41: #include "jspubtd.h" ! 42: ! 43: JS_BEGIN_EXTERN_C ! 44: ! 45: struct JSFunction { ! 46: jsrefcount nrefs; /* number of referencing objects */ ! 47: JSObject *object; /* back-pointer to GC'ed object header */ ! 48: JSNative native; /* native method pointer or null */ ! 49: JSScript *script; /* interpreted bytecode descriptor or null */ ! 50: uint16 nargs; /* minimum number of actual arguments */ ! 51: uint16 extra; /* number of arg slots for local GC roots */ ! 52: uint16 nvars; /* number of local variables */ ! 53: uint8 flags; /* bound method and other flags, see jsapi.h */ ! 54: uint8 spare; /* reserved for future use */ ! 55: JSAtom *atom; /* name for diagnostics and decompiling */ ! 56: JSClass *clasp; /* if non-null, constructor for this class */ ! 57: }; ! 58: ! 59: extern JSClass js_ArgumentsClass; ! 60: extern JSClass js_CallClass; ! 61: ! 62: /* JS_FRIEND_DATA so that JSVAL_IS_FUNCTION is callable from outside */ ! 63: extern JS_FRIEND_DATA(JSClass) js_FunctionClass; ! 64: ! 65: /* ! 66: * NB: jsapi.h and jsobj.h must be included before any call to this macro. ! 67: */ ! 68: #define JSVAL_IS_FUNCTION(cx, v) \ ! 69: (JSVAL_IS_OBJECT(v) && JSVAL_TO_OBJECT(v) && \ ! 70: OBJ_GET_CLASS(cx, JSVAL_TO_OBJECT(v)) == &js_FunctionClass) ! 71: ! 72: extern JSBool ! 73: js_fun_toString(JSContext *cx, JSObject *obj, uint32 indent, ! 74: uintN argc, jsval *argv, jsval *rval); ! 75: ! 76: extern JSBool ! 77: js_IsIdentifier(JSString *str); ! 78: ! 79: extern JSObject * ! 80: js_InitFunctionClass(JSContext *cx, JSObject *obj); ! 81: ! 82: extern JSObject * ! 83: js_InitArgumentsClass(JSContext *cx, JSObject *obj); ! 84: ! 85: extern JSObject * ! 86: js_InitCallClass(JSContext *cx, JSObject *obj); ! 87: ! 88: extern JSFunction * ! 89: js_NewFunction(JSContext *cx, JSObject *funobj, JSNative native, uintN nargs, ! 90: uintN flags, JSObject *parent, JSAtom *atom); ! 91: ! 92: extern JSObject * ! 93: js_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent); ! 94: ! 95: extern JSBool ! 96: js_LinkFunctionObject(JSContext *cx, JSFunction *fun, JSObject *object); ! 97: ! 98: extern JSFunction * ! 99: js_DefineFunction(JSContext *cx, JSObject *obj, JSAtom *atom, JSNative native, ! 100: uintN nargs, uintN flags); ! 101: ! 102: extern JSFunction * ! 103: js_ValueToFunction(JSContext *cx, jsval *vp, JSBool constructing); ! 104: ! 105: extern void ! 106: js_ReportIsNotFunction(JSContext *cx, jsval *vp, JSBool constructing); ! 107: ! 108: extern JSObject * ! 109: js_GetCallObject(JSContext *cx, JSStackFrame *fp, JSObject *parent); ! 110: ! 111: extern JSBool ! 112: js_PutCallObject(JSContext *cx, JSStackFrame *fp); ! 113: ! 114: extern JSBool ! 115: js_GetCallVariable(JSContext *cx, JSObject *obj, jsval id, jsval *vp); ! 116: ! 117: extern JSBool ! 118: js_SetCallVariable(JSContext *cx, JSObject *obj, jsval id, jsval *vp); ! 119: ! 120: extern JSBool ! 121: js_GetArgsValue(JSContext *cx, JSStackFrame *fp, jsval *vp); ! 122: ! 123: extern JSBool ! 124: js_GetArgsProperty(JSContext *cx, JSStackFrame *fp, jsid id, ! 125: JSObject **objp, jsval *vp); ! 126: ! 127: extern JSObject * ! 128: js_GetArgsObject(JSContext *cx, JSStackFrame *fp); ! 129: ! 130: extern JSBool ! 131: js_PutArgsObject(JSContext *cx, JSStackFrame *fp); ! 132: ! 133: extern JSBool ! 134: js_XDRFunction(JSXDRState *xdr, JSObject **objp); ! 135: ! 136: JS_END_EXTERN_C ! 137: ! 138: #endif /* jsfun_h___ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.