Exemple #1
0
ExprType* unifyTVarR(ExprType *type, ExprType* expected, Hashtable *varTypes, Region *r) {
    char buf[128];
    if(T_VAR_NUM_DISJUNCTS(expected)==0) { /* free */
    	if(occursIn(expected, type)) {
    		return NULL;
    	}
        insertIntoHashTable(varTypes, getTVarName(T_VAR_ID(expected), buf), type);
        return dereference(expected, varTypes, r);
    } else { /* union type */
        int i;
        ExprType *ty = NULL;
        for(i=0;i<T_VAR_NUM_DISJUNCTS(expected);i++) {
            if(getNodeType(type) == getNodeType(T_VAR_DISJUNCT(expected,i))) { /* union types can only include primitive types */
                ty = type;
            }
        }
        if(ty != NULL) {
            insertIntoHashTable(varTypes, getTVarName(T_VAR_ID(expected), buf), ty);
            return dereference(expected, varTypes, r);
        }
        return ty;
    }

}
/**
 * Handles the contained root information.
 */
void HeartbeatMsgEx::processIncomingRoot()
{
   LogContext log("Heartbeat incoming");

   // check whether root info is defined
   if( (getNodeType() != NODETYPE_Meta) || !getRootNumID() )
      return;

   // try to apply the contained root info
   if(Program::getApp()->getMetaNodes()->setRootNodeNumID(getRootNumID(), false) )
   {
      log.log(Log_CRITICAL, "Root (by Heartbeat): " + StringTk::uintToStr(getRootNumID() ) );
      
      Program::getApp()->getRootDir()->setOwnerNodeID(getRootNumID() );
   }
}
Exemple #3
0
void PPFnResolveQName::do_next(xqp_tuple &t)
{
    if (first_time)
    {
        child_qname.op->next(t);
        if (t.is_eos())
            return;

        first_time = false;
        tuple_cell qname_tc = atomize(child_qname.get(t));

        if (!is_string_type(qname_tc.get_atomic_type())) {
            throw XQUERY_EXCEPTION2(XPTY0004, "Wrong first argument of fn:resolve-QName function");
        }

        child_qname.op->next(t);
        if (!(t.is_eos())) {
            throw XQUERY_EXCEPTION2(XPTY0004, "Wrong first argument of fn:resolve-QName function");
        }

        qname_tc = tuple_cell::make_sure_light_atomic(qname_tc);

        child_elem.op->next(t);
        if (t.is_eos() || !child_elem.get(t).is_node()) {
            throw XQUERY_EXCEPTION2(XPTY0004, "Wrong second argument of fn:resolve-QName function");
        }

        xptr node = child_elem.get(t).get_node();

        child_elem.op->next(t);
        if (!(t.is_eos())) {
            throw XQUERY_EXCEPTION2(XPTY0004, "Wrong second argument of fn:resolve-QName function");
        }

        CHECKP(node);
        if (getNodeType(node) != element)
            throw XQUERY_EXCEPTION2(XPTY0004, "Wrong second argument of fn:resolve-QName function");

        scoped_ptr<InscopeNamespaceMap> inscopeNamespaces = new InscopeNamespaceMap(node, cxt->get_static_context()->getStaticallyKnownNamespaces());
        t.copy(tuple_cell::atomic(xsd::QName::createResolve(qname_tc.get_str_mem(), inscopeNamespaces.get())));
    }
    else
    {
        first_time = true;
        t.set_eos();
    }
}
void CX3DSphereNode::print(int indent)
{
	FILE *fp = CX3DParser::getDebugLogFp();

	char *nodeName = getNodeName();
	if (nodeName)
	{
		CX3DParser::printIndent(indent);
		fprintf(fp, "%s (%s)\n", nodeName, CX3DNode::getNodeTypeString(getNodeType()));

		CX3DParser::printIndent(indent+1);
		fprintf(fp, "solid  : %s\n", getSolid()->getValue() ? "TRUE" : "FALSE");

		CX3DParser::printIndent(indent+1);
		fprintf(fp, "radius : (%f)\n", getRadius()->getValue());
	}
}
Exemple #5
0
void TypeCheckerVisitor::visitCallNode(CallNode* node) {
	uint32_t params_count = node->parametersNumber();
	AstFunction* refFunc = _current_scope->lookupFunction(node->name(), true);
	bool matchesRefedFunction = (refFunc!= NULL) && (refFunc->parametersNumber() == params_count);
	for (uint32_t i = 0; i < params_count; i++) {
		AstNode* param = node->parameterAt(i);
		param->visit(this);
		if (matchesRefedFunction && !isAssignable(refFunc->parameterType(i), getNodeType(param))) {
			setErrorMessage(param, "Wrong type parameter");
		}
	}
	if (matchesRefedFunction) {
		setNodeType(node, refFunc->returnType());
	} else {
		setNodeType(node, VT_INVALID);
	}
}
  bool NodeBinaryOpCompare::doBinaryOperation(s32 lslot, s32 rslot, u32 slots)
  {
    assert(slots);
    if(m_state.isScalar(getNodeType())) //not an array
      {
	return doBinaryOperationImmediate(lslot, rslot, slots);
      }
    else
      { //array
#ifdef SUPPORT_ARITHMETIC_ARRAY_OPS
	return doBinaryOperationArray(lslot, rslot, slots);
#else
	m_state.abortNotImplementedYet();
#endif //defined below...
      }
    return false;
  } //end dobinaryop
  void NodeBinaryOpCompare::genCode(File * fp, UVPass& uvpass)
  {
    assert(m_nodeLeft && m_nodeRight);
    assert(m_state.m_currentObjSymbolsForCodeGen.empty()); //*************

    // generate rhs first; may update current object globals (e.g. function call)
    UVPass ruvpass;
    m_nodeRight->genCode(fp, ruvpass);

    // restore current object globals
    assert(m_state.m_currentObjSymbolsForCodeGen.empty()); //*************

    UVPass luvpass;
    m_nodeLeft->genCode(fp, luvpass); //updates m_currentObjSymbol

    UTI nuti = getNodeType();
    UlamType * nut = m_state.getUlamTypeByIndex(nuti);
    s32 tmpVarNum = m_state.getNextTmpVarNumber();

    m_state.indentUlamCode(fp);
    fp->write("const ");
    fp->write(nut->getTmpStorageTypeAsString().c_str()); //e.g. u32, s32, u64..
    fp->write(" ");

    fp->write(m_state.getTmpVarAsString(nuti, tmpVarNum, TMPREGISTER).c_str());
    fp->write(" = ");

    fp->write(methodNameForCodeGen().c_str());
    fp->write("(");

    UTI luti = luvpass.getPassTargetType(); //reset
    fp->write(luvpass.getTmpVarAsString(m_state).c_str());

    fp->write(", ");
    fp->write(ruvpass.getTmpVarAsString(m_state).c_str());
    fp->write(", ");

    //compare needs size of left/right nodes (only difference!)
    fp->write_decimal(m_state.getUlamTypeByIndex(luti)->getTotalBitSize());

    fp->write(");"); GCNL;

    uvpass = UVPass::makePass(tmpVarNum, TMPREGISTER, nuti, m_state.determinePackable(nuti), m_state, 0, 0);  //P
    assert(m_state.m_currentObjSymbolsForCodeGen.empty()); //*************
  } //genCode
