2007-11-12 16:09 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbapifs.h
  * harbour/source/common/hbfsapi.c
    + added hb_fsMaxFilesError()

  * harbour/source/pp/ppcore.c
  * harbour/utils/hbpp/hbppcore.c
    * use hb_fsMaxFilesError() to avoid direct accessing of errno
      value - some compilers/platforms do not support errno

  * harbour/include/hbdate.h
  * harbour/source/rtl/seconds.c
    + added hb_dateMilliSeconds()

  * harbour/source/rtl/hbgtcore.c
  * harbour/source/rtl/idle.c
  * harbour/source/rtl/inkey.c
    * use hb_dateMilliSeconds() to avoid using clock_t clock()
      some compilers/platforms do not support it

  * harbour/include/hbwince.h
  * harbour/source/common/hbwince.c
    * disabled clock_t clock() emulation - it's not longer used
    + added some declarations for ANSI functions emulated by us
      for WinCE and some defines - code sent by Marek Paliwoda

  * harbour/include/hbwmain.c
  * harbour/source/vm/mainwin.c
    * always use unicode translations with WinMain() parameters for compilers
      which do not set UNICODE macro for WinCE

  * harbour/source/rtl/fserror.c
    * do not include errno.h for HB_WIN32_IO - it's not necessary

  * harbour/utils/hbver/hbverfix.c
    * do not include errno.h for _MSC_VER and HB_WINCE builds

  * harbour/contrib/libmisc/dates2.c
    - commented DATETIME() function - this was not standard DATETIME()
      value but raw ctime() function output and some compilers/platforms
      do not support ctime()

  * harbour/contrib/libnf/getenvrn.c
    + added HB_OS_WIN_32_USED

  * harbour/contrib/mtpl.mak
  * harbour/contrib/pdflib/pdflib.h
    * replaced TABs with SPACEs

  * harbour/include/hbsetup.ch
    ! reenabled HB_EXTENSION in default builds - disabling it makes
      a lot of RDD code unusable and breaks default builds due to
      insufficient dependences
This commit is contained in:
Przemyslaw Czerpak
2007-11-12 15:10:28 +00:00
parent 0c9e8572bf
commit 5de7824e15
21 changed files with 308 additions and 158 deletions

View File

@@ -8,6 +8,60 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-11-12 16:09 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapifs.h
* harbour/source/common/hbfsapi.c
+ added hb_fsMaxFilesError()
* harbour/source/pp/ppcore.c
* harbour/utils/hbpp/hbppcore.c
* use hb_fsMaxFilesError() to avoid direct accessing of errno
value - some compilers/platforms do not support errno
* harbour/include/hbdate.h
* harbour/source/rtl/seconds.c
+ added hb_dateMilliSeconds()
* harbour/source/rtl/hbgtcore.c
* harbour/source/rtl/idle.c
* harbour/source/rtl/inkey.c
* use hb_dateMilliSeconds() to avoid using clock_t clock()
some compilers/platforms do not support it
* harbour/include/hbwince.h
* harbour/source/common/hbwince.c
* disabled clock_t clock() emulation - it's not longer used
+ added some declarations for ANSI functions emulated by us
for WinCE and some defines - code sent by Marek Paliwoda
* harbour/include/hbwmain.c
* harbour/source/vm/mainwin.c
* always use unicode translations with WinMain() parameters for compilers
which do not set UNICODE macro for WinCE
* harbour/source/rtl/fserror.c
* do not include errno.h for HB_WIN32_IO - it's not necessary
* harbour/utils/hbver/hbverfix.c
* do not include errno.h for _MSC_VER and HB_WINCE builds
* harbour/contrib/libmisc/dates2.c
- commented DATETIME() function - this was not standard DATETIME()
value but raw ctime() function output and some compilers/platforms
do not support ctime()
* harbour/contrib/libnf/getenvrn.c
+ added HB_OS_WIN_32_USED
* harbour/contrib/mtpl.mak
* harbour/contrib/pdflib/pdflib.h
* replaced TABs with SPACEs
* harbour/include/hbsetup.ch
! reenabled HB_EXTENSION in default builds - disabling it makes
a lot of RDD code unusable and breaks default builds due to
insufficient dependences
2007-11-12 01:25 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbmake/hbmake.prg
! Fixed warnings.

View File

@@ -301,6 +301,7 @@ HB_FUNC( BOY )
hb_retdl( 0 );
}
/*
HB_FUNC( DATETIME )
{
time_t current_time;
@@ -309,3 +310,4 @@ HB_FUNC( DATETIME )
hb_retc( ctime( &current_time ) );
}
*/

View File

@@ -101,6 +101,8 @@
#include "extend.api"
#include "fm.api"
*/
#define HB_OS_WIN_32_USED
#include "hbapi.h"
#if defined(OS_UNIX_COMPATIBLE)

View File

@@ -9,7 +9,7 @@
#**********************************************************
# NOTE: "echo." intentionally used instead of "echo", to avoid conflicts
# with external commands named echo.
# with external commands named echo.
!ifndef ECHO
ECHO = echo.

