int block_search (RecordList l, int key) { BlockList (BLOCK_SIZE, l.length, 1); int i; for (i = 0; i < block_list1.length; i++) { block_list1.r[i].addr = i * block_list1.block_length; block_list1.r[i].max_key = l.r[i*5].key; } for (i = 0; i < l.length; i++) if (block_list1.r[i/5].max_key < l.r[i].key) block_list1.r[i/5].max_key = l.r[i].key; for (i = 0; i < block_list1.length; i++) { if (key < block_list1.r[i].max_key) { l.list_s = block_list1.r[i].addr; l.list_e = (i == block_list1.length-1 ? l.length : block_list1.r[i+1].addr-1); return seq_search (l, key); } } return l.length; }
DomChildren findDomChildren(const BlockList& blocks) { IdomVector idom = findDominators(blocks); DomChildren children(blocks.size(), BlockList()); for (Block* block : blocks) { int idom_id = idom[block->postId()]; if (idom_id != -1) children[idom_id].push_back(block); } return children; }
DomChildren findDomChildren(const IRUnit& unit, const BlocksWithIds& blocks) { IdomVector idom = findDominators(unit, blocks); DomChildren children(unit, BlockList()); for (Block* block : blocks.blocks) { auto idomBlock = idom[block]; if (idomBlock) children[idomBlock].push_back(block); } return children; }
void Line::moveToNextPage(BlockList& floats, double minX, double maxX, const WTextRenderer& renderer) { for (unsigned i = 0; i < blocks_.size(); ++i) { Block *b = blocks_[i]; if (b->isFloat()) Utils::erase(floats, b); } PageState ps; ps.floats = floats; ps.page = page_; Block::clearFloats(ps); page_ = ps.page; floats = ps.floats; double oldY = y_; y_ = 0; x_ = minX; ++page_; BlockList blocks = BlockList(blocks_); blocks_.clear(); Range rangeX(x_, maxX); Block::adjustAvailableWidth(y_, page_, floats, rangeX); x_ = rangeX.start; maxX = rangeX.end; for (unsigned i = 0; i < blocks.size(); ++i) { Block *b = blocks[i]; if (b->isFloat()) { b->layoutFloat(y_, page_, floats, x_, height_, minX, maxX, false, renderer); reflow(b); } else { for (unsigned j = 0; j < b->inlineLayout.size(); ++j) { InlineBox& ib = b->inlineLayout[j]; if (ib.y == oldY && ib.page == page_ - 1) { if (ib.x != LEFT_MARGIN_X) { ib.x = x_; x_ += ib.width; } ib.page = page_; ib.y = y_; } } } blocks_.push_back(b); } }
BlockList StockManager::getBlockList() { return m_blockDriver ? m_blockDriver->getBlockList() : BlockList(); }
BlockList StockManager::getBlockList(const string& category) { return m_blockDriver ? m_blockDriver->getBlockList(category) : BlockList(); }