void CdbDumperHelper::setDumperCallThread(unsigned long t)
{
    if (m_dumperCallThread != t) {
        m_dumperCallThread = t;
        m_goCommand = goCommand(m_dumperCallThread);
    }
}
CdbDumperHelper::CdbDumperHelper(DebuggerManager *manager,
                                 CdbCore::CoreEngine *coreEngine) :
    m_tryInjectLoad(true),
    m_msgDisabled(QLatin1String("Dumpers are disabled")),
    m_msgNotInScope(QLatin1String("Data not in scope")),
    m_state(NotLoaded),
    m_manager(manager),
    m_coreEngine(coreEngine),
    m_inBufferAddress(0),
    m_inBufferSize(0),
    m_outBufferAddress(0),
    m_outBufferSize(0),
    m_buffer(0),
    m_dumperCallThread(0),
    m_goCommand(goCommand(m_dumperCallThread))
{
}
示例#3
0
//
// Main game loop
//
void XBoard::mainLoop()
{
  run = true;
  pulchess = NULL;

  while(readCommand() && run)
  {
	// if it is a move... play it
	if( pulchess != NULL && pulchess->IsMove(buff))
    {
	  if( !pulchess->gameCommand(buff) )
      {
	     cout << "Illegal move: " << buff << endl;	
      }
      else
      {
         CheckSendResult();
      }
	  if( !pulchess->IsGameFinished() )
      {
        goCommand();
	  }
	  continue;
    }
	
	// start deciding on the first char
    switch(buff[0])
    {  
	  case 'n':
	
	    // new
	    if( buff == "new" )
	    {
	      pulchess = new Pulchess(HUM_VS_CPU);
	      pulchess->Init();
          pulchess->StartGame();
	    }
	
	    // nopost
		if( buff == "nopost" )
		{
		  CPUPlayer::xboardPost = false;
		}
	    break;

	  // variant - UNSUPPORTED
	  case 'v':
	    unimplCommand(buff);
	    break;
	
	  // post
	  case 'p':
	    if( buff == "post") {
		  CPUPlayer::xboardPost = true;
        }
		break;

	  // quit 
	  case 'q':
	    if( buff == "quit" )
	    {
	     run = false;
	     delete pulchess;
	     return;
	    }
	    break;

      // gioco randomizzato
	  case 'r':
		if( buff == "random" )
		{
			// randomize plays
			// currently pulchess ignores this
		}	  
	    break;

      // force mode
      //
      // with this the engine should only check move correctness.
      // for 2 human players, I think.
	  case 'f':
		if( buff == "force" )
	    {
		  unknownCommand(buff);
		  continue;
	    }
	    unimplCommand(buff);
	    break;

      // go
      case 'g':
		if( buff == "go" )
        {
          goCommand();
		  continue;
        }
	    break;

      // white
      //
      // Set White on move. Set the engine to play Black. Stop clocks.
      case 'w':
		if( buff == "white" && pulchess != NULL)
        {
          pulchess->ResetMode(HUM_VS_CPU);
		  continue;
        }
        break;

      // black
      //
      // Set Black on move. Set the engine to play White. Stop clocks.
      case 'b':
		if( buff == "black"  && pulchess != NULL)
        {
          pulchess->ResetMode(CPU_VS_HUM);
		  continue;
	    }
        break;

	case 'l':
	    // level
	    // -> type 1 or 2 of time control.
		if( buff.substr(0,5) == "level"  && pulchess != NULL) {
          pulchess_debug("Trying to set the clock...");
	      unsigned int _m=40, _s=5, _i=0;
          if( sscanf(buff.c_str(), "level %d %d %d", &_m, &_s, &_i) == 3 ) {
            pulchess->SetTimecontrol(_m,_s*60,_i);
            continue;
          }
        }
		break;

	case '?':
		break;
		
    default:
      unknownCommand(buff);
      break;
	}
  }

} // end mainLoop()