View File

@@ -49,25 +49,25 @@
#ifdef WIN32
#define PDFLIB_CALL __cdecl
#define PDFLIB_CALL __cdecl
#ifdef PDFLIB_EXPORTS
#define PDFLIB_API __declspec(dllexport) /* prepare a DLL (PDFlib-internal use only) */
#define PDFLIB_API __declspec(dllexport) /* prepare a DLL (PDFlib-internal use only) */
#elif defined(PDFLIB_DLL)
#define PDFLIB_API __declspec(dllimport) /* PDFlib clients - import PDFlib DLL fcts. */
#define PDFLIB_API __declspec(dllimport) /* PDFlib clients - import PDFlib DLL fcts. */
#else /* !PDFLIB_DLL */
#define PDFLIB_API /* */ /* default: generate or use static library */
#else /* !PDFLIB_DLL */
#define PDFLIB_API /* */ /* default: generate or use static library */
#endif /* !PDFLIB_DLL */
#endif /* !PDFLIB_DLL */
#else /* !WIN32 */
#else /* !WIN32 */
#if (((defined __IBMC__) || (defined __IBMCPP__)) && (defined __DLL__))
#define PDFLIB_CALL _Export
#define PDFLIB_API
#endif /* IBM VisualAge C++ DLL */
#endif /* IBM VisualAge C++ DLL */
#ifndef PDFLIB_CALL
#define PDFLIB_CALL
@@ -76,7 +76,7 @@
#define PDFLIB_API
#endif
#endif /* !WIN32 */
#endif /* !WIN32 */
/* Make our declarations C++ compatible */
#ifdef __cplusplus
@@ -103,11 +103,11 @@ typedef struct PDF_s PDF;
*/
/* PDFlib version number, major part */
#define PDFLIB_MAJORVERSION 3
#define PDFLIB_MAJORVERSION 3
/* PDFlib version number, minor part (must use two decimal places if != 0) */
#define PDFLIB_MINORVERSION 02
#define PDFLIB_VERSIONSTRING "3.02"
#define PDFLIB_MINORVERSION 02
#define PDFLIB_VERSIONSTRING "3.02"
/*
* ActiveX uses the Class ID;
@@ -152,7 +152,7 @@ PDF_new2(errorproc errorhandler,
PDFLIB_API void * PDFLIB_CALL
PDF_get_opaque(PDF *p);
#endif /* !SWIG */
#endif /* !SWIG */
/* Create a new PDF object. */
PDFLIB_API PDF * PDFLIB_CALL
@@ -180,7 +180,7 @@ PDF_open_fp(PDF *p, FILE *fp);
/* Open a new PDF in memory, and install a callback for fetching the data */
PDFLIB_API void PDFLIB_CALL
PDF_open_mem(PDF *p, size_t (*writeproc)(PDF *p, void *data, size_t size));
#endif /* !defined(SWIG) */
#endif /* !defined(SWIG) */
/* Get the contents of the PDF output buffer. The result must be used
by the client before calling any other PDFlib function. Must not be
@@ -211,7 +211,7 @@ PDF_end_page(PDF *p);
#define PDF_NonfatalError 11
#define PDF_UnknownError 12
#endif /* !SWIG */
#endif /* !SWIG */
/* Set some PDFlib parameter with string type */
PDFLIB_API void PDFLIB_CALL
@@ -332,7 +332,7 @@ PDF_setpolydash(PDF *p, float *dasharray, int length);
#ifndef SWIG
/* Maximum length of dash arrays */
#define MAX_DASH_LENGTH 8
#define MAX_DASH_LENGTH 8
#endif
/* Set the flatness to a value between 0 and 100 inclusive. */
@@ -536,7 +536,7 @@ PDF_close_image(PDF *p, int image);
help with preparing the thumbnail, but simply places it in the output. */
PDFLIB_API void PDFLIB_CALL
PDF_add_thumbnail(PDF *p, int im);
#endif /* PDF_THUMBNAILS_SUPPORTED */
#endif /* PDF_THUMBNAILS_SUPPORTED */
/*
* ----------------------------------------------------------------------
@@ -648,34 +648,34 @@ Acrobat 4 maximum page size: 200" = 14400 pt = 508 cm
/* The page sizes are only available to the C and C++ bindings */
#ifndef SWIG
#define a0_width (float) 2380.0
#define a0_height (float) 3368.0
#define a1_width (float) 1684.0
#define a1_height (float) 2380.0
#define a2_width (float) 1190.0
#define a2_height (float) 1684.0
#define a3_width (float) 842.0
#define a3_height (float) 1190.0
#define a4_width (float) 595.0
#define a4_height (float) 842.0
#define a5_width (float) 421.0
#define a5_height (float) 595.0
#define a6_width (float) 297.0
#define a6_height (float) 421.0
#define b5_width (float) 501.0
#define b5_height (float) 709.0
#define letter_width (float) 612.0
#define letter_height (float) 792.0
#define legal_width (float) 612.0
#define legal_height (float) 1008.0
#define ledger_width (float) 1224.0
#define ledger_height (float) 792.0
#define p11x17_width (float) 792.0
#define p11x17_height (float) 1224.0
#define a0_width (float) 2380.0
#define a0_height (float) 3368.0
#define a1_width (float) 1684.0
#define a1_height (float) 2380.0
#define a2_width (float) 1190.0
#define a2_height (float) 1684.0
#define a3_width (float) 842.0
#define a3_height (float) 1190.0
#define a4_width (float) 595.0
#define a4_height (float) 842.0
#define a5_width (float) 421.0
#define a5_height (float) 595.0
#define a6_width (float) 297.0
#define a6_height (float) 421.0
#define b5_width (float) 501.0
#define b5_height (float) 709.0
#define letter_width (float) 612.0
#define letter_height (float) 792.0
#define legal_width (float) 612.0
#define legal_height (float) 1008.0
#define ledger_width (float) 1224.0
#define ledger_height (float) 792.0
#define p11x17_width (float) 792.0
#define p11x17_height (float) 1224.0
#endif
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* PDFLIB_H */
#endif /* PDFLIB_H */

