~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/js/jsd/jsd.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 
2
/* ***** BEGIN LICENSE BLOCK *****
 
3
 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
 
4
 *
 
5
 * The contents of this file are subject to the Netscape Public License
 
6
 * Version 1.1 (the "License"); you may not use this file except in
 
7
 * compliance with the License. You may obtain a copy of the License at
 
8
 * http://www.mozilla.org/NPL/
 
9
 *
 
10
 * Software distributed under the License is distributed on an "AS IS" basis,
 
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
12
 * for the specific language governing rights and limitations under the
 
13
 * License.
 
14
 *
 
15
 * The Original Code is mozilla.org code.
 
16
 *
 
17
 * The Initial Developer of the Original Code is 
 
18
 * Netscape Communications Corporation.
 
19
 * Portions created by the Initial Developer are Copyright (C) 1998
 
20
 * the Initial Developer. All Rights Reserved.
 
21
 *
 
22
 * Contributor(s):
 
23
 *
 
24
 * Alternatively, the contents of this file may be used under the terms of
 
25
 * either the GNU General Public License Version 2 or later (the "GPL"), or 
 
26
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
27
 * in which case the provisions of the GPL or the LGPL are applicable instead
 
28
 * of those above. If you wish to allow use of your version of this file only
 
29
 * under the terms of either the GPL or the LGPL, and not to allow others to
 
30
 * use your version of this file under the terms of the NPL, indicate your
 
31
 * decision by deleting the provisions above and replace them with the notice
 
32
 * and other provisions required by the GPL or the LGPL. If you do not delete
 
33
 * the provisions above, a recipient may use your version of this file under
 
34
 * the terms of any one of the NPL, the GPL or the LGPL.
 
35
 *
 
36
 * ***** END LICENSE BLOCK ***** */
 
37
 
 
38
/*
 
39
 * Header for JavaScript Debugging support - Internal ONLY declarations
 
40
 */
 
41
 
 
42
#ifndef jsd_h___
 
43
#define jsd_h___
 
44
 
 
45
/*
 
46
* NOTE: This is a *private* header file and should only be included by
 
47
* the sources in js/jsd. Defining EXPORT_JSD_API in an outside module
 
48
* using jsd would be bad.
 
49
*/
 
50
#define EXPORT_JSD_API 1 /* if used, must be set before include of jsdebug.h */
 
51
 
 
52
/*
 
53
* These can be controled by the makefile, but this allows a place to set
 
54
* the values always used in the mozilla client, but perhaps done differnetly
 
55
* in other embeddings.
 
56
*/
 
57
#ifdef MOZILLA_CLIENT
 
58
#define JSD_THREADSAFE 1
 
59
/* define JSD_HAS_DANGEROUS_THREAD 1 */
 
60
#define JSD_USE_NSPR_LOCKS 1
 
61
#endif /* MOZILLA_CLIENT */
 
62
 
 
63
 
 
64
/* Get jstypes.h included first. After that we can use PR macros for doing
 
65
*  this extern "C" stuff!
 
66
*/
 
67
#ifdef __cplusplus
 
68
extern "C"
 
69
{
 
70
#endif
 
71
#include "jstypes.h"
 
72
#ifdef __cplusplus
 
73
}
 
74
#endif
 
75
 
 
76
JS_BEGIN_EXTERN_C
 
77
#include "jsprf.h"
 
78
#include "jsutil.h" /* Added by JSIFY */
 
79
#include "jshash.h" /* Added by JSIFY */
 
80
#include "jsclist.h"
 
81
#include "jsdebug.h"
 
82
#include "jsapi.h"
 
83
#include "jsobj.h"
 
84
#include "jsfun.h"
 
85
#include "jsscope.h"
 
86
#include "jsdbgapi.h"
 
87
#include "jsd_lock.h"
 
88
 
 
89
#include <stdio.h>
 
90
#include <stdlib.h>
 
91
#include <string.h>
 
92
 
 
93
#ifdef LIVEWIRE
 
94
#include <base/pblock.h>
 
95
#include <base/session.h>
 
96
#include <frame/log.h>
 
97
#include <frame/req.h>
 
98
#endif /* LIVEWIRE */
 
99
JS_END_EXTERN_C
 
100
 
 
101
JS_BEGIN_EXTERN_C
 
102
 
 
103
#define JSD_MAJOR_VERSION 1
 
104
#define JSD_MINOR_VERSION 1
 
105
 
 
106
/***************************************************************************/
 
107
/* handy macros */
 
108
#undef  CHECK_BIT_FLAG
 
109
#define CHECK_BIT_FLAG(f,b) ((f)&(b))
 
110
#undef  SET_BIT_FLAG
 
111
#define SET_BIT_FLAG(f,b)   ((f)|=(b))
 
112
#undef  CLEAR_BIT_FLAG
 
113
#define CLEAR_BIT_FLAG(f,b) ((f)&=(~(b)))
 
114
 
 
115
#define JSD_IS_DEBUG_ENABLED(jsdc,jsdscript)                                   \
 
116
        (!(((jsdc->flags & JSD_DEBUG_WHEN_SET) ? 1 : 0)  ^                     \
 
117
           ((jsdscript->flags & JSD_SCRIPT_DEBUG_BIT) ?  1 : 0)))
 
118
#define JSD_IS_PROFILE_ENABLED(jsdc,jsdscript)                                 \
 
119
        ((jsdc->flags & JSD_COLLECT_PROFILE_DATA) &&                           \
 
120
         (!(((jsdc->flags & JSD_PROFILE_WHEN_SET) ? 1 : 0) ^                   \
 
121
            ((jsdscript->flags & JSD_SCRIPT_PROFILE_BIT) ? 1 : 0))))
 
122
 
 
123
 
 
124
/***************************************************************************/
 
125
/* These are not exposed in jsdebug.h - typedef here for consistency */
 
126
 
 
127
typedef struct JSDExecHook          JSDExecHook;
 
128
typedef struct JSDAtom              JSDAtom;
 
129
typedef struct JSDProfileData       JSDProfileData;
 
130
/***************************************************************************/
 
131
/* Our structures */
 
132
 
 
133
/*
 
134
* XXX What I'm calling a JSDContext is really more of a JSDTaskState. 
 
135
*/
 
136
 
 
137
struct JSDContext
 
