diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e536e7fdd9..0cd19c032f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,44 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-11-12 19:22 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + + harbour/include/hbassert.h + * harbour/include/hb_io.h + * harbour/source/rtl/gtstd/gtstd.c + * harbour/source/rtl/gtpca/gtpca.c + * harbour/source/rtl/fssize.c + * harbour/source/rtl/hbinet.c + * harbour/source/rtl/filesys.c + * harbour/source/compiler/hbfix.c + * harbour/source/compiler/hbpcode.c + * harbour/source/compiler/hbdead.c + * harbour/source/compiler/genc.c + * harbour/source/compiler/hbopt.c + * harbour/source/compiler/gencc.c + * harbour/source/compiler/hblbl.c + * harbour/source/compiler/hbstripl.c + * harbour/utils/hbver/hbverfix.c + * harbour/utils/hbpp/hbppcore.c + * removed dependences to unsupported by new MSVC header files + most of this modifications can be enabled also for standard Win32 + builds + + * harbour/source/common/hbwince.c + * do not create dummy LocalLock() and LocalUnlock() function in MSVC + WinCE builds + + * harbour/source/rtl/gtwin/gtwin.c + + added HB_WINCE_USE_POCKET_CONSOLE macro which enable + console support in WINCE builds (macro suggested by Marek Paliwoda) + + * harbour/source/rtl/gtwvt/gtwvt.h + * harbour/source/rtl/gtwvt/gtwvt.c + * changed default window and font size on WinCE to values suggested + by Marek Paliwoda + + Marek if you have a while please make test with MSVC WinCE/PocketPC + builds and current SVN code. + 2007-11-12 16:09 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbapifs.h * harbour/source/common/hbfsapi.c diff --git a/harbour/include/hb_io.h b/harbour/include/hb_io.h index 5073ca1e1e..9436c62200 100644 --- a/harbour/include/hb_io.h +++ b/harbour/include/hb_io.h @@ -59,7 +59,7 @@ #if defined(__DJGPP__) || defined(__CYGWIN__) || defined(__EMX__) #include #endif -#else +#elif !defined(HB_WINCE) #include #endif #if defined(HB_OS_DOS) && !defined(__RSX32__) diff --git a/harbour/include/hbassert.h b/harbour/include/hbassert.h new file mode 100644 index 0000000000..d9300d4c8e --- /dev/null +++ b/harbour/include/hbassert.h @@ -0,0 +1,66 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * assert() wrapper + * + * Copyright 2007 Przemyslaw Czerpak + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#ifndef HB_ASSERT_H_ +#define HB_ASSERT_H_ + +#include "hbapi.h" + +#if defined( HB_WINCE ) && defined( _MSC_VER ) + #ifndef assert + #define assert(exp) ((void)0) + #endif +#else + #include +#endif /* HB_WINCE */ + +#endif /* HB_ASSERT_H_ */ diff --git a/harbour/source/common/hbwince.c b/harbour/source/common/hbwince.c index 5a9703f4c5..5101a7cceb 100644 --- a/harbour/source/common/hbwince.c +++ b/harbour/source/common/hbwince.c @@ -653,6 +653,7 @@ BOOL WINAPI SetKeyboardState( PBYTE p ) return FALSE; } +#ifndef _MSC_VER PVOID WINAPI LocalLock( HLOCAL h ) { HB_SYMBOL_UNUSED( h ); @@ -666,6 +667,7 @@ BOOL WINAPI LocalUnlock( HLOCAL h ) return FALSE; } +#endif /* _MSC_VER */ #endif /* UNICODE */ diff --git a/harbour/source/compiler/genc.c b/harbour/source/compiler/genc.c index 109309703d..c25b4b1521 100644 --- a/harbour/source/compiler/genc.c +++ b/harbour/source/compiler/genc.c @@ -26,10 +26,9 @@ * */ -#include - #include "hbcomp.h" #include "hbdate.h" +#include "hbassert.h" static void hb_compGenCReadable( HB_COMP_DECL, PFUNCTION pFunc, FILE * yyc ); static void hb_compGenCCompact( PFUNCTION pFunc, FILE * yyc ); diff --git a/harbour/source/compiler/gencc.c b/harbour/source/compiler/gencc.c index 072ac5e286..679e12352c 100644 --- a/harbour/source/compiler/gencc.c +++ b/harbour/source/compiler/gencc.c @@ -26,10 +26,9 @@ * */ -#include - #include "hbcomp.h" #include "hbdate.h" +#include "hbassert.h" #define HB_GENC_FUNC( func ) HB_PCODE_FUNC( func, PHB_LABEL_INFO ) typedef HB_GENC_FUNC( HB_GENC_FUNC_ ); diff --git a/harbour/source/compiler/hbdead.c b/harbour/source/compiler/hbdead.c index 32cd9fc813..f38162cfa0 100644 --- a/harbour/source/compiler/hbdead.c +++ b/harbour/source/compiler/hbdead.c @@ -50,10 +50,8 @@ * */ -#include - #include "hbcomp.h" - +#include "hbassert.h" /* helper structure to pass information */ typedef struct _HB_CODETRACE_INFO diff --git a/harbour/source/compiler/hbfix.c b/harbour/source/compiler/hbfix.c index b7ed717bbd..00942032a5 100644 --- a/harbour/source/compiler/hbfix.c +++ b/harbour/source/compiler/hbfix.c @@ -49,10 +49,9 @@ * If you do not wish that, delete this exception notice. * */ -#include #include "hbcomp.h" - +#include "hbassert.h" /* helper structure to pass information */ typedef struct HB_stru_fix_info diff --git a/harbour/source/compiler/hblbl.c b/harbour/source/compiler/hblbl.c index 4854d8998b..52b968615b 100644 --- a/harbour/source/compiler/hblbl.c +++ b/harbour/source/compiler/hblbl.c @@ -50,9 +50,8 @@ * */ -#include - #include "hbcomp.h" +#include "hbassert.h" #define HB_LABEL_FUNC( func ) HB_PCODE_FUNC( func, PHB_LABEL_INFO ) typedef HB_LABEL_FUNC( HB_LABEL_FUNC_ ); diff --git a/harbour/source/compiler/hbopt.c b/harbour/source/compiler/hbopt.c index 204d9b14e0..57e8efdbe8 100644 --- a/harbour/source/compiler/hbopt.c +++ b/harbour/source/compiler/hbopt.c @@ -49,9 +49,9 @@ * If you do not wish that, delete this exception notice. * */ -#include #include "hbcomp.h" +#include "hbassert.h" typedef struct HB_stru_opt_info { diff --git a/harbour/source/compiler/hbpcode.c b/harbour/source/compiler/hbpcode.c index 29782aa5eb..2d53677d6e 100644 --- a/harbour/source/compiler/hbpcode.c +++ b/harbour/source/compiler/hbpcode.c @@ -37,9 +37,8 @@ * */ -#include - #include "hbcomp.h" +#include "hbassert.h" #define HB_PSIZE_FUNC( func ) HB_PCODE_FUNC( func, HB_VOID_PTR ) diff --git a/harbour/source/compiler/hbstripl.c b/harbour/source/compiler/hbstripl.c index ab4ccbf031..6f2c2576cf 100644 --- a/harbour/source/compiler/hbstripl.c +++ b/harbour/source/compiler/hbstripl.c @@ -50,9 +50,9 @@ * If you do not wish that, delete this exception notice. * */ -#include #include "hbcomp.h" +#include "hbassert.h" typedef void HB_STRIP_INFO, * PHB_STRIP_INFO; diff --git a/harbour/source/rtl/filesys.c b/harbour/source/rtl/filesys.c index b345716a3a..9c9564fb15 100644 --- a/harbour/source/rtl/filesys.c +++ b/harbour/source/rtl/filesys.c @@ -118,17 +118,17 @@ #endif #endif -#if ( defined(__DMC__) || defined(__BORLANDC__) || defined(__IBMCPP__) || defined(_MSC_VER) || \ - defined(__MINGW32__) || defined(__WATCOMC__) ) && !defined( HB_OS_UNIX ) +#if ( defined(__DMC__) || defined(__BORLANDC__) || \ + defined(__IBMCPP__) || defined(_MSC_VER) || \ + defined(__MINGW32__) || defined(__WATCOMC__) ) && \ + !defined( HB_OS_UNIX ) && !defined( HB_WINCE ) #include #include #include #if !defined( __POCC__ ) && !defined( __XCC__ ) #include #endif - #if !defined(__MINGW32CE__) - #include - #endif + #include #if defined(__BORLANDC__) #include #include @@ -261,7 +261,7 @@ static BOOL s_fUseWaitLocks = TRUE; #if defined(HB_WIN32_IO) - #if defined( __LCC__ ) + #if defined( __LCC__ ) || ( defined( _MSC_VER ) && defined( HB_WINCE ) ) __inline void * LongToHandle( const long h ) { return((void *) (INT_PTR) h ); diff --git a/harbour/source/rtl/fssize.c b/harbour/source/rtl/fssize.c index ad920ae43c..86cdc74b43 100644 --- a/harbour/source/rtl/fssize.c +++ b/harbour/source/rtl/fssize.c @@ -58,8 +58,10 @@ #include "hbapi.h" #include "hbapifs.h" -#include -#include +#if !defined(HB_WINCE) +# include +# include +#endif HB_FOFFSET hb_fsFSize( BYTE * pszFileName, BOOL bUseDirEntry ) { diff --git a/harbour/source/rtl/gtpca/gtpca.c b/harbour/source/rtl/gtpca/gtpca.c index 5144630c0e..b4f1478694 100644 --- a/harbour/source/rtl/gtpca/gtpca.c +++ b/harbour/source/rtl/gtpca/gtpca.c @@ -61,11 +61,11 @@ #include "hbgtcore.h" #include "hbinit.h" +#include "hbapifs.h" #include "hbapicdp.h" #include "hbapiitm.h" #include "hbdate.h" #include "hb_io.h" -#include "hbset.h" #include "inkey.ch" #include @@ -84,8 +84,7 @@ #if defined( HB_WIN32_IO ) #include #endif - #if defined( _MSC_VER ) || defined( __MINGW32__ ) - #include + #if defined( _MSC_VER ) && !defined( HB_WINCE ) #include #endif #endif @@ -668,7 +667,7 @@ static int hb_gt_pca_ReadKey( int iEventMask ) case 396: /* Alt + F12 */ ch = 349 - ch; } -#elif defined( _MSC_VER ) +#elif defined( _MSC_VER ) && !defined( HB_WINCE ) if( s_bStdinConsole ) { if( _kbhit() ) ch = _getch(); @@ -696,9 +695,9 @@ static int hb_gt_pca_ReadKey( int iEventMask ) ch = s_keyTransTbl[ bChar ]; } #else - - /* TODO: */ - + { + int TODO; /* TODO: */ + } #endif return ch; diff --git a/harbour/source/rtl/gtstd/gtstd.c b/harbour/source/rtl/gtstd/gtstd.c index fa0eeb149a..61a2a36450 100644 --- a/harbour/source/rtl/gtstd/gtstd.c +++ b/harbour/source/rtl/gtstd/gtstd.c @@ -75,7 +75,7 @@ #if defined( HB_WIN32_IO ) #include #endif - #if defined( _MSC_VER ) || defined( __MINGW32__ ) + #if defined( _MSC_VER ) && !defined( HB_WINCE ) #include #endif #endif @@ -285,7 +285,7 @@ static int hb_gt_std_ReadKey( int iEventMask ) HB_SYMBOL_UNUSED( iEventMask ); -#if defined( _MSC_VER ) +#if defined( _MSC_VER ) && !defined( HB_WINCE ) if( s_bStdinConsole ) { if( _kbhit() ) ch = _getch(); @@ -322,9 +322,9 @@ static int hb_gt_std_ReadKey( int iEventMask ) ch = s_keyTransTbl[ bChar ]; } #else - - /* TODO: */ - + { + int TODO; /* TODO: */ + } #endif return ch; diff --git a/harbour/source/rtl/gtwin/gtwin.c b/harbour/source/rtl/gtwin/gtwin.c index b7c2e4eeda..0290c912ce 100644 --- a/harbour/source/rtl/gtwin/gtwin.c +++ b/harbour/source/rtl/gtwin/gtwin.c @@ -88,7 +88,8 @@ # include "hbapicdp.h" #endif -#if !defined( HB_NO_WIN_CONSOLE ) && defined( HB_WINCE ) +#if !defined( HB_NO_WIN_CONSOLE ) && defined( HB_WINCE ) && \ + !defined( HB_WINCE_USE_POCKET_CONSOLE ) # define HB_NO_WIN_CONSOLE #endif diff --git a/harbour/source/rtl/gtwvt/gtwvt.c b/harbour/source/rtl/gtwvt/gtwvt.c index 00428fc616..1df0b44cc1 100644 --- a/harbour/source/rtl/gtwvt/gtwvt.c +++ b/harbour/source/rtl/gtwvt/gtwvt.c @@ -145,8 +145,8 @@ static void hb_gt_wvt_InitStatics( void ) /* THEESE are the default font parameters, if not changed by user */ _s.PTEXTSIZE.x = 8; _s.PTEXTSIZE.y = 12; - _s.fontHeight = 20; - _s.fontWidth = 10; + _s.fontHeight = WVT_DEFAULT_FONT_HEIGHT; + _s.fontWidth = WVT_DEFAULT_FONT_WIDTH; _s.fontWeight = FW_NORMAL; _s.fontQuality = DEFAULT_QUALITY; hb_strncpy( _s.fontFace, "Courier New", sizeof( _s.fontFace ) - 1 ); @@ -168,7 +168,7 @@ static BOOL hb_gt_wvt_SetWindowSize( int iRow, int iCol ) _s.COLS = ( USHORT ) iCol; return TRUE; } - + return FALSE; } diff --git a/harbour/source/rtl/gtwvt/gtwvt.h b/harbour/source/rtl/gtwvt/gtwvt.h index dd11bcac26..dc671123e5 100644 --- a/harbour/source/rtl/gtwvt/gtwvt.h +++ b/harbour/source/rtl/gtwvt/gtwvt.h @@ -77,8 +77,17 @@ #define WVT_CHAR_QUEUE_SIZE 128 #define WVT_MAX_ROWS 256 #define WVT_MAX_COLS 256 -#define WVT_DEFAULT_ROWS 25 -#define WVT_DEFAULT_COLS 80 +#if defined( HB_WINCE ) +# define WVT_DEFAULT_ROWS 15 +# define WVT_DEFAULT_COLS 50 +# define WVT_DEFAULT_FONT_HEIGHT 12 +# define WVT_DEFAULT_FONT_WIDTH 8 +#else +# define WVT_DEFAULT_ROWS 25 +# define WVT_DEFAULT_COLS 80 +# define WVT_DEFAULT_FONT_HEIGHT 20 +# define WVT_DEFAULT_FONT_WIDTH 10 +#endif #define BLACK RGB( 0x0 ,0x0 ,0x0 ) #define BLUE RGB( 0x0 ,0x0 ,0x85 ) diff --git a/harbour/source/rtl/hbinet.c b/harbour/source/rtl/hbinet.c index 5dbb24090d..4835379754 100644 --- a/harbour/source/rtl/hbinet.c +++ b/harbour/source/rtl/hbinet.c @@ -170,8 +170,8 @@ #if !defined( HB_NO_DEFAULT_INET ) -#include -#if !defined(__MINGW32CE__) +#if !defined( HB_WINCE ) + #include #include #endif diff --git a/harbour/source/rtl/hbrandom.c b/harbour/source/rtl/hbrandom.c index 1a7ade2585..3b227bd5c5 100644 --- a/harbour/source/rtl/hbrandom.c +++ b/harbour/source/rtl/hbrandom.c @@ -50,9 +50,9 @@ * */ -#include +#include "hbmath.h" +#include "hbdate.h" #include -#include #ifndef HB_OS_WIN_32 #include @@ -122,7 +122,7 @@ HB_FUNC( HB_RANDOMINT ) HB_FUNC( HB_RANDOMSEED ) { - srand( ISNUM( 1 ) ? ( unsigned ) hb_parni( 1 ) : ( unsigned ) time( NULL ) ); + srand( ISNUM( 1 ) ? ( unsigned ) hb_parni( 1 ) : ( unsigned ) hb_dateMilliSeconds() ); s_fInit = TRUE; } @@ -133,7 +133,7 @@ double hb_random_num() if( !s_fInit ) { - srand( ( unsigned ) time( NULL ) ); + srand( ( unsigned ) hb_dateMilliSeconds() ); s_fInit = TRUE; } diff --git a/harbour/utils/hbpp/hbppcore.c b/harbour/utils/hbpp/hbppcore.c index 764446f558..a999b547d0 100644 --- a/harbour/utils/hbpp/hbppcore.c +++ b/harbour/utils/hbpp/hbppcore.c @@ -75,14 +75,14 @@ #endif #endif -#if !defined(__MINGW32CE__) && !( defined( _MSC_VER ) && defined( HB_WINCE ) ) -# include -#endif - #include "hbppdef.h" #include "hbcomp.h" #include "hbdate.h" +#if !defined(__MINGW32CE__) && !( defined( _MSC_VER ) && defined( HB_WINCE ) ) +# include +#endif + int hb_pp_ParseDefine_( char * ); /* Process #define directive */ static COMMANDS *AddCommand( char * ); /* Add new #command to an array */ diff --git a/harbour/utils/hbver/hbverfix.c b/harbour/utils/hbver/hbverfix.c index 6af08d4d63..5018caecc5 100644 --- a/harbour/utils/hbver/hbverfix.c +++ b/harbour/utils/hbver/hbverfix.c @@ -64,23 +64,34 @@ #include #include #include + +#include "hbcomp.h" + #if !defined(__MINGW32CE__) && !( defined( _MSC_VER ) && defined( HB_WINCE ) ) # include #endif -#include "hbcomp.h" - #define MAX_BUF_LEN 4096 -#if defined(__MINGW32CE__) +#if defined(HB_WINCE) +wchar_t *hb_mbtowc( const char *srcA ) +{ + DWORD length; + wchar_t *dstW; + + length = MultiByteToWideChar( CP_ACP, 0, srcA, -1, NULL, 0 ); + dstW = ( wchar_t * ) malloc( ( length + 1 ) * sizeof( wchar_t ) ); + MultiByteToWideChar( CP_ACP, 0, srcA, -1, dstW, length + 1 ); + + return dstW; +} + int remove( const char *filename ) { - int length, result; wchar_t *wpath; + int result; - length = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 ); - wpath = ( wchar_t * ) malloc( ( length + 1 ) * sizeof( wchar_t ) ); - MultiByteToWideChar( CP_ACP, 0, filename, -1, wpath, length ); + wpath = hb_mbtowc( path ); result = DeleteFileW( wpath ) ? 0 : -1; free( wpath ); @@ -91,6 +102,21 @@ void perror( const char *szError ) { fprintf( stderr, "error: %s\n", szError ); } + +int rename( const char *oldname, const char *newname ) +{ + wchar_t wfn1, wfn2; + int result; + + wfn1 = hb_mbtowc( fn1 ); + wfn2 = hb_mbtowc( fn2 ); + result = MoveFileW( wfn1, wfn2 ) ? 0 : -1; + free( wfn1 ); + free( wfn2 ); + + return result; +} + #endif static char * szIncrementNumber( char * szBuffer, size_t stSkipOver )