コード例 #1
0
ファイル: ewing.cpp プロジェクト: speakman/qlc
EWing::EWing(QObject* parent, const QHostAddress& address,
	     const QByteArray& data) : QObject(parent)
{
	m_address = address;
	m_type = resolveType(data);
	m_firmware = resolveFirmware(data);
}
コード例 #2
0
ファイル: TypeLoader.cpp プロジェクト: TorinYu/coral
IType* TypeLoader::resolveType( const csl::location& loc, const std::string& typeName, bool isArray )
{
	try
	{
		if( isArray )
		{
			IType* elementType = resolveType( loc, typeName );
			if( !elementType )
			{
				assert( getError() != NULL );
				pushError( loc, "error loading array element type" );
				return NULL;
			}
			return _typeManager->getArrayOf( elementType );
		}

		// try to find an imported type aliased as 'typeName'
		IType* type = findImportedType( typeName );
		if( type )
			return type;

		// try to find an existing type named 'typeName'
		type = findDependency( typeName );
		if( type )
			return type;

		// try to load a type named 'typeName'
		return loadDependency( typeName );
	}
	catch( co::Exception& e )
	{
		pushError( loc, e.getMessage() );
		return NULL;
	}
}
コード例 #3
0
/**
 * \brief
 * judge e is unreducable value
 *
 * @param e
 *      target node
 * @param allowSymbolAddr
 *      set to 1 and symbol address will be treated as constant
 * @return
 *      0:no, 1:yes
 */
PRIVATE_STATIC int
isUnreducableConst(CExpr *e, int allowSymbolAddr)
{
    if(EXPR_CODE(e) == EC_GCC_BLTIN_OFFSET_OF)
        return 1;

    if(EXPR_CODE(e) == EC_FUNCTION_CALL) {
        CExprOfTypeDesc *td = resolveType(EXPR_B(e)->e_nodes[0]);
        if(td == NULL)
            return 0;
        td = getRefType(td);
        if(ETYP_IS_POINTER(td))
            td = EXPR_T(td->e_typeExpr);
        if(ETYP_IS_FUNC(td) == 0)
            return 0;
        //treat static+inline+const func with
        //constant argument as constant.
        //this code needs to compile the linux kernel.
        //ex) case __fswab16(0x0800):
        int isConst = (td->e_sc.esc_isStatic &&
            td->e_tq.etq_isInline &&
            (td->e_tq.etq_isConst || td->e_isGccConst));
        if(isConst &&
            isConstExpr(EXPR_B(e)->e_nodes[1], allowSymbolAddr))
            return 1;
    }

    return 0;
}
コード例 #4
0
ファイル: Kernels.cpp プロジェクト: corburn/ISIS
  /**
   * @brief Determine type of NAIF kernel file
   *
   *
   * This method will determine the type of kernel contained in the file
   * specified by the kfile parameter.
   *
   * The file specified by the kfile parameter is assumed to conform to NAIF
   * kernel file conventions (i.e., binary kernels are created using the NAIF
   * toolkit, text kernels conform to NAIF standards).  There are, however, two
   * exceptions that must be considered.  ISIS DEMs are cubes and do not follow
   * the NAIF convention for obvious reasons.  ISIS IAK kernels also do not
   * typically follow NAIF identification standards.  These two cases are
   * handled special.
   *
   * To determine a NAIF standard conforming file type, the first eight
   * characters of the file given will be inspected to determine the NAIF kernel
   * type.  If this fails to produce a known type, then it is assumed to be an
   * ISIS DEM or IAK kernel.
   *
   * For valid NAIF kernels, the NAIF routine kinfo_c is used to acquire
   * additional information such as if it is loaded.
   *
   * For files where the type cannot be determined, the type is set to
   * "UNKNOWN".  ISIS DEMs are set to the type "DEM".  ISIS IAKs are set to
   * "IAK".  Other types are set as follows:
   *
   * CK
   * SPK
   * DAF  (may be SPKs)
   * PCK
   * EK
   * META
   * IK
   * FK
   * SCLK
   *
   *
   * @param kfile Name of kernel file to inspect
   * @param manage Default state to assign to kernel.  Note that this only
   *               retains effect if the kernel is not loaded.  If it is loaded,
   *               its state is set to unmanaged.  You must explicitly exert
   *               management upon kernels that are already loaded.  Optional
   *               argument so the default is true.
   *
   * @return Kernels::KernelFile An internal Kernels file structure describing
   *         the file.
   */
  Kernels::KernelFile Kernels::examine(const QString &kfile,
                                       const bool &manage) const {

    FileName kernfile(kfile);
    KernelFile kf;
    kf.pathname = kfile;
    kf.name = kernfile.name();
    kf.fullpath = kernfile.expanded();
    kf.exists = kernfile.fileExists();
    kf.ktype = "UNKNOWN";
    kf.loaded = false;     // Assumes its not loaded
    kf.managed = manage;

    // Determine type and load info
    if (kf.exists) {
      kf.ktype = resolveType(kf.fullpath);

      // Use NAIF to determine if it is loaded
      if (IsNaifType(kf.ktype)) {
        SpiceChar ktype[32];
        SpiceChar source[128];
        SpiceInt  handle;
        SpiceBoolean found;
        kinfo_c(kf.fullpath.toAscii().data(), sizeof(ktype), sizeof(source), ktype,
                source, &handle, &found);
        if (found == SPICETRUE) {
          kf.loaded = true;
          kf.managed = false;
          kf.ktype = IString(ktype).UpCase().ToQt();
        }
      }
    }

    return (kf);
  }