View File

@@ -229,6 +229,7 @@ extern USHORT hb_fsAttrEncode( const char * szAttr );
extern char * hb_fsAttrDecode( USHORT uiAttr, char * szAttr );
extern HB_EXPORT BYTE * hb_fsNameConv( BYTE * szFileName, BOOL * pfFree );
extern HB_EXPORT BYTE * hb_fileNameConv( char *str );
extern HB_EXPORT BOOL hb_fsMaxFilesError( void );
/* wrapper to fopen() which calls hb_fsNameConv() */
extern FILE * hb_fopen( const char *path, const char *mode );

View File

@@ -58,6 +58,7 @@
HB_EXTERN_BEGIN
extern HB_EXPORT double hb_dateSeconds( void );
extern HB_EXPORT HB_ULONG hb_dateMilliSeconds( void );
extern HB_EXPORT double hb_secondsCPU( int n );
extern HB_EXPORT void hb_dateTimeStamp( LONG * plJulian, LONG * plMilliSec );
extern HB_EXPORT char * hb_timeStampStr( char * szTime, LONG lMillisec );

View File

@@ -59,7 +59,7 @@
/* NOTE: You can select here, which features you want to include of the
different Clipper implementations. */
/* #define HB_EXTENSION */ /* Enable Harbour extensions */
#define HB_EXTENSION /* Enable Harbour extensions */
#define HB_C52_UNDOC /* Enable CA-Cl*pper 5.2e undocumented features */
/* #define HB_C52_STRICT */ /* Enable CA-Cl*pper 5.2e strict compatibility */
#define HB_COMPAT_C53 /* Enable CA-Cl*pper 5.3x extensions */

View File

