|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 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$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef QSCRIPTENGINEAGENT_P_H |
|
43 #define QSCRIPTENGINEAGENT_P_H |
|
44 |
|
45 // |
|
46 // W A R N I N G |
|
47 // ------------- |
|
48 // |
|
49 // This file is not part of the Qt API. It exists purely as an |
|
50 // implementation detail. This header file may change from version to |
|
51 // version without notice, or even be removed. |
|
52 // |
|
53 // We mean it. |
|
54 // |
|
55 |
|
56 #include <QtCore/qobjectdefs.h> |
|
57 #include "Debugger.h" |
|
58 #include "qscriptengineagent.h" |
|
59 |
|
60 #include "CallFrame.h" |
|
61 #include "SourceCode.h" |
|
62 #include "UString.h" |
|
63 #include "DebuggerCallFrame.h" |
|
64 |
|
65 QT_BEGIN_NAMESPACE |
|
66 |
|
67 class QScriptEnginePrivate; |
|
68 |
|
69 class QScriptEngineAgent; |
|
70 class Q_SCRIPT_EXPORT QScriptEngineAgentPrivate : public JSC::Debugger |
|
71 { |
|
72 Q_DECLARE_PUBLIC(QScriptEngineAgent) |
|
73 public: |
|
74 static QScriptEngineAgent* get(QScriptEngineAgentPrivate* p) {return p->q_func();} |
|
75 static QScriptEngineAgentPrivate* get(QScriptEngineAgent* p) {return p->d_func();} |
|
76 |
|
77 QScriptEngineAgentPrivate(){} |
|
78 virtual ~QScriptEngineAgentPrivate(){}; |
|
79 |
|
80 void attach(); |
|
81 void detach(); |
|
82 |
|
83 //scripts |
|
84 virtual void sourceParsed(JSC::ExecState*, const JSC::SourceCode&, int /*errorLine*/, const JSC::UString& /*errorMsg*/) {}; |
|
85 virtual void scriptUnload(qint64 id) |
|
86 { |
|
87 q_ptr->scriptUnload(id); |
|
88 }; |
|
89 virtual void scriptLoad(qint64 id, const JSC::UString &program, |
|
90 const JSC::UString &fileName, int baseLineNumber) |
|
91 { |
|
92 q_ptr->scriptLoad(id,program, fileName, baseLineNumber); |
|
93 }; |
|
94 |
|
95 //exceptions |
|
96 virtual void exception(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 exceptionThrow(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, bool hasHandler); |
|
103 virtual void exceptionCatch(const JSC::DebuggerCallFrame& frame, intptr_t sourceID); |
|
104 |
|
105 //statements |
|
106 virtual void atStatement(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno, int column); |
|
107 virtual void callEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno) |
|
108 { |
|
109 Q_UNUSED(lineno); |
|
110 q_ptr->contextPush(); |
|
111 q_ptr->functionEntry(sourceID); |
|
112 }; |
|
113 virtual void returnEvent(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno); |
|
114 virtual void willExecuteProgram(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno) |
|
115 { |
|
116 Q_UNUSED(frame); |
|
117 Q_UNUSED(sourceID); |
|
118 Q_UNUSED(lineno); |
|
119 }; |
|
120 virtual void didExecuteProgram(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno) |
|
121 { |
|
122 Q_UNUSED(frame); |
|
123 Q_UNUSED(sourceID); |
|
124 Q_UNUSED(lineno); |
|
125 }; |
|
126 virtual void functionExit(const JSC::JSValue& returnValue, intptr_t sourceID); |
|
127 //others |
|
128 virtual void didReachBreakpoint(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno, int column); |
|
129 |
|
130 virtual void evaluateStart(intptr_t sourceID) |
|
131 { |
|
132 q_ptr->functionEntry(sourceID); |
|
133 } |
|
134 virtual void evaluateStop(const JSC::JSValue& returnValue, intptr_t sourceID); |
|
135 |
|
136 QScriptEnginePrivate *engine; |
|
137 QScriptEngineAgent *q_ptr; |
|
138 }; |
|
139 |
|
140 QT_END_NAMESPACE |
|
141 |
|
142 #endif |