Exemple #8
0
void PPFnInScopePrefixes::do_next (xqp_tuple &t)
{
    if (pos < 0)
    {
        child.op->next(t);

        if (t.is_eos())
            throw XQUERY_EXCEPTION2(XPTY0004, "Wrong argument of fn:in-scope-prefixes function");

        if (!child.get(t).is_node())
            throw XQUERY_EXCEPTION2(XPTY0004, "Wrong argument of fn:in-scope-prefixes function");

        xptr node = child.get(t).get_node();

        child.op->next(t);
        if (!(t.is_eos()))
            throw XQUERY_EXCEPTION2(XPTY0004, "Wrong argument of fn:in-scope-prefixes function");

        CHECKP(node);
        if (getNodeType(node) != element)
            throw XQUERY_EXCEPTION2(XPTY0004, "Wrong argument of fn:in-scope-prefixes function");

        namespaces = new InscopeNamespaceIterator(node, cxt->get_static_context()->getStaticallyKnownNamespaces());

        pos = 0;
    }

    if (namespaces->next())
    {
        xmlns_ptr ns = namespaces->get();

        if (ns->has_prefix())
            t.copy(tuple_cell::atomic_deep(xs_NCName, ns->prefix));
        else
            t.copy(EMPTY_STRING_TC);
    }
    else
    {
        t.set_eos();
        pos = -1;

        delete namespaces;
        namespaces = NULL;
    }
}
    bool readDataset1D(const H5::H5File &file, const std::string &name, std::vector<_Tp> &data)
    {
        H5::DataSet dataset = file.openDataSet(name);
        H5::DataSpace dataspace = dataset.getSpace();
        hsize_t dims_out[1];
        int rank = dataspace.getSimpleExtentDims( dims_out, NULL);

        int _type;
        bool read = getNodeType(dataset,  _type);
        read &= (_type == StorageNode::SEQ);
        read &= (rank  == 1);

        if (!read)
            return read;
        data.resize(dims_out[0]);
        dataset.read(data.data(), dataset.getDataType());
        return true;
    }