138
{
 
139
    JSCList                 links;      /* we are part of a JSCList */
 
140
    JSBool                  inited;
 
141
    void*                   data;
 
142
    uint32                  flags;
 
143
    JSD_ScriptHookProc      scriptHook;
 
144
    void*                   scriptHookData;
 
145
    JSD_ExecutionHookProc   interruptHook;
 
146
    void*                   interruptHookData;
 
147
    JSRuntime*              jsrt;
 
148
    JSD_ErrorReporter       errorReporter;
 
149
    void*                   errorReporterData;
 
150
    JSCList                 threadsStates;
 
151
    JSD_ExecutionHookProc   debugBreakHook;
 
152
    void*                   debugBreakHookData;
 
153
    JSD_ExecutionHookProc   debuggerHook;
 
154
    void*                   debuggerHookData;
 
155
    JSD_ExecutionHookProc   throwHook;
 
156
    void*                   throwHookData;
 
157
    JSD_CallHookProc        functionHook;
 
158
    void*                   functionHookData;
 
159
    JSD_CallHookProc        toplevelHook;
 
160
    void*                   toplevelHookData;
 
161
    JSContext*              dumbContext;
 
162
    JSObject*               glob;
 
163
    JSD_UserCallbacks       userCallbacks;
 
164
    void*                   user;
 
165
    JSCList                 scripts;
 
166
    JSHashTable*            scriptsTable;
 
167
    JSCList                 sources;
 
168
    JSCList                 removedSources;
 
169
    uintN                   sourceAlterCount;
 
170
    JSHashTable*            atoms;
 
171
    JSCList                 objectsList;
 
172
    JSHashTable*            objectsTable;
 
173
#ifdef JSD_THREADSAFE
 
174
    void*                   scriptsLock;
 
175
    void*                   sourceTextLock;
 
176
    void*                   objectsLock;
 
177
    void*                   atomsLock;
 
178
    void*                   threadStatesLock;
 
179
#endif /* JSD_THREADSAFE */
 
180
#ifdef JSD_HAS_DANGEROUS_THREAD
 
181
    void*                   dangerousThread;
 
182
#endif /* JSD_HAS_DANGEROUS_THREAD */
 
183
 
 
184
};
 
185
 
 
186
struct JSDScript
 
187
{
 
188
    JSCList     links;      /* we are part of a JSCList */
 
189
    JSDContext* jsdc;       /* JSDContext for this jsdscript */
 
190
    JSScript*   script;     /* script we are wrapping */
 
191
    JSFunction* function;   /* back pointer to owning function (can be NULL) */
 
192
    uintN       lineBase;   /* we cache this */
 
193
    uintN       lineExtent; /* we cache this */
 
194
    JSCList     hooks;      /* JSCList of JSDExecHooks for this script */
 
195
    char*       url;
 
196
    uint32      flags;
 
197
    void*       data;
 
198
 
 
199
    JSDProfileData  *profileData;
 
200
 
 
201
#ifdef LIVEWIRE
 
202
    LWDBGApp*    app;
 
203
    LWDBGScript* lwscript;
 
204
#endif
 
205
};
 
206
 
 
207
struct JSDProfileData
 
208
{
 
209
    int64    lastCallStart;
 
210
    uintN    callCount;
 
211
    uintN    recurseDepth;
 
212
    uintN    maxRecurseDepth;
 
213
    jsdouble minExecutionTime;
 
214
    jsdouble maxExecutionTime;
 
215
    jsdouble totalExecutionTime;
 
216
};
 
217
 
 
218
struct JSDSourceText
 
219
{
 
220
    JSCList          links;      /* we are part of a JSCList */
 
221
    char*            url;
 
222
    char*            text;
 
223
    uintN            textLength;
 
224
    uintN            textSpace;
 
225
    JSBool           dirty;
 
226
    JSDSourceStatus  status;
 
227
    uintN            alterCount;
 
228
    JSBool           doingEval;
 
229
};
 
230
 
 
231
struct JSDExecHook
 
232
{
 
233
    JSCList               links;        /* we are part of a JSCList */
 
234
    JSDScript*            jsdscript;
 
235
    jsuword               pc;
 
236
    JSD_ExecutionHookProc hook;
 
237
    void*                 callerdata;
 
238
};
 
239
 
 
240
#define TS_HAS_DISABLED_FRAME 0x01
 
241
 
 
242
struct JSDThreadState
 
243
{
 
244
    JSCList             links;        /* we are part of a JSCList */
 
245
    JSContext*          context;
 
246
    void*               thread;
 
247
    JSCList             stack;
 
248
    uintN               stackDepth;
 
249
    uintN               flags;
 
250
};
 
251
 
 
252
struct JSDStackFrameInfo
 
253
{
 
254
    JSCList             links;        /* we are part of a JSCList */
 
255
    JSDThreadState*     jsdthreadstate;
 
256
    JSDScript*          jsdscript;
 
257
    jsuword             pc;
 
258
    JSStackFrame*       fp;
 
259
};
 
260
 
 
261
#define GOT_PROTO   ((short) (1 << 0))
 
262
#define GOT_PROPS   ((short) (1 << 1))
 
263
#define GOT_PARENT  ((short) (1 << 2))
 
264
#define GOT_CTOR    ((short) (1 << 3))
 
265
 
 
266
struct JSDValue
 
267
{
 
268
    jsval       val;
 
269
    intN        nref;
 
270
    JSCList     props;
 
271
    JSString*   string;
 
272
    const char* funName;
 
273
    const char* className;
 
274
    JSDValue*   proto;
 
275
    JSDValue*   parent;
 
276
    JSDValue*   ctor;
 
277
    uintN       flags;
 
278
};
 
279
 
 
280
struct JSDProperty
 
281
{
 
282
    JSCList     links;      /* we are part of a JSCList */
 
283
    intN        nref;
 
284
    JSDValue*   val;
 
285
    JSDValue*   name;
 
286
    JSDValue*   alias;
 
287
    uintN       slot;
 
288
    uintN       flags;
 
289
};
 
290
 
 
291
struct JSDAtom
 
292
{
 
293
    char* str;      /* must be first element in stuct for compare */
 
294
    intN  refcount;
 
295
};
 
296
 
 
297
struct JSDObject
 
298
{
 
299
    JSCList     links;      /* we are part of a JSCList */
 
300
    JSObject*   obj;
 
301
    JSDAtom*    newURL;
 
302
    uintN       newLineno;
 
303
    JSDAtom*    ctorURL;
 
304
    uintN       ctorLineno;
 
305
    JSDAtom*    ctorName;
 
306
};
 
307
 
 
308
/***************************************************************************/
 
309
/* Code validation support */
 
310
 
 
311
#ifdef DEBUG
 
