|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
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 qt-info@nokia.com. |
|
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) |
|
79 { |
|
80 Q_UNUSED(frame); |
|
81 Q_UNUSED(sourceID); |
|
82 Q_UNUSED(lineno); |
|
83 }; |
|
84 virtual void exceptionThrow(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, bool hasHandler); |
|
85 virtual void exceptionCatch(const JSC::DebuggerCallFrame& frame, intptr_t sourceID); |
|
86 |
|
87 //statements |
|
88 virtual void atStatement(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno, int column); |
|
89 virtual void callEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno) |
|
90 { |
|
91 Q_UNUSED(lineno); |
|
92 q_ptr->contextPush(); |
|
93 q_ptr->functionEntry(sourceID); |
|
94 }; |
|
95 virtual void returnEvent(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno); |
|
96 virtual void willExecuteProgram(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno) |
|
97 { |
|
98 Q_UNUSED(frame); |
|
99 Q_UNUSED(sourceID); |
|
100 Q_UNUSED(lineno); |
|
101 }; |
|
102 virtual void didExecuteProgram(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno) |
|
103 { |
|
104 Q_UNUSED(frame); |
|
105 Q_UNUSED(sourceID); |
|
106 Q_UNUSED(lineno); |
|
107 }; |
|
108 virtual void functionExit(const JSC::JSValue& returnValue, intptr_t sourceID); |
|
109 //others |
|
110 virtual void didReachBreakpoint(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno, int column); |
|
111 |
|
112 virtual void evaluateStart(intptr_t sourceID) |
|
113 { |
|
114 q_ptr->functionEntry(sourceID); |
|
115 } |
|
116 virtual void evaluateStop(const JSC::JSValue& returnValue, intptr_t sourceID); |
|
117 |
|
118 QScriptEnginePrivate *engine; |
|
119 QScriptEngineAgent *q_ptr; |
|
120 }; |
|
121 |
|
122 QT_END_NAMESPACE |
|
123 |
|
124 #endif |