void ProcComdef( bool isstatic ) /*************************************/ { bool is32bit = isCOMDEF32(); char * sym_name; unsigned_8 sym_len; byte kind; unsigned_32 size; symbol * sym; extnode * ext; sym_flags flags; flags = ST_CREATE | ST_REFERENCE; if( isstatic ) { flags |= ST_STATIC; } while( ObjBuff < EOObjRec ) { sym_len = *ObjBuff++; sym_name = (char *)ObjBuff; ObjBuff += sym_len; SkipIdx(); kind = *ObjBuff++; size = GetLeaf(); if( kind == COMDEF_FAR ) { size *= GetLeaf(); } sym = SymOp( flags, sym_name, sym_len ); sym = MakeCommunalSym( sym, size, kind == COMDEF_FAR, is32bit ); ext = AllocNode( ExtNodes ); ext->entry = sym; ext->ovlref = 0; } }
bool HierarchyInstaller::InstallTree(HierarchConfNamed *root, const char *rootName, const ROAnything tree, Registry *r) { StartTrace(HierarchyInstaller.InstallTree); bool installSuccess = InstallRoot(root, rootName); Trace("root [" << rootName << "] success: " << (installSuccess ? "true" : "false")); long subTreeSz = tree.GetSize(); for (int i = 0; i < subTreeSz; ++i) { bool subtree = true; const char *leafName = tree.SlotName(i); if (!leafName) { leafName = tree[i].AsCharPtr(0); subtree = false; // no more hierarchy } if (leafName) { // there is something to install HierarchConfNamed *leaf = GetLeaf(leafName, root, r); if (leaf) { leaf->SetSuper(root); if (subtree) { installSuccess = InstallTree(leaf, leafName, tree[i], r) && installSuccess; } } else { Trace("failed leaf:" << leafName); installSuccess = false; } } } return installSuccess; }
wxDataViewItem MemCheckOutputView::GetAdjacentItem(const wxDataViewItem& item, bool forward = true) { wxDataViewItem parent = m_dataViewCtrlErrorsModel->GetParent(item); wxDataViewItemArray siblings; m_dataViewCtrlErrorsModel->GetChildren(parent, siblings); int pos = siblings.Index(item) + (forward ? 1 : -1); if(pos < 0 || pos >= (int)siblings.GetCount()) { if(!parent.IsOk()) { // parent == virtual root => we are on top level return GetLeaf(siblings.Item(forward ? 0 : siblings.GetCount() - 1), forward); } else { return GetLeaf(GetAdjacentItem(parent, forward), forward); } } else { return GetLeaf(siblings.Item(pos), forward); } }
void MemCheckOutputView::OnActivated(wxDataViewEvent& event) { // CL_DEBUG1(PLUGIN_PREFIX("MemCheckOutputView::OnActivated()")); wxDataViewItem item = GetLeaf(event.GetItem()); SetCurrentItem(item); JumpToLocation(item); }
TreeNode *MedianCut::FindVectorBest(cbVector &Vect) { TreeNode *pNode; long i, Diff, BestIndex = 0, BestDiff = 0x7fffffff; for(i=0; i<GetCount(); i++) { pNode = GetLeaf(i); Diff = Vect.DiffMag(pNode->Center); if(Diff < BestDiff) { BestDiff = Diff; BestIndex = i; } } return GetLeaf(BestIndex); }
void MemCheckOutputView::OnJumpToLocation(wxCommandEvent& event) { wxDataViewEvent* menuEvent = dynamic_cast<wxDataViewEvent*>(event.GetEventUserData()); if(!menuEvent) return; wxDataViewItem item = GetLeaf(menuEvent->GetItem()); SetCurrentItem(item); JumpToLocation(item); }
bool HierarchyInstaller::DoInstall(const ROAnything installerSpec, Registry *r) { StartTrace(HierarchyInstaller.DoInstall); TraceAny(installerSpec, ""); long isSz = installerSpec.GetSize(); bool installSuccess = true; for (long l = 0; l < isSz; ++l) { const char *pcRegObjectName = installerSpec.SlotName(l); installSuccess = InstallTree(GetLeaf(pcRegObjectName, 0, r), pcRegObjectName, installerSpec[l], r); } return installSuccess; }
TokIdNode *TokIdNode::GetNext(TokIdNode const *node, TokIdNode const *subroot) { if(node->v_prev == 0 || node == subroot) { return 0; } if(node->h_next) { return GetLeaf(node->h_next); } return (TokIdNode *)node->v_prev; }
wxDataViewItem MemCheckOutputView::GetLeaf(const wxDataViewItem& item, bool first = true) { // CL_DEBUG1(PLUGIN_PREFIX("MemCheckOutputView::GetLeaf()")); if(m_dataViewCtrlErrorsModel->IsContainer(item)) { m_dataViewCtrlErrors->Expand(item); wxDataViewItemArray subItems; m_dataViewCtrlErrorsModel->GetChildren(item, subItems); return GetLeaf(subItems.Item(first ? 0 : subItems.GetCount() - 1)); } else { return item; } }
void MemCheckOutputView::OnJumpToPrev(wxCommandEvent& event) { // CL_DEBUG1(PLUGIN_PREFIX("MemCheckOutputView::OnJumpToPrev()")); if(m_currentPageIsEmptyView) return; m_notebookOutputView->ChangeSelection(m_notebookOutputView->FindPage(m_panelErrors)); wxDataViewItem item = m_dataViewCtrlErrors->GetCurrentItem(); if(item.IsOk()) { item = GetAdjacentItem(item, false); } else { wxDataViewItemArray items; m_dataViewCtrlErrorsModel->GetChildren(wxDataViewItem(0), items); item = GetLeaf(items.Item(items.GetCount() - 1), false); } SetCurrentItem(item); JumpToLocation(item); }
void MedianCut::BuildTree(CodeBook &Codes, long TreeSize) { bool bFinished = false; TreeNode *pNode, *pLE, *pGT; cbVector *pVect; VectPtr *pList; long Axis, Len, i, Split, Count, NumLeaves, Changed = 0; ResetTree(); BuildRootNode(Codes); if(pRoot == 0) bFinished = true; NumLeaves = LeafList.Count(); while(!bFinished) { pNode = GetFirstLeaf(); Axis = pNode->LongAxis; Len = pNode->AxisLen; if(Len == 0) break; // Couldn't find a split - Finished // Create two new tree nodes pLE = pNode->pLessEqual = GetNewTreeNode(); pGT = pNode->pGreater = GetNewTreeNode(); // Choose a split point for the parent node Split = pNode->SplitPoint; pNode->SplitAxis = (u8)Axis; pNode->SplitPoint = (u8)Split; // Move all nodes from the parent into the two children Count = pNode->CodeList.Count(); pLE->CodeList.Resize(Count); pGT->CodeList.Resize(Count); pList = pNode->CodeList.Addr(0); for(i=0; i<Count; i++) { pVect = pList[i].pVect; if((*pVect)[Axis] <= Split) pLE->CodeList.Append(pList[i]); else pGT->CodeList.Append(pList[i]); } // Compute the min & max values of the two children pLE->ComputeBounds(); pLE->ComputeError(); pGT->ComputeBounds(); pGT->ComputeError(); pNode->CodeList.Resize(0); // Add the children to the leaf list and increment the leaf count LeafList.ExtractInsert( pLE ); LeafList.Insert( pGT ); NumLeaves++; if(NumLeaves == TreeSize) bFinished = true; } // Index the nodes Count = LeafList.Count(); for(i=0; i<Count; i++) { pNode = GetLeaf(i); pNode->Index = i; } }