コード例 #1
0
ファイル: util.cpp プロジェクト: Azpidatziak/Aegisub
bool compare(const std::string &file1, const std::string &file2) {
	std::stringstream ss1, ss2;
	std::ifstream if1(file1.c_str(), std::ios::binary), if2(file2.c_str(), std::ios::binary);
	ss1 << if1.rdbuf();
	ss2 << if2.rdbuf();
	return ss1.str() == ss2.str();
}
コード例 #2
0
ファイル: conditionals.c プロジェクト: EiNSTeiN-/decompiler
int main(int argc, char *argv[])
{
    if0();
    if1();
    if2();
    if3();
    if4();
    if5();
}
コード例 #3
0
ファイル: Test.cpp プロジェクト: byNull/OpenCLProject
bool compareFileData(std::string fName1, std::string fName2)
{
	bool          bEquel = true;
	int           data1 = -1, data2 = -1;
	std::ifstream if1(fName1.c_str());
	std::ifstream if2(fName1.c_str());
	if(!if1.is_open() || !if1.is_open()){
		printf("Can't open file or file is not existed!\n");
		return bEquel;
	}

	while(!if1.eof() && !if2.eof() && (bEquel == true)){
		if1>>data1;
		if2>>data2;
		if(data1 != data2){
			bEquel = false;
		}
	}
	return bEquel;
}
コード例 #4
0
ファイル: 5_3_1.cpp プロジェクト: xuzhezhaozhao/SeedCup2012
//检测无效的if分支
void ifErr()
{
	if1();
	if2();
	if3();
}
コード例 #5
0
ファイル: main.c プロジェクト: selavy/anothersim
int main( int argc, char ** argv )
{
  FILE * pFile;
  int i, do_continue;
  char in_file[MAX_STR+1], out_file[MAX_STR+1], line[MAX_STR+1];

  do_continue = i = 0;
  pFile = NULL;

do
  {
  printf("Input file? "); fgets( in_file, MAX_STR, stdin );
  printf("Output file? "); fgets( out_file, MAX_STR, stdin );
  sscanf( in_file, "%s\n", in_file );
  sscanf( out_file, "%s\n", out_file );

  pFile = fopen( in_file, "r" );
  if( pFile == NULL ) return 1;

  fout = fopen( out_file, "w" );
  if( fout == NULL ) return 2;
  
  if( init( pFile ) ) goto unable_to_parse;

  do 
    {
      fprintf( fout, "c#%d ", cycle );
      wb(); mem3(); mem2(); mem1(); ex(); id(); if2(); if1(); /* pretend all stages are happening simultaneously */
      fprintf( fout, "\n");
      /* move everything down the pipeline */
      if( !MEM3_stall ) { WB = MEM3; WB_count = MEM3_count; }
      if( !MEM2_stall ) { MEM3 = MEM2; MEM3_count = MEM2_count; }
      if( !MEM1_stall ) { MEM2 = MEM1; MEM2_count = MEM1_count; }
      if( !EX_stall   ) { MEM1 = EX; MEM1_count = EX_count; }
      if( !ID_stall   ) { EX = ID; EX_count = ID_count; } else MEM1 = EMPTY;
      if( !IF2_stall  ) { ID = IF2; ID_count = IF2_count; }
      if( !IF1_stall  ) { IF2 = IF1; IF2_count = IF1_count; ++inst_cycle; }
      if( flush ) { IF1 = EMPTY; IF2 = EMPTY; ID = EMPTY; EX = EMPTY; flush = FALSE; --inst_cycle; }
      ++cycle;
      Registers[0] = 0; /* reset R0 if it was accidently set */
    } while( ( (IF1 != EMPTY) || (IF2 != EMPTY) || (ID != EMPTY) || (EX != EMPTY) || (MEM1 != EMPTY) || (MEM2 != EMPTY) || (MEM3 != EMPTY) || (WB != EMPTY) ) );

  /* print end status */
  print_regs( fout ); print_mem( fout );

  unable_to_parse:
  for( i = 0; i < instcount; ++i )
    free( Instructions[i] );
  fclose( pFile );
  fclose( fout );

  printf("would you like to run again? ");
  fgets( line, MAX_STR, stdin );
  do_continue = ( line[0] == 'y' || line[0] == 'Y' ) ? 1 : 0;
  } while( do_continue );

 goto end;
 for( i = 0; i < instcount; ++i )
   free( Instructions[i] );
 fclose( pFile );
 fclose( fout );
 end:
 return 0;
}