1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #ifndef QDECLARATIVEINSTRUCTION_P_H
43 #define QDECLARATIVEINSTRUCTION_P_H
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.
56 #include <QtCore/qglobal.h>
57 #include <private/qdeclarativepropertycache_p.h>
61 #define FOR_EACH_QML_INSTR(F) \
63 F(DeferInit, deferInit) \
65 F(CreateCppObject, create) \
66 F(CreateQMLObject, createQml) \
67 F(CompleteQMLObject, completeQml) \
68 F(CreateSimpleObject, createSimple) \
70 F(SetDefault, common) \
71 F(CreateComponent, createComponent) \
72 F(StoreMetaObject, storeMeta) \
73 F(StoreVariant, storeString) \
74 F(StoreVariantInteger, storeInteger) \
75 F(StoreVariantDouble, storeDouble) \
76 F(StoreVariantBool, storeBool) \
77 F(StoreVar, storeString) \
78 F(StoreVarInteger, storeInteger) \
79 F(StoreVarDouble, storeDouble) \
80 F(StoreVarBool, storeBool) \
81 F(StoreString, storeString) \
82 F(StoreByteArray, storeByteArray) \
83 F(StoreUrl, storeUrl) \
84 F(StoreFloat, storeFloat) \
85 F(StoreDouble, storeDouble) \
86 F(StoreBool, storeBool) \
87 F(StoreInteger, storeInteger) \
88 F(StoreColor, storeColor) \
89 F(StoreDate, storeDate) \
90 F(StoreTime, storeTime) \
91 F(StoreDateTime, storeDateTime) \
92 F(StorePoint, storePoint) \
93 F(StorePointF, storePointF) \
94 F(StoreSize, storeSize) \
95 F(StoreSizeF, storeSizeF) \
96 F(StoreRect, storeRect) \
97 F(StoreRectF, storeRectF) \
98 F(StoreVector3D, storeVector3D) \
99 F(StoreVector4D, storeVector4D) \
100 F(StoreObject, storeObject) \
101 F(AssignCustomType, assignCustomType) \
102 F(AssignSignalObject, assignSignalObject) \
103 F(StoreSignal, storeSignal) \
104 F(StoreImportedScript, storeScript) \
105 F(StoreScriptString, storeScriptString) \
106 F(BeginObject, begin) \
107 F(InitV8Bindings, initV8Bindings) \
108 F(StoreBinding, assignBinding) \
109 F(StoreBindingOnAlias, assignBinding) \
110 F(StoreV8Binding, assignBinding) \
111 F(StoreV4Binding, assignV4Binding) \
112 F(StoreValueSource, assignValueSource) \
113 F(StoreValueInterceptor, assignValueInterceptor) \
114 F(StoreObjectQList, common) \
115 F(AssignObjectList, assignObjectList) \
116 F(StoreVariantObject, storeObject) \
117 F(StoreVarObject, storeObject) \
118 F(StoreInterface, storeObject) \
119 F(FetchAttached, fetchAttached) \
120 F(FetchQList, fetchQmlList) \
121 F(FetchObject, fetch) \
122 F(PopQList, common) \
124 F(PopFetchedObject, common) \
125 F(FetchValueType, fetchValue) \
126 F(PopValueType, fetchValue)
128 #if defined(Q_CC_GNU) && (!defined(Q_CC_INTEL) || __INTEL_COMPILER >= 1200)
129 # define QML_THREADED_VME_INTERPRETER
133 # define QML_INSTR_ALIGN_MASK (Q_ALIGNOF(QDeclarativeInstruction) - 1)
135 # define QML_INSTR_ALIGN_MASK (sizeof(void *) - 1)
138 #ifdef QML_THREADED_VME_INTERPRETER
139 # define QML_INSTR_HEADER void *code;
141 # define QML_INSTR_HEADER quint8 instructionType;
144 #define QML_INSTR_ENUM(I, FMT) I,
145 #define QML_INSTR_SIZE(I, FMT) ((sizeof(QDeclarativeInstruction::instr_##FMT) + QML_INSTR_ALIGN_MASK) & ~QML_INSTR_ALIGN_MASK)
147 class QDeclarativeCompiledData;
148 union QDeclarativeInstruction
151 FOR_EACH_QML_INSTR(QML_INSTR_ENUM)
154 struct instr_common {
160 int parserStatusSize;
166 struct instr_deferInit {
169 int parserStatusSize;
173 struct instr_createQml {
179 struct instr_completeQml {
185 struct instr_create {
193 struct instr_createSimple {
195 void (*create)(void *);
201 struct instr_storeMeta {
212 struct instr_assignValueSource {
214 QDeclarativePropertyCache::RawData property;
218 struct instr_assignValueInterceptor {
220 QDeclarativePropertyCache::RawData property;
224 struct instr_initV8Bindings {
230 struct instr_assignV4Binding {
232 unsigned int property;
239 struct instr_assignBinding {
241 QDeclarativePropertyCache::RawData property;
253 struct instr_fetchValue {
257 quint32 bindingSkipList;
259 struct instr_fetchQmlList {
268 struct instr_storeFloat {
273 struct instr_storeDouble {
278 struct instr_storeInteger {
283 struct instr_storeBool {
288 struct instr_storeString {
293 struct instr_storeByteArray {
298 struct instr_storeScriptString {
306 struct instr_storeScript {
310 struct instr_storeUrl {
315 struct instr_storeColor {
320 struct instr_storeDate {
325 struct instr_storeTime {
330 #if defined(Q_OS_WINCE)
335 struct instr_storeDateTime {
339 instr_storeTime::QTime time;
341 struct instr_storeRect {
345 #if defined(Q_OS_MAC)
358 struct instr_storeRectF {
368 struct instr_storeObject {
373 struct instr_assignCustomType {
380 struct instr_storeSignal {
388 struct instr_assignSignalObject {
393 struct instr_createComponent {
402 struct instr_fetchAttached {
411 struct instr_assignObjectList {
415 struct instr_storePoint {
423 struct instr_storePointF {
431 struct instr_storeSize {
439 struct instr_storeSizeF {
447 struct instr_storeVector3D {
456 struct instr_storeVector4D {
469 instr_deferInit deferInit;
471 instr_createQml createQml;
472 instr_completeQml completeQml;
473 instr_createSimple createSimple;
474 instr_storeMeta storeMeta;
476 instr_assignValueSource assignValueSource;
477 instr_assignValueInterceptor assignValueInterceptor;
478 instr_initV8Bindings initV8Bindings;
479 instr_assignV4Binding assignV4Binding;
480 instr_assignBinding assignBinding;
482 instr_fetchValue fetchValue;
483 instr_fetchQmlList fetchQmlList;
485 instr_storeFloat storeFloat;
486 instr_storeDouble storeDouble;
487 instr_storeInteger storeInteger;
488 instr_storeBool storeBool;
489 instr_storeString storeString;
490 instr_storeByteArray storeByteArray;
491 instr_storeScriptString storeScriptString;
492 instr_storeScript storeScript;
493 instr_storeUrl storeUrl;
494 instr_storeColor storeColor;
495 instr_storeDate storeDate;
496 instr_storeTime storeTime;
497 instr_storeDateTime storeDateTime;
498 instr_storePoint storePoint;
499 instr_storePointF storePointF;
500 instr_storeSize storeSize;
501 instr_storeSizeF storeSizeF;
502 instr_storeRect storeRect;
503 instr_storeRectF storeRectF;
504 instr_storeVector3D storeVector3D;
505 instr_storeVector4D storeVector4D;
506 instr_storeObject storeObject;
507 instr_assignCustomType assignCustomType;
508 instr_storeSignal storeSignal;
509 instr_assignSignalObject assignSignalObject;
510 instr_createComponent createComponent;
511 instr_fetchAttached fetchAttached;
513 instr_assignObjectList assignObjectList;
515 static int size(Type type);
519 struct QDeclarativeInstructionMeta {
522 #define QML_INSTR_META_TEMPLATE(I, FMT) \
523 template<> struct QDeclarativeInstructionMeta<(int)QDeclarativeInstruction::I> { \
524 enum { Size = QML_INSTR_SIZE(I, FMT) }; \
525 typedef QDeclarativeInstruction::instr_##FMT DataType; \
526 static const DataType &data(const QDeclarativeInstruction &instr) { return instr.FMT; } \
527 static void setData(QDeclarativeInstruction &instr, const DataType &v) { instr.FMT = v; } \
529 FOR_EACH_QML_INSTR(QML_INSTR_META_TEMPLATE);
530 #undef QML_INSTR_META_TEMPLATE
533 class QDeclarativeInstructionData : public QDeclarativeInstructionMeta<Instr>::DataType
539 #endif // QDECLARATIVEINSTRUCTION_P_H