Annotation of sbbs/include/mozilla/js/jsfun.h, revision 1.1

1.1     ! root        1: /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
        !             2:  *
        !             3:  * ***** BEGIN LICENSE BLOCK *****
        !             4:  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
        !             5:  *
        !             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/
        !            10:  *
        !            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
        !            14:  * License.
        !            15:  *
        !            16:  * The Original Code is Mozilla Communicator client code, released
        !            17:  * March 31, 1998.
        !            18:  *
        !            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.
        !            23:  *
        !            24:  * Contributor(s):
        !            25:  *
        !            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.
        !            37:  *
        !            38:  * ***** END LICENSE BLOCK ***** */
        !            39: 
        !            40: #ifndef jsfun_h___
        !            41: #define jsfun_h___
        !            42: /*
        !            43:  * JS function definitions.
        !            44:  */
        !            45: #include "jsprvtd.h"
        !            46: #include "jspubtd.h"
        !            47: 
        !            48: JS_BEGIN_EXTERN_C
        !            49: 
        !            50: struct JSFunction {
        !            51:     jsrefcount  nrefs;         /* number of referencing objects */
        !            52:     JSObject     *object;       /* back-pointer to GC'ed object header */
        !            53:     union {
        !            54:         JSNative native;        /* native method pointer or null */
        !            55:         JSScript *script;       /* interpreted bytecode descriptor or null */
        !            56:     } u;
        !            57:     uint16       nargs;         /* minimum number of actual arguments */
        !            58:     uint16       extra;         /* number of arg slots for local GC roots */
        !            59:     uint16       nvars;         /* number of local variables */
        !            60:     uint8        flags;         /* bound method and other flags, see jsapi.h */
        !            61:     JSPackedBool interpreted;   /* use u.script if true, u.native if false */
        !            62:     uint16       nregexps;      /* number of regular expressions literals */
        !            63:     uint16       spare;         /* reserved for future use */
        !            64:     JSAtom       *atom;         /* name for diagnostics and decompiling */
        !            65:     JSClass      *clasp;        /* if non-null, constructor for this class */
        !            66: };
        !            67: 
        !            68: #define FUN_NATIVE(fun)         ((fun)->interpreted ? NULL : (fun)->u.native)
        !            69: #define FUN_SCRIPT(fun)         ((fun)->interpreted ? (fun)->u.script : NULL)
        !            70: 
        !            71: extern JSClass js_ArgumentsClass;
        !            72: extern JSClass js_CallClass;
        !            73: 
        !            74: /* JS_FRIEND_DATA so that JSVAL_IS_FUNCTION is callable from outside */
        !            75: extern JS_FRIEND_DATA(JSClass) js_FunctionClass;
        !            76: 
        !            77: /*
        !            78:  * NB: jsapi.h and jsobj.h must be included before any call to this macro.
        !            79:  */
        !            80: #define JSVAL_IS_FUNCTION(cx, v)                                              \
        !            81:     (JSVAL_IS_OBJECT(v) && JSVAL_TO_OBJECT(v) &&                              \
        !            82:      OBJ_GET_CLASS(cx, JSVAL_TO_OBJECT(v)) == &js_FunctionClass)
        !            83: 
        !            84: extern JSBool
        !            85: js_fun_toString(JSContext *cx, JSObject *obj, uint32 indent,
        !            86:                 uintN argc, jsval *argv, jsval *rval);
        !            87: 
        !            88: extern JSBool
        !            89: js_IsIdentifier(JSString *str);
        !            90: 
        !            91: extern JSObject *
        !            92: js_InitFunctionClass(JSContext *cx, JSObject *obj);
        !            93: 
        !            94: extern JSObject *
        !            95: js_InitArgumentsClass(JSContext *cx, JSObject *obj);
        !            96: 
        !            97: extern JSObject *
        !            98: js_InitCallClass(JSContext *cx, JSObject *obj);
        !            99: 
        !           100: extern JSFunction *
        !           101: js_NewFunction(JSContext *cx, JSObject *funobj, JSNative native, uintN nargs,
        !           102:               uintN flags, JSObject *parent, JSAtom *atom);
        !           103: 
        !           104: extern JSObject *
        !           105: js_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent);
        !           106: 
        !           107: extern JSBool
        !           108: js_LinkFunctionObject(JSContext *cx, JSFunction *fun, JSObject *object);
        !           109: 
        !           110: extern JSFunction *
        !           111: js_DefineFunction(JSContext *cx, JSObject *obj, JSAtom *atom, JSNative native,
        !           112:                  uintN nargs, uintN flags);
        !           113: 
        !           114: /*
        !           115:  * Flags for js_ValueToFunction and js_ReportIsNotFunction.  We depend on the
        !           116:  * fact that JSINVOKE_CONSTRUCT (aka JSFRAME_CONSTRUCTING) is 1, and test that
        !           117:  * with #if/#error in jsfun.c.
        !           118:  */
        !           119: #define JSV2F_CONSTRUCT         JSINVOKE_CONSTRUCT
        !           120: #define JSV2F_SEARCH_STACK      2
        !           121: 
        !           122: extern JSFunction *
        !           123: js_ValueToFunction(JSContext *cx, jsval *vp, uintN flags);
        !           124: 
        !           125: extern void
        !           126: js_ReportIsNotFunction(JSContext *cx, jsval *vp, uintN flags);
        !           127: 
        !           128: extern JSObject *
        !           129: js_GetCallObject(JSContext *cx, JSStackFrame *fp, JSObject *parent);
        !           130: 
        !           131: extern JSBool
        !           132: js_PutCallObject(JSContext *cx, JSStackFrame *fp);
        !           133: 
        !           134: extern JSBool
        !           135: js_GetCallVariable(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
        !           136: 
        !           137: extern JSBool
        !           138: js_SetCallVariable(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
        !           139: 
        !           140: extern JSBool
        !           141: js_GetArgsValue(JSContext *cx, JSStackFrame *fp, jsval *vp);
        !           142: 
        !           143: extern JSBool
        !           144: js_GetArgsProperty(JSContext *cx, JSStackFrame *fp, jsid id,
        !           145:                    JSObject **objp, jsval *vp);
        !           146: 
        !           147: extern JSObject *
        !           148: js_GetArgsObject(JSContext *cx, JSStackFrame *fp);
        !           149: 
        !           150: extern JSBool
        !           151: js_PutArgsObject(JSContext *cx, JSStackFrame *fp);
        !           152: 
        !           153: extern JSBool
        !           154: js_XDRFunction(JSXDRState *xdr, JSObject **objp);
        !           155: 
        !           156: JS_END_EXTERN_C
        !           157: 
        !           158: #endif /* jsfun_h___ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.