diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 21d152180d..0ecc01c0e9 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,32 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-04-17 03:53 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * include/hbextern.ch + * source/rtl/errorapi.c + + Added ERRORINHAN() (and alias ERRORINHANDLER()) CA-Cl*pper + compatible, undocumented function, guarded with HB_C52_UNDOC. + Same as Harbour __ERRINHANDLER(). + + * source/rtl/trim.c + * source/rtl/strtran.c + + Added strict branches for incompatible error messages. + % Minor optimization in STRTRAN() parameter checking. + + * utils/hbtest/rt_str.prg + + Reenabled two C53-only test calls. + + * include/hbdefs.h + ! Minor indentation fix. + + * utils/hbdoc/hbdoc.prg + * utils/hbdot/hbdot.prg + * utils/hbmake/hbmake.prg + * utils/hbpp/hbpp.c + * utils/hbtest/hbtest.prg + * utils/hbrun/hbrun.prg + ! Year updated in copyright banners. + 2008-04-16 14:41 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbclass.ch ! removed: @@ -208,7 +234,7 @@ modified to 20 when certain value is reached (+/-1000000000), while in Harbour the length stays 10. I tried to do the same test using Item API, but I got - so strange results in C, that I finally dropped it. + so strange results in Clipper, that I finally dropped it. + Added optional C compilation using MSC for CA-Cl*pper build batch file. + Added better support to compile the test suite under C5.3. diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index 9753120650..7988676fd7 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -352,37 +352,37 @@ #endif #if defined( HB_ARCH_64BIT ) && !defined( _WIN64 ) -# if !defined( UINT64 ) - typedef ULONG UINT64; -# endif -# if !defined( INT64 ) - typedef LONG INT64; -# endif -# if !defined( UINT64_MAX ) -# define UINT64_MAX ULONG_MAX -# endif -# if !defined( INT64_MAX ) -# define INT64_MAX LONG_MAX -# endif -# if !defined( INT64_MIN ) -# define INT64_MIN LONG_MIN -# endif +# if !defined( UINT64 ) + typedef ULONG UINT64; +# endif +# if !defined( INT64 ) + typedef LONG INT64; +# endif +# if !defined( UINT64_MAX ) +# define UINT64_MAX ULONG_MAX +# endif +# if !defined( INT64_MAX ) +# define INT64_MAX LONG_MAX +# endif +# if !defined( INT64_MIN ) +# define INT64_MIN LONG_MIN +# endif #elif !defined( HB_LONG_LONG_OFF ) -# if !defined( UINT64 ) - typedef ULONGLONG UINT64; -# endif -# if !defined( INT64 ) - typedef LONGLONG INT64; -# endif -# if !defined( UINT64_MAX ) -# define UINT64_MAX ULONGLONG_MAX -# endif -# if !defined( INT64_MAX ) -# define INT64_MAX LONGLONG_MAX -# endif -# if !defined( INT64_MIN ) -# define INT64_MIN LONGLONG_MIN -# endif +# if !defined( UINT64 ) + typedef ULONGLONG UINT64; +# endif +# if !defined( INT64 ) + typedef LONGLONG INT64; +# endif +# if !defined( UINT64_MAX ) +# define UINT64_MAX ULONGLONG_MAX +# endif +# if !defined( INT64_MAX ) +# define INT64_MAX LONGLONG_MAX +# endif +# if !defined( INT64_MIN ) +# define INT64_MIN LONGLONG_MIN +# endif #endif #ifndef HB_LONG_DOUBLE_OFF diff --git a/harbour/include/hbextern.ch b/harbour/include/hbextern.ch index 6db6caad40..724ba081d9 100644 --- a/harbour/include/hbextern.ch +++ b/harbour/include/hbextern.ch @@ -620,6 +620,8 @@ EXTERNAL ISNEGATIVE EXTERNAL NATIONMSG EXTERNAL PROCFILE EXTERNAL SETTYPEAHEAD +EXTERNAL ERRORINHAN +EXTERNAL ERRORINHANDLER #endif /* HB_C52_UNDOC */ diff --git a/harbour/source/rtl/errorapi.c b/harbour/source/rtl/errorapi.c index 7b64f89083..1db50f1d15 100644 --- a/harbour/source/rtl/errorapi.c +++ b/harbour/source/rtl/errorapi.c @@ -56,7 +56,7 @@ * * Copyright 1999-2001 Viktor Szakats * DOSERROR() - * __ERRINHANDLER() + * __ERRINHANDLER(), ERRORINHAN(), ERRORINHANDLER() * __ERRRT_BASE() * __ERRRT_SBASE() * hb_errLaunch() @@ -434,15 +434,28 @@ HB_FUNC( ERRORNEW ) hb_itemReturnRelease( hb_errNew() ); } - -/* There's a similar undocumented, internal functions in CA-Cl*pper named +/* There's a similar undocumented, internal function in CA-Cl*pper named ErrorInHandler(). [vszakats] */ - + HB_FUNC( __ERRINHANDLER ) { hb_errInternal( HB_EI_ERRRECFAILURE, NULL, NULL, NULL ); } +#ifdef HB_C52_UNDOC + +HB_FUNC( ERRORINHAN ) +{ + HB_FUNC_EXEC( __ERRINHANDLER ) +} + +HB_FUNC( ERRORINHANDLER ) +{ + HB_FUNC_EXEC( __ERRINHANDLER ) +} + +#endif + HB_FUNC( ERRORBLOCK ) { PHB_ITEM pNewErrorBlock = hb_param( 1, HB_IT_BLOCK ); diff --git a/harbour/source/rtl/strtran.c b/harbour/source/rtl/strtran.c index cf75a550ad..27e0b1dd7f 100644 --- a/harbour/source/rtl/strtran.c +++ b/harbour/source/rtl/strtran.c @@ -63,111 +63,101 @@ HB_FUNC( STRTRAN ) { PHB_ITEM pText = hb_param( 1, HB_IT_STRING ); + PHB_ITEM pSeek = hb_param( 2, HB_IT_STRING ); - if( pText ) + if( pText && pSeek ) { - PHB_ITEM pSeek = hb_param( 2, HB_IT_STRING ); + char * szText = hb_itemGetCPtr( pText ); + ULONG ulText = hb_itemGetCLen( pText ); + ULONG ulSeek = hb_itemGetCLen( pSeek ); - if( pSeek ) + if( ulSeek && ulSeek <= ulText ) { - char * szText = hb_itemGetCPtr( pText ); - ULONG ulText = hb_itemGetCLen( pText ); - ULONG ulSeek = hb_itemGetCLen( pSeek ); + char * szSeek = hb_itemGetCPtr( pSeek ); + char * szReplace; + ULONG ulStart; - if( ulSeek && ulSeek <= ulText ) + ulStart = ( ISNUM( 4 ) ? hb_parnl( 4 ) : 1 ); + + if( !ulStart ) { - char * szSeek = hb_itemGetCPtr( pSeek ); - char * szReplace; - ULONG ulStart; + /* Clipper seems to work this way */ + hb_retc( NULL ); + } + else if( ulStart > 0 ) + { + PHB_ITEM pReplace = hb_param( 3, HB_IT_STRING ); + ULONG ulReplace; + ULONG ulCount; + BOOL bAll; - ulStart = ( ISNUM( 4 ) ? hb_parnl( 4 ) : 1 ); - - if( !ulStart ) + if( pReplace ) { - /* Clipper seems to work this way */ - hb_retc( NULL ); + szReplace = hb_itemGetCPtr( pReplace ); + ulReplace = hb_itemGetCLen( pReplace ); } - else if( ulStart > 0 ) + else { - PHB_ITEM pReplace = hb_param( 3, HB_IT_STRING ); - ULONG ulReplace; - ULONG ulCount; - BOOL bAll; + szReplace = ""; /* shouldn't matter that we don't allocate */ + ulReplace = 0; + } - if( pReplace ) - { - szReplace = hb_itemGetCPtr( pReplace ); - ulReplace = hb_itemGetCLen( pReplace ); - } - else - { - szReplace = ""; /* shouldn't matter that we don't allocate */ - ulReplace = 0; - } + if( ISNUM( 5 ) ) + { + ulCount = hb_parnl( 5 ); + bAll = FALSE; + } + else + { + ulCount = 0; + bAll = TRUE; + } - if( ISNUM( 5 ) ) - { - ulCount = hb_parnl( 5 ); - bAll = FALSE; - } - else - { - ulCount = 0; - bAll = TRUE; - } + if( bAll || ulCount > 0 ) + { + ULONG ulFound = 0; + long lReplaced = 0; + ULONG i = 0; + ULONG ulLength = ulText; + ULONG ulStop = ulText - ulSeek + 1; - if( bAll || ulCount > 0 ) + while( i < ulStop ) { - ULONG ulFound = 0; - long lReplaced = 0; - ULONG i = 0; - ULONG ulLength = ulText; - ULONG ulStop = ulText - ulSeek + 1; - - while( i < ulStop ) + if( ( bAll || lReplaced < ( long ) ulCount ) && + ! memcmp( szText + i, szSeek, ulSeek ) ) { - if( ( bAll || lReplaced < ( long ) ulCount ) && - ! memcmp( szText + i, szSeek, ulSeek ) ) + ulFound++; + if( ulFound >= ulStart ) { - ulFound++; - if( ulFound >= ulStart ) - { - lReplaced++; - ulLength = ulLength - ulSeek + ulReplace; - i += ulSeek; - } - else - i++; + lReplaced++; + ulLength = ulLength - ulSeek + ulReplace; + i += ulSeek; } else i++; } + else + i++; + } - if( ulFound ) + if( ulFound ) + { + char * szResult = ( char * ) hb_xgrab( ulLength + 1 ); + char * szPtr = szResult; + + ulFound = 0; + i = 0; + while( i < ulText ) { - char * szResult = ( char * ) hb_xgrab( ulLength + 1 ); - char * szPtr = szResult; - - ulFound = 0; - i = 0; - while( i < ulText ) + if( lReplaced && ! memcmp( szText + i, szSeek, ulSeek ) ) { - if( lReplaced && ! memcmp( szText + i, szSeek, ulSeek ) ) + ulFound++; + if( ulFound >= ulStart ) { - ulFound++; - if( ulFound >= ulStart ) - { - lReplaced--; - memcpy( szPtr, szReplace, ulReplace ); - szPtr += ulReplace; - i += ulSeek; - } - else - { - *szPtr = szText[ i ]; - szPtr++; - i++; - } + lReplaced--; + memcpy( szPtr, szReplace, ulReplace ); + szPtr += ulReplace; + i += ulSeek; } else { @@ -176,10 +166,14 @@ HB_FUNC( STRTRAN ) i++; } } - hb_retclen_buffer( szResult, ulLength ); + else + { + *szPtr = szText[ i ]; + szPtr++; + i++; + } } - else - hb_itemReturn( pText ); + hb_retclen_buffer( szResult, ulLength ); } else hb_itemReturn( pText ); @@ -191,9 +185,15 @@ HB_FUNC( STRTRAN ) hb_itemReturn( pText ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1126, NULL, "STRTRAN", HB_ERR_ARGS_BASEPARAMS ); /* NOTE: Undocumented but existing Clipper Run-time error [vszakats] */ + hb_itemReturn( pText ); } else - hb_errRT_BASE_SubstR( EG_ARG, 1126, NULL, "STRTRAN", HB_ERR_ARGS_BASEPARAMS ); /* NOTE: Undocumented but existing Clipper Run-time error [vszakats] */ + { + /* NOTE: Undocumented but existing Clipper Run-time error [vszakats] */ +#ifdef HB_C52_STRICT + hb_errRT_BASE_SubstR( EG_ARG, 1126, NULL, "STRTRAN", 0 ); +#else + hb_errRT_BASE_SubstR( EG_ARG, 1126, NULL, "STRTRAN", HB_ERR_ARGS_BASEPARAMS ); +#endif + } } - diff --git a/harbour/source/rtl/trim.c b/harbour/source/rtl/trim.c index 6961bf6797..df367d5e6d 100644 --- a/harbour/source/rtl/trim.c +++ b/harbour/source/rtl/trim.c @@ -175,7 +175,12 @@ HB_FUNC( ALLTRIM ) } else #ifdef HB_COMPAT_C53 - hb_errRT_BASE_SubstR( EG_ARG, 2022, NULL, "ALLTRIM", HB_ERR_ARGS_BASEPARAMS ); /* NOTE: This appeared in CA-Cl*pper 5.3 [vszakats] */ + /* NOTE: This runtime error appeared in CA-Cl*pper 5.3 [vszakats] */ +#ifdef HB_C52_STRICT + hb_errRT_BASE_SubstR( EG_ARG, 2022, NULL, "ALLTRIM", 0 ); +#else + hb_errRT_BASE_SubstR( EG_ARG, 2022, NULL, "ALLTRIM", HB_ERR_ARGS_BASEPARAMS ); +#endif #else hb_retc( NULL ); #endif diff --git a/harbour/utils/hbdoc/hbdoc.prg b/harbour/utils/hbdoc/hbdoc.prg index 93af48e231..40d0edb629 100644 --- a/harbour/utils/hbdoc/hbdoc.prg +++ b/harbour/utils/hbdoc/hbdoc.prg @@ -276,7 +276,7 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile ) IF cLinkName = NIL outstd( "Harbour Doc Extractor"+ hb_osnewline() ) - outstd( "Copyright 1999-2005, http://www.harbour-project.org"+ hb_osnewline() ) + outstd( "Copyright 1999-2008, http://www.harbour-project.org"+ hb_osnewline() ) outstd( ""+ hb_osnewline() ) outstd( "Syntax: hbdoc [options] []"+ hb_osnewline() ) outstd( ""+ hb_osnewline() ) diff --git a/harbour/utils/hbdot/hbdot.prg b/harbour/utils/hbdot/hbdot.prg index 9e2e45b905..743c26d194 100644 --- a/harbour/utils/hbdot/hbdot.prg +++ b/harbour/utils/hbdot/hbdot.prg @@ -183,7 +183,7 @@ RETURN STATIC PROCEDURE HB_DotUsage() OutStd( 'Harbour "DOt Prompt" Console' + HB_OSNewLine() +; - 'Copyright 1999-2007, Przemyslaw Czerpak' + HB_OSNewLine() + ; + 'Copyright 1999-2008, Przemyslaw Czerpak' + HB_OSNewLine() + ; 'http://www.harbour-project.org' + HB_OSNewLine() +; HB_OSNewLine() +; 'Syntax: hbdot [ []]' + HB_OSNewLine() + ; diff --git a/harbour/utils/hbmake/hbmake.prg b/harbour/utils/hbmake/hbmake.prg index 2cb12b6a9e..a8b6528099 100644 --- a/harbour/utils/hbmake/hbmake.prg +++ b/harbour/utils/hbmake/hbmake.prg @@ -5901,7 +5901,7 @@ RETURN ( "HbMake v"+s_cHbMakeVersion+" - Harbour Make Utility") *-------------------------- FUNCTION HbMake_Copyright() *-------------------------- -RETURN ( "Copyright (C) 2000-2007 Harbour project - http://www.harbour-project.org") +RETURN ( "Copyright (C) 2000-2008 Harbour project - http://www.harbour-project.org") *--------------------- FUNCTION ShowCredits() diff --git a/harbour/utils/hbpp/hbpp.c b/harbour/utils/hbpp/hbpp.c index f1e4da5176..eec84390b2 100644 --- a/harbour/utils/hbpp/hbpp.c +++ b/harbour/utils/hbpp/hbpp.c @@ -116,7 +116,7 @@ int main( int argc, char * argv[] ) printf( "Harbour Preprocessor %d.%d.%d\n", HB_VER_MAJOR, HB_VER_MINOR, HB_VER_REVISION ); - printf( "Copyright 1999-2000, http://www.harbour-project.org\n" ); + printf( "Copyright 1999-2008, http://www.harbour-project.org\n" ); hb_pp_Table(); stdef = hb_pp_topDefine; diff --git a/harbour/utils/hbrun/hbrun.prg b/harbour/utils/hbrun/hbrun.prg index 9702f94f25..9dc99be86d 100644 --- a/harbour/utils/hbrun/hbrun.prg +++ b/harbour/utils/hbrun/hbrun.prg @@ -76,7 +76,7 @@ FUNCTION _APPMAIN( cHRBFile, ... ) IF Empty( cHRBFile ) OutStd( "Harbour Runner" + HB_OSNewLine() +; - "Copyright 1999-2006, http://www.harbour-project.org" + HB_OSNewLine() +; + "Copyright 1999-2008, http://www.harbour-project.org" + HB_OSNewLine() +; HB_OSNewLine() +; "Syntax: hbrun [parameters]" + HB_OSNewLine() + ; HB_OSNewLine() +; diff --git a/harbour/utils/hbtest/hbtest.prg b/harbour/utils/hbtest/hbtest.prg index 859e7fa9b0..f9f73829df 100644 --- a/harbour/utils/hbtest/hbtest.prg +++ b/harbour/utils/hbtest/hbtest.prg @@ -102,7 +102,7 @@ STATIC s_nEndTime FUNCTION Main( cPar1, cPar2 ) OutStd( "Harbour Regression Test Suite" + HB_OSNewLine() +; - "Copyright 1999-2000, http://www.harbour-project.org" + HB_OSNewLine() ) + "Copyright 1999-2008, http://www.harbour-project.org" + HB_OSNewLine() ) IF cPar1 == NIL cPar1 := "" diff --git a/harbour/utils/hbtest/rt_str.prg b/harbour/utils/hbtest/rt_str.prg index af4db61b3d..8a6783e250 100644 --- a/harbour/utils/hbtest/rt_str.prg +++ b/harbour/utils/hbtest/rt_str.prg @@ -288,10 +288,10 @@ FUNCTION Main_STR() /* ALLTRIM() */ -/* These lines will cause CA-Cl*pper 5.2e to trash memory and later crash, it was fixed in 5.3 */ -#ifndef __CLIPPER__ - TEST_LINE( AllTrim( NIL ) , "E BASE 2022 Argument error ALLTRIM F:S" ) /* CA-Cl*pper 5.2e/5.3 is not giving the same result for this one. */ - TEST_LINE( AllTrim( 100 ) , "E BASE 2022 Argument error ALLTRIM F:S" ) /* CA-Cl*pper 5.2e/5.3 is not giving the same result for this one. */ +#ifdef HB_COMPAT_C53 + /* These lines will cause CA-Cl*pper 5.2e to trash memory and later crash, it was fixed in 5.3 */ + TEST_LINE( AllTrim( NIL ) , "E BASE 2022 Argument error ALLTRIM F:S" ) + TEST_LINE( AllTrim( 100 ) , "E BASE 2022 Argument error ALLTRIM F:S" ) #endif #ifdef __HARBOUR__ TEST_LINE( AllTrim(@scString) , "HELLO" ) /* CA-Cl*pper bug, it will terminate the program on this line. */