1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information ([email protected])
|
---|
5 | **
|
---|
6 | ** This file is part of the QtScript module of the Qt Toolkit.
|
---|
7 | **
|
---|
8 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
9 | ** Commercial Usage
|
---|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
11 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
12 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
13 | ** a written agreement between you and Nokia.
|
---|
14 | **
|
---|
15 | ** GNU Lesser General Public License Usage
|
---|
16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
17 | ** General Public License version 2.1 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
19 | ** packaging of this file. Please review the following information to
|
---|
20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
22 | **
|
---|
23 | ** In addition, as a special exception, Nokia gives you certain
|
---|
24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
---|
25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
---|
26 | ** package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you are unsure which license is appropriate for your use, please
|
---|
37 | ** contact the sales department at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #ifndef QSCRIPTENGINEFWD_P_H
|
---|
43 | #define QSCRIPTENGINEFWD_P_H
|
---|
44 |
|
---|
45 | #ifndef QT_NO_QOBJECT
|
---|
46 | #include "private/qobject_p.h"
|
---|
47 | #endif
|
---|
48 |
|
---|
49 | #ifndef QT_NO_SCRIPT
|
---|
50 |
|
---|
51 | #include <QtCore/qobjectdefs.h>
|
---|
52 |
|
---|
53 | #include <QtCore/QHash>
|
---|
54 | #include <QtCore/QList>
|
---|
55 | #include <QtCore/QRegExp>
|
---|
56 | #include <QtCore/QSet>
|
---|
57 | #include <QtCore/QStringList>
|
---|
58 | #include <QtCore/QTime>
|
---|
59 | #include <QtCore/QVector>
|
---|
60 |
|
---|
61 | #include "qscriptengine.h"
|
---|
62 | #include "qscriptrepository_p.h"
|
---|
63 | #include "qscriptgc_p.h"
|
---|
64 | #include "qscriptobjectfwd_p.h"
|
---|
65 | #include "qscriptclassinfo_p.h"
|
---|
66 | #include "qscriptstring_p.h"
|
---|
67 |
|
---|
68 | QT_BEGIN_NAMESPACE
|
---|
69 |
|
---|
70 | //
|
---|
71 | // W A R N I N G
|
---|
72 | // -------------
|
---|
73 | //
|
---|
74 | // This file is not part of the Qt API. It exists purely as an
|
---|
75 | // implementation detail. This header file may change from version to
|
---|
76 | // version without notice, or even be removed.
|
---|
77 | //
|
---|
78 | // We mean it.
|
---|
79 | //
|
---|
80 |
|
---|
81 | class QScriptClass;
|
---|
82 | class QScriptContext;
|
---|
83 |
|
---|
84 | namespace QScript {
|
---|
85 |
|
---|
86 | namespace AST {
|
---|
87 | class Node;
|
---|
88 | } // namespace AST
|
---|
89 |
|
---|
90 | namespace Ecma {
|
---|
91 | class Object;
|
---|
92 | class Number;
|
---|
93 | class Boolean;
|
---|
94 | class String;
|
---|
95 | class Math;
|
---|
96 | class Date;
|
---|
97 | class Function;
|
---|
98 | class Array;
|
---|
99 | class RegExp;
|
---|
100 | class Error;
|
---|
101 | } // namespace Ecma
|
---|
102 |
|
---|
103 | namespace Ext {
|
---|
104 | class Enumeration;
|
---|
105 | class Variant;
|
---|
106 | } // namespace Ext
|
---|
107 |
|
---|
108 | class ExtQObject;
|
---|
109 | class ExtQMetaObject;
|
---|
110 |
|
---|
111 | class Array;
|
---|
112 | class Lexer;
|
---|
113 | class Code;
|
---|
114 | class CompilationUnit;
|
---|
115 | class IdTable;
|
---|
116 | class MemoryPool;
|
---|
117 |
|
---|
118 | class IdTable
|
---|
119 | {
|
---|
120 | public:
|
---|
121 | inline IdTable()
|
---|
122 | : id_constructor(0), id_false(0), id_null(0),
|
---|
123 | id_object(0), id_pointer(0), id_prototype(0),
|
---|
124 | id_arguments(0), id_this(0), id_toString(0),
|
---|
125 | id_true(0), id_undefined(0), id_valueOf(0),
|
---|
126 | id_length(0), id_callee(0), id___proto__(0),
|
---|
127 | id___qt_sender__(0)
|
---|
128 | {}
|
---|
129 |
|
---|
130 | QScriptNameIdImpl *id_constructor;
|
---|
131 | QScriptNameIdImpl *id_false;
|
---|
132 | QScriptNameIdImpl *id_null;
|
---|
133 | QScriptNameIdImpl *id_object;
|
---|
134 | QScriptNameIdImpl *id_pointer;
|
---|
135 | QScriptNameIdImpl *id_prototype;
|
---|
136 | QScriptNameIdImpl *id_arguments;
|
---|
137 | QScriptNameIdImpl *id_this;
|
---|
138 | QScriptNameIdImpl *id_toString;
|
---|
139 | QScriptNameIdImpl *id_true;
|
---|
140 | QScriptNameIdImpl *id_undefined;
|
---|
141 | QScriptNameIdImpl *id_valueOf;
|
---|
142 | QScriptNameIdImpl *id_length;
|
---|
143 | QScriptNameIdImpl *id_callee;
|
---|
144 | QScriptNameIdImpl *id___proto__;
|
---|
145 | QScriptNameIdImpl *id___qt_sender__;
|
---|
146 | };
|
---|
147 |
|
---|
148 | } // namespace QScript
|
---|
149 |
|
---|
150 | #ifndef QT_NO_QOBJECT
|
---|
151 | class QScriptQObjectData;
|
---|
152 | class QScriptMetaObject;
|
---|
153 | #endif
|
---|
154 |
|
---|
155 | class QScriptCustomTypeInfo
|
---|
156 | {
|
---|
157 | public:
|
---|
158 | QScriptCustomTypeInfo() : signature(0, '\0'), marshal(0), demarshal(0)
|
---|
159 | { prototype.invalidate(); }
|
---|
160 |
|
---|
161 | QByteArray signature;
|
---|
162 | QScriptEngine::MarshalFunction marshal;
|
---|
163 | QScriptEngine::DemarshalFunction demarshal;
|
---|
164 | QScriptValueImpl prototype;
|
---|
165 | };
|
---|
166 |
|
---|
167 | class QScriptEnginePrivate
|
---|
168 | #ifndef QT_NO_QOBJECT
|
---|
169 | : public QObjectPrivate
|
---|
170 | #endif
|
---|
171 | {
|
---|
172 | Q_DECLARE_PUBLIC(QScriptEngine)
|
---|
173 |
|
---|
174 | enum {
|
---|
175 | DefaultHashSize = 1021
|
---|
176 | };
|
---|
177 |
|
---|
178 | public:
|
---|
179 | QScriptEnginePrivate();
|
---|
180 | virtual ~QScriptEnginePrivate();
|
---|
181 |
|
---|
182 | void init();
|
---|
183 | void initStringRepository();
|
---|
184 |
|
---|
185 | static inline QScriptEnginePrivate *get(QScriptEngine *q);
|
---|
186 | static inline const QScriptEnginePrivate *get(const QScriptEngine *q);
|
---|
187 | static inline QScriptEngine *get(QScriptEnginePrivate *d);
|
---|
188 |
|
---|
189 | QScript::AST::Node *createAbstractSyntaxTree(
|
---|
190 | const QString &source, int lineNumber,
|
---|
191 | QString *errorMessage, int *errorLineNumber);
|
---|
192 | QScript::AST::Node *changeAbstractSyntaxTree(QScript::AST::Node *program);
|
---|
193 |
|
---|
194 | inline QScript::AST::Node *abstractSyntaxTree() const;
|
---|
195 | inline bool hasUncaughtException() const;
|
---|
196 | inline QScriptValueImpl uncaughtException() const;
|
---|
197 | QStringList uncaughtExceptionBacktrace() const;
|
---|
198 | void clearExceptions();
|
---|
199 | #ifndef QT_NO_QOBJECT
|
---|
200 | void emitSignalHandlerException();
|
---|
201 | #endif
|
---|
202 |
|
---|
203 | static bool canEvaluate(const QString &program);
|
---|
204 | static QScriptSyntaxCheckResult checkSyntax(const QString &program);
|
---|
205 |
|
---|
206 | inline QScriptContextPrivate *currentContext() const;
|
---|
207 | inline QScriptContextPrivate *pushContext();
|
---|
208 | inline void popContext();
|
---|
209 |
|
---|
210 | inline QScript::MemoryPool *nodePool();
|
---|
211 | inline QScript::Lexer *lexer();
|
---|
212 | inline QScriptObject *allocObject();
|
---|
213 |
|
---|
214 | inline void maybeGC();
|
---|
215 |
|
---|
216 | void maybeGC_helper(bool do_string_gc);
|
---|
217 |
|
---|
218 | inline bool blockGC(bool block);
|
---|
219 |
|
---|
220 | void gc();
|
---|
221 | bool isCollecting() const;
|
---|
222 | void processMarkStack(int generation);
|
---|
223 |
|
---|
224 | inline void adjustBytesAllocated(int bytes);
|
---|
225 |
|
---|
226 | void markObject(const QScriptValueImpl &object, int generation);
|
---|
227 | void markFrame(QScriptContextPrivate *context, int generation);
|
---|
228 |
|
---|
229 | inline void markString(QScriptNameIdImpl *id, int generation);
|
---|
230 |
|
---|
231 | inline QScriptValueImpl createFunction(QScriptFunction *fun);
|
---|
232 | inline QScriptValueImpl newArray(const QScript::Array &value);
|
---|
233 | inline QScriptValueImpl newArray(uint length = 0);
|
---|
234 |
|
---|
235 | void evaluate(QScriptContextPrivate *context, const QString &contents,
|
---|
236 | int lineNumber, const QString &fileName = QString());
|
---|
237 |
|
---|
238 | inline void setLexer(QScript::Lexer *lexer);
|
---|
239 |
|
---|
240 | inline void setNodePool(QScript::MemoryPool *pool);
|
---|
241 |
|
---|
242 | inline QScriptClassInfo *registerClass(const QString &pname, int type);
|
---|
243 |
|
---|
244 | inline QScriptClassInfo *registerClass(const QString &name);
|
---|
245 |
|
---|
246 | int registerCustomClassType();
|
---|
247 |
|
---|
248 | inline QScriptValueImpl createFunction(QScriptInternalFunctionSignature fun,
|
---|
249 | int length, QScriptClassInfo *classInfo,
|
---|
250 | const QString &name = QString());
|
---|
251 |
|
---|
252 | static inline QString toString(QScriptNameIdImpl *id);
|
---|
253 | inline QString memberName(const QScript::Member &member) const;
|
---|
254 | inline void newReference(QScriptValueImpl *object, int mode);
|
---|
255 | inline void newActivation(QScriptValueImpl *object);
|
---|
256 | inline void newFunction(QScriptValueImpl *object, QScriptFunction *function);
|
---|
257 | inline void newConstructor(QScriptValueImpl *ctor, QScriptFunction *function,
|
---|
258 | QScriptValueImpl &proto);
|
---|
259 | inline void newInteger(QScriptValueImpl *object, int i);
|
---|
260 | inline void newPointer(QScriptValueImpl *object, void *ptr);
|
---|
261 | inline void newNameId(QScriptValueImpl *object, const QString &s);
|
---|
262 | inline void newNameId(QScriptValueImpl *object, QScriptNameIdImpl *id);
|
---|
263 | inline void newString(QScriptValueImpl *object, const QString &s);
|
---|
264 | inline void newArguments(QScriptValueImpl *object, const QScriptValueImpl &activation,
|
---|
265 | uint length, const QScriptValueImpl &callee);
|
---|
266 | static inline QString convertToNativeString(const QScriptValueImpl &value);
|
---|
267 | static QString convertToNativeString_helper(const QScriptValueImpl &value);
|
---|
268 | static inline qsreal convertToNativeDouble(const QScriptValueImpl &value);
|
---|
269 | static qsreal convertToNativeDouble_helper(const QScriptValueImpl &value);
|
---|
270 | static inline bool convertToNativeBoolean(const QScriptValueImpl &value);
|
---|
271 | static bool convertToNativeBoolean_helper(const QScriptValueImpl &value);
|
---|
272 | static inline qint32 convertToNativeInt32(const QScriptValueImpl &value);
|
---|
273 | static inline QScriptFunction *convertToNativeFunction(const QScriptValueImpl &value);
|
---|
274 |
|
---|
275 | inline QScriptValue toPublic(const QScriptValueImpl &value);
|
---|
276 | inline QScriptValueImpl toImpl(const QScriptValue &value);
|
---|
277 | QScriptValueImpl toImpl_helper(const QScriptValue &value);
|
---|
278 | inline QScriptValueImplList toImplList(const QScriptValueList &lst);
|
---|
279 |
|
---|
280 | inline const QScript::IdTable *idTable() const;
|
---|
281 |
|
---|
282 | inline QScriptValueImpl toObject(const QScriptValueImpl &value);
|
---|
283 | QScriptValueImpl toObject_helper(const QScriptValueImpl &value);
|
---|
284 |
|
---|
285 | inline QScriptValueImpl toPrimitive(const QScriptValueImpl &object,
|
---|
286 | QScriptValueImpl::TypeHint hint = QScriptValueImpl::NoTypeHint);
|
---|
287 | QScriptValueImpl toPrimitive_helper(const QScriptValueImpl &object,
|
---|
288 | QScriptValueImpl::TypeHint hint);
|
---|
289 |
|
---|
290 | static const qsreal D16;
|
---|
291 | static const qsreal D32;
|
---|
292 |
|
---|
293 | inline static qsreal toInteger(qsreal n);
|
---|
294 | inline static qint32 toInt32(qsreal m);
|
---|
295 | inline static quint32 toUint32(qsreal n);
|
---|
296 | inline static quint16 toUint16(qsreal n);
|
---|
297 |
|
---|
298 | inline QDateTime toDateTime(const QScriptValueImpl &value) const;
|
---|
299 |
|
---|
300 | inline void newArray(QScriptValueImpl *object, const QScript::Array &value);
|
---|
301 |
|
---|
302 | inline void newObject(QScriptValueImpl *o, const QScriptValueImpl &proto,
|
---|
303 | QScriptClassInfo *oc = 0);
|
---|
304 | inline void newObject(QScriptValueImpl *o, QScriptClassInfo *oc = 0);
|
---|
305 | QScriptValueImpl newObject(QScriptClass *scriptClass, const QScriptValueImpl &data);
|
---|
306 |
|
---|
307 | inline QScriptValueImpl newObject();
|
---|
308 |
|
---|
309 | inline void newVariant(QScriptValueImpl *out, const QVariant &value,
|
---|
310 | bool setDefaultPrototype = true);
|
---|
311 |
|
---|
312 | #ifndef QT_NO_QOBJECT
|
---|
313 | void newQObject(QScriptValueImpl *out, QObject *object,
|
---|
314 | QScriptEngine::ValueOwnership ownership = QScriptEngine::QtOwnership,
|
---|
315 | const QScriptEngine::QObjectWrapOptions &options = 0,
|
---|
316 | bool setDefaultPrototype = true);
|
---|
317 |
|
---|
318 | # ifndef Q_SCRIPT_NO_QMETAOBJECT_CACHE
|
---|
319 | inline QScriptMetaObject *cachedMetaObject(const QMetaObject *meta);
|
---|
320 | # endif
|
---|
321 | #endif
|
---|
322 |
|
---|
323 | inline QScriptNameIdImpl *nameId(const QString &str, bool persistent = false);
|
---|
324 |
|
---|
325 | inline QScriptNameIdImpl *intern(const QChar *u, int s);
|
---|
326 |
|
---|
327 | QScriptString internedString(const QString &str);
|
---|
328 | QScriptString internedString(QScriptNameIdImpl *nid);
|
---|
329 | void uninternString(QScriptStringPrivate *d);
|
---|
330 |
|
---|
331 | inline QScriptValueImpl valueFromVariant(const QVariant &v);
|
---|
332 |
|
---|
333 | inline QScriptValueImpl undefinedValue();
|
---|
334 |
|
---|
335 | inline QScriptValueImpl nullValue();
|
---|
336 |
|
---|
337 | inline QScriptValueImpl defaultPrototype(int metaTypeId) const;
|
---|
338 |
|
---|
339 | inline void setDefaultPrototype(int metaTypeId, const QScriptValueImpl &prototype);
|
---|
340 |
|
---|
341 | QScriptValueImpl call(const QScriptValueImpl &callee, const QScriptValueImpl &thisObject,
|
---|
342 | const QScriptValueImplList &args, bool asConstructor);
|
---|
343 | QScriptValueImpl call(const QScriptValueImpl &callee, const QScriptValueImpl &thisObject,
|
---|
344 | const QScriptValueImpl &args, bool asConstructor);
|
---|
345 |
|
---|
346 | void rehashStringRepository(bool resize = true);
|
---|
347 | inline QScriptNameIdImpl *toStringEntry(const QString &s);
|
---|
348 | QScriptNameIdImpl *insertStringEntry(const QString &s);
|
---|
349 |
|
---|
350 | QScriptValueImpl create(int type, const void *ptr);
|
---|
351 | static bool convert(const QScriptValueImpl &value, int type, void *ptr,
|
---|
352 | QScriptEnginePrivate *eng);
|
---|
353 |
|
---|
354 | QScriptValueImpl arrayFromStringList(const QStringList &lst);
|
---|
355 | static QStringList stringListFromArray(const QScriptValueImpl &arr);
|
---|
356 |
|
---|
357 | QScriptValueImpl arrayFromVariantList(const QVariantList &lst);
|
---|
358 | static QVariantList variantListFromArray(const QScriptValueImpl &arr);
|
---|
359 |
|
---|
360 | QScriptValueImpl objectFromVariantMap(const QVariantMap &vmap);
|
---|
361 | static QVariantMap variantMapFromObject(const QScriptValueImpl &obj);
|
---|
362 |
|
---|
363 | static inline bool lessThan(const QScriptValueImpl &lhs, const QScriptValueImpl &rhs);
|
---|
364 | static inline bool equals(const QScriptValueImpl &lhs, const QScriptValueImpl &rhs);
|
---|
365 | static inline bool strictlyEquals(const QScriptValueImpl &lhs, const QScriptValueImpl &rhs);
|
---|
366 |
|
---|
367 | QScriptValuePrivate *registerValue(const QScriptValueImpl &value);
|
---|
368 | inline void unregisterValue(QScriptValuePrivate *p);
|
---|
369 |
|
---|
370 | inline QScriptValueImpl globalObject() const;
|
---|
371 |
|
---|
372 | QScriptValueImpl objectById(qint64 id) const;
|
---|
373 |
|
---|
374 | QScriptValueImpl importExtension(const QString &extension);
|
---|
375 | QStringList availableExtensions() const;
|
---|
376 | QStringList importedExtensions() const;
|
---|
377 |
|
---|
378 | inline void maybeProcessEvents();
|
---|
379 | void setupProcessEvents();
|
---|
380 | void processEvents();
|
---|
381 |
|
---|
382 | #ifndef QT_NO_QOBJECT
|
---|
383 | QScriptQObjectData *qobjectData(QObject *object);
|
---|
384 |
|
---|
385 | bool scriptConnect(QObject *sender, const char *signal,
|
---|
386 | const QScriptValueImpl &receiver,
|
---|
387 | const QScriptValueImpl &function);
|
---|
388 | bool scriptDisconnect(QObject *sender, const char *signal,
|
---|
389 | const QScriptValueImpl &receiver,
|
---|
390 | const QScriptValueImpl &function);
|
---|
391 |
|
---|
392 | bool scriptConnect(QObject *sender, int index,
|
---|
393 | const QScriptValueImpl &receiver,
|
---|
394 | const QScriptValueImpl &function,
|
---|
395 | const QScriptValueImpl &senderWrapper = QScriptValueImpl());
|
---|
396 | bool scriptDisconnect(QObject *sender, int index,
|
---|
397 | const QScriptValueImpl &receiver,
|
---|
398 | const QScriptValueImpl &function);
|
---|
399 |
|
---|
400 | bool scriptConnect(const QScriptValueImpl &signal,
|
---|
401 | const QScriptValueImpl &receiver,
|
---|
402 | const QScriptValueImpl &function);
|
---|
403 | bool scriptDisconnect(const QScriptValueImpl &signal,
|
---|
404 | const QScriptValueImpl &receiver,
|
---|
405 | const QScriptValueImpl &function);
|
---|
406 |
|
---|
407 | void _q_objectDestroyed(QObject *object);
|
---|
408 |
|
---|
409 | void disposeQObject(QObject *object);
|
---|
410 | void deletePendingQObjects();
|
---|
411 |
|
---|
412 | static bool convertToNativeQObject(const QScriptValueImpl &value,
|
---|
413 | const QByteArray &targetType,
|
---|
414 | void **result);
|
---|
415 | #endif
|
---|
416 |
|
---|
417 | void abortEvaluation(const QScriptValueImpl &result);
|
---|
418 | inline bool shouldAbort() const;
|
---|
419 | inline void resetAbortFlag();
|
---|
420 |
|
---|
421 | void setAgent(QScriptEngineAgent *agent);
|
---|
422 | QScriptEngineAgent *agent() const;
|
---|
423 |
|
---|
424 | void agentDeleted(QScriptEngineAgent *agent);
|
---|
425 |
|
---|
426 | void installTranslatorFunctions(QScriptValueImpl &object);
|
---|
427 |
|
---|
428 | #ifndef Q_SCRIPT_NO_EVENT_NOTIFY
|
---|
429 | qint64 nextScriptId();
|
---|
430 | inline bool shouldNotify() const;
|
---|
431 | inline void notifyScriptLoad(qint64 id, const QString &program,
|
---|
432 | const QString &fileName, int lineNumber);
|
---|
433 | void notifyScriptLoad_helper(qint64 id, const QString &program,
|
---|
434 | const QString &fileName, int lineNumber);
|
---|
435 | inline void notifyScriptUnload(qint64 id);
|
---|
436 | void notifyScriptUnload_helper(qint64 id);
|
---|
437 | inline void notifyPositionChange(QScriptContextPrivate *ctx);
|
---|
438 | void notifyPositionChange_helper(QScriptContextPrivate *ctx);
|
---|
439 | inline void notifyContextPush();
|
---|
440 | void notifyContextPush_helper();
|
---|
441 | inline void notifyContextPop();
|
---|
442 | void notifyContextPop_helper();
|
---|
443 | inline void notifyFunctionEntry(QScriptContextPrivate *ctx);
|
---|
444 | void notifyFunctionEntry_helper(QScriptContextPrivate *ctx);
|
---|
445 | inline void notifyFunctionExit(QScriptContextPrivate *ctx);
|
---|
446 | void notifyFunctionExit_helper(QScriptContextPrivate *ctx);
|
---|
447 | inline void notifyException(QScriptContextPrivate *ctx);
|
---|
448 | void notifyException_helper(QScriptContextPrivate *ctx);
|
---|
449 | inline void notifyExceptionCatch(QScriptContextPrivate *ctx);
|
---|
450 | void notifyExceptionCatch_helper(QScriptContextPrivate *ctx);
|
---|
451 | void notifyDebugger(QScriptContextPrivate *ctx);
|
---|
452 | #endif // Q_SCRIPT_NO_EVENT_NOTIFY
|
---|
453 |
|
---|
454 | public: // attributes
|
---|
455 | bool m_evaluating;
|
---|
456 | bool m_abort;
|
---|
457 | int m_callDepth;
|
---|
458 | int m_maxCallDepth;
|
---|
459 | int m_gc_depth;
|
---|
460 | QList<QScriptValueImpl> m_markStack;
|
---|
461 | QScriptValueImpl m_globalObject;
|
---|
462 | int m_oldStringRepositorySize;
|
---|
463 | int m_oldTempStringRepositorySize;
|
---|
464 | QVector<QScriptNameIdImpl*> m_stringRepository;
|
---|
465 | int m_newAllocatedStringRepositoryChars;
|
---|
466 | QVector<QScriptNameIdImpl*> m_tempStringRepository;
|
---|
467 | int m_newAllocatedTempStringRepositoryChars;
|
---|
468 | QScriptNameIdImpl **m_string_hash_base;
|
---|
469 | int m_string_hash_size;
|
---|
470 | QScript::GCAlloc<QScriptObject> objectAllocator;
|
---|
471 | int m_objectGeneration;
|
---|
472 | QScript::Repository<QScriptContext, QScriptContextPrivate> m_frameRepository;
|
---|
473 | QScriptContextPrivate *m_context;
|
---|
474 | QScriptValueImpl *tempStackBegin;
|
---|
475 | QScriptValueImpl *tempStackEnd;
|
---|
476 | QScript::AST::Node *m_abstractSyntaxTree;
|
---|
477 | QScript::Lexer *m_lexer;
|
---|
478 | QScript::MemoryPool *m_pool;
|
---|
479 | QStringList m_exceptionBacktrace;
|
---|
480 | qint64 m_scriptCounter;
|
---|
481 |
|
---|
482 | QScriptValueImpl m_undefinedValue;
|
---|
483 | QScriptValueImpl m_nullValue;
|
---|
484 |
|
---|
485 | QScript::Ecma::Object *objectConstructor;
|
---|
486 | QScript::Ecma::Number *numberConstructor;
|
---|
487 | QScript::Ecma::Boolean *booleanConstructor;
|
---|
488 | QScript::Ecma::String *stringConstructor;
|
---|
489 | QScript::Ecma::Date *dateConstructor;
|
---|
490 | QScript::Ecma::Function *functionConstructor;
|
---|
491 | QScript::Ecma::Array *arrayConstructor;
|
---|
492 | QScript::Ecma::RegExp *regexpConstructor;
|
---|
493 | QScript::Ecma::Error *errorConstructor;
|
---|
494 | QScript::Ext::Enumeration *enumerationConstructor;
|
---|
495 | QScript::Ext::Variant *variantConstructor;
|
---|
496 | QScript::ExtQObject *qobjectConstructor;
|
---|
497 | QScript::ExtQMetaObject *qmetaObjectConstructor;
|
---|
498 |
|
---|
499 | QHash<int, QScriptCustomTypeInfo> m_customTypes;
|
---|
500 |
|
---|
501 | QScriptFunction *m_evalFunction;
|
---|
502 |
|
---|
503 | QList<QScriptClassInfo*> m_allocated_classes;
|
---|
504 | QScriptClassInfo *m_class_object;
|
---|
505 | QScriptClassInfo *m_class_function;
|
---|
506 | QScriptClassInfo *m_class_with;
|
---|
507 | QScriptClassInfo *m_class_arguments;
|
---|
508 | QScriptClassInfo *m_class_activation;
|
---|
509 |
|
---|
510 | int m_class_prev_id;
|
---|
511 | qint64 m_next_object_id;
|
---|
512 |
|
---|
513 | QScript::Repository<QScriptValuePrivate, QScriptValuePrivate> m_handleRepository;
|
---|
514 | QHash<QScriptObject*, QScriptValuePrivate*> m_objectHandles;
|
---|
515 | QHash<QScriptNameIdImpl*, QScriptValuePrivate*> m_stringHandles;
|
---|
516 | QVector<QScriptValuePrivate*> m_otherHandles;
|
---|
517 |
|
---|
518 | QScript::Repository<QScriptStringPrivate,
|
---|
519 | QScriptStringPrivate> m_internedStringRepository;
|
---|
520 | QHash<QScriptNameIdImpl*, QScriptStringPrivate*> m_internedStrings;
|
---|
521 |
|
---|
522 | QSet<QScriptObject*> visitedArrayElements;
|
---|
523 |
|
---|
524 | #ifndef QT_NO_REGEXP
|
---|
525 | QHash<QString, QRegExp> m_regExpLiterals;
|
---|
526 | #endif
|
---|
527 |
|
---|
528 | QScript::IdTable m_id_table;
|
---|
529 |
|
---|
530 | QSet<QString> m_importedExtensions;
|
---|
531 | QSet<QString> m_extensionsBeingImported;
|
---|
532 |
|
---|
533 | int m_processEventsInterval;
|
---|
534 | int m_nextProcessEvents;
|
---|
535 | int m_processEventIncr;
|
---|
536 | QTime m_processEventTracker;
|
---|
537 |
|
---|
538 | QList<QScriptEngineAgent*> m_agents;
|
---|
539 | QScriptEngineAgent *m_agent;
|
---|
540 |
|
---|
541 | #ifndef QT_NO_QOBJECT
|
---|
542 | QList<QObject*> m_qobjectsToBeDeleted;
|
---|
543 | QHash<QObject*, QScriptQObjectData*> m_qobjectData;
|
---|
544 |
|
---|
545 | # ifndef Q_SCRIPT_NO_QMETAOBJECT_CACHE
|
---|
546 | QHash<const QMetaObject*, QScriptMetaObject*> m_cachedMetaObjects;
|
---|
547 | # endif
|
---|
548 | #endif
|
---|
549 |
|
---|
550 | #ifdef QT_NO_QOBJECT
|
---|
551 | QScriptEngine *q_ptr;
|
---|
552 | #endif
|
---|
553 | };
|
---|
554 |
|
---|
555 | QT_END_NAMESPACE
|
---|
556 |
|
---|
557 | #endif // QT_NO_SCRIPT
|
---|
558 |
|
---|
559 | #endif
|
---|