312
extern void JSD_ASSERT_VALID_CONTEXT(JSDContext* jsdc);
 
313
extern void JSD_ASSERT_VALID_SCRIPT(JSDScript* jsdscript);
 
314
extern void JSD_ASSERT_VALID_SOURCE_TEXT(JSDSourceText* jsdsrc);
 
315
extern void JSD_ASSERT_VALID_THREAD_STATE(JSDThreadState* jsdthreadstate);
 
316
extern void JSD_ASSERT_VALID_STACK_FRAME(JSDStackFrameInfo* jsdframe);
 
317
extern void JSD_ASSERT_VALID_EXEC_HOOK(JSDExecHook* jsdhook);
 
318
extern void JSD_ASSERT_VALID_VALUE(JSDValue* jsdval);
 
319
extern void JSD_ASSERT_VALID_PROPERTY(JSDProperty* jsdprop);
 
320
extern void JSD_ASSERT_VALID_OBJECT(JSDObject* jsdobj);
 
321
#else
 
322
#define JSD_ASSERT_VALID_CONTEXT(x)     ((void)0)
 
323
#define JSD_ASSERT_VALID_SCRIPT(x)      ((void)0)
 
324
#define JSD_ASSERT_VALID_SOURCE_TEXT(x) ((void)0)
 
325
#define JSD_ASSERT_VALID_THREAD_STATE(x)((void)0)
 
326
#define JSD_ASSERT_VALID_STACK_FRAME(x) ((void)0)
 
327
#define JSD_ASSERT_VALID_EXEC_HOOK(x)   ((void)0)
 
328
#define JSD_ASSERT_VALID_VALUE(x)       ((void)0)
 
329
#define JSD_ASSERT_VALID_PROPERTY(x)    ((void)0)
 
330
#define JSD_ASSERT_VALID_OBJECT(x)      ((void)0)
 
331
#endif
 
332
 
 
333
/***************************************************************************/
 
334
/* higher level functions */
 
335
 
 
336
extern JSDContext*
 
337
jsd_DebuggerOnForUser(JSRuntime*         jsrt,
 
338
                      JSD_UserCallbacks* callbacks,
 
339
                      void*              user);
 
340
extern JSDContext*
 
341
jsd_DebuggerOn(void);
 
342
 
 
343
extern void
 
344
jsd_DebuggerOff(JSDContext* jsdc);
 
345
 
 
346
extern void
 
347
jsd_SetUserCallbacks(JSRuntime* jsrt, JSD_UserCallbacks* callbacks, void* user);
 
348
 
 
349
extern JSDContext*
 
350
jsd_JSDContextForJSContext(JSContext* context);
 
351
 
 
352
extern void*
 
353
jsd_SetContextPrivate(JSDContext* jsdc, void *data);
 
354
 
 
355
extern void*
 
356
jsd_GetContextPrivate(JSDContext* jsdc);
 
357
 
 
358
extern void
 
359
jsd_ClearAllProfileData(JSDContext* jsdc);
 
360
 
 
361
extern JSBool
 
362
jsd_SetErrorReporter(JSDContext*       jsdc,
 
363
                     JSD_ErrorReporter reporter,
 
364
                     void*             callerdata);
 
365
 
 
366
extern JSBool
 
367
jsd_GetErrorReporter(JSDContext*        jsdc,
 
368
                     JSD_ErrorReporter* reporter,
 
369
                     void**             callerdata);
 
370
 
 
371
JS_STATIC_DLL_CALLBACK(JSBool)
 
372
jsd_DebugErrorHook(JSContext *cx, const char *message,
 
373
                   JSErrorReport *report, void *closure);
 
374
 
 
375
/***************************************************************************/
 
376
/* Script functions */
 
377
 
 
378
extern JSBool
 
379
jsd_InitScriptManager(JSDContext *jsdc);
 
380
 
 
381
extern void
 
382
jsd_DestroyScriptManager(JSDContext* jsdc);
 
383
 
 
384
extern JSDScript*
 
385
jsd_FindJSDScript(JSDContext*  jsdc,
 
386
                  JSScript     *script);
 
387
 
 
388
extern JSDProfileData*
 
389
jsd_GetScriptProfileData(JSDContext* jsdc, JSDScript *script);
 
390
 
 
391
extern uint32
 
392
jsd_GetScriptFlags(JSDContext *jsdc, JSDScript *script);
 
393
 
 
394
extern void
 
395
jsd_SetScriptFlags(JSDContext *jsdc, JSDScript *script, uint32 flags);
 
396
 
 
397
extern uintN
 
398
jsd_GetScriptCallCount(JSDContext* jsdc, JSDScript *script);
 
399
 
 
400
extern  uintN
 
401
jsd_GetScriptMaxRecurseDepth(JSDContext* jsdc, JSDScript *script);
 
402
 
 
403
extern jsdouble
 
404
jsd_GetScriptMinExecutionTime(JSDContext* jsdc, JSDScript *script);
 
405
 
 
406
extern jsdouble
 
407
jsd_GetScriptMaxExecutionTime(JSDContext* jsdc, JSDScript *script);
 
408
 
 
409
extern jsdouble
 
410
jsd_GetScriptTotalExecutionTime(JSDContext* jsdc, JSDScript *script);
 
411
 
 
412
extern void
 
413
jsd_ClearScriptProfileData(JSDContext* jsdc, JSDScript *script);
 
414
 
 
415
extern JSScript *
 
416
jsd_GetJSScript (JSDContext *jsdc, JSDScript *script);
 
417
 
 
418
extern JSFunction *
 
419
jsd_GetJSFunction (JSDContext *jsdc, JSDScript *script);
 
420
 
 
421
extern JSDScript*
 
422
jsd_IterateScripts(JSDContext* jsdc, JSDScript **iterp);
 
423
 
 
424
extern void *
 
425
jsd_SetScriptPrivate (JSDScript *jsdscript, void *data);
 
426
 
 
427
extern void *
 
428
jsd_GetScriptPrivate (JSDScript *jsdscript);
 
429
 
 
430
extern JSBool
 
431
jsd_IsActiveScript(JSDContext* jsdc, JSDScript *jsdscript);
 
432
 
 
433
extern const char*
 
434
jsd_GetScriptFilename(JSDContext* jsdc, JSDScript *jsdscript);
 
435
 
 
436
extern const char*
 
437
jsd_GetScriptFunctionName(JSDContext* jsdc, JSDScript *jsdscript);
 
438
 
 
439
extern uintN
 
440
jsd_GetScriptBaseLineNumber(JSDContext* jsdc, JSDScript *jsdscript);
 
