|
|
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 jsprvtd_h___
36: #define jsprvtd_h___
37: /*
38: * JS private typename definitions.
39: *
40: * This header is included only in other .h files, for convenience and for
41: * simplicity of type naming. The alternative for structures is to use tags,
42: * which are named the same as their typedef names (legal in C/C++, and less
43: * noisy than suffixing the typedef name with "Struct" or "Str"). Instead,
44: * all .h files that include this file may use the same typedef name, whether
45: * declaring a pointer to struct type, or defining a member of struct type.
46: *
47: * A few fundamental scalar types are defined here too. Neither the scalar
48: * nor the struct typedefs should change much, therefore the nearly-global
49: * make dependency induced by this file should not prove painful.
50: */
51:
52: #include "jspubtd.h"
53:
54: /* Scalar typedefs. */
55: typedef uint8 jsbytecode;
56: typedef uint8 jssrcnote;
57: typedef uint32 jsatomid;
58:
59: /* Struct typedefs. */
60: typedef struct JSArgumentFormatMap JSArgumentFormatMap;
61: typedef struct JSCodeGenerator JSCodeGenerator;
62: typedef struct JSDependentString JSDependentString;
63: typedef struct JSGCLockHashEntry JSGCLockHashEntry;
64: typedef struct JSGCRootHashEntry JSGCRootHashEntry;
65: typedef struct JSGCThing JSGCThing;
66: typedef struct JSParseNode JSParseNode;
67: typedef struct JSSharpObjectMap JSSharpObjectMap;
68: typedef struct JSToken JSToken;
69: typedef struct JSTokenPos JSTokenPos;
70: typedef struct JSTokenPtr JSTokenPtr;
71: typedef struct JSTokenStream JSTokenStream;
72: typedef struct JSTreeContext JSTreeContext;
73: typedef struct JSTryNote JSTryNote;
74:
75: /* Friend "Advanced API" typedefs. */
76: typedef struct JSAtom JSAtom;
77: typedef struct JSAtomList JSAtomList;
78: typedef struct JSAtomListElement JSAtomListElement;
79: typedef struct JSAtomMap JSAtomMap;
80: typedef struct JSAtomState JSAtomState;
81: typedef struct JSCodeSpec JSCodeSpec;
82: typedef struct JSPrinter JSPrinter;
83: typedef struct JSRegExp JSRegExp;
84: typedef struct JSRegExpStatics JSRegExpStatics;
85: typedef struct JSScope JSScope;
86: typedef struct JSScopeOps JSScopeOps;
87: typedef struct JSScopeProperty JSScopeProperty;
88: typedef struct JSStackFrame JSStackFrame;
89: typedef struct JSStackHeader JSStackHeader;
90: typedef struct JSSubString JSSubString;
91:
92: /* "Friend" types used by jscntxt.h and jsdbgapi.h. */
93: typedef enum JSTrapStatus {
94: JSTRAP_ERROR,
95: JSTRAP_CONTINUE,
96: JSTRAP_RETURN,
97: JSTRAP_THROW,
98: JSTRAP_LIMIT
99: } JSTrapStatus;
100:
101: typedef JSTrapStatus
102: (* JS_DLL_CALLBACK JSTrapHandler)(JSContext *cx, JSScript *script, jsbytecode *pc,
103: jsval *rval, void *closure);
104:
105: typedef JSBool
106: (* JS_DLL_CALLBACK JSWatchPointHandler)(JSContext *cx, JSObject *obj, jsval id,
107: jsval old, jsval *newp, void *closure);
108:
109: /* called just after script creation */
110: typedef void
111: (* JS_DLL_CALLBACK JSNewScriptHook)(JSContext *cx,
112: const char *filename, /* URL of script */
113: uintN lineno, /* line script starts */
114: JSScript *script,
115: JSFunction *fun,
116: void *callerdata);
117:
118: /* called just before script destruction */
119: typedef void
120: (* JS_DLL_CALLBACK JSDestroyScriptHook)(JSContext *cx,
121: JSScript *script,
122: void *callerdata);
123:
124: typedef void
125: (* JS_DLL_CALLBACK JSSourceHandler)(const char *filename, uintN lineno,
126: jschar *str, size_t length,
127: void **listenerTSData, void *closure);
128:
129: /*
130: * This hook captures high level script execution and function calls
131: * (JS or native).
132: * It is used by JS_SetExecuteHook to hook top level scripts and by
133: * JS_SetCallHook to hook function calls.
134: * It will get called twice per script or function call:
135: * just before execution begins and just after it finishes. In both cases
136: * the 'current' frame is that of the executing code.
137: *
138: * The 'before' param is JS_TRUE for the hook invocation before the execution
139: * and JS_FALSE for the invocation after the code has run.
140: *
141: * The 'ok' param is significant only on the post execution invocation to
142: * signify whether or not the code completed 'normally'.
143: *
144: * The 'closure' param is as passed to JS_SetExecuteHook or JS_SetCallHook
145: * for the 'before'invocation, but is whatever value is returned from that
146: * invocation for the 'after' invocation. Thus, the hook implementor *could*
147: * allocate a stucture in the 'before' invocation and return a pointer
148: * to that structure. The pointer would then be handed to the hook for
149: * the 'after' invocation. Alternately, the 'before' could just return the
150: * same value as in 'closure' to cause the 'after' invocation to be called
151: * with the same 'closure' value as the 'before'.
152: *
153: * Returning NULL in the 'before' hook will cause the 'after' hook to
154: * NOT be called.
155: */
156:
157: typedef void *
158: (* JS_DLL_CALLBACK JSInterpreterHook)(JSContext *cx, JSStackFrame *fp, JSBool before,
159: JSBool *ok, void *closure);
160:
161: typedef void
162: (* JS_DLL_CALLBACK JSObjectHook)(JSContext *cx, JSObject *obj, JSBool isNew,
163: void *closure);
164:
165: typedef JSBool
166: (* JS_DLL_CALLBACK JSDebugErrorHook)(JSContext *cx, const char *message,
167: JSErrorReport *report, void *closure);
168:
169: #endif /* jsprvtd_h___ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.