コード例 #5
0
ファイル: Loader.cpp プロジェクト: coral-framework/coral-old
IType* Loader::getLastDeclaredType()
{
	if( _lastDeclTypeName == "void" )
		return NULL;

	IType* type = resolveType( _lastDeclTypeLocation, _lastDeclTypeName, _lastDeclTypeIsArray );
	if( !type && !_lastDeclTypeIsArray )
		PUSH_ERROR( _lastDeclTypeLocation, "error loading dependency '" << _lastDeclTypeName << "'" );

	return type;
}
コード例 #6
0
void MessageHandler<K, M, ExecPolicy>::handleMsg(const MsgType& message) const {

	try {
		auto type = resolveType(message);
		LOG(INFO)<< "Handling message type " << type;
		msgHandlers_.at(type)(message);
	} catch (std::bad_function_call& err) {

		LOG(ERROR)<< err.what();
		throw;
	}
}
コード例 #7
0
ファイル: Loader.cpp プロジェクト: coral-framework/coral-old
void Loader::onBaseType( const location& loc, const std::string& name )
{
	IType* type = resolveType( loc, name );
	if( getError() )
		return;

	if( !type )
	{
		PUSH_ERROR( loc, "could not load super-type '" << name << "'" );
	}
	else
	{
		CATCH_ERRORS( loc, _typeBuilder->defineBaseType( type ) );
	}
}
コード例 #8
0
  UTI NodeTypeDescriptorSelect::checkAndLabelType()
  {
    UTI it = getNodeType();
    if(isReadyType())
      return it;

    if(resolveType(it))
      {
	m_ready = true; //set here
	m_uti = it; //given reset here
      }
    setNodeType(it);
    if(it == Hzy) m_state.setGoAgain();
    return getNodeType();
  } //checkAndLabelType
