示例#1
0
文件: block.c 项目: zhanglp92/search
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;
}
示例#2
0
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;
}
示例#3
0
文件: cfg.cpp 项目: IshanRastogi/hhvm
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;
}
示例#4
0
文件: Line.C 项目: quatmax/wt
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);
  }
}
示例#5
0
BlockList StockManager::getBlockList() {
    return m_blockDriver ? m_blockDriver->getBlockList() : BlockList();
}
示例#6
0
BlockList StockManager::getBlockList(const string& category) {
    return m_blockDriver ? m_blockDriver->getBlockList(category) : BlockList();
}