diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 0ee2c97a1b..a8d011f5ba 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,25 @@ +20000423-11:38 GMT+1 Victor Szakats + + + contrib/libct/* + + contrib/libgt/* + + contrib/libmisc/* + - source/tools/* + * source/Makefile + * makefile.bc + * makefile.vc + * tests/Makefile + * utils/hbrun/Makefile + - utils/hbrun/exttools.prg + + utils/hbrun/external.prg + * TOOLS dir moved to CONTRIB, and split into three parts. CT_ prefixed + removed from the CT function names. + ; ! WARNING ! It's likely that some test program will fail now, because + they are using functions from TOOLS. These tests should be removed or + corrected. + + * source/vm/hvm.c + % Optimizations in hb_vmExecute() + 20000423-06:09 GMT+1 Victor Szakats * source/compiler/harbour.c diff --git a/harbour/contrib/libct/Makefile b/harbour/contrib/libct/Makefile new file mode 100644 index 0000000000..55ae8a8ff0 --- /dev/null +++ b/harbour/contrib/libct/Makefile @@ -0,0 +1,22 @@ +# +# $Id$ +# + +ROOT = ../../ + +C_SOURCES=\ + ctchksum.c \ + ctchrevn.c \ + ctchrmix.c \ + ctchrodd.c \ + ctcolton.c \ + ctcrypt.c \ + ctposupp.c \ + +PRG_SOURCES=\ + ctmisc.prg \ + cttoken.prg \ + +LIBNAME=ct3 + +include $(TOP)$(ROOT)config/lib.cf diff --git a/harbour/source/tools/ctchksum.c b/harbour/contrib/libct/ctchksum.c similarity index 96% rename from harbour/source/tools/ctchksum.c rename to harbour/contrib/libct/ctchksum.c index dd8bfbb35a..c484578533 100644 --- a/harbour/source/tools/ctchksum.c +++ b/harbour/contrib/libct/ctchksum.c @@ -4,7 +4,7 @@ /* * Harbour Project source code: - * CT_CHECKSUM() CA-Tools function + * CHECKSUM() CA-Tools function * * Copyright 1999 Victor Szakats * www - http://www.harbour-project.org @@ -35,7 +35,7 @@ #include "hbapi.h" -HB_FUNC( CT_CHECKSUM ) +HB_FUNC( CHECKSUM ) { BYTE * pbyString = ( BYTE * ) hb_parc( 1 ); ULONG ulLen = hb_parclen( 1 ); diff --git a/harbour/contrib/libct/ctchrevn.c b/harbour/contrib/libct/ctchrevn.c new file mode 100644 index 0000000000..5c7e8bed25 --- /dev/null +++ b/harbour/contrib/libct/ctchrevn.c @@ -0,0 +1,55 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * CHAREVEN() CA-Tools function + * + * Copyright 2000 Victor 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 of the License, or + * (at your option) any later version, with one exception: + * + * The exception is that if you link the Harbour Runtime Library (HRL) + * and/or the Harbour Virtual Machine (HVM) 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 HRL + * and/or HVM code into it. + * + * 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 program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + * their web site at http://www.gnu.org/). + * + */ + +#include "hbapi.h" + +HB_FUNC( CHAREVEN ) +{ + if( ISCHAR( 1 ) ) + { + char * pszSource = hb_parc( 1 ); + ULONG ulLen = hb_parclen( 1 ); + ULONG i; + char * pszResult = ( char * ) hb_xgrab( ulLen / 2 ); + + for( i = 1; i <= ulLen; i += 2 ) + pszResult[ ( i - 1 ) / 2 ] = pszSource[ i ]; + + hb_retclen( pszResult, ulLen ); + hb_xfree( pszResult ); + } + else + hb_retc( "" ); +} diff --git a/harbour/source/tools/ctchrmix.c b/harbour/contrib/libct/ctchrmix.c similarity index 97% rename from harbour/source/tools/ctchrmix.c rename to harbour/contrib/libct/ctchrmix.c index 28d6014d99..1f2a5f7e65 100644 --- a/harbour/source/tools/ctchrmix.c +++ b/harbour/contrib/libct/ctchrmix.c @@ -4,7 +4,7 @@ /* * Harbour Project source code: - * CT_CHARMIX() CA-Tools compatible function + * CHARMIX() CA-Tools compatible function * * Copyright 1999 Victor Szakats * www - http://www.harbour-project.org @@ -38,7 +38,7 @@ /* NOTE: CA-Tools will hang if the second parameter is an empty string */ -HB_FUNC( CT_CHARMIX ) +HB_FUNC( CHARMIX ) { PHB_ITEM pStr1 = hb_param( 1, HB_IT_STRING ); PHB_ITEM pStr2 = hb_param( 2, HB_IT_STRING ); diff --git a/harbour/contrib/libct/ctchrodd.c b/harbour/contrib/libct/ctchrodd.c new file mode 100644 index 0000000000..b2cb9fcfff --- /dev/null +++ b/harbour/contrib/libct/ctchrodd.c @@ -0,0 +1,55 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * CHARODD() CA-Tools function + * + * Copyright 2000 Victor 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 of the License, or + * (at your option) any later version, with one exception: + * + * The exception is that if you link the Harbour Runtime Library (HRL) + * and/or the Harbour Virtual Machine (HVM) 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 HRL + * and/or HVM code into it. + * + * 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 program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + * their web site at http://www.gnu.org/). + * + */ + +#include "hbapi.h" + +HB_FUNC( CHARODD ) +{ + if( ISCHAR( 1 ) ) + { + char * pszSource = hb_parc( 1 ); + ULONG ulLen = hb_parclen( 1 ); + ULONG i; + char * pszResult = ( char * ) hb_xgrab( ulLen / 2 ); + + for( i = 0; i <= len; i += 2 ) + pszResult[ i / 2 ] = pszSource[ i ]; + + hb_retclen( pszResult, ulLen ); + hb_xfree( pszResult ); + } + else + hb_retc( "" ); +} diff --git a/harbour/source/tools/ctcolton.c b/harbour/contrib/libct/ctcolton.c similarity index 97% rename from harbour/source/tools/ctcolton.c rename to harbour/contrib/libct/ctcolton.c index adb7d4ec28..2cf6f57e48 100644 --- a/harbour/source/tools/ctcolton.c +++ b/harbour/contrib/libct/ctcolton.c @@ -4,7 +4,7 @@ /* * Harbour Project source code: - * CT_COLORTON() CA-Tools function + * COLORTON() CA-Tools function * * Copyright 2000 Victor Szakats * www - http://www.harbour-project.org @@ -99,7 +99,7 @@ static BYTE StrToColor( char * pszColor ) return color; } -HB_FUNC( CT_COLORTON ) +HB_FUNC( COLORTON ) { hb_retni( StrToColor( hb_parc( 1 ) ) ); } diff --git a/harbour/source/tools/ctcrypt.c b/harbour/contrib/libct/ctcrypt.c similarity index 98% rename from harbour/source/tools/ctcrypt.c rename to harbour/contrib/libct/ctcrypt.c index c07c390bd7..06261e6b8d 100644 --- a/harbour/source/tools/ctcrypt.c +++ b/harbour/contrib/libct/ctcrypt.c @@ -4,7 +4,7 @@ /* * Harbour Project source code: - * CT_CRYPT() CA-Tools compatible function + * CRYPT() CA-Tools compatible function * * Copyright 1999 Victor Szakats * www - http://www.harbour-project.org @@ -35,7 +35,7 @@ #include "hbapi.h" -HB_FUNC( CT_CRYPT ) +HB_FUNC( CRYPT ) { ULONG ulCryptLen = hb_parclen( 2 ); diff --git a/harbour/source/tools/ctmisc.prg b/harbour/contrib/libct/ctmisc.prg similarity index 85% rename from harbour/source/tools/ctmisc.prg rename to harbour/contrib/libct/ctmisc.prg index f5d7be9cf4..acec1184bf 100644 --- a/harbour/source/tools/ctmisc.prg +++ b/harbour/contrib/libct/ctmisc.prg @@ -39,10 +39,10 @@ MEMVAR GetList -FUNCTION CT_CENTER( c, n, p ) +FUNCTION CENTER( c, n, p ) RETURN PadC( AllTrim( c ), n, p ) -FUNCTION CT_CSETCURS( l ) +FUNCTION CSETCURS( l ) IF PCount() == 0 RETURN SetCursor() != SC_NONE @@ -50,43 +50,43 @@ FUNCTION CT_CSETCURS( l ) RETURN SetCursor( iif( l, SC_NORMAL, SC_NONE ) ) != SC_NONE -FUNCTION CT_CSETKEY( n ) +FUNCTION CSETKEY( n ) RETURN SetKey( n ) -FUNCTION CT_ENHANCED() +FUNCTION ENHANCED() ColorSelect( CLR_ENHANCED ) RETURN "" -FUNCTION CT_STANDARD() +FUNCTION STANDARD() ColorSelect( CLR_STANDARD ) RETURN "" -FUNCTION CT_LTOC( l ) +FUNCTION LTOC( l ) RETURN iif( l, "T", "F" ) -FUNCTION CT_RESTGETS( aGetList ) +FUNCTION RESTGETS( aGetList ) GetList := aGetList RETURN .T. -FUNCTION CT_SAVEGETS() +FUNCTION SAVEGETS() LOCAL aGetList := GetList GetList := {} RETURN aGetList -FUNCTION CT_SCREENMIX( c, a, row, col ) +FUNCTION SCREENMIX( c, a, row, col ) DEFAULT row TO Row() DEFAULT col TO Col() - RestScreen( row, col, row, col + Len( a ) - 1, CT_CHARMIX( c, a ) ) + RestScreen( row, col, row, col + Len( a ) - 1, CHARMIX( c, a ) ) RETURN "" diff --git a/harbour/source/tools/ctposupp.c b/harbour/contrib/libct/ctposupp.c similarity index 96% rename from harbour/source/tools/ctposupp.c rename to harbour/contrib/libct/ctposupp.c index 93ef34c75c..5a4eac8987 100644 --- a/harbour/source/tools/ctposupp.c +++ b/harbour/contrib/libct/ctposupp.c @@ -4,7 +4,7 @@ /* * Harbour Project source code: - * CT_POSUPPER() CA-Tools function + * POSUPPER() CA-Tools function * * Copyright 2000 Victor Szakats * www - http://www.harbour-project.org @@ -37,7 +37,7 @@ #include "hbapi.h" -HB_FUNC( CT_POSUPPER ) +HB_FUNC( POSUPPER ) { BYTE * pbyString = ( BYTE * ) hb_parc( 1 ); ULONG ulLen = hb_parclen( 1 ); diff --git a/harbour/source/tools/cttoken.prg b/harbour/contrib/libct/cttoken.prg similarity index 96% rename from harbour/source/tools/cttoken.prg rename to harbour/contrib/libct/cttoken.prg index 939ac9b9bf..9b37918ff8 100644 --- a/harbour/source/tools/cttoken.prg +++ b/harbour/contrib/libct/cttoken.prg @@ -4,7 +4,7 @@ /* * Harbour Project source code: - * CT_NUMTOKEN() and CT_TOKEN() CA-Tools function + * NUMTOKEN() and TOKEN() CA-Tools function * * Copyright 2000 Phil Barnett * www - http://www.harbour-project.org @@ -40,7 +40,7 @@ // used in the like named function in Clipper Tools III, so it should // work identically. -function CT_NUMTOKEN( cString, cDelimiter ) +function NUMTOKEN( cString, cDelimiter ) local x local nStrLen := len( cString ) @@ -79,7 +79,7 @@ function CT_NUMTOKEN( cString, cDelimiter ) // This defaults to the same delimiters as used in the like named // function in Clipper Tools III, so it should work identically. -function CT_TOKEN( cString, cDelimiter, nPointer ) +function TOKEN( cString, cDelimiter, nPointer ) local x local nStrLen := len( cString ) diff --git a/harbour/contrib/libct/readme.txt b/harbour/contrib/libct/readme.txt new file mode 100644 index 0000000000..7497bb2e71 --- /dev/null +++ b/harbour/contrib/libct/readme.txt @@ -0,0 +1,12 @@ +/* + * $Id$ + */ + +CA-T**ls Compatible Library for Harbour +======================================= + +The goal of this library and header file is to provide the +functionality of the original CA-T**ls 3 Library for CA-Cl*pper. + +Victor Szakats + diff --git a/harbour/source/tools/Makefile b/harbour/contrib/libgt/Makefile similarity index 54% rename from harbour/source/tools/Makefile rename to harbour/contrib/libgt/Makefile index 54047473ee..c6ad0b32db 100644 --- a/harbour/source/tools/Makefile +++ b/harbour/contrib/libgt/Makefile @@ -14,35 +14,17 @@ C_SOURCES=\ chrcount.c \ chrfirst.c \ chrtotal.c \ - ctchksum.c \ - ctchrmix.c \ - ctcolton.c \ - ctcrypt.c \ - ctposupp.c \ - dates2.c \ - dbftools.c \ - hb_f.c \ - mathx.c \ strasint.c \ strcount.c \ strcspn.c \ strdiff.c \ strexpan.c \ - strfmt.c \ - stringsx.c \ strleft.c \ strpbrk.c \ strright.c \ PRG_SOURCES=\ - ctmisc.prg \ - cttoken.prg \ - fileread.prg \ - nconvert.prg \ - numtxthu.prg \ - numtxten.prg \ - stringp.prg \ -LIBNAME=tools +LIBNAME=gt include $(TOP)$(ROOT)config/lib.cf diff --git a/harbour/source/tools/asciisum.c b/harbour/contrib/libgt/asciisum.c similarity index 100% rename from harbour/source/tools/asciisum.c rename to harbour/contrib/libgt/asciisum.c diff --git a/harbour/source/tools/ascpos.c b/harbour/contrib/libgt/ascpos.c similarity index 100% rename from harbour/source/tools/ascpos.c rename to harbour/contrib/libgt/ascpos.c diff --git a/harbour/source/tools/atdiff.c b/harbour/contrib/libgt/atdiff.c similarity index 100% rename from harbour/source/tools/atdiff.c rename to harbour/contrib/libgt/atdiff.c diff --git a/harbour/source/tools/chareven.c b/harbour/contrib/libgt/chareven.c similarity index 100% rename from harbour/source/tools/chareven.c rename to harbour/contrib/libgt/chareven.c diff --git a/harbour/source/tools/charmix.c b/harbour/contrib/libgt/charmix.c similarity index 100% rename from harbour/source/tools/charmix.c rename to harbour/contrib/libgt/charmix.c diff --git a/harbour/source/tools/charodd.c b/harbour/contrib/libgt/charodd.c similarity index 100% rename from harbour/source/tools/charodd.c rename to harbour/contrib/libgt/charodd.c diff --git a/harbour/source/tools/chrcount.c b/harbour/contrib/libgt/chrcount.c similarity index 100% rename from harbour/source/tools/chrcount.c rename to harbour/contrib/libgt/chrcount.c diff --git a/harbour/source/tools/chrfirst.c b/harbour/contrib/libgt/chrfirst.c similarity index 100% rename from harbour/source/tools/chrfirst.c rename to harbour/contrib/libgt/chrfirst.c diff --git a/harbour/source/tools/chrtotal.c b/harbour/contrib/libgt/chrtotal.c similarity index 100% rename from harbour/source/tools/chrtotal.c rename to harbour/contrib/libgt/chrtotal.c diff --git a/harbour/source/tools/strasint.c b/harbour/contrib/libgt/strasint.c similarity index 100% rename from harbour/source/tools/strasint.c rename to harbour/contrib/libgt/strasint.c diff --git a/harbour/source/tools/strcount.c b/harbour/contrib/libgt/strcount.c similarity index 100% rename from harbour/source/tools/strcount.c rename to harbour/contrib/libgt/strcount.c diff --git a/harbour/source/tools/strcspn.c b/harbour/contrib/libgt/strcspn.c similarity index 100% rename from harbour/source/tools/strcspn.c rename to harbour/contrib/libgt/strcspn.c diff --git a/harbour/source/tools/strdiff.c b/harbour/contrib/libgt/strdiff.c similarity index 100% rename from harbour/source/tools/strdiff.c rename to harbour/contrib/libgt/strdiff.c diff --git a/harbour/source/tools/strexpan.c b/harbour/contrib/libgt/strexpan.c similarity index 100% rename from harbour/source/tools/strexpan.c rename to harbour/contrib/libgt/strexpan.c diff --git a/harbour/source/tools/strleft.c b/harbour/contrib/libgt/strleft.c similarity index 100% rename from harbour/source/tools/strleft.c rename to harbour/contrib/libgt/strleft.c diff --git a/harbour/source/tools/strpbrk.c b/harbour/contrib/libgt/strpbrk.c similarity index 100% rename from harbour/source/tools/strpbrk.c rename to harbour/contrib/libgt/strpbrk.c diff --git a/harbour/source/tools/strright.c b/harbour/contrib/libgt/strright.c similarity index 100% rename from harbour/source/tools/strright.c rename to harbour/contrib/libgt/strright.c diff --git a/harbour/contrib/libmisc/Makefile b/harbour/contrib/libmisc/Makefile new file mode 100644 index 0000000000..cbb2caf954 --- /dev/null +++ b/harbour/contrib/libmisc/Makefile @@ -0,0 +1,24 @@ +# +# $Id$ +# + +ROOT = ../../ + +C_SOURCES=\ + dates2.c \ + dbftools.c \ + hb_f.c \ + mathx.c \ + strfmt.c \ + stringsx.c \ + +PRG_SOURCES=\ + fileread.prg \ + nconvert.prg \ + numtxthu.prg \ + numtxten.prg \ + stringp.prg \ + +LIBNAME=libmisc + +include $(TOP)$(ROOT)config/lib.cf diff --git a/harbour/source/tools/dates2.c b/harbour/contrib/libmisc/dates2.c similarity index 100% rename from harbour/source/tools/dates2.c rename to harbour/contrib/libmisc/dates2.c diff --git a/harbour/source/tools/dbftools.c b/harbour/contrib/libmisc/dbftools.c similarity index 100% rename from harbour/source/tools/dbftools.c rename to harbour/contrib/libmisc/dbftools.c diff --git a/harbour/source/tools/fileread.prg b/harbour/contrib/libmisc/fileread.prg similarity index 100% rename from harbour/source/tools/fileread.prg rename to harbour/contrib/libmisc/fileread.prg diff --git a/harbour/source/tools/hb_f.c b/harbour/contrib/libmisc/hb_f.c similarity index 100% rename from harbour/source/tools/hb_f.c rename to harbour/contrib/libmisc/hb_f.c diff --git a/harbour/source/tools/mathx.c b/harbour/contrib/libmisc/mathx.c similarity index 100% rename from harbour/source/tools/mathx.c rename to harbour/contrib/libmisc/mathx.c diff --git a/harbour/source/tools/nconvert.prg b/harbour/contrib/libmisc/nconvert.prg similarity index 100% rename from harbour/source/tools/nconvert.prg rename to harbour/contrib/libmisc/nconvert.prg diff --git a/harbour/source/tools/numtxten.prg b/harbour/contrib/libmisc/numtxten.prg similarity index 100% rename from harbour/source/tools/numtxten.prg rename to harbour/contrib/libmisc/numtxten.prg diff --git a/harbour/source/tools/numtxthu.prg b/harbour/contrib/libmisc/numtxthu.prg similarity index 100% rename from harbour/source/tools/numtxthu.prg rename to harbour/contrib/libmisc/numtxthu.prg diff --git a/harbour/source/tools/strfmt.c b/harbour/contrib/libmisc/strfmt.c similarity index 100% rename from harbour/source/tools/strfmt.c rename to harbour/contrib/libmisc/strfmt.c diff --git a/harbour/source/tools/stringp.prg b/harbour/contrib/libmisc/stringp.prg similarity index 100% rename from harbour/source/tools/stringp.prg rename to harbour/contrib/libmisc/stringp.prg diff --git a/harbour/source/tools/stringsx.c b/harbour/contrib/libmisc/stringsx.c similarity index 100% rename from harbour/source/tools/stringsx.c rename to harbour/contrib/libmisc/stringsx.c diff --git a/harbour/makefile.bc b/harbour/makefile.bc index 660b49e267..e5f624cebd 100644 --- a/harbour/makefile.bc +++ b/harbour/makefile.bc @@ -71,7 +71,6 @@ MACRO_DIR = source\macro PP_DIR = source\pp RDD_DIR = source\rdd RTL_DIR = source\rtl -TOOLS_DIR = source\tools VM_DIR = source\vm HBRUN_DIR = utils\hbrun HBTEST_DIR = utils\hbtest @@ -101,7 +100,6 @@ NULSYS_LIB = $(LIB_DIR)\nulsys.lib PP_LIB = $(LIB_DIR)\pp.lib RDD_LIB = $(LIB_DIR)\rdd.lib RTL_LIB = $(LIB_DIR)\rtl.lib -TOOLS_LIB = $(LIB_DIR)\tools.lib VM_LIB = $(LIB_DIR)\vm.lib GTDOS_LIB = $(LIB_DIR)\gtdos.lib @@ -315,48 +313,6 @@ LANG_LIB_OBJS = \ $(OBJ_DIR)\msgpt.obj \ $(OBJ_DIR)\msgro.obj -# -# TOOLS.LIB rules -# - -TOOLS_LIB_OBJS = \ - $(OBJ_DIR)\asciisum.obj \ - $(OBJ_DIR)\ascpos.obj \ - $(OBJ_DIR)\atdiff.obj \ - $(OBJ_DIR)\chareven.obj \ - $(OBJ_DIR)\charmix.obj \ - $(OBJ_DIR)\charodd.obj \ - $(OBJ_DIR)\chrcount.obj \ - $(OBJ_DIR)\chrfirst.obj \ - $(OBJ_DIR)\chrtotal.obj \ - $(OBJ_DIR)\ctchksum.obj \ - $(OBJ_DIR)\ctchrmix.obj \ - $(OBJ_DIR)\ctcolton.obj \ - $(OBJ_DIR)\ctcrypt.obj \ - $(OBJ_DIR)\ctposupp.obj \ - $(OBJ_DIR)\dates2.obj \ - $(OBJ_DIR)\dbftools.obj \ - $(OBJ_DIR)\hb_f.obj \ - $(OBJ_DIR)\mathx.obj \ - $(OBJ_DIR)\strasint.obj \ - $(OBJ_DIR)\strcount.obj \ - $(OBJ_DIR)\strcspn.obj \ - $(OBJ_DIR)\strdiff.obj \ - $(OBJ_DIR)\strexpan.obj \ - $(OBJ_DIR)\strfmt.obj \ - $(OBJ_DIR)\stringsx.obj \ - $(OBJ_DIR)\strleft.obj \ - $(OBJ_DIR)\strpbrk.obj \ - $(OBJ_DIR)\strright.obj \ - \ - $(OBJ_DIR)\ctmisc.obj \ - $(OBJ_DIR)\cttoken.obj \ - $(OBJ_DIR)\fileread.obj \ - $(OBJ_DIR)\nconvert.obj \ - $(OBJ_DIR)\numtxten.obj \ - $(OBJ_DIR)\numtxthu.obj \ - $(OBJ_DIR)\stringp.obj - # # MACRO.LIB rules # @@ -527,7 +483,7 @@ HARBOUR_EXE_OBJS = \ HBRUN_EXE_OBJS = \ $(OBJ_DIR)\hbrun.obj \ - $(OBJ_DIR)\exttools.obj \ + $(OBJ_DIR)\external.obj \ # # HBTEST.EXE rules @@ -578,7 +534,6 @@ all: \ $(HARBOUR_EXE) \ $(VM_LIB) \ $(RTL_LIB) \ - $(TOOLS_LIB) \ $(MACRO_LIB) \ $(DEBUG_LIB) \ $(LANG_LIB) \ @@ -606,7 +561,6 @@ $(NULSYS_LIB) : $(NULSYS_LIB_OBJS) $(PP_LIB) : $(PP_LIB_OBJS) $(RDD_LIB) : $(RDD_LIB_OBJS) $(RTL_LIB) : $(RTL_LIB_OBJS) -$(TOOLS_LIB) : $(TOOLS_LIB_OBJS) $(VM_LIB) : $(VM_LIB_OBJS) $(GTDOS_LIB) : $(GTDOS_LIB_OBJS) $(GTPCA_LIB) : $(GTPCA_LIB_OBJS) @@ -1639,171 +1593,6 @@ $(OBJ_DIR)\msgro.obj : $(LANG_DIR)\msgro.c $(CC) $(CLIBFLAGS) -I$(LANG_DIR) -o$@ $** tlib $(LANG_LIB) $(ARFLAGS) -+$@,, -# -# TOOLS.LIB dependencies -# - -$(OBJ_DIR)\asciisum.obj : $(TOOLS_DIR)\asciisum.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\ascpos.obj : $(TOOLS_DIR)\ascpos.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\atdiff.obj : $(TOOLS_DIR)\atdiff.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\chareven.obj : $(TOOLS_DIR)\chareven.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\charmix.obj : $(TOOLS_DIR)\charmix.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\charodd.obj : $(TOOLS_DIR)\charodd.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\chrcount.obj : $(TOOLS_DIR)\chrcount.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\chrfirst.obj : $(TOOLS_DIR)\chrfirst.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\chrtotal.obj : $(TOOLS_DIR)\chrtotal.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\ctchksum.obj : $(TOOLS_DIR)\ctchksum.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\ctchrmix.obj : $(TOOLS_DIR)\ctchrmix.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\ctcolton.obj : $(TOOLS_DIR)\ctcolton.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\ctcrypt.obj : $(TOOLS_DIR)\ctcrypt.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\ctposupp.obj : $(TOOLS_DIR)\ctposupp.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\dates2.obj : $(TOOLS_DIR)\dates2.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\dbftools.obj : $(TOOLS_DIR)\dbftools.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\ctmisc.c : $(TOOLS_DIR)\ctmisc.prg - $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ - -$(OBJ_DIR)\ctmisc.obj : $(OBJ_DIR)\ctmisc.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\cttoken.c : $(TOOLS_DIR)\cttoken.prg - $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ - -$(OBJ_DIR)\cttoken.obj : $(OBJ_DIR)\cttoken.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\fileread.c : $(TOOLS_DIR)\fileread.prg - $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ - -$(OBJ_DIR)\fileread.obj : $(OBJ_DIR)\fileread.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\hb_f.obj : $(TOOLS_DIR)\hb_f.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\mathx.obj : $(TOOLS_DIR)\mathx.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\nconvert.c : $(TOOLS_DIR)\nconvert.prg - $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ - -$(OBJ_DIR)\nconvert.obj : $(OBJ_DIR)\nconvert.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\numtxten.c : $(TOOLS_DIR)\numtxten.prg - $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ - -$(OBJ_DIR)\numtxten.obj : $(OBJ_DIR)\numtxten.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\numtxthu.c : $(TOOLS_DIR)\numtxthu.prg - $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ - -$(OBJ_DIR)\numtxthu.obj : $(OBJ_DIR)\numtxthu.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\strasint.obj : $(TOOLS_DIR)\strasint.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\strcount.obj : $(TOOLS_DIR)\strcount.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\strcspn.obj : $(TOOLS_DIR)\strcspn.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\strdiff.obj : $(TOOLS_DIR)\strdiff.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\strexpan.obj : $(TOOLS_DIR)\strexpan.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\strfmt.obj : $(TOOLS_DIR)\strfmt.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\stringp.c : $(TOOLS_DIR)\stringp.prg - $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ - -$(OBJ_DIR)\stringp.obj : $(OBJ_DIR)\stringp.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\stringsx.obj : $(TOOLS_DIR)\stringsx.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\strleft.obj : $(TOOLS_DIR)\strleft.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\strpbrk.obj : $(TOOLS_DIR)\strpbrk.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\strright.obj : $(TOOLS_DIR)\strright.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - # # MACRO.LIB dependencies # @@ -1990,7 +1779,7 @@ $(HBRUN_EXE) : $(HBRUN_EXE_OBJS) echo. -e$(HBRUN_EXE) >> make.tmp echo. -I$(INCLUDE_DIR) >> make.tmp echo. $(OBJ_DIR)\hbrun.obj >> make.tmp - echo. $(OBJ_DIR)\exttools.obj >> make.tmp + echo. $(OBJ_DIR)\external.obj >> make.tmp echo. $(PP_LIB) >> make.tmp echo. $(COMMON_LIB) >> make.tmp echo. $(VM_LIB) >> make.tmp @@ -1999,7 +1788,6 @@ $(HBRUN_EXE) : $(HBRUN_EXE_OBJS) echo. $(LANG_LIB) >> make.tmp echo. $(RDD_LIB) >> make.tmp echo. $(MACRO_LIB) >> make.tmp - echo. $(TOOLS_LIB) >> make.tmp echo. $(DBFNTX_LIB) >> make.tmp echo. $(DBFCDX_LIB) >> make.tmp $(CC) @make.tmp @@ -2011,10 +1799,10 @@ $(OBJ_DIR)\hbrun.c : $(HBRUN_DIR)\hbrun.prg $(OBJ_DIR)\hbrun.obj : $(OBJ_DIR)\hbrun.c $(CC) $(CLIBFLAGS) -o$@ $** -$(OBJ_DIR)\exttools.c : $(HBRUN_DIR)\exttools.prg +$(OBJ_DIR)\external.c : $(HBRUN_DIR)\external.prg $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ -$(OBJ_DIR)\exttools.obj : $(OBJ_DIR)\exttools.c +$(OBJ_DIR)\external.obj : $(OBJ_DIR)\external.c $(CC) $(CLIBFLAGS) -o$@ $** # @@ -2147,7 +1935,6 @@ $(HBDOC_EXE) : $(HBDOC_EXE_OBJS) echo. $(LANG_LIB) >> make.tmp echo. $(RDD_LIB) >> make.tmp echo. $(MACRO_LIB) >> make.tmp - echo. $(TOOLS_LIB) >> make.tmp echo. $(DBFNTX_LIB) >> make.tmp echo. $(DBFCDX_LIB) >> make.tmp $(CC) @make.tmp diff --git a/harbour/makefile.vc b/harbour/makefile.vc index fd646ce659..fc99f7bf63 100644 --- a/harbour/makefile.vc +++ b/harbour/makefile.vc @@ -69,7 +69,6 @@ MACRO_DIR = source\macro PP_DIR = source\pp RDD_DIR = source\rdd RTL_DIR = source\rtl -TOOLS_DIR = source\tools VM_DIR = source\vm HBRUN_DIR = utils\hbrun HBTEST_DIR = utils\hbtest @@ -100,7 +99,6 @@ NULSYS_LIB = $(LIB_DIR)\nulsys.lib PP_LIB = $(LIB_DIR)\pp.lib RDD_LIB = $(LIB_DIR)\rdd.lib RTL_LIB = $(LIB_DIR)\rtl.lib -TOOLS_LIB = $(LIB_DIR)\tools.lib VM_LIB = $(LIB_DIR)\vm.lib GTPCA_LIB = $(LIB_DIR)\gtpca.lib @@ -147,7 +145,6 @@ LIBLIST = \ $(DBFCDX_LIB) \ $(DBFNTX_LIB) \ $(NULSYS_LIB) \ - $(TOOLS_LIB) \ $(VM_LIB) \ $(HB_GT_LIB) @@ -352,55 +349,6 @@ LANG_LIB_OBJS = \ $(OBJ_DIR)\msgpt.obj \ $(OBJ_DIR)\msgro.obj -# -# TOOLS.LIB rules -# - -{$(TOOLS_DIR)}.c{$(OBJ_DIR)}.obj:: - $(CC) $(CLIBFLAGS) -Fo$(OBJ_DIR)\ $< - -{$(TOOLS_DIR)}.prg{$(OBJ_DIR)}.obj:: - $(HARBOUR_EXE) $(HARBOURFLAGS) -o$(OBJ_DIR)\ $< - $(MAKE) -nologo /$(MK_FLAGS) /f$(MK_FILE) $(TOOLS_LIB)2 - -TOOLS_LIB_OBJS = \ - $(OBJ_DIR)\asciisum.obj \ - $(OBJ_DIR)\ascpos.obj \ - $(OBJ_DIR)\atdiff.obj \ - $(OBJ_DIR)\chareven.obj \ - $(OBJ_DIR)\charmix.obj \ - $(OBJ_DIR)\charodd.obj \ - $(OBJ_DIR)\chrcount.obj \ - $(OBJ_DIR)\chrfirst.obj \ - $(OBJ_DIR)\chrtotal.obj \ - $(OBJ_DIR)\ctchksum.obj \ - $(OBJ_DIR)\ctchrmix.obj \ - $(OBJ_DIR)\ctcolton.obj \ - $(OBJ_DIR)\ctcrypt.obj \ - $(OBJ_DIR)\ctposupp.obj \ - $(OBJ_DIR)\dates2.obj \ - $(OBJ_DIR)\dbftools.obj \ - $(OBJ_DIR)\hb_f.obj \ - $(OBJ_DIR)\mathx.obj \ - $(OBJ_DIR)\strasint.obj \ - $(OBJ_DIR)\strcount.obj \ - $(OBJ_DIR)\strcspn.obj \ - $(OBJ_DIR)\strdiff.obj \ - $(OBJ_DIR)\strexpan.obj \ - $(OBJ_DIR)\strfmt.obj \ - $(OBJ_DIR)\stringsx.obj \ - $(OBJ_DIR)\strleft.obj \ - $(OBJ_DIR)\strpbrk.obj \ - $(OBJ_DIR)\strright.obj \ - \ - $(OBJ_DIR)\ctmisc.obj \ - $(OBJ_DIR)\cttoken.obj \ - $(OBJ_DIR)\fileread.obj \ - $(OBJ_DIR)\nconvert.obj \ - $(OBJ_DIR)\numtxten.obj \ - $(OBJ_DIR)\numtxthu.obj \ - $(OBJ_DIR)\stringp.obj - # # MACRO.LIB rules # @@ -626,7 +574,6 @@ all: zot \ $(HARBOUR_EXE) \ $(VM_LIB) \ $(RTL_LIB) \ - $(TOOLS_LIB) \ $(MACRO_LIB) \ $(DEBUG_LIB) \ $(LANG_LIB) \ @@ -659,7 +606,6 @@ all: \ $(HARBOUR_EXE) \ $(VM_LIB) \ $(RTL_LIB) \ - $(TOOLS_LIB) \ $(MACRO_LIB) \ $(DEBUG_LIB) \ $(LANG_LIB) \ @@ -687,9 +633,9 @@ $(HBPP_EXE) : \ $(HBRUN_EXE) : \ $(HBRUN_DIR)\hbrun.prg \ - $(HBRUN_DIR)\exttools.prg + $(HBRUN_DIR)\external.prg $(HARBOUR_EXE) $(HARBOURFLAGS) -o$(OBJ_DIR)\ $** - $(CC) $(CFLAGS) -Fo$(OBJ_DIR)\ $(OBJ_DIR)\hbrun.c $(OBJ_DIR)\exttools.c -o $(HBRUN_EXE) /link $(LDFLAGS) $(LIBS2) + $(CC) $(CFLAGS) -Fo$(OBJ_DIR)\ $(OBJ_DIR)\hbrun.c $(OBJ_DIR)\external.c -o $(HBRUN_EXE) /link $(LDFLAGS) $(LIBS2) # # HBTEST.EXE rules @@ -793,9 +739,6 @@ $(DBFNTX_LIB) : $(DBFNTX_LIB_OBJS) $(NULSYS_LIB) : $(NULSYS_LIB_OBJS) lib /out:$@ $** -$(TOOLS_LIB) : $(TOOLS_LIB_OBJS) - lib /out:$@ $** - $(VM_LIB) : $(VM_LIB_OBJS) lib /out:$@ $** @@ -848,7 +791,6 @@ $(RDD_LIB)2 : $(RDD_LIB_OBJS) $(DBFCDX_LIB)2 : $(DBFCDX_LIB_OBJS) $(DBFNTX_LIB)2 : $(DBFNTX_LIB_OBJS) $(NULSYS_LIB)2 : $(NULSYS_LIB_OBJS) -$(TOOLS_LIB)2 : $(TOOLS_LIB_OBJS) $(VM_LIB)2 : $(VM_LIB_OBJS) $(GTPCA_LIB)2 : $(GTPCA_LIB_OBJS) $(GTSTD_LIB)2 : $(GTSTD_LIB_OBJS) diff --git a/harbour/source/Makefile b/harbour/source/Makefile index 924a4d1d3b..a52722fed6 100644 --- a/harbour/source/Makefile +++ b/harbour/source/Makefile @@ -14,6 +14,5 @@ DIRS=\ lang \ rdd \ debug \ - tools \ include $(ROOT)config/dir.cf diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 3f2ed630da..4852a9793c 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -361,11 +361,9 @@ void hb_vmQuit( void ) void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) { - BYTE bCode; LONG w = 0; BOOL bCanRecover = FALSE; ULONG ulPrivateBase; - LONG lOffset; HB_TRACE(HB_TR_DEBUG, ("hb_vmExecute(%p, %p)", pCode, pSymbols)); @@ -377,9 +375,9 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) /* NOTE: Initialization with 0 is needed to avoid GCC -O2 warning */ ulPrivateBase = pSymbols ? hb_memvarGetPrivatesBase() : 0; - while( ( bCode = pCode[ w ] ) != HB_P_ENDPROC ) + while( pCode[ w ] != HB_P_ENDPROC ) { - switch( bCode ) + switch( pCode[ w ] ) { /* Operators ( mathematical / character / misc ) */ @@ -613,6 +611,7 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) /* BEGIN SEQUENCE/RECOVER/END SEQUENCE */ case HB_P_SEQBEGIN: + { /* * Create the SEQUENCE envelope * [ break return value ] -4 @@ -630,12 +629,7 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) * 2) store the address of RECOVER or END opcode */ hb_stack.pPos->type = HB_IT_LONG; - - lOffset = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) + ( pCode[ w + 3 ] * 65536 ); - if ( lOffset > 8388607L ) - lOffset = ( lOffset - 16777216 ); - - hb_stack.pPos->item.asLong.value = w + lOffset; + hb_stack.pPos->item.asLong.value = w + ( long ) ( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) + ( pCode[ w + 3 ] * 65536 ) ); hb_stackPush(); /* * 3) store current RECOVER base @@ -660,8 +654,10 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) bCanRecover = TRUE; w += 4; break; + } case HB_P_SEQEND: + { /* * Remove the SEQUENCE envelope * This is executed either at the end of sequence or as the @@ -691,12 +687,9 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) /* * skip outside of SEQUENCE structure */ - lOffset = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) + ( pCode[ w + 3 ] * 65536 ); - if ( lOffset > 8388607L ) - lOffset = ( lOffset - 16777216 ); - - w += lOffset; + w += ( long ) ( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) + ( pCode[ w + 3 ] * 65536 ) ); break; + } case HB_P_SEQRECOVER: /* @@ -729,122 +722,55 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) /* Jumps */ case HB_P_JUMPSHORT: - - lOffset = pCode[ w + 1 ]; - if ( lOffset > 127 ) - lOffset -= 256 ; - /* - if( lOffset ) - w += lOffset; - else - w += 2; - */ - w += lOffset; + w += ( char ) pCode[ w + 1 ]; break; case HB_P_JUMP: - - lOffset = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); - if ( lOffset > SHRT_MAX ) - lOffset -= 65536; - /* - if( lOffset ) - w += lOffset; - else - w += 3; - */ - w += lOffset; + w += ( long ) ( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); break; case HB_P_JUMPFAR: - lOffset = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) + ( pCode[ w + 3 ] * 65536 ); - if ( lOffset > 8388607L ) - lOffset -= 16777216L; - - /* - if( lOffset ) - w += lOffset; - else - w += 4; - */ - - w += lOffset; + w += ( long ) ( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) + ( pCode[ w + 3 ] * 65536 ) ); break; case HB_P_JUMPSHORTFALSE: - if( ! hb_vmPopLogical() ) - { - lOffset = pCode[ w + 1 ]; - if ( lOffset > 127 ) - lOffset -= 256; - - w += lOffset; - } - else + if( hb_vmPopLogical() ) w += 2; + else + w += ( char ) pCode[ w + 1 ]; break; case HB_P_JUMPFALSE: - if( ! hb_vmPopLogical() ) - { - lOffset = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); - if ( lOffset > SHRT_MAX ) - lOffset -= 65536; - - w += lOffset; - } - else + if( hb_vmPopLogical() ) w += 3; + else + w += ( long ) ( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); break; case HB_P_JUMPFARFALSE: - if( ! hb_vmPopLogical() ) - { - lOffset = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) + ( pCode[ w + 3 ] * 65536 ); - if ( lOffset > 8388607L ) - lOffset -= 16777216L; - - w += lOffset; - } - else + if( hb_vmPopLogical() ) w += 4; + else + w += ( long ) ( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) + ( pCode[ w + 3 ] * 65536 ) ); break; case HB_P_JUMPSHORTTRUE: if( hb_vmPopLogical() ) - { - lOffset = pCode[ w + 1 ]; - if ( lOffset > 127 ) - lOffset -= 256; - - w += lOffset; - } + w += ( char ) pCode[ w + 1 ]; else w += 2; break; case HB_P_JUMPTRUE: if( hb_vmPopLogical() ) - { - lOffset = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); - if ( lOffset > SHRT_MAX ) - lOffset -= 65536; - - w += lOffset; - } + w += ( long ) ( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); else w += 3; break; case HB_P_JUMPFARTRUE: if( hb_vmPopLogical() ) - { - lOffset = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) + ( pCode[ w + 3 ] * 65536 ); - if ( lOffset > 8388607L ) - lOffset -= 16777216L; - - w += lOffset; - } + w += ( long ) ( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) + ( pCode[ w + 3 ] * 65536 ) ); else w += 4; break; @@ -852,12 +778,16 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) /* Push */ case HB_P_TRUE: - hb_vmPushLogical( TRUE ); + hb_stack.pPos->type = HB_IT_LOGICAL; + hb_stack.pPos->item.asLogical.value = TRUE; + hb_stackPush(); w++; break; case HB_P_FALSE: - hb_vmPushLogical( FALSE ); + hb_stack.pPos->type = HB_IT_LOGICAL; + hb_stack.pPos->item.asLogical.value = FALSE; + hb_stackPush(); w++; break; @@ -915,12 +845,12 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) break; case HB_P_PUSHSTR: - { - USHORT uiSize = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); - hb_vmPushString( ( char * ) pCode + w + 3, ( ULONG ) uiSize ); - w += ( 3 + uiSize ); - } + { + USHORT uiSize = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); + hb_vmPushString( ( char * ) pCode + w + 3, ( ULONG ) uiSize ); + w += ( 3 + uiSize ); break; + } case HB_P_PUSHSTRSHORT: hb_vmPushString( ( char * ) pCode + w + 2, ( ULONG ) pCode[ w + 1 ] ); @@ -934,7 +864,7 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) * +5 +6 -> number of referenced local variables * +7 -> start of table with referenced local variables */ - hb_vmPushBlock( pCode + w, pSymbols ); + hb_vmPushBlock( ( BYTE * ) ( pCode + w ), pSymbols ); w += ( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); break; @@ -1157,133 +1087,134 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) /* macro compiled opcodes - we are using symbol address here */ case HB_P_MMESSAGE: - { - HB_DYNS_PTR *pDynSym = ( HB_DYNS_PTR *) ( pCode + w + 1 ); - hb_vmMessage( ( *pDynSym )->pSymbol ); - w += sizeof( HB_DYNS_PTR ) + 1; - } + { + HB_DYNS_PTR * pDynSym = ( HB_DYNS_PTR * ) ( pCode + w + 1 ); + hb_vmMessage( ( *pDynSym )->pSymbol ); + w += sizeof( HB_DYNS_PTR ) + 1; break; + } case HB_P_MPOPALIASEDFIELD: - { - HB_DYNS_PTR *pDynSym = ( HB_DYNS_PTR *) ( pCode + w + 1 ); - hb_vmPopAliasedField( ( *pDynSym )->pSymbol ); - w += sizeof( HB_DYNS_PTR ) + 1; - } + { + HB_DYNS_PTR * pDynSym = ( HB_DYNS_PTR * ) ( pCode + w + 1 ); + hb_vmPopAliasedField( ( *pDynSym )->pSymbol ); + w += sizeof( HB_DYNS_PTR ) + 1; break; + } case HB_P_MPOPALIASEDVAR: - { - HB_DYNS_PTR *pDynSym = ( HB_DYNS_PTR *) ( pCode + w + 1 ); - hb_vmPopAliasedVar( ( *pDynSym )->pSymbol ); - w += sizeof( HB_DYNS_PTR ) + 1; - } + { + HB_DYNS_PTR * pDynSym = ( HB_DYNS_PTR * ) ( pCode + w + 1 ); + hb_vmPopAliasedVar( ( *pDynSym )->pSymbol ); + w += sizeof( HB_DYNS_PTR ) + 1; break; + } case HB_P_MPOPFIELD: - { - HB_DYNS_PTR *pDynSym = ( HB_DYNS_PTR *) ( pCode + w + 1 ); - /* Pops a value from the eval stack and uses it to set - * a new value of the given field - */ - hb_stackDec(); - hb_rddPutFieldValue( hb_stack.pPos, ( *pDynSym )->pSymbol ); - hb_itemClear( hb_stack.pPos ); - HB_TRACE(HB_TR_INFO, ("(hb_vmMPopField)")); - w += sizeof( HB_DYNS_PTR ) + 1; - } + { + HB_DYNS_PTR * pDynSym = ( HB_DYNS_PTR * ) ( pCode + w + 1 ); + /* Pops a value from the eval stack and uses it to set + * a new value of the given field + */ + hb_stackDec(); + hb_rddPutFieldValue( hb_stack.pPos, ( *pDynSym )->pSymbol ); + hb_itemClear( hb_stack.pPos ); + HB_TRACE(HB_TR_INFO, ("(hb_vmMPopField)")); + w += sizeof( HB_DYNS_PTR ) + 1; break; + } case HB_P_MPOPMEMVAR: - { - HB_DYNS_PTR *pDynSym = ( HB_DYNS_PTR *) ( pCode + w + 1 ); - hb_stackDec(); - hb_memvarSetValue( ( *pDynSym )->pSymbol, hb_stack.pPos ); - hb_itemClear( hb_stack.pPos ); - HB_TRACE(HB_TR_INFO, ("(hb_vmMPopMemvar)")); - w += sizeof( HB_DYNS_PTR ) + 1; - } + { + HB_DYNS_PTR * pDynSym = ( HB_DYNS_PTR * ) ( pCode + w + 1 ); + hb_stackDec(); + hb_memvarSetValue( ( *pDynSym )->pSymbol, hb_stack.pPos ); + hb_itemClear( hb_stack.pPos ); + HB_TRACE(HB_TR_INFO, ("(hb_vmMPopMemvar)")); + w += sizeof( HB_DYNS_PTR ) + 1; break; + } case HB_P_MPUSHALIASEDFIELD: - { - HB_DYNS_PTR *pDynSym = ( HB_DYNS_PTR *) ( pCode + w + 1 ); - hb_vmPushAliasedField( ( *pDynSym )->pSymbol ); - w += sizeof( HB_DYNS_PTR ) + 1; - } + { + HB_DYNS_PTR * pDynSym = ( HB_DYNS_PTR * ) ( pCode + w + 1 ); + hb_vmPushAliasedField( ( *pDynSym )->pSymbol ); + w += sizeof( HB_DYNS_PTR ) + 1; break; + } case HB_P_MPUSHALIASEDVAR: - { - HB_DYNS_PTR *pDynSym = ( HB_DYNS_PTR *) ( pCode + w + 1 ); - hb_vmPushAliasedVar( ( *pDynSym )->pSymbol ); - w += sizeof( HB_DYNS_PTR ) + 1; - } + { + HB_DYNS_PTR * pDynSym = ( HB_DYNS_PTR * ) ( pCode + w + 1 ); + hb_vmPushAliasedVar( ( *pDynSym )->pSymbol ); + w += sizeof( HB_DYNS_PTR ) + 1; break; + } case HB_P_MPUSHBLOCK: - { - /*NOTE: the pcode is stored in dynamically allocated memory - * We need to handle it with more care than compile-time - * codeblocks - */ - /* +0 -> _pushblock - * +1 +2 -> size of codeblock - * +3 +4 -> number of expected parameters - * +5 -> pcode bytes - */ - hb_vmPushMacroBlock( pCode + w, pSymbols ); - w += ( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); - } + { + /*NOTE: the pcode is stored in dynamically allocated memory + * We need to handle it with more care than compile-time + * codeblocks + */ + + /* +0 -> _pushblock + * +1 +2 -> size of codeblock + * +3 +4 -> number of expected parameters + * +5 -> pcode bytes + */ + hb_vmPushMacroBlock( ( BYTE * ) ( pCode + w ), pSymbols ); + w += ( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); break; + } case HB_P_MPUSHFIELD: - { - HB_DYNS_PTR *pDynSym = ( HB_DYNS_PTR *) ( pCode + w + 1 ); - /* It pushes the current value of the given field onto the eval stack - */ - hb_rddGetFieldValue( hb_stack.pPos, ( *pDynSym )->pSymbol ); - hb_stackPush(); - HB_TRACE(HB_TR_INFO, ("(hb_vmMPushField)")); - w += sizeof( HB_DYNS_PTR ) + 1; - } + { + HB_DYNS_PTR * pDynSym = ( HB_DYNS_PTR * ) ( pCode + w + 1 ); + /* It pushes the current value of the given field onto the eval stack + */ + hb_rddGetFieldValue( hb_stack.pPos, ( *pDynSym )->pSymbol ); + hb_stackPush(); + HB_TRACE(HB_TR_INFO, ("(hb_vmMPushField)")); + w += sizeof( HB_DYNS_PTR ) + 1; break; + } case HB_P_MPUSHMEMVAR: - { - HB_DYNS_PTR *pDynSym = ( HB_DYNS_PTR *) ( pCode + w + 1 ); - hb_memvarGetValue( hb_stack.pPos, ( *pDynSym )->pSymbol ); - hb_stackPush(); - HB_TRACE(HB_TR_INFO, ("(hb_vmMPushMemvar)")); - w += sizeof( HB_DYNS_PTR ) + 1; - } + { + HB_DYNS_PTR * pDynSym = ( HB_DYNS_PTR * ) ( pCode + w + 1 ); + hb_memvarGetValue( hb_stack.pPos, ( *pDynSym )->pSymbol ); + hb_stackPush(); + HB_TRACE(HB_TR_INFO, ("(hb_vmMPushMemvar)")); + w += sizeof( HB_DYNS_PTR ) + 1; break; + } case HB_P_MPUSHMEMVARREF: - { - HB_DYNS_PTR *pDynSym = ( HB_DYNS_PTR *) ( pCode + w + 1 ); - hb_memvarGetRefer( hb_stack.pPos, ( *pDynSym )->pSymbol ); - hb_stackPush(); - HB_TRACE(HB_TR_INFO, ("(hb_vmMPushMemvarRef)")); - w += sizeof( HB_DYNS_PTR ) + 1; - } + { + HB_DYNS_PTR * pDynSym = ( HB_DYNS_PTR * ) ( pCode + w + 1 ); + hb_memvarGetRefer( hb_stack.pPos, ( *pDynSym )->pSymbol ); + hb_stackPush(); + HB_TRACE(HB_TR_INFO, ("(hb_vmMPushMemvarRef)")); + w += sizeof( HB_DYNS_PTR ) + 1; break; + } case HB_P_MPUSHSYM: - { - HB_DYNS_PTR *pDynSym = ( HB_DYNS_PTR *) ( pCode + w + 1 ); - hb_vmPushSymbol( ( *pDynSym )->pSymbol ); - } + { + HB_DYNS_PTR * pDynSym = ( HB_DYNS_PTR * ) ( pCode + w + 1 ); + hb_vmPushSymbol( ( *pDynSym )->pSymbol ); w += sizeof( HB_DYNS_PTR ) + 1; break; + } case HB_P_MPUSHVARIABLE: - { - HB_DYNS_PTR *pDynSym = ( HB_DYNS_PTR *) ( pCode + w + 1 ); - hb_vmPushVariable( ( *pDynSym )->pSymbol ); - } + { + HB_DYNS_PTR * pDynSym = ( HB_DYNS_PTR * ) ( pCode + w + 1 ); + hb_vmPushVariable( ( *pDynSym )->pSymbol ); w += sizeof( HB_DYNS_PTR ) + 1; break; + } /* misc */ @@ -1316,7 +1247,7 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ) /* * reload the address of recovery code */ - w = ( USHORT ) hb_stack.pItems[ s_lRecoverBase + HB_RECOVER_ADDRESS ].item.asLong.value; + w = hb_stack.pItems[ s_lRecoverBase + HB_RECOVER_ADDRESS ].item.asLong.value; /* * leave the SEQUENCE envelope on the stack - it will * be popped either in RECOVER or END opcode diff --git a/harbour/tests/Makefile b/harbour/tests/Makefile index 4c3947959c..a7b2bc6f90 100644 --- a/harbour/tests/Makefile +++ b/harbour/tests/Makefile @@ -9,7 +9,6 @@ endif ROOT = ../ LIBS=\ - tools \ debug \ vm \ rtl \ diff --git a/harbour/utils/hbrun/Makefile b/harbour/utils/hbrun/Makefile index 0ca63bed9a..46ed2f9abc 100644 --- a/harbour/utils/hbrun/Makefile +++ b/harbour/utils/hbrun/Makefile @@ -15,7 +15,6 @@ PRG_SOURCES=\ PRG_MAIN=hbrun.prg LIBS=\ - tools \ debug \ vm \ rtl \ diff --git a/harbour/utils/hbrun/external.prg b/harbour/utils/hbrun/external.prg new file mode 100644 index 0000000000..a3eae5cf8d --- /dev/null +++ b/harbour/utils/hbrun/external.prg @@ -0,0 +1,39 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * The declarations for the functions/procedures not part of Harbour. + * + * Copyright 1999 Ryszard Glab + * 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 of the License, or + * (at your option) any later version, with one exception: + * + * The exception is that if you link the Harbour Runtime Library (HRL) + * and/or the Harbour Virtual Machine (HVM) 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 HRL + * and/or HVM code into it. + * + * 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 program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + * their web site at http://www.gnu.org/). + * + */ + +#include "hbsetup.ch" + +/* Fill it as needed */ + diff --git a/harbour/utils/hbrun/exttools.prg b/harbour/utils/hbrun/exttools.prg deleted file mode 100644 index 5e2cf77ba8..0000000000 --- a/harbour/utils/hbrun/exttools.prg +++ /dev/null @@ -1,218 +0,0 @@ -/* - * $Id$ - */ - -/* - * Harbour Project source code: - * The declarations for the functions/procedures defined in TOOLS. - * - * Copyright 1999 Ryszard Glab - * 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 of the License, or - * (at your option) any later version, with one exception: - * - * The exception is that if you link the Harbour Runtime Library (HRL) - * and/or the Harbour Virtual Machine (HVM) 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 HRL - * and/or HVM code into it. - * - * 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 program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at http://www.gnu.org/). - * - */ - -#include "hbsetup.ch" - -// Files from: tools -// -// -//symbols from file: tools\asciisum.c -// -EXTERNAL GT_ASCIISUM -// -//symbols from file: tools\ascpos.c -// -EXTERNAL GT_ASCPOS -// -//symbols from file: tools\atdiff.c -// -EXTERNAL GT_ATDIFF -// -//symbols from file: tools\chareven.c -// -EXTERNAL GT_CHAREVEN -// -//symbols from file: tools\charmix.c -// -EXTERNAL GT_CHARMIX -// -//symbols from file: tools\charodd.c -// -EXTERNAL GT_CHARODD -// -//symbols from file: tools\chrcount.c -// -EXTERNAL GT_CHRCOUNT -// -//symbols from file: tools\chrfirst.c -// -EXTERNAL GT_CHRFIRST -// -//symbols from file: tools\chrtotal.c -// -EXTERNAL GT_CHRTOTAL -// -//symbols from file: tools\ctchksum.c -// -EXTERNAL CT_CHECKSUM -// -//symbols from file: tools\ctchrmix.c -// -EXTERNAL CT_CHARMIX -// -//symbols from file: tools\ctcrypt.c -// -EXTERNAL CT_CRYPT -// -//symbols from file: tools\dates2.c -// -EXTERNAL AMONTHS -EXTERNAL ADAYS -EXTERNAL ISLEAPYEAR -EXTERNAL DAYSINMONTH -EXTERNAL EOM -EXTERNAL BOM -EXTERNAL WOM -EXTERNAL DOY -EXTERNAL WOY -EXTERNAL EOY -EXTERNAL BOY -EXTERNAL DATETIME -// -//symbols from file: tools\dbftools.c -// -EXTERNAL FIELDTYPE -EXTERNAL FIELDSIZE -EXTERNAL FIELDDECI -// -//symbols from file: tools\hb_f.c -// -EXTERNAL HB_FUSE -EXTERNAL HB_FRECNO -EXTERNAL HB_FSKIP -EXTERNAL HB_FREADLN -EXTERNAL HB_FEOF -EXTERNAL HB_FGOTO -EXTERNAL HB_FGOBOTTOM -EXTERNAL HB_FGOTOP -EXTERNAL HB_FLASTREC -EXTERNAL HB_FSELECT -// -//symbols from file: tools\mathx.c -// -EXTERNAL ACOS -EXTERNAL ASIN -EXTERNAL ATAN -EXTERNAL COS -EXTERNAL COSH -EXTERNAL LOG10 -EXTERNAL SIN -EXTERNAL SINH -EXTERNAL TAN -EXTERNAL TANH -EXTERNAL PI -// -//symbols from file: tools\strcount.c -// -EXTERNAL GT_STRCOUNT -// -//symbols from file: tools\strcspn.c -// -EXTERNAL GT_STRCSPN -// -//symbols from file: tools\strdiff.c -// -EXTERNAL GT_STRDIFF -// -//symbols from file: tools\strexpan.c -// -EXTERNAL GT_STREXPAND -// -//symbols from file: tools\strfmt.c -// -EXTERNAL STRFORMAT -// -//symbols from file: tools\stringsx.c -// -EXTERNAL STRTOKEN -EXTERNAL STRDUMP -EXTERNAL ROT13 -// -//symbols from file: tools\strleft.c -// -EXTERNAL GT_STRLEFT -// -//symbols from file: tools\strpbrk.c -// -EXTERNAL GT_STRPBRK -// -//symbols from file: tools\strright.c -// -EXTERNAL GT_STRRIGHT -// -//symbols from file: tools\fileread.prg -// -EXTERNAL TFILEREAD -// -//symbols from file: tools\nconvert.prg -// -EXTERNAL ISBIN -EXTERNAL ISOCTAL -EXTERNAL ISDEC -EXTERNAL ISHEXA -EXTERNAL DECTOBIN -EXTERNAL DECTOOCTAL -EXTERNAL DECTOHEXA -EXTERNAL BINTODEC -EXTERNAL OCTALTODEC -EXTERNAL HEXATODEC -// -//symbols from file: tools\numtxten.prg -// -EXTERNAL NUMTOTXTEN -// -//symbols from file: tools\numtxthu.prg -// -EXTERNAL NUMTOTXTHU -// -//symbols from file: tools\stringp.prg -// -EXTERNAL DEFAULT -EXTERNAL TOCHAR -EXTERNAL DEBUG - -EXTERNAL CT_COLORTON -EXTERNAL CT_CENTER -EXTERNAL CT_CSETCURS -EXTERNAL CT_CSETKEY -EXTERNAL CT_ENHANCED -EXTERNAL CT_STANDARD -EXTERNAL CT_LTOC -EXTERNAL CT_RESTGETS -EXTERNAL CT_SAVEGETS -EXTERNAL CT_SCREENMIX -EXTERNAL CT_POSUPPER -EXTERNAL CT_NUMTOKEN -EXTERNAL CT_TOKEN