Exemple #10
0
int typeNode( Node *node, Hashtable *varTypes, rError_t *errmsg, Node **errnode, Region *r ) {
    if ( ( node->option & OPTION_TYPED ) == 0 ) {
        /*printTree(node, 0); */
        List *typingConstraints = newList( r );
        Res *resType = typeExpression3( node, 0, ruleEngineConfig.extFuncDescIndex, varTypes, typingConstraints, errmsg, errnode, r );
        /*printf("Type %d\n",resType->t); */
        if ( getNodeType( resType ) == T_ERROR ) {
            addRErrorMsg( errmsg, RE_TYPE_ERROR, "type error: in rule" );
            return RE_TYPE_ERROR;
        }
        postProcessCoercion( node, varTypes, errmsg, errnode, r );
        postProcessActions( node, ruleEngineConfig.extFuncDescIndex, errmsg, errnode, r );
        /*    printTree(node, 0); */
        varTypes = NULL;
        node->option |= OPTION_TYPED;
    }
    return 0;
}
Exemple #11
0
  UTI NodeBlock::checkAndLabelType()
  {
    assert(m_nodeNext);
    //especially important for template instances (prev ptr nullified on instantiation)
    if(getPreviousBlockPointer() == NULL)
      setPreviousBlockPointer(m_state.getCurrentBlock());
    else
      assert(getPreviousBlockPointer() == m_state.getCurrentBlock());

    m_state.pushCurrentBlock(this);

    m_nodeNext->checkAndLabelType();

    m_state.popClassContext(); //restores m_prevBlockNode

    setNodeType(Void); //blocks don't have types
    return getNodeType();
  } //checkAndLabelType
Exemple #12
0
  bool NodeUnaryOp::doUnaryOperation(s32 slot, u32 nslots)
  {
    UTI nuti = getNodeType();
    if(m_state.isScalar(nuti))  //not an array
      {
	return doUnaryOperationImmediate(slot, nslots);
      }
    else
      {
	//arrays not supported at this time
	std::ostringstream msg;
	msg << "Unsupported unary operation " << getName();
	msg << ", with an array type <";
	msg << m_state.getUlamTypeNameBriefByIndex(nuti).c_str() << ">";
	MSG(getNodeLocationAsString().c_str(), msg.str().c_str(), ERR);
      }
    return false;
  } //dobinaryop
Exemple #13
0
void DeletePickedPoint::operate()
{
    vtkIdType id_node = GuiMainWindow::pointer()->getPickedPoint();
    cout << "You picked " << id_node << endl;
    if( id_node<0  || GuiMainWindow::pointer()->getPickedObject()!=1 ) {
        QApplication::restoreOverrideCursor();
        EG_ERR_RETURN("Error: No node picked.");
    }

    char type;
    QVector <vtkIdType> PSP;

    //IMPORTANT: to make sure only unselected nodes become fixed (redundant with previous line, but more readable)
    this->m_BoundaryCodes = GuiMainWindow::pointer()->getAllBoundaryCodes();
    qWarning()<<"m_BoundaryCodes="<<m_BoundaryCodes;

    updateNodeInfo();

    QMessageBox msgBox;
    msgBox.setText("Delete point?");
    msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
    switch (msgBox.exec()) {
    case QMessageBox::Yes:
        cout<<"yes was clicked"<<endl;
        DeletePoint(id_node);
        break;
    case QMessageBox::No:
        cout<<"no was clicked"<<endl;
        cout<<"=== Topological neighbours ==="<<endl;
        PSP = getPotentialSnapPoints(id_node);
        cout<<"id_node="<<id_node<<" PSP="<<PSP<<endl;

        cout<<"=== NODE TYPE ==="<<endl;
        type = getNodeType(id_node);
        cout<<"id_node="<<id_node<<" is of type="<<(int)type<<"="<<VertexType2Str(type)<<endl;

        break;
    default:
        // should never be reached
        break;
    }

}
Exemple #14
0
  void NodeBlock::print(File * fp)
  {
    printNodeLocation(fp);
    UTI myut = getNodeType();
    char id[255];
    if((myut == Nav) || (myut == Nouti))
      sprintf(id,"%s<NOTYPE>\n", prettyNodeName().c_str());
    else if(myut == Hzy)
      sprintf(id,"%s<HAZYTYPE>\n", prettyNodeName().c_str());
    else
      sprintf(id,"%s<%s>\n", prettyNodeName().c_str(), m_state.getUlamTypeNameByIndex(myut).c_str());
    fp->write(id);

    if(m_nodeNext)
      m_nodeNext->print(fp);

    sprintf(id,"-----------------%s\n", prettyNodeName().c_str());
    fp->write(id);
  } //print