441
 
 
442
extern uintN
 
443
jsd_GetScriptLineExtent(JSDContext* jsdc, JSDScript *jsdscript);
 
444
 
 
445
extern JSBool
 
446
jsd_SetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc hook, void* callerdata);
 
447
 
 
448
extern JSBool
 
449
jsd_GetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc* hook, void** callerdata);
 
450
 
 
451
extern jsuword
 
452
jsd_GetClosestPC(JSDContext* jsdc, JSDScript* jsdscript, uintN line);
 
453
 
 
454
extern uintN
 
455
jsd_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, jsuword pc);
 
456
 
 
457
extern void JS_DLL_CALLBACK
 
458
jsd_NewScriptHookProc(
 
459
                JSContext   *cx,
 
460
                const char  *filename,      /* URL this script loads from */
 
461
                uintN       lineno,         /* line where this script starts */
 
462
                JSScript    *script,
 
463
                JSFunction  *fun,
 
464
                void*       callerdata);
 
465
 
 
466
extern void JS_DLL_CALLBACK
 
467
jsd_DestroyScriptHookProc(
 
468
                JSContext   *cx,
 
469
                JSScript    *script,
 
470
                void*       callerdata);
 
471
 
 
472
/* Script execution hook functions */
 
473
 
 
474
extern JSBool
 
475
jsd_SetExecutionHook(JSDContext*           jsdc,
 
476
                     JSDScript*            jsdscript,
 
477
                     jsuword               pc,
 
478
                     JSD_ExecutionHookProc hook,
 
479
                     void*                 callerdata);
 
480
 
 
481
extern JSBool
 
482
jsd_ClearExecutionHook(JSDContext*           jsdc,
 
483
                       JSDScript*            jsdscript,
 
484
                       jsuword               pc);
 
485
 
 
486
extern JSBool
 
487
jsd_ClearAllExecutionHooksForScript(JSDContext* jsdc, JSDScript* jsdscript);
 
488
 
 
489
extern JSBool
 
490
jsd_ClearAllExecutionHooks(JSDContext* jsdc);
 
491
 
 
492
extern void
 
493
jsd_ScriptCreated(JSDContext* jsdc,
 
494
                  JSContext   *cx,
 
495
                  const char  *filename,    /* URL this script loads from */
 
496
                  uintN       lineno,       /* line where this script starts */
 
497
                  JSScript    *script,
 
498
                  JSFunction  *fun);
 
499
 
 
500
extern void
 
501
jsd_ScriptDestroyed(JSDContext* jsdc,
 
502
                    JSContext   *cx,
 
503
                    JSScript    *script);
 
504
 
 
505
/***************************************************************************/
 
506
/* Source Text functions */
 
507
 
 
508
extern JSDSourceText*
 
509
jsd_IterateSources(JSDContext* jsdc, JSDSourceText **iterp);
 
510
 
 
511
extern JSDSourceText*
 
512
jsd_FindSourceForURL(JSDContext* jsdc, const char* url);
 
513
 
 
514
extern const char*
 
515
jsd_GetSourceURL(JSDContext* jsdc, JSDSourceText* jsdsrc);
 
516
 
 
517
extern JSBool
 
518
jsd_GetSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc,
 
519
                  const char** ppBuf, intN* pLen);
 
520
 
 
521
extern void
 
522
jsd_ClearSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc);
 
523
 
 
524
extern JSDSourceStatus
 
525
jsd_GetSourceStatus(JSDContext* jsdc, JSDSourceText* jsdsrc);
 
526
 
 
527
extern JSBool
 
528
jsd_IsSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc);
 
529
 
 
530
extern void
 
531
jsd_SetSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc, JSBool dirty);
 
532
 
 
533
extern uintN
 
534
jsd_GetSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc);
 
535
 
 
536
extern uintN
 
537
jsd_IncrementSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc);
 
538
 
 
539
extern JSDSourceText*
 
540
jsd_NewSourceText(JSDContext* jsdc, const char* url);
 
541
 
 
542
extern JSDSourceText*
 
543
jsd_AppendSourceText(JSDContext* jsdc,
 
544
                     JSDSourceText* jsdsrc,
 
545
                     const char* text,       /* *not* zero terminated */
 
546
                     size_t length,
 
547
                     JSDSourceStatus status);
 
548
 
 
549
extern JSDSourceText*
 
550
jsd_AppendUCSourceText(JSDContext* jsdc,
 
551
                       JSDSourceText* jsdsrc,
 
552
                       const jschar* text,       /* *not* zero terminated */
 
553
                       size_t length,
 
554
                       JSDSourceStatus status);
 
555
 
 
556
/* convienence function for adding complete source of url in one call */
 
557
extern JSBool
 
558
jsd_AddFullSourceText(JSDContext* jsdc,
 
559
                      const char* text,       /* *not* zero terminated */
 
560
                      size_t      length,
 
561
                      const char* url);
 
562
 
 
563
extern void
 
564
jsd_DestroyAllSources(JSDContext* jsdc);
 
565
 
 
566
extern const char*
 
567
jsd_BuildNormalizedURL(const char* url_string);
 
568
 
 
569
extern void
 
570
jsd_StartingEvalUsingFilename(JSDContext* jsdc, const char* url);
 
571
 
 
572
extern void
 
573
jsd_FinishedEvalUsingFilename(JSDContext* jsdc, const char* url);
 
574
 
 
575
/***************************************************************************/
 
576
/* Interrupt Hook functions */
 
577
 
 
578
extern JSBool
 
579
jsd_SetInterruptHook(JSDContext*           jsdc,
 
580
                     JSD_ExecutionHookProc hook,
 
581
                     void*                 callerdata);
 
582
 
 
583
extern JSBool
 
584
jsd_ClearInterruptHook(JSDContext* jsdc);
 
585
 
 
586
extern JSBool
 
587
jsd_SetDebugBreakHook(JSDContext*           jsdc,
 
588
                      JSD_ExecutionHookProc hook,
 
589
                      void*                 callerdata);
 
590
 
 
591
extern JSBool
 
592
jsd_ClearDebugBreakHook(JSDContext* jsdc);
 
593
 
 
594
extern JSBool
 
595
jsd_SetDebuggerHook(JSDContext*           jsdc,
 
596
                    JSD_ExecutionHookProc hook,
 
597
                    void*                 callerdata);
 
598
 
 
599
extern JSBool
 
600
jsd_ClearDebuggerHook(JSDContext* jsdc);
 
601
 
 
602
extern JSTrapStatus
 
