void dDataFlowGraph::GetLoops (dList<dLoop>& loops) const { for (dCIL::dListNode* node = m_function; node; node = node->GetNext()) { dThreeAdressStmt& stmt = node->GetInfo(); if ((stmt.m_instruction == dThreeAdressStmt::m_nop) && (stmt.m_arg2.m_label == D_LOOP_HEADER_SYMBOL)) { dList<dLoop>::dListNode* const loopNode = loops.Addtop(); dLoop& loop = loopNode->GetInfo(); loop.m_head = node; int order = stmt.m_extraInformation; for (dList<dLoop>::dListNode* root = loops.GetLast(); root != loops.GetFirst(); root = root->GetPrev()) { int code = root->GetInfo().m_head->GetInfo().m_extraInformation; if (code > order) { loops.InsertAfter (root, loopNode); break; } } for (dCIL::dListNode* node1 = node->GetNext(); node1; node1 = node1->GetNext()) { dThreeAdressStmt& stmt = node1->GetInfo(); int code = stmt.m_extraInformation; if ((stmt.m_instruction == dThreeAdressStmt::m_nop) && (code == order) && (stmt.m_arg2.m_label == D_LOOP_TAIL_SYMBOL)) { loop.m_tail = node1; break; } } } } }
bool dDeterministicFiniteAutonata::CompareSets (dList<dAutomataState*>& setA, dTree<dAutomataState*,dAutomataState*>& setB) const { if (setA.GetCount() == setB.GetCount()) { for (dList<dAutomataState*>::dListNode* node = setA.GetFirst(); node; node = node->GetNext()) { if (!setB.Find(node->GetInfo())) { return false; } } return true; } return false; }
void dCILInstrMove::GetUsedVariables (dList<dArg*>& variablesList) { if (m_arg1.m_isPointer) { variablesList.Append(&m_arg1); } else { switch (m_arg1.GetType().m_intrinsicType) { case m_constInt: case m_constFloat: break; default: variablesList.Append(&m_arg1); } } }
dState (const dList<dItem>& itemSet) :m_key(0), m_number(0), m_hasErroItem(false), m_goto(), m_actions(), m_transitions() { for (dListNode* node = itemSet.GetFirst(); node; node = node->GetNext()) { AddItem (node->GetInfo()); } }
void dAutomataState::GetStateArray (dList<dAutomataState*>& statesList) { dTree<dAutomataState*, dAutomataState*> filter; int stack = 1; dAutomataState* pool[256]; pool[0] = this; filter.Insert(this, this); while (stack) { stack --; dAutomataState* const state = pool[stack]; statesList.Append(state); for (dList<dAutomataState::dTransition>::dListNode* node = state->m_transtions.GetFirst(); node; node = node->GetNext()) { dAutomataState* const state = node->GetInfo().GetState(); if (!filter.Find (state)) { pool[stack] = state; filter.Insert(state, state); stack ++; _ASSERTE (stack < sizeof (pool)/sizeof (pool[0])); } } } }
void dBone::Save(const char* fileName, const dList<dBone*>& list) { TiXmlText* header; TiXmlElement *root; TiXmlDeclaration* decl; TiXmlDocument out (fileName); decl = new TiXmlDeclaration( "1.0", "", "" ); out.LinkEndChild( decl ); root = new TiXmlElement( "root" ); out.LinkEndChild(root); header = new TiXmlText (XML_HEADER); root->LinkEndChild(header); for (dList<dBone*>::dListNode* node = list.GetFirst(); node; node = node->GetNext()) { int stack; TiXmlElement *skeleton; const dBone* nodeArray[1024]; skeleton = new TiXmlElement( "skeleton" ); stack = 1; nodeArray[0] = node->GetInfo(); while (stack) { const char* name; const dBone* node; TiXmlElement* xmlNode; stack --; node = nodeArray[stack]; name = node->GetName(); xmlNode = new TiXmlElement( "bone" ); skeleton->LinkEndChild(xmlNode); xmlNode->SetAttribute("name", name); if (node->GetParent()) { const char* parentName; parentName = node->GetParent()->GetName(); xmlNode->SetAttribute("parent", parentName); } xmlNode->SetAttribute("boneID", node->GetBoneID()); char matrixBuffer[512]; dModel::FloatsToString (matrixBuffer, &node->m_localMatrix[0][0], 16); xmlNode->SetAttribute("matrix", matrixBuffer); for (node = node->GetChild(); node; node = node->GetSibling()) { nodeArray[stack] = node; stack ++; } } root->LinkEndChild(skeleton); } out.SaveFile (fileName); }
dCILInstrCall::dCILInstrCall(dCIL& program, const dString& returnValue, const dArgType& type, const dString& target, dList<dArg>& parameters) :dCILTwoArgInstr (program, dArg (returnValue, type), dArg (target, dArgType())) ,m_tagetNode(NULL) { for (dList<dArg>::dListNode* node = parameters.GetFirst(); node; node = node->GetNext()) { m_parameters.Append (node->GetInfo()); } }
dCILInstrPhy::dCILInstrPhy (dCIL& program, const dString& name, const dArgType& type, const dBasicBlock* const basicBlock, dList<const dBasicBlock*>& sources) :dCILSingleArgInstr(program, dArg(name, type)) { m_basicBlock = (dBasicBlock*)basicBlock; for (dList<const dBasicBlock*>::dListNode* node = sources.GetFirst(); node; node = node->GetNext()) { m_sources.Append (dArgPair (m_arg0, node->GetInfo())); } }
void dModel::GetBoneList (dList<dBone*>& bodeList) const { for (dList<dBone*>::dListNode* node = m_skeleton.GetFirst(); node; node = node->GetNext()) { dBone* rootbone = node->GetInfo(); for (dBone* bone = rootbone->GetFirst(); bone; bone = (dBone*) bone->GetNext()) { bodeList.Append(bone); } } }
dCILInstrPhy::dCILInstrPhy (dCIL& program, const dString& name, const dArgType& type, dList<dCILInstr*>& source, const dBasicBlock* const basicBlock) :dCILSingleArgInstr(program, dArg(name, type)) { m_basicBlock = (dBasicBlock*)basicBlock; for (dList<dCILInstr*>::dListNode* node = source.GetFirst(); node; node = node->GetNext()) { dCILInstr* const instruction = node->GetInfo(); m_sources.Append (instruction->GetNode()); } }
void dCILInstrPhy::GetUsedVariables (dList<dArg*>& variablesList) { for (dList<dArgPair>::dListNode* node = m_sources.GetFirst(); node; node = node->GetNext()) { dArg* const arg = &node->GetInfo().m_arg; if (arg->GetType().m_isPointer) { variablesList.Append(arg); } else { switch (arg->GetType().m_intrinsicType) { case m_constInt: case m_constFloat: break; default: variablesList.Append(arg); } } } }
bool dDataFlowGraph::IsStatementInReachList(dCIL::dListNode* const node, dList<dCIL::dListNode*>& definitionList, dCIL::dListNode* const me) const { const dDataFlowPoint& point = m_dataFlowGraph.Find (node)->GetInfo(); for (dList<dCIL::dListNode*>::dListNode* ptr = definitionList.GetFirst(); ptr; ptr = ptr->GetNext()) { dCIL::dListNode* const defVarStmt = ptr->GetInfo(); if (defVarStmt != me) { if (point.m_reachStmtInputSet.Find(defVarStmt)) { return true; } } } return false; }
void dParserCompiler::First ( const dList<dCRCTYPE>& symbolSet, const dTree<dTokenInfo, dCRCTYPE>& symbolList, const dTree<dList<void*>, dCRCTYPE>& ruleMap, dTree<int, dCRCTYPE>& firstSetOut) const { if (symbolSet.GetCount() > 1) { dList<dCRCTYPE>::dListNode* node = symbolSet.GetFirst(); bool deriveEmpty = true; while ((deriveEmpty) && node) { dCRCTYPE symbol = node->GetInfo(); node = node->GetNext(); dTree<int, dCRCTYPE> tmpFirst; dTree<int, dCRCTYPE> symbolListMark; First (symbol, symbolListMark, symbolList, ruleMap, tmpFirst); dTree<int, dCRCTYPE>::Iterator iter (tmpFirst); deriveEmpty = false; for (iter.Begin(); iter; iter ++) { dCRCTYPE symbol = iter.GetKey(); if (symbol == 0) { deriveEmpty = true; } else { firstSetOut.Insert(0, symbol); } } } if (deriveEmpty) { firstSetOut.Insert(0, 0); } } else { dCRCTYPE symbol = symbolSet.GetFirst()->GetInfo(); dTree<int, dCRCTYPE> symbolListMark; First (symbol, symbolListMark, symbolList, ruleMap, firstSetOut); } }
void dBone::Load(const char* fileName, dList<dBone*>& list, dLoaderContext& context) { const TiXmlElement* root; TiXmlDocument doc (fileName); doc.LoadFile(); root = doc.RootElement(); if (root && !strcmp (root->GetText (), "newton 2.0 file format")){ for (const TiXmlElement* skeleton = (TiXmlElement*)root->FirstChild("skeleton"); skeleton; skeleton = (TiXmlElement*)skeleton->NextSibling()) { dBone* rootBone; rootBone = NULL; for (const TiXmlElement* node = (TiXmlElement*)skeleton->FirstChild("bone"); node; node = (TiXmlElement*)node->NextSibling()) { dBone* bone; const char* name; const char* parent; name = node->Attribute ("name"); parent = node->Attribute ("parent"); if (parent) { dBone* parentBone; parentBone = rootBone->Find (parent); _ASSERTE (parentBone); bone = context.CreateBone (parentBone); } else { bone = context.CreateBone (NULL); rootBone = bone; } dMatrix matrix; bone->SetNameID(name); node->Attribute ("boneID", &bone->m_boneID); dModel::StringToFloats (node->Attribute("matrix"), &matrix[0][0]); bone->SetMatrix (matrix); } list.Append(rootBone); } } }
void RigidBodyWorldDesc::GetNodeList (dList<INode*>& list) { int stackIndex; INode* stack[4096]; stackIndex = 1; Interface* const ip = GetCOREInterface(); stack[0] = ip->GetRootNode(); while (stackIndex) { stackIndex --; INode* const node = stack[stackIndex]; list.Append(node); for (int i = 0; i < node->NumberOfChildren(); i ++) { stack[stackIndex] = node->GetChildNode(i); stackIndex ++; _ASSERTE (stackIndex * sizeof (INode*) < sizeof (stack)); } } }
void dCILInstrStore::GetUsedVariables(dList<dArg*>& variablesList) { variablesList.Append(&m_arg0); variablesList.Append(&m_arg1); }
void dCILInstrLoad::GetUsedVariables (dList<dArg*>& variablesList) { variablesList.Append(&m_arg1); }