From eb0be876d2be245039d9f1841a222b9b7f42eeef Mon Sep 17 00:00:00 2001 From: Ignacio Ortiz de Zuniga Date: Mon, 4 Feb 2002 13:00:57 +0000 Subject: [PATCH] 2002-02-04 13:50 UTC+0100 Ignacio Ortiz --- harbour/source/compiler/hbfunchk.c | 5 ++++- harbour/source/rtl/at.c | 22 ++++++++++++++++++---- harbour/source/rtl/memoline.c | 7 ++++++- harbour/source/rtl/mlcount.c | 7 ++++++- harbour/source/rtl/tget.prg | 19 ++++++++++++------- 5 files changed, 46 insertions(+), 14 deletions(-) diff --git a/harbour/source/compiler/hbfunchk.c b/harbour/source/compiler/hbfunchk.c index 372fc166d1..5ad200831f 100644 --- a/harbour/source/compiler/hbfunchk.c +++ b/harbour/source/compiler/hbfunchk.c @@ -44,7 +44,11 @@ static HB_FUNCINFO hb_StdFunc[] = { "AADD" , 2, 2 }, { "ABS" , 1, 1 }, { "ASC" , 1, 1 }, +#if defined( HB_C52_STRICT ) { "AT" , 2, 2 }, +#else + { "AT" , 2, 4 }, +#endif { "BOF" , 0, 0 }, { "BREAK" , 0, 1 }, { "CDOW" , 1, 1 }, @@ -157,4 +161,3 @@ void hb_compFunCallCheck( char * szFuncCall, int iArgs ) } } } - diff --git a/harbour/source/rtl/at.c b/harbour/source/rtl/at.c index 0b49453c23..dc71745064 100644 --- a/harbour/source/rtl/at.c +++ b/harbour/source/rtl/at.c @@ -63,10 +63,24 @@ HB_FUNC( AT ) if( pText && pSub ) { - hb_retnl( hb_strAt( hb_itemGetCPtr( pSub ), hb_itemGetCLen( pSub ), - hb_itemGetCPtr( pText ), hb_itemGetCLen( pText ) ) ); + ULONG ulTextLength = hb_itemGetCLen( pText ); + ULONG ulStart = ISNUM( 3 ) ? hb_parnl( 3 ) : 1; + ULONG ulEnd = ISNUM( 4 ) ? hb_parnl( 4 ) : ulTextLength; + ULONG ulPos; + + if ( ulStart > ulTextLength || ulEnd < ulStart ) hb_retnl( 0 ); + else + { + if ( ulEnd > ulTextLength ) ulEnd = ulTextLength; + + ulPos = hb_strAt( hb_itemGetCPtr( pSub ), hb_itemGetCLen( pSub ), + hb_itemGetCPtr( pText ) + ulStart - 1, ulEnd - ulStart + 1 ); + + if ( ulPos > 0) ulPos += ( ulStart - 1 ); + + hb_retnl( ulPos ); + } } else hb_errRT_BASE_SubstR( EG_ARG, 1108, NULL, "AT", 2, hb_paramError( 1 ), hb_paramError( 2 ) ); -} - +} \ No newline at end of file diff --git a/harbour/source/rtl/memoline.c b/harbour/source/rtl/memoline.c index c354d6e2e0..54ce04e858 100644 --- a/harbour/source/rtl/memoline.c +++ b/harbour/source/rtl/memoline.c @@ -68,9 +68,14 @@ HB_FUNC( MEMOLINE ) ULONG ulLineBegin; ULONG ulLineEnd; - if( ulLineLength < 4 || ulLineLength > 254 ) + if( ulLineLength < 4 ) ulLineLength = 79; +#if defined( HB_C52_STRICT ) + if( ulLineLength > 254 ) + ulLineLength = 79; +#endif + if( ulTabLength > ulLineLength ) ulTabLength = ulLineLength - 1; diff --git a/harbour/source/rtl/mlcount.c b/harbour/source/rtl/mlcount.c index 47f7b17fc7..905d775d6e 100644 --- a/harbour/source/rtl/mlcount.c +++ b/harbour/source/rtl/mlcount.c @@ -64,9 +64,14 @@ HB_FUNC( MLCOUNT ) ULONG ulLines = 0; ULONG ulPos; - if( ulLineLength < 4 || ulLineLength > 254 ) + if( ulLineLength < 4 ) ulLineLength = 79; +#if defined( HB_C52_STRICT ) + if( ulLineLength > 254 ) + ulLineLength = 79; +#endif + if( ulTabLength > ulLineLength ) ulTabLength = ulLineLength - 1; diff --git a/harbour/source/rtl/tget.prg b/harbour/source/rtl/tget.prg index 7f31beca25..6545e3120b 100644 --- a/harbour/source/rtl/tget.prg +++ b/harbour/source/rtl/tget.prg @@ -124,7 +124,7 @@ CLASS Get METHOD UpdateBuffer() INLINE ::buffer := ::PutMask(), ::Assign(), Self METHOD VarGet() - METHOD VarPut() + METHOD VarPut(xValue, lReFormat) METHOD End() #ifdef HB_COMPAT_XPP @@ -299,7 +299,7 @@ return ::cPicFunc + ' ' + ::cPicMask METHOD Assign() CLASS Get - ::VarPut( ::unTransform() ) + ::VarPut( ::unTransform(), .f. ) return Self @@ -381,7 +381,7 @@ METHOD Undo() CLASS Get if ::hasfocus ::buffer := ::PutMask( ::original ) ::pos := 1 - ::VarPut( ::Original ) + ::VarPut( ::Original, .f. ) endif return Self @@ -435,13 +435,18 @@ return Self //---------------------------------------------------------------------------// -METHOD VarPut( xValue ) CLASS Get +METHOD VarPut( xValue, lReFormat ) CLASS Get + + DEFAULT lReFormat TO .t. if ::block != nil Eval( ::block, xValue ) - ::Type := ValType( xValue ) - ::nDispLen := NIL - ::Picture( ::cPicture ) + if lReFormat + ::Type := ValType( xValue ) + ::nDispLen := NIL + ::Picture( ::cPicture ) + ::BufferUpdate() + endif endif return xValue