603
jsd_CallExecutionHook(JSDContext*           jsdc,
 
604
                      JSContext*            cx,
 
605
                      uintN                 type,
 
606
                      JSD_ExecutionHookProc hook,
 
607
                      void*                 hookData,
 
608
                      jsval*                rval);
 
609
 
 
610
extern JSBool
 
611
jsd_CallCallHook (JSDContext*      jsdc,
 
612
                  JSContext*       cx,
 
613
                  uintN            type,
 
614
                  JSD_CallHookProc hook,
 
615
                  void*            hookData);
 
616
 
 
617
extern JSBool
 
618
jsd_SetThrowHook(JSDContext*           jsdc,
 
619
                 JSD_ExecutionHookProc hook,
 
620
                 void*                 callerdata);
 
621
extern JSBool
 
622
jsd_ClearThrowHook(JSDContext* jsdc);
 
623
 
 
624
extern JSTrapStatus JS_DLL_CALLBACK
 
625
jsd_DebuggerHandler(JSContext *cx, JSScript *script, jsbytecode *pc,
 
626
                    jsval *rval, void *closure);
 
627
 
 
628
extern JSTrapStatus JS_DLL_CALLBACK
 
629
jsd_ThrowHandler(JSContext *cx, JSScript *script, jsbytecode *pc,
 
630
                 jsval *rval, void *closure);
 
631
 
 
632
extern JSBool
 
633
jsd_SetFunctionHook(JSDContext*      jsdc,
 
634
                    JSD_CallHookProc hook,
 
635
                    void*            callerdata);
 
636
 
 
637
extern JSBool
 
638
jsd_ClearFunctionHook(JSDContext* jsdc);
 
639
 
 
640
extern JSBool
 
641
jsd_SetTopLevelHook(JSDContext*      jsdc,
 
642
                    JSD_CallHookProc hook,
 
643
                    void*            callerdata);
 
644
 
 
645
extern JSBool
 
646
jsd_ClearTopLevelHook(JSDContext* jsdc);
 
647
 
 
648
/***************************************************************************/
 
649
/* Stack Frame functions */
 
650
 
 
651
extern uintN
 
652
jsd_GetCountOfStackFrames(JSDContext* jsdc, JSDThreadState* jsdthreadstate);
 
653
 
 
654
extern JSDStackFrameInfo*
 
655
jsd_GetStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate);
 
656
 
 
657
extern JSContext*
 
658
jsd_GetJSContext(JSDContext* jsdc, JSDThreadState* jsdthreadstate);
 
659
 
 
660
extern JSDStackFrameInfo*
 
661
jsd_GetCallingStackFrame(JSDContext* jsdc,
 
662
                         JSDThreadState* jsdthreadstate,
 
663
                         JSDStackFrameInfo* jsdframe);
 
664
 
 
665
extern JSDScript*
 
666
jsd_GetScriptForStackFrame(JSDContext* jsdc,
 
667
                           JSDThreadState* jsdthreadstate,
 
668
                           JSDStackFrameInfo* jsdframe);
 
669
 
 
670
extern jsuword
 
671
jsd_GetPCForStackFrame(JSDContext* jsdc,
 
672
                       JSDThreadState* jsdthreadstate,
 
673
                       JSDStackFrameInfo* jsdframe);
 
674
 
 
675
extern JSDValue*
 
676
jsd_GetCallObjectForStackFrame(JSDContext* jsdc,
 
677
                               JSDThreadState* jsdthreadstate,
 
678
                               JSDStackFrameInfo* jsdframe);
 
679
 
 
680
extern JSDValue*
 
681
jsd_GetScopeChainForStackFrame(JSDContext* jsdc,
 
682
                               JSDThreadState* jsdthreadstate,
 
683
                               JSDStackFrameInfo* jsdframe);
 
684
 
 
685
extern JSBool
 
686
jsd_IsStackFrameNative(JSDContext* jsdc, 
 
687
                       JSDThreadState* jsdthreadstate,
 
688
                       JSDStackFrameInfo* jsdframe);
 
689
 
 
690
extern JSBool
 
691
jsd_IsStackFrameDebugger(JSDContext* jsdc, 
 
692
                         JSDThreadState* jsdthreadstate,
 
693
                         JSDStackFrameInfo* jsdframe);
 
694
 
 
695
extern JSBool
 
696
jsd_IsStackFrameConstructing(JSDContext* jsdc, 
 
697
                             JSDThreadState* jsdthreadstate,
 
698
                             JSDStackFrameInfo* jsdframe);
 
699
 
 
700
extern JSDValue*
 
701
jsd_GetThisForStackFrame(JSDContext* jsdc,
 
702
                         JSDThreadState* jsdthreadstate,
 
703
                         JSDStackFrameInfo* jsdframe);
 
704
 
 
705
extern const char*
 
706
jsd_GetNameForStackFrame(JSDContext* jsdc, 
 
707
                         JSDThreadState* jsdthreadstate,
 
708
                         JSDStackFrameInfo* jsdframe);
 
709
 
 
710
extern JSDThreadState*
 
711
jsd_NewThreadState(JSDContext* jsdc, JSContext *cx);
 
712
 
 
713
extern void
 
714
jsd_DestroyThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate);
 
715
 
 
716
extern JSBool
 
717
jsd_EvaluateUCScriptInStackFrame(JSDContext* jsdc,
 
718
                                 JSDThreadState* jsdthreadstate,
 
719
                                 JSDStackFrameInfo* jsdframe,
 
720
                                 const jschar *bytes, uintN length,
 
721
                                 const char *filename, uintN lineno,
 
722
                                 JSBool eatExceptions, jsval *rval);
 
723
 
 
724
extern JSBool
 
725
jsd_EvaluateScriptInStackFrame(JSDContext* jsdc,
 
726
                               JSDThreadState* jsdthreadstate,
 
727
                               JSDStackFrameInfo* jsdframe,
 
728
                               const char *bytes, uintN length,
 
729
                               const char *filename, uintN lineno,
 
730
                               JSBool eatExceptions, jsval *rval);
 
731
 
 
732
extern JSString*
 
733
jsd_ValToStringInStackFrame(JSDContext* jsdc,
 
734
                            JSDThreadState* jsdthreadstate,
 
735
                            JSDStackFrameInfo* jsdframe,
 
736
                            jsval val);
 
737
 
 
738
extern JSBool
 
739
jsd_IsValidThreadState(JSDContext*        jsdc,
 
740
                       JSDThreadState*    jsdthreadstate);
 
