Remove "All rights reserved" line from license headers.
[profile/ivi/qtdeclarative.git] / src / declarative / qml / qdeclarativeinstruction_p.h
index a48c44c..49eadad 100644 (file)
@@ -1,8 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
 **
 ** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
@@ -35,6 +34,7 @@
 **
 **
 **
+**
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
 //
 
 #include <QtCore/qglobal.h>
+#include <private/qdeclarativepropertycache_p.h>
 
 QT_BEGIN_NAMESPACE
 
 #define FOR_EACH_QML_INSTR(F) \
     F(Init, init) \
+    F(DeferInit, deferInit) \
     F(Done, common) \
-    F(CreateObject, create) \
+    F(CreateCppObject, create) \
+    F(CreateQMLObject, createQml) \
+    F(CompleteQMLObject, completeQml) \
     F(CreateSimpleObject, createSimple) \
     F(SetId, setId) \
     F(SetDefault, common) \
@@ -70,13 +74,25 @@ QT_BEGIN_NAMESPACE
     F(StoreVariantInteger, storeInteger) \
     F(StoreVariantDouble, storeDouble) \
     F(StoreVariantBool, storeBool) \
+    F(StoreVar, storeString) \
+    F(StoreVarInteger, storeInteger) \
+    F(StoreVarDouble, storeDouble) \
+    F(StoreVarBool, storeBool) \
     F(StoreString, storeString) \
+    F(StoreStringList, storeString) \
+    F(StoreStringQList, storeString) \
+    F(StoreTrString, storeTrString) \
+    F(StoreTrIdString, storeTrIdString) \
     F(StoreByteArray, storeByteArray) \
     F(StoreUrl, storeUrl) \
+    F(StoreUrlQList, storeUrl) \
     F(StoreFloat, storeFloat) \
     F(StoreDouble, storeDouble) \
+    F(StoreDoubleQList, storeDouble) \
     F(StoreBool, storeBool) \
+    F(StoreBoolQList, storeBool) \
     F(StoreInteger, storeInteger) \
+    F(StoreIntegerQList, storeInteger) \
     F(StoreColor, storeColor) \
     F(StoreDate, storeDate) \
     F(StoreTime, storeTime) \
@@ -88,6 +104,7 @@ QT_BEGIN_NAMESPACE
     F(StoreRect, storeRect) \
     F(StoreRectF, storeRectF) \
     F(StoreVector3D, storeVector3D) \
+    F(StoreVector4D, storeVector4D) \
     F(StoreObject, storeObject) \
     F(AssignCustomType, assignCustomType) \
     F(AssignSignalObject, assignSignalObject) \
@@ -98,13 +115,14 @@ QT_BEGIN_NAMESPACE
     F(InitV8Bindings, initV8Bindings) \
     F(StoreBinding, assignBinding) \
     F(StoreBindingOnAlias, assignBinding) \
-    F(StoreV4Binding, assignBinding) \
     F(StoreV8Binding, assignBinding) \
+    F(StoreV4Binding, assignV4Binding) \
     F(StoreValueSource, assignValueSource) \
     F(StoreValueInterceptor, assignValueInterceptor) \
     F(StoreObjectQList, common) \
     F(AssignObjectList, assignObjectList) \
     F(StoreVariantObject, storeObject) \
+    F(StoreVarObject, storeObject) \
     F(StoreInterface, storeObject) \
     F(FetchAttached, fetchAttached) \
     F(FetchQList, fetchQmlList) \
@@ -115,13 +133,22 @@ QT_BEGIN_NAMESPACE
     F(FetchValueType, fetchValue) \
     F(PopValueType, fetchValue) 
 
+#if defined(Q_CC_GNU) && (!defined(Q_CC_INTEL) || __INTEL_COMPILER >= 1200)
+#  define QML_THREADED_VME_INTERPRETER
+#endif
+
 #ifdef Q_ALIGNOF
 #  define QML_INSTR_ALIGN_MASK (Q_ALIGNOF(QDeclarativeInstruction) - 1)
 #else
 #  define QML_INSTR_ALIGN_MASK (sizeof(void *) - 1)
 #endif
 
-#define QML_INSTR_HEADER quint8 instructionType;
+#ifdef QML_THREADED_VME_INTERPRETER
+#  define QML_INSTR_HEADER void *code;
+#else
+#  define QML_INSTR_HEADER quint8 instructionType;
+#endif
+
 #define QML_INSTR_ENUM(I, FMT)  I,
 #define QML_INSTR_SIZE(I, FMT) ((sizeof(QDeclarativeInstruction::instr_##FMT) + QML_INSTR_ALIGN_MASK) & ~QML_INSTR_ALIGN_MASK)
 
@@ -132,9 +159,6 @@ union QDeclarativeInstruction
         FOR_EACH_QML_INSTR(QML_INSTR_ENUM)
     };
 
-    inline void setType(Type type) { common.instructionType = type; }
-    inline Type type() const { return (Type)common.instructionType; }
-
     struct instr_common {
         QML_INSTR_HEADER
     };
@@ -144,14 +168,35 @@ union QDeclarativeInstruction
         int parserStatusSize;
         int contextCache;
         int compiledBinding;
