Example #1
0
/// @todo Port this up to the new expression handling code
void MultiDispatch::operator()(
    RLMachine& machine,
    const libReallive::CommandElement& ff) {
  const ptr_vector<ExpressionPiece>& parameter_pieces = ff.getParameters();

  for (unsigned int i = 0; i < parameter_pieces.size(); ++i) {
    const ptr_vector<ExpressionPiece>& element =
        dynamic_cast<const ComplexExpressionPiece&>(parameter_pieces[i]).
        getContainedPieces();

    handler_->dispatch(machine, element);
  }

  machine.advanceInstructionPointer();
}
Example #2
0
void ChildObjAdapter::operator()(RLMachine& machine,
                                 const libReallive::CommandElement& ff) {
  const ptr_vector<ExpressionPiece>& allParameters = ff.getParameters();

  // Range check the data
  if (allParameters.size() < 1)
    throw rlvm::Exception("Less than one argument to an objLayered function!");

  int objset = allParameters[0].integerValue(machine);

  // Copy everything after the first item
  ptr_vector<ExpressionPiece> currentInstantiation;
  ptr_vector<ExpressionPiece>::const_iterator it = allParameters.begin();
  ++it;
  for (; it != allParameters.end(); ++it) {
    currentInstantiation.push_back(it->clone());
  }

  handler->setProperty(P_PARENTOBJ, objset);
  handler->dispatch(machine, currentInstantiation);

  machine.advanceInstructionPointer();
}