@@ -53,6 +53,8 @@
#ifndef HB_WINCE_H_
#define HB_WINCE_H_
#if defined(HB_OS_WIN_32)
HB_EXTERN_BEGIN
#if defined(HB_WINCE)
@@ -60,7 +62,7 @@ HB_EXTERN_BEGIN
/* defined(__CEGCC__) || defined(__MINGW32CE__) */
#if defined(__MINGW32CE__)
#if defined(__MINGW32CE__) && 0
typedef long clock_t;
extern clock_t clock( void );
#endif
@@ -70,9 +72,81 @@ extern int access( const char *pathname, int mode );
extern int system( const char *string );
extern char *strerror( int errnum );
#endif /* HB_WINCE */
#if defined( HB_OS_WIN_32_USED ) && defined( _MSC_VER )
#if defined(HB_OS_WIN_32)
#ifndef MAX_COMPUTERNAME_LENGTH
#define MAX_COMPUTERNAME_LENGTH 31
#define SEM_FAILCRITICALERRORS 0x0001
#define FILE_TYPE_CHAR 0x0002
#define FILE_ATTRIBUTE_DEVICE 0x00000040
#define STD_INPUT_HANDLE (DWORD)-10
#define STD_OUTPUT_HANDLE (DWORD)-11
#define STD_ERROR_HANDLE (DWORD)-12
#define LOCKFILE_FAIL_IMMEDIATELY 0x00000001
#define LOCKFILE_EXCLUSIVE_LOCK 0x00000002
#define OEM_FIXED_FONT SYSTEM_FONT
#define WM_NCMOUSEMOVE 0x00A0
#define WM_QUERYENDSESSION 0x0011
#define WM_ENTERIDLE 0x0121
#define SM_CMOUSEBUTTONS 43
#define PROOF_QUALITY 2
#define LR_LOADFROMFILE 0x0010
#endif
DWORD WINAPI GetEnvironmentVariableA( LPCSTR name, LPSTR value, DWORD size );
LPSTR WINAPI GetEnvironmentStringsA( void );
BOOL WINAPI GetProcessTimes( HANDLE hprocess,
LPFILETIME lpCreationTime, LPFILETIME lpExitTime,
LPFILETIME lpKernelTime, LPFILETIME lpUserTime );
BOOL WINAPI GetUserNameA( LPSTR buffer, LPDWORD len );
BOOL WINAPI GetComputerNameA( LPSTR buffer, LPDWORD len );
DWORD WINAPI GetCurrentDirectoryA( DWORD len, LPSTR buffer );
BOOL WINAPI SetCurrentDirectoryA( LPCSTR dirname );
BOOL WINAPI LockFile( HANDLE hFile,
DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh,
DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh );
BOOL WINAPI LockFileEx( HANDLE hFile,
DWORD dwFlags, DWORD dwReserved,
DWORD nNumberOfBytesToLockLow,
DWORD nNumberOfBytesToLockHigh, LPOVERLAPPED lpOverlapped );
BOOL WINAPI UnlockFile( HANDLE hFile,
DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh,
DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh );
BOOL WINAPI UnlockFileEx( HANDLE hFile, DWORD dwReserved,
DWORD nNumberOfBytesToUnlockLow,
DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped );
BOOL WINAPI GetVolumeInformationA( LPCSTR p1, LPSTR p2, DWORD p3, PDWORD p4,
PDWORD p5, PDWORD p6, LPSTR p7, DWORD p8 );
UINT WINAPI SetErrorMode( UINT mode );
HANDLE WINAPI CreateFileA( LPCSTR filename, DWORD access,
DWORD sharing, LPSECURITY_ATTRIBUTES sa,
DWORD creation, DWORD attributes, HANDLE template );
BOOL WINAPI MoveFileA( LPCSTR fn1, LPCSTR fn2 );
BOOL WINAPI DeleteFileA( LPCSTR path );
BOOL WINAPI RemoveDirectoryA( LPCSTR path );
BOOL WINAPI CreateDirectoryA( LPCSTR path, LPSECURITY_ATTRIBUTES attr );
BOOL WINAPI CharToOemBuffA( LPCSTR src, LPSTR dst, DWORD len );
BOOL WINAPI OemToCharBuffA( LPCSTR src, LPSTR dst, DWORD len );
HANDLE WINAPI FindFirstFileA( LPCSTR path, WIN32_FIND_DATAA * data );
BOOL WINAPI FindNextFileA( HANDLE handle, WIN32_FIND_DATAA * data );
BOOL WINAPI GetVersionExA( OSVERSIONINFOA * v );
HANDLE WINAPI GetStdHandle( DWORD nStdHandle );
DWORD WINAPI GetFileType( HANDLE handle );
HMODULE WINAPI GetModuleHandleA( LPCSTR modulename );
HINSTANCE WINAPI LoadLibraryA( LPCSTR libname );
DWORD WINAPI GetTempPathA( DWORD size, LPSTR buffer );
UINT WINAPI GetTempFileNameA( LPCSTR tmpdir, LPCSTR prefix, UINT unique, LPSTR filename );
BOOL WINAPI GetDiskFreeSpaceA( LPCSTR path, PDWORD pdwSectorsPerCluster,
PDWORD pdwBytesPerSector,
PDWORD pdwNumberOfFreeClusters, PDWORD pdwTotalNumberOfClusters );
BOOL WINAPI Beep( DWORD dwFreq, DWORD dwDurat );
int WINAPI SetTextCharacterExtra( HDC hdc, int i );
BOOL WINAPI GetKeyboardState( PBYTE p );
BOOL WINAPI SetKeyboardState( PBYTE p );
#endif /* HB_OS_WIN_32_USED && _MSC_VER */
#endif /* HB_WINCE */
extern wchar_t * hb_mbtowc( const char *srcA );
extern char * hb_wctomb( const wchar_t *srcW );
@@ -106,8 +180,8 @@ extern void hb_wctombget( char *dstA, const wchar_t *srcW, unsigned long ulLen )
#endif /* UNICODE */
#endif /* HB_OS_WIN_32 */
HB_EXTERN_END
#endif /* HB_OS_WIN_32 */
#endif /* HB_WINCE_H_ */

View File

@@ -84,9 +84,9 @@ int WINAPI WinMain( HINSTANCE hInstance, /* handle to current instance */
pArg = NULL;
#if defined( HB_WINCE )
pSrc = pFree = HB_TCHAR_CONVFROM( lpCmdLine );
pSrc = pFree = hb_wctomb( lpCmdLine );
#else
pSrc = pFree = lpCmdLine;
pSrc = pFree = HB_TCHAR_CONVFROM( lpCmdLine );
#endif
pDst = pArgs = ( LPSTR ) LocalAlloc( LMEM_FIXED, strlen( pFree ) + 1 );
fQuoted = FALSE;

View File

@@ -64,6 +64,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#endif
#if !defined( HB_WIN32_IO )
#include <errno.h>
#endif
/* NOTE: Not really belongs here, but until we can't find a better place
it will do it. [vszakats] */
@@ -330,7 +333,6 @@ HB_EXPORT BOOL hb_fsFileExists( const char * pszFileName )
return fExist;
}
HB_EXPORT BOOL hb_fsDirExists( const char * pszDirName )
{
BOOL fExist;
@@ -382,3 +384,14 @@ HB_EXPORT BOOL hb_fsDirExists( const char * pszDirName )
return fExist;
}
HB_EXPORT BOOL hb_fsMaxFilesError( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_fsMaxFilesError()"));
#if defined( HB_WIN32_IO )
return GetLastError() == ERROR_TOO_MANY_OPEN_FILES;
#else
return errno == EMFILE;
#endif
}

