2007-10-15 17:39 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbpp.h
* harbour/include/hbmath.h
* harbour/source/pp/ppcore.c
* harbour/source/pp/ppgen.c
* harbour/source/pp/Makefile
* harbour/source/rtl/diskspac.c
* harbour/source/rtl/fserror.c
* harbour/source/rtl/gtchrmap.c
* harbour/source/rtl/disksphb.c
* harbour/source/rtl/gttone.c
* harbour/source/rtl/gtwvt/gtwvt.c
* harbour/source/rtl/fssize.c
* harbour/source/rtl/hbinet.c
* harbour/source/rtl/hbffind.c
* harbour/source/rtl/filesys.c
* harbour/source/vm/mainwin.c
* harbour/source/common/hbver.c
* harbour/source/common/hbtrace.c
* harbour/source/compiler/cmdcheck.c
* harbour/source/compiler/ppcomp.c
* harbour/utils/hbver/hbverfix.c
* harbour/utils/hbpp/hbppcore.c
* harbour/config/w32/pocc.cf
* code cleanup:
- eliminated unnecessary errno access
- use WinAPI functions instead of some standard C library functions
in Windows builds
This commit is contained in:
@@ -8,6 +8,35 @@
|
||||
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2007-10-15 17:39 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbpp.h
|
||||
* harbour/include/hbmath.h
|
||||
* harbour/source/pp/ppcore.c
|
||||
* harbour/source/pp/ppgen.c
|
||||
* harbour/source/pp/Makefile
|
||||
* harbour/source/rtl/diskspac.c
|
||||
* harbour/source/rtl/fserror.c
|
||||
* harbour/source/rtl/gtchrmap.c
|
||||
* harbour/source/rtl/disksphb.c
|
||||
* harbour/source/rtl/gttone.c
|
||||
* harbour/source/rtl/gtwvt/gtwvt.c
|
||||
* harbour/source/rtl/fssize.c
|
||||
* harbour/source/rtl/hbinet.c
|
||||
* harbour/source/rtl/hbffind.c
|
||||
* harbour/source/rtl/filesys.c
|
||||
* harbour/source/vm/mainwin.c
|
||||
* harbour/source/common/hbver.c
|
||||
* harbour/source/common/hbtrace.c
|
||||
* harbour/source/compiler/cmdcheck.c
|
||||
* harbour/source/compiler/ppcomp.c
|
||||
* harbour/utils/hbver/hbverfix.c
|
||||
* harbour/utils/hbpp/hbppcore.c
|
||||
* harbour/config/w32/pocc.cf
|
||||
* code cleanup:
|
||||
- eliminated unnecessary errno access
|
||||
- use WinAPI functions instead of some standard C library functions
|
||||
in Windows builds
|
||||
|
||||
2007-10-13 12:48 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/source/compiler/hbdead.c
|
||||
% minor improvement
|
||||
|
||||
@@ -62,10 +62,13 @@ endif
|
||||
LINKLIBS += $(foreach gt, $(HB_GT_LIBS), $(gt)$(LIB_EXT))
|
||||
endif
|
||||
|
||||
#LDFLAGS = $(LINKPATHS)
|
||||
LDFLAGS = $(LINKPATHS) kernel32.lib user32.lib \
|
||||
winspool.lib ole32.lib oleaut32.lib uuid.lib \
|
||||
comctl32.lib mapi32.lib advapi32.lib \
|
||||
gdi32.lib mpr.lib wsock32.lib
|
||||
gdi32.lib mpr.lib wsock32.lib ws2.lib ws2_32.lib
|
||||
|
||||
# ws2 ws2_32
|
||||
|
||||
ifeq ($(HB_GT_DEFAULT),gtgui)
|
||||
LDFLAGS += /SUBSYSTEM:WINDOWS
|
||||
@@ -75,8 +78,6 @@ LDFLAGS += /SUBSYSTEM:WINDOWS
|
||||
endif
|
||||
endif
|
||||
|
||||
# mpr wsock32 ws2_32 mapi32
|
||||
|
||||
AR = polib.exe
|
||||
ARFLAGS = $(A_USR)
|
||||
AR_RULE = $(AR) $(ARFLAGS) /out:$@ $(^F)
|
||||
|
||||
@@ -82,7 +82,10 @@ HB_EXTERN_BEGIN
|
||||
#define exception _exception
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#elif defined(__MINGW32CE__)
|
||||
#define HB_MATH_HANDLER
|
||||
#define matherr _matherr
|
||||
#define exception _exception
|
||||
/* it seems that MinGW has some problem with MATH HANDLER
|
||||
use HB_MATH_ERRNO instead */
|
||||
#elif defined(__MINGW32__) && 0
|
||||
|
||||
@@ -83,7 +83,7 @@ HB_EXTERN_BEGIN
|
||||
#define HB_PP_INLINE_QUOTE2 6
|
||||
|
||||
/* function to open included files */
|
||||
#define HB_PP_OPEN_FUNC_( func ) FILE * func( void *, const char *, BOOL, char * )
|
||||
#define HB_PP_OPEN_FUNC_( func ) FILE * func( void *, const char *, BOOL, BOOL *, char * )
|
||||
typedef HB_PP_OPEN_FUNC_( HB_PP_OPEN_FUNC );
|
||||
typedef HB_PP_OPEN_FUNC * PHB_PP_OPEN_FUNC;
|
||||
|
||||
|
||||
@@ -225,7 +225,6 @@ void hb_tr_trace( char * fmt, ... )
|
||||
if ( s_flush )
|
||||
{
|
||||
fflush( s_fp ) ;
|
||||
close( dup( fileno( s_fp ))) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
#define VER_PLATFORM_WIN32_CE 3
|
||||
#endif
|
||||
|
||||
#elif defined(HB_OS_UNIX)
|
||||
#elif defined(HB_OS_UNIX) && !defined(__CEGCC__)
|
||||
|
||||
#include <sys/utsname.h>
|
||||
|
||||
@@ -269,6 +269,10 @@ char * hb_verPlatform( void )
|
||||
snprintf( pszPlatform, 256, "Windows" );
|
||||
}
|
||||
|
||||
#elif defined(__CEGCC__)
|
||||
{
|
||||
snprintf( pszPlatform, 256, "Windows" );
|
||||
}
|
||||
#elif defined(HB_OS_UNIX)
|
||||
|
||||
{
|
||||
|
||||
@@ -45,10 +45,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "hbcomp.h"
|
||||
|
||||
#if defined(HB_OS_WIN_32)
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
/* TODO: Add support for this compiler switches
|
||||
-r -t || hb_getenv( "TMP" )
|
||||
*/
|
||||
@@ -76,11 +80,40 @@ static ULONG PackDateTime( void )
|
||||
BYTE szString[4];
|
||||
BYTE nValue;
|
||||
|
||||
#if defined(HB_OS_WIN_32)
|
||||
SYSTEMTIME st;
|
||||
|
||||
GetLocalTime( &st );
|
||||
|
||||
nValue = ( BYTE ) ( ( st.wYear - 1980 ) & ( 2 ^ 6 ) ); /* 6 bits */
|
||||
szString[0] = nValue << 2;
|
||||
nValue = ( BYTE ) ( st.wMonth ); /* 4 bits */
|
||||
szString[0] |= nValue >> 2;
|
||||
szString[1] = nValue << 6;
|
||||
nValue = ( BYTE ) ( st.wDay ); /* 5 bits */
|
||||
szString[1] |= nValue << 1;
|
||||
|
||||
nValue = ( BYTE ) st.wHour; /* 5 bits */
|
||||
szString[1] = nValue >> 4;
|
||||
szString[2] = nValue << 4;
|
||||
nValue = ( BYTE ) st.wMinute; /* 6 bits */
|
||||
szString[2] |= nValue >> 2;
|
||||
szString[3] = nValue << 6;
|
||||
nValue = ( BYTE ) st.wSecond; /* 6 bits */
|
||||
szString[3] |= nValue;
|
||||
#else
|
||||
time_t t;
|
||||
struct tm *oTime;
|
||||
|
||||
#if defined( HB_OS_LINUX ) && !defined( __WATCOMC__ )
|
||||
struct tm tm;
|
||||
time( &t );
|
||||
oTime = &tm;
|
||||
localtime_r( &t, oTime );
|
||||
#else
|
||||
time( &t );
|
||||
oTime = localtime( &t );
|
||||
#endif
|
||||
|
||||
nValue = ( BYTE ) ( ( ( oTime->tm_year + 1900 ) - 1980 ) & ( 2 ^ 6 ) ); /* 6 bits */
|
||||
szString[0] = nValue << 2;
|
||||
@@ -98,6 +131,7 @@ static ULONG PackDateTime( void )
|
||||
szString[3] = nValue << 6;
|
||||
nValue = ( BYTE ) oTime->tm_sec; /* 6 bits */
|
||||
szString[3] |= nValue;
|
||||
#endif
|
||||
|
||||
return HB_MKLONG( szString[3], szString[2], szString[1], szString[0] );
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
|
||||
|
||||
#include "hbcomp.h"
|
||||
#include <errno.h>
|
||||
|
||||
static void hb_pp_ErrorGen( void * cargo,
|
||||
const char * szMsgTable[], char cPrefix, int iErrorCode,
|
||||
|
||||
@@ -22,5 +22,10 @@ endif
|
||||
|
||||
include $(TOP)$(ROOT)config/lib.cf
|
||||
|
||||
ifneq ($(HB_PP_RULES),)
|
||||
pptable.c : $(HB_PP_RULES)
|
||||
$(CP) $(subst /,$(DIRSEP),$<) $@
|
||||
else
|
||||
pptable.c : ppgen$(EXE_EXT)
|
||||
$(HB_PPGEN_PATH)/ppgen$(EXE_EXT) $(TOP)$(ROOT)include/hbstdgen.ch -opptable.c -q
|
||||
endif
|
||||
|
||||
@@ -58,7 +58,9 @@
|
||||
|
||||
#include "hbpp.h"
|
||||
#include "hbdate.h"
|
||||
#include <errno.h>
|
||||
#if !defined(__MINGW32CE__) && !defined(HB_WINCE)
|
||||
# include <errno.h>
|
||||
#endif
|
||||
|
||||
#define HB_PP_WARN_DEFINE_REDEF 1 /* C1005 */
|
||||
|
||||
@@ -1757,7 +1759,7 @@ static void hb_pp_defineDel( PHB_PP_STATE pState, PHB_PP_TOKEN pToken )
|
||||
}
|
||||
|
||||
static PHB_PP_FILE hb_pp_FileNew( PHB_PP_STATE pState, char * szFileName,
|
||||
BOOL fSysFile, FILE * file_in,
|
||||
BOOL fSysFile, BOOL * pfNested, FILE * file_in,
|
||||
BOOL fSearchPath, PHB_PP_OPEN_FUNC pOpenFunc )
|
||||
{
|
||||
char szFileNameBuf[ _POSIX_PATH_MAX + 1 ];
|
||||
@@ -1767,16 +1769,17 @@ static PHB_PP_FILE hb_pp_FileNew( PHB_PP_STATE pState, char * szFileName,
|
||||
{
|
||||
if( pOpenFunc )
|
||||
{
|
||||
file_in = ( pOpenFunc )( pState->cargo, szFileName, fSysFile, szFileNameBuf );
|
||||
file_in = ( pOpenFunc )( pState->cargo, szFileName, fSysFile,
|
||||
pfNested, szFileNameBuf );
|
||||
szFileName = szFileNameBuf;
|
||||
}
|
||||
else
|
||||
{
|
||||
PHB_FNAME pFileName = hb_fsFNameSplit( szFileName );
|
||||
BOOL fNested = FALSE;
|
||||
|
||||
pFileName->szName = szFileName;
|
||||
pFileName->szExtension = NULL;
|
||||
errno = 0;
|
||||
if( !fSysFile )
|
||||
{
|
||||
if( !pFileName->szPath || !pFileName->szPath[ 0 ] )
|
||||
@@ -1800,18 +1803,29 @@ static PHB_PP_FILE hb_pp_FileNew( PHB_PP_STATE pState, char * szFileName,
|
||||
}
|
||||
|
||||
file_in = fopen( szFileName, "r" );
|
||||
#if !defined(__MINGW32CE__) && !defined(HB_WINCE)
|
||||
fNested = errno == EMFILE;
|
||||
#endif
|
||||
}
|
||||
|
||||
if( !file_in && errno != EMFILE && pState->pIncludePath && fSearchPath )
|
||||
if( !file_in )
|
||||
{
|
||||
HB_PATHNAMES * pPath = pState->pIncludePath;
|
||||
|
||||
while( pPath && !file_in )
|
||||
if( fNested )
|
||||
{
|
||||
pFileName->szPath = pPath->szPath;
|
||||
hb_fsFNameMerge( szFileNameBuf, pFileName );
|
||||
file_in = fopen( szFileNameBuf, "r" );
|
||||
pPath = pPath->pNext;
|
||||
if( pfNested )
|
||||
* pfNested = TRUE;
|
||||
}
|
||||
else if( pState->pIncludePath && fSearchPath )
|
||||
{
|
||||
HB_PATHNAMES * pPath = pState->pIncludePath;
|
||||
|
||||
while( pPath && !file_in )
|
||||
{
|
||||
pFileName->szPath = pPath->szPath;
|
||||
hb_fsFNameMerge( szFileNameBuf, pFileName );
|
||||
file_in = fopen( szFileNameBuf, "r" );
|
||||
pPath = pPath->pNext;
|
||||
}
|
||||
}
|
||||
}
|
||||
hb_xfree( pFileName );
|
||||
@@ -1962,8 +1976,9 @@ static void hb_pp_includeFile( PHB_PP_STATE pState, char * szFileName, BOOL fSys
|
||||
}
|
||||
else
|
||||
{
|
||||
PHB_PP_FILE pFile = hb_pp_FileNew( pState, szFileName, fSysFile, NULL,
|
||||
TRUE, pState->pOpenFunc );
|
||||
BOOL fNested = FALSE;
|
||||
PHB_PP_FILE pFile = hb_pp_FileNew( pState, szFileName, fSysFile, &fNested,
|
||||
NULL, TRUE, pState->pOpenFunc );
|
||||
if( pFile )
|
||||
{
|
||||
pFile->pPrev = pState->pFile;
|
||||
@@ -1971,7 +1986,7 @@ static void hb_pp_includeFile( PHB_PP_STATE pState, char * szFileName, BOOL fSys
|
||||
pState->iFiles++;
|
||||
pFile->fGenLineInfo = TRUE;
|
||||
}
|
||||
else if( errno == EMFILE )
|
||||
else if( fNested )
|
||||
hb_pp_error( pState, 'F', HB_PP_ERR_NESTED_INCLUDES, NULL );
|
||||
else
|
||||
hb_pp_error( pState, 'F', HB_PP_ERR_CANNOT_OPEN_FILE, szFileName );
|
||||
@@ -5128,7 +5143,7 @@ void hb_pp_readRules( PHB_PP_STATE pState, const char * szRulesFile )
|
||||
hb_fsFNameMerge( szFileName, pFileName );
|
||||
hb_xfree( pFileName );
|
||||
|
||||
pState->pFile = hb_pp_FileNew( pState, szFileName, FALSE, NULL,
|
||||
pState->pFile = hb_pp_FileNew( pState, szFileName, FALSE, NULL, NULL,
|
||||
TRUE, pState->pOpenFunc );
|
||||
if( !pState->pFile )
|
||||
{
|
||||
@@ -5179,7 +5194,7 @@ BOOL hb_pp_inFile( PHB_PP_STATE pState, const char * szFileName,
|
||||
|
||||
pState->fError = FALSE;
|
||||
|
||||
pState->pFile = hb_pp_FileNew( pState, ( char * ) szFileName, FALSE,
|
||||
pState->pFile = hb_pp_FileNew( pState, ( char * ) szFileName, FALSE, NULL,
|
||||
file_in, fSearchPath, NULL );
|
||||
if( pState->pFile )
|
||||
{
|
||||
|
||||
@@ -54,6 +54,9 @@
|
||||
|
||||
#include "ppcore.c"
|
||||
|
||||
#if defined(__MINGW32CE__) || defined(HB_WINCE)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* library functions used by PP core code
|
||||
@@ -275,7 +278,9 @@ static int hb_pp_preprocesfile( PHB_PP_STATE pState, char * szRuleFile )
|
||||
foutr = fopen( szRuleFile, "w" );
|
||||
if( !foutr )
|
||||
{
|
||||
#if !defined(__MINGW32CE__) && !defined(HB_WINCE)
|
||||
perror( szRuleFile );
|
||||
#endif
|
||||
iResult = 1;
|
||||
}
|
||||
else
|
||||
@@ -302,12 +307,27 @@ static void hb_pp_usage( char * szName )
|
||||
" -q \tdisable information messages\n" );
|
||||
}
|
||||
|
||||
#if defined(__MINGW32CE__) || defined(HB_WINCE)
|
||||
int WINAPI WinMain( HINSTANCE hInstance, /* handle to current instance */
|
||||
HINSTANCE hPrevInstance, /* handle to previous instance */
|
||||
LPWSTR lpCmdLine, /* pointer to command line */
|
||||
int iCmdShow ) /* show state of window */
|
||||
{
|
||||
char * szFile = NULL, * szRuleFile = NULL;
|
||||
BOOL fQuiet = FALSE, fWrite = FALSE;
|
||||
PHB_PP_STATE pState;
|
||||
int iResult, i;
|
||||
/* hack - we do not want to create real binaries */
|
||||
int argc = 1;
|
||||
char * argv[] = {"ppgen"};
|
||||
#else
|
||||
int main( int argc, char * argv[] )
|
||||
{
|
||||
char * szFile = NULL, * szRuleFile = NULL;
|
||||
BOOL fQuiet = FALSE, fWrite = FALSE;
|
||||
PHB_PP_STATE pState;
|
||||
int iResult, i;
|
||||
#endif
|
||||
|
||||
pState = hb_pp_new();
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
#if defined(HB_OS_UNIX)
|
||||
# include <unistd.h>
|
||||
# include <sys/types.h>
|
||||
# if defined(__WATCOMC__)
|
||||
# if defined(__WATCOMC__) || defined(__CEGCC__)
|
||||
# include <sys/stat.h>
|
||||
# else
|
||||
# include <sys/statvfs.h>
|
||||
@@ -117,6 +117,7 @@ HB_FUNC( DISKSPACE )
|
||||
|
||||
SetLastError( 0 );
|
||||
|
||||
#if !defined(__MINGW32CE__) && !defined(HB_WINCE)
|
||||
pGetDiskFreeSpaceEx = ( P_GDFSE ) GetProcAddress( GetModuleHandle( "kernel32.dll" ),
|
||||
"GetDiskFreeSpaceExA");
|
||||
|
||||
@@ -156,6 +157,7 @@ HB_FUNC( DISKSPACE )
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
DWORD dwSectorsPerCluster;
|
||||
DWORD dwBytesPerSector;
|
||||
@@ -203,7 +205,7 @@ HB_FUNC( DISKSPACE )
|
||||
szName = ( char * ) hb_fsNameConv( ( BYTE * ) szName, &fFree );
|
||||
|
||||
{
|
||||
#if defined(__WATCOMC__)
|
||||
#if defined(__WATCOMC__) || defined(__CEGCC__)
|
||||
struct stat st;
|
||||
if( stat( szName, &st) == 0 )
|
||||
dSpace = ( double ) st.st_blocks * ( double ) st.st_blksize;
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
#include "hbapierr.h"
|
||||
#include "hbapifs.h"
|
||||
|
||||
#if defined( HB_OS_UNIX ) && !defined( __WATCOMC__ )
|
||||
#if defined( HB_OS_UNIX ) && !( defined( __WATCOMC__ ) || defined( __CEGCC__ ) )
|
||||
#include <sys/statvfs.h>
|
||||
#endif
|
||||
|
||||
@@ -163,6 +163,7 @@ HB_FUNC( HB_DISKSPACE )
|
||||
|
||||
SetLastError( 0 );
|
||||
|
||||
#if !defined(__MINGW32CE__) && !defined(HB_WINCE)
|
||||
pGetDiskFreeSpaceEx = ( P_GDFSE ) GetProcAddress( GetModuleHandle( "kernel32.dll" ),
|
||||
"GetDiskFreeSpaceExA");
|
||||
|
||||
@@ -231,6 +232,7 @@ HB_FUNC( HB_DISKSPACE )
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
DWORD dwSectorsPerCluster;
|
||||
DWORD dwBytesPerSector;
|
||||
@@ -327,7 +329,7 @@ HB_FUNC( HB_DISKSPACE )
|
||||
else
|
||||
hb_fsSetIOError( FALSE, 0 );
|
||||
}
|
||||
#elif defined(HB_OS_UNIX) && !defined(__WATCOMC__)
|
||||
#elif defined(HB_OS_UNIX) && !( defined(__WATCOMC__) || defined(__CEGCC__) )
|
||||
{
|
||||
struct statvfs sf;
|
||||
BOOL fFree = FALSE;
|
||||
|
||||
@@ -123,13 +123,14 @@
|
||||
#if ( defined(__DMC__) || defined(__BORLANDC__) || defined(__IBMCPP__) || defined(_MSC_VER) || \
|
||||
defined(__MINGW32__) || defined(__WATCOMC__) ) && !defined( HB_OS_UNIX )
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <process.h>
|
||||
#if !defined( __POCC__ ) && !defined( __XCC__ )
|
||||
#include <share.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <direct.h>
|
||||
#include <process.h>
|
||||
#if !defined(__MINGW32CE__)
|
||||
#include <direct.h>
|
||||
#endif
|
||||
#if defined(__BORLANDC__)
|
||||
#include <dir.h>
|
||||
#include <dos.h>
|
||||
@@ -153,7 +154,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#if defined(__CYGWIN__)
|
||||
#include <io.h>
|
||||
#elif defined(__DJGPP__)
|
||||
@@ -1182,10 +1182,7 @@ HB_EXPORT void hb_fsCommit( FHANDLE hFileHandle )
|
||||
#elif defined(HB_OS_OS2)
|
||||
|
||||
{
|
||||
errno = 0;
|
||||
/* TODO: what about error code from DosResetBuffer() call? */
|
||||
DosResetBuffer( hFileHandle );
|
||||
hb_fsSetIOError( errno == 0, 0 );
|
||||
hb_fsSetIOError( DosResetBuffer( hFileHandle ) == 0, 0 );
|
||||
}
|
||||
|
||||
#elif defined(HB_OS_UNIX)
|
||||
|
||||
@@ -57,7 +57,9 @@
|
||||
#include "hbapi.h"
|
||||
#include "hbapifs.h"
|
||||
#include "hb_io.h"
|
||||
#include <errno.h>
|
||||
#if !defined(__MINGW32CE__)
|
||||
# include <errno.h>
|
||||
#endif
|
||||
|
||||
static USHORT s_uiFError = 0;
|
||||
static USHORT s_uiErrorLast = 0;
|
||||
|
||||
@@ -58,12 +58,12 @@
|
||||
#include "hbapi.h"
|
||||
#include "hbapifs.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
HB_FOFFSET hb_fsFSize( BYTE * pszFileName, BOOL bUseDirEntry )
|
||||
{
|
||||
#if !defined(__MINGW32CE__) && !defined(HB_WINCE)
|
||||
if( bUseDirEntry )
|
||||
{
|
||||
BOOL fResult;
|
||||
@@ -84,6 +84,7 @@ HB_FOFFSET hb_fsFSize( BYTE * pszFileName, BOOL bUseDirEntry )
|
||||
return ( HB_FOFFSET ) statbuf.st_size;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
FHANDLE hFileHandle = hb_fsOpen( pszFileName, 0 );
|
||||
|
||||
|
||||
@@ -403,24 +403,30 @@ static int hb_gt_chrmapread( const char *pszFile, const char *pszTerm, int *nTra
|
||||
|
||||
int hb_gt_chrmapinit( int *piTransTbl, const char *pszTerm, BOOL fSetACSC )
|
||||
{
|
||||
char *pszFile, szFile[ _POSIX_PATH_MAX + 1 ];
|
||||
char *pszFree = NULL, *pszFile, szFile[ _POSIX_PATH_MAX + 1 ];
|
||||
int nRet = -1;
|
||||
|
||||
chrmap_init( piTransTbl );
|
||||
|
||||
if( pszTerm == NULL || *pszTerm == '\0' )
|
||||
pszTerm = getenv("HB_TERM");
|
||||
pszTerm = pszFree = hb_getenv("HB_TERM");
|
||||
if( pszTerm == NULL || *pszTerm == '\0' )
|
||||
pszTerm = getenv("TERM");
|
||||
{
|
||||
if( pszFree )
|
||||
hb_xfree( pszFree );
|
||||
pszTerm = pszFree = hb_getenv("TERM");
|
||||
}
|
||||
|
||||
if( pszTerm != NULL && *pszTerm != '\0' )
|
||||
{
|
||||
pszFile = getenv( "HB_CHARMAP" );
|
||||
pszFile = hb_getenv( "HB_CHARMAP" );
|
||||
if( pszFile != NULL && *pszFile != '\0' )
|
||||
nRet = hb_gt_chrmapread( pszFile, pszTerm, piTransTbl );
|
||||
if( nRet == -1 )
|
||||
{
|
||||
pszFile = getenv( "HB_ROOT" );
|
||||
if( pszFile )
|
||||
hb_xfree( pszFile );
|
||||
pszFile = hb_getenv( "HB_ROOT" );
|
||||
if( pszFile != NULL && sizeof( szFile ) >
|
||||
strlen( pszFile ) + strlen( s_szDefaultCharMapFile ) )
|
||||
{
|
||||
@@ -429,10 +435,15 @@ int hb_gt_chrmapinit( int *piTransTbl, const char *pszTerm, BOOL fSetACSC )
|
||||
nRet = hb_gt_chrmapread( szFile, pszTerm, piTransTbl );
|
||||
}
|
||||
}
|
||||
if( pszFile )
|
||||
hb_xfree( pszFile );
|
||||
if( nRet == -1 )
|
||||
nRet = hb_gt_chrmapread( s_szDefaultCharMapFile, pszTerm, piTransTbl );
|
||||
}
|
||||
|
||||
if( pszFree )
|
||||
hb_xfree( pszFree );
|
||||
|
||||
if( nRet == -1 )
|
||||
{
|
||||
chrmap_dotctrl( piTransTbl );
|
||||
|
||||
@@ -66,13 +66,14 @@
|
||||
|
||||
#if defined( HB_OS_WIN_32 )
|
||||
|
||||
#if defined(_MSC_VER) || defined(__WATCOMC__)
|
||||
#include <conio.h>
|
||||
#endif
|
||||
|
||||
#if defined( HB_ARCH_32BIT ) && \
|
||||
#if defined( HB_ARCH_32BIT ) && !defined( _M_ARM ) && \
|
||||
( defined(__BORLANDC__) || defined(_MSC_VER) || \
|
||||
defined(__WATCOMC__) || defined(__MINGW32__) )
|
||||
|
||||
#if defined(_MSC_VER) || defined(__WATCOMC__)
|
||||
#include <conio.h>
|
||||
#endif
|
||||
|
||||
static int hb_Inp9x( USHORT usPort )
|
||||
{
|
||||
USHORT usVal;
|
||||
@@ -258,7 +259,7 @@ void hb_gt_w32_Tone( double dFrequency, double dDuration )
|
||||
/* If Windows 95 or 98, use w9xTone for BCC32, MSVC */
|
||||
if( s_osv.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
|
||||
{
|
||||
#if defined( HB_ARCH_32BIT ) && \
|
||||
#if defined( HB_ARCH_32BIT ) && !defined( _M_ARM ) && \
|
||||
( defined( __BORLANDC__ ) || defined( _MSC_VER ) || \
|
||||
defined( __WATCOMC__ ) || defined(__MINGW32__) )
|
||||
hb_gt_w9xTone( dFrequency, dDuration );
|
||||
|
||||
@@ -86,10 +86,6 @@
|
||||
|
||||
#include "gtwvt.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <conio.h>
|
||||
#endif
|
||||
|
||||
static HB_GT_FUNCS SuperTable;
|
||||
#define HB_GTSUPER (&SuperTable)
|
||||
|
||||
|
||||
@@ -76,7 +76,6 @@ HB_FILE_VER( "$Id$" )
|
||||
|
||||
#if defined(__DJGPP__) || defined(__RSX32__)
|
||||
#include <sys/param.h>
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#if defined(__DJGPP__) || defined(__RSX32__) || defined(__BORLANDC__)
|
||||
#include <sys/stat.h>
|
||||
@@ -127,8 +126,6 @@ HB_FILE_VER( "$Id$" )
|
||||
|
||||
#elif defined(HB_OS_WIN_32)
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HANDLE hFindFile;
|
||||
@@ -147,7 +144,6 @@ HB_FILE_VER( "$Id$" )
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
@@ -61,7 +61,6 @@
|
||||
#include "hbapiitm.h"
|
||||
#include "hbapierr.h"
|
||||
|
||||
|
||||
/* HB_INET_H_ */
|
||||
#if defined( HB_OS_DOS )
|
||||
|
||||
@@ -71,6 +70,8 @@
|
||||
|
||||
#else
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#if defined( HB_OS_WIN_32 )
|
||||
#define _WINSOCKAPI_ /* Prevents inclusion of Winsock.h in Windows.h */
|
||||
#define HB_SOCKET_T SOCKET
|
||||
@@ -170,7 +171,9 @@
|
||||
#if !defined( HB_NO_DEFAULT_INET )
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#if !defined(__MINGW32CE__)
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#if defined( HB_OS_UNIX ) || defined( OS_UNIX_COMPATIBLE ) || defined( HB_OS_BSD ) || defined(HB_OS_OS2)
|
||||
#include <sys/time.h>
|
||||
@@ -1513,6 +1516,9 @@ HB_FUNC( HB_INETSERVER )
|
||||
|
||||
HB_FUNC( HB_INETACCEPT )
|
||||
{
|
||||
#if !defined(EAGAIN)
|
||||
#define EAGAIN -1
|
||||
#endif
|
||||
HB_SOCKET_STRUCT *Socket = HB_PARSOCKET( 1 );
|
||||
HB_SOCKET_STRUCT *NewSocket;
|
||||
HB_SOCKET_T incoming = 0;
|
||||
|
||||
@@ -73,9 +73,15 @@ static int s_argc = 0;
|
||||
static char * s_argv[ MAX_ARGS ];
|
||||
static char s_szAppName[ 256 ];
|
||||
|
||||
#if defined(__MINGW32CE__) || defined(HB_WINCE)
|
||||
# define HB_SYSSTR LPWSTR
|
||||
#else
|
||||
# define HB_SYSSTR LPSTR
|
||||
#endif
|
||||
|
||||
int WINAPI WinMain( HINSTANCE hInstance, /* handle to current instance */
|
||||
HINSTANCE hPrevInstance, /* handle to previous instance */
|
||||
LPSTR lpCmdLine, /* pointer to command line */
|
||||
HB_SYSSTR lpCmdLine, /* pointer to command line */
|
||||
int iCmdShow ) /* show state of window */
|
||||
{
|
||||
LPSTR pArgs, pArg, pDst, pSrc;
|
||||
@@ -97,9 +103,14 @@ int WINAPI WinMain( HINSTANCE hInstance, /* handle to current instance */
|
||||
GetModuleFileName( hInstance, s_szAppName, sizeof( s_szAppName ) - 1 );
|
||||
s_argv[ s_argc++ ] = s_szAppName;
|
||||
|
||||
pDst = pArgs = ( LPSTR ) LocalAlloc( LMEM_FIXED, strlen( lpCmdLine ) + 1 );
|
||||
pArg = NULL;
|
||||
#if defined(__MINGW32CE__) || defined(HB_WINCE)
|
||||
pDst = pArgs = ( LPSTR ) LocalAlloc( LMEM_FIXED, strlen( ( LPSTR ) lpCmdLine ) + 1 );
|
||||
pSrc = ( LPSTR ) lpCmdLine;
|
||||
#else
|
||||
pDst = pArgs = ( LPSTR ) LocalAlloc( LMEM_FIXED, strlen( lpCmdLine ) + 1 );
|
||||
pSrc = lpCmdLine;
|
||||
#endif
|
||||
fQuoted = FALSE;
|
||||
|
||||
while( *pSrc != 0 && s_argc < MAX_ARGS )
|
||||
|
||||
@@ -76,7 +76,9 @@
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#if !defined(__MINGW32CE__)
|
||||
# include <errno.h>
|
||||
#endif
|
||||
|
||||
#include "hbppdef.h"
|
||||
#include "hbcomp.h"
|
||||
@@ -557,11 +559,13 @@ int hb_pp_ParseDirective_( char *sLine )
|
||||
|
||||
if( !OpenInclude( sLine, hb_comp_pIncludePath, hb_comp_pFileName, ( cDelimChar == '>' ), szInclude ) )
|
||||
{
|
||||
#if !defined(__MINGW32CE__)
|
||||
if( errno == 0 || errno == EMFILE )
|
||||
hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_TOO_MANY_INCLUDES, sLine, NULL );
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#if defined(__CYGWIN__) || defined(__IBMCPP__) || defined(__LCC__)
|
||||
#if defined(__CYGWIN__) || defined(__MINGW32CE__) || defined(__IBMCPP__) || defined(__LCC__)
|
||||
hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_CANNOT_OPEN, sLine, "" );
|
||||
#else
|
||||
hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_CANNOT_OPEN, sLine, strerror( errno ) );
|
||||
@@ -4734,7 +4738,9 @@ static BOOL OpenInclude( char *szFileName, HB_PATHNAMES * pSearch, PHB_FNAME pMa
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( "OpenInclude(%s, %p, %p, %d, %s)", szFileName, pSearch, pMainFileName, ( int ) bStandardOnly, szInclude ) );
|
||||
|
||||
#if !defined(__MINGW32CE__)
|
||||
errno = 0;
|
||||
#endif
|
||||
if( bStandardOnly )
|
||||
{
|
||||
fptr = 0;
|
||||
@@ -4753,7 +4759,11 @@ static BOOL OpenInclude( char *szFileName, HB_PATHNAMES * pSearch, PHB_FNAME pMa
|
||||
hb_xfree( pFileName );
|
||||
}
|
||||
|
||||
#if defined(__MINGW32CE__)
|
||||
if( !fptr && pSearch )
|
||||
#else
|
||||
if( !fptr && pSearch && errno != EMFILE )
|
||||
#endif
|
||||
{
|
||||
pFileName = hb_fsFNameSplit( szFileName );
|
||||
pFileName->szName = szFileName;
|
||||
|
||||
@@ -60,9 +60,11 @@
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if ! defined(__MINGW32CE__)
|
||||
# include <errno.h>
|
||||
#endif
|
||||
|
||||
#include "hbcomp.h"
|
||||
|
||||
@@ -208,6 +210,10 @@ int main( int argc, char * argv[] )
|
||||
fhChangeLog = fopen( cszChangeLogName, "rt" );
|
||||
if( fhChangeLog == NULL )
|
||||
{
|
||||
#if defined(__MINGW32CE__)
|
||||
fprintf( stderr, "error: %s\n", szErrBuf );
|
||||
return 4;
|
||||
#else
|
||||
switch( errno )
|
||||
{
|
||||
case ENOENT:
|
||||
@@ -217,6 +223,7 @@ int main( int argc, char * argv[] )
|
||||
perror( szErrBuf );
|
||||
return 4;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
while( ! ( bFoundID && bFoundLog ) && ! feof( fhChangeLog ) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user