Example #1
0
UnimplementedOpcode::UnimplementedOpcode(
    RLMachine& machine,
    const libReallive::CommandElement& command)
    : Exception(""),
      has_parameters_(true),
      parameters_(command.getUnparsedParameters()) {
    ostringstream oss;
    oss << "opcode<" << command.modtype() << ":" << command.module() << ":"
        << command.opcode() << ", " << command.overload() << ">";
    name_ = oss.str();
    setFullDescription(machine);
}
Example #2
0
void RLOp_SpecialCase::dispatchFunction(RLMachine& machine,
                                        const libReallive::CommandElement& ff) {
  // First try to run the default parse_parameters if we can.
  if (!ff.areParametersParsed()) {
    vector<string> unparsed = ff.getUnparsedParameters();
    libReallive::ExpressionPiecesVector output;
    parseParameters(unparsed, output);
    ff.setParsedParameters(output);
  }

  // Pass this on to the implementation of this functor.
  operator()(machine, ff);
}
Example #3
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 #4
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();
}