+        int objectStackSize;
+        int listStackSize;
+    };
+    struct instr_deferInit {
+        QML_INSTR_HEADER
+        int bindingsSize;
+        int parserStatusSize;
+        int objectStackSize;
+        int listStackSize;
+    };
+    struct instr_createQml {
+        QML_INSTR_HEADER
+        int type;
+        int bindingBits;
+        bool isRoot;
+    };
+    struct instr_completeQml {
+        QML_INSTR_HEADER
+        ushort column;
+        ushort line; 
+        bool isRoot;
     };
     struct instr_create {
         QML_INSTR_HEADER
         int type;
         int data;
-        int bindingBits;
         ushort column;
         ushort line; 
+        bool isRoot;
     };
     struct instr_createSimple {
         QML_INSTR_HEADER
@@ -174,13 +219,13 @@ union QDeclarativeInstruction
     };
     struct instr_assignValueSource {
         QML_INSTR_HEADER
-        int property;
+        QDeclarativePropertyRawData property;
         int owner;
         int castValue;
     };
     struct instr_assignValueInterceptor {
         QML_INSTR_HEADER
-        int property;
+        QDeclarativePropertyRawData property;
         int owner;
         int castValue;
     };
@@ -190,13 +235,25 @@ union QDeclarativeInstruction
         ushort programIndex;
         ushort line;
     };
-    struct instr_assignBinding {
+    struct instr_assignV4Binding {
         QML_INSTR_HEADER
         unsigned int property;
         int value;
         short context;
         short owner;
+        bool isRoot;
+        ushort line;
+        ushort column;
+    };
+    struct instr_assignBinding {
+        QML_INSTR_HEADER
+        QDeclarativePropertyRawData property;
+        int value;
+        short context;
+        short owner;
+        bool isRoot;
         ushort line;
+        ushort column;
     };
     struct instr_fetch {
         QML_INSTR_HEADER
@@ -243,6 +300,20 @@ union QDeclarativeInstruction
         int propertyIndex;
         int value;
     };
+    struct instr_storeTrString {
+        QML_INSTR_HEADER
+        int propertyIndex;
+        int context;
+        int text;
+        int comment;
+        int n;
+    };
+    struct instr_storeTrIdString {
+        QML_INSTR_HEADER
+        int propertyIndex;
+        int text;
+        int n;
+    };
     struct instr_storeByteArray {
         QML_INSTR_HEADER
         int propertyIndex;
@@ -255,6 +326,7 @@ union QDeclarativeInstruction
         int scope;
         int bindingId;
         ushort line;
+        ushort column;
     }; 
     struct instr_storeScript {
         QML_INSTR_HEADER
@@ -295,17 +367,10 @@ union QDeclarativeInstruction
         QML_INSTR_HEADER
         int propertyIndex;
         struct QRect {
-#if defined(Q_OS_MAC)
-            int y1;
-            int x1;
-            int y2;
-            int x2;
-#else
             int x1;
             int y1;
             int x2;
             int y2;
-#endif
         } rect;
     };
     struct instr_storeRectF {
@@ -335,8 +400,8 @@ union QDeclarativeInstruction
         int signalIndex;
         int value;
         short context;
-        int name;
         ushort line;
+        ushort column;
     };
     struct instr_assignSignalObject {
         QML_INSTR_HEADER
@@ -350,6 +415,7 @@ union QDeclarativeInstruction
         int metaObject;
         ushort column;
         ushort line;
+        bool isRoot;
     };
     struct instr_fetchAttached {
         QML_INSTR_HEADER
@@ -405,16 +471,30 @@ union QDeclarativeInstruction
             float zp;
         } vector;
     };
+    struct instr_storeVector4D {
+        QML_INSTR_HEADER
+        int propertyIndex;
+        struct QVector4D {
+            float xp;
+            float yp;
+            float zp;
+            float wp;
+        } vector;
+    };
 
     instr_common common;
     instr_init init;
+    instr_deferInit deferInit;
     instr_create create;
+    instr_createQml createQml;
+    instr_completeQml completeQml;
     instr_createSimple createSimple;
     instr_storeMeta storeMeta;
     instr_setId setId;
     instr_assignValueSource assignValueSource;
     instr_assignValueInterceptor assignValueInterceptor;
     instr_initV8Bindings initV8Bindings;
+    instr_assignV4Binding assignV4Binding;
     instr_assignBinding assignBinding;
     instr_fetch fetch;
     instr_fetchValue fetchValue;
@@ -425,6 +505,8 @@ union QDeclarativeInstruction
     instr_storeInteger storeInteger;
     instr_storeBool storeBool;
     instr_storeString storeString;
+    instr_storeTrString storeTrString;
+    instr_storeTrIdString storeTrIdString;
     instr_storeByteArray storeByteArray;
     instr_storeScriptString storeScriptString;
     instr_storeScript storeScript;
@@ -440,6 +522,7 @@ union QDeclarativeInstruction
     instr_storeRect storeRect;
     instr_storeRectF storeRectF;
     instr_storeVector3D storeVector3D;
+    instr_storeVector4D storeVector4D;
     instr_storeObject storeObject;
     instr_assignCustomType assignCustomType;
     instr_storeSignal storeSignal;
@@ -449,7 +532,7 @@ union QDeclarativeInstruction
     instr_defer defer;
     instr_assignObjectList assignObjectList;
 
-    int size() const;
+    static int size(Type type);
 };
 
 template<int N>
@@ -461,10 +544,16 @@ struct QDeclarativeInstructionMeta {
         enum { Size = QML_INSTR_SIZE(I, FMT) }; \
         typedef QDeclarativeInstruction::instr_##FMT DataType; \
         static const DataType &data(const QDeclarativeInstruction &instr) { return instr.FMT; } \
+        static void setData(QDeclarativeInstruction &instr, const DataType &v) { instr.FMT = v; } \
     }; 
 FOR_EACH_QML_INSTR(QML_INSTR_META_TEMPLATE);
 #undef QML_INSTR_META_TEMPLATE
 
+template<int Instr>
+class QDeclarativeInstructionData : public QDeclarativeInstructionMeta<Instr>::DataType
+{
+};
+
 QT_END_NAMESPACE
 
 #endif // QDECLARATIVEINSTRUCTION_P_H