Beispiel #1
0
CBool CScene::ReverseExecuteAction(CInt id )
{
	if( m_numClips == 0 )
	{
		CChar temp[MAX_NAME_SIZE];
		sprintf( temp, "\n%s%s%s", "scene '", GetName(), "' has no animation" );
		PrintInfo( temp, COLOR_RED );
		return CFalse;
	}

	if( id > m_numClips - 1 || id < 0 )
	{
		CChar temp[MAX_NAME_SIZE];
		sprintf( temp, "\n%s%s%s", "Invalid animation ID for scene '", GetName(), "'" );
		PrintInfo( temp, COLOR_RED );
		return CFalse;
	}

	if( m_animationClips[id]->GetAnimationStatus() == eANIM_BLEND_CYCLE || m_animationClips[id]->GetAnimationStatus() == eANIM_CLEAR_CYCLE )
		return CFalse;

	if( m_animationClips[id]->GetAnimationStatus() != eANIM_EXECUTE_ACTION )
		return CFalse;

	if( m_animationClips[id]->GetReverse() )
		return CFalse;

	m_animationClips[id]->SetReverse(CTrue);
	m_updateAnimationLists = CTrue;
	return CTrue;
}
Beispiel #2
0
/* Main driver.

Arguments (may be any combination):
-sstring - digests string
-t       - runs time trial
-ct		 - runs time trial in convert number mode
-x       - runs test script
-h		 - print help info
--help   - print help info
filename - digests file
(none)   - digests standard input
*/
int main (int argc, char *argv[])
{
	if (argc > 1) {
		if (strcmp(argv[1], "-s") == 0) {
			if (argc == 3)
				MDString(argv[2]);
			else
				MDString("");
		} else if (strcmp(argv[1], "-t") == 0)
			//MDTimeTrial();
			MDWordTime();
		else if (strcmp(argv[1], "-ct") == 0)
			MDWordTimeConvert();
		else if (strcmp(argv[1], "-x") == 0)
			MDTestSuite();
		else if (strcmp(argv[1], "-c") == 0)
			MDCrypt("8f14e45fceea167a5a36dedd4bea2543");
		else if (strcmp(argv[1], "-h") == 0)
			PrintInfo();
		else if (strcmp(argv[1], "--help") == 0)
			PrintInfo();
		else
			MDFile(argv[1]);    
	} else
		MDFilter();

	return 0;
}
Beispiel #3
0
static void pattern_fill(unsigned char *buffer, unsigned int pattern,
			 size_t n)
{
	unsigned int	i, nb;
	unsigned char	bpattern[sizeof(pattern)], *ptr;

	if (pattern == (unsigned int) ~0) {
		PrintInfo(3500, MSG_236);
		srand((unsigned int)GetTickCount64());
		for (ptr = buffer; ptr < buffer + n; ptr++) {
			// coverity[dont_call]
			(*ptr) = rand() % (1 << (8 * sizeof(char)));
		}
	} else {
		PrintInfo(3500, MSG_237, pattern);
		bpattern[0] = 0;
		for (i = 0; i < sizeof(bpattern); i++) {
			if (pattern == 0)
				break;
			bpattern[i] = pattern & 0xFF;
			pattern = pattern >> 8;
		}
		nb = i ? (i-1) : 0;
		for (ptr = buffer, i = nb; ptr < buffer + n; ptr++) {
			*ptr = bpattern[i];
			if (i == 0)
				i = nb;
			else
				i--;
		}
		cur_pattern++;
	}
}
void SocketClient::ReceiveData()
{
    int res = 0;

    char* recvBuf = new char[DEFAULT_BUFLEN];
    int receiveBufLen = DEFAULT_BUFLEN;

    res = recv(ConnectSocket, recvBuf, receiveBufLen, 0);
    if (res > 0)
    {
        PrintInfo("Bytes received: %d", res);

        NetworkMessage* msg = new NetworkMessage();
        msg->TimeStamp = time(NULL);
        msg->Message = recvBuf;

        this->data->Push(msg);
    }
    else if (res == 0)
    {
        PrintInfo("Connection closed");
    }
    else
    {
        PrintInfo("recv failed: %d", WSAGetLastError());
    }
}
void SocketServer::ListenAndAccept()
{
    int res = 0;

    res = listen(ListenSocket, SOMAXCONN);
    if (res == SOCKET_ERROR) {
        int err = WSAGetLastError();

        PrintInfo("listen failed with error: %d", err);
        closesocket(ListenSocket);
        //WSACleanup();

        return;
    }

    SOCKET currentClientSocket = INVALID_SOCKET;

    currentClientSocket = accept(ListenSocket, NULL, NULL);
    if (currentClientSocket == INVALID_SOCKET) {
        PrintInfo("accept failed with error: %d", WSAGetLastError());
        closesocket(ListenSocket);
        //WSACleanup();

        return;
    }

    StartReadingFromSocket(currentClientSocket);
}
Beispiel #6
0
CBool CScene::ClearCycle(CInt id, CFloat delay)
{
	if( m_numClips == 0 )
	{
		CChar temp[MAX_NAME_SIZE];
		sprintf( temp, "\n%s%s%s", "scene '", GetName(), "' has no animation" );
		PrintInfo( temp, COLOR_RED );
		return CFalse;
	}

	if( id > m_numClips - 1 || id < 0 )
	{
		CChar temp[MAX_NAME_SIZE];
		sprintf( temp, "\n%s%s%s", "Invalid animation ID for scene '", GetName(), "'" );
		PrintInfo( temp, COLOR_RED );
		return CFalse;
	}

	if( m_animationClips[id]->GetAnimationStatus() != eANIM_BLEND_CYCLE || m_animationClips[id]->GetAnimationStatus() == eANIM_EXECUTE_ACTION)
		return CFalse;

	if( m_animationClips[id]->GetAnimationStatus() != eANIM_BLEND_CYCLE && m_animationClips[id]->GetAnimationStatus() != eANIM_CLEAR_CYCLE)
		m_blendCycleList.push_back( m_animationClips[id]->GetName() );

	m_animationClips[id]->SetTargetDelayIn( 0.0f );
	m_animationClips[id]->SetTargetDelayOut( delay );
	m_animationClips[id]->SetCurrentDelayInTime( 0.0f );
	m_animationClips[id]->SetCurrentDelayOutTime( 0.0f );
	m_animationClips[id]->SetTargetWeight( 0.0f );
	m_animationClips[id]->SetStartWeight( m_animationClips[id]->GetCurrentWeight() );
	m_animationClips[id]->SetAnimationStatus( eANIM_CLEAR_CYCLE );
	m_updateAnimationLists = CTrue;

	return CTrue;
}
void go(void)
{
	GFLW_LIBRARY::Initialise(); 
	GFLW_LIBRARY::EnableLZW(GFL_TRUE); 
	
	GFLW_FORMAT
		format; 
	GFL_ERROR
		ret; 

	format.FindByName("jpeg"); 
	PrintInfo(format); 
	format.FindByFilename("toto.tif"); 
	PrintInfo(format); 
	format.FindByIndex(10); 
	PrintInfo(format); 
	
	ret = GFLW_FORMAT::FindFirst(format); 
	while ( ret == GFL_NO_ERROR )
	{
		ret = GFLW_FORMAT::FindNext(format); 
		PrintInfo(format); 
	}

	GetInfo( DIR"test1" ); 
	TestFile( DIR"test1", DIR"test1.bmp", -1 ); 
	GetInfo( DIR"test1.bmp" ); 
	TestFile( DIR"test2", DIR"test2.bmp", -1 ); 
	GetInfo( DIR"test2.bmp" ); 
	
	GetInfo( DIR"test3" ); 
	TestFile( DIR"test3", DIR"test3.bmp", GFLW_FORMAT("jpeg").GetIndex() ); 
	GetInfo( DIR"test2.bmp" ); 
	TestFile( DIR"test4", DIR"test.bmp", -1 ); 
	
	Test2File( DIR"test2", DIR"test4.bmp", GFLW_FORMAT("bmp").GetIndex() ); 
	GetInfo( DIR"test4.bmp" ); 
	
	Test3File( DIR"test2", DIR"test5.bmp", GFLW_FORMAT("bmp").GetIndex() ); 
	GetInfo( DIR"test5.bmp" ); 
	
	Test4File( DIR"test2", DIR"test6.jpg", GFLW_FORMAT("jpeg").GetIndex(), 5 ); 
	Test4File( DIR"test2", DIR"test7.jpg", GFLW_FORMAT("jpeg").GetIndex(), 80 ); 
	
	Test5File( DIR"test2", DIR"test10.gif", GFLW_FORMAT("gif").GetIndex(), GFL_MODE_TO_BINARY, GFL_MODE_FLOYD_STEINBERG ); 
	Test5File( DIR"test2", DIR"test11.gif", GFLW_FORMAT("gif").GetIndex(), GFL_MODE_TO_64GREY, GFL_MODE_PATTERN_DITHER ); 
	Test5File( DIR"test2", DIR"test12.gif", GFLW_FORMAT("gif").GetIndex(), GFL_MODE_TO_64GREY, GFL_MODE_ADAPTIVE ); 
	Test5File( DIR"test2", DIR"test13.gif", GFLW_FORMAT("gif").GetIndex(), GFL_MODE_TO_216COLORS, GFL_MODE_PATTERN_DITHER ); 
	Test5File( DIR"test2", DIR"test14.gif", GFLW_FORMAT("gif").GetIndex(), GFL_MODE_TO_216COLORS, GFL_MODE_ADAPTIVE ); 
	Test5File( DIR"test10.gif", DIR"test15.jpg", GFLW_FORMAT("jpeg").GetIndex(), GFL_MODE_TO_RGB, 0 ); 
	
	Test6File( DIR"test1", DIR"test16.png" ); 

	Test7File( "jpeg" ); 

	Test8File(); 

	GFLW_LIBRARY::Exit(); 
}
void SocketServer::Init()
{
    int res = 0;

    res = StartNetworkComponent(&wsaData);// WSAStartup(MAKEWORD(2, 2), &wsaData);

    if (res != 0)
    {
        DWORD err = GetLastError();

        PrintInfo("WinSock Startup error %d", res);

        return;
    }

    ZeroMemory(&hints, sizeof(hints));
    hints.ai_family = AF_INET;
    hints.ai_socktype = SOCK_STREAM;
    hints.ai_protocol = IPPROTO_TCP;
    hints.ai_flags = AI_PASSIVE;

    res = getaddrinfo(NULL, ServerPort.c_str(), &hints, &result);
    if (res != 0) {
        PrintInfo("getaddrinfo failed with error: %d", res);
        //WSACleanup();

        serverValid = false;

        return;
    }

    ListenSocket = socket(result->ai_family, result->ai_socktype, result->ai_protocol);
    if (ListenSocket == INVALID_SOCKET) {
        PrintInfo("socket failed with error: %ld", WSAGetLastError());
        freeaddrinfo(result);
        //WSACleanup();
        
        serverValid = false;

        return;
    }

    res = bind(ListenSocket, result->ai_addr, (int)result->ai_addrlen);
    if (res == SOCKET_ERROR) {
        PrintInfo("bind failed with error: %d", WSAGetLastError());
        freeaddrinfo(result);
        closesocket(ListenSocket);
        //WSACleanup();
        
        serverValid = false;

        return;
    }

    freeaddrinfo(result);
}
Beispiel #9
0
void energy_init ()
{
	/*
	*  readmemorysizesfromparmfile_ --  fortran function reads first part of parm file, calculates size memory
	*  readfromparmfile_ -- fortran function reads second part of parm file after allocation of memory 
	*/ 
	//  int num_file = 8;
	int len_name = 0;
	int lastr = 1;
	int lasti = 1;
	int lasth = 1;
	int lastpr = 1;
	int lastrst = 1;
	int lastist = 1;
//	int atomsMaskLength=0;
	char *coordFileName, *refcFileName, sysCommand[500];
	
	len_name = strlen(proteinFileNameNoExt );
	PrintInfo(("\n\n Reading memory sizes from file \n")); 
//	readmemorysizesfromparmfile_(&lastr,&lasti,&lasth,&lastpr,&lastrst,&lastist, proteinFileNameNoExt, &len_name, NULL, &atomsMaskLength);
	readmemorysizesfromparmfile_(&lastr,&lasti,&lasth,&lastpr,&lastrst,&lastist, proteinFileNameNoExt, &len_name, &keepLigandFixedDuringMinimization);

	//DoPause();	
	
	parmet = (PARAMET*) malloc (sizeof(PARAMET));
	parmet->px = (double*) malloc( (lastr) * sizeof(double));
	parmet->pix = (int*) malloc( (lasti) * sizeof(int));
	parmet->pih = (STRING*) malloc( (lasth) * sizeof(STRING));
	parmet->pipairs = (int*) malloc( (lastpr) * sizeof(int));
	parmet->pr_stack = (double*) malloc( (lastrst) * sizeof(double));
	parmet->pi_stack = (int*) malloc( (lastist) * sizeof(int));

	//Actually, here, before starting the reading of the parm file
	// we have to copy the ".coord" file into the ".refc" file because
	// we need the ligand to be kept fixed
	coordFileName = (char*)malloc( len_name + 10 );
	refcFileName = (char*)malloc( len_name + 10 );
	strcpy( coordFileName, proteinFileNameNoExt );
	strcat( coordFileName, ".coord" );
	strcpy( refcFileName, proteinFileNameNoExt );
	strcat( refcFileName, ".refc" );
	strcpy( file_coord, coordFileName);

	sprintf(sysCommand, "cp %s %s", coordFileName, refcFileName);
	PrintInfo(("\n\n Executing: %s \n", sysCommand)); 
	system( sysCommand );
	
	
	PrintInfo(("\n\n Reading from the parm file \n")); 
	//rdparm2_(parmet->px,parmet->pix,parmet->pih,parmet->pipairs,parmet->pr_stack,&num_file,parmet->pi_stack);
	readfromparmfile_(parmet->px,parmet->pix,parmet->pih,parmet->pipairs,parmet->pr_stack,parmet->pi_stack);

	// stef
	//PARMpt = &PARM;
}
void SocketClient::Init()
{
    int res = 0;

    res = StartNetworkComponent(&wsaData);

    if (res != 0)
    {
        DWORD err = GetLastError();

        PrintInfo("WinSock Startup error %d", res);

        return;
    }

    PrintInfo("WinSock Startup success !");

    ZeroMemory(&hints, sizeof(hints));
    hints.ai_family = AF_INET;
    hints.ai_socktype = SOCK_STREAM;
    hints.ai_protocol = IPPROTO_TCP;

    res = getaddrinfo(ServerAddress.c_str(), ServerPort.c_str(), &hints, &result);

    if (res != 0)
    {
        DWORD err = GetLastError();

        //WSACleanup();

        PrintInfo("WinSock GetAddrInfo error %d", res);

        return;
    }

    PrintInfo("WinSock GetAddrInfo success !");

    ptr = result;

    ConnectSocket = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol);

    if (ConnectSocket == INVALID_SOCKET)
    {
        res = WSAGetLastError();

        PrintInfo("Error at socket() %ld", res);

        freeaddrinfo(result);
        //WSACleanup();

        return;
    }

}
Beispiel #11
0
CBool CScene::ExecuteAction(CInt id, CFloat delayIn, CFloat delayOut, CFloat weight, CBool LockToLastFrame)
{
	if( m_numClips == 0 )
	{
		CChar temp[MAX_NAME_SIZE];
		sprintf( temp, "\n%s%s%s", "scene '", GetName(), "' has no animation" );
		PrintInfo( temp, COLOR_RED );
		return CFalse;
	}

	if( id > m_numClips - 1 || id < 0 )
	{
		CChar temp[MAX_NAME_SIZE];
		sprintf( temp, "\n%s%s%s", "Invalid animation ID for scene '", GetName(), "'" );
		PrintInfo( temp, COLOR_RED );
		return CFalse;
	}

	if( weight == 0 ) return CFalse;
	if( weight > 1 ) weight = 1;

	if( delayIn + delayOut  > m_animationClips[id]->GetDuration() )
	{
		CChar temp[MAX_NAME_SIZE];
		sprintf( temp, "\n%s%s%s%s%s", "scene ' ", GetName(), " ': delayIn + delayOut values are greater than duration of animation ' ", m_animationClips[id]->GetName(), " '" );
		PrintInfo( temp, COLOR_RED );
		return CFalse;
	}

	if( m_animationClips[id]->GetAnimationStatus() == eANIM_EXECUTE_ACTION && m_animationClips[id]->GetReverse() )
	{
		m_animationClips[id]->SetReverse(CFalse);
		return CTrue;
	}
	if( m_animationClips[id]->GetAnimationStatus() == eANIM_BLEND_CYCLE || m_animationClips[id]->GetAnimationStatus() == eANIM_CLEAR_CYCLE || m_animationClips[id]->GetAnimationStatus() == eANIM_EXECUTE_ACTION)
		return CFalse;

	m_executeActionList.push_back( m_animationClips[id]->GetName() );

	m_animationClips[id]->SetTargetDelayIn( delayIn );
	m_animationClips[id]->SetTargetDelayOut( delayOut );
	m_animationClips[id]->SetCurrentDelayInTime( 0.0f );
	m_animationClips[id]->SetCurrentDelayOutTime( 0.0f );
	m_animationClips[id]->SetCurrentTime( m_animationClips[id]->GetStart() );
	m_animationClips[id]->SetTargetWeight( weight );
	m_animationClips[id]->SetStartWeight( 0.0f );
	m_animationClips[id]->SetAnimationStatus( eANIM_EXECUTE_ACTION );
	m_animationClips[id]->SetLock( LockToLastFrame );
	m_animationClips[id]->SetReverse(CFalse);
	m_updateAnimationLists = CTrue;
	return CTrue;
}
Beispiel #12
0
	void AnalyzeCommand(const udtCuCommandMessage& command, s32 serverTimeMs)
	{
		if(!command.IsConfigString)
		{
			return;
		}

		const s32 clientNumber = command.ConfigStringIndex - _protocolFirstPlayerCsIdx;
		if(clientNumber < 0 || clientNumber >= ID_MAX_CLIENTS)
		{
			// Not a player config string.
			return;
		}

		// Config string update commands always have 3 tokens:
		// 1. "cs"
		// 2. The index of the config string to update.
		// 3. The actual content, in quotes.
		if(command.TokenCount != 3)
		{
			// Not a proper config string command.
			return;
		}

		std::string serverTime;
		FormatServerTime(serverTime, serverTimeMs);

		const std::string configString = command.CommandTokens[2];
		std::string playerName;
		Player& player = _players[clientNumber];
		if(configString.empty() || !ExtractPlayerName(playerName, configString, _protocol))
		{
			PrintInfo("%s Player %s left (client %u)", serverTime.c_str(), player.Name.c_str(), (u32)clientNumber);
			player.Name = "";
			player.Valid = false;
			return;
		}
		
		const bool wasValid = player.Valid;
		player.Valid = true;
		if(!wasValid)
		{
			PrintInfo("%s Player %s joined (client %u)", serverTime.c_str(), playerName.c_str(), (u32)clientNumber);
			player.Name = playerName;
		}
		else if(playerName != player.Name)
		{
			PrintInfo("%s Player %s renamed to %s (client %u)", serverTime.c_str(), player.Name.c_str(), playerName.c_str(), (u32)clientNumber);
			player.Name = playerName;
		}
	}