SNode SNode::multiplyParentheses() const {
  ENTERMETHOD();

  switch(getNodeType()) {
  case NT_NUMBER   :
  case NT_BOOLCONST:
  case NT_VARIABLE : break;
  case NT_POWER    :
  case NT_TREE     : RETURNNODE( multiplyTreeNode() );
  case NT_BOOLEXPR : RETURNNODE( multiplyBoolExpr() );
  case NT_POLY     : RETURNNODE( multiplyParenthesesInPoly() );
  case NT_ASSIGN   : RETURNNODE( multiplyAssignStmt() );
  case NT_STMTLIST : RETURNNODE( multiplyStmtList() );
  case NT_SUM      : RETURNNODE( multiplyParenthesesInSum() );
  case NT_PRODUCT  : RETURNNODE( multiplyParenthesesInProduct() );
  default          : throwUnknownNodeTypeException(__TFUNCTION__);
  }
  RETURNTHIS;
}
Exemple #16
0
  EvalStatus NodeConstantArray::eval()
  {
    if(!isReadyConstant())
      return ERROR;

    UTI nuti = getNodeType();
    if(!m_state.isComplete(nuti))
      return ERROR;

    if(((SymbolConstantValue *) m_constSymbol)->getConstantStackFrameAbsoluteSlotIndex() == 0)
      return NOTREADY;

    evalNodeProlog(0); //new current node eval frame pointer, t3897

    UlamValue rtnUVPtr = makeUlamValuePtr();
    Node::assignReturnValueToStack(rtnUVPtr);

    evalNodeEpilog();
    return NORMAL;
  } //eval
Exemple #17
0
  EvalStatus NodeUnaryOp::eval()
  {
    assert(m_node);

    UTI nuti = getNodeType();
    if(nuti == Nav) return evalErrorReturn();

    if(nuti == Hzy) return evalStatusReturnNoEpilog(NOTREADY);

    evalNodeProlog(0); //new current frame pointer
    u32 slots = makeRoomForNodeType(nuti);
    EvalStatus evs = m_node->eval();
    if(evs != NORMAL) return evalStatusReturn(evs);

    if(!doUnaryOperation(1,slots))
      return evalStatusReturn(ERROR);

    evalNodeEpilog();
    return NORMAL;
  } //eval
Exemple #18
0
  void NodeBlockLocals::addTargetDescriptionToInfoMap(TargetMap& classtargets, u32 scid)
  {
    UTI cuti = getNodeType();
    u32 classNameId = m_state.getClassNameIdForUlamLocalsFilescope(cuti); //cut->getUlamTypeNameOnly();
    std::string className = m_state.m_pool.getDataAsString(classNameId);
    u32 mangledNameId = m_state.getMangledClassNameIdForUlamLocalsFilescope(cuti); //cut->getUlamTypeMangledName();
    std::string mangledName = m_state.m_pool.getDataAsString(mangledNameId);

    struct TargetDesc desc;

    desc.m_hasTest = false;
    desc.m_classType = UC_LOCALSFILESCOPE;

    desc.m_bitsize = 0;
    desc.m_loc = getNodeLocation();
    desc.m_className = className;
    desc.m_structuredComment = "NONE";

    classtargets.insert(std::pair<std::string, struct TargetDesc>(mangledName, desc));
  } //addTargetDescriptionToInfoMap
