diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4cc9d3c1d0..e6756ea71b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,29 @@ +19991105-21:20 EDT David G. Holm + + * config/os2/icc.cf + % Now that source/vm/main.c includes either mainstd.c or + mainwin.c, reference main.obj instead of main$(HB_MAIN).obj + when HB_MAIN is defined. + + * include/filesys.h + ! Only use hb_fsReadLarge() and hb_fsWriteLarge() if the size + of a ULONG is different from the size of a UINT (was USHORT, + which is always going to be smaller than a ULONG). + + * source/common/hbtrace.c + ! The hb_trace module uses strcmp(), which means that it + has to include to keep C++ compilers happy. + + * source/rtl/filesys.c + ! Only use hb_fsReadLarge() and hb_fsWriteLarge() if the size + of a ULONG is different from the size of a UINT (was USHORT, + which is always going to be smaller than a ULONG). + + * source/runner/stdalone/Makefile + % IBM's Visual Age C++ compiler will not resolve main() from a + library, so it is necessary to set HB_MAIN, if it isn't already + set, so that icc.cf will know to include the main.obj module. + 19991105-14:07 GMT+1 Ryszard Glab *source/rtl/codebloc.prg diff --git a/harbour/config/os2/icc.cf b/harbour/config/os2/icc.cf index 14c66a2490..fb528002c1 100644 --- a/harbour/config/os2/icc.cf +++ b/harbour/config/os2/icc.cf @@ -20,7 +20,7 @@ LD_OUT = /Fe LDFLAGS = /C- ifeq ($(HB_MAIN),) else -LDFLAGS += $(TOP)$(ROOT)source/vm/$(ARCH)/main$(HB_MAIN).obj +LDFLAGS += $(TOP)$(ROOT)source/vm/$(ARCH)/main.obj endif ifeq ($(HB_LIB_COMPILE),) LINKLIBS = $(foreach lib, $(LIBS), $(TOP)$(ROOT)source/$(lib)/$(ARCH)/$(lib)$(LIB_EXT)) diff --git a/harbour/include/filesys.h b/harbour/include/filesys.h index 7f88747be9..b1ee2d56c4 100644 --- a/harbour/include/filesys.h +++ b/harbour/include/filesys.h @@ -115,7 +115,7 @@ extern void hb_fsSetDevText ( FHANDLE hFileHandle ); extern void hb_fsSetError ( USHORT uiError ); extern USHORT hb_fsWrite ( FHANDLE hFileHandle, BYTE * pBuff, USHORT ulCount ); -#if USHORT_MAX == ULONG_MAX +#if UINT_MAX == ULONG_MAX /* NOTE: hb_fsRead/hb_fsWrite can work with ULONG data blocks */ #define hb_fsReadLarge hb_fsRead #define hb_fsWriteLarge hb_fsWrite diff --git a/harbour/source/common/hbtrace.c b/harbour/source/common/hbtrace.c index ef12198f7f..aa5775b200 100644 --- a/harbour/source/common/hbtrace.c +++ b/harbour/source/common/hbtrace.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "hbtrace.h" char * hb_tr_file_ = ""; @@ -78,7 +79,7 @@ void hb_tr_trace( char * fmt, ... ) * Print file and line. */ fprintf(hb_tr_fp_, "%s:%d: %s ", - hb_tr_file_ + i, hb_tr_line_, slevel[hb_tr_level_]); + hb_tr_file_ + i, hb_tr_line_, slevel[hb_tr_level_]); /* * Print the name and arguments for the function. diff --git a/harbour/source/rtl/filesys.c b/harbour/source/rtl/filesys.c index 897d918649..2656f9d0b3 100644 --- a/harbour/source/rtl/filesys.c +++ b/harbour/source/rtl/filesys.c @@ -131,6 +131,7 @@ #include #include #include + #include #if defined(__BORLANDC__) #include #include @@ -138,7 +139,9 @@ #if defined(_MSC_VER) || defined(__MINGW32__) #include + #define ftruncate _chsize #else + #define ftruncate chsize #if !defined(HAVE_POSIX_IO) #define HAVE_POSIX_IO #endif @@ -541,6 +544,7 @@ USHORT hb_fsWrite( FHANDLE hFileHandle, BYTE * pBuff, USHORT uiCount ) errno = 0; uiWritten = write( hFileHandle, pBuff, uiCount ); s_uiErrorLast = errno; + ftruncate( hFileHandle, tell( hFileHandle ) ); if( uiWritten == ( USHORT ) -1 ) uiWritten = 0; @@ -554,9 +558,9 @@ USHORT hb_fsWrite( FHANDLE hFileHandle, BYTE * pBuff, USHORT uiCount ) return uiWritten; } -#if USHORT_MAX != ULONG_MAX +#if UINT_MAX != ULONG_MAX -#define LARGE_MAX ( USHRT_MAX - 1L ) +#define LARGE_MAX ( UINT_MAX - 1L ) ULONG hb_fsReadLarge( FHANDLE hFileHandle, BYTE * pBuff, ULONG ulCount ) { @@ -574,9 +578,9 @@ ULONG hb_fsReadLarge( FHANDLE hFileHandle, BYTE * pBuff, ULONG ulCount ) while( ulLeftToRead ) { /* Determine how much to read this time */ - if( ulLeftToRead > ( ULONG ) LARGE_MAX ) + if( ulLeftToRead > ( ULONG ) INT_MAX ) { - uiToRead = LARGE_MAX; + uiToRead = INT_MAX; ulLeftToRead -= ( ULONG ) uiToRead; } else @@ -621,9 +625,9 @@ ULONG hb_fsWriteLarge( FHANDLE hFileHandle, BYTE * pBuff, ULONG ulCount ) while( ulLeftToWrite ) { /* Determine how much to write this time */ - if( ulLeftToWrite > ( ULONG ) LARGE_MAX ) + if( ulLeftToWrite > ( ULONG ) INT_MAX ) { - uiToWrite = LARGE_MAX; + uiToWrite = INT_MAX; ulLeftToWrite -= ( ULONG ) uiToWrite; } else @@ -642,6 +646,7 @@ ULONG hb_fsWriteLarge( FHANDLE hFileHandle, BYTE * pBuff, ULONG ulCount ) pPtr += uiWritten; } s_uiErrorLast = errno; + ftruncate( hFileHandle, tell( hFileHandle ) ); #else diff --git a/harbour/source/runner/stdalone/Makefile b/harbour/source/runner/stdalone/Makefile index debccbc2b5..414ec8186f 100644 --- a/harbour/source/runner/stdalone/Makefile +++ b/harbour/source/runner/stdalone/Makefile @@ -2,6 +2,10 @@ # $Id$ # +ifeq ($(HB_MAIN),) +HB_MAIN = std +endif + ROOT = ../../../ PRG_SOURCES=\