コード例 #9
0
ファイル: Loader.cpp プロジェクト: coral-framework/coral-old
void Loader::resolveImports()
{
	assert( _typeBuilder.isValid() );

	for( ImportTypeMap::iterator it = _importedTypes.begin(); it != _importedTypes.end(); ++it )
	{
		ImportInfo& ii = it->second;
		ii.type = resolveType( ii.loc, ii.typeName.c_str() );
		if( getError() )
			return;

		if( ii.type == NULL )
		{
			PUSH_ERROR( ii.loc, "could not import '" << ii.typeName << "'" );
			return;
		}
	}
}
コード例 #10
0
ファイル: Loader.cpp プロジェクト: coral-framework/coral-old
void Loader::onRaises( const location& loc, const std::string& name )
{
	IType* type = resolveType( loc, name );
	if( getError() )
		return;

	if( !type )
	{
		PUSH_ERROR( loc, "error loading exception type '" << name << "'" );
	}
	else if( type->getKind() != TK_EXCEPTION )
	{
		PUSH_ERROR( loc, "attempt to raise non-exception type '" << type->getFullName() << "'" );
	}
	else
	{
		CATCH_ERRORS( loc, _methodBuilder->defineException( static_cast<IException*>( type ) ) );
	}
}
コード例 #11
0
int QmlProfilerTraceClientPrivate::resolveStackTop()
{
    if (rangesInProgress.isEmpty())
        return -1;

    QmlTypedEvent &typedEvent = rangesInProgress.top();
    int typeIndex = typedEvent.event.typeIndex();
    if (typeIndex >= 0)
        return typeIndex;

    typeIndex = resolveType(typedEvent);
    typedEvent.event.setTypeIndex(typeIndex);
    while (!pendingMessages.isEmpty()
           && pendingMessages.head().timestamp() < typedEvent.event.timestamp()) {
        model->addEvent(pendingMessages.dequeue());
    }
    model->addEvent(typedEvent.event);
    return typeIndex;
}
コード例 #12
0
ファイル: Loader.cpp プロジェクト: coral-framework/coral-old
void Loader::onAnnotation( const location& loc, const std::string& name, bool hasData )
{
	std::string componentName;
	componentName.reserve( name.size() + 10 );
	componentName.append( name );
	componentName.append( "Annotation" );

	IType* type = resolveType( loc, componentName );
	if( !type )
	{
		PUSH_ERROR( loc, "error loading annotation type '" << componentName << "'" );
		return;
	}

	if( type->getKind() != TK_COMPONENT )
	{
		PUSH_ERROR( loc, "annotation type '" << componentName << "' is not a component" );
		return;
	}

	try
	{
		RefPtr<IAnnotation> annotation;
		if( hasData )
		{
			RefPtr<IObject> object( type->getReflector()->newInstance() );
			annotation = getAnnotationFrom( object.get() );
		}
		else
		{
			annotation = getDefaultAnnotationInstance( type );
		}

		if( _annotations.empty() )
			_annotations.push_back( AnnotationRecord() );
		_annotations.back().annotations.push_back( annotation.get() );
	}
	catch( Exception& e )
	{
		pushError( loc, e.getMessage() );
	}
}
コード例 #13
0
Type* BasicScope::getType(ArrayType *type){
		auto dim = type->getDimensions();
		auto rootType = resolveType(type->getBasicType());
		//type->setBasicType(rootType);

		//AbstractScope *currentScope = resolveNamedScope(type->getName());
		//Disabled 
		string name = type->getName();
		//while(currentScope != nullptr){
			if(!this->getTypes().count(name)){
				//break;
				throw NoticeException ("Unsupported feature: complex array types!");
			}
		//	currentScope = currentScope->getParentScope();
		//}

		cout << "asdfasdfawefasdfasdfasdf\n\n";

		auto currentTypes = this->getTypes()[type->getName()];
		Type *basicType = nullptr;
		if(type->getDimensions().size() > 0){
			for(auto it: currentTypes){
				if(*type == *it){
					cout << type->getDimensions().size() << " !! " << it->getDimensions().size() << "\n";
					cout << type->toString() << "\n" << it->toString() << "\n\n";
					delete type;
					return it;
				}
			}

			basicType = getType(type->getTrimmedVersion());
    		type->setBasicType(basicType);
    		this->addType(name, type);
    		cout << "yay!\n\n";
		}
		else {
			cout << "wow!\n\n";
			return this->getType(type);
		}

		return type;
}
コード例 #14
0
TypeInfo TypeInfo::resolveType(TypeInfo const &__type, CodeModelItem __scope) {
    CodeModel *__model = __scope->model();
    Q_ASSERT(__model != 0);

    CodeModelItem __item = __model->findItem(__type.qualifiedName(), __scope);

    // Copy the type and replace with the proper qualified name. This
    // only makes sence to do if we're actually getting a resolved
    // type with a namespace. We only get this if the returned type
    // has more than 2 entries in the qualified name... This test
    // could be improved by returning if the type was found or not.
    TypeInfo otherType(__type);
    if (__item && __item->qualifiedName().size() > 1) {
        otherType.setQualifiedName(__item->qualifiedName());
    }

    if (TypeAliasModelItem __alias = model_dynamic_cast<TypeAliasModelItem> (__item))
        return resolveType(TypeInfo::combine(__alias->type(), otherType), __scope);

    return otherType;
}
コード例 #15
0
void QmlProfilerTraceClientPrivate::processCurrentEvent()
{
    // RangeData and RangeLocation always apply to the range on the top of the stack. Furthermore,
    // all ranges are perfectly nested. This is why we can defer the type resolution until either
    // the range ends or a child range starts. With only the information in RangeStart we wouldn't
    // be able to uniquely identify the event type.
    Message rangeStage = currentEvent.type.rangeType() == MaximumRangeType ?
                currentEvent.type.message() : currentEvent.event.rangeStage();
    switch (rangeStage) {
    case RangeStart:
        resolveStackTop();
        rangesInProgress.push(currentEvent);
        break;
    case RangeEnd: {
        int typeIndex = resolveStackTop();
        QTC_ASSERT(typeIndex != -1, break);
        currentEvent.event.setTypeIndex(typeIndex);
        while (!pendingMessages.isEmpty())
            model->addEvent(pendingMessages.dequeue());
        model->addEvent(currentEvent.event);
        rangesInProgress.pop();
        break;
    }
    case RangeData:
        rangesInProgress.top().type.setData(currentEvent.type.data());
        break;
    case RangeLocation:
        rangesInProgress.top().type.setLocation(currentEvent.type.location());
        break;
    default: {
        int typeIndex = resolveType(currentEvent);
        currentEvent.event.setTypeIndex(typeIndex);
        if (rangesInProgress.isEmpty())
            model->addEvent(currentEvent.event);
        else
            pendingMessages.enqueue(currentEvent.event);
        break;
    }
    }
}
コード例 #16
0
ファイル: NUnaryOp.cpp プロジェクト: mtottenh/MAlice
int NUnaryOp::check() {
	int isValid = 1;

	this->type = resolveType();

	/* Do we have a unary boolean expression? (i.e. NOT) */
	if(op == LNOT) {
		return checkBoolean();
	}

	/* Valid if the type is a number and the children are valid. */
	isValid &= Node::check();

	/* Is the type invalid? */
	if(type == INVALIDTYPE) {
		printErrorHeader("unary operator");
		error_type_mismatch(op, children[0]->getType(), TNUMBER);
		isValid = 0;
	}

	return isValid;
}
コード例 #17
0
SbkObjectType* BindingManager::resolveType(void* cptr, SbkObjectType* type)
{
    return resolveType(&cptr, type);
}
コード例 #18
0
ファイル: qdeclarativelistmodel.cpp プロジェクト: BGmot/Qt
bool QDeclarativeListModelParser::compileProperty(const QDeclarativeCustomParserProperty &prop, QList<ListInstruction> &instr, QByteArray &data)
{
    QList<QVariant> values = prop.assignedValues();
    for(int ii = 0; ii < values.count(); ++ii) {
        const QVariant &value = values.at(ii);

        if(value.userType() == qMetaTypeId<QDeclarativeCustomParserNode>()) {
            QDeclarativeCustomParserNode node =
                qvariant_cast<QDeclarativeCustomParserNode>(value);

            if (node.name() != listElementTypeName) {
                const QMetaObject *mo = resolveType(node.name());
                if (mo != &QDeclarativeListElement::staticMetaObject) {
                    error(node, QDeclarativeListModel::tr("ListElement: cannot contain nested elements"));
                    return false;
                }
                listElementTypeName = node.name(); // cache right name for next time
            }

            {
            ListInstruction li;
            li.type = ListInstruction::Push;
            li.dataIdx = -1;
            instr << li;
            }

            QList<QDeclarativeCustomParserProperty> props = node.properties();
            for(int jj = 0; jj < props.count(); ++jj) {
                const QDeclarativeCustomParserProperty &nodeProp = props.at(jj);
                if (nodeProp.name().isEmpty()) {
                    error(nodeProp, QDeclarativeListModel::tr("ListElement: cannot contain nested elements"));
                    return false;
                }
                if (nodeProp.name() == "id") {
                    error(nodeProp, QDeclarativeListModel::tr("ListElement: cannot use reserved \"id\" property"));
                    return false;
                }

                ListInstruction li;
                int ref = data.count();
                data.append(nodeProp.name());
                data.append('\0');
                li.type = ListInstruction::Set;
                li.dataIdx = ref;
                instr << li;

                if(!compileProperty(nodeProp, instr, data))
                    return false;

                li.type = ListInstruction::Pop;
                li.dataIdx = -1;
                instr << li;
            }

            {
            ListInstruction li;
            li.type = ListInstruction::Pop;
            li.dataIdx = -1;
            instr << li;
            }

        } else {

            QDeclarativeParser::Variant variant =
                qvariant_cast<QDeclarativeParser::Variant>(value);

            int ref = data.count();

            QByteArray d;
            d += char(variant.type()); // type tag
            if (variant.isString()) {
                d += variant.asString().toUtf8();
            } else if (variant.isNumber()) {
                d += QByteArray::number(variant.asNumber(),'g',20);
            } else if (variant.isBoolean()) {
                d += char(variant.asBoolean());
            } else if (variant.isScript()) {
                if (definesEmptyList(variant.asScript())) {
                    d[0] = char(QDeclarativeParser::Variant::Invalid); // marks empty list
                } else {
                    QByteArray script = variant.asScript().toUtf8();
                    int v = evaluateEnum(script);
                    if (v<0) {
                        if (script.startsWith("QT_TR_NOOP(\"") && script.endsWith("\")")) {
                            d[0] = char(QDeclarativeParser::Variant::String);
                            d += script.mid(12,script.length()-14);
                        } else {
                            error(prop, QDeclarativeListModel::tr("ListElement: cannot use script for property value"));
                            return false;
                        }
                    } else {
                        d[0] = char(QDeclarativeParser::Variant::Number);
                        d += QByteArray::number(v);
                    }
                }
            }
            d.append('\0');
            data.append(d);

            ListInstruction li;
            li.type = ListInstruction::Value;
            li.dataIdx = ref;
            instr << li;
        }
    }

    return true;
}
コード例 #19
0
BasicTypeDeclaration* GeneratorVisitor::resolveType(const QString & name)
{
    QString _name = name;
    return resolveType(_name);
}
コード例 #20
0
ファイル: resolvescope.cpp プロジェクト: jesmaz/numbat
const nir::Instruction * ResolveScope::buildAllocate (nir::Scope * scope, const string & iden) {
	const nir::Type * type = resolveType (scope);
	if (not type) return nullptr;
	return scope->allocateVariable (type, iden);
}
コード例 #21
0
ファイル: NMethodCall.cpp プロジェクト: mtottenh/MAlice
int NMethodCall::getType() {
	return resolveType();
}
コード例 #22
0
ファイル: identifier.cpp プロジェクト: jesmaz/numbat
const nir::Instruction * ParseTreeIdentifier::buildAllocate (nir::Scope * scope, const string & iden) {
	auto * t = resolveType (scope);
	if (not t) return nullptr;
	return scope->allocateVariable (t, iden);
}
コード例 #23
0
/**
 * \brief
 * do constant folding
 *
 * @param expr
 *      target node
 * @param[out] result
 *      result value
 * @return
 *      0:is not constant, 1:constant
 */