void CharacterData::setDataAndUpdate(const String& newData, unsigned offsetOfReplacedData, unsigned oldLength, unsigned newLength, UpdateSource source, RecalcStyleBehavior recalcStyleBehavior)
{
    String oldData = m_data;
    m_data = newData;

    ASSERT(!layoutObject() || isTextNode());
    if (isTextNode())
        toText(this)->updateTextLayoutObject(offsetOfReplacedData, oldLength, recalcStyleBehavior);

    if (source != UpdateFromParser) {
        if (getNodeType() == PROCESSING_INSTRUCTION_NODE)
            toProcessingInstruction(this)->didAttributeChanged();

        if (document().frame())
            document().frame()->selection().didUpdateCharacterData(this, offsetOfReplacedData, oldLength, newLength);
    }

    document().incDOMTreeVersion();
    didModifyData(oldData, source);
}
void CX3DPointLightNode::print(int indent)
{
	FILE *fp = CX3DParser::getDebugLogFp();

	char *nodeName = getNodeName();
	if (nodeName)
	{
		float r, g, b;
		float x, y, z;

		CX3DParser::printIndent(indent);
		fprintf(fp, "%s (%s)\n", nodeName, CX3DNode::getNodeTypeString(getNodeType()));

		CX3DParser::printIndent(indent+1);
		fprintf(fp, "ambientIntensity : (%f)\n", getAmbientIntensity()->getValue());

		getColor()->getValue(r, g, b);
		CX3DParser::printIndent(indent+1);
		fprintf(fp, "color : (%f %f %f)\n", r, g, b);

		CX3DParser::printIndent(indent+1);
		fprintf(fp, "intensity : (%f)\n", getIntensity()->getValue());

		getLocation()->getValue(x, y, z);
		CX3DParser::printIndent(indent+1);
		fprintf(fp, "location : (%f %f %f)\n", x, y, z);

		CX3DParser::printIndent(indent+1);
		fprintf(fp, "radius : (%f)\n", getRadius()->getValue());

		getAttenuation()->getValue(x, y, z);
		CX3DParser::printIndent(indent+1);
		fprintf(fp, "attenuation : (%f %f %f)\n", x, y, z);

		CX3DParser::printIndent(indent+1);
		fprintf(fp, "on : %s\n", getOn()->getValue() ? "TRUE" : "FALSE");

		CX3DParser::printIndent(indent+1);
		fprintf(fp, "global : %s\n", getGlobal()->getValue() ? "TRUE" : "FALSE");
	}
}
Exemple #21
0
  void NodeVarRef::checkAbstractInstanceErrors()
  {
    //unlike NodeVarDecl, an abstract class can be a reference!
    UTI nuti = getNodeType();
    UlamType * nut = m_state.getUlamTypeByIndex(nuti);
    if(nut->getUlamTypeEnum() == Class)
      {
	SymbolClass * csym = NULL;
	AssertBool isDefined = m_state.alreadyDefinedSymbolClass(nuti, csym);
	assert(isDefined);
	if(csym->isAbstract())
	  {
	    std::ostringstream msg;
	    msg << "Instance of Abstract Class ";
	    msg << m_state.getUlamTypeNameBriefByIndex(nuti).c_str();
	    msg << " used with reference variable symbol name '";
	    msg << getName() << "'";
	    MSG(getNodeLocationAsString().c_str(), msg.str().c_str(), INFO);
	  }
      }
  } //checkAbstractInstanceErrors
  UTI NodeBinaryOpEqualBitwise::checkAndLabelType()
  {
    UTI nodeType = NodeBinaryOp::checkAndLabelType(); //dup Bitwise calcNodeType

    if(nodeType != Nav)
      {
	if(!NodeBinaryOpEqual::checkStoreIntoAble())
	  {
	    setNodeType(Nav);
	    return Nav; //newType
	  }

	if(!NodeBinaryOpEqual::checkNotUnpackedArray())
	  {
	    setNodeType(Nav);
	    return Nav;
	  }
      }

    return getNodeType();
  } //checkandlabeltype
/**
 * Class constructor: parses a given XML file and parse it with libxml2.
 * 
 * @param filename XML file to parse.
 */