Beispiel #13
0
void PrintProfileInformation(cmsHPROFILE hInput)
{
    PrintInfo(hInput, cmsInfoDescription);
    PrintInfo(hInput, cmsInfoManufacturer);
    PrintInfo(hInput, cmsInfoModel);       
    PrintInfo(hInput, cmsInfoCopyright);   

    if (Verbose > 2) {
        
        PrintColorantTable(hInput, cmsSigColorantTableTag,    "Input colorant table");
        PrintColorantTable(hInput, cmsSigColorantTableOutTag, "Input colorant out table");      
    }

    printf("\n");
}
Beispiel #14
0
extern "C" NTSTATUS DriverEntry (
			IN PDRIVER_OBJECT pDriverObject,
			IN PUNICODE_STRING pRegistryPath	) 
{
	NTSTATUS status = STATUS_SUCCESS;
	KdPrint(("Enter DriverEntry\n"));

	//注册其他驱动调用函数入口
	pDriverObject->DriverUnload = HelloDDKUnload;
	pDriverObject->MajorFunction[IRP_MJ_CREATE] = HelloDDKDispatchRoutine;
	pDriverObject->MajorFunction[IRP_MJ_CLOSE] = HelloDDKDispatchRoutine;
	pDriverObject->MajorFunction[IRP_MJ_WRITE] = HelloDDKDispatchRoutine;
	pDriverObject->MajorFunction[IRP_MJ_READ] = HelloDDKDispatchRoutine;
	
	//创建驱动设备对象
	status = CreateDevice(pDriverObject);

	UNICODE_STRING devName;
	RtlInitUnicodeString(&devName,L"\\Device\\MyDDKDevice");//浅拷贝
	UNICODE_STRING tTestUnicode;
	RtlInitUnicodeString(&tTestUnicode,devName.Buffer);

	PrintInfo(pDriverObject);
	KdPrint(("DriverEntry end\n"));

	TestList();
	TestLookaside();
	return status;
}
Beispiel #15
0
void
LayerManager::LogSelf(const char* aPrefix)
{
  nsCAutoString str;
  PrintInfo(str, aPrefix);
  MOZ_LAYERS_LOG(("%s", str.get()));
}
Beispiel #16
0
void
LayerManager::DumpSelf(FILE* aFile, const char* aPrefix)
{
  nsCAutoString str;
  PrintInfo(str, aPrefix);
  fprintf(FILEOrDefault(aFile), "%s\n", str.get());
}
Beispiel #17
0
void
Messenger::StartAcquisition()
{
  fPID = fork();
  std::ostringstream os; int ret;

  try {
    switch (fPID) {
      case -1:
        throw Exception(__PRETTY_FUNCTION__, "Failed to fork the current process!", JustWarning);
      case 0:
        PrintInfo("Launching the daughter acquisition process");
        ret = execl("ppsFetch", "", (char*)NULL);
        os.str("");
        os << "Failed to launch the daughter process!" << "\n\t"
           << "Return value: " << ret << "\n\t"
           << "Errno: " << errno;
        throw Exception(__PRETTY_FUNCTION__, os.str(), JustWarning);
      default:
        break;
    }
    SendAll(DAQ, SocketMessage(ACQUISITION_STARTED));
    
    // Send the run number to DQMonitors
    int last_run = -1;
    try { last_run = OnlineDBHandler().GetLastRun(); } catch (Exception& e) { last_run = -1; }
    try { SendAll(DQM, SocketMessage(RUN_NUMBER, last_run)); } catch (Exception& e) { e.Dump(); }

    throw Exception(__PRETTY_FUNCTION__, "Acquisition started!", Info, 30000);
  } catch (Exception& e) { e.Dump(); }
}
Beispiel #18
0
void energy_calcul (double *px_coo, double *energy, int number_at )
{

	// m_coo -- coordinates of atoms after minimization
	double *pm_coo = NULL;
	
	pm_coo = (double*) malloc(number_at * 3 * sizeof(double)); 
	// fortrancodeenergyminimisation_ -- fortran function to run energy calculation, minimization calculations or MD. 
	
	PrintInfo(("\n\n Starting energy minimization: "));

	fortrancodeenergyminimisation_(px_coo, parmet->px,parmet->pix,parmet->pih,parmet->pipairs,parmet->pr_stack, parmet->pi_stack, 
		energy, pm_coo, &number_at);
	
	PrintInfo(("\n\n Finished minimization: "));
} 
Beispiel #19
0
static bool
RunCommand(CAI302Device &device, const char *command,
           OperationEnvironment &env)
{
  if (strcmp(command, "info") == 0)
    return PrintInfo(device, env);
  else if (strcmp(command, "reboot") == 0)
    return device.Reboot(env);
  else if (strcmp(command, "poweroff") == 0)
    return device.PowerOff(env);
  else if (strcmp(command, "startlogger") == 0)
    return device.StartLogging(env);
  else if (strcmp(command, "stoplogger") == 0)
    return device.StopLogging(env);
  else if (strcmp(command, "clearlog") == 0)
    return device.ClearLog(env);
  else if (strcmp(command, "pilots") == 0)
    return ListPilots(device, env);
  else if (strcmp(command, "navpoints") == 0)
    return ListNavpoints(device, env);
  else {
    fprintf(stderr, "Unknown command: %s\n", command);
    return false;
  }
}
Beispiel #20
0
/**
 * @brief  main 
 *
 * @param  argc
 * @param  argv[]
 *
 * @return  
 */
