/[jscoverage]/trunk/js/jsprvtd.h
ViewVC logotype

Contents of /trunk/js/jsprvtd.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 332 - (show annotations)
Thu Oct 23 19:03:33 2008 UTC (11 years, 8 months ago) by siliconforks
File MIME type: text/plain
File size: 10306 byte(s)
Add SpiderMonkey from Firefox 3.1b1.

The following directories and files were removed:
correct/, correct.js
liveconnect/
nanojit/
t/
v8/
vprof/
xpconnect/
all JavaScript files (Y.js, call.js, if.js, math-partial-sums.js, md5.js, perfect.js, trace-test.js, trace.js)


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 jsprvtd_h___
41 #define jsprvtd_h___
42 /*
43 * JS private typename definitions.
44 *
45 * This header is included only in other .h files, for convenience and for
46 * simplicity of type naming. The alternative for structures is to use tags,
47 * which are named the same as their typedef names (legal in C/C++, and less
48 * noisy than suffixing the typedef name with "Struct" or "Str"). Instead,
49 * all .h files that include this file may use the same typedef name, whether
50 * declaring a pointer to struct type, or defining a member of struct type.
51 *
52 * A few fundamental scalar types are defined here too. Neither the scalar
53 * nor the struct typedefs should change much, therefore the nearly-global
54 * make dependency induced by this file should not prove painful.
55 */
56
57 #include "jspubtd.h"
58
59 /* Internal identifier (jsid) macros. */
60
61 #define JSID_IS_ATOM(id) JSVAL_IS_STRING((jsval)(id))
62 #define JSID_TO_ATOM(id) ((JSAtom *)(id))
63 #define ATOM_TO_JSID(atom) (JS_ASSERT(ATOM_IS_STRING(atom)), \
64 (jsid)(atom))
65
66 #define JSID_IS_INT(id) JSVAL_IS_INT((jsval)(id))
67 #define JSID_TO_INT(id) JSVAL_TO_INT((jsval)(id))
68 #define INT_TO_JSID(i) ((jsid)INT_TO_JSVAL(i))
69 #define INT_JSVAL_TO_JSID(v) ((jsid)(v))
70 #define INT_JSID_TO_JSVAL(id) ((jsval)(id))
71
72 #define JSID_IS_OBJECT(id) JSVAL_IS_OBJECT((jsval)(id))
73 #define JSID_TO_OBJECT(id) JSVAL_TO_OBJECT((jsval)(id))
74 #define OBJECT_TO_JSID(obj) ((jsid)OBJECT_TO_JSVAL(obj))
75 #define OBJECT_JSVAL_TO_JSID(v) ((jsid)v)
76
77 #define ID_TO_VALUE(id) ((jsval)(id))
78
79 /*
80 * Convenience constants.
81 */
82 #define JS_BITS_PER_UINT32_LOG2 5
83 #define JS_BITS_PER_UINT32 32
84
85 /* Scalar typedefs. */
86 typedef uint8 jsbytecode;
87 typedef uint8 jssrcnote;
88 typedef uint32 jsatomid;
89
90 /* Struct typedefs. */
91 typedef struct JSArgumentFormatMap JSArgumentFormatMap;
92 typedef struct JSCodeGenerator JSCodeGenerator;
93 typedef struct JSGCThing JSGCThing;
94 typedef struct JSGenerator JSGenerator;
95 typedef struct JSNativeEnumerator JSNativeEnumerator;
96 typedef struct JSParseContext JSParseContext;
97 typedef struct JSParsedObjectBox JSParsedObjectBox;
98 typedef struct JSParseNode JSParseNode;
99 typedef struct JSPropCacheEntry JSPropCacheEntry;
100 typedef struct JSSharpObjectMap JSSharpObjectMap;
101 typedef struct JSTempValueRooter JSTempValueRooter;
102 typedef struct JSThread JSThread;
103 typedef struct JSToken JSToken;
104 typedef struct JSTokenPos JSTokenPos;
105 typedef struct JSTokenPtr JSTokenPtr;
106 typedef struct JSTokenStream JSTokenStream;
107 typedef struct JSTreeContext JSTreeContext;
108 typedef struct JSTryNote JSTryNote;
109 typedef struct JSWeakRoots JSWeakRoots;
110
111 /* Friend "Advanced API" typedefs. */
112 typedef struct JSAtom JSAtom;
113 typedef struct JSAtomList JSAtomList;
114 typedef struct JSAtomListElement JSAtomListElement;
115 typedef struct JSAtomMap JSAtomMap;
116 typedef struct JSAtomState JSAtomState;
117 typedef struct JSCodeSpec JSCodeSpec;
118 typedef struct JSPrinter JSPrinter;
119 typedef struct JSRegExp JSRegExp;
120 typedef struct JSRegExpStatics JSRegExpStatics;
121 typedef struct JSScope JSScope;
122 typedef struct JSScopeOps JSScopeOps;
123 typedef struct JSScopeProperty JSScopeProperty;
124 typedef struct JSStackHeader JSStackHeader;
125 typedef struct JSStringBuffer JSStringBuffer;
126 typedef struct JSSubString JSSubString;
127 typedef struct JSXML JSXML;
128 typedef struct JSXMLArray JSXMLArray;
129 typedef struct JSXMLArrayCursor JSXMLArrayCursor;
130
131 /* "Friend" types used by jscntxt.h and jsdbgapi.h. */
132 typedef enum JSTrapStatus {
133 JSTRAP_ERROR,
134 JSTRAP_CONTINUE,
135 JSTRAP_RETURN,
136 JSTRAP_THROW,
137 JSTRAP_LIMIT
138 } JSTrapStatus;
139
140 typedef JSTrapStatus
141 (* JSTrapHandler)(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval,
142 void *closure);
143
144 typedef JSBool
145 (* JSWatchPointHandler)(JSContext *cx, JSObject *obj, jsval id, jsval old,
146 jsval *newp, void *closure);
147
148 /* called just after script creation */
149 typedef void
150 (* JSNewScriptHook)(JSContext *cx,
151 const char *filename, /* URL of script */
152 uintN lineno, /* first line */
153 JSScript *script,
154 JSFunction *fun,
155 void *callerdata);
156
157 /* called just before script destruction */
158 typedef void
159 (* JSDestroyScriptHook)(JSContext *cx,
160 JSScript *script,
161 void *callerdata);
162
163 typedef void
164 (* JSSourceHandler)(const char *filename, uintN lineno, jschar *str,
165 size_t length, void **listenerTSData, void *closure);
166
167 /*
168 * This hook captures high level script execution and function calls (JS or
169 * native). It is used by JS_SetExecuteHook to hook top level scripts and by
170 * JS_SetCallHook to hook function calls. It will get called twice per script
171 * or function call: just before execution begins and just after it finishes.
172 * In both cases the 'current' frame is that of the executing code.
173 *
174 * The 'before' param is JS_TRUE for the hook invocation before the execution
175 * and JS_FALSE for the invocation after the code has run.
176 *
177 * The 'ok' param is significant only on the post execution invocation to
178 * signify whether or not the code completed 'normally'.
179 *
180 * The 'closure' param is as passed to JS_SetExecuteHook or JS_SetCallHook
181 * for the 'before'invocation, but is whatever value is returned from that
182 * invocation for the 'after' invocation. Thus, the hook implementor *could*
183 * allocate a structure in the 'before' invocation and return a pointer to that
184 * structure. The pointer would then be handed to the hook for the 'after'
185 * invocation. Alternately, the 'before' could just return the same value as
186 * in 'closure' to cause the 'after' invocation to be called with the same
187 * 'closure' value as the 'before'.
188 *
189 * Returning NULL in the 'before' hook will cause the 'after' hook *not* to
190 * be called.
191 */
192 typedef void *
193 (* JSInterpreterHook)(JSContext *cx, JSStackFrame *fp, JSBool before,
194 JSBool *ok, void *closure);
195
196 typedef void
197 (* JSObjectHook)(JSContext *cx, JSObject *obj, JSBool isNew, void *closure);
198
199 typedef JSBool
200 (* JSDebugErrorHook)(JSContext *cx, const char *message, JSErrorReport *report,
201 void *closure);
202
203 typedef struct JSDebugHooks {
204 JSTrapHandler interruptHandler;
205 void *interruptHandlerData;
206 JSNewScriptHook newScriptHook;
207 void *newScriptHookData;
208 JSDestroyScriptHook destroyScriptHook;
209 void *destroyScriptHookData;
210 JSTrapHandler debuggerHandler;
211 void *debuggerHandlerData;
212 JSSourceHandler sourceHandler;
213 void *sourceHandlerData;
214 JSInterpreterHook executeHook;
215 void *executeHookData;
216 JSInterpreterHook callHook;
217 void *callHookData;
218 JSObjectHook objectHook;
219 void *objectHookData;
220 JSTrapHandler throwHook;
221 void *throwHookData;
222 JSDebugErrorHook debugErrorHook;
223 void *debugErrorHookData;
224 } JSDebugHooks;
225
226 /*
227 * Type definitions for temporary GC roots that register with GC local C
228 * variables. See jscntxt.h for details.
229 */
230 typedef void
231 (* JSTempValueTrace)(JSTracer *trc, JSTempValueRooter *tvr);
232
233 typedef union JSTempValueUnion {
234 jsval value;
235 JSObject *object;
236 JSString *string;
237 JSXML *xml;
238 JSTempValueTrace trace;
239 JSScopeProperty *sprop;
240 JSWeakRoots *weakRoots;
241 JSParseContext *parseContext;
242 JSScript *script;
243 jsval *array;
244 } JSTempValueUnion;
245
246 struct JSTempValueRooter {
247 JSTempValueRooter *down;
248 ptrdiff_t count;
249 JSTempValueUnion u;
250 };
251
252 /*
253 * The following determines whether JS_EncodeCharacters and JS_DecodeBytes
254 * treat char[] as utf-8 or simply as bytes that need to be inflated/deflated.
255 */
256 #ifdef JS_C_STRINGS_ARE_UTF8
257 # define js_CStringsAreUTF8 JS_TRUE
258 #else
259 extern JSBool js_CStringsAreUTF8;
260 #endif
261
262 #endif /* jsprvtd_h___ */

  ViewVC Help
Powered by ViewVC 1.1.24