MINGW patch from Benoît Laniel
This commit is contained in:
+2
-1
@@ -34,6 +34,7 @@ AC_PROG_MAKE_SET
|
|||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_CPP
|
AC_PROG_CPP
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
|
AC_PROG_CXXCPP
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
@@ -301,7 +302,7 @@ case "${host}" in
|
|||||||
dnl CygWin under Windoze.
|
dnl CygWin under Windoze.
|
||||||
INCLUDES="$INCLUDES -I/usr/local/include/"
|
INCLUDES="$INCLUDES -I/usr/local/include/"
|
||||||
LIBS="$LIBS -L/usr/local/lib"
|
LIBS="$LIBS -L/usr/local/lib"
|
||||||
AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal ] )
|
AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal 'openal -ldsound -lwinmm' ] )
|
||||||
AC_SEARCH_LIBS(alutInit, [ openal32 ALut alut ] )
|
AC_SEARCH_LIBS(alutInit, [ openal32 ALut alut ] )
|
||||||
LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
|
LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
|
||||||
openal_LIBS="$LIBS"
|
openal_LIBS="$LIBS"
|
||||||
|
|||||||
@@ -1958,6 +1958,10 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\simgear\compiler.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\simgear\simgear_config.h-msvc90"
|
RelativePath="..\..\simgear\simgear_config.h-msvc90"
|
||||||
>
|
>
|
||||||
|
|||||||
+1
-7
@@ -1,9 +1,3 @@
|
|||||||
if HAVE_THREADS
|
|
||||||
SGTHREAD_DIR = threads
|
|
||||||
else
|
|
||||||
SGTHREAD_DIR =
|
|
||||||
endif
|
|
||||||
|
|
||||||
# METAR_DIRS =
|
# METAR_DIRS =
|
||||||
METAR_DIRS = environment
|
METAR_DIRS = environment
|
||||||
|
|
||||||
@@ -31,7 +25,7 @@ SUBDIRS = \
|
|||||||
screen \
|
screen \
|
||||||
serial \
|
serial \
|
||||||
sound \
|
sound \
|
||||||
$(SGTHREAD_DIR) \
|
threads \
|
||||||
timing
|
timing
|
||||||
|
|
||||||
DIST_SUBDIRS = $(SUBDIRS) compatibility
|
DIST_SUBDIRS = $(SUBDIRS) compatibility
|
||||||
|
|||||||
+3
-4
@@ -63,6 +63,9 @@
|
|||||||
# if _MSC_VER >= 1200 // msvc++ 6.0 or greater
|
# if _MSC_VER >= 1200 // msvc++ 6.0 or greater
|
||||||
# define isnan _isnan
|
# define isnan _isnan
|
||||||
# define snprintf _snprintf
|
# define snprintf _snprintf
|
||||||
|
# if _MSC_VER < 1500
|
||||||
|
# define vsnprintf _vsnprintf
|
||||||
|
# endif
|
||||||
# define copysign _copysign
|
# define copysign _copysign
|
||||||
|
|
||||||
# pragma warning(disable: 4786) // identifier was truncated to '255' characters
|
# pragma warning(disable: 4786) // identifier was truncated to '255' characters
|
||||||
@@ -158,10 +161,6 @@ inline int (isnan)(double r) { return !(r <= 0 || r >= 0); }
|
|||||||
# include <ieeefp.h> // isnan
|
# include <ieeefp.h> // isnan
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__MINGW32__)
|
|
||||||
# define isnan(x) _isnan(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// No user modifiable definitions beyond here.
|
// No user modifiable definitions beyond here.
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
logstream *logstream::global_logstream = 0;
|
logstream *logstream::global_logstream = 0;
|
||||||
|
|
||||||
bool logbuf::logging_enabled = true;
|
bool logbuf::logging_enabled = true;
|
||||||
#ifdef _MSC_VER
|
#ifdef _WIN32
|
||||||
bool logbuf::has_console = true;
|
bool logbuf::has_console = true;
|
||||||
#endif
|
#endif
|
||||||
sgDebugClass logbuf::logClass = SG_NONE;
|
sgDebugClass logbuf::logClass = SG_NONE;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _WIN32
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void set_sb( std::streambuf* sb );
|
void set_sb( std::streambuf* sb );
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _WIN32
|
||||||
static void has_no_console() { has_console = false; }
|
static void has_no_console() { has_console = false; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ private:
|
|||||||
static std::streambuf* sbuf;
|
static std::streambuf* sbuf;
|
||||||
|
|
||||||
static bool logging_enabled;
|
static bool logging_enabled;
|
||||||
#ifdef _MSC_VER
|
#ifdef _WIN32
|
||||||
static bool has_console;
|
static bool has_console;
|
||||||
#endif
|
#endif
|
||||||
static sgDebugClass logClass;
|
static sgDebugClass logClass;
|
||||||
@@ -176,7 +176,7 @@ logbuf::would_log( sgDebugClass c, sgDebugPriority p ) const
|
|||||||
inline logbuf::int_type
|
inline logbuf::int_type
|
||||||
logbuf::overflow( int c )
|
logbuf::overflow( int c )
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef _WIN32
|
||||||
if ( logging_enabled ) {
|
if ( logging_enabled ) {
|
||||||
if ( !has_console ) {
|
if ( !has_console ) {
|
||||||
AllocConsole();
|
AllocConsole();
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ void SGMetar::useCurrentDate()
|
|||||||
{
|
{
|
||||||
struct tm now;
|
struct tm now;
|
||||||
time_t now_sec = time(0);
|
time_t now_sec = time(0);
|
||||||
#if defined( _MSC_VER ) || defined ( __MINGW32__ )
|
#ifdef _WIN32
|
||||||
now = *gmtime(&now_sec);
|
now = *gmtime(&now_sec);
|
||||||
#else
|
#else
|
||||||
gmtime_r(&now_sec, &now);
|
gmtime_r(&now_sec, &now);
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ socktest_LDADD = \
|
|||||||
$(top_builddir)/simgear/debug/libsgdebug.a \
|
$(top_builddir)/simgear/debug/libsgdebug.a \
|
||||||
$(top_builddir)/simgear/bucket/libsgbucket.a \
|
$(top_builddir)/simgear/bucket/libsgbucket.a \
|
||||||
$(top_builddir)/simgear/misc/libsgmisc.a \
|
$(top_builddir)/simgear/misc/libsgmisc.a \
|
||||||
$(socktest_PLIB_LIBS) -lz
|
$(socktest_PLIB_LIBS) -lz \
|
||||||
$(network_LIBS) \
|
$(network_LIBS) \
|
||||||
$(base_LIBS)
|
$(base_LIBS)
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
#ifdef _WIN32
|
||||||
# include <io.h>
|
# include <io.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ bool SGFile::open( const SGProtocolDir d ) {
|
|||||||
set_dir( d );
|
set_dir( d );
|
||||||
|
|
||||||
if ( get_dir() == SG_IO_OUT ) {
|
if ( get_dir() == SG_IO_OUT ) {
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
#ifdef _WIN32
|
||||||
int mode = 00666;
|
int mode = 00666;
|
||||||
#else
|
#else
|
||||||
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
|
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
|
||||||
|
|||||||
@@ -4,7 +4,12 @@
|
|||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#define sleep(x) Sleep(x*1000)
|
||||||
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "sg_socket.hxx"
|
#include "sg_socket.hxx"
|
||||||
@@ -44,10 +49,6 @@ int main() {
|
|||||||
if ( s.readline( buf, 256 ) > 0 ) {
|
if ( s.readline( buf, 256 ) > 0 ) {
|
||||||
cout << "result = " << buf;
|
cout << "result = " << buf;
|
||||||
}
|
}
|
||||||
#ifdef __MINGW32__
|
|
||||||
Sleep(100);
|
|
||||||
#else
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,6 @@
|
|||||||
#ifndef SGVec2_H
|
#ifndef SGVec2_H
|
||||||
#define SGVec2_H
|
#define SGVec2_H
|
||||||
|
|
||||||
#if defined ( __CYGWIN__ )
|
|
||||||
#include <ieeefp.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||||
#include <osg/Vec2f>
|
#include <osg/Vec2f>
|
||||||
#include <osg/Vec2d>
|
#include <osg/Vec2d>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#if defined( _MSC_VER) || defined(__MINGW32__)
|
#ifdef _WIN32
|
||||||
# include <direct.h>
|
# include <direct.h>
|
||||||
#endif
|
#endif
|
||||||
#include "sg_path.hxx"
|
#include "sg_path.hxx"
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
static const char sgDirPathSep = '/';
|
static const char sgDirPathSep = '/';
|
||||||
static const char sgDirPathSepBad = '\\';
|
static const char sgDirPathSepBad = '\\';
|
||||||
|
|
||||||
#if defined( WIN32 ) && !defined(__CYGWIN__)
|
#ifdef _WIN32
|
||||||
static const char sgSearchPathSep = ';';
|
static const char sgSearchPathSep = ';';
|
||||||
#else
|
#else
|
||||||
static const char sgSearchPathSep = ':';
|
static const char sgSearchPathSep = ':';
|
||||||
@@ -181,7 +181,7 @@ bool SGPath::exists() const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( _MSC_VER) || defined(__MINGW32__)
|
#ifdef _WIN32
|
||||||
# define sgMkDir(d,m) _mkdir(d)
|
# define sgMkDir(d,m) _mkdir(d)
|
||||||
#else
|
#else
|
||||||
# define sgMkDir(d,m) mkdir(d,m)
|
# define sgMkDir(d,m) mkdir(d,m)
|
||||||
@@ -199,7 +199,7 @@ int SGPath::create_dir( mode_t mode ) {
|
|||||||
unsigned int i = 1;
|
unsigned int i = 1;
|
||||||
SGPath dir = absolute ? string( 1, sgDirPathSep ) : "";
|
SGPath dir = absolute ? string( 1, sgDirPathSep ) : "";
|
||||||
dir.concat( path_elements[0] );
|
dir.concat( path_elements[0] );
|
||||||
#if defined( _MSC_VER) || defined(__MINGW32__)
|
#ifdef _WIN32
|
||||||
if ( dir.str().find(':') != string::npos && path_elements.size() >= 2 ) {
|
if ( dir.str().find(':') != string::npos && path_elements.size() >= 2 ) {
|
||||||
dir.append( path_elements[1] );
|
dir.append( path_elements[1] );
|
||||||
i = 2;
|
i = 2;
|
||||||
|
|||||||
@@ -20,10 +20,6 @@ void printOpDEBUG(int ip, int op);
|
|||||||
void printStackDEBUG(naContext ctx);
|
void printStackDEBUG(naContext ctx);
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#define vsnprintf _vsnprintf
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct Globals* globals = 0;
|
struct Globals* globals = 0;
|
||||||
|
|
||||||
static naRef bindFunction(naContext ctx, struct Frame* f, naRef code);
|
static naRef bindFunction(naContext ctx, struct Frame* f, naRef code);
|
||||||
|
|||||||
@@ -195,14 +195,16 @@ static naRef f_readln(naContext ctx, naRef me, int argc, naRef* args)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define S_ISLNK(m) 0
|
||||||
|
#define S_ISSOCK(m) 0
|
||||||
|
#endif
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define S_ISREG(m) (((m)&_S_IFMT)==_S_IFREG)
|
#define S_ISREG(m) (((m)&_S_IFMT)==_S_IFREG)
|
||||||
#define S_ISDIR(m) (((m)&_S_IFMT)==_S_IFDIR)
|
#define S_ISDIR(m) (((m)&_S_IFMT)==_S_IFDIR)
|
||||||
#define S_ISCHR(m) (((m)&_S_IFMT)==_S_IFCHR)
|
#define S_ISCHR(m) (((m)&_S_IFMT)==_S_IFCHR)
|
||||||
#define S_ISFIFO(m) (((m)&_S_IFMT)==_S_IFIFO)
|
#define S_ISFIFO(m) (((m)&_S_IFMT)==_S_IFIFO)
|
||||||
#define S_ISBLK(m) 0
|
#define S_ISBLK(m) 0
|
||||||
#define S_ISLNK(m) 0
|
|
||||||
#define S_ISSOCK(m) 0
|
|
||||||
typedef unsigned short mode_t;
|
typedef unsigned short mode_t;
|
||||||
#endif
|
#endif
|
||||||
static naRef ftype(naContext ctx, mode_t m)
|
static naRef ftype(naContext ctx, mode_t m)
|
||||||
|
|||||||
@@ -25,10 +25,6 @@
|
|||||||
# include <simgear_config.h>
|
# include <simgear_config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined ( __CYGWIN__ )
|
|
||||||
#include <ieeefp.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
#include <simgear/constants.h>
|
#include <simgear/constants.h>
|
||||||
#include <simgear/structure/exception.hxx>
|
#include <simgear/structure/exception.hxx>
|
||||||
|
|||||||
@@ -75,10 +75,6 @@ using namespace osg;
|
|||||||
// # endif
|
// # endif
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
#if defined (__CYGWIN__)
|
|
||||||
#include <ieeefp.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static osg::ref_ptr<osg::StateSet> layer_states[SGCloudLayer::SG_MAX_CLOUD_COVERAGES];
|
static osg::ref_ptr<osg::StateSet> layer_states[SGCloudLayer::SG_MAX_CLOUD_COVERAGES];
|
||||||
static osg::ref_ptr<osg::StateSet> layer_states2[SGCloudLayer::SG_MAX_CLOUD_COVERAGES];
|
static osg::ref_ptr<osg::StateSet> layer_states2[SGCloudLayer::SG_MAX_CLOUD_COVERAGES];
|
||||||
static osg::ref_ptr<osg::TextureCubeMap> cubeMap;
|
static osg::ref_ptr<osg::TextureCubeMap> cubeMap;
|
||||||
|
|||||||
@@ -63,10 +63,6 @@ using std::vector;
|
|||||||
using namespace simgear;
|
using namespace simgear;
|
||||||
|
|
||||||
|
|
||||||
#if defined (__CYGWIN__)
|
|
||||||
#include <ieeefp.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float SGCloudField::fieldSize = 50000.0f;
|
float SGCloudField::fieldSize = 50000.0f;
|
||||||
double SGCloudField::timer_dt = 0.0;
|
double SGCloudField::timer_dt = 0.0;
|
||||||
float SGCloudField::view_distance = 20000.0f;
|
float SGCloudField::view_distance = 20000.0f;
|
||||||
|
|||||||
@@ -20,10 +20,6 @@
|
|||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
//
|
//
|
||||||
// $Id$
|
// $Id$
|
||||||
#ifdef __CYGWIN__
|
|
||||||
#include <ieeefp.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
#include <simgear/constants.h>
|
#include <simgear/constants.h>
|
||||||
|
|||||||
@@ -27,10 +27,6 @@
|
|||||||
# include <simgear_config.h>
|
# include <simgear_config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __CYGWIN__
|
|
||||||
#include <ieeefp.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
#include <simgear/constants.h>
|
#include <simgear/constants.h>
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
|||||||
@@ -2,11 +2,7 @@
|
|||||||
# include <simgear_config.h>
|
# include <simgear_config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__CYGWIN__) /* && !defined(USING_X) */
|
#ifdef WIN32
|
||||||
#define WIN32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(WIN32) /* MINGW and MSC predefine WIN32 */
|
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -39,9 +39,6 @@
|
|||||||
* Implementation of class RenderTexture. A multi-format render to
|
* Implementation of class RenderTexture. A multi-format render to
|
||||||
* texture wrapper.
|
* texture wrapper.
|
||||||
*/
|
*/
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(disable:4786)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Changelog:
|
* Changelog:
|
||||||
@@ -339,11 +336,7 @@ void PrintExtensionError( const char* strMsg, ... )
|
|||||||
char strBuffer[512];
|
char strBuffer[512];
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, strMsg);
|
va_start(args, strMsg);
|
||||||
#if defined _WIN32 && !defined __CYGWIN__
|
|
||||||
_vsnprintf( strBuffer, 512, strMsg, args );
|
|
||||||
#else
|
|
||||||
vsnprintf( strBuffer, 512, strMsg, args );
|
vsnprintf( strBuffer, 512, strMsg, args );
|
||||||
#endif
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
SG_LOG(SG_GL, SG_ALERT, strMsg);
|
SG_LOG(SG_GL, SG_ALERT, strMsg);
|
||||||
@@ -1055,11 +1048,7 @@ bool RenderTexture::Reset(const char *strMode, ...)
|
|||||||
va_list args;
|
va_list args;
|
||||||
char strBuffer[256];
|
char strBuffer[256];
|
||||||
va_start(args,strMode);
|
va_start(args,strMode);
|
||||||
#if defined _WIN32 && !defined __CYGWIN__
|
|
||||||
_vsnprintf( strBuffer, 256, strMode, args );
|
|
||||||
#else
|
|
||||||
vsnprintf( strBuffer, 256, strMode, args );
|
vsnprintf( strBuffer, 256, strMode, args );
|
||||||
#endif
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
_ParseModeString(strBuffer, _pixelFormatAttribs, _pbufferAttribs);
|
_ParseModeString(strBuffer, _pixelFormatAttribs, _pbufferAttribs);
|
||||||
|
|||||||
@@ -24,11 +24,7 @@
|
|||||||
#ifndef __SG_EXTENSIONS_HXX
|
#ifndef __SG_EXTENSIONS_HXX
|
||||||
#define __SG_EXTENSIONS_HXX 1
|
#define __SG_EXTENSIONS_HXX 1
|
||||||
|
|
||||||
#if defined(__CYGWIN__) && !defined(WIN32) /* && !defined(USING_X) */
|
#ifdef WIN32
|
||||||
#define WIN32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(WIN32) /* MINGW and MSC predefine WIN32 */
|
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -23,11 +23,7 @@
|
|||||||
# include <simgear_config.h>
|
# include <simgear_config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__CYGWIN__) /* && !defined(USING_X) */
|
#ifdef WIN32
|
||||||
#define WIN32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(WIN32) /* MINGW and MSC predefine WIN32 */
|
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
|
||||||
#if !defined( WIN32 ) || defined( __CYGWIN__) || defined( __CYGWIN32__ )
|
#ifndef _WIN32
|
||||||
# include <termios.h>
|
# include <termios.h>
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <sys/stat.h>
|
# include <sys/stat.h>
|
||||||
@@ -60,7 +60,7 @@ SGSerialPort::~SGSerialPort() {
|
|||||||
|
|
||||||
bool SGSerialPort::open_port(const string& device) {
|
bool SGSerialPort::open_port(const string& device) {
|
||||||
|
|
||||||
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
|
#ifdef _WIN32
|
||||||
|
|
||||||
fd = CreateFile( device.c_str(),
|
fd = CreateFile( device.c_str(),
|
||||||
GENERIC_READ | GENERIC_WRITE,
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
@@ -147,7 +147,7 @@ bool SGSerialPort::open_port(const string& device) {
|
|||||||
|
|
||||||
|
|
||||||
bool SGSerialPort::close_port() {
|
bool SGSerialPort::close_port() {
|
||||||
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
|
#ifdef _WIN32
|
||||||
CloseHandle( fd );
|
CloseHandle( fd );
|
||||||
#else
|
#else
|
||||||
close(fd);
|
close(fd);
|
||||||
@@ -161,7 +161,7 @@ bool SGSerialPort::close_port() {
|
|||||||
|
|
||||||
bool SGSerialPort::set_baud(int baud) {
|
bool SGSerialPort::set_baud(int baud) {
|
||||||
|
|
||||||
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
|
#ifdef _WIN32
|
||||||
|
|
||||||
DCB dcb;
|
DCB dcb;
|
||||||
if ( GetCommState( fd, &dcb ) ) {
|
if ( GetCommState( fd, &dcb ) ) {
|
||||||
@@ -274,7 +274,7 @@ string SGSerialPort::read_port() {
|
|||||||
char buffer[max_count+1];
|
char buffer[max_count+1];
|
||||||
string result;
|
string result;
|
||||||
|
|
||||||
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
|
#ifdef _WIN32
|
||||||
|
|
||||||
DWORD count;
|
DWORD count;
|
||||||
if ( ReadFile( fd, buffer, max_count, &count, 0 ) ) {
|
if ( ReadFile( fd, buffer, max_count, &count, 0 ) ) {
|
||||||
@@ -326,7 +326,7 @@ string SGSerialPort::read_port() {
|
|||||||
|
|
||||||
int SGSerialPort::read_port(char *buf, int len) {
|
int SGSerialPort::read_port(char *buf, int len) {
|
||||||
|
|
||||||
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
|
#ifdef _WIN32
|
||||||
|
|
||||||
DWORD count;
|
DWORD count;
|
||||||
if ( ReadFile( fd, buf, len, &count, 0 ) ) {
|
if ( ReadFile( fd, buf, len, &count, 0 ) ) {
|
||||||
@@ -383,7 +383,7 @@ int SGSerialPort::read_port(char *buf, int len) {
|
|||||||
|
|
||||||
int SGSerialPort::write_port(const string& value) {
|
int SGSerialPort::write_port(const string& value) {
|
||||||
|
|
||||||
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
|
#ifdef _WIN32
|
||||||
|
|
||||||
LPCVOID lpBuffer = value.data();
|
LPCVOID lpBuffer = value.data();
|
||||||
DWORD nNumberOfBytesToWrite = value.length();
|
DWORD nNumberOfBytesToWrite = value.length();
|
||||||
@@ -457,7 +457,7 @@ int SGSerialPort::write_port(const string& value) {
|
|||||||
|
|
||||||
|
|
||||||
int SGSerialPort::write_port(const char* buf, int len) {
|
int SGSerialPort::write_port(const char* buf, int len) {
|
||||||
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
|
#ifdef _WIN32
|
||||||
|
|
||||||
LPCVOID lpBuffer = buf;
|
LPCVOID lpBuffer = buf;
|
||||||
DWORD nNumberOfBytesToWrite = len;
|
DWORD nNumberOfBytesToWrite = len;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
# error This library requires C++
|
# error This library requires C++
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
|
#ifdef _WIN32
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ using std::string;
|
|||||||
*/
|
*/
|
||||||
class SGSerialPort
|
class SGSerialPort
|
||||||
{
|
{
|
||||||
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
|
#ifdef _WIN32
|
||||||
typedef HANDLE fd_type;
|
typedef HANDLE fd_type;
|
||||||
#else
|
#else
|
||||||
typedef int fd_type;
|
typedef int fd_type;
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef _WIN32
|
||||||
// This is broken, but allows the file to compile without a POSIX
|
#include <windows.h>
|
||||||
// environment.
|
#define sleep(x) Sleep(x*1000)
|
||||||
static unsigned int sleep(unsigned int secs) { return 0; }
|
|
||||||
#else
|
#else
|
||||||
#include <unistd.h> // sleep()
|
#include <unistd.h> // sleep()
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#elif defined(__sgi) && defined(_COMPILER_VERSION) && (_COMPILER_VERSION>=730)
|
#elif defined(__sgi) && defined(_COMPILER_VERSION) && (_COMPILER_VERSION>=730)
|
||||||
// No need to include something. Is a Compiler API ...
|
// No need to include something. Is a Compiler API ...
|
||||||
# define SGATOMIC_USE_MIPSPRO_BUILTINS
|
# define SGATOMIC_USE_MIPSPRO_BUILTINS
|
||||||
#elif defined(WIN32) && !defined ( __CYGWIN__ )
|
#elif defined(_WIN32)
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# define SGATOMIC_USE_WIN32_INTERLOCKED
|
# define SGATOMIC_USE_WIN32_INTERLOCKED
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
includedir = @includedir@/threads
|
includedir = @includedir@/threads
|
||||||
|
|
||||||
|
if HAVE_THREADS
|
||||||
lib_LIBRARIES = libsgthreads.a
|
lib_LIBRARIES = libsgthreads.a
|
||||||
|
|
||||||
include_HEADERS = \
|
include_HEADERS = \
|
||||||
@@ -11,3 +12,6 @@ libsgthreads_a_SOURCES = \
|
|||||||
SGThread.cxx
|
SGThread.cxx
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)
|
INCLUDES = -I$(top_srcdir)
|
||||||
|
else
|
||||||
|
include_HEADERS = SGQueue.hxx
|
||||||
|
endif
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
#include "timestamp.hxx"
|
#include "timestamp.hxx"
|
||||||
|
|
||||||
void SGTimeStamp::stamp() {
|
void SGTimeStamp::stamp() {
|
||||||
#if defined( WIN32 ) && !defined(__CYGWIN__)
|
#ifdef _WIN32
|
||||||
unsigned int t;
|
unsigned int t;
|
||||||
t = timeGetTime();
|
t = timeGetTime();
|
||||||
_sec = t / 1000;
|
_sec = t / 1000;
|
||||||
|
|||||||
Reference in New Issue
Block a user