int main ( int argc, char *argv[] ) { 
	char board[N][N] = { {0,0} };
//	int *player = &Player;
	int x = 0, y =0;
	int flag = 2;
	status s = -1;
	CreateBoard(board);
	while ( true ) {
		PrintBoard(board, x, y);
		PrintInfo(flag, Player);
		if ( s == WIN ) {
			printf ( "\033[33mSome one win!\n\033[0m" );
			break;
		}
		s = PlayChess(board, Player, &x, &y);
		if ( s == -1 ) continue;
		if ( s == RES ) {
			printf ( "Someone rescinded!\n" );
		}
		if ( s == QUIT ) {
			printf ( "Gave Over\n" );
			break;
		}
		s =  CheckBoard(board, Player, &x,&y);
		Player = ( Player + 1 ) % 2;

	}
	return EXIT_SUCCESS;
}				/* ----------  end of function main  ---------- */
Beispiel #21
0
OBJEKT AMBER_loadPrep(char *file_prep)
{
	DICTIONARY      dUnits;
	DICTLOOP        dlLoop ;
	UNIT            uUnit = NULL;
	STRING          sName;
	LOOP            lResidues;
	RESIDUE         rRes;
	
	/* Read an AMBER PREP file into a dictionary.*/
	dUnits = dAmberReadPrepFile(file_prep);
	if ( dUnits != NULL )
	{
		dlLoop = ydlDictionaryLoop( dUnits );
		uUnit=(UNIT)yPDictionaryNext( dUnits, &dlLoop );
		strcpy( sName, sContainerName((CONTAINER) uUnit) );
		PrintInfo(( "Loaded UNIT: %s", sName ));
		/* Set the name for the UNIT */
		ContainerSetName( (CONTAINER) uUnit, sName );
		/* Set the name for the only residue in the unit */
		lResidues = lLoop( (OBJEKT)uUnit, RESIDUES );
		rRes = (RESIDUE)oNext(&lResidues);
		ContainerSetName( (CONTAINER) rRes, sName );    
		VariableSet( sName, (OBJEKT) uUnit );       /* adds 1 REF */
		return((OBJEKT)uUnit);
	}
	if (uUnit == NULL)
	PrintError( ("-- no UNIT  loaded \n"));
	return(NULL);
}
Beispiel #22
0
CVoid CScene::SetPrevAnimation() 
{
	if (g_selectedName != -1)
	{
		m_currentClipIndex--;
		if (m_currentClipIndex == 0)
			ex_pBtnPrevAnim->EnableWindow(FALSE);
		if (m_numClips > 1)
			ex_pBtnNextAnim->EnableWindow(TRUE);

		if (m_currentClipIndex < 0)
			m_currentClipIndex = 0;

		for (CInt index = 0; index < m_numClips; index++)
		{
			if (m_currentClipIndex != index)
			{
				ClearCycle(index, 1.0f); //0.5 second
			}
			else
			{
				BlendCycle(index, 1.0f, 1.0f);
			}
		}

		PrintInfo("\nAnimation '" + (CString)m_animationClips[m_currentClipIndex]->GetName() + "' activated");
	}
}
Beispiel #23
0
void
Layer::DumpSelf(FILE* aFile, const char* aPrefix)
{
  nsAutoCString str;
  PrintInfo(str, aPrefix);
  fprintf_stderr(aFile, "%s\n", str.get());
}
Beispiel #24
0
void TestFull()
{
	int i, x, y, ty;
	int count = 0;
	static int arScoreInfo[] = { 0, 1, 3, 8, 20 };

	for (i = 0; i < 4; i++)
	{
		board[nx + Shape[brick][rot][i].x][ny + Shape[brick][rot][i].y] = BRICK; // 벽돌의 위치 기록
	}

	for (y = 1; y < BH + 1; y++)
	{
		for (x = 1; x < BW + 1; x++)
		{
			if (board[x][y] != BRICK) break; // 벽돌이 없는칸이 있으면 루프를 빠져나온다.
		}
		if (x == BW + 1) // 벽돌로 꽉 차있다.
		{
			count++;
			for (ty = y; ty>1; ty--)
			{
				for (x = 1; x < BW + 1; x++)
				{
					board[x][ty] = board[x][ty - 1]; // 보드 배열에서 제거될 벽돌의 정보를 삭제
				}
			}
			DrawBoard();
			delay(200);
			Score = Score + arScoreInfo[count];
			PrintInfo();
		}
	}
}
Beispiel #25
0
int mem_check_integrity( int block_number )
{
	int i, ErrorCount;
	ubyte * CheckData;

	CheckData = (ubyte *)((char *)MallocBase[block_number] + MallocSize[block_number]);

	ErrorCount = 0;
			
	for (i=0; i<CHECKSIZE; i++ )
		if (CheckData[i] != CHECKBYTE ) {
			ErrorCount++;
			con_printf(CON_CRITICAL, "OA: %p ", &CheckData[i] );
		}

	if (ErrorCount &&  (!out_of_memory))	{
		con_printf(CON_CRITICAL, "\nMEM_OVERWRITE: Memory after the end of allocated block overwritten.\n" );
		PrintInfo( block_number );
		con_printf(CON_CRITICAL, "\t%d/%d check bytes were overwritten.\n", ErrorCount, CHECKSIZE );
		Int3();
	}

	return ErrorCount;

}
Beispiel #26
0
/**
 * Set file position
 *
 * @v This			File handle
 * @v Position		New file position
 * @ret Status		EFI status code
 */
