Ejemplo n.º 1
0
//--------------------------------------------------------------
// process input line
void mgDebugPane::processInput(
  const mgString& input)
{
  mgString verb;
  int posn = input.getToken(0, " *(=", verb);

  if (verb.equalsIgnoreCase("help"))
  {
    mgString helpText;
    m_debugApp->debugHelp(helpText);
    m_console->addLine(OUTPUT_COLOR, NULL, helpText);
  }
  else if (verb.equalsIgnoreCase("list"))
  {
    listVariables();
    listFunctions();
  }
  else
  {
    if (!parseGetVariable(input))
    {
      if (!parseSetVariable(input))
      {
        if (!parseCallFunction(input))
          m_console->addLine(ERROR_COLOR, NULL, "Unknown command.");
      }
    }
  }
}
Ejemplo n.º 2
0
    // Insert (another) line of text into the interpreter.
    OgitorsScriptConsole::State OgitorsScriptConsole::insertLine( std::string& line, bool fInsertInOutput )
    {
        OGRE_LOCK_AUTO_MUTEX;
        if( fInsertInOutput == true )
        {
            mOutput.push_back(line);
        }

        if( mFirstLine && line.substr(0,1) == "=" )
        {
            line = "return " + line.substr(1, line.length()-1 );
        }

        mCurrentStatement += line;
        mFirstLine = false;

        mState = LI_READY;

        if(mCurrentStatement == "list")
        {
            listFunctions();
        }
        else
        {
            std::string sought = "(";
            int pos = mCurrentStatement.find(sought);
            if(pos == std::string::npos)
            {
                mCurrentStatement += std::string("()");
            }
            execString(mCurrentStatement);
        }

        mCurrentStatement.clear();
        mFirstLine = true;

        mPrompt = LI_PROMPT;

        return mState;
    }