1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation ([email protected])
|
---|
6 | **
|
---|
7 | ** This file is part of the QtScript module of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL-ONLY$
|
---|
10 | ** GNU Lesser General Public License Usage
|
---|
11 | ** This file may be used under the terms of the GNU Lesser
|
---|
12 | ** General Public License version 2.1 as published by the Free Software
|
---|
13 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
14 | ** packaging of this file. Please review the following information to
|
---|
15 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
16 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
17 | **
|
---|
18 | ** If you have questions regarding the use of this file, please contact
|
---|
19 | ** Nokia at [email protected].
|
---|
20 | ** $QT_END_LICENSE$
|
---|
21 | **
|
---|
22 | ****************************************************************************/
|
---|
23 |
|
---|
24 | #ifndef QSCRIPTENGINEAGENT_P_H
|
---|
25 | #define QSCRIPTENGINEAGENT_P_H
|
---|
26 |
|
---|
27 | //
|
---|
28 | // W A R N I N G
|
---|
29 | // -------------
|
---|
30 | //
|
---|
31 | // This file is not part of the Qt API. It exists purely as an
|
---|
32 | // implementation detail. This header file may change from version to
|
---|
33 | // version without notice, or even be removed.
|
---|
34 | //
|
---|
35 | // We mean it.
|
---|
36 | //
|
---|
37 |
|
---|
38 | #include <QtCore/qobjectdefs.h>
|
---|
39 | #include "Debugger.h"
|
---|
40 | #include "qscriptengineagent.h"
|
---|
41 |
|
---|
42 | #include "CallFrame.h"
|
---|
43 | #include "SourceCode.h"
|
---|
44 | #include "UString.h"
|
---|
45 | #include "DebuggerCallFrame.h"
|
---|
46 |
|
---|
47 | QT_BEGIN_NAMESPACE
|
---|
48 |
|
---|
49 | class QScriptEnginePrivate;
|
---|
50 |
|
---|
51 | class QScriptEngineAgent;
|
---|
52 | class Q_SCRIPT_EXPORT QScriptEngineAgentPrivate : public JSC::Debugger
|
---|
53 | {
|
---|
54 | Q_DECLARE_PUBLIC(QScriptEngineAgent)
|
---|
55 | public:
|
---|
56 | static QScriptEngineAgent* get(QScriptEngineAgentPrivate* p) {return p->q_func();}
|
---|
57 | static QScriptEngineAgentPrivate* get(QScriptEngineAgent* p) {return p->d_func();}
|
---|
58 |
|
---|
59 | QScriptEngineAgentPrivate(){}
|
---|
60 | virtual ~QScriptEngineAgentPrivate(){};
|
---|
61 |
|
---|
62 | void attach();
|
---|
63 | void detach();
|
---|
64 |
|
---|
65 | //scripts
|
---|
66 | virtual void sourceParsed(JSC::ExecState*, const JSC::SourceCode&, int /*errorLine*/, const JSC::UString& /*errorMsg*/) {};
|
---|
67 | virtual void scriptUnload(qint64 id)
|
---|
68 | {
|
---|
69 | q_ptr->scriptUnload(id);
|
---|
70 | };
|
---|
71 | virtual void scriptLoad(qint64 id, const JSC::UString &program,
|
---|
72 | const JSC::UString &fileName, int baseLineNumber)
|
---|
73 | {
|
---|
74 | q_ptr->scriptLoad(id,program, fileName, baseLineNumber);
|
---|
75 | };
|
---|
76 |
|
---|
77 | //exceptions
|
---|
78 | virtual void exception(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno, bool hasHandler)
|
---|
79 | {
|
---|
80 | Q_UNUSED(frame);
|
---|
81 | Q_UNUSED(sourceID);
|
---|
82 | Q_UNUSED(lineno);
|
---|
83 | Q_UNUSED(hasHandler);
|
---|
84 | };
|
---|
85 | virtual void exceptionThrow(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, bool hasHandler);
|
---|
86 | virtual void exceptionCatch(const JSC::DebuggerCallFrame& frame, intptr_t sourceID);
|
---|
87 |
|
---|
88 | //statements
|
---|
89 | virtual void atStatement(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno/*, int column*/);
|
---|
90 | virtual void callEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno)
|
---|
91 | {
|
---|
92 | Q_UNUSED(lineno);
|
---|
93 | q_ptr->contextPush();
|
---|
94 | q_ptr->functionEntry(sourceID);
|
---|
95 | };
|
---|
96 | virtual void returnEvent(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno);
|
---|
97 | virtual void willExecuteProgram(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno)
|
---|
98 | {
|
---|
99 | Q_UNUSED(frame);
|
---|
100 | Q_UNUSED(sourceID);
|
---|
101 | Q_UNUSED(lineno);
|
---|
102 | };
|
---|
103 | virtual void didExecuteProgram(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno)
|
---|
104 | {
|
---|
105 | Q_UNUSED(frame);
|
---|
106 | Q_UNUSED(sourceID);
|
---|
107 | Q_UNUSED(lineno);
|
---|
108 | };
|
---|
109 | virtual void functionExit(const JSC::JSValue& returnValue, intptr_t sourceID);
|
---|
110 | //others
|
---|
111 | virtual void didReachBreakpoint(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno/*, int column*/);
|
---|
112 |
|
---|
113 | virtual void evaluateStart(intptr_t sourceID)
|
---|
114 | {
|
---|
115 | q_ptr->functionEntry(sourceID);
|
---|
116 | }
|
---|
117 | virtual void evaluateStop(const JSC::JSValue& returnValue, intptr_t sourceID);
|
---|
118 |
|
---|
119 | QScriptEnginePrivate *engine;
|
---|
120 | QScriptEngineAgent *q_ptr;
|
---|
121 | };
|
---|
122 |
|
---|
123 | QT_END_NAMESPACE
|
---|
124 |
|
---|
125 | #endif
|
---|