static EFI_STATUS EFIAPI
FileSetPosition(EFI_FILE_HANDLE This, UINT64 Position)
{
	EFI_GRUB_FILE *File = _CR(This, EFI_GRUB_FILE, EfiFile);
	UINT64 FileSize;

	PrintInfo(L"SetPosition(%llx|'%s', %lld) %s\n", (UINT64) This,
		FileName(File), Position, (File->IsDir)?L"<DIR>":L"");

	/* If this is a directory, reset the Index to the start */
	if (File->IsDir) {
		if (Position != 0)
			return EFI_INVALID_PARAMETER;
		File->DirIndex = 0;
		return EFI_SUCCESS;
	}

	/* Fail if we attempt to seek past the end of the file (since
	 * we do not support writes).
	 */
	FileSize = GrubGetFileSize(File);
	if (Position > FileSize) {
		PrintError(L"'%s': Cannot seek to %#llx of %llx\n",
				FileName(File), Position, FileSize);
		return EFI_UNSUPPORTED;
	}

	/* Set position */
	GrubSetFileOffset(File, Position);
	PrintDebug(L"'%s': Position set to %llx\n",
			FileName(File), Position);

	return EFI_SUCCESS;
}
void SocketClient::Connect()
{
    int res = 0;

    res = connect(ConnectSocket, ptr->ai_addr, ptr->ai_addrlen);

    if (res == SOCKET_ERROR)
    {
        closesocket(ConnectSocket);
        ConnectSocket = INVALID_SOCKET;
    }

    freeaddrinfo(result);

    if (ConnectSocket == INVALID_SOCKET)
    {
        PrintInfo("Cannot connect to server.");
        //WSACleanup();

        return;
    }

    StopSocket = false;

    StartReceiveData();
}
Beispiel #28
0
  void DisparityPlugin::DrawIplImage(cv::Mat *image)
  {
    // TODO(malban): glTexture2D may be more efficient than glDrawPixels

    if (!has_image_)
      return;

    if (image == NULL)
      return;

    if (image->cols == 0 || image->rows == 0)
      return;

    GLenum format;
    switch (image->channels())
    {
      case 1:
        format = GL_LUMINANCE;
        break;
      case 2:
        format = GL_LUMINANCE_ALPHA;
        break;
      case 3:
        format = GL_BGR;
        break;
      default:
        return;
    }

    glPixelZoom(1.0, -1.0);
    glDrawPixels(image->cols, image->rows, format, GL_UNSIGNED_BYTE, image->ptr());

    PrintInfo("OK");
  }
Beispiel #29
0
/**
 * Flush file modified data
 *
 * @v This			File handle
 * @v Type			Type of information
 * @v Len			Buffer size
 * @v Data			Buffer
 * @ret Status		EFI status code
 */
static EFI_STATUS EFIAPI
FileFlush(EFI_FILE_HANDLE This)
{
	EFI_GRUB_FILE *File = _CR(This, EFI_GRUB_FILE, EfiFile);

	PrintInfo(L"Flush(%llx|'%s')\n", (UINT64)This, FileName(File));
	return EFI_SUCCESS;
}
Beispiel #30
0
/**********************************************************************
* 功能描述:主函数
* 输入参数:无
* 输出参数:无
* 返 回 值:无
* 其它说明:无
* 修改日期        版本号     修改人            修改内容
* -------------------------------------------------------------------
* 20151008       V1.0     Zhou Zhaoxiong      创建
***********************************************************************/
INT32 main()
{

    // 在屏幕上输出消息
    PrintInfo();   

    return 0;
}