~ubuntu-branches/ubuntu/trusty/mozjs17/trusty

« back to all changes in this revision

Viewing changes to js/jsd/jsd.h

  • Committer: Package Import Robot
  • Author(s): Rico Tzschichholz
  • Date: 2013-05-25 12:24:23 UTC
  • Revision ID: package-import@ubuntu.com-20130525122423-zmxucrhtensw90xy
Tags: upstream-17.0.0
ImportĀ upstreamĀ versionĀ 17.0.0

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