View File

@@ -65,7 +65,7 @@
#if defined(HB_WINCE)
#if defined(__MINGW32CE__)
#if defined(__MINGW32CE__) && 0
clock_t clock( void )
{
SYSTEMTIME st;
@@ -100,7 +100,7 @@ int access( const char *filename, int mode )
int system( const char *cmd )
{
LPWSTR wcmd;
STARTUPINFO si;
STARTUPINFOW si;
PROCESS_INFORMATION pi;
BOOL b;
@@ -111,16 +111,16 @@ int system( const char *cmd )
wcmd = hb_mbtowc( cmd );
/* Start the child process. */
b = CreateProcess( NULL, /* No module name (use command line) */
wcmd, /* Command line */
NULL, /* Process handle not inheritable */
NULL, /* Thread handle not inheritable */
FALSE, /* Set handle inheritance to FALSE */
0, /* No creation flags */
NULL, /* Use parent's environment block */
NULL, /* Use parent's starting directory */
&si, /* Pointer to STARTUPINFO structure */
&pi ); /* Pointer to PROCESS_INFORMATION structure */
b = CreateProcessW( NULL, /* No module name (use command line) */
wcmd, /* Command line */
NULL, /* Process handle not inheritable */
NULL, /* Thread handle not inheritable */
FALSE, /* Set handle inheritance to FALSE */
0, /* No creation flags */
NULL, /* Use parent's environment block */
NULL, /* Use parent's starting directory */
&si, /* Pointer to STARTUPINFO structure */
&pi ); /* Pointer to PROCESS_INFORMATION structure */
hb_xfree( wcmd );
@@ -137,7 +137,7 @@ int system( const char *cmd )
return b ? 0 : -1;
}
char *strerror( int errnum )
char * strerror( int errnum )
{
HB_SYMBOL_UNUSED( errnum );
@@ -148,7 +148,7 @@ char *strerror( int errnum )
#if defined(HB_OS_WIN_32)
void hb_mbtowccpy( wchar_t * dstW, const char *srcA, ULONG ulLen )
void hb_mbtowccpy( wchar_t *dstW, const char *srcA, ULONG ulLen )
{
MultiByteToWideChar( CP_ACP, 0, srcA, -1, dstW, ulLen / sizeof( wchar_t ) );
}
@@ -237,7 +237,7 @@ DWORD WINAPI GetEnvironmentVariableA( LPCSTR name, LPSTR value, DWORD size )
cbData = MAX_PATH * sizeof( *buf );
wname = hb_mbtowc( name );
lret = RegQueryValueEx( hk, wname, NULL, &dwType, lpData, &cbData );
lret = RegQueryValueExW( hk, wname, NULL, &dwType, lpData, &cbData );
RegCloseKey( hk );
if( lret != ERROR_SUCCESS )
@@ -248,7 +248,7 @@ DWORD WINAPI GetEnvironmentVariableA( LPCSTR name, LPSTR value, DWORD size )
return 0;
}
avalue = hb_wctomb( ( LPCTSTR ) lpData );
avalue = hb_wctomb( ( LPCWSTR ) lpData );
if( value && size )
hb_strncpy( value, avalue, size - 1 );
size = strlen( avalue );
@@ -575,7 +575,7 @@ HINSTANCE WINAPI LoadLibraryA( LPCSTR libname )
DWORD WINAPI GetTempPathA( DWORD size, LPSTR buffer )
{
TCHAR wbuffer[MAX_PATH] = { 0 };
WCHAR wbuffer[MAX_PATH] = { 0 };
char *abuffer;
DWORD dw;
@@ -590,7 +590,7 @@ DWORD WINAPI GetTempPathA( DWORD size, LPSTR buffer )
UINT WINAPI GetTempFileNameA( LPCSTR tmpdir, LPCSTR prefix, UINT unique, LPSTR filename )
{
LPWSTR wtmpdir, wprefix;
TCHAR wfilename[MAX_PATH] = { 0 };
WCHAR wfilename[MAX_PATH] = { 0 };
UINT u;
wtmpdir = hb_mbtowc( tmpdir );

View File

@@ -58,9 +58,6 @@
#include "hbpp.h"
#include "hbdate.h"
#if !defined(__MINGW32CE__) && !defined(HB_WINCE)
# include <errno.h>
#endif
#define HB_PP_WARN_DEFINE_REDEF 1 /* C1005 */
@@ -1805,9 +1802,7 @@ static PHB_PP_FILE hb_pp_FileNew( PHB_PP_STATE pState, char * szFileName,
}
file_in = hb_fopen( szFileName, "r" );
#if !defined(__MINGW32CE__) && !defined(HB_WINCE)
fNested = errno == EMFILE;
#endif
fNested = file_in == NULL && hb_fsMaxFilesError();
}
if( !file_in )

View File

@@ -55,7 +55,7 @@
#include "hbapi.h"
#include "hbapifs.h"
#include "hb_io.h"
#if !defined(__MINGW32CE__)
#if !(defined(HB_WIN32_IO) || defined(HB_OS_WIN_32))
# include <errno.h>
#endif

View File

@@ -58,14 +58,12 @@
#define HB_GT_NAME NUL
#include <ctype.h>
#include "hbgtcore.h"
#include "hbapiitm.h"
#include "hbapifs.h"
#include "hbapierr.h"
#include "hbapicdp.h"
#include <time.h>
#include "hbdate.h"
static PHB_GT_BASE s_curGT = NULL;
static BOOL s_fVgaCell = TRUE;
@@ -100,9 +98,9 @@ static int s_iDoubleClickSpeed = 168; /* In milliseconds */
static BOOL s_fMouseVisible = FALSE;
static int s_iMouseLastRow;
static int s_iMouseLastCol;
static clock_t s_iMouseLeftTimer;
static clock_t s_iMouseRightTimer;
static clock_t s_iMouseMiddleTimer;
static HB_LONG s_iMouseLeftTimer;
static HB_LONG s_iMouseRightTimer;
static HB_LONG s_iMouseMiddleTimer;
static void * hb_gt_def_New( void )
{
@@ -323,7 +321,7 @@ static const char * hb_gt_def_ColorDecode( const char * szColorString, int * piC
while( ( c = *szColorString++ ) != 0 )
{
switch( toupper( ( UCHAR ) c ) )
switch( c )
{
case '*':
nColor |= 0x80;
@@ -340,36 +338,44 @@ static const char * hb_gt_def_ColorDecode( const char * szColorString, int * piC
bFore = FALSE;
break;
case 'b':
case 'B':
nColor |= bFore ? 0x01: 0x10;
break;
case 'g':
case 'G':
nColor |= bFore ? 0x02: 0x20;
break;
case 'r':
case 'R':
nColor |= bFore ? 0x04: 0x40;
break;
case 'w':
case 'W':
nColor |= bFore ? 0x07: 0x70;
break;
case 'n':
case 'N':
nColor &= bFore ? 0xFFF8: 0xFF8F;
break;
case 'i':
case 'I':
bFore = FALSE;
nColor &= 0x88;
nColor |= 0x70;
break;
case 'x':
case 'X':
nColor &= 0x88;
break;
case 'u':
case 'U':
if( bFore )
nColor = ( nColor & 0xF0F8 ) | 0x0801;
@@ -2314,8 +2320,8 @@ static int hb_gt_def_MouseReadKey( int iEventMask )
{
if( iEventMask & INKEY_LDOWN && hb_mouse_ButtonPressed( 0, &iRow, &iCol ) )
{
clock_t timer = clock();
if( timer - s_iMouseLeftTimer <= ( clock_t ) hb_mouse_GetDoubleClickSpeed() * 1000 / CLOCKS_PER_SEC )
HB_ULONG timer = hb_dateMilliSeconds();
if( timer - s_iMouseLeftTimer <= ( HB_ULONG ) hb_mouse_GetDoubleClickSpeed() )
iKey = K_LDBLCLK;
else
iKey = K_LBUTTONDOWN;
@@ -2327,8 +2333,8 @@ static int hb_gt_def_MouseReadKey( int iEventMask )
}
else if( iEventMask & INKEY_RDOWN && hb_mouse_ButtonPressed( 1, &iRow, &iCol ) )
{
clock_t timer = clock();
if( timer - s_iMouseRightTimer <= ( clock_t ) hb_mouse_GetDoubleClickSpeed() * 1000 / CLOCKS_PER_SEC )
HB_ULONG timer = hb_dateMilliSeconds();
if( timer - s_iMouseRightTimer <= ( HB_ULONG ) hb_mouse_GetDoubleClickSpeed() )
iKey = K_RDBLCLK;
else
iKey = K_RBUTTONDOWN;
@@ -2340,8 +2346,8 @@ static int hb_gt_def_MouseReadKey( int iEventMask )
}
else if( iEventMask & INKEY_MMIDDLE && hb_mouse_ButtonPressed( 2, &iRow, &iCol ) )
{
clock_t timer = clock();
if( timer - s_iMouseMiddleTimer <= ( clock_t ) hb_mouse_GetDoubleClickSpeed() * 1000 / CLOCKS_PER_SEC )
HB_ULONG timer = hb_dateMilliSeconds();
if( timer - s_iMouseMiddleTimer <= ( HB_ULONG ) hb_mouse_GetDoubleClickSpeed() )
iKey = K_MDBLCLK;
else
iKey = K_MBUTTONDOWN;

View File

@@ -71,6 +71,7 @@
#include "hbapiitm.h"
#include "hbset.h"
#include "hbvm.h"
#include "hbdate.h"
#include "error.ch"
#if defined( HB_OS_UNIX )
#ifndef __USE_POSIX199309
@@ -213,23 +214,15 @@ void hb_idleShutDown( void )
void hb_idleSleep( double dSeconds )
{
#if defined( HB_OS_UNIX )
/* NOTE: clock() returns a time used by a program - if it is suspended
* then this time will be zero
*/
clock_t end_clock;
struct tms tm;
end_clock = times( &tm ) + ( clock_t ) ( dSeconds * sysconf(_SC_CLK_TCK) );
while( times( &tm ) < end_clock )
#else
clock_t end_clock = clock() + ( clock_t ) ( dSeconds * CLOCKS_PER_SEC );
while( clock() < end_clock )
#endif
if( dSeconds >= 0 )
{
hb_idleState();
HB_ULONG end_timer = hb_dateMilliSeconds() + ( HB_ULONG ) dSeconds * 1000;
while( hb_dateMilliSeconds() < end_timer )
hb_idleState();
hb_idleReset();
}
hb_idleReset();
}
/* signal that the user code is in idle state */

View File

@@ -83,14 +83,9 @@
#include "hbapigt.h"
#include "hbvm.h"
#include "hbset.h"
#include "hbdate.h"
#include "inkey.ch"
#include <time.h>
#if defined( HB_OS_UNIX )
#include <sys/times.h>
#include <unistd.h>
#endif
static int s_defaultKeyBuffer[ HB_DEFAULT_INKEY_BUFSIZE + 1 ];
static int * s_inkeyBuffer = s_defaultKeyBuffer;
@@ -302,27 +297,15 @@ HB_EXPORT int hb_inkeyNext( int iEventMask )
HB_EXPORT int hb_inkey( BOOL fWait, double dSeconds, int iEventMask )
{
clock_t end_clock = 0;
HB_ULONG end_timer = 0;
BOOL fPop;
#if defined( HB_OS_UNIX )
/* NOTE: clock() returns a time used by a program - if it is suspended
* then this time will be zero
*/
struct tms tm;
#define _HB_CUR_CLOCK() times( &tm )
#define _HB_CLOCK_TICK sysconf(_SC_CLK_TCK)
#else
#define _HB_CUR_CLOCK() clock()
#define _HB_CLOCK_TICK CLOCKS_PER_SEC
#endif
HB_TRACE(HB_TR_DEBUG, ("hb_inkey(%d, %f, %d)", (int) fWait, dSeconds, iEventMask));
/* Wait forever ?, Use fixed value 100 for strict Clipper compatibility */
if( fWait && dSeconds * 100 >= 1 )
{
end_clock = _HB_CUR_CLOCK() + ( clock_t ) ( dSeconds * _HB_CLOCK_TICK );
end_timer = hb_dateMilliSeconds() + ( HB_ULONG ) ( dSeconds * 1000 );
}
do
@@ -343,7 +326,7 @@ HB_EXPORT int hb_inkey( BOOL fWait, double dSeconds, int iEventMask )
hb_idleState();
}
while( end_clock == 0 || end_clock > _HB_CUR_CLOCK() );
while( end_timer == 0 || end_timer > hb_dateMilliSeconds() );
hb_idleReset();

View File

@@ -59,7 +59,7 @@
#if ( defined( HB_OS_BSD ) || defined( HB_OS_LINUX ) ) && !defined( __WATCOMC__ )
#include <sys/time.h>
#else
#elif !( defined( HB_WINCE ) && defined( _MSC_VER ) )
#include <sys/timeb.h>
#endif
#if defined( OS_UNIX_COMPATIBLE )
@@ -128,6 +128,37 @@ HB_EXPORT void hb_dateTimeStamp( LONG * plJulian, LONG * plMilliSec )
#endif
}
HB_EXPORT HB_ULONG hb_dateMilliSeconds( void )
{
#if defined(HB_OS_WIN_32)
SYSTEMTIME st;
HB_TRACE(HB_TR_DEBUG, ("hb_dateMilliSeconds()"));
GetLocalTime( &st );
return ( HB_ULONG ) hb_dateEncode( st.wYear, st.wMonth, st.wDay ) * 86400000L +
( ( st.wHour * 60 + st.wMinute ) * 60 + st.wSecond ) * 1000 +
st.wMilliseconds;
#elif ( defined( HB_OS_LINUX ) || defined( HB_OS_BSD ) ) && !defined( __WATCOMC__ )
struct timeval tv;
HB_TRACE(HB_TR_DEBUG, ("hb_dateMilliSeconds()"));
gettimeofday( &tv, NULL );
return ( HB_ULONG ) tv.tv_sec * 1000 * tv.tv_usec / 1000;
#else
struct timeb tb;
HB_TRACE(HB_TR_DEBUG, ("hb_dateMilliSeconds()"));
ftime( &tb );
return ( HB_ULONG ) tb.time * 1000 * tb.millitm;
#endif
}
HB_EXPORT double hb_dateSeconds( void )
{
#if defined(HB_OS_WIN_32)
@@ -194,7 +225,11 @@ HB_FUNC( SECONDS )
HB_FUNC( HB_CLOCKS2SECS )
{
hb_retnd((double) hb_parnl( 1 ) / CLOCKS_PER_SEC );
#ifdef CLOCKS_PER_SEC
hb_retnd( ( double ) hb_parnint( 1 ) / CLOCKS_PER_SEC );
#else
hb_retnd( ( double ) hb_parnint( 1 ) / 1000 );
#endif
}
/*
@@ -211,7 +246,7 @@ HB_FUNC( HB_CLOCKS2SECS )
HB_EXPORT double hb_secondsCPU( int n )
{
double d = 0.0;
#if defined( HB_OS_WIN_32 )
#if defined( HB_OS_WIN_32 ) && !defined( OS_UNIX_COMPATIBLE )
FILETIME Create, Exit, Kernel, User;
#endif

View File

@@ -107,9 +107,9 @@ int WINAPI WinMain( HINSTANCE hInstance, /* handle to current instance */
pArg = NULL;
#if defined( HB_WINCE )
pSrc = pFree = HB_TCHAR_CONVFROM( lpCmdLine );
pSrc = pFree = hb_wctomb( lpCmdLine );
#else
pSrc = pFree = lpCmdLine;
pSrc = pFree = HB_TCHAR_CONVFROM( lpCmdLine );
#endif
pDst = pArgs = ( LPSTR ) LocalAlloc( LMEM_FIXED, strlen( pFree ) + 1 );
fQuoted = FALSE;

View File

@@ -75,19 +75,13 @@
#endif
#endif
#include <time.h>
#if !defined(__MINGW32CE__)
#if !defined(__MINGW32CE__) && !( defined( _MSC_VER ) && defined( HB_WINCE ) )
# include <errno.h>
#endif
#include "hbppdef.h"
#include "hbcomp.h"
#if defined( OS_UNIX_COMPATIBLE )
#include <sys/timeb.h>
#else
#include <sys/timeb.h>
#endif
#include "hbdate.h"
int hb_pp_ParseDefine_( char * ); /* Process #define directive */
@@ -448,17 +442,20 @@ void hb_pp_Init( void )
}
{
int iYear, iMonth, iDay;
char szResult[11];
time_t t;
struct tm *oTime;
time( &t );
oTime = localtime( &t );
snprintf( szResult, sizeof( szResult ), "\"%04d%02d%02d\"", oTime->tm_year + 1900, oTime->tm_mon + 1, oTime->tm_mday );
hb_dateToday( &iYear, &iMonth, &iDay );
hb_dateStrPut( szResult + 1, iYear, iMonth, iDay );
szResult[ 0 ] = '"';
szResult[ 9 ] = '"';
szResult[ 10 ] = '\0';
hb_pp_AddDefine_( "__DATE__", szResult );
snprintf( szResult, sizeof( szResult ), "\"%02d:%02d:%02d\"", oTime->tm_hour, oTime->tm_min, oTime->tm_sec );
hb_dateTimeStr( szResult + 1 );
szResult[ 0 ] = '"';
szResult[ 9 ] = '"';
szResult[ 10 ] = '\0';
hb_pp_AddDefine_( "__TIME__", szResult );
}
@@ -559,13 +556,11 @@ 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 )
if( hb_fsMaxFilesError() )
hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_TOO_MANY_INCLUDES, sLine, NULL );
else
#endif
{
#if defined(__CYGWIN__) || defined(__MINGW32CE__) || defined(__IBMCPP__) || defined(__LCC__)
#if defined(__CYGWIN__) || defined(__IBMCPP__) || defined(__LCC__) || defined( HB_WINCE )
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 ) );
@@ -4738,7 +4733,7 @@ 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__)
#if !defined(__MINGW32CE__) && !( defined( _MSC_VER ) && defined( HB_WINCE ) )
errno = 0;
#endif
if( bStandardOnly )
@@ -4759,11 +4754,7 @@ 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
if( !fptr && pSearch && !hb_fsMaxFilesError() )
{
pFileName = hb_fsFNameSplit( szFileName );
pFileName->szName = szFileName;

View File

@@ -64,7 +64,7 @@
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#if ! defined(__MINGW32CE__)
#if !defined(__MINGW32CE__) && !( defined( _MSC_VER ) && defined( HB_WINCE ) )
# include <errno.h>
#endif
@@ -233,7 +233,7 @@ int main( int argc, char * argv[] )
fhChangeLog = fopen( cszChangeLogName, "rt" );
if( fhChangeLog == NULL )
{
#if defined(__MINGW32CE__)
#if defined(__MINGW32CE__) || ( defined( _MSC_VER ) && defined( HB_WINCE ) )
perror( szErrBuf );
return 4;
#else