int
getConstNumValue(CExpr *expr, CNumValueWithType *result)
{
    memset(result, 0, sizeof(CNumValueWithType));

    if(EXPR_ISNULL(expr) || EXPR_ISERROR(expr)) {
        result->nvt_numValue.ll = 0;
        result->nvt_basicType = BT_INT;
        result->nvt_numKind = getNumValueKind(result->nvt_basicType);
        return 1;
    }

    if(EXPR_CODE(expr) == EC_XMP_DESC_OF) return 0; /* not constant */

    CNumValueWithType n1, n2, n3;
    int use2 = 0, use3 = 0, isConst2 = 0, isConst3 = 0;

    switch(EXPR_STRUCT(expr)) {
    case STRUCT_CExprOfUnaryNode: {
            CExpr *node = EXPR_U(expr)->e_node;

            if(EXPR_CODE(expr) == EC_SIZE_OF || 
	       EXPR_CODE(expr) == EC_GCC_ALIGN_OF) {
                CExprOfTypeDesc *td = resolveType(node);

                if(td == NULL)
                    return 0;

                result->nvt_isConstButMutable = 1;
                result->nvt_basicType = BT_INT;
                result->nvt_numKind = getNumValueKind(result->nvt_basicType);
                if(EXPR_CODE(expr) == EC_SIZE_OF)
                    result->nvt_numValue.ll = getTypeSize(td);
                else {
                    assertExpr((CExpr*)td, getTypeAlign(td));
                    result->nvt_numValue.ll = getTypeAlign(td);
                }
                return 1;
            }

            if(getConstNumValue(node, &n1) == 0) {
                mergeConstFlag(result, &n1);
                return 0;
            }
        }
        break;

    case STRUCT_CExprOfBinaryNode: {
            if(isUnreducableConst(expr, 1)) {
                result->nvt_isConstButUnreducable = 1;
                return 0;
            }

            CExpr *node1 = EXPR_B(expr)->e_nodes[0];
            CExpr *node2 = EXPR_B(expr)->e_nodes[1];

            if(EXPR_CODE(node1) == EC_TYPE_DESC) {
                if(getConstNumValue(node2, &n2) == 0)
                    return 0;
                else
                    n1 = n2;
            } else {
                if(getConstNumValue(node1, &n1) == 0) {
                    mergeConstFlag(result, &n1);
                    return 0;
                }

                if(getConstNumValue(node2, &n2) == 0) {
                    mergeConstFlag(result, &n1);
                    mergeConstFlag(result, &n2);
                    return 0;
                }
                use2 = 1;
            }
        }
        break;

    case STRUCT_CExprOfList:
        if(EXPR_CODE(expr) == EC_CONDEXPR) {
            if(getConstNumValue(exprListNextNData(expr, 0), &n1) == 0) {
                mergeConstFlag(result, &n1);
                return 0;
            }
            isConst2 = getConstNumValue(exprListNextNData(expr, 1), &n2);
            isConst3 = getConstNumValue(exprListNextNData(expr, 2), &n3);
            use2 = use3 = 1;
        } else {
            //maybe comma expr
            if(getConstNumValue(exprListTailData(expr), &n1) == 0) {
                mergeConstFlag(result, &n1);
                return 0;
            }
        }
        break;

    case STRUCT_CExprOfCharConst:
        //wide char is not supported
        result->nvt_numValue.ll = EXPR_CHARCONST(expr)->e_token[0];
        result->nvt_basicType = BT_CHAR;
        result->nvt_numKind = getNumValueKind(result->nvt_basicType);
        return 1;

    case STRUCT_CExprOfNumberConst:
        constToNumValueWithType(EXPR_NUMBERCONST(expr), result);
        return 1;

    case STRUCT_CExprOfSymbol: {
            CExprOfSymbol *tsym = findSymbolByGroup(EXPR_SYMBOL(expr)->e_symName, STB_IDENT);
            if(tsym == NULL || (tsym->e_symType != ST_ENUM) ||
                tsym->e_isConstButUnreducable ||
                (tsym && getConstNumValue(tsym->e_valueExpr, &n1) == 0)) {
                if(tsym && tsym->e_isConstButUnreducable)
                    result->nvt_isConstButUnreducable = 1;
                mergeConstFlag(result, &n1);
                return 0;
            }
        }
        break;

    case STRUCT_CExprOfArrayDecl:
    case STRUCT_CExprOfTypeDesc:
    case STRUCT_CExprOfErrorNode:
    case STRUCT_CExprOfGeneralCode:
    case STRUCT_CExprOfNull:
        return 0;

    default:
        assertExpr(expr, 0);
        ABORT();
    }

    int r = 1;
    int isCondExpr = (EXPR_CODE(expr) == EC_CONDEXPR);
    //for lshift/rshift
    int ni2 = 0;
    mergeConstFlag(result, &n1);
    
    if(use2) {
        ni2 = (int)getCastedLongValue(&n2);
        if(fixNumValueType(&n1, &n2) == 0 && isCondExpr == 0)
            return 0;
        mergeConstFlag(result, &n2);
    }

    if(use3) {
        if(fixNumValueType(&n1, &n3) == 0 && isCondExpr == 0)
            return 0;
        mergeConstFlag(result, &n3);
    }

    //now n1/n2/n3 have same basicType and numKind
    CNumValueKind nk = n1.nvt_numKind;
    CNumValue *nvr = &result->nvt_numValue;
    CNumValue *nv1 = &n1.nvt_numValue;
    CNumValue *nv2 = &n2.nvt_numValue;
    CNumValue *nv3 = &n3.nvt_numValue;

    switch(EXPR_CODE(expr)) {
    case EC_EXPRS:
        //last expression
        switch(nk) {
        case NK_LL:  nvr->ll  = nv1->ll; break;
        case NK_ULL: nvr->ull = nv1->ull; break;
        case NK_LD:  nvr->ld  = nv1->ld; break;
        }
        break;
    case EC_BRACED_EXPR:
    case EC_IDENT: // enumerator
        switch(nk) {
        case NK_LL:  nvr->ll  = nv1->ll; break;
        case NK_ULL: nvr->ull = nv1->ull; break;
        case NK_LD:  nvr->ld  = nv1->ld; break;
        }
        break;
    case EC_UNARY_MINUS:
        switch(nk) {
        case NK_LL:  nvr->ll  = -nv1->ll; break;
        case NK_ULL: nvr->ull = -nv1->ull; break;
        case NK_LD:  nvr->ld  = -nv1->ld; break;
        }
        break;
    case EC_BIT_NOT:
        switch(nk) {
        case NK_LL:  nvr->ll  = ~nv1->ll; break;
        case NK_ULL: nvr->ull = ~nv1->ull; break;
        case NK_LD:  return 0;
        }
        break;
    case EC_LOG_NOT:
        switch(nk) {
        case NK_LL:  nvr->ll  = !nv1->ll; break;
        case NK_ULL: nvr->ull = !nv1->ull; break;
        case NK_LD:  nvr->ld  = !nv1->ld; break;
        }
        break;
    case EC_CAST: {
            CExprOfTypeDesc *td = resolveType(EXPR_B(expr)->e_nodes[0]);
            if(td == NULL)
                return 0;
            CExprOfTypeDesc *tdo = getRefType(td);
            if(castNumValue(&n1, tdo->e_basicType) == 0) {
                addError(expr, CERR_016);
                EXPR_ISERROR(expr) = 1;
                return 0;
            }
            switch(n1.nvt_numKind) {
            case NK_LL:  nvr->ll  = nv1->ll;  break;
            case NK_ULL: nvr->ull = nv1->ull; break;
            case NK_LD:  nvr->ld  = nv1->ld;  break;
            }
        }
        break;
    case EC_LSHIFT:
        switch(nk) {
        case NK_LL:  nvr->ll  = nv1->ll  << ni2; break;
        case NK_ULL: nvr->ull = nv1->ull << ni2; break;
        case NK_LD:  return 0;
        }
        break;
    case EC_RSHIFT:
        switch(nk) {
        case NK_LL:  nvr->ll  = nv1->ll  >> ni2; break;
        case NK_ULL: nvr->ull = nv1->ull >> ni2; break;
        case NK_LD:  return 0;
        }
        break;
    case EC_PLUS:
        switch(nk) {
        case NK_LL:  nvr->ll  = nv1->ll  + nv2->ll; break;
        case NK_ULL: nvr->ull = nv1->ull + nv2->ull; break;
        case NK_LD:  nvr->ld  = nv1->ld  + nv2->ld; break;
        }
        break;
    case EC_MINUS:
        switch(nk) {
        case NK_LL:  nvr->ll  = nv1->ll  - nv2->ll; break;
        case NK_ULL: nvr->ull = nv1->ull - nv2->ull; break;
        case NK_LD:  nvr->ld  = nv1->ld  - nv2->ld; break;
        }
        break;
    case EC_MUL:
        switch(nk) {
        case NK_LL:  nvr->ll  = nv1->ll  * nv2->ll; break;
        case NK_ULL: nvr->ull = nv1->ull * nv2->ull; break;
        case NK_LD:  nvr->ld  = nv1->ld  * nv2->ld; break;
        }
        break;
    case EC_DIV:
        if(checkDivisionByZero(expr, nk, nv2))
            return 0;
        switch(nk) {
        case NK_LL:  nvr->ll  = nv1->ll  / nv2->ll; break;
        case NK_ULL: nvr->ull = nv1->ull / nv2->ull; break;
        case NK_LD:  nvr->ld  = nv1->ld  / nv2->ld; break;
        }
        break;
    case EC_MOD:
        if(checkDivisionByZero(expr, nk, nv2))
            return 0;
        switch(nk) {
        case NK_LL:  nvr->ll  = nv1->ll  % nv2->ll; break;
        case NK_ULL: nvr->ull = nv1->ull % nv2->ull; break;
        case NK_LD:  return 0;
        }
        break;
    case EC_ARITH_EQ:
        switch(nk) {
        case NK_LL:  nvr->ll  = (nv1->ll  == nv2->ll); break;
        case NK_ULL: nvr->ull = (nv1->ull == nv2->ull); break;
        case NK_LD:  nvr->ld  = (nv1->ld  == nv2->ld); break;
        }
        break;
    case EC_ARITH_NE:
        switch(nk) {
        case NK_LL:  nvr->ll  = (nv1->ll  != nv2->ll); break;
        case NK_ULL: nvr->ull = (nv1->ull != nv2->ull); break;
        case NK_LD:  nvr->ld  = (nv1->ld  != nv2->ld); break;
        }
        break;
    case EC_ARITH_GE:
        switch(nk) {
        case NK_LL:  nvr->ll  = (nv1->ll  >= nv2->ll); break;
        case NK_ULL: nvr->ull = (nv1->ull >= nv2->ull); break;
        case NK_LD:  nvr->ld  = (nv1->ld  >= nv2->ld); break;
        }
        break;
    case EC_ARITH_GT:
        switch(nk) {
        case NK_LL:  nvr->ll  = (nv1->ll  > nv2->ll); break;
        case NK_ULL: nvr->ull = (nv1->ull > nv2->ull); break;
        case NK_LD:  nvr->ld  = (nv1->ld  > nv2->ld); break;
        }
        break;
    case EC_ARITH_LE:
        switch(nk) {
        case NK_LL:  nvr->ll  = (nv1->ll  <= nv2->ll); break;
        case NK_ULL: nvr->ull = (nv1->ull <= nv2->ull); break;
        case NK_LD:  nvr->ld  = (nv1->ld  <= nv2->ld); break;
        }
        break;
    case EC_ARITH_LT:
        switch(nk) {
        case NK_LL:  nvr->ll  = (nv1->ll  < nv2->ll); break;
        case NK_ULL: nvr->ull = (nv1->ull < nv2->ull); break;
        case NK_LD:  nvr->ld  = (nv1->ld  < nv2->ld); break;
        }
        break;
    case EC_LOG_AND:
        switch(nk) {
        case NK_LL:  nvr->ll  = (nv1->ll  && nv2->ll); break;
        case NK_ULL: nvr->ull = (nv1->ull && nv2->ull); break;
        case NK_LD:  return 0;
        }
        break;
    case EC_LOG_OR:
        switch(nk) {
        case NK_LL:  nvr->ll  = (nv1->ll  || nv2->ll); break;
        case NK_ULL: nvr->ull = (nv1->ull || nv2->ull); break;
        case NK_LD:  return 0;
        }
        break;
    case EC_BIT_AND:
        switch(nk) {
        case NK_LL:  nvr->ll  = (nv1->ll  & nv2->ll); break;
        case NK_ULL: nvr->ull = (nv1->ull & nv2->ull); break;
        case NK_LD:  return 0;
        }
        break;
    case EC_BIT_OR:
        switch(nk) {
        case NK_LL:  nvr->ll  = (nv1->ll  | nv2->ll); break;
        case NK_ULL: nvr->ull = (nv1->ull | nv2->ull); break;
        case NK_LD:  return 0;
        }
        break;
    case EC_BIT_XOR:
        switch(nk) {
        case NK_LL:  nvr->ll  = (nv1->ll  ^ nv2->ll); break;
        case NK_ULL: nvr->ull = (nv1->ull ^ nv2->ull); break;
        case NK_LD:  return 0;
        }
        break;
    case EC_CONDEXPR:
        switch(nk) {
        case NK_LL:  nvr->ll  = nv1->ll  ? nv2->ll  : nv3->ll;
            r = (nv1->ll) ? isConst2 : isConst3; break;
        case NK_ULL: nvr->ull = nv1->ull ? nv2->ull : nv3->ull;
            r = (nv1->ull) ? isConst2 : isConst3; break;
        case NK_LD:  nvr->ld  = nv1->ld  ? nv2->ld  : nv3->ld;
            r = (nv1->ld) ? isConst2 : isConst3; break;
        }
        break;
    default:
        return 0;
    }

    result->nvt_basicType = n1.nvt_basicType;
    result->nvt_numKind = n1.nvt_numKind;

    return r;
}