예제 #1
0
void startConsole()
{	
	//intptr_t serverId = _spawnl(_P_NOWAIT, "TiGaServ.exe", "TiGaServ.exe", "15600" ); 
	//intptr_t clientId = _spawnl(_P_NOWAIT, "TiGaClient.exe", "TiGaServ.exe", "localhost", "15600" );
	bool exit = false;
	KeyMap keyMap;

	MENU_BEGIN('1',"Print menu")
		printMenu(keyMap);
	MENU_END();
	MENU_BEGIN('2',"Start server")
		system("start TiGaServ.exe 15600" ); 
		//if( serverId == 0 )
		//	serverId = _spawnl(_P_NOWAITO, "TiGaServ.exe", "TiGaServ.exe", "15600" ); 
	MENU_END();

	MENU_BEGIN('3',"Start client")
		system("start TiGaClient.exe 127.0.0.1 15600" ); 
		//size_t id = spawnClient();
		//printf("Client %d spawned\n",id);
	MENU_END();

	MENU_BEGIN(' ',"Exit")
		exit = true;
	MENU_END();
	printMenu(keyMap);
	while(exit != true)
	{
		int ch = getch();		
		KeyMap::iterator it = keyMap.find(ch);
		if( it != keyMap.end() )
			it->second.second();
	}
}
예제 #2
0
  static rinteger make_key(Env* env, Method* meth, KeyMap& keys) {
    KeyMap::iterator iter = keys.find(meth);

    if(iter == keys.end()) {
      rinteger key = env->integer_new(keys.size());
      keys[meth] = key;
      return key;
    }

    return iter->second;
  }