diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 30065082c7..3d512f880b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,15 @@ +19990914-20:45 EDT David G. Holm + + config/win32/mingw32.cf + * source/hbpp/hbpp.c + * source/hbpp/hbppint.c + * source/rtl/console.c + * source/rtl/dir.c + * source/rtl/environ.c + * source/rtl/filesys.c + * source/rtl/inkey.c + * source/rtl/tone.c + + Added __MINGW32__ support for Cygnus GCC compiler. + 19990916-02:25 GMT+1 Victor Szel * source/compiler/symbols.asm (removed) diff --git a/harbour/config/win32/mingw32.cf b/harbour/config/win32/mingw32.cf new file mode 100644 index 0000000000..1e708aadd6 --- /dev/null +++ b/harbour/config/win32/mingw32.cf @@ -0,0 +1,52 @@ +# +# $Id$ +# + +include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/global.cf + +OBJ_EXT = .o +EXE_EXT = .exe +LIB_PREF = lib +LIB_EXT = .a + +CC = gcc +CC_IN = -c +CC_OUT = -o +CPPFLAGS = -DDEBUG -I. -I$(HB_INC_COMPILE) -mno-cygwin +CFLAGS = -Wall -g + +LD = gcc +LD_OUT = -o + +# Add all libraries specified in LIBS. +ifeq ($(HB_LIB_COMPILE),) +LINKPATHS += $(foreach lib, $(LIBS), -L$(TOP)$(ROOT)source/$(lib)/$(ARCH)) +else +LINKPATHS += -L$(HB_LIB_COMPILE) +endif + +# The -( option could be appropriate to link against libraries with +# cyclic dependencies, but I think it is not really necessary if the +# libraries are kept in proper order. +# LINKLIBS += -Wl,-( + +LINKLIBS += $(foreach lib, $(LIBS), -l$(lib)) + +# If LIBS specifies the rdd library, add all DB drivers. +ifeq ($(findstring rdd,$(LIBS)),rdd) +LINKPATHS += $(foreach drv, $(HB_DB_DRIVERS), -L$(TOP)$(ROOT)source/rdd/$(drv)/$(ARCH)) +LINKLIBS += $(foreach drv, $(HB_DB_DRIVERS), -l$(drv)) +endif + +# The -) option could be appropriate to link against libraries with +# cyclic dependencies, but I think it is not really necessary if the +# libraries are kept in proper order. +# LINKLIBS += -Wl,-) + +LDFLAGS = $(LINKPATHS) -mno-cygwin + +AR = ar +ARFLAGS = +AR_RULE = $(AR) $(ARFLAGS) r $@ $^ || $(RM) $@ + +include $(TOP)$(ROOT)config/rules.cf diff --git a/harbour/source/hbpp/hbpp.c b/harbour/source/hbpp/hbpp.c index 39ad297d1f..87fed3d089 100644 --- a/harbour/source/hbpp/hbpp.c +++ b/harbour/source/hbpp/hbpp.c @@ -34,7 +34,7 @@ */ #include -#if defined(__GNUC__) +#if defined(__GNUC__) && ! defined(__MINGW32__) #include #include #else diff --git a/harbour/source/hbpp/hbppint.c b/harbour/source/hbpp/hbppint.c index 3882742077..c4a8d629c8 100644 --- a/harbour/source/hbpp/hbppint.c +++ b/harbour/source/hbpp/hbppint.c @@ -34,17 +34,15 @@ their web site at http://www.gnu.org/). */ -#if defined(__GNUC__) || defined(__WATCOMC__) +#if ( defined(__GNUC__) || defined(__WATCOMC__) ) && ! defined(__MINGW32__) #include #include -#else - #if ( defined(_MSC_VER) || defined(__IBMCPP__) ) +#elif ( defined(_MSC_VER) || defined(__IBMCPP__) ) #include #include - #else +#else #include #include - #endif #endif #include #include "hbpp.h" diff --git a/harbour/source/rtl/console.c b/harbour/source/rtl/console.c index 8423b35e80..49593c2b95 100644 --- a/harbour/source/rtl/console.c +++ b/harbour/source/rtl/console.c @@ -69,7 +69,7 @@ #include "gtapi.h" /* HARBOUR_USE_GTAPI is checked inside gtapi.h, so that we can always get the border styles */ -#if defined(__GNUC__) +#if defined(__GNUC__) && ! defined(__MINGW32__) #include #if defined(__DJGPP__) || defined(__CYGWIN__) || defined(HARBOUR_GCC_OS2) #include diff --git a/harbour/source/rtl/dir.c b/harbour/source/rtl/dir.c index b7560b6be1..2357a9e05a 100644 --- a/harbour/source/rtl/dir.c +++ b/harbour/source/rtl/dir.c @@ -7,6 +7,7 @@ * by the optional file and attribute mask. * * Latest mods: + * 1.49 19990915 dholm Added __MINGW32__ support * 1.46 19990915 ptucker Return results are now fully compatible * particularly using MSVC - other os's need * testing. @@ -69,9 +70,12 @@ #define INCL_DOSERRORS #endif -#if defined(_MSC_VER) -#define WIN32_LEAN_AND_MEAN -#include +#if defined(_MSC_VER) || defined(__MINGW32__) + #define WIN32_LEAN_AND_MEAN + #include + #if defined(__MINGW32__) + #define HB_DONT_DEFINE_BASIC_TYPES + #endif #endif #include @@ -79,7 +83,7 @@ #include "itemapi.h" #include "directry.ch" -#if defined(__GNUC__) +#if defined(__GNUC__) && ! defined(__MINGW32__) #include #include #include @@ -102,7 +106,7 @@ #include #endif -#if defined(__WATCOMC__) || defined(_MSC_VER) +#if defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__) #include #include #include @@ -285,7 +289,7 @@ static USHORT osAttributesToMask( BYTE * byAttrib ) #else #if defined(__IBMCPP__) #else - #if defined(_MSC_VER) + #if defined(_MSC_VER) || defined(__MINGW32__) #elif defined(__BORLANDC__) || defined(__DJGPP__) #else #endif @@ -305,7 +309,7 @@ static BYTE * osMaskToAttributes( USHORT usMask, BYTE * byAttrib ) #else #if defined(__IBMCPP__) #else - #if defined(_MSC_VER) + #if defined(_MSC_VER) || defined(__MINGW32__) #elif defined(__BORLANDC__) || defined(__DJGPP__) #else #endif @@ -432,7 +436,7 @@ HARBOUR HB_DIRECTORY( void ) struct stat statbuf; struct tm * ft; -#if defined(_MSC_VER ) +#if defined(_MSC_VER ) || defined(__MINGW32__) struct _finddata_t entry; long hFile; #elif defined(__IBMCPP__) @@ -541,7 +545,7 @@ HARBOUR HB_DIRECTORY( void ) tzset(); pDir = hb_itemArrayNew( 0 ); -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__MINGW32__) strcpy( string, dirname ); strcat( string, pattern ); @@ -624,7 +628,7 @@ HARBOUR HB_DIRECTORY( void ) { attrib = 0; -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__MINGW32__) /* due to short-name support: reconstruct the filename */ if( bEightDotThree ) { @@ -672,7 +676,7 @@ HARBOUR HB_DIRECTORY( void ) #if defined(__IBMCPP__) attrib = entry.attrFile; #else - #if defined(_MSC_VER) + #if defined(_MSC_VER) || defined(__MINGW32__) attrib = entry.attrib; if( bEightDotThree ) { @@ -750,7 +754,7 @@ HARBOUR HB_DIRECTORY( void ) } } } -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__MINGW32__) while( _findnext( hFile, &entry ) == 0 ); _findclose( hFile ); #elif defined(__IBMCPP__) @@ -763,7 +767,7 @@ HARBOUR HB_DIRECTORY( void ) hb_itemReturn( pDir ); /* DIRECTORY() returns an array */ hb_itemRelease( pDir ); -#if defined(_MSC_VER) || defined(__IBMCPP__) +#if defined(_MSC_VER) || defined(__IBMCPP__) || defined(__MINGW32__) } #endif diff --git a/harbour/source/rtl/environ.c b/harbour/source/rtl/environ.c index 6a40548df7..5125361a58 100644 --- a/harbour/source/rtl/environ.c +++ b/harbour/source/rtl/environ.c @@ -19,10 +19,13 @@ /* NOTE: The following #ifdef block #including must be ahead of any and all #include statements! */ -#if defined(_Windows) || defined(_WIN32) +#if defined(_Windows) || defined(_WIN32) || defined(__MINGW32__) #if !defined(__CYGWIN__) #define WIN32_LEAN_AND_MEAN #include + #if defined(__MINGW32__) + #define HB_DONT_DEFINE_BASIC_TYPES + #endif #endif #endif @@ -30,12 +33,12 @@ #include "errorapi.h" #include "hbver.h" -#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(__MSC__) || defined(_MSC_VER) || defined(__DJGPP__) +#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(__MSC__) || defined(_MSC_VER) || defined(__DJGPP__) || defined(__MINGW32__) #include #include #endif -#if defined(__GNUC__) && !defined(__DJGPP__) +#if defined(__GNUC__) && !defined(__DJGPP__) && ! defined(__MINGW32__) #include #endif @@ -79,7 +82,7 @@ HARBOUR HB_OS( void ) #else -#if defined(__GNUC__) && !defined(__DJGPP__) +#if defined(__GNUC__) && !defined(__DJGPP__) && !defined(__MINGW32__) struct utsname un; @@ -97,9 +100,9 @@ HARBOUR HB_OS( void ) #else /* TODO: add MSVC support but MSVC cannot detect any OS except Windows! */ -#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(__MSC__) || defined(_MSC_VER) +#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(__MSC__) || defined(_MSC_VER) || defined(__MINGW32__) -#if defined(_Windows) || defined(_WIN32) +#if defined(_Windows) || defined(_WIN32) || defined(__MINGW32__) /* NOTE: Support for determining the window version by Luiz Rafael Culik Culik@sl.conex.net @@ -297,7 +300,7 @@ HARBOUR HB_GETENV( void ) HARBOUR HB___RUN( void ) { -#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(__DJGPP__) || defined(__MSC__) || defined(_MSC_VER) || defined(__IBMCPP__) || defined(HARBOUR_GCC_OS2) || defined(__CYGWIN__) +#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(__DJGPP__) || defined(__MSC__) || defined(_MSC_VER) || defined(__IBMCPP__) || defined(HARBOUR_GCC_OS2) || defined(__CYGWIN__) || defined(__MINGW32__) if( ISCHAR( 1 ) ) system( hb_parc( 1 ) ); #else diff --git a/harbour/source/rtl/filesys.c b/harbour/source/rtl/filesys.c index 4801818189..1f1bf44f9c 100644 --- a/harbour/source/rtl/filesys.c +++ b/harbour/source/rtl/filesys.c @@ -46,7 +46,7 @@ #include #endif -#if defined(__GNUC__) +#if defined(__GNUC__) && !defined(__MINGW32__) #include #include #include @@ -80,7 +80,7 @@ #endif #endif -#if defined(__BORLANDC__) || defined(__IBMCPP__) || defined(_MSC_VER) +#if defined(__BORLANDC__) || defined(__IBMCPP__) || defined(_MSC_VER) || defined(__MINGW32__) #include #include #include @@ -90,7 +90,7 @@ #include #endif - #if defined(_MSC_VER) + #if defined(_MSC_VER) || defined(__MINGW32__) #include #else #if !defined(HAVE_POSIX_IO) @@ -163,7 +163,7 @@ extern int rename( const char *, const char * ); /* Convert HARBOUR flags to IO subsystem flags */ -#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) +#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) || defined(__MINGW32__) static int convert_open_flags( USHORT uiFlags ) { @@ -173,7 +173,7 @@ static int convert_open_flags( USHORT uiFlags ) result_flags |= O_BINARY; /* DEBUG: printf("\nconvert_open_flags: O_BINARY"); */ -#if defined( _MSC_VER ) +#if defined( _MSC_VER ) || defined(__MINGW32__) if( uiFlags == 0 ) { result_flags |= O_RDONLY; @@ -201,7 +201,7 @@ static int convert_open_flags( USHORT uiFlags ) /* DEBUG: printf(" O_RDWR"); */ } -#if ! defined(_MSC_VER) +#if ! defined(_MSC_VER) && ! defined(__MINGW32__) /* shared flags */ if( ( uiFlags & FO_DENYREAD ) == FO_DENYREAD ) { @@ -292,9 +292,7 @@ FHANDLE hb_fsOpen( BYTE * pFilename, USHORT uiFlags ) hFileHandle = open( ( char * ) pFilename, convert_open_flags( uiFlags ) ); s_uiErrorLast = errno; -#else - - #if defined(_MSC_VER) +#elif defined(_MSC_VER) int iShare = _SH_DENYNO; @@ -314,13 +312,31 @@ FHANDLE hb_fsOpen( BYTE * pFilename, USHORT uiFlags ) hFileHandle = _open( ( char * ) pFilename, convert_open_flags( uiFlags ) ); s_uiErrorLast = errno; - #else +#elif defined(__MINGW32__) + + int iShare = SH_DENYNO; + + if( ( uiFlags & FO_DENYREAD ) == FO_DENYREAD ) + iShare = SH_DENYRD; + + else if( uiFlags & FO_EXCLUSIVE ) + iShare = SH_DENYRW; + + else if( uiFlags & FO_DENYWRITE ) + iShare = SH_DENYWR; + + errno = 0; + if( iShare ) + hFileHandle = sopen( ( char * ) pFilename, convert_open_flags( uiFlags ), iShare ); + else + hFileHandle = open( ( char * ) pFilename, convert_open_flags( uiFlags ) ); + s_uiErrorLast = errno; + +#else hFileHandle = FS_ERROR; s_uiErrorLast = FS_ERROR; - #endif - #endif return hFileHandle; @@ -334,7 +350,7 @@ FHANDLE hb_fsCreate( BYTE * pFilename, USHORT uiFlags ) s_uiErrorLast = 0; -#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) +#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) || defined(__MINGW32__) errno = 0; convert_create_flags( uiFlags, &oflag, &pmode ); @@ -359,7 +375,7 @@ FHANDLE hb_fsCreate( BYTE * pFilename, USHORT uiFlags ) void hb_fsClose( FHANDLE hFileHandle ) { -#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) +#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) || defined(__MINGW32__) errno = 0; close( hFileHandle ); @@ -395,7 +411,7 @@ void hb_fsSetDevMode( FHANDLE hFileHandle, USHORT uiDevMode ) } s_uiErrorLast = errno; -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) || defined(__MINGW32__) errno = 0; switch( uiDevMode ) @@ -422,7 +438,7 @@ USHORT hb_fsRead( FHANDLE hFileHandle, BYTE * pBuff, USHORT uiCount ) { USHORT uiRead; -#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) +#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) || defined(__MINGW32__) errno = 0; uiRead = read( hFileHandle, pBuff, uiCount ); @@ -444,7 +460,7 @@ USHORT hb_fsWrite( FHANDLE hFileHandle, BYTE * pBuff, USHORT uiCount ) { USHORT uiWritten; -#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) +#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) || defined(__MINGW32__) errno = 0; uiWritten = write( hFileHandle, pBuff, uiCount ); @@ -466,7 +482,7 @@ ULONG hb_fsReadLarge( FHANDLE hFileHandle, BYTE * pBuff, ULONG ulCount ) { ULONG ulReadTotal = 0; -#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) +#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) || defined(__MINGW32__) errno = 0; while( ulReadTotal < ulCount ) @@ -497,7 +513,7 @@ ULONG hb_fsWriteLarge( FHANDLE hFileHandle, BYTE * pBuff, ULONG ulCount ) { ULONG ulWrittenTotal = 0; -#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) +#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) || defined(__MINGW32__) errno = 0; while( ulWrittenTotal < ulCount ) @@ -534,7 +550,7 @@ ULONG hb_fsSeek( FHANDLE hFileHandle, LONG lOffset, USHORT uiFlags ) /* 'Seek Error' */ s_uiErrorLast = 25; - #if defined(HAVE_POSIX_IO) || defined(_MSC_VER) + #if defined(HAVE_POSIX_IO) || defined(_MSC_VER) || defined(__MINGW32__) /* get current offset */ errno = 0; ulPos = lseek( hFileHandle, 0, SEEK_CUR ); @@ -547,7 +563,7 @@ ULONG hb_fsSeek( FHANDLE hFileHandle, LONG lOffset, USHORT uiFlags ) else { - #if defined(HAVE_POSIX_IO) || defined(_MSC_VER) + #if defined(HAVE_POSIX_IO) || defined(_MSC_VER) || defined(__MINGW32__) errno = 0; ulPos = lseek( hFileHandle, lOffset, Flags ); @@ -591,7 +607,7 @@ int hb_fsDelete( BYTE * pFilename ) #else - #if defined(_MSC_VER) + #if defined(_MSC_VER) || defined(__MINGW32__) errno = 0; iResult = remove( ( char * ) pFilename ); @@ -613,7 +629,7 @@ int hb_fsRename( BYTE * pOldName, BYTE * pNewName ) { int iResult; -#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) +#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) || defined(__MINGW32__) errno = 0; iResult = rename( ( char * ) pOldName, ( char * ) pNewName ); @@ -634,7 +650,7 @@ BOOL hb_fsLock ( FHANDLE hFileHandle, ULONG ulStart, { int iResult = 0; -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__MINGW32__) ULONG ulOldPos; #endif @@ -653,9 +669,7 @@ BOOL hb_fsLock ( FHANDLE hFileHandle, ULONG ulStart, } s_uiErrorLast = errno; -#else - -#if defined(_MSC_VER) +#elif defined(_MSC_VER) ulOldPos = hb_fsSeek( hFileHandle, ulStart, FS_SET ); @@ -672,13 +686,28 @@ BOOL hb_fsLock ( FHANDLE hFileHandle, ULONG ulStart, hb_fsSeek( hFileHandle, ulOldPos, FS_SET ); +#elif defined(__MINGW32__) + + ulOldPos = hb_fsSeek( hFileHandle, ulStart, FS_SET ); + + switch( uiMode ) + { + case FL_LOCK: + iResult = _locking( hFileHandle, _LK_LOCK, ulLength ); + break; + + case FL_UNLOCK: + iResult = _locking( hFileHandle, _LK_UNLOCK, ulLength ); + break; + } + + hb_fsSeek( hFileHandle, ulOldPos, FS_SET ); + #else iResult = 1; s_uiErrorLast = FS_ERROR; -#endif - #endif return ( iResult ? FALSE : TRUE ); @@ -686,7 +715,7 @@ BOOL hb_fsLock ( FHANDLE hFileHandle, ULONG ulStart, void hb_fsCommit( FHANDLE hFileHandle ) { -#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) +#if defined(HAVE_POSIX_IO) || defined(_MSC_VER) || defined(__MINGW32__) int dup_handle; @@ -801,7 +830,7 @@ USHORT hb_fsChDrv( BYTE nDrive ) { USHORT uiResult; -#if defined(HAVE_POSIX_IO) && ( defined(OS2) || defined(DOS) || defined(_Windows) ) && ! defined(__CYGWIN__) +#if defined(HAVE_POSIX_IO) && ( defined(OS2) || defined(DOS) || defined(_Windows) || defined(__MINGW32__) ) && ! defined(__CYGWIN__) USHORT uiSave = _getdrive(); @@ -831,7 +860,7 @@ BYTE hb_fsCurDrv( void ) { USHORT uiResult; -#if defined(HAVE_POSIX_IO) && ( defined(OS2) || defined(DOS) || defined(_Windows) ) && ! defined(__CYGWIN__) +#if defined(HAVE_POSIX_IO) && ( defined(OS2) || defined(DOS) || defined(_Windows) || defined(__MINGW32__) ) && ! defined(__CYGWIN__) errno = 0; uiResult = _getdrive(); @@ -851,7 +880,7 @@ USHORT hb_fsIsDrv( BYTE nDrive ) { USHORT uiResult; -#if defined(HAVE_POSIX_IO) && ( defined(OS2) || defined(DOS) || defined(_Windows) ) && ! defined(__CYGWIN__) +#if defined(HAVE_POSIX_IO) && ( defined(OS2) || defined(DOS) || defined(_Windows) || defined(__MINGW32__) ) && ! defined(__CYGWIN__) USHORT uiSave = _getdrive(); diff --git a/harbour/source/rtl/inkey.c b/harbour/source/rtl/inkey.c index b396708270..00b0ffb468 100644 --- a/harbour/source/rtl/inkey.c +++ b/harbour/source/rtl/inkey.c @@ -32,6 +32,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit their web site at http://www.gnu.org/). + V 1.36 David G. Holm Added __MINGW32__ support V 1.35 David G. Holm Changed the __CYGWIN__ build to use the Unix keyboard input method and modified it to not block the VM. @@ -70,7 +71,7 @@ #include "inkey.h" #include "init.h" -#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(__MSC__) || defined(_MSC_VER) +#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(__MSC__) || defined(_MSC_VER) || defined(__MINGW32__) #include #include #elif defined(__DJGPP__) @@ -145,7 +146,7 @@ static HB_inkey_enum s_eventmask; void hb_releaseCPU( void ) { /* TODO: Add code to release time slices on all platforms */ -#if defined(_Windows) +#if defined(_Windows) || defined(__MINGW32__) /* according to ms docs, you should not do this in a Win app. dos only */ #elif defined(OS2) DosSleep( 25 ); /* Duration is in milliseconds */ @@ -218,7 +219,8 @@ int hb_inkeyGet( void ) /* Extract the next key from the keyboard buffer * non-blocking Unix-style keyboard input is implemented */ char ch; read( STDIN_FILENO, &ch, 1 ); - key = ch; + if( ch == '\n' ) key = '\r'; + else key = ch; #else hb_inkeyPoll(); if( hb_set.HB_SET_TYPEAHEAD ) @@ -267,7 +269,7 @@ void hb_inkeyPoll( void ) /* Poll the console keyboard to stuff the Harbour if( hb_set.HB_SET_TYPEAHEAD || s_inkeyPoll ) { int ch = 0; -#if ( defined(OS_DOS_COMPATIBLE) || defined(HARBOUR_GCC_OS2) || defined(__IBMCPP__) || defined(_Windows) ) && ! defined(__CYGWIN__) +#if ( defined(OS_DOS_COMPATIBLE) || defined(HARBOUR_GCC_OS2) || defined(__IBMCPP__) || defined(_Windows) || defined(__MINGW32__) ) && ! defined(__CYGWIN__) /* The reason for including _Windows here is that kbhit() and getch() appear to work properly in console mode. For true Windows mode, changes are needed. */ #if defined(HARBOUR_GCC_OS2) diff --git a/harbour/source/rtl/tone.c b/harbour/source/rtl/tone.c index 7c4a9fbe2b..43f4d3f5e3 100644 --- a/harbour/source/rtl/tone.c +++ b/harbour/source/rtl/tone.c @@ -30,6 +30,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit their web site at http://www.gnu.org/). + V 1.10 David G. Holm Added __MINGW32__ support V 1.8 David G. Holm Added '&& ! defined(_Windows)' check to all __BORLANDC__ checks. V 1.6 David G. Holm Added Win32 Beep(), thanks to @@ -53,6 +54,8 @@ #include #include #elif defined(_Windows) +#elif defined(__MINGW32__) + #include #elif defined(__BORLANDC__) #include #include @@ -133,7 +136,7 @@ void hb_tone( double frequency, double duration ) ULONG temp; #elif defined(WINNT) || defined(_Windows) ULONG temp; -#elif defined(OS2) +#elif defined(OS2) || defined(__MINGW32__) USHORT temp; #elif defined(__DJGPP__) || defined(__BORLANDC__) USHORT temp; /* Use USHORT, because this variable gets added to clock() @@ -144,7 +147,7 @@ void hb_tone( double frequency, double duration ) ULONG temp; /* Avoid unreferenced temp */ duration = -1; /* Exit without delay */ #endif -#if defined(HARBOUR_GCC_OS2) || defined(OS2) || defined(WINNT) || defined(_Windows) +#if defined(HARBOUR_GCC_OS2) || defined(OS2) || defined(WINNT) || defined(_Windows) || defined(__MINGW32__) frequency = MIN( MAX( 0.0, frequency ), 32767.0 ); duration = duration * 1000.0 / 18.2; /* milliseconds */ #elif defined(__DJGPP) || defined(__BORLANDC__) @@ -160,7 +163,7 @@ void hb_tone( double frequency, double duration ) { #if defined(HARBOUR_GCC_OS2) || defined(_Windows) || defined(__CYGWIN__) temp = MIN( MAX ( 0, duration ), ULONG_MAX ); -#elif defined(OS2) || defined(__BORLANDC__) || defined(__DJGPP__) +#elif defined(OS2) || defined(__BORLANDC__) || defined(__DJGPP__) || defined(__MINGW32__) temp = MIN( MAX ( 0, duration ), USHRT_MAX ); #endif duration -= temp; @@ -176,6 +179,8 @@ void hb_tone( double frequency, double duration ) DosBeep( ( ULONG ) frequency, temp ); #elif defined(OS2) DosBeep( ( USHORT ) frequency, temp ); +#elif defined(__MINGW32__) + beep( frequency, temp ); #elif defined(WINNT) Beep( ( ULONG ) frequency, temp ); #elif defined(_Windows) && ! defined(_Windows)