741
 
 
742
extern JSBool
 
743
jsd_IsValidFrameInThreadState(JSDContext*        jsdc,
 
744
                              JSDThreadState*    jsdthreadstate,
 
745
                              JSDStackFrameInfo* jsdframe);
 
746
 
 
747
extern JSDValue*
 
748
jsd_GetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate);
 
749
 
 
750
extern JSBool
 
751
jsd_SetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate, 
 
752
                 JSDValue* jsdval);
 
753
 
 
754
/***************************************************************************/
 
755
/* Locking support */
 
756
 
 
757
/* protos are in js_lock.h for:
 
758
 *      jsd_CreateLock
 
759
 *      jsd_Lock
 
760
 *      jsd_Unlock
 
761
 *      jsd_IsLocked
 
762
 *      jsd_CurrentThread
 
763
 */
 
764
 
 
765
#ifdef JSD_THREADSAFE
 
766
 
 
767
/* the system-wide lock */
 
768
extern void* _jsd_global_lock;
 
769
#define JSD_LOCK()                               \
 
770
    JS_BEGIN_MACRO                               \
 
771
        if(!_jsd_global_lock)                    \
 
772
            _jsd_global_lock = jsd_CreateLock(); \
 
773
        JS_ASSERT(_jsd_global_lock);             \
 
774
        jsd_Lock(_jsd_global_lock);              \
 
775
    JS_END_MACRO
 
776
 
 
777
#define JSD_UNLOCK()                             \
 
778
    JS_BEGIN_MACRO                               \
 
779
        JS_ASSERT(_jsd_global_lock);             \
 
780
        jsd_Unlock(_jsd_global_lock);            \
 
781
    JS_END_MACRO
 
782
 
 
783
/* locks for the subsystems of a given context */
 
784
#define JSD_INIT_LOCKS(jsdc)                                    \
 
785
    ( (NULL != (jsdc->scriptsLock      = jsd_CreateLock())) &&  \
 
786
      (NULL != (jsdc->sourceTextLock   = jsd_CreateLock())) &&  \
 
787
      (NULL != (jsdc->atomsLock        = jsd_CreateLock())) &&  \
 
788
      (NULL != (jsdc->objectsLock      = jsd_CreateLock())) &&  \
 
789
      (NULL != (jsdc->threadStatesLock = jsd_CreateLock())) )
 
790
 
 
791
#define JSD_LOCK_SCRIPTS(jsdc)        jsd_Lock(jsdc->scriptsLock)
 
792
#define JSD_UNLOCK_SCRIPTS(jsdc)      jsd_Unlock(jsdc->scriptsLock)
 
793
 
 
794
#define JSD_LOCK_SOURCE_TEXT(jsdc)    jsd_Lock(jsdc->sourceTextLock)
 
795
#define JSD_UNLOCK_SOURCE_TEXT(jsdc)  jsd_Unlock(jsdc->sourceTextLock)
 
796
 
 
797
#define JSD_LOCK_ATOMS(jsdc)          jsd_Lock(jsdc->atomsLock)
 
798
#define JSD_UNLOCK_ATOMS(jsdc)        jsd_Unlock(jsdc->atomsLock)
 
799
 
 
800
#define JSD_LOCK_OBJECTS(jsdc)        jsd_Lock(jsdc->objectsLock)
 
801
#define JSD_UNLOCK_OBJECTS(jsdc)      jsd_Unlock(jsdc->objectsLock)
 
802
 
 
803
#define JSD_LOCK_THREADSTATES(jsdc)   jsd_Lock(jsdc->threadStatesLock)
 
804
#define JSD_UNLOCK_THREADSTATES(jsdc) jsd_Unlock(jsdc->threadStatesLock)
 
805
 
 
806
#else  /* !JSD_THREADSAFE */
 
807
 
 
808
#define JSD_LOCK()                    ((void)0)
 
809
#define JSD_UNLOCK()                  ((void)0)
 
810
 
 
811
#define JSD_INIT_LOCKS(jsdc)          1
 
812
 
 
813
#define JSD_LOCK_SCRIPTS(jsdc)        ((void)0)
 
814
#define JSD_UNLOCK_SCRIPTS(jsdc)      ((void)0)
 
815
 
 
816
#define JSD_LOCK_SOURCE_TEXT(jsdc)    ((void)0)
 
817
#define JSD_UNLOCK_SOURCE_TEXT(jsdc)  ((void)0)
 
818
 
 
819
#define JSD_LOCK_ATOMS(jsdc)          ((void)0)
 
820
#define JSD_UNLOCK_ATOMS(jsdc)        ((void)0)
 
821
 
 
822
#define JSD_LOCK_OBJECTS(jsdc)        ((void)0)
 
823
#define JSD_UNLOCK_OBJECTS(jsdc)      ((void)0)
 
824
 
 
825
#define JSD_LOCK_THREADSTATES(jsdc)   ((void)0)
 
826
#define JSD_UNLOCK_THREADSTATES(jsdc) ((void)0)
 
827
 
 
828
#endif /* JSD_THREADSAFE */
 
829
 
 
830
/* NOTE: These are intended for ASSERTs. Thus we supply checks for both
 
831
 * LOCKED and UNLOCKED (rather that just LOCKED and !LOCKED) so that in
 
832
 * the DEBUG non-Threadsafe case we can have an ASSERT that always succeeds
 
833
 * without having to special case things in the code.
 
834
 */
 
835
#if defined(JSD_THREADSAFE) && defined(DEBUG)
 
836
#define JSD_SCRIPTS_LOCKED(jsdc)        (jsd_IsLocked(jsdc->scriptsLock))
 
837
#define JSD_SOURCE_TEXT_LOCKED(jsdc)    (jsd_IsLocked(jsdc->sourceTextLock))
 
838
#define JSD_ATOMS_LOCKED(jsdc)          (jsd_IsLocked(jsdc->atomsLock))
 
839
#define JSD_OBJECTS_LOCKED(jsdc)        (jsd_IsLocked(jsdc->objectsLock))
 
840
#define JSD_THREADSTATES_LOCKED(jsdc)   (jsd_IsLocked(jsdc->threadStatesLock))
 
841
#define JSD_SCRIPTS_UNLOCKED(jsdc)      (!jsd_IsLocked(jsdc->scriptsLock))
 
842
#define JSD_SOURCE_TEXT_UNLOCKED(jsdc)  (!jsd_IsLocked(jsdc->sourceTextLock))
 
843
#define JSD_ATOMS_UNLOCKED(jsdc)        (!jsd_IsLocked(jsdc->atomsLock))
 