XmlReader::XmlReader(const std::string& filename)
{
    PHYSFS_file* file = PHYSFS_openRead(filename.c_str());
    if(file == 0) {
        std::stringstream msg;
        msg << "Couldn't open file '" << filename << "': " 
            << PHYSFS_getLastError();
        throw std::runtime_error(msg.str());
    }
    
    reader = xmlReaderForIO(readCallback, closeCallback, file, 
            0, 0, XML_PARSE_NONET);
    if(reader == 0) {
        PHYSFS_close(file);
        std::stringstream msg;
        msg << "Couldn't parse file '" << filename << "'";
        throw std::runtime_error(msg.str());
    }
    while(read() && getNodeType() != XML_READER_TYPE_ELEMENT)
        ;
}
  // third arg is the slots for the rtype; slots for the left is
  // rslot-lslot; they should be equal, unless one is a packed array
  // and the other isn't; however, currently, according to
  // CompilerState determinePackable, they should always be the same
  // since their types must be identical.
  bool NodeBinaryOpEqualShift::doBinaryOperation(s32 lslot, s32 rslot, u32 slots)
  {
    assert(slots);
    UTI nuti = getNodeType();
    if(m_state.isScalar(nuti))  //not an array
      {
	return doBinaryOperationImmediate(lslot, rslot, slots);
      }
    else
      { //array
	// leverage case when both are packed, for logical shift operations
	if(m_state.determinePackable(nuti) == PACKEDLOADABLE)
	  {
	    return doBinaryOperationImmediate(lslot, rslot, slots);
	  }
	else
	  {
	    return doBinaryOperationArray(lslot, rslot, slots);
	  }
      }
    return false;
  } //end dobinaryop
Exemple #25
0
void TypeCheckerVisitor::visitBlockNode(BlockNode* node) {
	_current_scope = node->scope();
	Scope::FunctionIterator funcIt(_current_scope);
	while (funcIt.hasNext()) {
		AstFunction* func = funcIt.next();
		func->node()->visit(this);
	}
	int nodes_count = node->nodes();
	VarType commonType = VT_VOID;
	for (int i = 0; i != nodes_count; ++i) {
		AstNode* currentNode = node->nodeAt(i);
		currentNode->visit(this);
		bool isBlockNode = currentNode->isForNode() || currentNode->isWhileNode() || currentNode->isIfNode();
		VarType currentNodeType = getNodeType(currentNode);
		bool hasType = currentNodeType != VT_VOID;
		if ((isBlockNode && hasType) || (i == nodes_count - 1)) {
			commonType = getUpperCommonType(commonType, currentNodeType);
		}
	}
	setNodeType(node, commonType);
	_current_scope = node->scope()->parent();
}
  void NodeStatements::print(File * fp)
  {
    printNodeLocation(fp); //has same location as it's node
    UTI myut = getNodeType();
    char id[255];
    if(myut == Nav)
      sprintf(id,"%s<NOTYPE>\n", prettyNodeName().c_str());
    else
      sprintf(id,"%s<%s>\n", prettyNodeName().c_str(), m_state.getUlamTypeNameByIndex(myut).c_str());
    fp->write(id);

    if(m_node)
      m_node->print(fp);
    else
      fp->write(" <EMPTYSTMT>\n");

    if(m_nodeNext)
      m_nodeNext->print(fp);
    else
      fp->write(" <NONEXTSTMT>\n");
    sprintf(id,"-----------------%s\n", prettyNodeName().c_str());
    fp->write(id);
  } //print
Exemple #27
0
  EvalStatus NodeConstantArray::evalToStoreInto()
  {
    //possible access of constant array item (t3881)
    UTI nuti = getNodeType();
    if(nuti == Nav)
      return ERROR;

    if(nuti == Hzy)
      return NOTREADY;

    assert(m_constSymbol);

    if(((SymbolConstantValue *) m_constSymbol)->getConstantStackFrameAbsoluteSlotIndex() == 0)
      return NOTREADY;

    evalNodeProlog(0); //new current node eval frame pointer

    UlamValue rtnUVPtr = makeUlamValuePtr();
    Node::assignReturnValuePtrToStack(rtnUVPtr);

    evalNodeEpilog();
    return NORMAL;
  } //evalToStoreInto
