diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 108588fae6..c6fefe2694 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,19 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-10-19 00:05 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * common.mak + * include/hbextern.ch + * source/rtl/Makefile + + source/rtl/strtrim.c + + Added function HB_N2S( ) -> . + This is equivalent to LTrim( Str( ) ), + just faster. + + * source/rtl/dircmd.prg + * source/rtl/tget.prg + * Minor cleanup. + 2008-10-18 22:21 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/hbmysql/utils/bld_b32.bat * contrib/hbmysql/utils/bld_vc.bat diff --git a/harbour/common.mak b/harbour/common.mak index ab70217882..3b5366c54a 100644 --- a/harbour/common.mak +++ b/harbour/common.mak @@ -479,7 +479,7 @@ RTL_LIB_OBJS = \ $(OBJ_DIR)\dateshb$(OBJEXT) \ $(OBJ_DIR)\datesx$(OBJEXT) \ $(OBJ_DIR)\defpath$(OBJEXT) \ - $(OBJ_DIR)\defpathu$(OBJEXT) \ + $(OBJ_DIR)\defpathu$(OBJEXT) \ $(OBJ_DIR)\descend$(OBJEXT) \ $(OBJ_DIR)\dirdrive$(OBJEXT) \ $(OBJ_DIR)\direct$(OBJEXT) \ @@ -579,7 +579,7 @@ RTL_LIB_OBJS = \ $(OBJ_DIR)\setpos$(OBJEXT) \ $(OBJ_DIR)\setposbs$(OBJEXT) \ $(OBJ_DIR)\shadow$(OBJEXT) \ - $(OBJ_DIR)\shadowu$(OBJEXT) \ + $(OBJ_DIR)\shadowu$(OBJEXT) \ $(OBJ_DIR)\soundex$(OBJEXT) \ $(OBJ_DIR)\space$(OBJEXT) \ $(OBJ_DIR)\spfiles$(OBJEXT) \ @@ -588,6 +588,7 @@ RTL_LIB_OBJS = \ $(OBJ_DIR)\strcase$(OBJEXT) \ $(OBJ_DIR)\strmatch$(OBJEXT) \ $(OBJ_DIR)\strtran$(OBJEXT) \ + $(OBJ_DIR)\strtrim$(OBJEXT) \ $(OBJ_DIR)\strzero$(OBJEXT) \ $(OBJ_DIR)\stuff$(OBJEXT) \ $(OBJ_DIR)\substr$(OBJEXT) \ diff --git a/harbour/include/hbextern.ch b/harbour/include/hbextern.ch index f863376d5e..b2246be3a6 100644 --- a/harbour/include/hbextern.ch +++ b/harbour/include/hbextern.ch @@ -1118,6 +1118,7 @@ EXTERNAL HB_TOKENPTR EXTERNAL HB_ATOKENS EXTERNAL HB_STRSHRINK EXTERNAL HB_MEMOWRIT +EXTERNAL HB_N2S EXTERNAL HB_HASH EXTERNAL HB_HHASKEY diff --git a/harbour/source/rtl/Makefile b/harbour/source/rtl/Makefile index 5cbdbf5b8f..f8d567a3b3 100644 --- a/harbour/source/rtl/Makefile +++ b/harbour/source/rtl/Makefile @@ -130,6 +130,7 @@ C_SOURCES=\ strmatch.c \ strpeek.c \ strtran.c \ + strtrim.c \ strzero.c \ stuff.c \ substr.c \ diff --git a/harbour/source/rtl/dircmd.prg b/harbour/source/rtl/dircmd.prg index 3de792fead..d1af8f3d72 100644 --- a/harbour/source/rtl/dircmd.prg +++ b/harbour/source/rtl/dircmd.prg @@ -94,7 +94,7 @@ STATIC PROCEDURE PutDBF( aDirEntry ) LOCAL fhnd LOCAL buffer LOCAL nRecCount := 0 - LOCAL dLastUpdate := hb_SToD( "" ) + LOCAL dLastUpdate := hb_SToD() IF ( fhnd := FOpen( aDirEntry[ F_NAME ] ) ) != F_ERROR diff --git a/harbour/source/rtl/strtrim.c b/harbour/source/rtl/strtrim.c new file mode 100644 index 0000000000..12a48a7342 --- /dev/null +++ b/harbour/source/rtl/strtrim.c @@ -0,0 +1,80 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * HB_N2S() function + * + * Copyright 2008 Viktor Szakats + * 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. + * + */ + +#include "hbapi.h" +#include "hbapiitm.h" + +HB_FUNC( HB_N2S ) +{ + PHB_ITEM pNumber = hb_param( 1, HB_IT_NUMERIC ); + + if( pNumber ) + { + char * szResult = hb_itemStr( pNumber, NULL, NULL ); + + if( szResult ) + { + ULONG nToTrim = 0; + + while( szResult[ nToTrim ] == ' ' ) + ++nToTrim; + + if( nToTrim ) + memmove( szResult, szResult + nToTrim, strlen( szResult + nToTrim ) + 1 ); + + hb_retc_buffer( szResult ); + return; + } + } + + hb_retc_null(); +} diff --git a/harbour/source/rtl/tget.prg b/harbour/source/rtl/tget.prg index 571c3a4b3c..5e75f15c3f 100644 --- a/harbour/source/rtl/tget.prg +++ b/harbour/source/rtl/tget.prg @@ -1441,7 +1441,7 @@ METHOD badDate() CLASS Get RETURN ::hasFocus .AND. ; ::type == "D" .AND. ; - ( xValue := ::unTransform() ) == hb_SToD( "" ) .AND. ; + ( xValue := ::unTransform() ) == hb_SToD() .AND. ; !( ::cBuffer == Transform( xValue, ::cPicture ) ) #ifdef HB_C52_UNDOC