From 4d9930caa6b063fd819ae74a0436d3152a922ffb Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Wed, 9 Jan 2008 14:04:12 +0000 Subject: [PATCH] 2008-01-09 15:03 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/vm/estack.c * added missing static to s_initSymbol declaration * harbour/include/hbgtinfo.ch * harbour/source/rtl/scroll.c * formatting * harbour/common.mak * added empty line necessary for some make systems (f.e. wmake) * harbour/bin/hb-func.sh * changed system libs order to avoid problems on some platforms * harbour/bin/pack_src.sh * collect information about repository files using 'svn status -v' command instead of scanning .svn/entries files to avoid problems with different formats used by SVN * harbour/include/hbchksum.h * harbour/include/hbset.h ! added missing extern in few function prototypes * harbour/include/hbclass.ch * use HB_CLS_PARAM_LIST macro instead of ... for strict C52 mode * harbour/source/common/hbfsapi.c + added missing const to one declaration * harbour/source/common/hbstr.c * minor cleanup in hb_stricmp() * harbour/source/rtl/inkey.c ! casting to avoid negative values during char to int translation * harbour/source/rtl/mouse53.c * added one internal definition * harbour/source/rtl/philes.c * removed unnecessary #include(s) * added missing const to one declaration * harbour/source/rtl/valtype.c * harbour/source/vm/hashfunc.c * cleanup RT error call to eliminate hb_paramError() function * harbour/source/pp/pplib.c * harbour/source/vm/runner.c * harbour/source/vm/debug.c * harbour/source/vm/arrayshb.c * harbour/source/vm/classes.c * harbour/source/vm/hvm.c * harbour/source/rtl/hbgtcore.c * harbour/source/rtl/gtfunc.c * harbour/source/rtl/hbinet.c * harbour/source/rtl/hbregex.c * harbour/source/rtl/idle.c * harbour/source/rtl/errorapi.c * harbour/source/rtl/hbtoken.c * harbour/source/rtl/direct.c * harbour/source/rdd/dbcmd.c * harbour/source/rdd/dbcmd53.c * harbour/source/rdd/fieldhb.c * harbour/source/rdd/hbsix/sxcompr.c * harbour/source/rdd/hbsix/sxcrypt.c * harbour/source/compiler/hbcmplib.c * harbour/contrib/hbrddads/adsfunc.c * harbour/contrib/hbrddads/adsmgmnt.c - removed unnecessary calls to hb_ret() % replaced hb_itemRelease( hb_itemReturn( pItem ) ) with hb_itemReturnRelease( pItem ) % replaced hb_itemPut*( hb_arrayGetItemPtr( pArray, ... ), ... ) with hb_arraySetNI( pArray, ... ) * harbour/source/macro/macro.y * harbour/source/macro/macro.yyc * harbour/contrib/xhb/cstructc.c * harbour/contrib/hbw32/w32_ole.c * harbour/contrib/hbgtwvg/wvtcore.c * cleaned typos with double ;; * harbour/source/vm/extend.c * harbour/source/rtl/math.c * cleaned HB_EXPORT usage * harbour/source/pp/ppcore.c ! fixed Harbour extension which allows to use match marker at the beginning of rule definition * harbour/source/main/harbour.c ! fixed hex conversion in FM log module - fix done by Phil Krylov in xHarbour * harbour/source/rdd/nulsys/nulsys.c + added dummy version of DBEVAL() and DBFILTER() - these functions are used in RTL * harbour/contrib/hbct/bitnum.c + added INTNEG(), INTPOS() + harbour/contrib/hbct/ctrand.prg + added RANDOM(), RAND() - borrowd from xHarbour by Pavel Tsarenko + harbour/contrib/hbct/setrc.c + added SETRC() * harbour/contrib/hbct/getinput.prg % minor optimization * harbour/contrib/hbct/Makefile * harbour/contrib/hbct/common.mak * updated for new files * harbour/contrib/hbnf/tempfile.prg * use HB_FTempCreate() - modification borrowed from xHarbour TOFIX this function uses hb_isbyref() which does not exist in Harbour * harbour/config/w32/msvc.cf + added -nologo flag for cl.exe (Phil Krylov's modification borrowed from xHarbour * harbour/config/w32/mingw32.cf - removed repeated definitions * harbour/config/w32/install.cf ! added alternative install rule for command.com with max line size limit --- harbour/ChangeLog | 128 ++++++++++++++++++++++++++++ harbour/bin/hb-func.sh | 10 +-- harbour/bin/pack_src.sh | 26 +++++- harbour/common.mak | 3 +- harbour/config/w32/install.cf | 28 +++++- harbour/config/w32/mingw32.cf | 2 - harbour/config/w32/msvc.cf | 2 +- harbour/contrib/hbct/Makefile | 2 + harbour/contrib/hbct/bitnum.c | 41 ++++++++- harbour/contrib/hbct/common.mak | 2 + harbour/contrib/hbct/ctrand.prg | 62 ++++++++++++++ harbour/contrib/hbct/getinput.prg | 4 +- harbour/contrib/hbct/setrc.c | 69 +++++++++++++++ harbour/contrib/hbgtwvg/wvtcore.c | 2 +- harbour/contrib/hbnf/tempfile.prg | 54 ++---------- harbour/contrib/hbrddads/adsfunc.c | 10 +-- harbour/contrib/hbrddads/adsmgmnt.c | 17 +--- harbour/contrib/hbw32/w32_ole.c | 2 +- harbour/contrib/xhb/cstructc.c | 12 +-- harbour/include/hbchksum.h | 14 +-- harbour/include/hbclass.ch | 21 +++-- harbour/include/hbgtinfo.ch | 10 +-- harbour/include/hbset.h | 8 +- harbour/source/common/hbfsapi.c | 2 +- harbour/source/common/hbstr.c | 6 +- harbour/source/compiler/hbcmplib.c | 10 +-- harbour/source/macro/macro.y | 2 +- harbour/source/macro/macro.yyc | 2 +- harbour/source/main/harbour.c | 4 +- harbour/source/pp/ppcore.c | 46 ++++++---- harbour/source/pp/pplib.c | 2 +- harbour/source/rdd/dbcmd.c | 53 ++++-------- harbour/source/rdd/dbcmd53.c | 51 ++++------- harbour/source/rdd/fieldhb.c | 9 +- harbour/source/rdd/hbsix/sxcompr.c | 2 +- harbour/source/rdd/hbsix/sxcrypt.c | 4 - harbour/source/rdd/nulsys/nulsys.c | 4 + harbour/source/rtl/direct.c | 2 +- harbour/source/rtl/errorapi.c | 2 +- harbour/source/rtl/gtfunc.c | 8 -- harbour/source/rtl/hbgtcore.c | 16 ++-- harbour/source/rtl/hbinet.c | 37 ++++---- harbour/source/rtl/hbregex.c | 56 ++++++------ harbour/source/rtl/hbtoken.c | 9 +- harbour/source/rtl/idle.c | 3 - harbour/source/rtl/inkey.c | 4 +- harbour/source/rtl/math.c | 2 +- harbour/source/rtl/mouse53.c | 1 + harbour/source/rtl/philes.c | 4 +- harbour/source/rtl/scroll.c | 8 +- harbour/source/rtl/valtype.c | 2 +- harbour/source/vm/arrayshb.c | 7 +- harbour/source/vm/classes.c | 38 +++------ harbour/source/vm/debug.c | 6 +- harbour/source/vm/estack.c | 2 +- harbour/source/vm/extend.c | 2 +- harbour/source/vm/hashfunc.c | 2 +- harbour/source/vm/hvm.c | 54 ++++++------ harbour/source/vm/runner.c | 2 +- 59 files changed, 614 insertions(+), 379 deletions(-) create mode 100644 harbour/contrib/hbct/ctrand.prg create mode 100644 harbour/contrib/hbct/setrc.c diff --git a/harbour/ChangeLog b/harbour/ChangeLog index bdbde7e767..3a8df8c421 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,134 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2008-01-09 15:03 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/vm/estack.c + * added missing static to s_initSymbol declaration + + * harbour/include/hbgtinfo.ch + * harbour/source/rtl/scroll.c + * formatting + + * harbour/common.mak + * added empty line necessary for some make systems (f.e. wmake) + + * harbour/bin/hb-func.sh + * changed system libs order to avoid problems on some platforms + + * harbour/bin/pack_src.sh + * collect information about repository files using 'svn status -v' + command instead of scanning .svn/entries files to avoid problems + with different formats used by SVN + + * harbour/include/hbchksum.h + * harbour/include/hbset.h + ! added missing extern in few function prototypes + + * harbour/include/hbclass.ch + * use HB_CLS_PARAM_LIST macro instead of ... for strict C52 mode + + * harbour/source/common/hbfsapi.c + + added missing const to one declaration + + * harbour/source/common/hbstr.c + * minor cleanup in hb_stricmp() + + * harbour/source/rtl/inkey.c + ! casting to avoid negative values during char to int translation + + * harbour/source/rtl/mouse53.c + * added one internal definition + + * harbour/source/rtl/philes.c + * removed unnecessary #include(s) + * added missing const to one declaration + + * harbour/source/rtl/valtype.c + * harbour/source/vm/hashfunc.c + * cleanup RT error call to eliminate hb_paramError() function + + * harbour/source/pp/pplib.c + * harbour/source/vm/runner.c + * harbour/source/vm/debug.c + * harbour/source/vm/arrayshb.c + * harbour/source/vm/classes.c + * harbour/source/vm/hvm.c + * harbour/source/rtl/hbgtcore.c + * harbour/source/rtl/gtfunc.c + * harbour/source/rtl/hbinet.c + * harbour/source/rtl/hbregex.c + * harbour/source/rtl/idle.c + * harbour/source/rtl/errorapi.c + * harbour/source/rtl/hbtoken.c + * harbour/source/rtl/direct.c + * harbour/source/rdd/dbcmd.c + * harbour/source/rdd/dbcmd53.c + * harbour/source/rdd/fieldhb.c + * harbour/source/rdd/hbsix/sxcompr.c + * harbour/source/rdd/hbsix/sxcrypt.c + * harbour/source/compiler/hbcmplib.c + * harbour/contrib/hbrddads/adsfunc.c + * harbour/contrib/hbrddads/adsmgmnt.c + - removed unnecessary calls to hb_ret() + % replaced hb_itemRelease( hb_itemReturn( pItem ) ) with + hb_itemReturnRelease( pItem ) + % replaced hb_itemPut*( hb_arrayGetItemPtr( pArray, ... ), ... ) with + hb_arraySetNI( pArray, ... ) + + * harbour/source/macro/macro.y + * harbour/source/macro/macro.yyc + * harbour/contrib/xhb/cstructc.c + * harbour/contrib/hbw32/w32_ole.c + * harbour/contrib/hbgtwvg/wvtcore.c + * cleaned typos with double ;; + + * harbour/source/vm/extend.c + * harbour/source/rtl/math.c + * cleaned HB_EXPORT usage + + * harbour/source/pp/ppcore.c + ! fixed Harbour extension which allows to use match marker + at the beginning of rule definition + + * harbour/source/main/harbour.c + ! fixed hex conversion in FM log module - fix done by Phil Krylov + in xHarbour + + * harbour/source/rdd/nulsys/nulsys.c + + added dummy version of DBEVAL() and DBFILTER() - these functions + are used in RTL + + * harbour/contrib/hbct/bitnum.c + + added INTNEG(), INTPOS() + + + harbour/contrib/hbct/ctrand.prg + + added RANDOM(), RAND() - borrowd from xHarbour by Pavel Tsarenko + + + harbour/contrib/hbct/setrc.c + + added SETRC() + + * harbour/contrib/hbct/getinput.prg + % minor optimization + + * harbour/contrib/hbct/Makefile + * harbour/contrib/hbct/common.mak + * updated for new files + + * harbour/contrib/hbnf/tempfile.prg + * use HB_FTempCreate() - modification borrowed from xHarbour + TOFIX this function uses hb_isbyref() which does not exist + in Harbour + + * harbour/config/w32/msvc.cf + + added -nologo flag for cl.exe (Phil Krylov's modification borrowed + from xHarbour + + * harbour/config/w32/mingw32.cf + - removed repeated definitions + + * harbour/config/w32/install.cf + ! added alternative install rule for command.com with max line size limit + 2008-01-08 19:31 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * include/hbclass.ch ! Enabling HB_CLS_NO_DECORATION if compiled with HB_C52_STRICT, diff --git a/harbour/bin/hb-func.sh b/harbour/bin/hb-func.sh index 79e1c48d67..02b0e477d5 100755 --- a/harbour/bin/hb-func.sh +++ b/harbour/bin/hb-func.sh @@ -357,20 +357,20 @@ if [ -f "\${HB_LIB_INSTALL}/libgtsln.a" ]; then elif [ "\${HB_ARCHITECTURE}" = "bsd" ]; then SYSTEM_LIBS="\${SYSTEM_LIBS} -L/usr/local/lib" fi - SYSTEM_LIBS="\${SYSTEM_LIBS} -l${HB_SLN_LIB:-slang}" + SYSTEM_LIBS="-l${HB_SLN_LIB:-slang} \${SYSTEM_LIBS}" [ "\${HB_GPM_MOUSE}" = "yes" ] && HB_GPM_LIB="gpm" fi if [ -f "\${HB_LIB_INSTALL}/libgtcrs.a" ]; then - SYSTEM_LIBS="\${SYSTEM_LIBS} -l${HB_CRS_LIB:-ncurses}" + SYSTEM_LIBS="-l${HB_CRS_LIB:-ncurses} \${SYSTEM_LIBS}" [ "\${HB_GPM_MOUSE}" = "yes" ] && HB_GPM_LIB="gpm" fi if [ "\${HB_WITHOUT_X11}" != "yes" ]; then if [ -f "\${HB_LIB_INSTALL}/libgtxvt.a" ] || [ -f "\${HB_LIB_INSTALL}/libgtxwc.a" ]; then [ -d "/usr/X11R6/lib64" ] && SYSTEM_LIBS="\${SYSTEM_LIBS} -L/usr/X11R6/lib64" - SYSTEM_LIBS="\${SYSTEM_LIBS} -L/usr/X11R6/lib -lX11" + SYSTEM_LIBS="-L/usr/X11R6/lib -lX11 \${SYSTEM_LIBS}" fi fi -[ -n "\${HB_GPM_LIB}" ] && SYSTEM_LIBS="\${SYSTEM_LIBS} -l\${HB_GPM_LIB}" +[ -n "\${HB_GPM_LIB}" ] && SYSTEM_LIBS="-l\${HB_GPM_LIB} \${SYSTEM_LIBS}" if [ "\${HB_XBGTK}" = "yes" ]; then SYSTEM_LIBS="\${SYSTEM_LIBS} \`pkg-config --libs gtk+-2.0\`" @@ -380,7 +380,7 @@ fi if [ "\${HB_STATIC}" = "full" ]; then if [ "\${HB_ARCHITECTURE}" = "linux" ]; then - SYSTEM_LIBS="\${SYSTEM_LIBS} -lpthread" + SYSTEM_LIBS="\${SYSTEM_LIBS} -lpthread -ldl" fi LN_OPT="\${LN_OPT} -static" HB_STATIC="yes" diff --git a/harbour/bin/pack_src.sh b/harbour/bin/pack_src.sh index ec439b5086..6ab3d5a5d4 100755 --- a/harbour/bin/pack_src.sh +++ b/harbour/bin/pack_src.sh @@ -33,11 +33,20 @@ rm -f $hb_filename #[ -z "$TZ" ] && export TZ=PST8PDT +hb_get_entries() +{ + if [ "$format" = 8 ]; then + sed -e '/^\f/,+1 !d' -e '/[a-zA-Z0-9_]/ !d' $1/entries + else + sed -e '/^[ ]*name="..*"[\r]*$/ !d' -e 's/^[ ]*name="\(.*\)".*$/\1/g' $1/entries + fi +} + hb_collect_all() { for d in `find . -name ".svn"` do - for f in `sed -e '/^[ ]*name="..*"$/ !d' -e 's/^[ ]*name="\(.*\)"$/\1/g' $d/entries` + for f in `hb_get_entries $d` do f="`dirname $d`/$f" [ -f "$f" ] && echo "$f" @@ -45,7 +54,20 @@ hb_collect_all() done } +hb_collect_all_svn() +{ + for f in `svn status -v|sed -e '/^?/ d' -e 's/.* \([^ ]*\)/\1/g'` + do + [ -f "$f" ] && echo "$f" + done +} + hb_flst="$hb_rootdir/bin/hb_flst.tmp" -(cd "$hb_rootdir";hb_collect_all) > "$hb_flst" +#format=`cat $hb_rootdir/.svn/format` +if [ "$format" = 4 ] || [ "$format" = 8 ]; then + (cd "$hb_rootdir";hb_collect_all) > "$hb_flst" +else + (cd "$hb_rootdir";hb_collect_all_svn) > "$hb_flst" +fi $hb_archbin $hb_archopt $hb_filename --files-from "$hb_flst" rm -fR "$hb_flst" diff --git a/harbour/common.mak b/harbour/common.mak index c58093baf5..069aaf791e 100644 --- a/harbour/common.mak +++ b/harbour/common.mak @@ -1065,10 +1065,11 @@ HBDOC_EXE_OBJS = \ # PDF support for HBDOC HBDOC_EXE_OBJS = \ - $(HBDOC_EXE_OBJS) \ + $(HBDOC_EXE_OBJS) \ $(OBJ_DIR)\pdfhbdoc$(OBJEXT) \ $(OBJ_DIR)\genpdf1$(OBJEXT) \ + !endif #********************************************************** diff --git a/harbour/config/w32/install.cf b/harbour/config/w32/install.cf index 0ea250cebd..f6cd2474bb 100644 --- a/harbour/config/w32/install.cf +++ b/harbour/config/w32/install.cf @@ -2,11 +2,31 @@ # $Id$ # -ifeq ($(SHLVL),) # COMMAND.COM +ifeq ($(INSTALL_OBJS),) # Empty install list + +INSTALL_RULE = @echo Done + +else + +ifeq ($(SHLVL),) # COMMAND.COM or CMD.EXE INSTALL_LIST = $(subst /,\,$(INSTALL_OBJS)) -INSTALL_RULE =\ - $(COMSPEC) /c FOR %f IN ($(INSTALL_LIST)) DO COPY %f $(subst /,\,$(INSTALL_DIR)) + +ifeq ($(CMD_EXE),yes) +# CMD.EXE no command line size limit +INSTALL_RULE = \ + $(COMSPEC) /c for %f in ($(INSTALL_LIST)) do copy %f $(subst /,\,$(INSTALL_DIR)) +else +# We have to use script to overcome the DOS limit of max 128 characters +# NOTE: The empty line directly before 'endef' HAVE TO exist! +# It causes that every commands will be separated by LF +define inst_file +$(CP) $(file) $(subst /,\,$(INSTALL_DIR)) + +endef +INSTALL_RULE = \ + $(foreach file, $(INSTALL_LIST), $(inst_file)) +endif else # bash @@ -28,3 +48,5 @@ INSTALL_RULE =\ fi endif + +endif # Empty install list diff --git a/harbour/config/w32/mingw32.cf b/harbour/config/w32/mingw32.cf index 1c08cd4892..40f4a3611e 100644 --- a/harbour/config/w32/mingw32.cf +++ b/harbour/config/w32/mingw32.cf @@ -132,8 +132,6 @@ ARFLAGS = $(A_USR) RANLIB = $(CCPREFIX)ranlib -AR = $(CCPREFIX)ar -ARFLAGS = $(A_USR) ifeq ($(SHLVL),) # COMMAND.COM - length of command line is limited ifneq ($(OS),Windows_NT) diff --git a/harbour/config/w32/msvc.cf b/harbour/config/w32/msvc.cf index a1e69736eb..935fbf6b5b 100644 --- a/harbour/config/w32/msvc.cf +++ b/harbour/config/w32/msvc.cf @@ -13,7 +13,7 @@ CC = cl.exe CC_IN = -c CC_OUT = -Fo CPPFLAGS = -I. -I$(HB_INC_COMPILE) -CFLAGS = -W0 -Zi # -W4 for max warnings +CFLAGS = -nologo -W0 -Zi # -W4 for max warnings LD = cl.exe LD_OUT = -Fe diff --git a/harbour/contrib/hbct/Makefile b/harbour/contrib/hbct/Makefile index 380378cfb5..d92cbab35d 100644 --- a/harbour/contrib/hbct/Makefile +++ b/harbour/contrib/hbct/Makefile @@ -72,6 +72,7 @@ C_SOURCES =\ screen1.c \ screen2.c \ setlast.c \ + setrc.c \ strdiff.c \ strswap.c \ tab.c \ @@ -86,6 +87,7 @@ PRG_SOURCES=\ blank.prg \ ct.prg \ ctmisc.prg \ + ctrand.prg \ cttime.prg \ fcopy.prg \ getinfo.prg \ diff --git a/harbour/contrib/hbct/bitnum.c b/harbour/contrib/hbct/bitnum.c index c9d6734be9..f3e4e12557 100644 --- a/harbour/contrib/hbct/bitnum.c +++ b/harbour/contrib/hbct/bitnum.c @@ -6,7 +6,8 @@ * Harbour Project source code: * CT3 Number and bit manipulation functions: * NUMAND(), NUMOR(), NUMXOR(), NUMNOT(), NUMHIGH(), NUMLOW() - * NUMROL(), NUMMIRR(), CLEARBIT(), SETBIT(), ISBIT() + * NUMROL(), NUMMIRR(), CLEARBIT(), SETBIT(), ISBIT(), + * INTNEG(), INTPOS() * * Copyright 2007 Przemyslaw Czerpak * www - http://www.harbour-project.org @@ -283,3 +284,41 @@ HB_FUNC( ISBIT ) hb_retl( lValue != 0 ); } + +HB_FUNC( INTNEG ) +{ + HB_LONG lValue; + + if( __numParam( 1, &lValue ) ) + { + BOOL f32Bit = ISLOG( 2 ) && hb_parl( 2 ); + + if( f32Bit ) + hb_retnint( ( INT16 ) lValue ); + else + hb_retnint( ( INT32 ) lValue ); + } + else + hb_retni( 0 ); +} + +HB_FUNC( INTPOS ) +{ + HB_LONG lValue; + + if( __numParam( 1, &lValue ) ) + { + BOOL f32Bit = ISLOG( 2 ) && hb_parl( 2 ); + + if( f32Bit ) + hb_retnint( ( UINT16 ) lValue ); + else +#ifndef HB_LONG_LONG_OFF + hb_retnint( ( UINT32 ) lValue ); +#else + hb_retnlen( ( UINT32 ) lValue, 0, 0 ); +#endif + } + else + hb_retni( 0 ); +} diff --git a/harbour/contrib/hbct/common.mak b/harbour/contrib/hbct/common.mak index eead94f6fe..c94159b3fb 100644 --- a/harbour/contrib/hbct/common.mak +++ b/harbour/contrib/hbct/common.mak @@ -81,6 +81,7 @@ LIB_OBJS = \ $(OBJ_DIR)\screen1$(OBJEXT) \ $(OBJ_DIR)\screen2$(OBJEXT) \ $(OBJ_DIR)\setlast$(OBJEXT) \ + $(OBJ_DIR)\setrc$(OBJEXT) \ $(OBJ_DIR)\strdiff$(OBJEXT) \ $(OBJ_DIR)\strswap$(OBJEXT) \ $(OBJ_DIR)\tab$(OBJEXT) \ @@ -94,6 +95,7 @@ LIB_OBJS = \ $(OBJ_DIR)\blank$(OBJEXT) \ $(OBJ_DIR)\ct$(OBJEXT) \ $(OBJ_DIR)\ctmisc$(OBJEXT) \ + $(OBJ_DIR)\ctrand$(OBJEXT) \ $(OBJ_DIR)\cttime$(OBJEXT) \ $(OBJ_DIR)\fcopy$(OBJEXT) \ $(OBJ_DIR)\getinfo$(OBJEXT) \ diff --git a/harbour/contrib/hbct/ctrand.prg b/harbour/contrib/hbct/ctrand.prg new file mode 100644 index 0000000000..47b002de08 --- /dev/null +++ b/harbour/contrib/hbct/ctrand.prg @@ -0,0 +1,62 @@ +/* + * $Id$ + */ +/* + * Harbour Project source code: + * CT3 functions: RANDOM(), RAND() + * + * Copyright 2007 Pavel Tsarenko + * 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 "common.ch" + +FUNCTION Random( lMode ) +RETURN IIF( VALTYPE( lMode ) == "L" .AND. lMode, ; + HB_RandomInt( 0, 65535 ), HB_RandomInt( -32768, 32767 ) ) + +FUNCTION Rand( nStart ) + IF nStart != NIL + HB_RandomSeed( nStart ) + ENDIF +RETURN HB_Random() diff --git a/harbour/contrib/hbct/getinput.prg b/harbour/contrib/hbct/getinput.prg index 38f70c46c2..47452c16b7 100644 --- a/harbour/contrib/hbct/getinput.prg +++ b/harbour/contrib/hbct/getinput.prg @@ -61,10 +61,10 @@ FUNCTION GETINPUT( xVar, nRow, nCol, lSay, xPrompt ) LOCAL GetList := {} IF !ISNUMBER( nRow ) - nRow := ROW() + nRow := nCursorRow ENDIF IF !ISNUMBER( nCol ) - nCol := COL() + nCol := nCursorCol ENDIF IF !ISLOGICAL( lSay ) lSay := .F. diff --git a/harbour/contrib/hbct/setrc.c b/harbour/contrib/hbct/setrc.c new file mode 100644 index 0000000000..68cd601c5d --- /dev/null +++ b/harbour/contrib/hbct/setrc.c @@ -0,0 +1,69 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * CT3 function: SETRC() + * + * Copyright 2008 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. + * + */ + +#include "hbapigt.h" + +HB_FUNC( SETRC ) +{ + BOOL fRow = ISNUM( 1 ), fCol = ISNUM( 2 ); + + if( fRow && fCol ) + hb_gtSetPos( hb_parni( 1 ), hb_parni( 2 ) ); + else + { + SHORT sRow, sCol; + hb_gtGetPos( &sRow, &sCol ); + hb_gtSetPos( fRow ? hb_parni( 1 ) : sRow, fCol ? hb_parni( 2 ) : sCol ); + } + + hb_retc( NULL ); +} diff --git a/harbour/contrib/hbgtwvg/wvtcore.c b/harbour/contrib/hbgtwvg/wvtcore.c index 0926965212..80c2d27adb 100644 --- a/harbour/contrib/hbgtwvg/wvtcore.c +++ b/harbour/contrib/hbgtwvg/wvtcore.c @@ -2755,7 +2755,7 @@ HB_FUNC( WVT_DRAWSCROLLTHUMBHORZ ) int iLeft = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 5,2 ); int iBottom = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 ); int iRight = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 ); - int iThumbLeft, iThumbRight;; + int iThumbLeft, iThumbRight; iThumbLeft = _s->PTEXTSIZE.x * hb_parni( 6 ); iThumbRight = iThumbLeft + ( _s->PTEXTSIZE.x * 2 ) - 1; diff --git a/harbour/contrib/hbnf/tempfile.prg b/harbour/contrib/hbnf/tempfile.prg index 090ff4736a..772d0cf3c9 100644 --- a/harbour/contrib/hbnf/tempfile.prg +++ b/harbour/contrib/hbnf/tempfile.prg @@ -144,67 +144,23 @@ #include "fileio.ch" FUNCTION FT_TEMPFIL( cPath, lHide, nHandle ) - LOCAL nError := 0, cFile + + LOCAL cFile Default cPath to ".\" Default lHide to .f. cPath = alltrim( cPath ) - if right( cPath ) # "\" - cPath += "\" - endif - - do while .t. - cFile = ntoc( int( ft_rand1( 65535 ) ), 16 ) + ntoc( int( ft_rand1( 65535 ) ), 16 ) - - nHandle := fopen( cPath + cFile ) // Use this method because - // the FILE() function can't see - // the hidden and system files - - if ferror() = 2 // File not found - - nHandle = fcreate( cPath + cFile, if( lHide, FC_HIDDEN, FC_NORMAL ) ) - - if ferror() = 5 - fclose( nHandle ) - loop - endif - - if ferror() # 0 - nError ++ - if nError > 10 - cFile = "" - exit - endif - endif - fclose( nHandle ) - - nHandle = fopen( cPath + cFile, FO_EXCLUSIVE + FO_READWRITE ) - if ferror() = 0 - exit - else - nError ++ - if nError > 10 - cFile = "" - exit - endif - endif - - else - fclose( nHandle ) - - endif - - enddo + nHandle := HB_FTempCreate( cPath, nil, if( lHide, FC_HIDDEN, FC_NORMAL ), @cFile ) if !hb_isbyref( @nHandle ) fclose( nHandle ) endif - return cFile + RETURN cFile -#endif +#endif /* FT_TEMPFILE_ORIGINAL */ #ifdef FT_TEST FUNCTION MAIN( cPath, cHide ) diff --git a/harbour/contrib/hbrddads/adsfunc.c b/harbour/contrib/hbrddads/adsfunc.c index 13be9e8cfb..99d655abe0 100644 --- a/harbour/contrib/hbrddads/adsfunc.c +++ b/harbour/contrib/hbrddads/adsfunc.c @@ -310,10 +310,10 @@ HB_FUNC( ADSGETSERVERTIME ) hb_storc( (char * )pucDateBuf, -1, 1 ); hb_storc( (char *) pucTimeBuf, -1, 2 ); hb_stornl( plTime, -1, 3 ); - } else + } + else { AdsShowError( (UNSIGNED8 *) "AdsGetServerTime error:" ); - hb_ret(); } } @@ -2491,7 +2491,7 @@ HB_FUNC( ADSDIRECTORY ) AdsFindClose( hConnect, sHandle ); } - hb_itemRelease( hb_itemReturn( pitmDir ) ); + hb_itemReturnRelease( pitmDir ); } @@ -2561,10 +2561,6 @@ HB_FUNC( ADSGETSERVERNAME ) { hb_retclen( buf, usLen ); } - else - { - hb_ret(); - } } #endif /* ADS_REQUIRE_VERSION >= 6 */ diff --git a/harbour/contrib/hbrddads/adsmgmnt.c b/harbour/contrib/hbrddads/adsmgmnt.c index 1668108d61..942e5ed1fc 100644 --- a/harbour/contrib/hbrddads/adsmgmnt.c +++ b/harbour/contrib/hbrddads/adsmgmnt.c @@ -110,10 +110,6 @@ HB_FUNC( ADSMGGETINSTALLINFO ) hb_storc ( (char *) stInstallInfo.aucEvalExpireDate , -1, 7 ); /* Eval expiration date */ hb_storc ( (char *) stInstallInfo.aucSerialNumber , -1, 8 ); /* Serial number string */ } - else - { - hb_ret( ); - } } HB_FUNC( ADSMGGETACTIVITYINFO ) @@ -130,8 +126,6 @@ HB_FUNC( ADSMGGETACTIVITYINFO ) // printf( "\nActivity Information structure on server is larger." ); // printf( "\nMore possible info available." ); */ - hb_ret(); /* default to NIL */ - if ( iOption && ulRetVal == AE_SUCCESS ) { switch ( iOption ) @@ -267,11 +261,6 @@ HB_FUNC( ADSMGGETCOMMSTATS ) hb_stornl( stCommStats.ulRecvFromErrors , -1, 10); /* RecvFrom failed (NT only) */ hb_stornl( stCommStats.ulSendToErrors , -1, 11); /* SendTo failed (NT only) */ } - else - { - hb_ret(); - } - } HB_FUNC( ADSMGRESETCOMMSTATS ) @@ -373,10 +362,6 @@ HB_FUNC( ADSMGGETCONFIGINFO ) } } - else - { - hb_ret(); - } } HB_FUNC( ADSMGGETUSERNAMES ) /* Return array of connected users */ @@ -431,7 +416,7 @@ HB_FUNC( ADSMGGETUSERNAMES ) /* Return array of connected users */ hb_itemPutC( hb_arrayGetItemPtr( pArrayItm, 3 ), ( char * ) pastUserInfo[ulCount].aucAddress ); } - hb_itemRelease( hb_itemReturn( pArray ) ); + hb_itemReturnRelease( pArray ); } else { diff --git a/harbour/contrib/hbw32/w32_ole.c b/harbour/contrib/hbw32/w32_ole.c index bb155ee5ee..592d0b9baf 100644 --- a/harbour/contrib/hbw32/w32_ole.c +++ b/harbour/contrib/hbw32/w32_ole.c @@ -882,7 +882,7 @@ static void hb_vmRequestReset( void ) static PHB_ITEM SafeArrayToArray( SAFEARRAY *parray, UINT iDim, long* rgIndices, VARTYPE vt ) { long iFrom, iTo, iLen, i; - PHB_ITEM pArray = hb_itemNew( NULL );; + PHB_ITEM pArray = hb_itemNew( NULL ); if( parray == NULL ) { diff --git a/harbour/contrib/xhb/cstructc.c b/harbour/contrib/xhb/cstructc.c index ea4ae6eeef..54362b968b 100644 --- a/harbour/contrib/xhb/cstructc.c +++ b/harbour/contrib/xhb/cstructc.c @@ -330,7 +330,7 @@ static BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, unsigned int uiAli && ( pBaseVar->pItems + ulIndex )->type != HB_IT_LONG ) { hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); - return NULL;; + return NULL; } uiMemberSize = sizeof( char * ); @@ -348,7 +348,7 @@ static BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, unsigned int uiAli && ( pBaseVar->pItems + ulIndex )->type != HB_IT_LONG ) { hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); - return NULL;; + return NULL; } uiMemberSize = sizeof( short * ); @@ -366,7 +366,7 @@ static BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, unsigned int uiAli && ( pBaseVar->pItems + ulIndex )->type != HB_IT_LONG ) { hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); - return NULL;; + return NULL; } uiMemberSize = sizeof( int * ); @@ -384,7 +384,7 @@ static BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, unsigned int uiAli && ( pBaseVar->pItems + ulIndex )->type != HB_IT_LONG ) { hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); - return NULL;; + return NULL; } uiMemberSize = sizeof( long * ); @@ -1153,13 +1153,13 @@ static PHB_ITEM StructureToArray( BYTE* Buffer, unsigned long ulBufferLen, PHB_I { hb_itemRelease( pStructure ); hb_errRT_BASE( EG_ARG, 2023, NULL, "StructureToArray", 1, hb_paramError( 1 ) ); - return pRet;; + return pRet; } } else { hb_errRT_BASE( EG_ARG, 2023, NULL, "StructureToArray", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); - return pRet;; + return pRet; } } } diff --git a/harbour/include/hbchksum.h b/harbour/include/hbchksum.h index 3d4047f1b9..52475d66d1 100644 --- a/harbour/include/hbchksum.h +++ b/harbour/include/hbchksum.h @@ -54,12 +54,12 @@ HB_EXTERN_BEGIN -HB_EXPORT ULONG hb_adler32( ULONG adler, const BYTE *buf, ULONG len ); -HB_EXPORT ULONG hb_crc16( ULONG crc, const BYTE *buf, ULONG len ); -HB_EXPORT ULONG hb_crc32( ULONG crc, const BYTE *buf, ULONG len ); -HB_EXPORT HB_ULONG hb_crc( HB_ULONG crc, const BYTE * buf, ULONG len, HB_ULONG poly ); -HB_EXPORT HB_ULONG hb_crcct( HB_ULONG crc, const BYTE * buf, ULONG len, HB_ULONG poly ); -HB_EXPORT void hb_md5( BYTE * ucData, ULONG ulLen, BYTE * ucDigest ); -HB_EXPORT void hb_md5file( FHANDLE hFile, BYTE * ucDigest ); +extern HB_EXPORT ULONG hb_adler32( ULONG adler, const BYTE *buf, ULONG len ); +extern HB_EXPORT ULONG hb_crc16( ULONG crc, const BYTE *buf, ULONG len ); +extern HB_EXPORT ULONG hb_crc32( ULONG crc, const BYTE *buf, ULONG len ); +extern HB_EXPORT HB_ULONG hb_crc( HB_ULONG crc, const BYTE * buf, ULONG len, HB_ULONG poly ); +extern HB_EXPORT HB_ULONG hb_crcct( HB_ULONG crc, const BYTE * buf, ULONG len, HB_ULONG poly ); +extern HB_EXPORT void hb_md5( BYTE * ucData, ULONG ulLen, BYTE * ucDigest ); +extern HB_EXPORT void hb_md5file( FHANDLE hFile, BYTE * ucDigest ); HB_EXTERN_END diff --git a/harbour/include/hbclass.ch b/harbour/include/hbclass.ch index 2576d4af20..ba02f5dae2 100644 --- a/harbour/include/hbclass.ch +++ b/harbour/include/hbclass.ch @@ -124,16 +124,20 @@ #ifndef __HARBOUR__ #define HB_CLS_NO_DECORATION #define HB_CLS_NO_DECLARATIONS + #define HB_CLS_PARAM_LIST #endif /* Disable method decoration when Harbour compiled strict compatibility mode. In strict mode, PP doesn't support identifier concatenation, which would be needed for method decoration. */ #ifdef HB_C52_STRICT - #ifndef HB_CLS_NO_DECORATION - #define HB_CLS_NO_DECORATION - #endif -#endif + #ifndef HB_CLS_NO_DECORATION + #define HB_CLS_NO_DECORATION + #endif + #ifndef HB_CLS_PARAM_LIST + #define HB_CLS_PARAM_LIST + #endif +#endif /* * I have to enable this definition by default untill we will not fix @@ -148,6 +152,11 @@ #xtranslate __HB_CLS_MTHNAME => _ #endif +/* parameters list passed throw - it's Harbour extnesion */ +#ifndef HB_CLS_PARAM_LIST + #define HB_CLS_PARAM_LIST ... +#endif + /* should we use _HB_CLASS/_HB_MEMBER declarations? */ #ifdef HB_CLS_NO_DECLARATIONS #xcommand _HB_CLASS => @@ -245,7 +254,7 @@ DECLARE HBClass ; [ ] ; [ ] [ FUNCTION ] => ; _HB_CLASS ;; - function __HB_CLS_OPT([,] ) ( ... ) ;; + function __HB_CLS_OPT([,] ) ( HB_CLS_PARAM_LIST ) ;; static s_oClass ;; local nScope, oInstance ;; if s_oClass == NIL ;; @@ -263,7 +272,7 @@ DECLARE HBClass ; s_oClass:Create() ; [<-lck-> __clsLock( s_oClass:hClass ) ] ;; oInstance := s_oClass:Instance() ;; if __ObjHasMsg( oInstance, "InitClass" ) ;; - oInstance:InitClass( ... ) ;; + oInstance:InitClass( HB_CLS_PARAM_LIST ) ;; end ;; return oInstance ;; end ;; diff --git a/harbour/include/hbgtinfo.ch b/harbour/include/hbgtinfo.ch index 122e820a5c..67d1fa9e1b 100644 --- a/harbour/include/hbgtinfo.ch +++ b/harbour/include/hbgtinfo.ch @@ -51,12 +51,12 @@ * */ -/* +/* Minimal informations: - + READ doc/gtinfo.txt */ - + #ifndef HB_GTINFO_CH_ #define HB_GTINFO_CH_ @@ -128,8 +128,8 @@ #define GTI_FONTW_THIN 1 #define GTI_FONTW_NORMAL 2 #define GTI_FONTW_BOLD 3 - -/* Font sizes */ + +/* Font sizes */ #define GTI_FONTQ_DRAFT 1 #define GTI_FONTQ_NORMAL 2 #define GTI_FONTQ_HIGH 3 diff --git a/harbour/include/hbset.h b/harbour/include/hbset.h index bcb8ee10d1..0c9e4329e4 100644 --- a/harbour/include/hbset.h +++ b/harbour/include/hbset.h @@ -234,10 +234,10 @@ extern int hb_setListenerRemove( int ); extern HB_EXPORT HB_SET_STRUCT hb_set; #endif -HB_EXPORT BOOL hb_setGetL( HB_set_enum set_specifier ); -HB_EXPORT char * hb_setGetCPtr( HB_set_enum set_specifier ); -HB_EXPORT int hb_setGetNI( HB_set_enum set_specifier ); -HB_EXPORT long hb_setGetNL( HB_set_enum set_specifier ); +extern HB_EXPORT BOOL hb_setGetL( HB_set_enum set_specifier ); +extern HB_EXPORT char * hb_setGetCPtr( HB_set_enum set_specifier ); +extern HB_EXPORT int hb_setGetNI( HB_set_enum set_specifier ); +extern HB_EXPORT long hb_setGetNL( HB_set_enum set_specifier ); extern HB_EXPORT HB_PATHNAMES * hb_setGetFirstSetPath( void ); diff --git a/harbour/source/common/hbfsapi.c b/harbour/source/common/hbfsapi.c index e696b35bea..0617a5b951 100644 --- a/harbour/source/common/hbfsapi.c +++ b/harbour/source/common/hbfsapi.c @@ -225,7 +225,7 @@ HB_EXPORT PHB_FNAME hb_fsFNameSplit( const char * pszFileName ) /* This function joins path, name and extension into a string with a filename */ HB_EXPORT char * hb_fsFNameMerge( char * pszFileName, PHB_FNAME pFileName ) { - static char s_szPathSep[] = { OS_PATH_DELIMITER, 0 }; /* see NOTE below */ + static const char s_szPathSep[] = { OS_PATH_DELIMITER, 0 }; /* see NOTE below */ char * pszName; HB_TRACE(HB_TR_DEBUG, ("hb_fsFNameMerge(%p, %p)", pszFileName, pFileName)); diff --git a/harbour/source/common/hbstr.c b/harbour/source/common/hbstr.c index 39724f0751..770d3e84e2 100644 --- a/harbour/source/common/hbstr.c +++ b/harbour/source/common/hbstr.c @@ -199,14 +199,14 @@ HB_EXPORT int hb_stricmp( const char * s1, const char * s2 ) c1 = toupper( (unsigned char) *s1 ); c2 = toupper( (unsigned char) *s2 ); - s1++; - s2++; - if( c1 != c2 ) { rc = ( c1 < c2 ? -1 : 1 ); break; } + + s1++; + s2++; } while ( c1 ); diff --git a/harbour/source/compiler/hbcmplib.c b/harbour/source/compiler/hbcmplib.c index 35e4984a2d..637528a23b 100644 --- a/harbour/source/compiler/hbcmplib.c +++ b/harbour/source/compiler/hbcmplib.c @@ -56,7 +56,7 @@ static void hb_compGenArgList( int iFirst, int iLast, int * pArgC, char *** pArgV ) { - PHB_ITEM pParam, pItem; + PHB_ITEM pParam; ULONG ul; int argc = 0, i; char ** argv; @@ -71,8 +71,7 @@ static void hb_compGenArgList( int iFirst, int iLast, ul = hb_arrayLen( pParam ); if( ul ) do { - pItem = hb_arrayGetItemPtr( pParam, ul ); - if( pItem && HB_IS_STRING( pItem ) ) + if( hb_arrayGetType( pParam, ul ) & HB_IT_STRING ) ++argc; } while( --ul ); @@ -94,9 +93,8 @@ static void hb_compGenArgList( int iFirst, int iLast, ul = hb_arrayLen( pParam ); if( ul ) do { - pItem = hb_arrayGetItemPtr( pParam, ul ); - if( pItem && HB_IS_STRING( pItem ) ) - argv[ argc++ ] = hb_itemGetCPtr( pItem ); + if( hb_arrayGetType( pParam, ul ) & HB_IT_STRING ) + argv[ argc++ ] = hb_arrayGetCPtr( pParam, ul ); } while( --ul ); } diff --git a/harbour/source/macro/macro.y b/harbour/source/macro/macro.y index d0f6bb4d06..9ef59c873e 100644 --- a/harbour/source/macro/macro.y +++ b/harbour/source/macro/macro.y @@ -842,7 +842,7 @@ static void hb_macroLstFree( HB_MACRO_PTR pMacro ) while( pMacro->pIdentLst ) { - HB_MIDENT_PTR pMIdent = ( HB_MIDENT_PTR ) HB_MACRO_DATA->pIdentLst;; + HB_MIDENT_PTR pMIdent = ( HB_MIDENT_PTR ) HB_MACRO_DATA->pIdentLst; HB_MACRO_DATA->pIdentLst = ( void * ) pMIdent->pPrev; hb_xfree( pMIdent->Identifier ); hb_xfree( pMIdent ); diff --git a/harbour/source/macro/macro.yyc b/harbour/source/macro/macro.yyc index 08a575bb52..c6991b349c 100644 --- a/harbour/source/macro/macro.yyc +++ b/harbour/source/macro/macro.yyc @@ -3273,7 +3273,7 @@ static void hb_macroLstFree( HB_MACRO_PTR pMacro ) while( pMacro->pIdentLst ) { - HB_MIDENT_PTR pMIdent = ( HB_MIDENT_PTR ) HB_MACRO_DATA->pIdentLst;; + HB_MIDENT_PTR pMIdent = ( HB_MIDENT_PTR ) HB_MACRO_DATA->pIdentLst; HB_MACRO_DATA->pIdentLst = ( void * ) pMIdent->pPrev; hb_xfree( pMIdent->Identifier ); hb_xfree( pMIdent ); diff --git a/harbour/source/main/harbour.c b/harbour/source/main/harbour.c index db80fef02c..4e4b2b50e3 100644 --- a/harbour/source/main/harbour.c +++ b/harbour/source/main/harbour.c @@ -277,8 +277,8 @@ static char * hb_memToStr( char * szBuffer, void * pMem, ULONG ulSize ) { int iLo = byMem[ i ] & 0x0f, iHi = byMem[ i ] >> 4; * pDest++ = '\\'; - * pDest++ = iHi < 9 ? '0' + iHi : 'A' - 10 + iHi; - * pDest++ = iLo < 9 ? '0' + iLo : 'A' - 10 + iLo; + * pDest++ = iHi <= 9 ? '0' + iHi : 'A' - 10 + iHi; + * pDest++ = iLo <= 9 ? '0' + iLo : 'A' - 10 + iLo; } } * pDest = '\0'; diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 9111a7fd96..1bf4b08b1f 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -1658,7 +1658,7 @@ static void hb_pp_ruleListFree( PHB_PP_RULE * pRulePtr ) } } -static void hb_pp_ruleNonStdFree( PHB_PP_RULE * pRulePtr ) +static void hb_pp_ruleListNonStdFree( PHB_PP_RULE * pRulePtr ) { PHB_PP_RULE pRule; @@ -1677,7 +1677,7 @@ static void hb_pp_ruleNonStdFree( PHB_PP_RULE * pRulePtr ) } } -static void hb_pp_ruleSetStd( PHB_PP_RULE pRule ) +static void hb_pp_ruleListSetStd( PHB_PP_RULE pRule ) { while( pRule ) { @@ -1686,11 +1686,25 @@ static void hb_pp_ruleSetStd( PHB_PP_RULE pRule ) } } -static void hb_pp_ruleSetId( PHB_PP_STATE pState, PHB_PP_RULE pRule, BYTE id ) +static void hb_pp_ruleSetId( PHB_PP_STATE pState, PHB_PP_TOKEN pMatch, BYTE id ) +{ + if( HB_PP_TOKEN_ISMATCH( pMatch ) ) + { + int i; + for( i = 0; i < HB_PP_HASHID_MAX; ++i ) + pState->pMap[ i ] |= id; + } + else + pState->pMap[ HB_PP_HASHID( pMatch ) ] |= id; +} + +static void hb_pp_ruleListSetId( PHB_PP_STATE pState, PHB_PP_RULE pRule, BYTE id ) { while( pRule ) { - pState->pMap[ HB_PP_HASHID( pRule->pMatch ) ] |= id; + hb_pp_ruleSetId( pState, pRule->pMatch, id ); + if( HB_PP_TOKEN_ISMATCH( pRule->pMatch ) ) + break; pRule = pRule->pPrev; } } @@ -1736,7 +1750,7 @@ static void hb_pp_defineAdd( PHB_PP_STATE pState, USHORT mode, pState->pDefinitions = pRule; pState->iDefinitions++; } - pState->pMap[ HB_PP_HASHID( pMatch ) ] |= HB_PP_DEFINE; + hb_pp_ruleSetId( pState, pMatch, HB_PP_DEFINE ); } static void hb_pp_defineDel( PHB_PP_STATE pState, PHB_PP_TOKEN pToken ) @@ -3214,14 +3228,14 @@ static void hb_pp_directiveNew( PHB_PP_STATE pState, PHB_PP_TOKEN pToken, pRule->pPrev = pState->pCommands; pState->pCommands = pRule; pState->iCommands++; - pState->pMap[ HB_PP_HASHID( pMatch ) ] |= HB_PP_COMMAND; + hb_pp_ruleSetId( pState, pMatch, HB_PP_COMMAND ); } else { pRule->pPrev = pState->pTranslations; pState->pTranslations = pRule; pState->iTranslations++; - pState->pMap[ HB_PP_HASHID( pMatch ) ] |= HB_PP_TRANSLATE; + hb_pp_ruleSetId( pState, pMatch, HB_PP_TRANSLATE ); } pMatch = pResult = NULL; } @@ -4992,9 +5006,9 @@ void hb_pp_reset( PHB_PP_STATE pState ) hb_pp_OutFileFree( pState ); hb_pp_TraceFileFree( pState ); - hb_pp_ruleNonStdFree( &pState->pDefinitions ); - hb_pp_ruleNonStdFree( &pState->pTranslations ); - hb_pp_ruleNonStdFree( &pState->pCommands ); + hb_pp_ruleListNonStdFree( &pState->pDefinitions ); + hb_pp_ruleListNonStdFree( &pState->pTranslations ); + hb_pp_ruleListNonStdFree( &pState->pCommands ); } /* @@ -5020,13 +5034,13 @@ void hb_pp_addSearchPath( PHB_PP_STATE pState, const char * szPath, BOOL fReplac void hb_pp_setStdBase( PHB_PP_STATE pState ) { pState->fError = FALSE; - hb_pp_ruleSetStd( pState->pDefinitions ); - hb_pp_ruleSetStd( pState->pTranslations ); - hb_pp_ruleSetStd( pState->pCommands ); + hb_pp_ruleListSetStd( pState->pDefinitions ); + hb_pp_ruleListSetStd( pState->pTranslations ); + hb_pp_ruleListSetStd( pState->pCommands ); memset( pState->pMap, 0, sizeof( pState->pMap ) ); - hb_pp_ruleSetId( pState, pState->pDefinitions, HB_PP_DEFINE ); - hb_pp_ruleSetId( pState, pState->pTranslations, HB_PP_TRANSLATE ); - hb_pp_ruleSetId( pState, pState->pCommands, HB_PP_COMMAND ); + hb_pp_ruleListSetId( pState, pState->pDefinitions, HB_PP_DEFINE ); + hb_pp_ruleListSetId( pState, pState->pTranslations, HB_PP_TRANSLATE ); + hb_pp_ruleListSetId( pState, pState->pCommands, HB_PP_COMMAND ); /* clear total number of preprocessed lines so we will report only * lines in compiled .prg files diff --git a/harbour/source/pp/pplib.c b/harbour/source/pp/pplib.c index 4f43e31147..adf4cc4388 100644 --- a/harbour/source/pp/pplib.c +++ b/harbour/source/pp/pplib.c @@ -164,7 +164,7 @@ HB_FUNC( __PP_INIT ) hb_pp_initDynDefines( pState ); hb_pp_setStdBase( pState ); - hb_itemRelease( hb_itemReturnForward( ppItem ) ); + hb_itemReturnRelease( ppItem ); } else hb_ret(); diff --git a/harbour/source/rdd/dbcmd.c b/harbour/source/rdd/dbcmd.c index 746c721e6f..d2b8f0738e 100644 --- a/harbour/source/rdd/dbcmd.c +++ b/harbour/source/rdd/dbcmd.c @@ -656,7 +656,7 @@ HB_FUNC( DBRLOCKLIST ) { PHB_ITEM pList = hb_itemArrayNew( 0 ); SELF_INFO( pArea, DBI_GETLOCKARRAY, pList ); - hb_itemRelease( hb_itemReturnForward( pList ) ); + hb_itemReturnRelease( pList ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "DBRLOCKLIST" ); @@ -788,7 +788,7 @@ HB_FUNC( DBSTRUCT ) AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); if( pArea ) hb_tblStructure( pArea, pStruct, DBS_ALEN ); - hb_itemRelease( hb_itemReturn( pStruct ) ); + hb_itemReturnRelease( pStruct ); } HB_FUNC( DBTABLEEXT ) @@ -815,8 +815,7 @@ HB_FUNC( DBTABLEEXT ) { SELF_INFO( pArea, DBI_TABLEEXT, pItem ); } - hb_itemReturnForward( pItem ); - hb_itemRelease( pItem ); + hb_itemReturnRelease( pItem ); } HB_FUNC( DBUNLOCK ) @@ -893,8 +892,7 @@ HB_FUNC( FIELDGET ) SELF_GETVALUE( pArea, uiField, pItem ); } - hb_itemReturnForward( pItem ); - hb_itemRelease( pItem ); + hb_itemReturnRelease( pItem ); } HB_FUNC( FIELDNAME ) @@ -990,8 +988,7 @@ HB_FUNC( HEADER ) { PHB_ITEM pItem = hb_itemNew( NULL ); SELF_INFO( pArea, DBI_GETHEADERSIZE, pItem ); - hb_itemReturnForward( pItem ); - hb_itemRelease( pItem ); + hb_itemReturnRelease( pItem ); } } @@ -1050,8 +1047,7 @@ HB_FUNC( LUPDATE ) PHB_ITEM pItem = hb_itemNew( NULL ); SELF_INFO( pArea, DBI_LASTUPDATE, pItem ); - hb_itemReturnForward( pItem ); - hb_itemRelease( pItem ); + hb_itemReturnRelease( pItem ); } else hb_retds( "" ); @@ -1091,8 +1087,7 @@ HB_FUNC( ORDBAGEXT ) { SELF_ORDINFO( pArea, DBOI_BAGEXT, &pInfo ); } - hb_itemReturn( pInfo.itmResult ); - hb_itemRelease( pInfo.itmResult ); + hb_itemReturnRelease( pInfo.itmResult ); } HB_FUNC( ORDBAGNAME ) @@ -1122,8 +1117,7 @@ HB_FUNC( ORDBAGNAME ) } pOrderInfo.itmResult = hb_itemPutC( NULL, "" ); SELF_ORDINFO( pArea, DBOI_BAGNAME, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDBAGNAME" ); @@ -1311,8 +1305,7 @@ HB_FUNC( ORDFOR ) pOrderInfo.itmCobExpr = NULL; pOrderInfo.fAllTags = FALSE; SELF_ORDINFO( pArea, DBOI_CONDITION, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDFOR" ); @@ -1345,8 +1338,7 @@ HB_FUNC( ORDKEY ) pOrderInfo.atomBagName = hb_param( 2, HB_IT_STRING ); pOrderInfo.itmResult = hb_itemPutC( NULL, "" ); SELF_ORDINFO( pArea, DBOI_EXPRESSION, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDKEY" ); @@ -1438,8 +1430,7 @@ HB_FUNC( ORDNAME ) pOrderInfo.atomBagName = hb_param( 2, HB_IT_STRING ); pOrderInfo.itmResult = hb_itemPutC( NULL, "" ); SELF_ORDINFO( pArea, DBOI_NAME, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDNAME" ); @@ -1463,8 +1454,7 @@ HB_FUNC( ORDNUMBER ) } pOrderInfo.itmResult = hb_itemPutNI( NULL, 0 ); SELF_ORDINFO( pArea, DBOI_NUMBER, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDNUMBER" ); @@ -1484,8 +1474,7 @@ HB_FUNC( ORDSETFOCUS ) pInfo.atomBagName = hb_param( 2, HB_IT_STRING ); pInfo.itmResult = hb_itemPutC( NULL, "" ); SELF_ORDLSTFOCUS( pArea, &pInfo ); - hb_itemReturn( pInfo.itmResult ); - hb_itemRelease( pInfo.itmResult ); + hb_itemReturnRelease( pInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDSETFOCUS" ); @@ -1493,7 +1482,7 @@ HB_FUNC( ORDSETFOCUS ) HB_FUNC( RDDLIST ) { - hb_itemRelease( hb_itemReturnForward( hb_rddList( hb_parni( 1 ) ) ) ); + hb_itemReturnRelease( hb_rddList( hb_parni( 1 ) ) ); } HB_FUNC( RDDNAME ) @@ -1552,8 +1541,7 @@ HB_FUNC( RECNO ) { SELF_RECID( pArea, pRecNo ); } - hb_itemReturnForward( pRecNo ); - hb_itemRelease( pRecNo ); + hb_itemReturnRelease( pRecNo ); } HB_FUNC( RECSIZE ) @@ -1564,8 +1552,7 @@ HB_FUNC( RECSIZE ) { PHB_ITEM pItem = hb_itemNew( NULL ); SELF_INFO( pArea, DBI_GETRECSIZE, pItem ); - hb_itemReturnForward( pItem ); - hb_itemRelease( pItem ); + hb_itemReturnRelease( pItem ); } else hb_retni( 0 ); @@ -1675,8 +1662,7 @@ HB_FUNC( ORDSCOPE ) } } SELF_ORDINFO( pArea, uiAction, &pInfo ); - hb_itemReturn( pInfo.itmResult ); - hb_itemRelease( pInfo.itmResult ); + hb_itemReturnRelease( pInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDSCOPE" ); @@ -2008,8 +1994,6 @@ HB_FUNC( HB_RDDGETTEMPALIAS ) if( hb_rddGetTempAlias( szAliasTmp ) == SUCCESS ) hb_retc( szAliasTmp ); - else - hb_ret(); } /* NOTE: Left here for compatibility with previous Harbour versions. */ @@ -2041,8 +2025,7 @@ HB_FUNC( HB_RDDINFO ) { PHB_ITEM pInfo = hb_itemNew( pParam ); SELF_RDDINFO( pRDDNode, hb_itemGetNI( pIndex ), ulConnection, pInfo ); - hb_itemReturn( pInfo ); - hb_itemRelease( pInfo ); + hb_itemReturnRelease( pInfo ); } else { diff --git a/harbour/source/rdd/dbcmd53.c b/harbour/source/rdd/dbcmd53.c index f2f4a0ba4a..fa997ab9da 100644 --- a/harbour/source/rdd/dbcmd53.c +++ b/harbour/source/rdd/dbcmd53.c @@ -86,8 +86,7 @@ HB_FUNC( ORDKEYCOUNT ) pOrderInfo.itmResult = hb_itemPutNL( NULL, 0 ); SELF_ORDINFO( pArea, DBOI_KEYCOUNT, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDKEYCOUNT" ); @@ -110,8 +109,7 @@ HB_FUNC( ORDKEYNO ) pOrderInfo.itmNewVal = NULL; pOrderInfo.itmResult = hb_itemPutNL( NULL, 0 ); SELF_ORDINFO( pArea, DBOI_POSITION, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDKEYNO" ); @@ -128,8 +126,7 @@ HB_FUNC( ORDKEYGOTO ) pOrderInfo.itmNewVal = hb_param( 1 , HB_IT_NUMERIC ); pOrderInfo.itmResult = hb_itemPutL( NULL, FALSE ); SELF_ORDINFO( pArea, DBOI_POSITION, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDKEYGOTO" ); @@ -146,8 +143,7 @@ HB_FUNC( ORDKEYRELPOS ) pOrderInfo.itmNewVal = hb_param( 1 , HB_IT_NUMERIC ); pOrderInfo.itmResult = hb_itemPutNI( NULL, 0 ); SELF_ORDINFO( pArea, DBOI_RELKEYPOS, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDKEYRELPOS" ); @@ -165,8 +161,7 @@ HB_FUNC( ORDFINDREC ) pOrderInfo.itmResult = hb_itemPutL( NULL, FALSE ); SELF_ORDINFO( pArea, ISLOG( 2 ) && hb_parl( 2 ) ? DBOI_FINDRECCONT : DBOI_FINDREC, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDKEYGOTO" ); @@ -193,8 +188,7 @@ HB_FUNC( ORDSKIPUNIQUE ) pOrderInfo.itmNewVal = hb_param( 1, HB_IT_ANY ); pOrderInfo.itmResult = hb_itemPutL( NULL, FALSE ); SELF_ORDINFO( pArea, DBOI_SKIPUNIQUE, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDSKIPUNIQUE" ); @@ -210,8 +204,7 @@ HB_FUNC( ORDKEYVAL ) memset( &pOrderInfo, 0, sizeof( DBORDERINFO ) ); pOrderInfo.itmResult = hb_itemNew( NULL ); SELF_ORDINFO( pArea, DBOI_KEYVAL, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDKEYVAL" ); @@ -233,8 +226,7 @@ HB_FUNC( ORDKEYADD ) pOrderInfo.itmNewVal = hb_param( 3 , HB_IT_ANY ); pOrderInfo.itmResult = hb_itemPutNL( NULL, 0 ); SELF_ORDINFO( pArea, DBOI_KEYADD, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDKEYADD" ); @@ -256,8 +248,7 @@ HB_FUNC( ORDKEYDEL ) pOrderInfo.itmNewVal = hb_param( 3 , HB_IT_ANY ); pOrderInfo.itmResult = hb_itemPutNL( NULL, 0 ); SELF_ORDINFO( pArea, DBOI_KEYDELETE, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDKEYDEL" ); @@ -279,8 +270,7 @@ HB_FUNC( ORDDESCEND ) pOrderInfo.itmNewVal = hb_param( 3 , HB_IT_LOGICAL ); pOrderInfo.itmResult = hb_itemPutL( NULL, FALSE ); SELF_ORDINFO( pArea, DBOI_ISDESC, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDDESCEND" ); @@ -302,8 +292,7 @@ HB_FUNC( ORDISUNIQUE ) pOrderInfo.itmNewVal = hb_param( 3 , HB_IT_LOGICAL ); pOrderInfo.itmResult = hb_itemPutL( NULL, FALSE ); SELF_ORDINFO( pArea, DBOI_UNIQUE, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDISUNIQUE" ); @@ -325,8 +314,7 @@ HB_FUNC( ORDCUSTOM ) pOrderInfo.itmNewVal = hb_param( 3 , HB_IT_LOGICAL ); pOrderInfo.itmResult = hb_itemPutL( NULL, FALSE ); SELF_ORDINFO( pArea, DBOI_CUSTOM, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDCUSTOM" ); @@ -343,8 +331,7 @@ HB_FUNC( ORDCOUNT ) pOrderInfo.atomBagName = hb_param( 1, HB_IT_STRING ); pOrderInfo.itmResult = hb_itemPutNI( NULL, 0 ); SELF_ORDINFO( pArea, DBOI_ORDERCOUNT, &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDCOUNT" ); @@ -364,8 +351,7 @@ HB_FUNC( DBINFO ) PHB_ITEM pInfo = hb_itemNew( hb_param( 2, HB_IT_ANY ) ); SELF_INFO( pArea, hb_itemGetNI( pIndex ), pInfo ); - hb_itemReturn( pInfo ); - hb_itemRelease( pInfo ); + hb_itemReturnRelease( pInfo ); } else hb_errRT_DBCMD( EG_ARG, EDBCMD_DBINFOBADPARAMETER, NULL, "DBINFO" ); @@ -399,8 +385,7 @@ HB_FUNC( DBORDERINFO ) pOrderInfo.itmCobExpr = NULL; pOrderInfo.fAllTags = FALSE; SELF_ORDINFO( pArea, hb_itemGetNI( pType ), &pOrderInfo ); - hb_itemReturn( pOrderInfo.itmResult ); - hb_itemRelease( pOrderInfo.itmResult ); + hb_itemReturnRelease( pOrderInfo.itmResult ); } else hb_errRT_DBCMD( EG_ARG, EDBCMD_DBCMDBADPARAMETER, NULL, "DBORDERINFO" ); @@ -426,8 +411,7 @@ HB_FUNC( DBFIELDINFO ) PHB_ITEM pInfo = hb_itemNew( hb_param( 3, HB_IT_ANY ) ); SELF_FIELDINFO( pArea, uiIndex, hb_itemGetNI( pType ), pInfo ); - hb_itemReturn( pInfo ); - hb_itemRelease( pInfo ); + hb_itemReturnRelease( pInfo ); } else hb_errRT_DBCMD( EG_ARG, EDBCMD_DBCMDBADPARAMETER, NULL, "DBFIELDINFO" ); @@ -451,8 +435,7 @@ HB_FUNC( DBRECORDINFO ) PHB_ITEM pInfo = hb_itemNew( hb_param( 3, HB_IT_ANY ) ); SELF_RECINFO( pArea, pRecNo, hb_itemGetNI( pType ), pInfo ); - hb_itemReturn( pInfo ); - hb_itemRelease( pInfo ); + hb_itemReturnRelease( pInfo ); } else hb_errRT_DBCMD( EG_ARG, EDBCMD_INFOBADPARAMETER, NULL, "DBRECORDINFO" ); diff --git a/harbour/source/rdd/fieldhb.c b/harbour/source/rdd/fieldhb.c index a5478dfd8f..51dd0c4ad8 100644 --- a/harbour/source/rdd/fieldhb.c +++ b/harbour/source/rdd/fieldhb.c @@ -72,8 +72,7 @@ HB_FUNC( FIELDLEN ) if( SELF_FIELDINFO( pArea, uiIndex, DBS_LEN, pItem ) == SUCCESS ) { - hb_itemReturnForward( pItem ); - hb_itemRelease( pItem ); + hb_itemReturnRelease( pItem ); return; } hb_itemRelease( pItem ); @@ -97,8 +96,7 @@ HB_FUNC( FIELDDEC ) if( SELF_FIELDINFO( pArea, uiIndex, DBS_DEC, pItem ) == SUCCESS ) { - hb_itemReturnForward( pItem ); - hb_itemRelease( pItem ); + hb_itemReturnRelease( pItem ); return; } hb_itemRelease( pItem ); @@ -122,8 +120,7 @@ HB_FUNC( FIELDTYPE ) if( SELF_FIELDINFO( pArea, uiIndex, DBS_TYPE, pItem ) == SUCCESS ) { - hb_itemReturnForward( pItem ); - hb_itemRelease( pItem ); + hb_itemReturnRelease( pItem ); return; } hb_itemRelease( pItem ); diff --git a/harbour/source/rdd/hbsix/sxcompr.c b/harbour/source/rdd/hbsix/sxcompr.c index 70e3d1c425..91a1f14353 100644 --- a/harbour/source/rdd/hbsix/sxcompr.c +++ b/harbour/source/rdd/hbsix/sxcompr.c @@ -736,7 +736,7 @@ HB_FUNC( _SX_STRDECOMPRESS ) { PHB_ITEM pItem = hb_errRT_SubstParams( "SIXCOMPRESS", EG_MEM, 0, "possible compressed string corruption", "_SX_STRDECOMPRESS" ); if( pItem ) - hb_itemRelease( hb_itemReturn( pItem ) ); + hb_itemReturnRelease( pItem ); return; } } diff --git a/harbour/source/rdd/hbsix/sxcrypt.c b/harbour/source/rdd/hbsix/sxcrypt.c index 0d412fb6e6..5fc4d035ae 100644 --- a/harbour/source/rdd/hbsix/sxcrypt.c +++ b/harbour/source/rdd/hbsix/sxcrypt.c @@ -183,8 +183,6 @@ HB_FUNC( SX_ENCRYPT ) hb_itemReturn( hb_param( 1, HB_IT_ANY ) ); } } - else - hb_ret(); } HB_FUNC( SX_DECRYPT ) @@ -206,6 +204,4 @@ HB_FUNC( SX_DECRYPT ) hb_itemReturn( hb_param( 1, HB_IT_ANY ) ); } } - else - hb_ret(); } diff --git a/harbour/source/rdd/nulsys/nulsys.c b/harbour/source/rdd/nulsys/nulsys.c index 426ffe8fc6..03449da2e3 100644 --- a/harbour/source/rdd/nulsys/nulsys.c +++ b/harbour/source/rdd/nulsys/nulsys.c @@ -174,6 +174,10 @@ HB_FUNC( DBRELATION ) { hb_retc( NULL ); } HB_FUNC( DBRSELECT ) { hb_retni( 0 ); } +HB_FUNC( DBFILTER ) { hb_retc( NULL ); } + +HB_FUNC( DBEVAL ) {} + HB_FUNC( SELECT ) { hb_retni( 0 ); } HB_FUNC( ALIAS ) { hb_retc( NULL ); } diff --git a/harbour/source/rtl/direct.c b/harbour/source/rtl/direct.c index 39498b0399..d56d6bb631 100644 --- a/harbour/source/rtl/direct.c +++ b/harbour/source/rtl/direct.c @@ -168,5 +168,5 @@ HB_FUNC( DIRECTORY ) hb_fsFindClose( ffind ); } - hb_itemRelease( hb_itemReturn( pDir ) ); + hb_itemReturnRelease( pDir ); } diff --git a/harbour/source/rtl/errorapi.c b/harbour/source/rtl/errorapi.c index fe174ed3a1..3d78e35c51 100644 --- a/harbour/source/rtl/errorapi.c +++ b/harbour/source/rtl/errorapi.c @@ -1226,7 +1226,7 @@ void hb_errRT_BASE_SubstR( ULONG ulGenCode, ULONG ulSubCode, const char * szDesc } /* Ok, launch... */ - hb_itemRelease( hb_itemReturn( hb_errLaunchSubst( pError ) ) ); + hb_itemReturnRelease( hb_errLaunchSubst( pError ) ); hb_errRelease( pError ); } diff --git a/harbour/source/rtl/gtfunc.c b/harbour/source/rtl/gtfunc.c index 70c8022964..851a47a160 100644 --- a/harbour/source/rtl/gtfunc.c +++ b/harbour/source/rtl/gtfunc.c @@ -65,8 +65,6 @@ HB_FUNC( HB_SETDISPCP ) } else hb_errRT_BASE_SubstR( EG_ARG, 1089, NULL, "HB_SETDISPCP", HB_ERR_ARGS_BASEPARAMS ); - - hb_ret(); /* return NIL */ } HB_FUNC( HB_SETKEYCP ) @@ -77,8 +75,6 @@ HB_FUNC( HB_SETKEYCP ) } else hb_errRT_BASE_SubstR( EG_ARG, 1089, NULL, "HB_SETKEYCP", HB_ERR_ARGS_BASEPARAMS ); - - hb_ret(); /* return NIL */ } HB_FUNC( HB_SETTERMCP ) @@ -98,8 +94,6 @@ HB_FUNC( HB_SETTERMCP ) } else hb_errRT_BASE_SubstR( EG_ARG, 1089, NULL, "HB_SETTERMCP", HB_ERR_ARGS_BASEPARAMS ); - - hb_ret(); /* return NIL */ } HB_FUNC( HB_GTINFO ) @@ -114,8 +108,6 @@ HB_FUNC( HB_GTINFO ) hb_gtInfo( hb_parni( 1 ), >Info ); if( gtInfo.pResult ) hb_itemReturnRelease( gtInfo.pResult ); - else - hb_ret(); } else hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, "HB_GTINFO", HB_ERR_ARGS_BASEPARAMS ); diff --git a/harbour/source/rtl/hbgtcore.c b/harbour/source/rtl/hbgtcore.c index d498d1d576..155d5ea3ff 100644 --- a/harbour/source/rtl/hbgtcore.c +++ b/harbour/source/rtl/hbgtcore.c @@ -1474,23 +1474,22 @@ static BOOL hb_gt_def_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) pInfo->pResult = hb_itemNew( NULL ); hb_arrayNew( pInfo->pResult, 8 ); HB_GTSELF_GETPOS( pGT, &iRow, &iCol ); - hb_itemPutNI( hb_arrayGetItemPtr( pInfo->pResult, 1 ), iRow ); - hb_itemPutNI( hb_arrayGetItemPtr( pInfo->pResult, 2 ), iCol ); - hb_itemPutNI( hb_arrayGetItemPtr( pInfo->pResult, 3 ), HB_GTSELF_GETCURSORSTYLE( pGT ) ); - hb_itemPutC( hb_arrayGetItemPtr( pInfo->pResult, 4 ), hb_conSetColor( NULL ) ); + hb_arraySetNI( pInfo->pResult, 1, iRow ); + hb_arraySetNI( pInfo->pResult, 2, iCol ); + hb_arraySetNI( pInfo->pResult, 3, HB_GTSELF_GETCURSORSTYLE( pGT ) ); + hb_arraySetC ( pInfo->pResult, 4, hb_conSetColor( NULL ) ); iRow = HB_GTSELF_MAXROW( pGT ); iCol = HB_GTSELF_MAXCOL( pGT ); - hb_itemPutNI( hb_arrayGetItemPtr( pInfo->pResult, 5 ), iRow ); - hb_itemPutNI( hb_arrayGetItemPtr( pInfo->pResult, 6 ), iCol ); + hb_arraySetNI( pInfo->pResult, 5, iRow ); + hb_arraySetNI( pInfo->pResult, 6, iCol ); ulSize = HB_GTSELF_RECTSIZE( pGT, 0, 0, iRow, iCol ); if( ulSize ) { BYTE * pBuffer = ( BYTE * ) hb_xgrab( ulSize + 1 ); HB_GTSELF_SAVE( pGT, 0, 0, iRow, iCol, pBuffer ); - hb_itemPutCPtr( hb_arrayGetItemPtr( pInfo->pResult, 7 ), - ( char * ) pBuffer, ulSize ); + hb_arraySetCPtr( pInfo->pResult, 7, ( char * ) pBuffer, ulSize ); } break; } @@ -3101,7 +3100,6 @@ HB_EXPORT BOOL hb_gtUnLoad( void ) memcpy( &s_gtCoreFunc, s_gtInit[ s_gtLinkOrder[ s_iGtLinkCount ] ]->pSuperTable, sizeof( HB_GT_FUNCS ) ); - } return TRUE; diff --git a/harbour/source/rtl/hbinet.c b/harbour/source/rtl/hbinet.c index 8935a9bc1c..a007acfe5b 100644 --- a/harbour/source/rtl/hbinet.c +++ b/harbour/source/rtl/hbinet.c @@ -534,7 +534,7 @@ HB_FUNC( HB_INETCREATE ) if( ISNUM( 1 ) ) Socket->timeout = hb_parni(1); - hb_itemRelease( hb_itemReturnForward( pSocket ) ); + hb_itemReturnRelease( pSocket ); } HB_FUNC( HB_INETCLOSE ) @@ -998,7 +998,6 @@ static void s_inetRecvPattern( char *szPattern ) } hb_xfree( (void *) Buffer ); - hb_ret(); } else { @@ -1388,11 +1387,11 @@ HB_FUNC( HB_INETGETHOSTS ) cHosts = Host->h_addr_list; while( *cHosts ) { - hb_itemPutC( hb_arrayGetItemPtr( pHosts, ++iCount ), - inet_ntoa( *( ( struct in_addr * ) * cHosts ) ) ); + hb_arraySetC( pHosts, ++iCount, + inet_ntoa( *( ( struct in_addr * ) * cHosts ) ) ); cHosts++; } - hb_itemRelease( hb_itemReturnForward( pHosts ) ); + hb_itemReturnRelease( pHosts ); } } @@ -1430,11 +1429,11 @@ HB_FUNC( HB_INETGETALIAS ) cHosts = Host->h_aliases; while( *cHosts ) { - hb_itemPutC( hb_arrayGetItemPtr( pHosts, ++iCount ), - inet_ntoa( *( ( struct in_addr * ) * cHosts ) ) ); + hb_arraySetC( pHosts, ++iCount, + inet_ntoa( *( ( struct in_addr * ) * cHosts ) ) ); cHosts++; } - hb_itemRelease( hb_itemReturnForward( pHosts ) ); + hb_itemReturnRelease( pHosts ); } } @@ -1480,7 +1479,7 @@ HB_FUNC( HB_INETSERVER ) HB_SOCKET_SET_ERROR( Socket ); Socket->com = 0; if( pSocket ) - hb_itemRelease( hb_itemReturn( pSocket ) ); + hb_itemReturnRelease( pSocket ); else hb_itemReturn( hb_param( 2, HB_IT_ANY ) ); } @@ -1513,7 +1512,7 @@ HB_FUNC( HB_INETSERVER ) } if( pSocket ) - hb_itemRelease( hb_itemReturnForward( pSocket ) ); + hb_itemReturnRelease( pSocket ); else hb_itemReturn( hb_param( 2, HB_IT_ANY ) ); } @@ -1581,12 +1580,10 @@ HB_FUNC( HB_INETACCEPT ) if( iError == -1 ) { HB_SOCKET_SET_ERROR2( Socket, -1, "Timeout" ); - hb_ret(); } else if( iError > 0 ) { HB_SOCKET_SET_ERROR1( Socket, iError ); - hb_ret(); } else { @@ -1596,7 +1593,7 @@ HB_FUNC( HB_INETACCEPT ) memcpy( &NewSocket->remote, &si_remote, Len ); NewSocket->com = incoming; /* hb_socketSetNonBlocking( NewSocket ); */ - hb_itemRelease( hb_itemReturnForward( pSocket ) ); + hb_itemReturnRelease( pSocket ); } } @@ -1658,7 +1655,7 @@ HB_FUNC( HB_INETCONNECT ) } if( pSocket ) - hb_itemRelease( hb_itemReturnForward( pSocket ) ); + hb_itemReturnRelease( pSocket ); else hb_itemReturn( hb_param( 3, HB_IT_ANY ) ); } @@ -1709,7 +1706,7 @@ HB_FUNC( HB_INETCONNECTIP ) } if( pSocket ) - hb_itemRelease( hb_itemReturnForward( pSocket ) ); + hb_itemReturnRelease( pSocket ); else hb_itemReturn( hb_param( 3, HB_IT_ANY ) ); } @@ -1746,7 +1743,7 @@ HB_FUNC( HB_INETDGRAMBIND ) { HB_SOCKET_SET_ERROR( Socket ); Socket->com = 0; - hb_itemRelease( hb_itemReturnForward( pSocket ) ); + hb_itemReturnRelease( pSocket ); return; } @@ -1807,12 +1804,12 @@ HB_FUNC( HB_INETDGRAMBIND ) { HB_SOCKET_SET_ERROR( Socket ); Socket->com = 0; - hb_itemRelease( hb_itemReturnForward( pSocket ) ); + hb_itemReturnRelease( pSocket ); return; } } - hb_itemRelease( hb_itemReturnForward( pSocket ) ); + hb_itemReturnRelease( pSocket ); } HB_FUNC( HB_INETDGRAM ) @@ -1834,7 +1831,7 @@ HB_FUNC( HB_INETDGRAM ) { HB_SOCKET_SET_ERROR( Socket ); Socket->com = 0; - hb_itemRelease( hb_itemReturnForward( pSocket ) ); + hb_itemReturnRelease( pSocket ); return; } @@ -1847,7 +1844,7 @@ HB_FUNC( HB_INETDGRAM ) /* we'll be using non blocking sockets in all functions */ /* hb_socketSetNonBlocking( Socket ); */ - hb_itemRelease( hb_itemReturnForward( pSocket ) ); + hb_itemReturnRelease( pSocket ); } HB_FUNC( HB_INETDGRAMSEND ) diff --git a/harbour/source/rtl/hbregex.c b/harbour/source/rtl/hbregex.c index 6d92101946..3dc5798b7b 100644 --- a/harbour/source/rtl/hbregex.c +++ b/harbour/source/rtl/hbregex.c @@ -280,14 +280,14 @@ static BOOL hb_regex( int iRequest ) for( i = 0; i < iMatches; i++ ) { if( HB_REGMATCH_EO( aMatches, i ) > -1 ) - hb_itemPutCL( hb_arrayGetItemPtr( pRetArray, i + 1 ), - pszString + HB_REGMATCH_SO( aMatches, i ), - HB_REGMATCH_EO( aMatches, i ) - - HB_REGMATCH_SO( aMatches, i ) ); + hb_arraySetCL( pRetArray, i + 1, + pszString + HB_REGMATCH_SO( aMatches, i ), + HB_REGMATCH_EO( aMatches, i ) - + HB_REGMATCH_SO( aMatches, i ) ); else - hb_itemPutCL( hb_arrayGetItemPtr( pRetArray, i + 1 ), "", 0 ); + hb_arraySetCL( pRetArray, i + 1, "", 0 ); } - hb_itemRelease( hb_itemReturnForward( pRetArray ) ); + hb_itemReturnRelease( pRetArray ); fResult = TRUE; break; @@ -326,7 +326,7 @@ static BOOL hb_regex( int iRequest ) } hb_itemRelease( pMatch ); - hb_itemRelease( hb_itemReturnForward( pRetArray ) ); + hb_itemReturnRelease( pRetArray ); fResult = TRUE; break; @@ -342,20 +342,20 @@ static BOOL hb_regex( int iRequest ) if( iEO != -1 ) { /* matched string */ - hb_itemPutCL( hb_arrayGetItemPtr( pMatch, 1 ), pszString + iSO, iEO - iSO ); + hb_arraySetCL( pMatch, 1, pszString + iSO, iEO - iSO ); /* begin of match */ - hb_itemPutNI( hb_arrayGetItemPtr( pMatch, 2 ), iSO + 1 ); + hb_arraySetNI( pMatch, 2, iSO + 1 ); /* End of match */ - hb_itemPutNI( hb_arrayGetItemPtr( pMatch, 3 ), iEO ); + hb_arraySetNI( pMatch, 3, iEO ); } else { - hb_itemPutCL( hb_arrayGetItemPtr( pMatch, 1 ), "", 0 ); - hb_itemPutNI( hb_arrayGetItemPtr( pMatch, 2 ), 0 ); - hb_itemPutNI( hb_arrayGetItemPtr( pMatch, 3 ), 0 ); + hb_arraySetCL( pMatch, 1, "", 0 ); + hb_arraySetNI( pMatch, 2, 0 ); + hb_arraySetNI( pMatch, 3, 0 ); } } - hb_itemRelease( hb_itemReturnForward( pRetArray ) ); + hb_itemReturnRelease( pRetArray ); fResult = TRUE; break; @@ -389,17 +389,17 @@ static BOOL hb_regex( int iRequest ) if ( iEO != -1 ) { /* matched string */ - hb_itemPutCL( hb_arrayGetItemPtr( pMatch, 1 ), pszString + iSO, iEO - iSO ); + hb_arraySetCL( pMatch, 1, pszString + iSO, iEO - iSO ); /* begin of match */ - hb_itemPutNI( hb_arrayGetItemPtr( pMatch, 2 ), ulOffSet + iSO + 1 ); + hb_arraySetNI( pMatch, 2, ulOffSet + iSO + 1 ); /* End of match */ - hb_itemPutNI( hb_arrayGetItemPtr( pMatch, 3 ), ulOffSet + iEO ); + hb_arraySetNI( pMatch, 3, ulOffSet + iEO ); } else { - hb_itemPutCL( hb_arrayGetItemPtr( pMatch, 1 ), "", 0 ); - hb_itemPutNI( hb_arrayGetItemPtr( pMatch, 2 ), 0 ); - hb_itemPutNI( hb_arrayGetItemPtr( pMatch, 3 ), 0 ); + hb_arraySetCL( pMatch, 1, "", 0 ); + hb_arraySetNI( pMatch, 2, 0 ); + hb_arraySetNI( pMatch, 3, 0 ); } } else @@ -426,17 +426,17 @@ static BOOL hb_regex( int iRequest ) if( iEO != -1 ) { /* matched string */ - hb_itemPutCL( hb_arrayGetItemPtr( pMatch, 1 ), pszString + iSO, iEO - iSO ); + hb_arraySetCL( pMatch, 1, pszString + iSO, iEO - iSO ); /* begin of match */ - hb_itemPutNI( hb_arrayGetItemPtr( pMatch, 2 ), ulOffSet + iSO + 1 ); + hb_arraySetNI( pMatch, 2, ulOffSet + iSO + 1 ); /* End of match */ - hb_itemPutNI( hb_arrayGetItemPtr( pMatch, 3 ), ulOffSet + iEO ); + hb_arraySetNI( pMatch, 3, ulOffSet + iEO ); } else { - hb_itemPutCL( hb_arrayGetItemPtr( pMatch, 1 ), "", 0 ); - hb_itemPutNI( hb_arrayGetItemPtr( pMatch, 2 ), 0 ); - hb_itemPutNI( hb_arrayGetItemPtr( pMatch, 3 ), 0 ); + hb_arraySetCL( pMatch, 1, "", 0 ); + hb_arraySetNI( pMatch, 2, 0 ); + hb_arraySetNI( pMatch, 3, 0 ); } } else @@ -461,7 +461,7 @@ static BOOL hb_regex( int iRequest ) } while( iEO && ulLen && ( iMax == 0 || iCount < iMax ) && ( iMatches = hb_regexec( pRegEx, pszString, ulLen, iMaxMatch, aMatches ) ) > 0 ); - hb_itemRelease( hb_itemReturnForward( pRetArray ) ); + hb_itemReturnRelease( pRetArray ); fResult = TRUE; break; } @@ -471,7 +471,7 @@ static BOOL hb_regex( int iRequest ) { pRetArray = hb_itemArrayNew( 1 ); hb_arraySet( pRetArray, 1, pString ); - hb_itemRelease( hb_itemReturnForward( pRetArray ) ); + hb_itemReturnRelease( pRetArray ); fResult = TRUE; } diff --git a/harbour/source/rtl/hbtoken.c b/harbour/source/rtl/hbtoken.c index 092ab14063..bc9eef33c9 100644 --- a/harbour/source/rtl/hbtoken.c +++ b/harbour/source/rtl/hbtoken.c @@ -157,7 +157,7 @@ static PHB_ITEM hb_tokenArray( char * szLine, ULONG ulLen, else if( szLine[ ul ] == szDelim[ 0 ] && ( ulDelim == 1 || !memcmp( szLine + ul, szDelim, ulDelim ) ) ) { - hb_itemPutCL( hb_arrayGetItemPtr( pArray, ++ulToken ), szLine + ulStart, ul - ulStart ); + hb_arraySetCL( pArray, ++ulToken, szLine + ulStart, ul - ulStart ); if( ulDelim == 1 && *szDelim == ' ' ) { while( ul + 1 < ulLen && szLine[ ul + 1 ] == ' ' ) @@ -166,7 +166,7 @@ static PHB_ITEM hb_tokenArray( char * szLine, ULONG ulLen, ulStart = ul + ulDelim; } } - hb_itemPutCL( hb_arrayGetItemPtr( pArray, ++ulToken ), szLine + ulStart, ul - ulStart ); + hb_arraySetCL( pArray, ++ulToken, szLine + ulStart, ul - ulStart ); } return pArray; @@ -287,9 +287,8 @@ HB_FUNC( HB_ATOKENS ) hb_tokenParam( 2, 0, &szLine, &ulLen, &szDelim, &ulDelim ); if( szLine ) - hb_itemRelease( hb_itemReturnForward( - hb_tokenArray( szLine, ulLen, szDelim, ulDelim, - hb_parl( 3 ), hb_parl( 4 ) ) ) ); + hb_itemReturnRelease( hb_tokenArray( szLine, ulLen, szDelim, ulDelim, + hb_parl( 3 ), hb_parl( 4 ) ) ); else hb_errRT_BASE_SubstR( EG_ARG, 1123, NULL, &hb_errFuncName, HB_ERR_ARGS_BASEPARAMS ); } diff --git a/harbour/source/rtl/idle.c b/harbour/source/rtl/idle.c index bba1ec84ca..6eff8a0dad 100644 --- a/harbour/source/rtl/idle.c +++ b/harbour/source/rtl/idle.c @@ -315,9 +315,6 @@ HB_FUNC( HB_IDLEDEL ) ++iTask; } } - - if( !bFound ) - hb_ret(); /* return NIL */ } /* Release a CPU time slice */ diff --git a/harbour/source/rtl/inkey.c b/harbour/source/rtl/inkey.c index 4447a57d80..8410953d31 100644 --- a/harbour/source/rtl/inkey.c +++ b/harbour/source/rtl/inkey.c @@ -201,7 +201,7 @@ HB_FUNC( HB_KEYPUT ) ULONG ulLen = hb_itemGetCLen( pText ), ulIndex; for( ulIndex = 0; ulIndex < ulLen; ulIndex++ ) - hb_inkeyPut( szText[ ulIndex ] ); + hb_inkeyPut( ( UCHAR ) szText[ ulIndex ] ); } else if( ISARRAY( 1 ) ) { @@ -228,6 +228,6 @@ HB_FUNC( LASTKEY ) HB_FUNC( HB_SETLASTKEY ) { - if( ISNUM(1) ) + if( ISNUM( 1 ) ) hb_retni( hb_inkeySetLast( hb_parni( 1 ) ) ); } diff --git a/harbour/source/rtl/math.c b/harbour/source/rtl/math.c index fb633236f7..766278f917 100644 --- a/harbour/source/rtl/math.c +++ b/harbour/source/rtl/math.c @@ -111,7 +111,7 @@ void hb_mathResetError( HB_MATH_EXCEPTION * phb_exc ) /* route C math lib errors to Harbour error handling */ #if defined(HB_MATH_HANDLER) -int HB_EXPORT matherr( struct exception *err ) +HB_EXPORT int matherr( struct exception *err ) { int retval; HB_MATH_HANDLERPROC mathHandler; diff --git a/harbour/source/rtl/mouse53.c b/harbour/source/rtl/mouse53.c index 5acaaf54ed..c3bba9c04f 100644 --- a/harbour/source/rtl/mouse53.c +++ b/harbour/source/rtl/mouse53.c @@ -58,6 +58,7 @@ #define M_BUTTON_LEFT 0 #define M_BUTTON_RIGHT 1 +#define M_BUTTON_MIDDLE 2 HB_FUNC( MPRESENT ) { diff --git a/harbour/source/rtl/philes.c b/harbour/source/rtl/philes.c index 361d4f76d1..9e32a3ff4e 100644 --- a/harbour/source/rtl/philes.c +++ b/harbour/source/rtl/philes.c @@ -53,8 +53,6 @@ #include "hbapifs.h" #include "hbapierr.h" #include "hbapiitm.h" -#include "hbset.h" -#include "hbstack.h" HB_FUNC( FOPEN ) { @@ -317,7 +315,7 @@ HB_FUNC( HB_OSPATHDELIMITERS ) HB_FUNC( HB_OSDRIVESEPARATOR ) { #ifdef OS_HAS_DRIVE_LETTER - char ret[ 2 ] = { OS_DRIVE_DELIMITER, 0 }; + const char ret[ 2 ] = { OS_DRIVE_DELIMITER, 0 }; hb_retc( ret ); #else hb_retc( NULL ); diff --git a/harbour/source/rtl/scroll.c b/harbour/source/rtl/scroll.c index 34e0fa0f09..161fb6f743 100644 --- a/harbour/source/rtl/scroll.c +++ b/harbour/source/rtl/scroll.c @@ -101,10 +101,10 @@ HB_FUNC( SCROLL ) else iRight = iMaxCol; - hb_gtScroll( ( USHORT ) iTop, - ( USHORT ) iLeft, - ( USHORT ) iBottom, - ( USHORT ) iRight, + hb_gtScroll( ( USHORT ) iTop, + ( USHORT ) iLeft, + ( USHORT ) iBottom, + ( USHORT ) iRight, hb_parni( 5 ), /* Defaults to zero on bad type */ hb_parni( 6 ) ); /* Defaults to zero on bad type */ } diff --git a/harbour/source/rtl/valtype.c b/harbour/source/rtl/valtype.c index 4293e8b8ab..ba87504ec5 100644 --- a/harbour/source/rtl/valtype.c +++ b/harbour/source/rtl/valtype.c @@ -173,5 +173,5 @@ HB_FUNC( HB_ISNULL ) return; } } - hb_errRT_BASE_SubstR( EG_ARG, 1111, NULL, "HB_ISNULL", 1, hb_paramError( 1 ) ); + hb_errRT_BASE_SubstR( EG_ARG, 1111, NULL, "HB_ISNULL", HB_ERR_ARGS_BASEPARAMS ); } diff --git a/harbour/source/vm/arrayshb.c b/harbour/source/vm/arrayshb.c index 584364b8af..a387c5e505 100644 --- a/harbour/source/vm/arrayshb.c +++ b/harbour/source/vm/arrayshb.c @@ -414,13 +414,10 @@ HB_FUNC( ACLONE ) PHB_ITEM pSrcArray = hb_param( 1, HB_IT_ARRAY ); if( pSrcArray && ! hb_arrayIsObject( pSrcArray ) ) - hb_itemRelease( hb_itemReturn( hb_arrayClone( pSrcArray ) ) ); /* AClone() returns the new array */ + hb_itemReturnRelease( hb_arrayClone( pSrcArray ) ); /* AClone() returns the new array */ } HB_FUNC( HB_APARAMS ) { - if( hb_pcount() == 0 ) - hb_itemRelease( hb_itemReturn( hb_arrayFromParams( 1 ) ) ); - else - hb_itemRelease( hb_itemReturn( hb_arrayFromParams( hb_parni( 1 ) + 1 ) ) ); + hb_itemReturnRelease( hb_arrayFromParams( hb_parni( 1 ) + 1 ) ); } diff --git a/harbour/source/vm/classes.c b/harbour/source/vm/classes.c index 9e49380965..015edffe43 100644 --- a/harbour/source/vm/classes.c +++ b/harbour/source/vm/classes.c @@ -1748,12 +1748,12 @@ PHB_SYMB hb_objGetMethod( PHB_ITEM pObject, PHB_SYMB pMessage, if( pMsg == s___msgKeys.pDynSym ) { - hb_itemRelease( hb_itemReturnForward( hb_hashGetKeys( pObject ) ) ); + hb_itemReturnRelease( hb_hashGetKeys( pObject ) ); return &s___msgKeys; } else if( pMsg == s___msgValues.pDynSym ) { - hb_itemRelease( hb_itemReturnForward( hb_hashGetValues( pObject ) ) ); + hb_itemReturnRelease( hb_hashGetValues( pObject ) ); return &s___msgValues; } #if defined( HB_HASH_MSG_ITEMS ) @@ -3260,7 +3260,7 @@ HB_FUNC( __CLSINST ) PHB_ITEM pSelf = hb_clsInst( ( USHORT ) hb_parni( 1 ) ); if( pSelf ) - hb_itemRelease( hb_itemReturnForward( pSelf ) ); + hb_itemReturnRelease( pSelf ); } /* @@ -3404,7 +3404,7 @@ HB_FUNC( __OBJCLONE ) if( pSrcObject ) { pDstObject = hb_arrayClone( pSrcObject ); - hb_itemRelease( hb_itemReturnForward( pDstObject ) ); + hb_itemReturnRelease( pDstObject ); } else { @@ -3687,13 +3687,7 @@ HB_FUNC( __CLASSSEL ) do { if( pMethod->pMessage ) /* Hash Entry used ? */ - { - PHB_ITEM pItem = hb_arrayGetItemPtr( pReturn, ++ulPos ); - if( pItem ) - hb_itemPutC( pItem, pMethod->pMessage->pSymbol->szName ); - else - break; /* Generate internal error? */ - } + hb_arraySetC( pReturn, ++ulPos, pMethod->pMessage->pSymbol->szName ); ++pMethod; } while( --ulLimit ); @@ -3702,7 +3696,7 @@ HB_FUNC( __CLASSSEL ) hb_arraySize( pReturn, ulPos ); } - hb_itemRelease( hb_itemReturnForward( pReturn ) ); + hb_itemReturnRelease( pReturn ); } /* to be used from Classes ERROR HANDLER method */ @@ -3823,8 +3817,8 @@ static HARBOUR hb___msgClassSel( void ) ) ) { - hb_itemPutC( hb_arrayGetItemPtr( pReturn, ++ulPos ), - pMethod->pMessage->pSymbol->szName ); + hb_arraySetC( pReturn, ++ulPos, + pMethod->pMessage->pSymbol->szName ); } } ++pMethod; @@ -3833,7 +3827,7 @@ static HARBOUR hb___msgClassSel( void ) if( ulPos < ( ULONG ) pClass->uiMethods ) hb_arraySize( pReturn, ulPos ); - hb_itemRelease( hb_itemReturnForward( pReturn ) ); + hb_itemReturnRelease( pReturn ); } } @@ -4350,7 +4344,7 @@ HB_FUNC( __CLSGETPROPERTIES ) hb_itemRelease( pItem ); } - hb_itemRelease( hb_itemReturnForward( pReturn ) ); + hb_itemReturnRelease( pReturn ); } /* Real dirty function, though very usefull under certain circunstances: @@ -4407,7 +4401,7 @@ void hb_clsAssociate( USHORT usClassH ) PHB_ITEM pSelf = hb_clsInst( usClassH ); if( pSelf ) - hb_itemRelease( hb_itemReturnForward( pSelf ) ); + hb_itemReturnRelease( pSelf ); } @@ -4427,17 +4421,15 @@ HB_FUNC( __CLS_PARAM ) { array = hb_itemArrayNew( uiParam ); for( n = 1; n <= uiParam; n++ ) - { hb_arraySet( array, n, hb_param( n, HB_IT_ANY ) ); - } } else { array = hb_itemArrayNew( 1 ); - hb_itemPutC( hb_arrayGetItemPtr( array, 1 ), "HBObject" ); + hb_arraySetC( array, 1, "HBObject" ); } - hb_itemRelease( hb_itemReturnForward( array ) ); + hb_itemReturnRelease( array ); } HB_FUNC( __CLS_PAR00 ) @@ -4448,11 +4440,9 @@ HB_FUNC( __CLS_PAR00 ) array = hb_itemArrayNew( uiParam ); for( n = 1; n <= uiParam; n++ ) - { hb_arraySet( array, n, hb_param( n, HB_IT_ANY ) ); - } - hb_itemRelease( hb_itemReturnForward( array ) ); + hb_itemReturnRelease( array ); } /* diff --git a/harbour/source/vm/debug.c b/harbour/source/vm/debug.c index e91bc2913f..6b92c47ec8 100644 --- a/harbour/source/vm/debug.c +++ b/harbour/source/vm/debug.c @@ -107,7 +107,7 @@ HB_FUNC( HB_DBG_VMSTKGLIST ) { AddToArray( hb_stackItem( ulPos ), pReturn, ulPos + 1 ); } - hb_itemRelease( hb_itemReturn( pReturn ) ); + hb_itemReturnRelease( pReturn ); } /* $Doc$ @@ -169,7 +169,7 @@ HB_FUNC( HB_DBG_VMSTKLLIST ) for( ul = 0; ul < ulLen; ++ul ) AddToArray( hb_stackItem( lPrevOffset + ul ), pReturn, ul + 1 ); - hb_itemRelease( hb_itemReturn( pReturn ) ); + hb_itemReturnRelease( pReturn ); } /* $Doc$ @@ -181,7 +181,7 @@ HB_FUNC( HB_DBG_VMSTKLLIST ) /* and locals */ HB_FUNC( HB_DBG_VMPARLLIST ) { - hb_itemRelease( hb_itemReturn( hb_arrayFromParams( hb_parni( 1 ) + 1 ) ) ); + hb_itemReturnRelease( hb_arrayFromParams( hb_parni( 1 ) + 1 ) ); } HB_EXPORT PHB_ITEM hb_dbg_vmVarLGet( int iLevel, int iLocal ) diff --git a/harbour/source/vm/estack.c b/harbour/source/vm/estack.c index 8080788cea..4a0b89e9a7 100644 --- a/harbour/source/vm/estack.c +++ b/harbour/source/vm/estack.c @@ -73,7 +73,7 @@ HB_STACK hb_stack; -HB_SYMB s_initSymbol = { "hb_stackInit", {HB_FS_STATIC}, {NULL}, NULL }; +static HB_SYMB s_initSymbol = { "hb_stackInit", {HB_FS_STATIC}, {NULL}, NULL }; /* ------------------------------- */ diff --git a/harbour/source/vm/extend.c b/harbour/source/vm/extend.c index 51d62020de..f0b472ecd5 100644 --- a/harbour/source/vm/extend.c +++ b/harbour/source/vm/extend.c @@ -901,7 +901,7 @@ HB_EXPORT void hb_retptr( void * pointer ) } #undef hb_retptrGC -void HB_EXPORT hb_retptrGC( void * pointer ) +HB_EXPORT void hb_retptrGC( void * pointer ) { HB_TRACE(HB_TR_DEBUG, ("hb_retptrGC(%p)", pointer)); diff --git a/harbour/source/vm/hashfunc.c b/harbour/source/vm/hashfunc.c index 44d542fab2..0c82cd9cc2 100644 --- a/harbour/source/vm/hashfunc.c +++ b/harbour/source/vm/hashfunc.c @@ -75,7 +75,7 @@ HB_FUNC( HB_HASH ) hb_hashAdd( pHash, pKey, pValue ); else { - hb_errRT_BASE( EG_BOUND, 1133, NULL, hb_langDGetErrorDesc( EG_ARRASSIGN ), pValue ? 3 : 2, pHash, hb_paramError( iParam ), pValue ); + hb_errRT_BASE( EG_BOUND, 1133, NULL, hb_langDGetErrorDesc( EG_ARRASSIGN ), 3, pHash, hb_param( iParam, HB_IT_ANY ), pValue ); break; } } diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index ca8e8164a7..1f8252e222 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -955,21 +955,21 @@ HB_EXPORT void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) hb_vmEnumNext(); w++; break; - + case HB_P_ENUMPREV: hb_vmEnumPrev(); w++; break; - + case HB_P_ENUMEND: hb_vmEnumEnd(); w++; break; - + case HB_P_SWITCH: w = hb_vmSwitch( pCode, w+3, HB_PCODE_MKUSHORT( &pCode[ w + 1 ] ) ); break; - + /* Operators (logical) */ case HB_P_NOT: @@ -1005,7 +1005,7 @@ HB_EXPORT void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) break; case HB_P_ARRAYDIM: - hb_vmArrayDim( HB_PCODE_MKUSHORT( &( pCode[ w + 1 ] ) ) ); + hb_vmArrayDim( HB_PCODE_MKUSHORT( &pCode[ w + 1 ] ) ); w += 3; break; @@ -1368,7 +1368,7 @@ HB_EXPORT void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) break; case HB_P_JUMP: - w += HB_PCODE_MKSHORT( &( pCode[ w + 1 ] ) );; + w += HB_PCODE_MKSHORT( &( pCode[ w + 1 ] ) ); break; case HB_P_JUMPFAR: @@ -1899,13 +1899,13 @@ HB_EXPORT void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) hb_macroPushSymbol( pMacro ); /* NOTE: pMacro string is replaced with a symbol. * Symbol is created if it doesn't exist. - */ + */ if( hb_stackGetActionRequest() == 0 ) { pSym = pMacro->item.asSymbol.value; - /* NOTE: pMacro item of symbol type is replaced with - * the reference - */ + /* NOTE: pMacro item of symbol type is replaced with + * the reference + */ hb_memvarGetRefer( pMacro, pSym ); } w++; @@ -2095,23 +2095,23 @@ HB_EXPORT void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) int iLocal = pCode[ w + 1 ]; HB_TRACE( HB_TR_DEBUG, ("HB_P_LOCALNEARADDINT") ); - hb_vmAddInt( hb_stackLocalVariable( &iLocal ), + hb_vmAddInt( hb_stackLocalVariable( &iLocal ), HB_PCODE_MKSHORT( &pCode[ w + 2 ] ) ); w += 4; break; } - + case HB_P_LOCALADDINT: { int iLocal = HB_PCODE_MKUSHORT( &pCode[ w + 1 ] ); HB_TRACE( HB_TR_DEBUG, ("HB_P_LOCALADDINT") ); - hb_vmAddInt( hb_stackLocalVariable( &iLocal ), + hb_vmAddInt( hb_stackLocalVariable( &iLocal ), HB_PCODE_MKSHORT( &pCode[ w + 3 ] ) ); w += 5; break; } - + case HB_P_LOCALINC: { int iLocal = HB_PCODE_MKUSHORT( &pCode[ w + 1 ] ); @@ -3510,7 +3510,7 @@ static HB_GARBAGE_FUNC( hb_SeqBlockDestructor ) hb_itemMove( hb_errorBlock(), * pBlockPtr ); hb_itemRelease( * pBlockPtr ); } - + static void hb_vmSeqBlock( void ) { PHB_ITEM pItem; @@ -3850,7 +3850,7 @@ static void hb_vmEnumPrev( void ) { HB_ITEM_PTR pEnumRef, pEnum, pBase; int i; - + for( i = hb_stackItemFromTop( -1 )->item.asInteger.value; i > 0; --i ) { pEnumRef = hb_stackItemFromTop( -( i << 1 ) ); @@ -3925,7 +3925,7 @@ static void hb_vmEnumPrev( void ) static void hb_vmEnumEnd( void ) { int iVars; - + /* remove number of iterators */ iVars = hb_stackItemFromTop( -1 )->item.asInteger.value; hb_stackDec(); @@ -3964,7 +3964,7 @@ static LONG hb_vmSwitch( const BYTE * pCode, LONG offset, USHORT casesCnt ) } offset += 5; break; - + case HB_P_PUSHSTRSHORT: if( HB_IS_STRING( pSwitch ) ) { @@ -3976,7 +3976,7 @@ static LONG hb_vmSwitch( const BYTE * pCode, LONG offset, USHORT casesCnt ) } offset += 2 + pCode[ offset + 1 ]; break; - + case HB_P_PUSHNIL: /* default clause */ fFound = TRUE; @@ -4676,28 +4676,28 @@ static ERRCODE hb_vmSelectWorkarea( PHB_ITEM pAlias, PHB_SYMB pField ) hb_rddSelectWorkAreaNumber( pAlias->item.asInteger.value ); pAlias->type = HB_IT_NIL; break; - + case HB_IT_LONG: /* Alias was evaluated from an expression, (nWorkArea)->field */ hb_rddSelectWorkAreaNumber( ( int ) pAlias->item.asLong.value ); pAlias->type = HB_IT_NIL; break; - + case HB_IT_DOUBLE: /* Alias was evaluated from an expression, (nWorkArea)->field */ hb_rddSelectWorkAreaNumber( ( int ) pAlias->item.asDouble.value ); pAlias->type = HB_IT_NIL; break; - + case HB_IT_SYMBOL: /* Alias was specified using alias identifier, for example: al->field */ errCode = hb_rddSelectWorkAreaSymbol( pAlias->item.asSymbol.value ); pAlias->type = HB_IT_NIL; break; - + case HB_IT_STRING: { /* Alias was evaluated from an expression, for example: (cVar)->field @@ -4705,7 +4705,7 @@ static ERRCODE hb_vmSelectWorkarea( PHB_ITEM pAlias, PHB_SYMB pField ) /* expand '&' operator if exists */ char * szAlias; BOOL bNewString; - + szAlias = hb_macroExpandString( pAlias->item.asString.value, pAlias->item.asString.length, &bNewString ); if( pField ) { @@ -6908,7 +6908,7 @@ BOOL hb_vmMsgReference( PHB_ITEM pObject, PHB_DYNS pMessage, PHB_DYNS pAccMsg ) PHB_MSGREF pMsgRef; PHB_ITEM pRefer; - HB_TRACE(HB_TR_DEBUG, ("hb_vmMsgReference(%p,%p,%p)", pObject, pMessage,pAccMsg)); + HB_TRACE(HB_TR_DEBUG, ("hb_vmMsgReference(%p,%p,%p)", pObject, pMessage, pAccMsg)); pMsgRef = ( PHB_MSGREF ) hb_xgrab( sizeof( HB_MSGREF ) ); pMsgRef->access = pAccMsg; @@ -9551,7 +9551,7 @@ HB_FUNC( HB_DBG_VMVARSLIST ) { PHB_ITEM pStatics = hb_itemClone( &s_aStatics ); - hb_itemRelease( hb_itemReturnForward( pStatics ) ); + hb_itemReturnRelease( pStatics ); } /* $Doc$ @@ -9625,7 +9625,7 @@ HB_FUNC( HB_DBG_VMVARGLIST ) PHB_ITEM pGlobals = hb_itemArrayNew( 0 ); #endif - hb_itemRelease( hb_itemReturnForward( pGlobals ) ); + hb_itemReturnRelease( pGlobals ); } HB_FUNC( HB_DBG_VMVARGGET ) diff --git a/harbour/source/vm/runner.c b/harbour/source/vm/runner.c index e80c3ed99a..5d68445a4b 100644 --- a/harbour/source/vm/runner.c +++ b/harbour/source/vm/runner.c @@ -562,7 +562,7 @@ static void hb_hrbDo( PHRB_BODY pHrbBody, int argc, char * argv[] ) if( pRetVal ) { - hb_itemRelease( hb_itemReturnForward( pRetVal ) ); + hb_itemReturnRelease( pRetVal ); } }