Exemple #28
0
  void NodeCast::genCodeCastAtomAndElement(File * fp, UlamValue & uvpass)
  {
    UTI nuti = getNodeType();
    UlamType * nut = m_state.getUlamTypeByIndex(nuti);

    UTI vuti = uvpass.getUlamValueTypeIdx();
    s32 tmpVarNum = 0;

    if(vuti == Ptr)
      {
	tmpVarNum = uvpass.getPtrSlotIndex();
	vuti = uvpass.getPtrTargetType();  //replace
      }

    // "downcast" might not be true; compare to be sure the atom is an element "Foo"
    if(vuti == UAtom)
      {
	m_state.indent(fp);
	fp->write("if(!");
	fp->write(nut->getUlamTypeMangledName().c_str());
	fp->write("<EC>::THE_INSTANCE.");
	fp->write(m_state.getIsMangledFunctionName());
	fp->write("(");
	fp->write(m_state.getTmpVarAsString(vuti, tmpVarNum).c_str());
	fp->write("))\n");

	m_state.m_currentIndentLevel++;
	m_state.indent(fp);
	fp->write("FAIL(BAD_CAST);\n");
	m_state.m_currentIndentLevel--;
      }

    //update the uvpass to have the casted type
    uvpass = UlamValue::makePtr(tmpVarNum, uvpass.getPtrStorage(), nuti, m_state.determinePackable(nuti), m_state, 0, uvpass.getPtrNameId()); //POS 0 rightjustified; pass along name id

    return;
  } //genCodeCastAtomAndElement
Exemple #29
0
void CX3DViewpointNode::print(int indent)
{
	FILE *fp = CX3DParser::getDebugLogFp();

	char *nodeName = getNodeName();
	if (nodeName)
	{
		float x, y, z, rot;

		CX3DParser::printIndent(indent);
		fprintf(fp, "%s (%s)\n", nodeName, CX3DNode::getNodeTypeString(getNodeType()));

		CX3DParser::printIndent(indent+1);
		fprintf(fp, "fieldOfView : (%f)\n", getFieldOfView()->getValue());

		CX3DParser::printIndent(indent+1);
		fprintf(fp, "jump : %s\n", getJump()->getValue() ? "TRUE" : "FALSE");

		CX3DParser::printIndent(indent+1);
		fprintf(fp, "retainUserOffsets : %s\n", getRetainUserOffsets()->getValue() ? "TRUE" : "FALSE");

		getOrientation()->getValue(x, y, z, rot);
		CX3DParser::printIndent(indent+1);
		fprintf(fp, "orientation : (%f %f %f)(%f)\n", x, y, z, rot);

		getPosition()->getValue(x, y, z);
		CX3DParser::printIndent(indent+1);
		fprintf(fp, "position : (%f %f %f)\n", x, y, z);

		getCenterOfRotation()->getValue(x, y, z);
		CX3DParser::printIndent(indent+1);
		fprintf(fp, "centerOfRotation : (%f %f %f)\n", x, y, z);

		CX3DParser::printIndent(indent+1);
		fprintf(fp, "description : (%s)\n", getDescription()->getValue());
	}
}
void FileBrowser::showContextMenu(int x, int y)
{
	TVHITTESTINFO tvHitInfo;
	HTREEITEM hTreeItem;

	// Detect if the given position is on the element TVITEM
	tvHitInfo.pt.x = x;
	tvHitInfo.pt.y = y;
	tvHitInfo.flags = 0;
	ScreenToClient(_treeView.getHSelf(), &(tvHitInfo.pt));
	hTreeItem = TreeView_HitTest(_treeView.getHSelf(), &tvHitInfo);

	if (tvHitInfo.hItem == nullptr)
	{
		TrackPopupMenu(_hGlobalMenu, TPM_LEFTALIGN, x, y, 0, _hSelf, NULL);
	}
	else
	{
		// Make item selected
		_treeView.selectItem(tvHitInfo.hItem);

		// get clicked item type
		BrowserNodeType nodeType = getNodeType(tvHitInfo.hItem);
		HMENU hMenu = NULL;
		if (nodeType == browserNodeType_root)
			hMenu = _hRootMenu;
		else if (nodeType == browserNodeType_folder)
			//hMenu = _hFolderMenu;
			return;
		else //nodeType_file
			//hMenu = _hFileMenu;
			return;

		TrackPopupMenu(hMenu, TPM_LEFTALIGN, x, y, 0, _hSelf, NULL);
	}
}