src/declarative/qml/qdeclarativeinstruction.cpp
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
child 33 3e2da88830cd
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
       
     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 QtDeclarative 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 #include "private/qdeclarativeinstruction_p.h"
       
    43 
       
    44 #include "private/qdeclarativecompiler_p.h"
       
    45 
       
    46 #include <QtCore/qdebug.h>
       
    47 
       
    48 QT_BEGIN_NAMESPACE
       
    49 
       
    50 void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx)
       
    51 {
       
    52     QByteArray lineNumber = QByteArray::number(instr->line);
       
    53     if (instr->line == (unsigned short)-1)
       
    54         lineNumber = "NA";
       
    55     const char *line = lineNumber.constData();
       
    56 
       
    57     switch(instr->type) {
       
    58     case QDeclarativeInstruction::Init:
       
    59         qWarning().nospace() << idx << "\t\t" << line << "\t" << "INIT\t\t\t" << instr->init.bindingsSize << "\t" << instr->init.parserStatusSize << "\t" << instr->init.contextCache << "\t" << instr->init.compiledBinding;
       
    60         break;
       
    61     case QDeclarativeInstruction::CreateObject:
       
    62         qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE\t\t\t" << instr->create.type << "\t\t\t" << types.at(instr->create.type).className;
       
    63         break;
       
    64     case QDeclarativeInstruction::CreateSimpleObject:
       
    65         qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE_SIMPLE\t\t" << instr->createSimple.typeSize;
       
    66         break;
       
    67     case QDeclarativeInstruction::SetId:
       
    68         qWarning().nospace() << idx << "\t\t" << line << "\t" << "SETID\t\t\t" << instr->setId.value << "\t\t\t" << primitives.at(instr->setId.value);
       
    69         break;
       
    70     case QDeclarativeInstruction::SetDefault:
       
    71         qWarning().nospace() << idx << "\t\t" << line << "\t" << "SET_DEFAULT";
       
    72         break;
       
    73     case QDeclarativeInstruction::CreateComponent:
       
    74         qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE_COMPONENT\t" << instr->createComponent.count;
       
    75         break;
       
    76     case QDeclarativeInstruction::StoreMetaObject:
       
    77         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_META\t\t" << instr->storeMeta.data;
       
    78         break;
       
    79 
       
    80     case QDeclarativeInstruction::StoreFloat:
       
    81         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_FLOAT\t\t" << instr->storeFloat.propertyIndex << "\t" << instr->storeFloat.value;
       
    82         break;
       
    83     case QDeclarativeInstruction::StoreDouble:
       
    84         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_DOUBLE\t\t" << instr->storeDouble.propertyIndex << "\t" << instr->storeDouble.value;
       
    85         break;
       
    86     case QDeclarativeInstruction::StoreInteger:
       
    87         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_INTEGER\t\t" << instr->storeInteger.propertyIndex << "\t" << instr->storeInteger.value;
       
    88         break;
       
    89     case QDeclarativeInstruction::StoreBool:
       
    90         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_BOOL\t\t" << instr->storeBool.propertyIndex << "\t" << instr->storeBool.value;
       
    91         break;
       
    92     case QDeclarativeInstruction::StoreString:
       
    93         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_STRING\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value);
       
    94         break;
       
    95     case QDeclarativeInstruction::StoreUrl:
       
    96         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_URL\t\t" << instr->storeUrl.propertyIndex << "\t" << instr->storeUrl.value << "\t\t" << urls.at(instr->storeUrl.value);
       
    97         break;
       
    98     case QDeclarativeInstruction::StoreColor:
       
    99         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_COLOR\t\t" << instr->storeColor.propertyIndex << "\t\t\t" << QString::number(instr->storeColor.value, 16);
       
   100         break;
       
   101     case QDeclarativeInstruction::StoreDate:
       
   102         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_DATE\t\t" << instr->storeDate.propertyIndex << "\t" << instr->storeDate.value;
       
   103         break;
       
   104     case QDeclarativeInstruction::StoreTime:
       
   105         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_TIME\t\t" << instr->storeTime.propertyIndex << "\t" << instr->storeTime.valueIndex;
       
   106         break;
       
   107     case QDeclarativeInstruction::StoreDateTime:
       
   108         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_DATETIME\t\t" << instr->storeDateTime.propertyIndex << "\t" << instr->storeDateTime.valueIndex;
       
   109         break;
       
   110     case QDeclarativeInstruction::StorePoint:
       
   111         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_POINT\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex;
       
   112         break;
       
   113     case QDeclarativeInstruction::StorePointF:
       
   114         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_POINTF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex;
       
   115         break;
       
   116     case QDeclarativeInstruction::StoreSize:
       
   117         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SIZE\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex;
       
   118         break;
       
   119     case QDeclarativeInstruction::StoreSizeF:
       
   120         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SIZEF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex;
       
   121         break;
       
   122     case QDeclarativeInstruction::StoreRect:
       
   123         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_RECT\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex;
       
   124         break;
       
   125     case QDeclarativeInstruction::StoreRectF:
       
   126         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_RECTF\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex;
       
   127         break;
       
   128     case QDeclarativeInstruction::StoreVector3D:
       
   129         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VECTOR3D\t\t" << instr->storeVector3D.propertyIndex << "\t" << instr->storeVector3D.valueIndex;
       
   130         break;
       
   131     case QDeclarativeInstruction::StoreVariant:
       
   132         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value);
       
   133         break;
       
   134     case QDeclarativeInstruction::StoreVariantInteger:
       
   135         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_INTEGER\t\t" << instr->storeInteger.propertyIndex << "\t" << instr->storeInteger.value;
       
   136         break;
       
   137     case QDeclarativeInstruction::StoreVariantDouble:
       
   138         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_DOUBLE\t\t" << instr->storeDouble.propertyIndex << "\t" << instr->storeDouble.value;
       
   139         break;
       
   140     case QDeclarativeInstruction::StoreVariantBool:
       
   141         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_BOOL\t\t" << instr->storeBool.propertyIndex << "\t" << instr->storeBool.value;
       
   142         break;
       
   143     case QDeclarativeInstruction::StoreObject:
       
   144         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJECT\t\t" << instr->storeObject.propertyIndex;
       
   145         break;
       
   146     case QDeclarativeInstruction::StoreVariantObject:
       
   147         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_OBJECT\t" << instr->storeObject.propertyIndex;
       
   148         break;
       
   149     case QDeclarativeInstruction::StoreInterface:
       
   150         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_INTERFACE\t\t" << instr->storeObject.propertyIndex;
       
   151         break;
       
   152 
       
   153     case QDeclarativeInstruction::StoreSignal:
       
   154         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SIGNAL\t\t" << instr->storeSignal.signalIndex << "\t" << instr->storeSignal.value << "\t\t" << primitives.at(instr->storeSignal.value);
       
   155         break;
       
   156     case QDeclarativeInstruction::StoreImportedScript:
       
   157         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_IMPORTED_SCRIPT\t" << instr->storeScript.value;
       
   158         break;
       
   159     case QDeclarativeInstruction::StoreScriptString:
       
   160         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SCRIPT_STRING\t" << instr->storeScriptString.propertyIndex << "\t" << instr->storeScriptString.value << "\t" << instr->storeScriptString.scope;
       
   161         break;
       
   162 
       
   163     case QDeclarativeInstruction::AssignSignalObject:
       
   164         qWarning().nospace() << idx << "\t\t" << line << "\t" << "ASSIGN_SIGNAL_OBJECT\t" << instr->assignSignalObject.signal << "\t\t\t" << datas.at(instr->assignSignalObject.signal);
       
   165         break;
       
   166     case QDeclarativeInstruction::AssignCustomType:
       
   167         qWarning().nospace() << idx << "\t\t" << line << "\t" << "ASSIGN_CUSTOMTYPE\t" << instr->assignCustomType.propertyIndex << "\t" << instr->assignCustomType.valueIndex;
       
   168         break;
       
   169 
       
   170     case QDeclarativeInstruction::StoreBinding:
       
   171         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
       
   172         break;
       
   173     case QDeclarativeInstruction::StoreCompiledBinding:
       
   174         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_COMPILED_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
       
   175         break;
       
   176     case QDeclarativeInstruction::StoreValueSource:
       
   177         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VALUE_SOURCE\t" << instr->assignValueSource.property << "\t" << instr->assignValueSource.castValue;
       
   178         break;
       
   179     case QDeclarativeInstruction::StoreValueInterceptor:
       
   180         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VALUE_INTERCEPTOR\t" << instr->assignValueInterceptor.property << "\t" << instr->assignValueInterceptor.castValue;
       
   181         break;
       
   182 
       
   183     case QDeclarativeInstruction::BeginObject:
       
   184         qWarning().nospace() << idx << "\t\t" << line << "\t" << "BEGIN\t\t\t" << instr->begin.castValue;
       
   185         break;
       
   186     case QDeclarativeInstruction::StoreObjectQList:
       
   187         qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJECT_QLIST";
       
   188         break;
       
   189     case QDeclarativeInstruction::AssignObjectList:
       
   190         qWarning().nospace() << idx << "\t\t" << line << "\t" << "ASSIGN_OBJECT_LIST";
       
   191         break;
       
   192     case QDeclarativeInstruction::FetchAttached:
       
   193         qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_ATTACHED\t\t" << instr->fetchAttached.id;
       
   194         break;
       
   195     case QDeclarativeInstruction::FetchQList:
       
   196         qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_QLIST\t\t" << instr->fetch.property;
       
   197         break;
       
   198     case QDeclarativeInstruction::FetchObject:
       
   199         qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH\t\t\t" << instr->fetch.property;
       
   200         break;
       
   201     case QDeclarativeInstruction::FetchValueType:
       
   202         qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type;
       
   203         break;
       
   204     case QDeclarativeInstruction::PopFetchedObject:
       
   205         qWarning().nospace() << idx << "\t\t" << line << "\t" << "POP";
       
   206         break;
       
   207     case QDeclarativeInstruction::PopQList:
       
   208         qWarning().nospace() << idx << "\t\t" << line << "\t" << "POP_QLIST";
       
   209         break;
       
   210     case QDeclarativeInstruction::PopValueType:
       
   211         qWarning().nospace() << idx << "\t\t" << line << "\t" << "POP_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type;
       
   212         break;
       
   213     case QDeclarativeInstruction::Defer:
       
   214         qWarning().nospace() << idx << "\t\t" << line << "\t" << "DEFER" << "\t\t\t" << instr->defer.deferCount;
       
   215         break;
       
   216     default:
       
   217         qWarning().nospace() << idx << "\t\t" << line << "\t" << "XXX UNKOWN INSTRUCTION" << "\t" << instr->type;
       
   218         break;
       
   219     }
       
   220 }
       
   221 
       
   222 QT_END_NAMESPACE