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.
This commit is contained in:
Viktor Szakats
2008-04-17 02:02:02 +00:00
parent f181406951
commit cb966c280e
13 changed files with 179 additions and 133 deletions

View File

@@ -8,6 +8,32 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
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.

View File

@@ -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

View File

@@ -620,6 +620,8 @@ EXTERNAL ISNEGATIVE
EXTERNAL NATIONMSG
EXTERNAL PROCFILE
EXTERNAL SETTYPEAHEAD
EXTERNAL ERRORINHAN
EXTERNAL ERRORINHANDLER
#endif /* HB_C52_UNDOC */

View File

@@ -56,7 +56,7 @@
*
* Copyright 1999-2001 Viktor Szakats <viktor.szakats@syenar.hu>
* 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 );

View File

@@ -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
}
}

View File

@@ -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

View File

@@ -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] <linkname> [<ifile>]"+ hb_osnewline() )
outstd( ""+ hb_osnewline() )

View File

@@ -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 [<hrbfile[.prg]> [<parameters,...>]]' + HB_OSNewLine() + ;

View File

@@ -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()

View File

@@ -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;

View File

@@ -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 <hrbfile[.hrb|.prg]> [parameters]" + HB_OSNewLine() + ;
HB_OSNewLine() +;

View File

@@ -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 := ""

View File

@@ -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. */