844
#define JSD_OBJECTS_UNLOCKED(jsdc)      (!jsd_IsLocked(jsdc->objectsLock))
 
845
#define JSD_THREADSTATES_UNLOCKED(jsdc) (!jsd_IsLocked(jsdc->threadStatesLock))
 
846
#else
 
847
#define JSD_SCRIPTS_LOCKED(jsdc)        1
 
848
#define JSD_SOURCE_TEXT_LOCKED(jsdc)    1
 
849
#define JSD_ATOMS_LOCKED(jsdc)          1
 
850
#define JSD_OBJECTS_LOCKED(jsdc)        1
 
851
#define JSD_THREADSTATES_LOCKED(jsdc)   1
 
852
#define JSD_SCRIPTS_UNLOCKED(jsdc)      1
 
853
#define JSD_SOURCE_TEXT_UNLOCKED(jsdc)  1
 
854
#define JSD_ATOMS_UNLOCKED(jsdc)        1
 
855
#define JSD_OBJECTS_UNLOCKED(jsdc)      1
 
856
#define JSD_THREADSTATES_UNLOCKED(jsdc) 1
 
857
#endif /* defined(JSD_THREADSAFE) && defined(DEBUG) */
 
858
 
 
859
/***************************************************************************/
 
860
/* Threading support */
 
861
 
 
862
#ifdef JSD_THREADSAFE
 
863
 
 
864
#define JSD_CURRENT_THREAD()        jsd_CurrentThread()
 
865
 
 
866
#else  /* !JSD_THREADSAFE */
 
867
 
 
868
#define JSD_CURRENT_THREAD()        ((void*)0)
 
869
 
 
870
#endif /* JSD_THREADSAFE */
 
871
 
 
872
/***************************************************************************/
 
873
/* Dangerous thread support */
 
874
 
 
875
#ifdef JSD_HAS_DANGEROUS_THREAD
 
876
 
 
877
#define JSD_IS_DANGEROUS_THREAD(jsdc) \
 
878
    (JSD_CURRENT_THREAD() == jsdc->dangerousThread)
 
879
 
 
880
#else  /* !JSD_HAS_DANGEROUS_THREAD */
 
881
 
 
882
#define JSD_IS_DANGEROUS_THREAD(jsdc)   0
 
883
 
 
884
#endif /* JSD_HAS_DANGEROUS_THREAD */
 
885
 
 
886
/***************************************************************************/
 
887
/* Value and Property Functions */
 
888
 
 
889
extern JSDValue*
 
890
jsd_NewValue(JSDContext* jsdc, jsval val);
 
891
 
 
892
extern void
 
893
jsd_DropValue(JSDContext* jsdc, JSDValue* jsdval);
 
894
 
 
895
extern jsval
 
896
jsd_GetValueWrappedJSVal(JSDContext* jsdc, JSDValue* jsdval);
 
897
 
 
898
extern void
 
899
jsd_RefreshValue(JSDContext* jsdc, JSDValue* jsdval);
 
900
 
 
901
/**************************************************/
 
902
 
 
903
extern JSBool
 
904
jsd_IsValueObject(JSDContext* jsdc, JSDValue* jsdval);
 
905
 
 
906
extern JSBool
 
907
jsd_IsValueNumber(JSDContext* jsdc, JSDValue* jsdval);
 
908
 
 
909
extern JSBool
 
910
jsd_IsValueInt(JSDContext* jsdc, JSDValue* jsdval);
 
911
 
 
912
extern JSBool
 
913
jsd_IsValueDouble(JSDContext* jsdc, JSDValue* jsdval);
 
914
 
 
915
extern JSBool
 
916
jsd_IsValueString(JSDContext* jsdc, JSDValue* jsdval);
 
917
 
 
918
extern JSBool
 
919
jsd_IsValueBoolean(JSDContext* jsdc, JSDValue* jsdval);
 
920
 
 
921
extern JSBool
 
922
jsd_IsValueNull(JSDContext* jsdc, JSDValue* jsdval);
 
923
 
 
924
extern JSBool
 
925
jsd_IsValueVoid(JSDContext* jsdc, JSDValue* jsdval);
 
926
 
 
927
extern JSBool
 
928
jsd_IsValuePrimitive(JSDContext* jsdc, JSDValue* jsdval);
 
929
 
 
930
extern JSBool
 
931
jsd_IsValueFunction(JSDContext* jsdc, JSDValue* jsdval);
 
932
 
 
933
extern JSBool
 
934
jsd_IsValueNative(JSDContext* jsdc, JSDValue* jsdval);
 
935
 
 
936
/**************************************************/
 
937
 
 
938
extern JSBool
 
939
jsd_GetValueBoolean(JSDContext* jsdc, JSDValue* jsdval);
 
940
 
 
941
extern int32
 
942
jsd_GetValueInt(JSDContext* jsdc, JSDValue* jsdval);
 
943
 
 
944
extern jsdouble*
 
945
jsd_GetValueDouble(JSDContext* jsdc, JSDValue* jsdval);
 
946
 
 
947
extern JSString*
 
948
jsd_GetValueString(JSDContext* jsdc, JSDValue* jsdval);
 
949
 
 
950
extern const char*
 
951
jsd_GetValueFunctionName(JSDContext* jsdc, JSDValue* jsdval);
 
952
 
 
953
/**************************************************/
 
954
 
 
955
extern uintN
 
956
jsd_GetCountOfProperties(JSDContext* jsdc, JSDValue* jsdval);
 
957
 
 
958
extern JSDProperty*
 
959
jsd_IterateProperties(JSDContext* jsdc, JSDValue* jsdval, JSDProperty **iterp);
 
960
 
 
961
extern JSDProperty*
 
962
jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* name);
 
963
 
 
964
extern JSDValue*
 
965
jsd_GetValuePrototype(JSDContext* jsdc, JSDValue* jsdval);
 
966
 
 
967
extern JSDValue*
 
968
jsd_GetValueParent(JSDContext* jsdc, JSDValue* jsdval);
 
969
 
 
970
extern JSDValue*
 
971
jsd_GetValueConstructor(JSDContext* jsdc, JSDValue* jsdval);
 
972
 
 
973
extern const char*
 
974
jsd_GetValueClassName(JSDContext* jsdc, JSDValue* jsdval);
 
975
 
 
976
/**************************************************/
 
977
 
 
978
extern void
 
979
jsd_DropProperty(JSDContext* jsdc, JSDProperty* jsdprop);
 
980
 
 
981
extern JSDValue*
 
