compilation: hopefully the program should be compilable on VC now

This commit is contained in:
Daniel Marjamäki 2008-09-10 18:15:33 +00:00
parent d942092ac0
commit ffb6e1dc6e
3 changed files with 42 additions and 32 deletions

View File

@ -5,7 +5,7 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <list> #include <list>
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
extern bool CheckCodingStyle; extern bool CheckCodingStyle;
@ -48,10 +48,10 @@ bool SameFileName( const char fname1[], const char fname2[] )
#ifdef __linux__ #ifdef __linux__
return bool( strcmp(fname1, fname2) == 0 ); return bool( strcmp(fname1, fname2) == 0 );
#endif #endif
#ifdef __BORLANDC__ #ifdef __GNUC__
return bool( stricmp(fname1, fname2) == 0 );
#else
return bool( strcasecmp(fname1, fname2) == 0 ); return bool( strcasecmp(fname1, fname2) == 0 );
#else
return bool( stricmp(fname1, fname2) == 0 );
#endif #endif
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@ -37,6 +37,16 @@ namespace std
} }
#endif #endif
#ifdef __GNUC__
#include <float.h>
namespace std
{
bool isinf(double x) {
return bool(x == DBL_MAX);
}
}
#endif
TestsListener& TestsListener::theInstance() TestsListener& TestsListener::theInstance()
{ {
static TestsListener instancia; static TestsListener instancia;

View File

@ -29,15 +29,15 @@
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <cstring> #include <cstring>
#ifdef __BORLANDC__ #ifdef __GNUC__
#include <dir.h>
#else
#include <glob.h> #include <glob.h>
#include <unistd.h> #include <unistd.h>
#else
#include <dir.h>
#endif #endif
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -51,16 +51,7 @@ static void CppCheck(const char FileName[], unsigned int FileId);
static void AddFiles( std::vector<std::string> &filenames, const char path[], const char pattern[] ) static void AddFiles( std::vector<std::string> &filenames, const char path[], const char pattern[] )
{ {
#ifdef __BORLANDC__ #ifdef __GNUC__
struct ffblk f;
for ( int done = findfirst(pattern, &f, 0); ! done; done = findnext(&f) )
{
std::ostringstream fname;
fname << path << f.ff_name;
filenames.push_back( fname.str() );
}
findclose(&f);
#else
glob_t glob_results; glob_t glob_results;
glob(pattern, 0, 0, &glob_results); glob(pattern, 0, 0, &glob_results);
for ( unsigned int i = 0; i < glob_results.gl_pathc; i++ ) for ( unsigned int i = 0; i < glob_results.gl_pathc; i++ )
@ -70,6 +61,15 @@ static void AddFiles( std::vector<std::string> &filenames, const char path[], co
filenames.push_back( fname.str() ); filenames.push_back( fname.str() );
} }
globfree(&glob_results); globfree(&glob_results);
#else
struct ffblk f;
for ( int done = findfirst(pattern, &f, 0); ! done; done = findnext(&f) )
{
std::ostringstream fname;
fname << path << f.ff_name;
filenames.push_back( fname.str() );
}
findclose(&f);
#endif #endif
} }
@ -79,20 +79,7 @@ static void RecursiveAddFiles( std::vector<std::string> &filenames, const char p
AddFiles( filenames, path, "*.cc" ); AddFiles( filenames, path, "*.cc" );
AddFiles( filenames, path, "*.c" ); AddFiles( filenames, path, "*.c" );
#ifdef __BORLANDC__ #ifdef __GNUC__
struct ffblk f ;
for ( int done = findfirst("*", &f, FA_DIREC); ! done; done = findnext(&f) )
{
if ( f.ff_attrib != FA_DIREC || f.ff_name[0] == '.' )
continue;
chdir( f.ff_name );
std::ostringstream curdir;
curdir << path << f.ff_name << "/";
RecursiveAddFiles( filenames, curdir.str().c_str() );
chdir( ".." );
}
findclose(&f);
#else
// gcc / cygwin.. // gcc / cygwin..
glob_t glob_results; glob_t glob_results;
glob("*", GLOB_MARK, 0, &glob_results); glob("*", GLOB_MARK, 0, &glob_results);
@ -112,6 +99,19 @@ static void RecursiveAddFiles( std::vector<std::string> &filenames, const char p
chdir( ".." ); chdir( ".." );
} }
globfree(&glob_results); globfree(&glob_results);
#else
struct ffblk f ;
for ( int done = findfirst("*", &f, FA_DIREC); ! done; done = findnext(&f) )
{
if ( f.ff_attrib != FA_DIREC || f.ff_name[0] == '.' )
continue;
chdir( f.ff_name );
std::ostringstream curdir;
curdir << path << f.ff_name << "/";
RecursiveAddFiles( filenames, curdir.str().c_str() );
chdir( ".." );
}
findclose(&f);
#endif #endif
} }