1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3
* ***** BEGIN LICENSE BLOCK *****
4
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
6
* The contents of this file are subject to the Mozilla Public License Version
7
* 1.1 (the "License"); you may not use this file except in compliance with
8
* the License. You may obtain a copy of the License at
9
* http://www.mozilla.org/MPL/
11
* Software distributed under the License is distributed on an "AS IS" basis,
12
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13
* for the specific language governing rights and limitations under the
16
* The Original Code is Mozilla Communicator client code, released
19
* The Initial Developer of the Original Code is
20
* Netscape Communications Corporation.
21
* Portions created by the Initial Developer are Copyright (C) 1998
22
* the Initial Developer. All Rights Reserved.
26
* Alternatively, the contents of this file may be used under the terms of
27
* either of the GNU General Public License Version 2 or later (the "GPL"),
28
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
* in which case the provisions of the GPL or the LGPL are applicable instead
30
* of those above. If you wish to allow use of your version of this file only
31
* under the terms of either the GPL or the LGPL, and not to allow others to
32
* use your version of this file under the terms of the MPL, indicate your
33
* decision by deleting the provisions above and replace them with the notice
34
* and other provisions required by the GPL or the LGPL. If you do not delete
35
* the provisions above, a recipient may use your version of this file under
36
* the terms of any one of the MPL, the GPL or the LGPL.
38
* ***** END LICENSE BLOCK ***** */
43
* JS function definitions.
51
jsrefcount nrefs; /* number of referencing objects */
52
JSObject *object; /* back-pointer to GC'ed object header */
53
JSNative native; /* native method pointer or null */
54
JSScript *script; /* interpreted bytecode descriptor or null */
55
uint16 nargs; /* minimum number of actual arguments */
56
uint16 extra; /* number of arg slots for local GC roots */
57
uint16 nvars; /* number of local variables */
58
uint8 flags; /* bound method and other flags, see jsapi.h */
59
uint8 spare; /* reserved for future use */
60
JSAtom *atom; /* name for diagnostics and decompiling */
61
JSClass *clasp; /* if non-null, constructor for this class */
64
extern JSClass js_ArgumentsClass;
65
extern JSClass js_CallClass;
67
/* JS_FRIEND_DATA so that JSVAL_IS_FUNCTION is callable from outside */
68
extern JS_FRIEND_DATA(JSClass) js_FunctionClass;
71
* NB: jsapi.h and jsobj.h must be included before any call to this macro.
73
#define JSVAL_IS_FUNCTION(cx, v) \
74
(JSVAL_IS_OBJECT(v) && JSVAL_TO_OBJECT(v) && \
75
OBJ_GET_CLASS(cx, JSVAL_TO_OBJECT(v)) == &js_FunctionClass)
78
js_fun_toString(JSContext *cx, JSObject *obj, uint32 indent,
79
uintN argc, jsval *argv, jsval *rval);
82
js_IsIdentifier(JSString *str);
85
js_InitFunctionClass(JSContext *cx, JSObject *obj);
88
js_InitArgumentsClass(JSContext *cx, JSObject *obj);
91
js_InitCallClass(JSContext *cx, JSObject *obj);
94
js_NewFunction(JSContext *cx, JSObject *funobj, JSNative native, uintN nargs,
95
uintN flags, JSObject *parent, JSAtom *atom);
98
js_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent);
101
js_LinkFunctionObject(JSContext *cx, JSFunction *fun, JSObject *object);
104
js_DefineFunction(JSContext *cx, JSObject *obj, JSAtom *atom, JSNative native,
105
uintN nargs, uintN flags);
108
* Flags for js_ValueToFunction and js_ReportIsNotFunction. We depend on the
109
* fact that JSINVOKE_CONSTRUCT (aka JSFRAME_CONSTRUCTING) is 1, and test that
110
* with #if/#error in jsfun.c.
112
#define JSV2F_CONSTRUCT JSINVOKE_CONSTRUCT
113
#define JSV2F_SEARCH_STACK 2
116
js_ValueToFunction(JSContext *cx, jsval *vp, uintN flags);
119
js_ReportIsNotFunction(JSContext *cx, jsval *vp, uintN flags);
122
js_GetCallObject(JSContext *cx, JSStackFrame *fp, JSObject *parent);
125
js_PutCallObject(JSContext *cx, JSStackFrame *fp);
128
js_GetCallVariable(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
131
js_SetCallVariable(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
134
js_GetArgsValue(JSContext *cx, JSStackFrame *fp, jsval *vp);
137
js_GetArgsProperty(JSContext *cx, JSStackFrame *fp, jsid id,
138
JSObject **objp, jsval *vp);
141
js_GetArgsObject(JSContext *cx, JSStackFrame *fp);
144
js_PutArgsObject(JSContext *cx, JSStackFrame *fp);
147
js_XDRFunction(JSXDRState *xdr, JSObject **objp);
151
#endif /* jsfun_h___ */