982
jsd_GetPropertyName(JSDContext* jsdc, JSDProperty* jsdprop);
 
983
 
 
984
extern JSDValue*
 
985
jsd_GetPropertyValue(JSDContext* jsdc, JSDProperty* jsdprop);
 
986
 
 
987
extern JSDValue*
 
988
jsd_GetPropertyAlias(JSDContext* jsdc, JSDProperty* jsdprop);
 
989
 
 
990
extern uintN
 
991
jsd_GetPropertyFlags(JSDContext* jsdc, JSDProperty* jsdprop);
 
992
 
 
993
extern uintN
 
994
jsd_GetPropertyVarArgSlot(JSDContext* jsdc, JSDProperty* jsdprop);
 
995
 
 
996
/**************************************************/
 
997
/* Stepping Functions */
 
998
 
 
999
extern void * JS_DLL_CALLBACK
 
1000
jsd_FunctionCallHook(JSContext *cx, JSStackFrame *fp, JSBool before,
 
1001
                     JSBool *ok, void *closure);
 
1002
 
 
1003
extern void * JS_DLL_CALLBACK
 
1004
jsd_TopLevelCallHook(JSContext *cx, JSStackFrame *fp, JSBool before,
 
1005
                     JSBool *ok, void *closure);
 
1006
 
 
1007
/**************************************************/
 
1008
/* Object Functions */
 
1009
 
 
1010
extern JSBool
 
1011
jsd_InitObjectManager(JSDContext* jsdc);
 
1012
 
 
1013
extern void
 
1014
jsd_DestroyObjectManager(JSDContext* jsdc);
 
1015
 
 
1016
extern void JS_DLL_CALLBACK
 
1017
jsd_ObjectHook(JSContext *cx, JSObject *obj, JSBool isNew, void *closure);
 
1018
 
 
1019
extern void
 
1020
jsd_Constructing(JSDContext* jsdc, JSContext *cx, JSObject *obj,
 
1021
                 JSStackFrame *fp);
 
1022
 
 
1023
extern JSDObject*
 
1024
jsd_IterateObjects(JSDContext* jsdc, JSDObject** iterp);
 
1025
 
 
1026
extern JSObject*
 
1027
jsd_GetWrappedObject(JSDContext* jsdc, JSDObject* jsdobj);
 
1028
 
 
1029
extern const char*
 
1030
jsd_GetObjectNewURL(JSDContext* jsdc, JSDObject* jsdobj);
 
1031
 
 
1032
extern uintN
 
1033
jsd_GetObjectNewLineNumber(JSDContext* jsdc, JSDObject* jsdobj);
 
1034
 
 
1035
extern const char*
 
1036
jsd_GetObjectConstructorURL(JSDContext* jsdc, JSDObject* jsdobj);
 
1037
 
 
1038
extern uintN
 
1039
jsd_GetObjectConstructorLineNumber(JSDContext* jsdc, JSDObject* jsdobj);
 
1040
 
 
1041
extern const char*
 
1042
jsd_GetObjectConstructorName(JSDContext* jsdc, JSDObject* jsdobj);
 
1043
 
 
1044
extern JSDObject*
 
1045
jsd_GetJSDObjectForJSObject(JSDContext* jsdc, JSObject* jsobj);
 
1046
 
 
1047
extern JSDObject*
 
1048
jsd_GetObjectForValue(JSDContext* jsdc, JSDValue* jsdval);
 
1049
 
 
1050
/*
 
1051
* returns new refcounted JSDValue
 
1052
*/
 
1053
extern JSDValue*
 
1054
jsd_GetValueForObject(JSDContext* jsdc, JSDObject* jsdobj);
 
1055
 
 
1056
/**************************************************/
 
1057
/* Atom Functions */
 
1058
 
 
1059
extern JSBool
 
1060
jsd_CreateAtomTable(JSDContext* jsdc);
 
1061
 
 
1062
extern void
 
1063
jsd_DestroyAtomTable(JSDContext* jsdc);
 
1064
 
 
1065
extern JSDAtom*
 
1066
jsd_AddAtom(JSDContext* jsdc, const char* str);
 
1067
 
 
1068
extern JSDAtom*
 
1069
jsd_CloneAtom(JSDContext* jsdc, JSDAtom* atom);
 
1070
 
 
1071
extern void
 
1072
jsd_DropAtom(JSDContext* jsdc, JSDAtom* atom);
 
1073
 
 
1074
#define JSD_ATOM_TO_STRING(a) ((const char*)((a)->str))
 
1075
 
 
1076
/***************************************************************************/
 
1077
/* Livewire specific API */
 
1078
#ifdef LIVEWIRE
 
1079
 
 
1080
extern LWDBGScript*
 
1081
jsdlw_GetLWScript(JSDContext* jsdc, JSDScript* jsdscript);
 
1082
 
 
1083
extern char*
 
1084
jsdlw_BuildAppRelativeFilename(LWDBGApp* app, const char* filename);
 
1085
 
 
1086
extern JSDSourceText*
 
1087
jsdlw_PreLoadSource(JSDContext* jsdc, LWDBGApp* app,
 
1088
                     const char* filename, JSBool clear);
 
1089
 
 
1090
extern JSDSourceText*
 
1091
jsdlw_ForceLoadSource(JSDContext* jsdc, JSDSourceText* jsdsrc);
 
1092
 
 
1093
extern JSBool
 
1094
jsdlw_UserCodeAtPC(JSDContext* jsdc, JSDScript* jsdscript, jsuword pc);
 
1095
 
 
1096
extern JSBool
 
1097
jsdlw_RawToProcessedLineNumber(JSDContext* jsdc, JSDScript* jsdscript,
 
1098
                               uintN lineIn, uintN* lineOut);
 
1099
 
 
1100
extern JSBool
 
1101
jsdlw_ProcessedToRawLineNumber(JSDContext* jsdc, JSDScript* jsdscript,
 
1102
                               uintN lineIn, uintN* lineOut);
 
1103
 
 
1104
 
 
1105
#if 0
 
1106
/* our hook proc for LiveWire app start/stop */
 
1107
extern void JS_DLL_CALLBACK
 
1108
jsdlw_AppHookProc(LWDBGApp* app,
 
1109
                  JSBool created,
 
1110
                  void *callerdata);
 
1111
#endif
 
1112
 
 
1113
 
 
1114
#endif
 
1115
/***************************************************************************/
 
1116
 
 
1117
JS_END_EXTERN_C
 
1118
 
 
1119
#endif /* jsd_h___ */