2004-10-11 21:40 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/Makefile
  + harbour/make_bsd.sh
  + harbour/make_drw.sh
  * harbour/make_tgz.sh
  + harbour/bin/hb-func.sh
  * harbour/bin/pack_src.sh
  + harbour/bin/postinst.bat
  + harbour/bin/postinst.sh
  * harbour/config/dir.cf
  * harbour/config/bsd/gcc.cf
  * harbour/config/bsd/global.cf
  + harbour/config/darwin/dir.cf
  + harbour/config/darwin/gcc.cf
  + harbour/config/darwin/global.cf
  + harbour/config/darwin/install.cf
  * harbour/config/dos/dir.cf
  * harbour/config/dos/global.cf
  * harbour/config/dos/install.cf
  * harbour/config/dos/owatcom.cf
  * harbour/config/dos/watcom.cf
  * harbour/config/linux/gcc.cf
  * harbour/config/linux/global.cf
  * harbour/contrib/Makefile
  * harbour/contrib/dot/pp_harb.ch
  * harbour/contrib/libct/Makefile
  * harbour/contrib/libct/bit1.c
  * harbour/contrib/libct/bit2.c
  * harbour/contrib/libct/bit3.c
  * harbour/contrib/libct/files.c
  * harbour/contrib/libct/ftoc.c
  - harbour/contrib/libct/invertwin.prg
  + harbour/contrib/libct/invrtwin.prg
  * harbour/contrib/libct/keyset.c
  * harbour/contrib/libct/makefile.bc
  * harbour/contrib/libmisc/dates2.c
  * harbour/contrib/rdd_ads/ads1.c
  * harbour/contrib/rdd_ads/adsfunc.c
  * harbour/contrib/samples/date.c
  * harbour/include/dbinfo.ch
  * harbour/include/hbapi.h
  * harbour/include/hbapicdp.h
  * harbour/include/hbapifs.h
  * harbour/include/hbapigt.h
  * harbour/include/hbapiitm.h
  * harbour/include/hbcomp.h
  * harbour/include/hbdate.h
  * harbour/include/hbdbf.h
  * harbour/include/hbdbferr.h
  * harbour/include/hbdefs.h
  * harbour/include/hbexprb.c
  * harbour/include/hbexprc.c
  * harbour/include/hbexprop.h
  * harbour/include/hbmacro.h
  * harbour/include/hbmath.h
  * harbour/include/hbpcode.h
  * harbour/include/hbrddcdx.h
  * harbour/include/hbrdddbf.h
  * harbour/include/hbrdddbt.h
  * harbour/include/hbrddfpt.h
  * harbour/include/hbrddntx.h
  * harbour/include/hbset.h
  * harbour/include/hbsetup.h
  * harbour/include/set.ch
  * harbour/source/common/Makefile
  * harbour/source/common/expropt1.c
  * harbour/source/common/expropt2.c
  - harbour/source/common/hbffind.c
  * harbour/source/common/hbfsapi.c
  * harbour/source/common/hbstr.c
  * harbour/source/common/hbver.c
  + harbour/source/common/hbverdsp.c
  * harbour/source/compiler/genc.c
  * harbour/source/compiler/gencli.c
  * harbour/source/compiler/harbour.c
  * harbour/source/compiler/harbour.l
  * harbour/source/compiler/harbour.slx
  * harbour/source/compiler/harbour.sly
  * harbour/source/compiler/harbour.y
  * harbour/source/compiler/hbfix.c
  * harbour/source/compiler/hbpcode.c
  * harbour/source/compiler/hbusage.c
  * harbour/source/compiler/simplex.c
  * harbour/source/macro/macro.l
  * harbour/source/macro/macro.slx
  * harbour/source/macro/macro.y
  * harbour/source/pp/ppcore.c
  * harbour/source/rdd/dbcmd.c
  * harbour/source/rdd/dbf1.c
  * harbour/source/rdd/dbfcdx/dbfcdx1.c
  - harbour/source/rdd/dbfcdx/dbfcdx1.h
  * harbour/source/rdd/dbffpt/dbffpt1.c
  * harbour/source/rdd/dbfntx/dbfntx1.c
  * harbour/source/rtl/Makefile
  * harbour/source/rtl/abs.c
  * harbour/source/rtl/at.c
  * harbour/source/rtl/datec.c
  * harbour/source/rtl/dates.c
  * harbour/source/rtl/dateshb.c
  * harbour/source/rtl/datesx.c
  * harbour/source/rtl/empty.c
  * harbour/source/rtl/errorapi.c
  * harbour/source/rtl/errorint.c
  * harbour/source/rtl/filesys.c
  * harbour/source/rtl/fstemp.c
  + harbour/source/rtl/hbffind.c
  * harbour/source/rtl/hbrandom.c
  * harbour/source/rtl/idle.c
  * harbour/source/rtl/inkey.c
  * harbour/source/rtl/math.c
  * harbour/source/rtl/minmax.c
  * harbour/source/rtl/pad.c
  * harbour/source/rtl/padc.c
  * harbour/source/rtl/padl.c
  * harbour/source/rtl/padr.c
  * harbour/source/rtl/philes.c
  * harbour/source/rtl/round.c
  * harbour/source/rtl/soundex.c
  * harbour/source/rtl/str.c
  * harbour/source/rtl/strcase.c
  * harbour/source/rtl/strmatch.c
  * harbour/source/rtl/strtran.c
  * harbour/source/rtl/strzero.c
  * harbour/source/rtl/substr.c
  * harbour/source/rtl/val.c
  * harbour/source/rtl/gtcrs/gtcrs.c
  * harbour/source/rtl/gtcrs/kbdcrs.c
  * harbour/source/rtl/gtdos/gtdos.c
  * harbour/source/rtl/gtsln/gtsln.c
  * harbour/source/rtl/gtsln/kbsln.c
  * harbour/source/rtl/gtsln/keytrans.c
  * harbour/source/vm/arrays.c
  * harbour/source/vm/codebloc.c
  * harbour/source/vm/estack.c
  * harbour/source/vm/eval.c
  * harbour/source/vm/extend.c
  * harbour/source/vm/hvm.c
  * harbour/source/vm/itemapi.c
  * harbour/source/vm/macro.c
  * harbour/source/vm/memvars.c
  * harbour/source/vm/runner.c
  * harbour/tests/bldtest/bldtest.c
  * harbour/utils/hbtest/hbtest.prg
  * harbour/utils/hbtest/rt_misc.prg
  * harbour/utils/hbtest/rt_str.prg
   * Sorry but it's too much modification for full description
     cvs diff gives file 785982 bytes length. So I only count the
     main things:
   ! cleand the code (no more warning messages under Linux and GCC and
     DOS OpenWatcom) - some of them were real bugs
   ! cleaned all endian dependend code I've found - now Harbour can be
     compiled on LITLE and BIG endian machines - for some other like
     PDP ENDIAN it's enough to define proper macros in hbdefs.h
   + added macros for to get/put values in chosen byte order:
         HB_GET_LE_[U]INT{16,24,32,64}( pPtr )
         HB_GET_BE_[U]INT{16,24,32,64}( pPtr )
         HB_PUT_LE_[U]INT{16,24,32,64}( pPtr, nVal )
         HB_PUT_BE_[U]INT{16,24,32,64}( pPtr, nVal )
   + added macro HB_CAST_BYTE_NUMBERS_OFF which disables casting in
     HB_{GET|PUT}_{LE|BE}_* macros - it's necessary for some platforms
     like ALPHA DEC.
   ! cleaned the code for 64bit machines
   * changed all parameters in hb_date* functions (day, month, year, week)
     from LONG to int - it doesn't change binary compatibility for 32bit
     machines but can cause troubles with compiling the old source
   + changed HB_IT_LONG type to HB_LONG which is mapped to long long
     by default for 32 bit machines.
   + change HB_IT_INTEGER to be real 'int' C type not 'short int'
   + added HB_IS_NUMINT() macro
   + added hb_parnll, hb_stornll, hb_retnll, hbretnlllen, hb_itemPutNLL,
     hb_itemPutNLLLen, hb_itemGetNLL which operates on LONGLONG
   + added hb_parnint, hb_stornint, hb_retnint, hb_retnintlen,
     hb_itemPutNInt, hb_itemPutNIntLen, hb_itemGetNInt which operates on
     HB_LONG
   + added HB_PUSHLONGLONG pcode
   + changed compiler and optimizer to use HB_LONG numbers and reduce
     conversion from to double which may damage the 64bit number.
   + common functions for string to number conversions for compiler, RTL
     and RDD to reduce problems with differ FL values for the same number:
     hb_compStrToNum(), hb_valStrnToNum(), hb_strToNum(), hb_strnToNum()
   + common function hb_numRoun() which uses exactly the same algorithms
     as string to number conversion for the same reason - please keep
     this functions together.
   + hack inside hb_numRound() similar to the one used by CL5.3
   + hb_numInt() which uses uses the same hack as hb_numRound()
   + rewritten number to string conversion
   + some new string manipulation functions hb_strncpy(), hb_strncat(), ...
     They works differ the the C one - always set 0 at the end, the buffer
     has to be n+1 bytes length, the n is total size of buffer not the
     left free space.
   ! cleaned some code which operates on ASCIIZ string to avoid potential
     buffer overflow
   + updated RDD code - it's the first part - in few days I plan to change
     workarea structure in both projects - it will break any 3rd party RDDs
     so they have to be updated. I want to add SUPERTABLE into workarea
     to allow creating new RDD on-line.
   ! cleaned the bugs with negating integers - on most machines (like x86)
     the integers are not 0 symmetric - it means that x = -x does not work
     for {INT,LONG,LONGLONG}_MIN (hb_vmNegate, ABS())
   + cleaned error messages to be Clipper compatible.
   + updated build process for .DEB packages - now hb* scripts and shared
     libs are created by standard make install
   * added new .prg #defines: __PLATFORM__<cPlatfrom>,
     __ARCH{16|32|64}BIT__, __LITTLE_ENDIAN__|__BIG_ENDIAN__|__PDP_ENDIAN__
     !!! cPlatfrom can have lower letters (for xHarbour compatibility)
     If you do not like it please change it.
   * others ...
This commit is contained in:
Przemyslaw Czerpak
2004-10-11 20:44:30 +00:00
parent b359072842
commit ef0883bf02
143 changed files with 9765 additions and 5765 deletions

View File

@@ -8,6 +8,214 @@
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2004-10-11 21:40 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/Makefile
+ harbour/make_bsd.sh
+ harbour/make_drw.sh
* harbour/make_tgz.sh
+ harbour/bin/hb-func.sh
* harbour/bin/pack_src.sh
+ harbour/bin/postinst.bat
+ harbour/bin/postinst.sh
* harbour/config/dir.cf
* harbour/config/bsd/gcc.cf
* harbour/config/bsd/global.cf
+ harbour/config/darwin/dir.cf
+ harbour/config/darwin/gcc.cf
+ harbour/config/darwin/global.cf
+ harbour/config/darwin/install.cf
* harbour/config/dos/dir.cf
* harbour/config/dos/global.cf
* harbour/config/dos/install.cf
* harbour/config/dos/owatcom.cf
* harbour/config/dos/watcom.cf
* harbour/config/linux/gcc.cf
* harbour/config/linux/global.cf
* harbour/contrib/Makefile
* harbour/contrib/dot/pp_harb.ch
* harbour/contrib/libct/Makefile
* harbour/contrib/libct/bit1.c
* harbour/contrib/libct/bit2.c
* harbour/contrib/libct/bit3.c
* harbour/contrib/libct/files.c
* harbour/contrib/libct/ftoc.c
- harbour/contrib/libct/invertwin.prg
+ harbour/contrib/libct/invrtwin.prg
* harbour/contrib/libct/keyset.c
* harbour/contrib/libct/makefile.bc
* harbour/contrib/libmisc/dates2.c
* harbour/contrib/rdd_ads/ads1.c
* harbour/contrib/rdd_ads/adsfunc.c
* harbour/contrib/samples/date.c
* harbour/include/dbinfo.ch
* harbour/include/hbapi.h
* harbour/include/hbapicdp.h
* harbour/include/hbapifs.h
* harbour/include/hbapigt.h
* harbour/include/hbapiitm.h
* harbour/include/hbcomp.h
* harbour/include/hbdate.h
* harbour/include/hbdbf.h
* harbour/include/hbdbferr.h
* harbour/include/hbdefs.h
* harbour/include/hbexprb.c
* harbour/include/hbexprc.c
* harbour/include/hbexprop.h
* harbour/include/hbmacro.h
* harbour/include/hbmath.h
* harbour/include/hbpcode.h
* harbour/include/hbrddcdx.h
* harbour/include/hbrdddbf.h
* harbour/include/hbrdddbt.h
* harbour/include/hbrddfpt.h
* harbour/include/hbrddntx.h
* harbour/include/hbset.h
* harbour/include/hbsetup.h
* harbour/include/set.ch
* harbour/source/common/Makefile
* harbour/source/common/expropt1.c
* harbour/source/common/expropt2.c
- harbour/source/common/hbffind.c
* harbour/source/common/hbfsapi.c
* harbour/source/common/hbstr.c
* harbour/source/common/hbver.c
+ harbour/source/common/hbverdsp.c
* harbour/source/compiler/genc.c
* harbour/source/compiler/gencli.c
* harbour/source/compiler/harbour.c
* harbour/source/compiler/harbour.l
* harbour/source/compiler/harbour.slx
* harbour/source/compiler/harbour.sly
* harbour/source/compiler/harbour.y
* harbour/source/compiler/hbfix.c
* harbour/source/compiler/hbpcode.c
* harbour/source/compiler/hbusage.c
* harbour/source/compiler/simplex.c
* harbour/source/macro/macro.l
* harbour/source/macro/macro.slx
* harbour/source/macro/macro.y
* harbour/source/pp/ppcore.c
* harbour/source/rdd/dbcmd.c
* harbour/source/rdd/dbf1.c
* harbour/source/rdd/dbfcdx/dbfcdx1.c
- harbour/source/rdd/dbfcdx/dbfcdx1.h
* harbour/source/rdd/dbffpt/dbffpt1.c
* harbour/source/rdd/dbfntx/dbfntx1.c
* harbour/source/rtl/Makefile
* harbour/source/rtl/abs.c
* harbour/source/rtl/at.c
* harbour/source/rtl/datec.c
* harbour/source/rtl/dates.c
* harbour/source/rtl/dateshb.c
* harbour/source/rtl/datesx.c
* harbour/source/rtl/empty.c
* harbour/source/rtl/errorapi.c
* harbour/source/rtl/errorint.c
* harbour/source/rtl/filesys.c
* harbour/source/rtl/fstemp.c
+ harbour/source/rtl/hbffind.c
* harbour/source/rtl/hbrandom.c
* harbour/source/rtl/idle.c
* harbour/source/rtl/inkey.c
* harbour/source/rtl/math.c
* harbour/source/rtl/minmax.c
* harbour/source/rtl/pad.c
* harbour/source/rtl/padc.c
* harbour/source/rtl/padl.c
* harbour/source/rtl/padr.c
* harbour/source/rtl/philes.c
* harbour/source/rtl/round.c
* harbour/source/rtl/soundex.c
* harbour/source/rtl/str.c
* harbour/source/rtl/strcase.c
* harbour/source/rtl/strmatch.c
* harbour/source/rtl/strtran.c
* harbour/source/rtl/strzero.c
* harbour/source/rtl/substr.c
* harbour/source/rtl/val.c
* harbour/source/rtl/gtcrs/gtcrs.c
* harbour/source/rtl/gtcrs/kbdcrs.c
* harbour/source/rtl/gtdos/gtdos.c
* harbour/source/rtl/gtsln/gtsln.c
* harbour/source/rtl/gtsln/kbsln.c
* harbour/source/rtl/gtsln/keytrans.c
* harbour/source/vm/arrays.c
* harbour/source/vm/codebloc.c
* harbour/source/vm/estack.c
* harbour/source/vm/eval.c
* harbour/source/vm/extend.c
* harbour/source/vm/hvm.c
* harbour/source/vm/itemapi.c
* harbour/source/vm/macro.c
* harbour/source/vm/memvars.c
* harbour/source/vm/runner.c
* harbour/tests/bldtest/bldtest.c
* harbour/utils/hbtest/hbtest.prg
* harbour/utils/hbtest/rt_misc.prg
* harbour/utils/hbtest/rt_str.prg
* Sorry but it's too much modification for full description
cvs diff gives file 785982 bytes length. So I only count the
main things:
! cleand the code (no more warning messages under Linux and GCC and
DOS OpenWatcom) - some of them were real bugs
! cleaned all endian dependend code I've found - now Harbour can be
compiled on LITLE and BIG endian machines - for some other like
PDP ENDIAN it's enough to define proper macros in hbdefs.h
+ added macros for to get/put values in chosen byte order:
HB_GET_LE_[U]INT{16,24,32,64}( pPtr )
HB_GET_BE_[U]INT{16,24,32,64}( pPtr )
HB_PUT_LE_[U]INT{16,24,32,64}( pPtr, nVal )
HB_PUT_BE_[U]INT{16,24,32,64}( pPtr, nVal )
+ added macro HB_CAST_BYTE_NUMBERS_OFF which disables casting in
HB_{GET|PUT}_{LE|BE}_* macros - it's necessary for some platforms
like ALPHA DEC.
! cleaned the code for 64bit machines
* changed all parameters in hb_date* functions (day, month, year, week)
from LONG to int - it doesn't change binary compatibility for 32bit
machines but can cause troubles with compiling the old source
+ changed HB_IT_LONG type to HB_LONG which is mapped to long long
by default for 32 bit machines.
+ change HB_IT_INTEGER to be real 'int' C type not 'short int'
+ added HB_IS_NUMINT() macro
+ added hb_parnll, hb_stornll, hb_retnll, hbretnlllen, hb_itemPutNLL,
hb_itemPutNLLLen, hb_itemGetNLL which operates on LONGLONG
+ added hb_parnint, hb_stornint, hb_retnint, hb_retnintlen,
hb_itemPutNInt, hb_itemPutNIntLen, hb_itemGetNInt which operates on
HB_LONG
+ added HB_PUSHLONGLONG pcode
+ changed compiler and optimizer to use HB_LONG numbers and reduce
conversion from to double which may damage the 64bit number.
+ common functions for string to number conversions for compiler, RTL
and RDD to reduce problems with differ FL values for the same number:
hb_compStrToNum(), hb_valStrnToNum(), hb_strToNum(), hb_strnToNum()
+ common function hb_numRoun() which uses exactly the same algorithms
as string to number conversion for the same reason - please keep
this functions together.
+ hack inside hb_numRound() similar to the one used by CL5.3
+ hb_numInt() which uses uses the same hack as hb_numRound()
+ rewritten number to string conversion
+ some new string manipulation functions hb_strncpy(), hb_strncat(), ...
They works differ the the C one - always set 0 at the end, the buffer
has to be n+1 bytes length, the n is total size of buffer not the
left free space.
! cleaned some code which operates on ASCIIZ string to avoid potential
buffer overflow
+ updated RDD code - it's the first part - in few days I plan to change
workarea structure in both projects - it will break any 3rd party RDDs
so they have to be updated. I want to add SUPERTABLE into workarea
to allow creating new RDD on-line.
! cleaned the bugs with negating integers - on most machines (like x86)
the integers are not 0 symmetric - it means that x = -x does not work
for {INT,LONG,LONGLONG}_MIN (hb_vmNegate, ABS())
+ cleaned error messages to be Clipper compatible.
+ updated build process for .DEB packages - now hb* scripts and shared
libs are created by standard make install
* added new .prg #defines: __PLATFORM__<cPlatfrom>,
__ARCH{16|32|64}BIT__, __LITTLE_ENDIAN__|__BIG_ENDIAN__|__PDP_ENDIAN__
!!! cPlatfrom can have lower letters (for xHarbour compatibility)
If you do not like it please change it.
* others ...
2004-10-10 21:35 UTC+0300 Alexander Kresin <alex@belacy.belgorod.su>
* source/rdd/dbfntx/dbfntx1.c
! Fixed a bug, introduced in a last change.

View File

@@ -12,4 +12,25 @@ DIRS=\
contrib \
# samples \
ifeq ($(HB_POSTINST),)
ifneq ($(HB_ROOTPOSTINST),)
HB_POSTINST = $(HB_ROOTPOSTINST) $(HB_POSTINSTPARAM)
else
ifneq ($(SHLVL),)
HB_POSTINST = $(TOP)$(ROOT)bin/postinst.sh $(HB_POSTINSTPARAM)
else
ifeq ($(HB_ARCHITECTURE),dos)
HB_POSTINST = $(subst /,\,$(TOP)$(ROOT)bin/postinst.bat) $(HB_POSTINSTPARAM)
else
ifeq ($(HB_ARCHITECTURE),w32)
HB_POSTINST = $(subst /,\,$(TOP)$(ROOT)bin/postinst.bat) $(HB_POSTINSTPARAM)
endif
endif
endif
endif
endif
include $(ROOT)config/dir.cf

492
harbour/bin/hb-func.sh Normal file
View File

@@ -0,0 +1,492 @@
#!/bin/sh
[ "$BASH" ] || exec bash `which $0` ${1+"$@"}
#
# $Id$
#
# ---------------------------------------------------------------
# Copyright 2003 Przemyslaw Czerpak <druzus@priv.onet.pl>
# small set of functions used by Harbour scripts
# warnig: some bash extensions are used
#
# See doc/license.txt for licensing terms.
# ---------------------------------------------------------------
get_hbplatform()
{
local id
# please add your distro suffix if it not belong to the one recognized below
# and remember that order checking can be important
[ "${id}" = "" ] && id=`rel=$(rpm -q --queryformat='.%{VERSION}' mandrake-release 2>/dev/null) && echo "mdk$rel"|tr -d "."`
[ "${id}" = "" ] && id=`rel=$(rpm -q --queryformat='.%{VERSION}' redhat-release 2>/dev/null) && echo "rh$rel"|tr -d "."`
[ "${id}" = "" ] && id=`rel=$(rpm -q --queryformat='.%{VERSION}' fedora-release 2>/dev/null) && echo "fc$rel"|tr -d "."`
[ "${id}" = "" ] && id=`rel=$(rpm -q --queryformat='.%{VERSION}' suse-release 2>/dev/null) && echo "fc$rel"|tr -d "."`
[ "${id}" = "" ] && id=`rel=$(rpm -q --queryformat='.%{VERSION}' conectiva-release 2>/dev/null) && echo "cl$rel"|tr -d "."`
[ "${id}" = "" ] && id=`rel=$(rpm -q --queryformat='.%{VERSION}' aurox-release 2>/dev/null) && echo "cl$rel"|tr -d "."`
[ "${id}" = "" ] && id=`[ -f /etc/pld-release ] && cat /etc/pld-release|sed -e '/1/ !d' -e 's/[^0-9]//g' -e 's/^/pld/'`
echo -n "${id}"
}
get_hbver()
{
local FVER MAJOR MINOR REVIS hb_rootdir
hb_rootdir="${1-.}"
FVER="${hb_rootdir}/include/hbver.h"
MAJOR=`sed -e '/HB_VER_MAJOR/ s/[^0-9]*\([^ ]*\).*/\1/g p' -e 'd' "${FVER}"`
MINOR=`sed -e '/HB_VER_MINOR/ s/[^0-9]*\([^ ]*\).*/\1/g p' -e 'd' "${FVER}"`
REVIS=`sed -e '/HB_VER_REVISION/ s/[^0-9]*\([^ ]*\).*/\1/g p' -e 'd' "${FVER}"`
echo -n "${MAJOR}.${MINOR}.${REVIS}"
}
get_solibname()
{
local name
name="${HB_SHAREDLIB_NAME}"
[ -z "${name}" ] && name="harbour"
echo -n "${name}"
}
mk_hbgetlibs()
{
if [ -z "$@" ]
then
echo -n "vm pp rtl rdd dbfdbt dbffpt dbfcdx dbfntx ${HB_DB_DRVEXT} macro common lang codepage gtnul gtcrs gtsln gtxvt gtxwc gtalleg gtcgi gtstd gtpca gtwin gtwvt gtdos gtos2 debug profiler"
else
echo -n "$@"
fi
}
mk_hbgetlibsctb()
{
if [ -z "$@" ]
then
echo -n "ct rddads"
else
echo -n "$@"
fi
}
mk_hbtools()
{
local name hb_pref hb_tool hb_libs hb_libsc
name=`get_solibname`
hb_pref="$4"
[ -z "${hb_pref}" ] && hb_pref="${HB_TOOLS_PREF-hb}"
hb_cmpname="${HB_CMPNAME-harbour}"
if [ "${HB_ARCHITECTURE}" = "dos" ]; then
hb_tool="$1/${hb_pref}-bld"
else
hb_tool="$1/${hb_pref}-build"
fi
hb_libs=`mk_hbgetlibs "$2"`
hb_libsc=`mk_hbgetlibsctb "$3"`
[ -z "${HB_GT_LIB}" ] && HB_GT_LIB="gtstd"
[ -z "${_DEFAULT_BIN_DIR}" ] && _DEFAULT_BIN_DIR="${HB_BIN_INSTALL}"
[ -z "${_DEFAULT_INC_DIR}" ] && _DEFAULT_INC_DIR="${HB_INC_INSTALL}"
[ -z "${_DEFAULT_LIB_DIR}" ] && _DEFAULT_LIB_DIR="${HB_LIB_INSTALL}"
HB_SYS_LIBS="-lm"
HB_CRS_LIB=""
HB_SLN_LIB=""
if [ "${HB_COMPILER}" = "mingw32" ]; then
HB_SYS_LIBS="${HB_SYS_LIBS} -luser32 -lwinspool -lgdi32 -lcomctl32 -lcomdlg32 -lole32 -loleaut32 -luuid -lwsock32 -lws2_32"
elif [ "${HB_COMPILER}" = "djgpp" ]; then
HB_SYS_LIBS="${HB_SYS_LIBS}"
else
if [ "${HB_NCURSES_194}" = "yes" ]; then
HB_CRS_LIB="ncur194"
else
HB_CRS_LIB="ncurses"
fi
HB_SLN_LIB="slang"
fi
echo "Generating ${hb_tool}... "
cat > ${hb_tool} <<EOF
#!/bin/sh
[ "\$BASH" ] || exec bash \`which \$0\` \${1+"\$@"}
#
# ---------------------------------------------------------------
# Copyright 2003 Przemyslaw Czerpak <druzus@priv.onet.pl>
# simple script to build binaries .tgz from Harbour sources
#
# See doc/license.txt for licensing terms.
# ---------------------------------------------------------------
#
if [ \$# = 0 ]; then
echo "syntax: \$0 [<options,...>] <file>[.prg|.o]
\"${hb_pref}cc\", \"${hb_pref}cmp\", \"${hb_pref}lnk\" and \"${hb_pref}mk\" parameters:
-o<outputfilename> # output file name
\"${hb_pref}lnk\" and \"${hb_pref}mk\" parameters:
-static # link with static ${name} libs
-fullstatic # link with all static libs
-shared # link with shared libs (default)
-mt # link with multi-thread libs
-gt<hbgt> # link with <hbgt> GT driver, can be repeated to
# link with more GTs. The first one will be
# the default at runtime
-fmstat # link with the memory statistics lib
-nofmstat # do not link with the memory statistics lib (default)
-[no]strip # strip (no strip) binaries
-main=<main_func> # set the name of main program function/procedure.
# if not set then 'MAIN' is used or if it doesn't
# exist the name of first public function/procedure
# in first linked object module (link)
"
exit 1
elif [ "\$*" = "mk-links" ]; then
DIR="\${0%/*}"
NAME="\${0##*/}"
if [ "\${DIR}" != "\${NAME}" ]; then
(cd "\${DIR}"
for n in ${hb_pref}cc ${hb_pref}cmp ${hb_pref}mk ${hb_pref}lnk gharbour harbour-link; do
if [ "\${HB_ARCHITECTURE}" = "dos" ]; then
cp -f "\${NAME}" "\${n}"
else
ln -sf "\${NAME}" "\${n}"
fi
done
)
fi
exit
fi
## default parameters
HB_STATIC="no"
HB_MT=""
HB_GT="${HB_GT_LIB#gt}"
HB_MG="${HB_MULTI_GT}"
HB_GPM_MOUSE="${HB_GPM_MOUSE}"
HB_GT_REQ=""
HB_FM_REQ=""
HB_STRIP="yes"
HB_MAIN_FUNC=""
[ -n "\$TMPDIR" ] || TMPDIR="\$TMP"
[ -n "\$TMPDIR" ] || TMPDIR="\$TEMP"
[ -n "\$TMPDIR" ] || TMPDIR="/tmp"
_TMP_FILE_="\${TMPDIR}/hb-build-\$USER-\$\$.c"
## parse params
P=( "\$@" ); n=0; DIROUT="."; FILEOUT=""
while [ \$n -lt \${#P[@]} ]; do
v=\${P[\$n]}; p=""
case "\$v" in
-o*)
d="\${v#-o}"; p="\${v}"
if [ -d "\${d}" ]; then
DIROUT="\${d%/}"
elif [ -d "\${d%/*}" ]; then
DIROUT="\${d%/*}"; FILEOUT="\${d##*/}"; p="-o\${d%.*}"
elif [ -n "\${d}" ]; then
FILEOUT="\${d}"; p="-o\${d%.*}"
fi ;;
-static) HB_STATIC="yes" ;;
-fullstatic) HB_STATIC="full" ;;
-shared) HB_STATIC="no" ;;
-mt) HB_MT="MT" ;;
-gt*) HB_GT_REQ="\${HB_GT_REQ} \${v#-gt}" ;;
-fmstat) HB_FM_REQ="STAT" ;;
-nofmstat) HB_FM_REQ="NOSTAT" ;;
-strip) HB_STRIP="yes" ;;
-nostrip) HB_STRIP="no" ;;
-main=*) HB_MAIN_FUNC="\${v#*=}" ;;
-*) p="\${v}" ;;
*) [ -z \${FILEOUT} ] && FILEOUT="\${v##*/}"; p="\${v}" ;;
esac
[ -n "\$p" ] && PP[\$n]="\$p"
n=\$[\$n + 1]
done
P=( "\${PP[@]}" )
case "\${HB_MT}" in
[Mm][Tt]|[Yy][Ee][Ss]|1) HB_MT="MT";;
*) HB_MT="";;
esac
SYSTEM_LIBS="${HB_SYS_LIBS}"
# use pthread system library for MT programs
if [ "\${HB_MT}" = "MT" ]; then
SYSTEM_LIBS="-lpthread \${SYSTEM_LIBS}"
fi
HB_GT_STAT=""
[ -z "\${HB_GT_REQ}" ] && HB_GT_REQ="\${HB_GT}"
if [ "\${HB_MG}" != "yes" ]; then
if [ "\${HB_STATIC}" = "yes" ] || [ "\${HB_STATIC}" = "full" ]; then
HB_GT_STAT=\`echo \${HB_GT_REQ}|tr A-Z a-z\`
fi
HB_GT_REQ=""
else
HB_GT_REQ=\`echo \${HB_GT_REQ}|tr a-z A-Z\`
fi
HB_MAIN_FUNC=\`echo \${HB_MAIN_FUNC}|tr a-z A-Z\`
# set environment variables
export HB_ARCHITECTURE="${HB_ARCHITECTURE}"
export HB_COMPILER="${HB_COMPILER}"
[ -z "\${HB_BIN_INSTALL}" ] && export HB_BIN_INSTALL="${_DEFAULT_BIN_DIR}"
[ -z "\${HB_INC_INSTALL}" ] && export HB_INC_INSTALL="${_DEFAULT_INC_DIR}"
[ -z "\${HB_LIB_INSTALL}" ] && export HB_LIB_INSTALL="${_DEFAULT_LIB_DIR}"
# be sure that ${name} binaries are in your path
export PATH="\${HB_BIN_INSTALL}:\${PATH}"
HB_PATHS="-I\${HB_INC_INSTALL}"
GCC_PATHS="\${HB_PATHS} -L\${HB_LIB_INSTALL}"
LINK_OPT=""
HB_GPM_LIB=""
if [ -f "\${HB_LIB_INSTALL}/libgtsln.a" ]; then
SYSTEM_LIBS="\${SYSTEM_LIBS} -l${HB_SLN_LIB:-slang}"
[ "\${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}"
[ "\${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
SYSTEM_LIBS="\${SYSTEM_LIBS} -L/usr/X11R6/lib -lX11"
fi
fi
[ -n "\${HB_GPM_LIB}" ] && SYSTEM_LIBS="\${SYSTEM_LIBS} -l\${HB_GPM_LIB}"
if [ "\${HB_STATIC}" = "full" ]; then
if [ "\${HB_STATIC}" = "full" ]; then
SYSTEM_LIBS="\${SYSTEM_LIBS} -ldl"
fi
LINK_OPT="\${LINK_OPT} -static"
HB_STATIC="yes"
fi
HB_LNK_REQ=""
for gt in \${HB_GT_REQ}; do
if [ "\${HB_STATIC}" = "yes" ] || [ "\${gt}" = "ALLEG" ]; then
HB_LNK_REQ="\${HB_LNK_REQ} HB_GT_\${gt}"
if [ "\${gt}" = "ALLEG" ]; then
if [ "\${HB_STATIC}" = "yes" ]; then
SYSTEM_LIBS="\`allegro-config --static 2>/dev/null\` \${SYSTEM_LIBS}"
else
SYSTEM_LIBS="\`allegro-config --libs 2>/dev/null\` \${SYSTEM_LIBS}"
fi
fi
fi
done
[ -n "\${HB_FM_REQ}" ] && HB_LNK_REQ="\${HB_LNK_REQ} HB_FM_\${HB_FM_REQ}"
HARBOUR_LIBS=""
if [ "\${HB_STATIC}" = "yes" ]; then
libs="${hb_libs} ${hb_libsc}"
else
l="${name}"
[ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/lib\${l}mt.so" ] && l="\${l}mt"
[ -f "\${HB_LIB_INSTALL}/lib\${l}.so" ] && HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}"
libs="gtalleg hbodbc debug profiler ${hb_libsc}"
fi
for l in \${libs}
do
if [ "\${HB_MG}" = "yes" ] || [ "\${l#gt}" = "\${l}" ] || [ "\${l}" = "gt\${HB_GT_STAT}" ]; then
[ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/lib\${l}mt.a" ] && l="\${l}mt"
if [ -f "\${HB_LIB_INSTALL}/lib\${l}.a" ]; then
HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}"
fi
fi
done
if [ "\${HB_ARCHITECTURE}" = "darwin" ]; then
HARBOUR_LIBS="\${HARBOUR_LIBS} \${HARBOUR_LIBS}"
else
HARBOUR_LIBS="-Wl,--start-group \${HARBOUR_LIBS} -Wl,--end-group"
fi
l="fm"
[ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/lib\${l}mt.a" ] && l="\${l}mt"
if [ -f "\${HB_LIB_INSTALL}/lib\${l}.a" ]; then
if [ "\${HB_STATIC}" = "yes" ] && [ "\${HB_FM_REQ}" = "STAT" ]; then
HARBOUR_LIBS="-l\${l} \${HARBOUR_LIBS}"
else
HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}"
fi
fi
FOUTC1="\${FILEOUT%.*}.c"
FOUTO1="\${FILEOUT%.*}.o"
FOUTE1="\${FILEOUT%.[Pp][Rr][Gg]}"
FOUTE1="\${FOUTE1%.[oc]}"
FOUTC="\${DIROUT}/\${FILEOUT%.*}.c"
FOUTO="\${DIROUT}/\${FILEOUT%.*}.o"
FOUTE="\${DIROUT}/\${FILEOUT%.[Pp][Rr][Gg]}"
FOUTE="\${FOUTE%.[oc]}"
hb_cc()
{
${hb_cmpname} "\$@" \${HB_PATHS} && [ -f "\${FOUTC}" ]
}
hb_link()
{
if [ -n "\${HB_MAIN_FUNC}" ]; then
HB_MAIN_FUNC="@\${HB_MAIN_FUNC}"
elif [ -f "\${FOUTO}" ]; then
HB_MAIN_FUNC=\`hb_lnk_main "\${FOUTO}"\`
fi
if [ -n "\${HB_LNK_REQ}" ] || [ -n "\${HB_GT_REQ}" ] || [ -n "\${HB_MAIN_FUNC}" ]; then
hb_lnk_request > \${_TMP_FILE_} && \\
gcc "\$@" "\${_TMP_FILE_}" \${LINK_OPT} \${GCC_PATHS} \${HARBOUR_LIBS} \${SYSTEM_LIBS} -o "\${FOUTE}"
else
gcc "\$@" \${LINK_OPT} \${GCC_PATHS} \${HARBOUR_LIBS} \${SYSTEM_LIBS} -o "\${FOUTE}"
fi
}
hb_cmp()
{
hb_cc "\$@" && \\
gcc -c "\${FOUTC}" -o "\${FOUTO}" \${GCC_PATHS} && \\
rm -f "\${FOUTC}"
}
hb_lnk_request()
{
echo "#include \\"hbapi.h\\""
if [ -n "\${HB_LNK_REQ}" ]; then
for fn in \${HB_LNK_REQ}; do
echo "extern HB_FUNC( \${fn} );"
done
echo "void hb_lnk_ForceLink_build( void )"
echo "{"
for fn in \${HB_LNK_REQ}; do
echo " HB_FUNCNAME( \${fn} )();"
done
echo "}"
fi
gt="\${HB_GT_REQ%% *}"
if [ -n "\$gt" ] || [ -n "\${HB_MAIN_FUNC}" ]; then
echo "#include \\"hbinit.h\\""
echo "extern char * s_defaultGT;"
echo "extern char * s_pszLinkedMain;"
echo "HB_CALL_ON_STARTUP_BEGIN( hb_lnk_SetDefault_build )"
if [ -n "\$gt" ]; then
echo " s_defaultGT = \\"\$gt\\";"
fi
if [ -n "\${HB_MAIN_FUNC}" ]; then
echo " s_pszLinkedMain = \\"\${HB_MAIN_FUNC}\\";"
fi
echo "HB_CALL_ON_STARTUP_END( hb_lnk_SetDefault_build )"
fi
}
hb_lnk_main()
{
(nm \$1 -g -n --defined-only|sed -e '/HB_FUN_/ ! d' -e 's/^[0-9a-fA-F]* T HB_FUN_//'|head -1|grep -v '^MAIN\$')2>/dev/null
# (nm \$1 -n --defined-only|sed -e '/HB_FUN_/ ! d' -e 's/^[0-9a-fA-F]* [Tt] HB_FUN_//'|head -1|grep -v '^MAIN\$')2>/dev/null
}
hb_cleanup()
{
rm -f "\${_TMP_FILE_}"
}
trap hb_cleanup EXIT &>/dev/null
## get basename
HB="\${0##*/}"
case "\${HB}" in
*cc)
hb_cc "\${P[@]}"
;;
*cmp|gharbour)
hb_cmp "\${P[@]}"
;;
*lnk|harbour-link)
hb_link "\${P[@]}" && \\
( [ "\${HB_STRIP}" != "yes" ] || strip "\${FOUTE}" )
;;
*mk)
hb_cmp "\${P[@]}" && \\
hb_link "\${FOUTO}" && \\
( [ "\${HB_STRIP}" != "yes" ] || strip "\${FOUTE}" ) && \\
rm -f "\${FOUTO}"
;;
esac
EOF
chmod 755 ${hb_tool}
echo "Creating links..."
${hb_tool} mk-links
}
mk_hblibso()
{
local LIBS LIBSMT l lm ll hb_rootdir hb_ver hb_libs
name=`get_solibname`
hb_rootdir="${1-.}"
hb_ver=`get_hbver "${hb_rootdir}"`
hb_libs=`mk_hbgetlibs "$2"`
[ -z "${HB_GT_LIB}" ] && HB_GT_LIB="gtstd"
(cd $HB_LIB_INSTALL
LIBS=""
LIBSMT=""
for l in ${hb_libs}
do
case $l in
debug|profiler|fm|hbodbc|gtalleg|rddads) ;;
*)
ls="lib${l}.a"
if [ -f lib${l}mt.a ]
then
lm="lib${l}mt.a"
else
lm="${ls}"
fi
if [ "${HB_MULTI_GT}" = "yes" ] || \
[ "${l#gt}" = "${l}" ] || \
[ "${l}" = "${HB_GT_LIB}" ]
then
if [ -f $ls ]
then
LIBS="$LIBS $ls"
fi
if [ -f $lm ]
then
LIBSMT="$LIBSMT $lm"
fi
fi
;;
esac
done
echo "Making lib${name}-${hb_ver}.so..."
$HB_BIN_INSTALL/hb-mkslib lib${name}-${hb_ver}.so $LIBS
[ "$HB_MT" != "MT" ] || $HB_BIN_INSTALL/hb-mkslib lib${name}mt-${hb_ver}.so $LIBSMT
for l in lib${name}-${hb_ver}.so lib${name}mt-${hb_ver}.so
do
if [ -f $l ]
then
ll=${l%-${hb_ver}.so}.so
ln -sf $l $ll
case $HB_LIB_INSTALL in
*/usr/lib/*|*/usr/local/lib/*)
ln -sf ${name}/$l ../$ll
;;
*/usr/local/*)
mkdir -p ../../lib
ln -sf ../${name}/lib/$l ../../lib/$ll
;;
*)
;;
esac
fi
done
)
#export LD_LIBRARY_PATH="$HB_LIB_INSTALL:$LD_LIBRARY_PATH"
}

View File

@@ -51,6 +51,7 @@ $hb_collect config/os2/*.cf
$hb_collect config/w32/*.cf
# DOC
$hb_collect doc/Makefile
$hb_collect doc/*.txt
$hb_collect doc/en/*.txt
$hb_collect doc/es/*.txt
@@ -70,9 +71,9 @@ $hb_collect source/Makefile
# SOURCE\COMPILER
$hb_collect source/compiler/Makefile
$hb_collect source/compiler/*.[cyl]
$hb_collect source/compiler/*.simple
$hb_collect source/compiler/*.[cylh]
$hb_collect source/compiler/*.sl[xy]
$hb_collect source/compiler/*.simple
# SOURCE\DEBUG
$hb_collect source/debug/Makefile
@@ -88,7 +89,7 @@ $hb_collect source/codepage/*.[ch]
# SOURCE\MACRO
$hb_collect source/macro/Makefile
$hb_collect source/macro/*.[cyl]
$hb_collect source/macro/*.[cylh]
$hb_collect source/macro/*.slx
# SOURCE\PP
@@ -124,6 +125,13 @@ $hb_collect source/rdd/dbfntx/*.prg
$hb_collect source/rdd/nulsys/Makefile
$hb_collect source/rdd/nulsys/*.prg
for d in ${HB_DB_DRVEXT}
do
$hb_collect source/rdd/$d/Makefile
$hb_collect source/rdd/$d/*.[ch]
$hb_collect source/rdd/$d/*.prg
done
# SOURCE\RTL
$hb_collect source/rtl/Makefile
$hb_collect source/rtl/*.[ch]
@@ -173,6 +181,23 @@ $hb_collect source/rtl/gtstd/*.[ch]
$hb_collect source/rtl/gtwin/Makefile
$hb_collect source/rtl/gtwin/*.[ch]
# SOURCE\RTL\GTWVT
$hb_collect source/rtl/gtwvt/Makefile*
$hb_collect source/rtl/gtwvt/*.[ch]
# SOURCE\RTL\GTXVT
$hb_collect source/rtl/gtxvt/Makefile*
$hb_collect source/rtl/gtxvt/*.[ch]
# SOURCE\RTL\GTXWC
$hb_collect source/rtl/gtxwc/Makefile*
$hb_collect source/rtl/gtxwc/*.[ch]
# SOURCE\RTL\GTALLEG
$hb_collect source/rtl/gtalleg/Makefile*
$hb_collect source/rtl/gtalleg/*.[ch]
$hb_collect source/rtl/gtalleg/*.sfc
# SOURCE\VM
$hb_collect source/vm/Makefile
$hb_collect source/vm/*.[ch]
@@ -184,10 +209,15 @@ $hb_collect tests/*.ch
$hb_collect tests/*.dbf
$hb_collect tests/*.fpt
$hb_collect tests/*.prg
$hb_collect tests/*.src
$hb_collect tests/*.txt
# TESTS\BLDTEST
$hb_collect tests/bldtest/Makefile
$hb_collect tests/bldtest/*.[ch]
# UTILS
$hb_collect utils/Makefile*
$hb_collect utils/Makefile
# UTILS\HBDOC
$hb_collect utils/hbdoc/Makefile
@@ -222,6 +252,12 @@ $hb_collect utils/hbtest/*.prg
# CONTRIB
$hb_collect contrib/Makefile
# CONTRIB\RDD_ADS
$hb_collect contrib/rdd_ads/Makefile
$hb_collect contrib/rdd_ads/*.[ch]
$hb_collect contrib/rdd_ads/*.prg
$hb_collect contrib/rdd_ads/*.ch
# CONTRIB\LIBCT
$hb_collect contrib/libct/Makefile
$hb_collect contrib/libct/*.[ch]

29
harbour/bin/postinst.bat Normal file
View File

@@ -0,0 +1,29 @@
@echo off
rem
rem $Id$
rem
rem ---------------------------------------------------------------
rem Copyright 2003 Przemyslaw Czerpak <druzus@priv.onet.pl>
rem simple script run after Harbour make install to finish install
rem process
rem
rem See doc/license.txt for licensing terms.
rem ---------------------------------------------------------------
goto inst_%HB_ARCHITECTURE%
:inst_dos
rem DOS post install part
goto end
:inst_w32
rem Windows post install part
goto end
:inst_
:end

64
harbour/bin/postinst.sh Normal file
View File

@@ -0,0 +1,64 @@
#!/bin/sh
[ "$BASH" ] || exec bash `which $0` ${1+"$@"}
#
# $Id$
#
# ---------------------------------------------------------------
# Copyright 2003 Przemyslaw Czerpak <druzus@priv.onet.pl>
# simple script run after Harbour make install to finish install
# process
#
# See doc/license.txt for licensing terms.
# ---------------------------------------------------------------
if [ -z "$HB_ARCHITECTURE" ] || [ -z "$HB_COMPILER" ] || \
[ -z "$HB_BIN_INSTALL" ] || \
[ -z "$HB_INC_INSTALL" ] || \
[ -z "$HB_LIB_INSTALL" ]
then
echo "The following envvars must be set:"
echo " HB_ARCHITECTURE"
echo " HB_COMPILER"
echo " HB_BIN_INSTALL"
echo " HB_INC_INSTALL"
echo " HB_LIB_INSTALL"
exit 1
fi
hb_root=`dirname "$0"`
if [ "${hb_root}" = "." ]
then
hb_root=".."
else
hb_root=`dirname "${hb_root}"`
fi
. ${hb_root}/bin/hb-func.sh
if [ "$HB_COMPILER" = "gcc" ] || [ "$HB_COMPILER" = "mingw32" ] || [ "$HB_COMPILER" = "djgpp" ]
then
if [ "${HB_ARCHITECTURE}" == "bsd" ]; then
MAKE=gmake
else
MAKE=make
fi
if [ "${HB_ARCHITECTURE}" != "dos" ]; then
install -m755 "${hb_root}/bin/hb-mkslib.sh" "${HB_BIN_INSTALL}/hb-mkslib"
fi
mk_hbtools "${HB_BIN_INSTALL}" "$@"
[ "$HB_COMPILER" = "gcc" ] && mk_hblibso "${hb_root}"
# build fm lib with memory statistic
(cd ${hb_root}/source/vm
C_USR=${C_USR//-DHB_FM_STATISTICS_OFF/}
rm -f fm.o
${MAKE} -r fm.o
ar -cr ${HB_LIB_INSTALL}/libfm.a fm.o
rm -f fm.o
if [ "${HB_MT}" = "MT" ]; then
${MAKE} -r fm.o 'HB_LIBCOMP_MT=YES'
ar -cr ${HB_LIB_INSTALL}/libfmmt.a fm.o
rm -f fm.o
fi
)
fi

View File

@@ -69,8 +69,3 @@ ARFLAGS = $(A_USR)
AR_RULE = $(AR) $(ARFLAGS) r $@ $^ || $(RM) $@
include $(TOP)$(ROOT)config/rules.cf

View File

@@ -26,13 +26,11 @@ RD = rm -f -r
CP = cp -f
MV = mv -f
MD = mkdir
MDP = mkdir -p
RANLIB = ranlib
dirbase::
@[ -d $(HB_ARCHITECTURE) ] || $(MD) $(HB_ARCHITECTURE); \
[ -d $(ARCH) ] || $(MD) $(ARCH)
@[ -d $(ARCH_DIR) ] || $(MDP) $(ARCH_DIR)
clean::
-$(RD) $(ARCH_DIR)

View File

@@ -0,0 +1,14 @@
#
# $Id$
#
ifeq ($(PM),) # Only traverse directories if not compiling a specific module
DIR_RULE =\
@for d in $(DIRS); do \
if [ -d $$d ]; then \
$(MAKE) -C $$d $@; \
fi \
done
endif # ! compiling a specific program module

View File

@@ -0,0 +1,104 @@
#
# $Id$
#
include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/global.cf
OBJ_EXT = .o
EXE_EXT =
LIB_PREF = lib
LIB_EXT = .a
CC = $(CCACHE) gcc
CC_IN = -c
CC_OUT = -o
CPPFLAGS = -fsigned-char -no-cpp-precomp -I. -I$(TOP)include -I$(HB_INC_COMPILE)
CFLAGS = -Wall -W -DHB_OS_DARWIN -DHB_BIG_ENDIAN
ifeq ($(HB_LEX),SIMPLEX)
CFLAGS += -DSIMPLEX
endif
LD = gcc
LD_OUT = -o
# Add all libraries specified in HB_USER_LIBS.
LINKPATHS += $(foreach lib, $(HB_USER_LIBS), -L$(TOP)$(ROOT)source/$(lib)/$(ARCH))
LINKLIBS += $(foreach lib, $(HB_USER_LIBS), -l$(lib))
# Add all libraries specified in CONTRIBS and LIBS.
ifeq ($(HB_LIB_COMPILE),)
LINKPATHS += $(foreach lib, $(CONTRIBS), -L$(TOP)$(ROOT)contrib/$(lib)/$(ARCH))
LINKPATHS += $(foreach lib, $(LIBS), -L$(TOP)$(ROOT)source/$(lib)/$(ARCH))
else
LINKPATHS += -L$(HB_LIB_COMPILE)
endif
# LINKLIBS += -Wl,--start-group
LINKLIBS += $(foreach lib, $(CONTRIBS), -l$(lib))
LINKLIBS += $(foreach lib, $(LIBS), -l$(lib))
# If LIBS specifies the rdd library, add all DB drivers.
ifeq ($(findstring rdd,$(LIBS)),rdd)
LINKPATHS += $(foreach drv, $(HB_DB_DRIVERS), -L$(TOP)$(ROOT)source/rdd/$(drv)/$(ARCH))
LINKLIBS += $(foreach drv, $(HB_DB_DRIVERS), -l$(drv))
endif
# Add the specified GT driver library
ifeq ($(findstring rtl,$(LIBS)),rtl)
LINKPATHS += -L$(TOP)$(ROOT)source/rtl/$(HB_GT_LIB)/$(ARCH)
LINKLIBS += -l$(HB_GT_LIB)
ifeq ($(HB_MULTI_GT),yes)
LINKPATHS += -L$(TOP)$(ROOT)source/rtl/gtnul/$(ARCH)
LINKLIBS += -lgtnul
endif
# HB_SCREEN_LIB: empty, or one of ncurses, slang
ifeq ($(HB_GT_LIB),gtcrs)
HB_SCREEN_LIB:=ncurses
else
ifeq ($(HB_GT_LIB),gtsln)
HB_SCREEN_LIB:=slang
endif
endif
ifneq ($(HB_SCREEN_LIB),)
LINKLIBS += -l$(HB_SCREEN_LIB)
endif
# In BSD, slang still needs curses :(
ifeq ($(HB_GT_LIB),gtsln)
LINKLIBS += -lncurses
endif
ifeq ($(HB_GT_LIB),gtxvt)
LINKLIBS += -lX11
LINKPATHS +=-L/usr/X11R6/lib
else
ifeq ($(HB_GT_LIB),gtxwc)
LINKLIBS += -lX11
LINKPATHS +=-L/usr/X11R6/lib
endif
endif
# HB_GPM_MOUSE: use gpm mouse driver
# Actually, there is no gpm on BSD.
ifeq ($(HB_GPM_MOUSE),yes)
LINKLIBS += -lgpm
endif
endif
LINKLIBS += -lm
# -Wl,--end-group
LDFLAGS = $(LINKPATHS)
LD_RULE = $(LD) $(CFLAGS) $(LD_OUT) $@ $^ $(LDFLAGS) $(L_USR) $(LINKLIBS) $(LINKLIBS)
#AR = ar
#ARFLAGS = $(A_USR)
#AR_RULE = $(AR) $(ARFLAGS) r $@ $^ || $(RM) $@
LIBTOOL = libtool
LIBTOOLFLAGS = $(LIBTOOL_USR)
AR_RULE = $(LIBTOOL) -static $(LIBTOOLFLAGS) -o $@ $^ || $(RM) $@
RANLIB = ranlib
include $(TOP)$(ROOT)config/rules.cf

View File

@@ -0,0 +1,41 @@
#
# $Id$
#
all : first
HB_GT_LIBS=\
gtcgi \
gtcrs \
gtpca \
gtstd \
gtnul \
ifeq ($(HB_COMMERCE),yes)
HB_GPM_MOUSE = no
else
ifneq ($(HB_WITHOUT_GTSLN),yes)
HB_GT_LIBS += gtsln
endif
endif
ifeq ($(HB_GT_LIB),)
HB_GT_LIB = gtstd
endif
ARCH_DIR = $(ARCH)
MK = $(MAKE)
RM = rm -f
RD = rm -f -r
CP = cp -f
MV = mv -f
MD = mkdir
MDP = mkdir -p
RANLIB = ranlib
dirbase::
@[ -d $(ARCH_DIR) ] || $(MDP) $(ARCH_DIR)
clean::
-$(RD) $(ARCH_DIR)

View File

@@ -0,0 +1,25 @@
#
# $Id$
#
INSTALL_RULE =\
@if [ ! -d $(INSTALL_DIR) ]; \
then \
echo "! Can't install, path not found:" $(INSTALL_DIR); \
else \
for i in $(INSTALL_OBJS); \
do \
if [ -r $$i ]; \
then \
echo "! Installing $$i on $(INSTALL_DIR)"; \
$(CP) $$i $(INSTALL_DIR); \
else \
echo "! Can't install $$i, not found"; \
fi \
done; \
if [ $(INSTALL_DIR) = $(HB_LIB_INSTALL) ]; \
then \
$(RANLIB) $(foreach file,$(notdir $(INSTALL_OBJS)),$(INSTALL_DIR)/$(file)); \
fi \
fi

View File

@@ -13,5 +13,10 @@ all : first
first clean install::
$(DIR_RULE)
ifneq ($(HB_POSTINST),)
install::
$(HB_POSTINST)
endif
endif
endif

View File

@@ -2,18 +2,39 @@
# $Id$
#
include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/global.cf
ifeq ($(PM),) # Only traverse directories if not compiling a specific module
ifeq ($(DIRS),) # Empty directory list
DIR_RULE =\
@echo Done
DIR_RULE = @echo Done
else
ifeq ($(SHLVL),) # COMMAND.COM
# 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 dir_mk
$(DIR_MAKE) -C $(file) $@
endef
DIR_LIST := $(subst /,\,$(DIRS))
DIR_MAKE := $(subst /,\,$(MK))
DIR_RULE =\
$(COMSPEC) /C FOR %d IN ($(DIR_LIST)) DO $(DIR_MAKE) -C %d $@
endif
DIR_RULE = $(foreach file, $(DIR_LIST), $(dir_mk))
endif # ! compiling a specific program module
else # bash
DIR_LIST = $(subst \,/,$(DIRS))
DIR_RULE =\
for d in $(DIR_LIST); do \
if [ -d $$d ]; then \
$(MAKE) -C $$d $@; \
fi \
done
endif # ! COMMAND.COM
endif # ! Empty directory list
endif # ! compiling a specific program module

View File

@@ -7,17 +7,21 @@ ifndef MK
all : first
HB_GT_LIBS=\
gtcgi \
gtdos \
gtpca \
gtstd \
# gtcrs \
# gtsln \
gtcgi \
gtpca \
gtstd \
gtdos \
# gtnul \
# gtcrs \
# gtsln \
ifeq ($(HB_GT_LIB),)
HB_GT_LIB = gtdos
endif
ifeq ($(SHLVL),) # COMMAND.COM
# There is a conflict with the use of '\' and '/' characters
# The MAKE requires '/' in filenames (ARCH_DIR) however some compilers
# and some DOS commands require '\' (ARCH_DOS)
@@ -34,7 +38,7 @@ else
ifeq ($(HB_COMPILER),rsx32)
#Use standard dos path, which is already set up.
else
ifeq ($(HB_COMPILER),watcom)
ifneq ($(findstring watcom,$(HB_COMPILER)),)
#Use standard dos path, which is already set up.
else
ifeq ($(HB_COMPILER),djgpp)
@@ -57,17 +61,37 @@ CP = copy
MV = move
MD = md
#this will be used only under DJGPP
RANLIB = ranlib
dirbase::
-if not exist $(HB_ARCHITECTURE) $(MD) $(HB_ARCHITECTURE)
-if not exist $(ARCH_DOS) $(MD) $(ARCH_DOS)
-@for %d in ($(HB_ARCHITECTURE) $(ARCH_DOS)) do if not exist %d\nul $(MD) %d
clean::
-for %f in ($(ARCH_DOS)\*.*) do $(RM) %f
-if exist *.bak $(RM) *.bak
-if exist *.obj $(RM) *.obj
-if exist core $(RM) core
-if exist *.o $(RM) *.o
-$(RD) $(ARCH_DOS)
-$(RD) $(HB_ARCHITECTURE)
endif
-@for %f in ($(ARCH_DOS)\*.* *.bak *.obj *.o *.tds) do $(RM) %f
-@for %d in ($(ARCH_DOS) $(HB_ARCHITECTURE)) do if exist %d\nul $(RD) %d
else # bash
ARCH_DIR = $(ARCH)
MK = $(MAKE)
RM = rm -f
RD = rm -f -r
CP = cp -f
MV = mv -f
MD = mkdir
#this will be used only under MINGW
RANLIB = ranlib
dirbase::
@[ -d $(HB_ARCHITECTURE) ] || $(MD) $(HB_ARCHITECTURE); \
[ -d $(ARCH_DIR) ] || $(MD) $(ARCH_DIR)
clean::
-$(RD) $(ARCH)
endif
endif

View File

@@ -2,8 +2,46 @@
# $Id$
#
include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/global.cf
ifeq ($(INSTALL_OBJS),) # Empty install list
INSTALL_RULE = @echo Done
else
ifeq ($(SHLVL),) # COMMAND.COM
# 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_LIST = $(subst /,\,$(INSTALL_OBJS))
INSTALL_RULE = $(foreach file, $(INSTALL_LIST), $(inst_file))
else # bash
INSTALL_DIRSH = $(subst \,/,$(INSTALL_DIR))
INSTALL_OBJSH = $(subst \,/,$(INSTALL_OBJS))
INSTALL_RULE =\
$(COMSPEC) /c FOR %f IN ($(INSTALL_LIST)) DO COPY %f $(subst /,\,$(INSTALL_DIR))
@if [ ! -d $(INSTALL_DIRSH) ]; \
then \
echo "! Can't install, path not found:" $(INSTALL_DIRSH); \
else \
for i in $(INSTALL_OBJSH); \
do \
if [ -r $$i ]; \
then \
echo "! Installing $$i on $(INSTALL_DIRSH)"; \
$(CP) $$i $(INSTALL_DIRSH); \
else \
echo "! Can't install $$i, not found"; \
fi \
done \
fi
endif
endif

View File

@@ -2,7 +2,7 @@
# $Id$
#
# The Harbour project
# GNU MAKE file for OpenWatcom C/C++ compiler
# GNU MAKE file for OpenWatcom
include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/global.cf
@@ -18,17 +18,29 @@ CC_IN =
CC_OUT = -fo=
# important: -j is necessary for proper build
CPPFLAGS = -j -w3 -d2 -5s -5r -fp5 -oxehtz -zq -zt0 -bt=DOS
CFLAGS := -i$(subst /,\,$(HB_INC_COMPILE)) -i.
#CPPFLAGS = -j -w3 -d1 -5s -5r -fp5 -oehtz -s -zq -zt0 -bt=DOS
CPPFLAGS = -j -w2 -d1 -zq -bt=DOS
# work arround to DOS command line size limit
export WPP386 := $(CPPFLAGS)
CPPFLAGS =
#architecture flags
CPPFLAGS += -5 -fp5
# optimization flags
# don't enable -ol optimization in OpenWatcom 1.1 - gives buggy code
CPPFLAGS += -onaehtzr -oi+ -ei -zp8 -s -zt0
CPPFLAGS += -i. -i$(TOP)include -i$(TOP)$(ROOT)include -iinclude
ifneq ($(HB_LIB_COMPILE),)
CPPFLAGS += -i$(HB_INC_COMPILE)
endif
ifeq ($(HB_LEX),SIMPLEX)
CFLAGS += -DSIMPLEX
endif
# work arround to DOS command line size limit
export WPP386 := $(strip $(CPPFLAGS))
CPPFLAGS =
# Note: The empty line directly before 'endef' HAVE TO exist!
# It causes that the 'echo' command is separated by LF
define link_file
@@ -45,6 +57,7 @@ endef
define link_exe_file
echo $(LDFLAGS) NAME $@ > __link__.tmp
$(foreach file, $^, $(link_file))
$(foreach lib, $(HB_USER_LIBS), $(link_lib))
$(foreach lib, $(LINKLIBS), $(link_lib))
$(foreach lib, $(RDDLIBS), $(link_lib))
$(foreach lib, $(GTLIBS), $(link_lib))
@@ -53,28 +66,38 @@ endef
LD = wlink
LDFLAGS = debug all OP osn=DOS OP stack=65536 OP CASEEXACT OP stub=cwstub.exe
HB_USER_LIBS := $(foreach lib, $(HB_USER_LIBS), $(subst /,\,$(TOP)$(ROOT)source/$(lib)/$(ARCH)/$(lib)))
ifeq ($(HB_LIB_COMPILE),)
LINKLIBS := $(foreach lib, $(CONTRIBS), $(subst /,\,$(TOP)$(ROOT)contrib/$(lib)/$(ARCH)/$(subst lib,,$(lib))))
LINKLIBS := $(foreach lib, $(LIBS), $(subst /,\,$(TOP)$(ROOT)source/$(lib)/$(ARCH)/$(lib)))
LINKLIBS += $(foreach lib, $(LIBS), $(subst /,\,$(TOP)$(ROOT)source/$(lib)/$(ARCH)/$(lib)))
else
LINKLIBS := $(foreach lib, $(CONTRIBS), $(subst /,\,$(HB_LIB_COMPILE)/$(lib)))
LINKLIBS := $(foreach lib, $(LIBS), $(subst /,\,$(HB_LIB_COMPILE)/$(lib)))
LINKLIBS += $(foreach lib, $(LIBS), $(subst /,\,$(HB_LIB_COMPILE)/$(lib)))
endif
# If LIBS specifies the rdd library, add all DB drivers.
ifeq ($(findstring rdd,$(LIBS)),rdd)
ifeq ($(HB_LIB_COMPILE),)
RDDLIBS := $(foreach drv, $(HB_DB_DRIVERS), $(subst /,\,$(TOP)$(ROOT)source/rdd/$(drv)/$(ARCH)/$(drv)))
else
RDDLIBS := $(foreach drv, $(HB_DB_DRIVERS), $(subst /,\,$(HB_LIB_COMPILE)/$(drv)))
endif
endif
ifeq ($(findstring rtl,$(LIBS)),rtl)
ifeq ($(HB_LIB_COMPILE),)
GTLIBS := $(TOP)$(ROOT)source/rtl/$(HB_GT_LIB)/$(ARCH)/$(HB_GT_LIB)
else
GTLIBS := $(HB_LIB_COMPILE)/$(HB_GT_LIB)
endif
ifeq ($(HB_MULTI_GT),yes)
GTLIBS := $(TOP)$(ROOT)source/rtl/gtnul/$(ARCH)/gtnul
GTLIBS += $(TOP)$(ROOT)source/rtl/gtnul/$(ARCH)/gtnul
endif
GTLIBS := $(subst /,\,$(GTLIBS))
endif
LD_RULE = $(link_exe_file)
#Note: The empty line below HAVE TO exist!

View File

@@ -45,10 +45,10 @@ LD = wlink
LDFLAGS = debug all OP osn=DOS4G OP stack=65536 OP CASEEXACT
ifeq ($(HB_LIB_COMPILE),)
LINKLIBS := $(foreach lib, $(CONTRIBS), $(subst /,\,$(TOP)$(ROOT)contrib/$(lib)/$(ARCH)/$(subst lib,,$(lib))))
LINKLIBS := $(foreach lib, $(LIBS), $(subst /,\,$(TOP)$(ROOT)source/$(lib)/$(ARCH)/$(lib)))
LINKLIBS += $(foreach lib, $(LIBS), $(subst /,\,$(TOP)$(ROOT)source/$(lib)/$(ARCH)/$(lib)))
else
LINKLIBS := $(foreach lib, $(CONTRIBS), $(subst /,\,$(HB_LIB_COMPILE)/$(lib)))
LINKLIBS := $(foreach lib, $(LIBS), $(subst /,\,$(HB_LIB_COMPILE)/$(lib)))
LINKLIBS += $(foreach lib, $(LIBS), $(subst /,\,$(HB_LIB_COMPILE)/$(lib)))
endif
# If LIBS specifies the rdd library, add all DB drivers.

View File

@@ -13,12 +13,19 @@ CC = $(HB_CCACHE) gcc
CC_IN = -c
CC_OUT = -o
CPPFLAGS = -I. -I$(HB_INC_COMPILE)
# We are under linux
CFLAGS = -DHB_OS_LINUX -Wall -W -fsigned-char
# uncomment this if you want to farce relocateable code for .so libs
# it's necessary on some platforms but can reduce performance
#CFLAGS += -fPIC
ifeq ($(HB_LEX),SIMPLEX)
CFLAGS = -Wall -g -DSIMPLEX
else
CFLAGS = -Wall -g
CFLAGS += -DSIMPLEX
endif
LD = $(HB_CCACHE) gcc
LD_OUT = -o
@@ -64,6 +71,6 @@ LDFLAGS = $(LINKPATHS)
AR = ar
ARFLAGS = $(A_USR)
AR_RULE = $(AR) $(ARFLAGS) r $@ $^ || $(RM) $@
AR_RULE = $(AR) $(ARFLAGS) cr $@ $^ || $(RM) $@
include $(TOP)$(ROOT)config/rules.cf

View File

@@ -22,10 +22,10 @@ RD = rm -f -r
CP = cp -f
MV = mv -f
MD = mkdir
MDP = mkdir -p
dirbase::
@[ -d $(HB_ARCHITECTURE) ] || $(MD) $(HB_ARCHITECTURE); \
[ -d $(ARCH) ] || $(MD) $(ARCH)
@[ -d $(ARCH_DIR) ] || $(MDP) $(ARCH_DIR)
clean::
-$(RD) $(ARCH_DIR)

View File

@@ -75,6 +75,16 @@ DIRS=\
else
ifeq ($(HB_ARCHITECTURE),bsd)
DIRS=\
htmllib \
libct \
libgt \
libmisc \
samples \
else
ifeq ($(HB_ARCHITECTURE),dos)
DIRS=\
htmllib \
libct \
@@ -96,5 +106,6 @@ endif
endif
endif
endif
endif
include $(ROOT)config/dir.cf

View File

@@ -1645,7 +1645,7 @@
static BOOL s_bArrayPrefix = FALSE;
//----------------------------------------------------------------------------//
static HB_FUNC( SETARRAYPREFIX )
HB_FUNC_STATIC( SETARRAYPREFIX )
{
PHB_ITEM pbArrayPrefix = hb_param( 1, HB_IT_LOGICAL );
@@ -1656,13 +1656,13 @@
}
//----------------------------------------------------------------------------//
static HB_FUNC( GETARRAYPREFIX )
HB_FUNC_STATIC( GETARRAYPREFIX )
{
hb_retl( s_bArrayPrefix );
}
//----------------------------------------------------------------------------//
static HB_FUNC( NEXTTOKEN )
HB_FUNC_STATIC( NEXTTOKEN )
{
PHB_ITEM pLine = hb_param( 1, HB_IT_STRING );
PHB_ITEM pDontRecord = hb_param( 2, HB_IT_LOGICAL );
@@ -2027,7 +2027,7 @@
}
//----------------------------------------------------------------------------//
static HB_FUNC( NEXTIDENTIFIER )
HB_FUNC_STATIC( NEXTIDENTIFIER )
{
PHB_ITEM pLine = hb_param( 1, HB_IT_STRING );
PHB_ITEM pSkipped = hb_param( 2, HB_IT_ANY );

View File

@@ -66,7 +66,7 @@ PRG_SOURCES= \
ctmisc.prg \
datetime.prg \
dattime2.prg \
invertwin.prg \
invrtwin.prg \
numconv.prg \
screen2.prg \
setlast.prg \

View File

@@ -59,13 +59,13 @@
#include "ct.h"
#include "clipdefs.h"
long static __hex2int( char *cNum1, int iLenHex );
long static __getparam( int iParam );
long static __numand( long wNum1, long wNum2 );
long static __numor ( long wNum1, long wNum2 );
long static __numxor( long wNum1, long wNum2 );
long static __numnot( long wNum1, long wNum2 );
long static __numfun( int iPCount, long (*operation)(long wNum1, long wNum2));
static long __hex2int( char *cNum1, int iLenHex );
static long __getparam( int iParam );
static long __numand( long wNum1, long wNum2 );
static long __numor ( long wNum1, long wNum2 );
static long __numxor( long wNum1, long wNum2 );
static long __numnot( long wNum1, long wNum2 );
static long __numfun( int iPCount, long (*operation)(long wNum1, long wNum2));
/* $DOC$
@@ -381,7 +381,7 @@ HB_FUNC ( HEX2NUM )
}
*/
long static __hex2int( char *cNum1, int iLenHex )
static long __hex2int( char *cNum1, int iLenHex )
{
int i;
int iNum;
@@ -406,7 +406,7 @@ long static __hex2int( char *cNum1, int iLenHex )
}
long static __getparam( int iParam )
static long __getparam( int iParam )
{
if ( ISCHAR( iParam ) )
@@ -417,32 +417,32 @@ long static __getparam( int iParam )
}
long static __numand( long uiNum1, long uiNum2 )
static long __numand( long uiNum1, long uiNum2 )
{
return uiNum1 & uiNum2;
}
long static __numor( long uiNum1, long uiNum2 )
static long __numor( long uiNum1, long uiNum2 )
{
return uiNum1 | uiNum2;
}
long static __numxor( long uiNum1, long uiNum2 )
static long __numxor( long uiNum1, long uiNum2 )
{
return uiNum1 ^ uiNum2;
}
long static __numnot( long uiNum1, long uiNum2 )
static long __numnot( long uiNum1, long uiNum2 )
{
HB_SYMBOL_UNUSED (uiNum2);
return ~uiNum1;
}
long static __numfun( int iPCount, long (*operation)(long wNum1, long wNum2))
static long __numfun( int iPCount, long (*operation)(long wNum1, long wNum2))
{
long uiNumOp = 0;
long uiNum1, uiNum2;

View File

@@ -56,8 +56,8 @@
#include "ct.h"
long int static __hex2long( char *cNum1, int iLenHex );
long int static __getparam( int iParam );
static long __hex2long( char *cNum1, int iLenHex );
static long __getparam( int iParam );
/* $DOC$
@@ -245,7 +245,7 @@ HB_FUNC ( ISBIT )
}
long int static __hex2long( char *cNum1, int iLenHex )
static long __hex2long( char *cNum1, int iLenHex )
{
register int i;
register int iNum;
@@ -270,7 +270,7 @@ long int static __hex2long( char *cNum1, int iLenHex )
}
long int static __getparam( int iParam )
static long __getparam( int iParam )
{
if ( ISCHAR( iParam ) )

View File

@@ -59,14 +59,14 @@
#include "ct.h"
#include "clipdefs.h"
long static __hex2long( char *cNum1, int iLenHex );
long static __getparam( int iParam );
long static __numand( long wNum1, long wNum2 );
long static __numor ( long wNum1, long wNum2 );
long static __numxor( long wNum1, long wNum2 );
long static __numnot( long wNum1, long wNum2 );
long static __numfun( int iPCount, long (*operation)(long wNum1, long wNum2), BOOL * pbOk );
void static sizeofbits( USHORT * pusBytes, LONG * plPattern, LONG * plTestMSB );
static long __hex2long( char *cNum1, int iLenHex );
static long __getparam( int iParam );
static long __numand( long wNum1, long wNum2 );
static long __numor ( long wNum1, long wNum2 );
static long __numxor( long wNum1, long wNum2 );
static long __numnot( long wNum1, long wNum2 );
static long __numfun( int iPCount, long (*operation)(long wNum1, long wNum2), BOOL * pbOk );
static void sizeofbits( USHORT * pusBytes, LONG * plPattern, LONG * plTestMSB );
/* $DOC$
* $FUNCNAME$
@@ -482,7 +482,7 @@ HB_FUNC ( NUMMIRRX )
}
long static __hex2long( char *cNum1, int iLenHex )
static long __hex2long( char *cNum1, int iLenHex )
{
int i;
int iNum;
@@ -507,7 +507,7 @@ long static __hex2long( char *cNum1, int iLenHex )
}
long static __getparam( int iParam )
static long __getparam( int iParam )
{
if ( ISCHAR( iParam ) )
@@ -518,32 +518,32 @@ long static __getparam( int iParam )
}
long static __numand( long lNum1, long lNum2 )
static long __numand( long lNum1, long lNum2 )
{
return lNum1 & lNum2;
}
long static __numor( long lNum1, long lNum2 )
static long __numor( long lNum1, long lNum2 )
{
return lNum1 | lNum2;
}
long static __numxor( long lNum1, long lNum2 )
static long __numxor( long lNum1, long lNum2 )
{
return lNum1 ^ lNum2;
}
long static __numnot( long lNum1, long lNum2 )
static long __numnot( long lNum1, long lNum2 )
{
HB_SYMBOL_UNUSED (lNum2);
return ~lNum1;
}
long static __numfun( int iPCount, long (*operation)(long wNum1, long wNum2), BOOL * pbOk )
static long __numfun( int iPCount, long (*operation)(long wNum1, long wNum2), BOOL * pbOk )
{
long lNumOp = 0;
long lNum1, lNum2;
@@ -615,7 +615,7 @@ long static __numfun( int iPCount, long (*operation)(long wNum1, long wNum2), BO
}
void static sizeofbits( USHORT * pusBytes, long *plPattern, long *plTestMSB )
static void sizeofbits( USHORT * pusBytes, long *plPattern, long *plTestMSB )
{
*pusBytes = ((ISNIL(1) || hb_parni(1) == 0) ? sizeof( int ) * 8

View File

@@ -53,10 +53,12 @@
#define HB_OS_WIN_32_USED
#include <hbapi.h>
#include <hbapifs.h>
#if defined(HB_OS_DOS)
static struct ffblk fsOldFiles;
#if defined( HB_OS_DOS ) && !defined( __WATCOMC__ )
static struct ffblk fsOldFiles;
#endif
#if defined(HB_OS_OS2) && defined(__GNUC__)
#include "hb_io.h"
@@ -71,11 +73,17 @@ static struct ffblk fsOldFiles;
#elif defined(HB_OS_DOS) && !defined(__RSX32__)
#if defined(__DJGPP__)
#include <dpmi.h>
#include <go32.h>
#include <sys/farptr.h>
#include <sys/param.h>
#endif
#include "hb_io.h"
#include "dos.h"
#if defined( __WATCOMC__ )
#else
#include <dir.h>
#endif
#endif
#if defined(__GNUC__) && !defined(__MINGW32__)
#include <sys/types.h>
@@ -84,17 +92,20 @@ static struct ffblk fsOldFiles;
#include <errno.h>
#include <dirent.h>
#include <time.h>
#include <utime.h>
#if !defined(HAVE_POSIX_IO)
#define HAVE_POSIX_IO
#endif
#endif
#if (defined(HB_OS_WIN_32) || defined(__MINGW32__)) && !defined(__CYGWIN__)
static HANDLE hLastFind;
static WIN32_FIND_DATA Lastff32;
LPTSTR GetDate(FILETIME *rTime);
LPTSTR GetTime(FILETIME *rTime);
#if !defined(_MSC_VER) && !defined(__RSXNT__)
#if !defined( _MSC_VER ) && !defined( __RSXNT__ ) && !defined( __WATCOMC__ )
#include <dir.h>
#endif
#endif
@@ -121,6 +132,7 @@ LPTSTR GetTime(FILETIME *rTime);
#define FA_VOLCOMP 32768 /* M */
#endif
#if defined( OS_UNIX_COMPATIBLE ) || defined(HB_OS_OS2)
static USHORT osToHarbourMask( USHORT usMask )
{
USHORT usRetMask;
@@ -167,12 +179,11 @@ static USHORT osToHarbourMask( USHORT usMask )
return usRetMask;
}
#endif
HB_FUNC(FILEATTR)
{
#if defined(HB_OS_DOS)
#if defined(__DJGPP__) || defined(__BORLANDC__)
{
@@ -190,8 +201,8 @@ HB_FUNC(FILEATTR)
iAttri = _chmod( szFile, 0 );
#endif
hb_retni(iAttri);
#endif
}
#endif
#elif defined(HB_OS_WIN_32)
{
@@ -368,7 +379,7 @@ HB_FUNC(FILESEEK)
}
}
}
#elif defined(HB_OS_DOS)
#elif defined(HB_OS_DOS) && !defined( __WATCOMC__ )
{
int iFind;
char *szFiles;
@@ -470,7 +481,7 @@ HB_FUNC(FILESIZE)
hb_retnl(dwFileSize);
}
}
#elif defined(HB_OS_DOS)
#elif defined(HB_OS_DOS) && !defined( __WATCOMC__ )
{
int iFind;
if (hb_pcount() >0)
@@ -581,7 +592,7 @@ HB_FUNC(FILEDATE)
hb_xfree(szDateString);
}
}
#elif defined(HB_OS_DOS)
#elif defined(HB_OS_DOS) && !defined( __WATCOMC__ )
{
int iFind;
if (hb_pcount() >0)
@@ -697,7 +708,7 @@ HB_FUNC(FILETIME)
hb_xfree(szDateString);
}
}
#elif defined(HB_OS_DOS)
#elif defined(HB_OS_DOS) && !defined( __WATCOMC__ )
{
char szTime[7];
int iFind;
@@ -736,7 +747,7 @@ HB_FUNC(FILETIME)
struct tm *ft;
stat(szFile,&sStat );
tm_t = sStat.st_mtime;
ft = localtime( &tm_t );
sprintf( szTime, "%02d:%02d:%02d",ft->tm_hour, ft->tm_min, ft->tm_sec );
hb_retc(szTime);
}

View File

@@ -158,7 +158,7 @@ HB_FUNC( CTOF )
{
pcString = hb_parc( 1 );
for (i=0; i<sizeof(double); i++)
for (i=0; i < (int) sizeof(double); i++)
xConvert.string[i] = pcString[i];
hb_retnd( xConvert.value );

View File

@@ -235,7 +235,7 @@ static void SetGet( char cKey )
#if defined(__WATCOMC__) && defined(__386__)
*( ( char * ) 0x0417 ) = ( *( ( char * ) 0x0417 ) & ( !cKey ) ) | cKey );
*( ( char * ) 0x0417 ) = ( *( ( char * ) 0x0417 ) & ( !cKey ) ) | cKey;
#elif defined(__DJGPP__)

View File

@@ -150,7 +150,7 @@ TOOLS_LIB_OBJS = \
$(OBJ_DIR)\ctmisc.obj \
$(OBJ_DIR)\datetime.obj \
$(OBJ_DIR)\dattime2.obj \
$(OBJ_DIR)\invertwin.obj \
$(OBJ_DIR)\invrtwin.obj \
$(OBJ_DIR)\numconv.obj \
$(OBJ_DIR)\screen2.obj \
$(OBJ_DIR)\setlast.obj \
@@ -423,10 +423,10 @@ $(OBJ_DIR)\dattime2.obj : $(OBJ_DIR)\dattime2.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\invertwin.c : $(TOOLS_DIR)\invertwin.prg
$(OBJ_DIR)\invrtwin.c : $(TOOLS_DIR)\invrtwin.prg
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
$(OBJ_DIR)\invertwin.obj : $(OBJ_DIR)\invertwin.c
$(OBJ_DIR)\invrtwin.obj : $(OBJ_DIR)\invrtwin.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,

View File

@@ -72,60 +72,60 @@
static int s_daysinmonth[ 12 ] =
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
BOOL hb_isleapyear( long lYear )
BOOL hb_isleapyear( int iYear )
{
HB_TRACE(HB_TR_DEBUG, ("hb_isleapyear(%ld)", lYear));
HB_TRACE(HB_TR_DEBUG, ("hb_isleapyear(%d)", iYear));
return ( lYear % 4 == 0 && lYear % 100 != 0 ) || ( lYear % 400 == 0 );
return ( iYear % 4 == 0 && iYear % 100 != 0 ) || ( iYear % 400 == 0 );
}
long hb_daysinmonth( long lYear, long lMonth )
int hb_daysinmonth( int iYear, int iMonth )
{
HB_TRACE(HB_TR_DEBUG, ("hb_daysinmonth(%ld, %ld)", lYear, lMonth));
HB_TRACE(HB_TR_DEBUG, ("hb_daysinmonth(%d, %d)", iYear, iMonth));
if( lMonth > 0 && lMonth < 13 )
return s_daysinmonth[ lMonth - 1 ] +
( ( lMonth == 2 && hb_isleapyear( lYear ) ) ? 1 : 0 );
if( iMonth > 0 && iMonth < 13 )
return s_daysinmonth[ iMonth - 1 ] +
( ( iMonth == 2 && hb_isleapyear( iYear ) ) ? 1 : 0 );
else
return 0;
}
long hb_doy( long lYear, long lMonth, long lDay )
int hb_doy( int iYear, int iMonth, int iDay )
{
int i;
int iDoy = 0;
HB_TRACE(HB_TR_DEBUG, ("hb_doy(%ld, %ld, %ld)", lYear, lMonth, lDay));
HB_TRACE(HB_TR_DEBUG, ("hb_doy(%d, %d, %d)", iYear, iMonth, iDay));
for( i = 1; i < lMonth; i++ )
iDoy += hb_daysinmonth( lYear, i );
for( i = 1; i < iMonth; i++ )
iDoy += hb_daysinmonth( iYear, i );
return iDoy + lDay;
return iDoy + iDay;
}
long hb_wom( long lYear, long lMonth, long lDay )
int hb_wom( int iYear, int iMonth, int iDay )
{
int iWom;
HB_TRACE(HB_TR_DEBUG, ("hb_wom(%ld, %ld, %ld)", lYear, lMonth, lDay));
HB_TRACE(HB_TR_DEBUG, ("hb_wom(%d, %d, %d)", iYear, iMonth, iDay));
iWom = lDay + hb_dateDOW( lYear, lMonth, 1 ) - 1;
iWom = iDay + hb_dateDOW( iYear, iMonth, 1 ) - 1;
if( iWom > 0 )
return ( iWom - hb_dateDOW( lYear, lMonth, lDay ) ) / 7 + 1;
return ( iWom - hb_dateDOW( iYear, iMonth, iDay ) ) / 7 + 1;
else
return 0;
}
long hb_woy( long lYear, long lMonth, long lDay, BOOL bISO )
int hb_woy( int iYear, int iMonth, int iDay, BOOL bISO )
{
int iWeek, n;
HB_TRACE(HB_TR_DEBUG, ("hb_woy(%ld, %ld, %ld, %d)", lYear, lMonth, lDay, (int) bISO));
HB_TRACE(HB_TR_DEBUG, ("hb_woy(%d, %d, %d, %d)", iYear, iMonth, iDay, (int) bISO));
lDay = hb_doy( lYear, lMonth, lDay );
iDay = hb_doy( iYear, iMonth, iDay );
n = ( ( ( 1 - ( bISO ? 1 : 0 ) ) % 7 ) ) - 1;
lDay += ( n > 0 ) ? 1 : 0;
iWeek = lDay / 7;
iDay += ( n > 0 ) ? 1 : 0;
iWeek = iDay / 7;
if( bISO )
iWeek += ( n < 4 ) ? 1 : 0;
else
@@ -170,10 +170,10 @@ HB_FUNC( ISLEAPYEAR )
if( pDate )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
hb_dateDecode( hb_itemGetDL( pDate ), &lYear, &lMonth, &lDay );
hb_retl( hb_isleapyear( lYear ) );
hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );
hb_retl( hb_isleapyear( iYear ) );
}
else
hb_retl( FALSE );
@@ -185,10 +185,10 @@ HB_FUNC( DAYSINMONTH )
if( pDate )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
hb_dateDecode( hb_itemGetDL( pDate ), &lYear, &lMonth, &lDay );
hb_retni( hb_daysinmonth( lYear, lMonth ) );
hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );
hb_retni( hb_daysinmonth( iYear, iMonth ) );
}
else
hb_retni( 0 );
@@ -200,10 +200,10 @@ HB_FUNC( EOM )
if( pDate )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
hb_dateDecode( hb_itemGetDL( pDate ), &lYear, &lMonth, &lDay );
hb_retd( lYear, lMonth, hb_daysinmonth( lYear, lMonth ) );
hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );
hb_retd( iYear, iMonth, hb_daysinmonth( iYear, iMonth ) );
}
else
hb_retdl( 0 );
@@ -215,10 +215,10 @@ HB_FUNC( BOM )
if( pDate )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
hb_dateDecode( hb_itemGetDL( pDate ), &lYear, &lMonth, &lDay );
hb_retd( lYear, lMonth, 1 );
hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );
hb_retd( iYear, iMonth, 1 );
}
else
hb_retdl( 0 );
@@ -230,10 +230,10 @@ HB_FUNC( WOM )
if( pDate )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
hb_dateDecode( hb_itemGetDL( pDate ), &lYear, &lMonth, &lDay );
hb_retni( hb_wom( lYear, lMonth, lDay ) );
hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );
hb_retni( hb_wom( iYear, iMonth, iDay ) );
}
else
hb_retni( 0 );
@@ -245,10 +245,10 @@ HB_FUNC( DOY )
if( pDate )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
hb_dateDecode( hb_itemGetDL( pDate ), &lYear, &lMonth, &lDay );
hb_retni( hb_doy( lYear, lMonth, lDay ) );
hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );
hb_retni( hb_doy( iYear, iMonth, iDay ) );
}
else
hb_retni( 0 );
@@ -262,10 +262,10 @@ HB_FUNC( WOY )
if( pDate )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
hb_dateDecode( hb_itemGetDL( pDate ), &lYear, &lMonth, &lDay );
hb_retni( hb_woy( lYear, lMonth, lDay, ISLOG( 2 ) ? hb_parl( 2 ) : TRUE ) );
hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );
hb_retni( hb_woy( iYear, iMonth, iDay, ISLOG( 2 ) ? hb_parl( 2 ) : TRUE ) );
}
else
hb_retni( 0 );
@@ -277,10 +277,10 @@ HB_FUNC( EOY )
if( pDate )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
hb_dateDecode( hb_itemGetDL( pDate ), &lYear, &lMonth, &lDay );
hb_retd( lYear, 12, 31 );
hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );
hb_retd( iYear, 12, 31 );
}
else
hb_retdl( 0 );
@@ -292,10 +292,10 @@ HB_FUNC( BOY )
if( pDate )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
hb_dateDecode( hb_itemGetDL( pDate ), &lYear, &lMonth, &lDay );
hb_retd( lYear, 1, 1 );
hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );
hb_retd( iYear, 1, 1 );
}
else
hb_retdl( 0 );

View File

@@ -88,8 +88,8 @@ extern ADSHANDLE adsConnectHandle;
#endif
HB_INIT_SYMBOLS_BEGIN( ads1__InitSymbols )
{ "_ADS", HB_FS_PUBLIC, HB_FUNCNAME( _ADS ), NULL },
{ "ADS_GETFUNCTABLE", HB_FS_PUBLIC, HB_FUNCNAME( ADS_GETFUNCTABLE ), NULL }
{ "_ADS", HB_FS_PUBLIC, {HB_FUNCNAME( _ADS )}, NULL },
{ "ADS_GETFUNCTABLE", HB_FS_PUBLIC, {HB_FUNCNAME( ADS_GETFUNCTABLE )}, NULL }
HB_INIT_SYMBOLS_END( ads1__InitSymbols )
#if defined(_MSC_VER)
@@ -105,7 +105,7 @@ HB_INIT_SYMBOLS_END( ads1__InitSymbols )
#pragma startup ads1__InitSymbols
#endif
static RDDFUNCS adsSuper = { NULL };
static RDDFUNCS adsSuper;
void adsSetListener_callback( HB_set_enum setting, HB_set_listener_enum when )
{
@@ -167,6 +167,7 @@ static void commonError( ADSAREAP pArea, USHORT uiGenCode, USHORT uiSubCode, cha
return;
}
#if 0
static void DumpArea( ADSAREAP pArea ) /* For debugging: call this to dump ads server settings to HB_TRACE. Currently in a quick-and-dirty state... */
{
UNSIGNED8 pucTemp[1025];
@@ -215,7 +216,7 @@ static void DumpArea( ADSAREAP pArea ) /* For debugging: call this to dump ads
}
}
}
#endif
/*
static BOOL hb_nltoa( LONG lValue, char * szBuffer, USHORT uiLen )
{
@@ -1245,7 +1246,7 @@ static ERRCODE adsPutValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
USHORT uiCount;
BYTE * szText;
BOOL bTypeError = TRUE;
long lDay, lMonth, lYear;
int iDay, iMonth, iYear;
UNSIGNED8 pucFormat[ 11 ];
UNSIGNED16 pusLen = 11;
@@ -1339,8 +1340,8 @@ static ERRCODE adsPutValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
bTypeError = FALSE;
AdsGetDateFormat ( pucFormat, &pusLen );
AdsSetDateFormat ( (UNSIGNED8*)"YYYYMMDD" );
hb_dateDecode( hb_itemGetDL( pItem ), &lYear, &lMonth, &lDay );
hb_dateStrPut( ( char * ) szText, lYear, lMonth, lDay );
hb_dateDecode( hb_itemGetDL( pItem ), &iYear, &iMonth, &iDay );
hb_dateStrPut( ( char * ) szText, iYear, iMonth, iDay );
ulRetVal = AdsSetDate( pArea->hTable, ADSFIELD( uiIndex ), szText, 8 );
AdsSetDateFormat ( pucFormat );
}
@@ -1745,7 +1746,7 @@ static ERRCODE adsOpen( ADSAREAP pArea, LPDBOPENINFO pOpenInfo )
USHORT uiFields, uiCount;
UNSIGNED8 szName[ ADS_MAX_FIELD_NAME + 1 ];
/* See adsGettValue() for why we don't use pArea->uiMaxFieldNameLength here */
UNSIGNED16 pusBufLen, pusType;
UNSIGNED16 pusBufLen, pusType, pusDecimals;
DBFIELDINFO dbFieldInfo;
HB_TRACE(HB_TR_DEBUG, ("adsOpen(%p)", pArea));
@@ -1829,8 +1830,8 @@ static ERRCODE adsOpen( ADSAREAP pArea, LPDBOPENINFO pOpenInfo )
case ADS_TIMESTAMP:
case ADS_AUTOINC:
dbFieldInfo.uiType = HB_IT_LONG;
AdsGetFieldDecimals( pArea->hTable, szName, ( UNSIGNED16 * ) &pulLength );
dbFieldInfo.uiDec = ( USHORT ) pulLength;
AdsGetFieldDecimals( pArea->hTable, szName, ( UNSIGNED16 * ) &pusDecimals );
dbFieldInfo.uiDec = ( USHORT ) pusDecimals;
break;
case ADS_LOGICAL:
@@ -2711,7 +2712,7 @@ static ERRCODE adsScopeInfo( ADSAREAP pArea, USHORT nScope, PHB_ITEM pItem )
static ERRCODE adsSetFilter( ADSAREAP pArea, LPDBFILTERINFO pFilterInfo )
{
BOOL bValidExpr = FALSE;
UNSIGNED16 bValidExpr = FALSE;
UNSIGNED16 usResolve = ADS_RESOLVE_DYNAMIC ; /*ADS_RESOLVE_IMMEDIATE ;get this from a SETting*/
UNSIGNED32 ulRetVal = AE_INVALID_EXPRESSION;
@@ -2730,7 +2731,6 @@ static ERRCODE adsSetFilter( ADSAREAP pArea, LPDBFILTERINFO pFilterInfo )
if ( bValidExpr )
{
if ( hb_set.HB_SET_OPTIMIZE )
{
ulRetVal = AdsSetAOF( pArea->hTable, (UNSIGNED8*) hb_itemGetCPtr( pFilterInfo->abFilterText), usResolve );
@@ -2742,7 +2742,7 @@ static ERRCODE adsSetFilter( ADSAREAP pArea, LPDBFILTERINFO pFilterInfo )
} /* else let SUPER handle filtering */
}
return ulRetVal == AE_SUCCESS ? SUCCESS : FAILURE ;
return ulRetVal == AE_SUCCESS ? SUCCESS : FAILURE;
}
#define adsSetLocate NULL
@@ -3108,10 +3108,10 @@ HB_FUNC( ADS_GETFUNCTABLE )
uiCount = ( USHORT * ) hb_itemGetPtr( hb_param( 1, HB_IT_POINTER ) );
* uiCount = RDDFUNCSCOUNT;
pTable = ( RDDFUNCS * ) hb_itemGetPtr( hb_param( 2, HB_IT_POINTER ) );
HB_TRACE(HB_TR_DEBUG, ("ADS_GETFUNCTABLE(%i, %p)", *uiCount, pTable));
pTable = ( RDDFUNCS * ) hb_itemGetPtr( hb_param( 2, HB_IT_POINTER ) );
if( pTable )
{
iSetListenerHandle = hb_setListenerAdd( adsSetListener_callback );
@@ -3197,7 +3197,7 @@ HB_FUNC( ADSCUSTOMIZEAOF )
{
ADSAREAP pArea;
UNSIGNED32 ulNumRecs = 0;
UNSIGNED32 ulRecord;
UNSIGNED32 ulRecord = 0;
UNSIGNED32 *pulRecords;
UNSIGNED16 usOption = ADS_AOF_ADD_RECORD;
UNSIGNED32 ulRetVal = AE_SUCCESS + 1; /* initialize to something other than success */

View File

@@ -226,7 +226,7 @@ HB_FUNC( ADSGETSERVERTIME )
SIGNED32 plTime = 0;
ADSHANDLE hConnect = ISNUM( 1 ) ? hb_parnl( 1 ) : adsConnectHandle;
ADSHANDLE hConnect = ISNUM( 1 ) ? ( ADSHANDLE ) hb_parnl( 1 ) : adsConnectHandle;
ulRetVal = AdsGetServerTime( hConnect, pucDateBuf, &pusDateBufLen, &plTime, pucTimeBuf, &pusTimeBufLen );
@@ -1375,14 +1375,14 @@ HB_FUNC( ADSISINDEXED )
HB_FUNC( ADSISEXPRVALID ) /* cExpr */
{
ADSAREAP pArea;
BOOL bValidExpr = FALSE;
UNSIGNED16 bValidExpr = FALSE;
pArea = (ADSAREAP) hb_rddGetCurrentWorkAreaPointer();
if(pArea && ISCHAR( 1 ) )
if( pArea && ISCHAR( 1 ) )
AdsIsExprValid( pArea->hTable, (UNSIGNED8*) hb_parc( 1 ),
(UNSIGNED16*) &bValidExpr );
hb_retl(bValidExpr);
hb_retl( bValidExpr != FALSE );
}
HB_FUNC( ADSGETNUMINDEXES ) /* cExpr */
@@ -1428,11 +1428,7 @@ HB_FUNC( ADSGETNUMOPENTABLES )
HB_FUNC( ADSSHOWERROR )
{
UNSIGNED8* pucTitle;
if( ISCHAR( 1 ) )
{
pucTitle = (UNSIGNED8*) hb_parc( 1 );
}
UNSIGNED8* pucTitle = ISCHAR( 1 ) ? (UNSIGNED8*) hb_parc( 1 ) : NULL;
AdsShowError( pucTitle );
}
@@ -1911,4 +1907,4 @@ HB_FUNC( ADSCOPYTABLECONTENTS )
}
#endif /* ADS_REQUIRE_VERSION6 */
/* Please add all-version functions above this block */
/* Please add all-version functions above this block */

View File

@@ -59,23 +59,23 @@
*/
HB_FUNC( MDY )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
char szDate[ 9 ];
char szFormatted[ 11 ];
char * szReturn;
int iBufferLen;
int iLen;
hb_dateDecode( hb_parnl( 1 ), &lYear, &lMonth, &lDay );
hb_dateDecode( hb_parnl( 1 ), &iYear, &iMonth, &iDay );
hb_dateFormat( hb_pardsbuff( szDate, 1 ), szFormatted, "MM/DD/YYYY" );
iLen = strlen( hb_dateCMonth( lMonth ) );
iLen = strlen( hb_dateCMonth( iMonth ) );
iBufferLen = iLen + ( hb_set.hb_set_century ? 9 : 7 );
szReturn = ( char * ) hb_xgrab( iBufferLen );
memset( szReturn, ' ', iBufferLen + 1 );
memcpy( szReturn, hb_dateCMonth( lMonth ), iLen );
memcpy( szReturn, hb_dateCMonth( iMonth ), iLen );
memcpy( szReturn + iLen + 1, szFormatted + 3, 2 );
szReturn[ iLen + 3 ] = ',';
memcpy( szReturn + iLen + 5, szFormatted + 6 + ( hb_set.hb_set_century ? 0 : 2 ), 2 + ( hb_set.hb_set_century ? 2 : 0 ) );
@@ -88,24 +88,24 @@ HB_FUNC( MDY )
*/
HB_FUNC( DMY )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
char szDate[ 9 ];
char szFormatted[ 11 ];
char * szReturn;
int iBufferLen;
int iLen;
hb_dateDecode( hb_parnl( 1 ), &lYear, &lMonth, &lDay );
hb_dateDecode( hb_parnl( 1 ), &iYear, &iMonth, &iDay );
hb_dateFormat( hb_pardsbuff( szDate, 1 ), szFormatted, "MM/DD/YYYY" );
iLen = strlen( hb_dateCMonth( lMonth ) );
iLen = strlen( hb_dateCMonth( iMonth ) );
iBufferLen = iLen + ( hb_set.hb_set_century ? 9 : 7 );
szReturn = ( char * ) hb_xgrab( iBufferLen );
memset( szReturn, ' ', iBufferLen );
memcpy( szReturn, szFormatted + 3, 2 );
memcpy( szReturn + 3, hb_dateCMonth( lMonth ), iLen );
memcpy( szReturn + 3, hb_dateCMonth( iMonth ), iLen );
memcpy( szReturn + iLen + 4, szFormatted + 6 + ( hb_set.hb_set_century ? 0 : 2 ), 2 + ( hb_set.hb_set_century ? 2 : 0 ) );
hb_retclen( szReturn, iBufferLen );
@@ -116,27 +116,27 @@ HB_FUNC( DMY )
*/
HB_FUNC( DATEASAGE )
{
long lAge = 0;
int iAge = 0;
PHB_ITEM pDate = hb_param( 1, HB_IT_DATE );
if( pDate )
{
long lYear, lMonth, lDay;
long lThisYear, lThisMonth, lThisDay;
int iYear, iMonth, iDay;
int iThisYear, iThisMonth, iThisDay;
hb_dateToday( &lThisYear, &lThisMonth, &lThisDay );
hb_dateDecode( hb_itemGetDL( pDate ), &lYear, &lMonth, &lDay );
hb_dateToday( &iThisYear, &iThisMonth, &iThisDay );
hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );
if( lThisYear > lYear )
if( iThisYear > iYear )
{
lAge = lThisYear - lYear;
iAge = iThisYear - iYear;
if( lThisMonth < lMonth || ( lThisMonth == lMonth && lThisDay < lDay ) )
--lAge;
if( iThisMonth < iMonth || ( iThisMonth == iMonth && iThisDay < iDay ) )
--iAge;
}
}
hb_retnl( lAge );
hb_retni( iAge );
}
/* ADDMONTH( <dDate>, <nMonths> ) --> <dNewDate>
@@ -144,39 +144,39 @@ HB_FUNC( DATEASAGE )
*/
HB_FUNC( ADDMONTH )
{
long lMonths = hb_parnl( 2 );
long lYear, lMonth, lDay;
int iMonths = hb_parnl( 2 );
int iYear, iMonth, iDay;
int iLimit, iMonthAdd, iYearAdd;
long lNew;
hb_dateDecode( hb_parnl( 1 ), &lYear, &lMonth, &lDay );
hb_dateDecode( hb_parnl( 1 ), &iYear, &iMonth, &iDay );
iLimit = 12 - lMonth + 1;
iYearAdd = lMonths / 12;
lMonths %= 12;
iLimit = 12 - iMonth + 1;
iYearAdd = iMonths / 12;
iMonths %= 12;
if( lMonths >= iLimit )
if( iMonths >= iLimit )
iYearAdd++;
lYear += iYearAdd;
iYear += iYearAdd;
iMonthAdd = lMonths % 12;
lMonth = ( lMonth + iMonthAdd ) % 12;
iMonthAdd = iMonths % 12;
iMonth = ( iMonth + iMonthAdd ) % 12;
if( lMonth == 0 )
lMonth = 12;
if( iMonth == 0 )
iMonth = 12;
lNew = hb_dateEncode( lYear, lMonth, lDay );
lNew = hb_dateEncode( iYear, iMonth, iDay );
if( !lNew )
{
lMonth = ( lMonth + 1 ) % 12;
lDay = 1;
lYear = lYear + ( ( lMonth + 1 ) / 12 );
iMonth = ( iMonth + 1 ) % 12;
iDay = 1;
iYear = iYear + ( ( iMonth + 1 ) / 12 );
}
hb_retd( lYear, lMonth, lDay );
hb_retd( iYear, iMonth, iDay );
}
/* DATEASARRAY( <dDate> ) --> { Year, Month, Day }
@@ -190,19 +190,19 @@ HB_FUNC( DATEASARRAY )
if( pDate )
{
PHB_ITEM pItem;
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
hb_dateDecode( hb_itemGetDL( pDate ), &lYear, &lMonth, &lDay );
hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );
pItem = hb_itemPutNL( NULL, lYear );
pItem = hb_itemPutNI( NULL, iYear );
hb_itemArrayPut( pReturn, 1, pItem );
hb_itemRelease( pItem );
pItem = hb_itemPutNL( NULL, lMonth );
pItem = hb_itemPutNI( NULL, iMonth );
hb_itemArrayPut( pReturn, 2, pItem );
hb_itemRelease( pItem );
pItem = hb_itemPutNL( NULL, lDay );
pItem = hb_itemPutNI( NULL, iDay );
hb_itemArrayPut( pReturn, 3, pItem );
hb_itemRelease( pItem );
}
@@ -218,7 +218,7 @@ HB_FUNC( ARRAYASDATE )
PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
if( pArray )
hb_retd( hb_arrayGetNL( pArray, 1 ), hb_arrayGetNL( pArray, 2 ), hb_arrayGetNL( pArray, 3 ) );
hb_retd( hb_arrayGetNI( pArray, 1 ), hb_arrayGetNI( pArray, 2 ), hb_arrayGetNI( pArray, 3 ) );
else
hb_retdl( 0 );
}
@@ -231,11 +231,11 @@ HB_FUNC( DATEISLEAP )
if( pDate )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
hb_dateDecode( hb_itemGetDL( pDate ), &lYear, &lMonth, &lDay );
hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );
hb_retl( ( lYear % 4 == 0 && lYear % 100 != 0 ) || ( lYear % 400 == 0 ) );
hb_retl( ( iYear % 4 == 0 && iYear % 100 != 0 ) || ( iYear % 400 == 0 ) );
}
else
hb_retl( FALSE );
@@ -245,5 +245,5 @@ HB_FUNC( DATEISLEAP )
*/
HB_FUNC( NTOD )
{
hb_retd( hb_parnl( 3 ), hb_parnl( 1 ), hb_parnl( 2 ) );
hb_retd( hb_parni( 3 ), hb_parni( 1 ), hb_parni( 2 ) );
}

View File

@@ -113,6 +113,11 @@
/* Harbour extensions */
#define DBOI_SKIPEVAL 100 /* skip while code block doesn't return TRUE */
#define DBOI_SKIPEVALBACK 101 /* skip backward while code block doesn't return TRUE */
#define DBOI_SKIPREGEX 102 /* skip while regular expression on index key doesn't return TRUE */
#define DBOI_SKIPREGEXBACK 103 /* skip backward while regular expression on index key doesn't return TRUE */
#define DBOI_SKIPWILD 104 /* skip while while comparison with given pattern with wildcards doesn't return TRUE */
#define DBOI_SKIPWILDBACK 105 /* skip backward while comparison with given pattern with wildcards doesn't return TRUE */
#define DBOI_SCOPEEVAL 106 /* skip through index evaluating given C function */
/* Return values for DBOI_OPTLEVEL */
#define DBOI_OPTIMIZED_NONE 0
@@ -126,6 +131,13 @@
#define DBRI_RECNO 4
#define DBRI_UPDATED 5
/* constants for some SCOPED DBOI_* parameter */
#define DBRMI_FUNCTION 1
#define DBRMI_PARAM 2
#define DBRMI_LOVAL 3
#define DBRMI_HIVAL 4
#define DBRMI_RESULT 5
#define DBRMI_SIZE 5
/* constants for dbInfo() */
#define DBI_ISDBF 1 /* Does this RDD support DBFs? */
@@ -160,6 +172,37 @@
#define DBI_DB_VERSION 101 /* Version of the Host driver */
#define DBI_RDD_VERSION 102 /* current RDD's version */
/* HARBOUR extension */
#define DBI_LOCKSCHEME 128 /* Locking scheme used by RDD */
#define DBI_ISREADONLY 129 /* Was the file opened readonly? */
#define DBI_ROLLBACK 130 /* Rollback changes made to current record */
#define DBI_USER 1000 /* User-defined DBI_ constants */
/* BLOB support - definitions for internal use by BLOB.CH */
#define DBI_BLOB_DIRECT_EXPORT 201
#define DBI_BLOB_DIRECT_GET 202
#define DBI_BLOB_DIRECT_IMPORT 203
#define DBI_BLOB_DIRECT_PUT 204
#define DBI_BLOB_ROOT_GET 205
#define DBI_BLOB_ROOT_PUT 206
#define DBI_BLOB_ROOT_LOCK 207
#define DBI_BLOB_ROOT_UNLOCK 208
/* CA-CLIPPER documented for public use */
#define DBI_BLOB_DIRECT_LEN 209
#define DBI_BLOB_DIRECT_TYPE 210
#define DBI_BLOB_INTEGRITY 211
#define DBI_BLOB_OFFSET 212
#define DBI_BLOB_RECOVER 213
#define DBS_BLOB_GET 201 /* This is internal definition */
#define DBS_BLOB_LEN 202
#define DBS_BLOB_OFFSET 203
#define DBS_BLOB_POINTER 204
#define DBS_BLOB_TYPE 205
#define BLOB_EXPORT_APPEND 1
#define BLOB_EXPORT_OVERWRITE 0
#endif /* HB_DBINFO_CH_ */

View File

@@ -73,7 +73,6 @@ extern "C" {
#define HB_IT_LONG ( ( USHORT ) 0x0008 )
#define HB_IT_DOUBLE ( ( USHORT ) 0x0010 )
#define HB_IT_DATE ( ( USHORT ) 0x0020 )
#define HB_IT_LONGLONG ( ( USHORT ) 0x0040 )
#define HB_IT_LOGICAL ( ( USHORT ) 0x0080 )
#define HB_IT_SYMBOL ( ( USHORT ) 0x0100 )
#define HB_IT_ALIAS ( ( USHORT ) 0x0200 )
@@ -86,7 +85,9 @@ extern "C" {
#define HB_IT_ARRAY ( ( USHORT ) 0x8000 )
#define HB_IT_OBJECT HB_IT_ARRAY
#define HB_IT_NUMERIC ( ( USHORT ) ( HB_IT_INTEGER | HB_IT_LONG | HB_IT_DOUBLE ) )
#define HB_IT_NUMINT ( ( USHORT ) ( HB_IT_INTEGER | HB_IT_LONG ) )
#define HB_IS_NUMBER( p ) ( ( p )->type & HB_IT_NUMERIC )
#define HB_IS_NUMINT( p ) ( ( p )->type & HB_IT_NUMINT )
#define HB_IT_ANY ( ( USHORT ) 0xFFFF )
#define HB_IS_OF_TYPE( p, t ) ( ( ( p )->type & ~HB_IT_BYREF ) == t )
@@ -107,6 +108,12 @@ extern "C" {
#define HB_IS_MEMVAR( p ) HB_IS_OF_TYPE( p, HB_IT_MEMVAR )
#define HB_IS_POINTER( p ) HB_IS_OF_TYPE( p, HB_IT_POINTER )
#if defined(__GNUC__)
# define HB_ITEM_NIL { HB_IT_NIL, {} }
#else
# define HB_ITEM_NIL { HB_IT_NIL, NULL }
#endif
#define ISNIL( n ) ( hb_param( n, HB_IT_ANY ) == NULL || HB_IS_NIL( hb_param( n, HB_IT_ANY ) ) ) /* NOTE: Intentionally using a different method */
#define ISCHAR( n ) ( hb_param( n, HB_IT_STRING ) != NULL )
#define ISNUM( n ) ( hb_param( n, HB_IT_NUMERIC ) != NULL )
@@ -172,7 +179,7 @@ struct hb_struLogical
struct hb_struLong
{
USHORT length;
long value;
HB_LONG value;
};
struct hb_struMemvar
@@ -283,21 +290,25 @@ typedef USHORT ERRCODE;
extern HB_SYMB hb_symEval;
/* Extend API */
extern char HB_EXPORT * hb_parc( int iParam, ... ); /* retrieve a string parameter */
extern ULONG HB_EXPORT hb_parclen( int iParam, ... ); /* retrieve a string parameter length */
extern ULONG HB_EXPORT hb_parcsiz( int iParam, ... ); /* retrieve a by-reference string parameter length, including terminator */
extern char HB_EXPORT * hb_pards( int iParam, ... ); /* retrieve a date as a string yyyymmdd */
extern char HB_EXPORT * hb_pardsbuff( char * szDate, int iParam, ... ); /* retrieve a date as a string yyyymmdd */
extern ULONG HB_EXPORT hb_parinfa( int iParamNum, ULONG uiArrayIndex ); /* retrieve length or element type of an array parameter */
extern int HB_EXPORT hb_parinfo( int iParam ); /* Determine the param count or data type */
extern int HB_EXPORT hb_parl( int iParam, ... ); /* retrieve a logical parameter as an int */
extern double HB_EXPORT hb_parnd( int iParam, ... ); /* retrieve a numeric parameter as a double */
extern int HB_EXPORT hb_parni( int iParam, ... ); /* retrieve a numeric parameter as a integer */
extern long HB_EXPORT hb_parnl( int iParam, ... ); /* retrieve a numeric parameter as a long */
extern void HB_EXPORT * hb_parptr( int iParam, ... ); /* retrieve a parameter as a pointer */
extern PHB_ITEM HB_EXPORT hb_param( int iParam, int iMask ); /* retrieve a generic parameter */
extern PHB_ITEM HB_EXPORT hb_paramError( int iParam ); /* Returns either the generic parameter or a NIL item if param not provided */
extern BOOL HB_EXPORT hb_extIsArray( int iParam );
extern char HB_EXPORT * hb_parc( int iParam, ... ); /* retrieve a string parameter */
extern ULONG HB_EXPORT hb_parclen( int iParam, ... ); /* retrieve a string parameter length */
extern ULONG HB_EXPORT hb_parcsiz( int iParam, ... ); /* retrieve a by-reference string parameter length, including terminator */
extern char HB_EXPORT * hb_pards( int iParam, ... ); /* retrieve a date as a string yyyymmdd */
extern char HB_EXPORT * hb_pardsbuff( char * szDate, int iParam, ... ); /* retrieve a date as a string yyyymmdd */
extern ULONG HB_EXPORT hb_parinfa( int iParamNum, ULONG uiArrayIndex ); /* retrieve length or element type of an array parameter */
extern int HB_EXPORT hb_parinfo( int iParam ); /* Determine the param count or data type */
extern int HB_EXPORT hb_parl( int iParam, ... ); /* retrieve a logical parameter as an int */
extern double HB_EXPORT hb_parnd( int iParam, ... ); /* retrieve a numeric parameter as a double */
extern int HB_EXPORT hb_parni( int iParam, ... ); /* retrieve a numeric parameter as a integer */
extern long HB_EXPORT hb_parnl( int iParam, ... ); /* retrieve a numeric parameter as a long */
extern HB_LONG HB_EXPORT hb_parnint( int iParam, ... ); /* retrieve a numeric parameter as a HB_LONG */
extern void HB_EXPORT * hb_parptr( int iParam, ... ); /* retrieve a parameter as a pointer */
extern PHB_ITEM HB_EXPORT hb_param( int iParam, int iMask ); /* retrieve a generic parameter */
extern PHB_ITEM HB_EXPORT hb_paramError( int iParam ); /* Returns either the generic parameter or a NIL item if param not provided */
extern BOOL HB_EXPORT hb_extIsArray( int iParam );
#ifndef HB_LONG_LONG_OFF
extern LONGLONG HB_EXPORT hb_parnll( int iParam, ... ); /* retrieve a numeric parameter as a long long */
#endif
#ifndef HB_NO_DEFAULT_API_MACROS
#ifndef HB_API_MACROS
@@ -326,10 +337,14 @@ extern BOOL HB_EXPORT hb_extIsArray( int iParam );
#define hb_retnd( dNumber ) hb_itemPutND( &hb_stack.Return, dNumber )
#define hb_retni( iNumber ) hb_itemPutNI( &hb_stack.Return, iNumber )
#define hb_retnl( lNumber ) hb_itemPutNL( &hb_stack.Return, lNumber )
#define hb_retnll( lNumber ) hb_itemPutNLL( &hb_stack.Return, lNumber )
#define hb_retnlen( dNumber, iWidth, iDec ) hb_itemPutNLen( &hb_stack.Return, dNumber, iWidth, iDec )
#define hb_retndlen( dNumber, iWidth, iDec ) hb_itemPutNDLen( &hb_stack.Return, dNumber, iWidth, iDec )
#define hb_retnilen( iNumber, iWidth ) hb_itemPutNILen( &hb_stack.Return, iNumber, iWidth )
#define hb_retnllen( lNumber, iWidth ) hb_itemPutNLLen( &hb_stack.Return, lNumber, iWidth )
#define hb_retnlllen( lNumber, iWidth ) hb_itemPutNLLLen( &hb_stack.Return, lNumber, iWidth )
#define hb_retnint( iNumber ) hb_itemPutNInt( &hb_stack.Return, iNumber )
#define hb_retnintlen( lNumber, iWidth ) hb_itemPutNIntLen( &hb_stack.Return, lNumber, iWidth )
#define hb_retptr( pointer ) hb_itemPutPtr( &hb_stack.Return, pointer )
#else
@@ -343,18 +358,24 @@ extern void HB_EXPORT hb_retc_const( char * szText ); /* returns a string as a
extern void HB_EXPORT hb_retclen( char * szText, ULONG ulLen ); /* returns a string with a specific length */
extern void HB_EXPORT hb_retclen_buffer( char * szText, ULONG ulLen ); /* sames as above, but accepts an allocated buffer */
extern void HB_EXPORT hb_retds( char * szDate ); /* returns a date, must use yyyymmdd format */
extern void HB_EXPORT hb_retd( long lYear, long lMonth, long lDay ); /* returns a date */
extern void HB_EXPORT hb_retd( int iYear, int iMonth, int iDay ); /* returns a date */
extern void HB_EXPORT hb_retdl( long lJulian ); /* returns a long value as a julian date */
extern void HB_EXPORT hb_retl( int iTrueFalse ); /* returns a logical integer */
extern void HB_EXPORT hb_retnd( double dNumber ); /* returns a double */
extern void HB_EXPORT hb_retni( int iNumber ); /* returns a integer number */
extern void HB_EXPORT hb_retnl( long lNumber ); /* returns a long number */
extern void HB_EXPORT hb_retnl( long lNumber );/* returns a long number */
extern void HB_EXPORT hb_retnint( HB_LONG lNumber );/* returns a long number */
extern void HB_EXPORT hb_retnlen( double dNumber, int iWidth, int iDec ); /* returns a double, with specific width and decimals */
extern void HB_EXPORT hb_retndlen( double dNumber, int iWidth, int iDec ); /* returns a double, with specific width and decimals */
extern void HB_EXPORT hb_retnilen( int iNumber, int iWidth ); /* returns a integer number, with specific width */
extern void HB_EXPORT hb_retnllen( long lNumber, int iWidth ); /* returns a long number, with specific width */
extern void HB_EXPORT hb_retnintlen( HB_LONG lNumber, int iWidth ); /* returns a long long number, with specific width */
extern void HB_EXPORT hb_reta( ULONG ulLen ); /* returns an array with a specific length */
extern void HB_EXPORT hb_retptr( void * ptr ); /* returns a pointer */
#ifndef HB_LONG_LONG_OFF
extern void HB_EXPORT hb_retnll( LONGLONG lNumber );/* returns a long long number */
extern void HB_EXPORT hb_retnlllen( LONGLONG lNumber, int iWidth ); /* returns a long long number, with specific width */
#endif
#endif
@@ -365,7 +386,11 @@ extern int HB_EXPORT hb_storl( int iLogical, int iParam, ... ); /* stores a l
extern int HB_EXPORT hb_storni( int iValue, int iParam, ... ); /* stores an integer on a variable by reference */
extern int HB_EXPORT hb_stornl( long lValue, int iParam, ... ); /* stores a long on a variable by reference */
extern int HB_EXPORT hb_stornd( double dValue, int iParam, ... ); /* stores a double on a variable by reference */
extern int HB_EXPORT hb_stornint( HB_LONG lValue, int iParam, ... ); /* stores a HB_LONG on a variable by reference */
extern int HB_EXPORT hb_storptr( void * pointer, int iParam, ... ); /* stores a pointer on a variable by reference */
#ifndef HB_LONG_LONG_OFF
extern int HB_EXPORT hb_stornll( LONGLONG lValue, int iParam, ... ); /* stores a long long on a variable by reference */
#endif
extern void HB_EXPORT hb_xinit( void ); /* Initialize fixed memory subsystem */
extern void HB_EXPORT hb_xexit( void ); /* Deinitialize fixed memory subsystem */
@@ -374,7 +399,7 @@ extern void HB_EXPORT * hb_xgrab( ULONG ulSize ); /* allocate
extern void HB_EXPORT hb_xfree( void * pMem ); /* frees memory */
extern void HB_EXPORT * hb_xrealloc( void * pMem, ULONG ulSize ); /* reallocates memory */
extern ULONG HB_EXPORT hb_xsize( void * pMem ); /* returns the size of an allocated memory block */
extern ULONG hb_xquery( USHORT uiMode ); /* Query different types of memory information */
extern ULONG hb_xquery( USHORT uiMode ); /* Query different types of memory information */
#if UINT_MAX == ULONG_MAX
/* NOTE: memcpy/memset can work with ULONG data blocks */
@@ -388,38 +413,42 @@ extern void * hb_xmemset( void * pDestArg, int iFill, ULONG ulLen ); /* set mo
#endif
/* array management */
extern BOOL HB_EXPORT hb_arrayNew( PHB_ITEM pItem, ULONG ulLen ); /* creates a new array */
extern ULONG HB_EXPORT hb_arrayLen( PHB_ITEM pArray ); /* retrives the array len */
extern BOOL HB_EXPORT hb_arrayIsObject( PHB_ITEM pArray ); /* retrives if the array is an object */
extern BOOL HB_EXPORT hb_arrayAdd( PHB_ITEM pArray, PHB_ITEM pItemValue ); /* add a new item to the end of an array item */
extern BOOL HB_EXPORT hb_arrayIns( PHB_ITEM pArray, ULONG ulIndex ); /* insert a nil item into an array, without changing the length */
extern BOOL HB_EXPORT hb_arrayDel( PHB_ITEM pArray, ULONG ulIndex ); /* delete an array item, without changing length */
extern BOOL HB_EXPORT hb_arraySize( PHB_ITEM pArray, ULONG ulLen ); /* sets the array total length */
extern BOOL hb_arrayLast( PHB_ITEM pArray, PHB_ITEM pResult ); /* retrieve last item in an array */
extern BOOL hb_arrayRelease( PHB_ITEM pArray ); /* releases an array - don't call it - use ItemRelease() !!! */
extern BOOL HB_EXPORT hb_arraySet( PHB_ITEM pArray, ULONG ulIndex, PHB_ITEM pItem ); /* sets an array element */
extern BOOL HB_EXPORT hb_arrayGet( PHB_ITEM pArray, ULONG ulIndex, PHB_ITEM pItem ); /* retrieves an item */
extern PHB_ITEM hb_arrayGetItemPtr( PHB_ITEM pArray, ULONG ulIndex ); /* returns pointer to specified element of the array */
extern ULONG hb_arrayCopyC( PHB_ITEM pArray, ULONG ulIndex, char * szBuffer, ULONG ulLen ); /* copy a string into an array item */
extern char * hb_arrayGetC( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the string contained on an array element */
extern char * hb_arrayGetCPtr( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the string pointer on an array element */
extern ULONG hb_arrayGetCLen( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the string length contained on an array element */
extern void * hb_arrayGetPtr( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the pointer contained on an array element */
extern BOOL hb_arrayGetL( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the logical value contained on an array element */
extern int hb_arrayGetNI( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the int value contained on an array element */
extern long hb_arrayGetNL( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the long numeric value contained on an array element */
extern double hb_arrayGetND( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the double value contained on an array element */
extern char * hb_arrayGetDS( PHB_ITEM pArray, ULONG ulIndex, char * szDate ); /* retrieves the date value contained in an array element */
extern long hb_arrayGetDL( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the date value contained in an array element, as a long integer */
extern USHORT hb_arrayGetType( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the type of an array item */
extern BOOL hb_arrayFill( PHB_ITEM pArray, PHB_ITEM pValue, ULONG * pulStart, ULONG * pulCount ); /* fill an array with a given item */
extern ULONG hb_arrayScan( PHB_ITEM pArray, PHB_ITEM pValue, ULONG * pulStart, ULONG * pulCount ); /* scan an array for a given item, or until code-block item returns TRUE */
extern BOOL hb_arrayEval( PHB_ITEM pArray, PHB_ITEM bBlock, ULONG * pulStart, ULONG * pulCount ); /* execute a code-block for every element of an array item */
extern BOOL hb_arrayCopy( PHB_ITEM pSrcArray, PHB_ITEM pDstArray, ULONG * pulStart, ULONG * pulCount, ULONG * pulTarget ); /* copy items from one array to another */
extern PHB_ITEM hb_arrayClone( PHB_ITEM pArray, PHB_NESTED_CLONED pClonedList ); /* returns a duplicate of an existing array, including all nested items */
extern BOOL hb_arraySort( PHB_ITEM pArray, ULONG * pulStart, ULONG * pulCount, PHB_ITEM pBlock ); /* sorts an array item */
extern PHB_ITEM hb_arrayFromStack( USHORT uiLen ); /* Creates and returns an Array of n Elements from the Eval Stack - Does NOT pop the items. */
extern PHB_ITEM hb_arrayFromParams( PHB_ITEM *pBase ); /* Creates and returns an Array of Generic Parameters for specified base symbol. */
extern BOOL HB_EXPORT hb_arrayNew( PHB_ITEM pItem, ULONG ulLen ); /* creates a new array */
extern ULONG HB_EXPORT hb_arrayLen( PHB_ITEM pArray ); /* retrives the array len */
extern BOOL HB_EXPORT hb_arrayIsObject( PHB_ITEM pArray ); /* retrives if the array is an object */
extern BOOL HB_EXPORT hb_arrayAdd( PHB_ITEM pArray, PHB_ITEM pItemValue ); /* add a new item to the end of an array item */
extern BOOL HB_EXPORT hb_arrayIns( PHB_ITEM pArray, ULONG ulIndex ); /* insert a nil item into an array, without changing the length */
extern BOOL HB_EXPORT hb_arrayDel( PHB_ITEM pArray, ULONG ulIndex ); /* delete an array item, without changing length */
extern BOOL HB_EXPORT hb_arraySize( PHB_ITEM pArray, ULONG ulLen ); /* sets the array total length */
extern BOOL hb_arrayLast( PHB_ITEM pArray, PHB_ITEM pResult ); /* retrieve last item in an array */
extern BOOL hb_arrayRelease( PHB_ITEM pArray ); /* releases an array - don't call it - use ItemRelease() !!! */
extern BOOL HB_EXPORT hb_arraySet( PHB_ITEM pArray, ULONG ulIndex, PHB_ITEM pItem ); /* sets an array element */
extern BOOL HB_EXPORT hb_arrayGet( PHB_ITEM pArray, ULONG ulIndex, PHB_ITEM pItem ); /* retrieves an item */
extern PHB_ITEM hb_arrayGetItemPtr( PHB_ITEM pArray, ULONG ulIndex ); /* returns pointer to specified element of the array */
extern ULONG hb_arrayCopyC( PHB_ITEM pArray, ULONG ulIndex, char * szBuffer, ULONG ulLen ); /* copy a string into an array item */
extern char * hb_arrayGetC( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the string contained on an array element */
extern char * hb_arrayGetCPtr( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the string pointer on an array element */
extern ULONG hb_arrayGetCLen( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the string length contained on an array element */
extern void * hb_arrayGetPtr( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the pointer contained on an array element */
extern BOOL hb_arrayGetL( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the logical value contained on an array element */
extern int hb_arrayGetNI( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the int value contained on an array element */
extern long hb_arrayGetNL( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the long numeric value contained on an array element */
extern HB_LONG hb_arrayGetNInt( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the HB_LONG value contained on an array element */
extern double hb_arrayGetND( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the double value contained on an array element */
extern char * hb_arrayGetDS( PHB_ITEM pArray, ULONG ulIndex, char * szDate ); /* retrieves the date value contained in an array element */
extern long hb_arrayGetDL( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the date value contained in an array element, as a long integer */
extern USHORT hb_arrayGetType( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the type of an array item */
extern BOOL hb_arrayFill( PHB_ITEM pArray, PHB_ITEM pValue, ULONG * pulStart, ULONG * pulCount ); /* fill an array with a given item */
extern ULONG hb_arrayScan( PHB_ITEM pArray, PHB_ITEM pValue, ULONG * pulStart, ULONG * pulCount ); /* scan an array for a given item, or until code-block item returns TRUE */
extern BOOL hb_arrayEval( PHB_ITEM pArray, PHB_ITEM bBlock, ULONG * pulStart, ULONG * pulCount ); /* execute a code-block for every element of an array item */
extern BOOL hb_arrayCopy( PHB_ITEM pSrcArray, PHB_ITEM pDstArray, ULONG * pulStart, ULONG * pulCount, ULONG * pulTarget ); /* copy items from one array to another */
extern PHB_ITEM hb_arrayClone( PHB_ITEM pArray, PHB_NESTED_CLONED pClonedList ); /* returns a duplicate of an existing array, including all nested items */
extern BOOL hb_arraySort( PHB_ITEM pArray, ULONG * pulStart, ULONG * pulCount, PHB_ITEM pBlock ); /* sorts an array item */
extern PHB_ITEM hb_arrayFromStack( USHORT uiLen ); /* Creates and returns an Array of n Elements from the Eval Stack - Does NOT pop the items. */
extern PHB_ITEM hb_arrayFromParams( PHB_ITEM *pBase ); /* Creates and returns an Array of Generic Parameters for specified base symbol. */
#ifndef HB_LONG_LONG_OFF
extern LONGLONG hb_arrayGetNLL( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the long long numeric value contained on an array element */
#endif
/* string management */
@@ -435,16 +464,26 @@ extern char * hb_strdup( const char * pszText ); /* returns a pointer to a new
extern BOOL hb_strMatchRegExp( const char * szString, const char * szMask ); /* compare two strings using a regular expression pattern */
extern BOOL hb_strEmpty( const char * szText, ULONG ulLen ); /* returns whether a string contains only white space */
extern void hb_strDescend( char * szStringTo, const char * szStringFrom, ULONG ulLen ); /* copy a string to a buffer, inverting each character */
extern BOOL hb_strMatchWild(const char *szString, const char *szPattern ); /* compare two strings using pattern with wildcard (?*) */
extern ULONG hb_strAt( const char * szSub, ULONG ulSubLen, const char * szText, ULONG ulLen ); /* returns an index to a sub-string within another string */
extern char * hb_strUpper( char * szText, ULONG ulLen ); /* convert an existing string buffer to upper case */
extern char * hb_strLower( char * szText, ULONG ulLen ); /* convert an existing string buffer to lower case */
extern char * hb_strncpy( char * pDest, const char * pSource, ULONG ulLen ); /* copy at most ulLen bytes from string buffer to another buffer and _always_ set 0 in destin buffer */
extern char * hb_strncat( char * pDest, const char * pSource, ULONG ulLen ); /* copy at most ulLen-strlen(pDest) bytes from string buffer to another buffer and _always_ set 0 in destin buffer */
extern char * hb_strncpyTrim( char * pDest, const char * pSource, ULONG ulLen );
extern char * hb_strncpyUpper( char * pDest, const char * pSource, ULONG ulLen ); /* copy an existing string buffer to another buffer, as upper case */
extern char * hb_strncpyUpperTrim( char * pDest, const char * pSource, ULONG ulLen );
extern double hb_strVal( const char * szText, ULONG ulLen ); /* return the numeric value of a character string representation of a number */
extern char * hb_strLTrim( const char * szText, ULONG * ulLen ); /* return a pointer to the first non-white space character */
extern ULONG hb_strRTrimLen( const char * szText, ULONG ulLen, BOOL bAnySpace ); /* return length of a string, ignoring trailing white space (or true spaces) */
extern BOOL hb_compStrToNum( const char* szNum, HB_LONG * plVal, double * pdVal, int * piDec, int * piWidth ); /* converts string to number, sets iDec, iWidth and returns TRUE if results is double */
extern BOOL hb_valStrnToNum( const char* szNum, ULONG ulLen, HB_LONG * plVal, double * pdVal, int * piDec, int * piWidth );
extern BOOL hb_strToNum( const char* szNum, HB_LONG * plVal, double * pdVal ); /* converts string to number, returns TRUE if results is double */
extern BOOL hb_strnToNum( const char* szNum, ULONG ulLen, HB_LONG * plVal, double * pdVal ); /* converts string to number, returns TRUE if results is double */
extern double hb_numRound( double dResult, int iDec ); /* round a number to a specific number of digits */
extern double hb_numInt( double dNum ); /* take the integer part of the number */
/* class management */
extern void hb_clsReleaseAll( void ); /* releases all defined classes */
@@ -481,7 +520,7 @@ extern ULONG hb_cmdargProcessVM( int*, int* ); /* Check for command line inte
extern PHB_SYMB hb_symbolNew( char * szName ); /* create a new symbol */
/* Codeblock management */
extern HB_CODEBLOCK_PTR hb_codeblockNew( BYTE * pBuffer, USHORT uiLocals, USHORT * pLocalPosTable, PHB_SYMB pSymbols ); /* create a code-block */
extern HB_CODEBLOCK_PTR hb_codeblockNew( BYTE * pBuffer, USHORT uiLocals, BYTE * pLocalPosTable, PHB_SYMB pSymbols ); /* create a code-block */
extern HB_CODEBLOCK_PTR hb_codeblockMacroNew( BYTE * pBuffer, USHORT usLen );
extern void hb_codeblockDelete( HB_ITEM_PTR pItem ); /* delete a codeblock */
extern PHB_ITEM hb_codeblockGetVar( PHB_ITEM pItem, LONG iItemPos ); /* get local variable referenced in a codeblock */

View File

@@ -109,5 +109,6 @@ extern void hb_cdpnTranslate( char*, PHB_CODEPAGE, PHB_CODEPAGE, unsigned int );
extern int hb_cdpcmp( char*, char*, ULONG, PHB_CODEPAGE, ULONG* );
extern int hb_cdpchrcmp( char cFirst, char cSecond, PHB_CODEPAGE cdpage );
extern PHB_CODEPAGE hb_cdp_page;
#endif /* HB_APICDP_H_ */

View File

@@ -174,12 +174,12 @@ extern FHANDLE hb_spCreateEx( BYTE * pFilename, USHORT uiAttr, USHORT uiFlags );
/* File Find API structure */
typedef struct
{
char szName[ _POSIX_PATH_MAX + 1 ];
LONG lDate;
char szDate[ 9 ]; /* in YYYYMMDD format */
char szTime[ 9 ]; /* in HH:MM:SS format */
USHORT attr;
ULONG size; /* TOFIX: Use LONGLONG or double instead */
char szName[ _POSIX_PATH_MAX + 1 ];
LONG lDate;
char szDate[ 9 ]; /* in YYYYMMDD format */
char szTime[ 9 ]; /* in HH:MM:SS format */
USHORT attr;
HB_FOFFSET size;
/* Private */

View File

@@ -71,9 +71,7 @@
#include "hbapi.h"
#if defined(HB_EXTERN_C)
extern "C" {
#endif
HB_EXTERN_BEGIN
/* NOTE: The declaration of hb_gtSetPos(), hb_gtGetPos(), hb_gtWrite(),
hb_gtWriteAt(), hb_gtRepChar(), hb_gtBox(), hb_gtBoxS(), hb_gtBoxD()

View File

@@ -75,48 +75,56 @@ extern BOOL hb_evalRelease ( PEVALINFO pEvalInfo );
extern PHB_ITEM hb_itemDo ( PHB_ITEM pItem, ULONG ulPCount, ... );
extern PHB_ITEM hb_itemDoC ( char * szFunc, ULONG ulPCount, ... );
extern PHB_ITEM hb_itemArrayGet ( PHB_ITEM pArray, ULONG ulIndex );
extern PHB_ITEM hb_itemArrayNew ( ULONG ulLen );
extern PHB_ITEM hb_itemArrayPut ( PHB_ITEM pArray, ULONG ulIndex, PHB_ITEM pItem );
extern ULONG hb_itemCopyC ( PHB_ITEM pItem, char * szBuffer, ULONG ulLen );
extern BOOL hb_itemFreeC ( char * szText );
extern char * hb_itemGetC ( PHB_ITEM pItem );
extern char * hb_itemGetCPtr ( PHB_ITEM pItem );
extern ULONG hb_itemGetCLen ( PHB_ITEM pItem );
extern char * hb_itemGetDS ( PHB_ITEM pItem, char * szDate );
extern long hb_itemGetDL ( PHB_ITEM pItem );
extern BOOL hb_itemGetL ( PHB_ITEM pItem );
extern double hb_itemGetND ( PHB_ITEM pItem );
extern int hb_itemGetNI ( PHB_ITEM pItem );
extern long hb_itemGetNL ( PHB_ITEM pItem );
extern void hb_itemGetNLen ( PHB_ITEM pItem, int * piWidth, int * piDec );
extern void * hb_itemGetPtr ( PHB_ITEM pItem );
extern PHB_ITEM hb_itemNew ( PHB_ITEM pNull );
extern void hb_itemInit ( PHB_ITEM pItem );
extern USHORT hb_itemPCount ( void );
extern PHB_ITEM hb_itemParam ( USHORT uiParam );
extern PHB_ITEM hb_itemPutC ( PHB_ITEM pItem, char * szText );
extern PHB_ITEM hb_itemPutCConst( PHB_ITEM pItem, char * szText );
extern PHB_ITEM hb_itemPutCPtr ( PHB_ITEM pItem, char * szText, ULONG ulLen );
extern PHB_ITEM hb_itemPutCL ( PHB_ITEM pItem, char * szText, ULONG ulLen );
extern void hb_itemSetCMemo ( PHB_ITEM pItem );
extern PHB_ITEM hb_itemPutD ( PHB_ITEM pItem, long lYear, long lMonth, long lDay );
extern PHB_ITEM hb_itemPutDS ( PHB_ITEM pItem, char * szDate );
extern PHB_ITEM hb_itemPutDL ( PHB_ITEM pItem, long lJulian );
extern PHB_ITEM hb_itemPutL ( PHB_ITEM pItem, BOOL bValue );
extern PHB_ITEM hb_itemPutND ( PHB_ITEM pItem, double dNumber );
extern PHB_ITEM hb_itemPutNI ( PHB_ITEM pItem, int iNumber );
extern PHB_ITEM hb_itemPutNL ( PHB_ITEM pItem, long lNumber );
extern PHB_ITEM hb_itemPutNLen ( PHB_ITEM pItem, double dNumber, int iWidth, int iDec );
extern PHB_ITEM hb_itemPutNDLen ( PHB_ITEM pItem, double dNumber, int iWidth, int iDec );
extern PHB_ITEM hb_itemPutNILen ( PHB_ITEM pItem, int iNumber, int iWidth );
extern PHB_ITEM hb_itemPutNLLen ( PHB_ITEM pItem, long lNumber, int iWidth );
extern PHB_ITEM hb_itemPutPtr ( PHB_ITEM pItem, void * pValue );
extern BOOL hb_itemRelease ( PHB_ITEM pItem );
extern PHB_ITEM hb_itemReturn ( PHB_ITEM pItem );
extern ULONG hb_itemSize ( PHB_ITEM pItem );
extern USHORT hb_itemType ( PHB_ITEM pItem );
extern char * hb_itemTypeStr ( PHB_ITEM pItem );
extern PHB_ITEM hb_itemArrayGet ( PHB_ITEM pArray, ULONG ulIndex );
extern PHB_ITEM hb_itemArrayNew ( ULONG ulLen );
extern PHB_ITEM hb_itemArrayPut ( PHB_ITEM pArray, ULONG ulIndex, PHB_ITEM pItem );
extern ULONG hb_itemCopyC ( PHB_ITEM pItem, char * szBuffer, ULONG ulLen );
extern BOOL hb_itemFreeC ( char * szText );
extern char * hb_itemGetC ( PHB_ITEM pItem );
extern char * hb_itemGetCPtr ( PHB_ITEM pItem );
extern ULONG hb_itemGetCLen ( PHB_ITEM pItem );
extern char * hb_itemGetDS ( PHB_ITEM pItem, char * szDate );
extern long hb_itemGetDL ( PHB_ITEM pItem );
extern BOOL hb_itemGetL ( PHB_ITEM pItem );
extern double hb_itemGetND ( PHB_ITEM pItem );
extern int hb_itemGetNI ( PHB_ITEM pItem );
extern long hb_itemGetNL ( PHB_ITEM pItem );
extern HB_LONG hb_itemGetNInt ( PHB_ITEM pItem );
extern void hb_itemGetNLen ( PHB_ITEM pItem, int * piWidth, int * piDec );
extern void * hb_itemGetPtr ( PHB_ITEM pItem );
extern PHB_ITEM hb_itemNew ( PHB_ITEM pNull );
extern void hb_itemInit ( PHB_ITEM pItem );
extern USHORT hb_itemPCount ( void );
extern PHB_ITEM hb_itemParam ( USHORT uiParam );
extern PHB_ITEM hb_itemPutC ( PHB_ITEM pItem, char * szText );
extern PHB_ITEM hb_itemPutCConst( PHB_ITEM pItem, char * szText );
extern PHB_ITEM hb_itemPutCPtr ( PHB_ITEM pItem, char * szText, ULONG ulLen );
extern PHB_ITEM hb_itemPutCL ( PHB_ITEM pItem, char * szText, ULONG ulLen );
extern void hb_itemSetCMemo ( PHB_ITEM pItem );
extern PHB_ITEM hb_itemPutD ( PHB_ITEM pItem, int iYear, int iMonth, int iDay );
extern PHB_ITEM hb_itemPutDS ( PHB_ITEM pItem, char * szDate );
extern PHB_ITEM hb_itemPutDL ( PHB_ITEM pItem, long lJulian );
extern PHB_ITEM hb_itemPutL ( PHB_ITEM pItem, BOOL bValue );
extern PHB_ITEM hb_itemPutND ( PHB_ITEM pItem, double dNumber );
extern PHB_ITEM hb_itemPutNI ( PHB_ITEM pItem, int iNumber );
extern PHB_ITEM hb_itemPutNL ( PHB_ITEM pItem, long lNumber );
extern PHB_ITEM hb_itemPutNInt ( PHB_ITEM pItem, HB_LONG lNumber );
extern PHB_ITEM hb_itemPutNIntLen( PHB_ITEM pItem, HB_LONG lNumber, int iWidth );
extern PHB_ITEM hb_itemPutNLen ( PHB_ITEM pItem, double dNumber, int iWidth, int iDec );
extern PHB_ITEM hb_itemPutNDLen ( PHB_ITEM pItem, double dNumber, int iWidth, int iDec );
extern PHB_ITEM hb_itemPutNILen ( PHB_ITEM pItem, int iNumber, int iWidth );
extern PHB_ITEM hb_itemPutNLLen ( PHB_ITEM pItem, long lNumber, int iWidth );
extern PHB_ITEM hb_itemPutPtr ( PHB_ITEM pItem, void * pValue );
extern BOOL hb_itemRelease ( PHB_ITEM pItem );
extern PHB_ITEM hb_itemReturn ( PHB_ITEM pItem );
extern ULONG hb_itemSize ( PHB_ITEM pItem );
extern USHORT hb_itemType ( PHB_ITEM pItem );
extern char * hb_itemTypeStr ( PHB_ITEM pItem );
#ifndef HB_LONG_LONG_OFF
extern LONGLONG hb_itemGetNLL ( PHB_ITEM pItem );
extern PHB_ITEM hb_itemPutNLL ( PHB_ITEM pItem, LONGLONG lNumber );
extern PHB_ITEM hb_itemPutNLLLen( PHB_ITEM pItem, LONGLONG lNumber, int iWidth );
#endif
/* Non Clipper compliant internal API */
@@ -132,7 +140,7 @@ extern char * hb_itemStr ( PHB_ITEM pNumber, PHB_ITEM pWidth, PHB_ITEM pD
extern char * hb_itemString ( PHB_ITEM pItem, ULONG * ulLen, BOOL * bFreeReq ); /* Convert any scalar to a string */
extern BOOL hb_itemStrBuf ( char *szResult, PHB_ITEM pNumber, int iSize, int iDec ); /* convert a number to a string */
extern PHB_ITEM hb_itemValToStr ( PHB_ITEM pItem ); /* Convert any scalar to a string */
extern char * hb_itemPadConv ( PHB_ITEM pItem, char * buffer, ULONG * pulSize );
extern char * hb_itemPadConv ( PHB_ITEM pItem, ULONG * pulSize, BOOL * bFreeReq );
extern void hb_itemSwap ( PHB_ITEM pItem1, PHB_ITEM pItem2 );
#if defined(HB_EXTERN_C)

View File

@@ -355,11 +355,11 @@ extern void hb_compGenMessageData( char * szMsg ); /* generates an underscor
extern void hb_compGenPopVar( char * szVarName ); /* generates the pcode to pop a value from the virtual machine stack onto a variable */
extern void hb_compGenPushDouble( double dNumber, BYTE bWidth, BYTE bDec ); /* Pushes a number on the virtual machine stack */
extern void hb_compGenPushFunCall( char * ); /* generates the pcode to push function's call */
extern void hb_compGenPushVar( char * szVarName ); /* generates the pcode to push a variable value to the virtual machine stack */
extern void hb_compGenPushVar( char * szVarName ); /* generates the pcode to push a variable value to the virtual machine stack */
extern void hb_compGenPushVarRef( char * szVarName ); /* generates the pcode to push a variable by reference to the virtual machine stack */
extern void hb_compGenPushInteger( int iNumber ); /* Pushes a integer number on the virtual machine stack */
extern void hb_compGenPushLogical( int iTrueFalse ); /* pushes a logical value on the virtual machine stack */
extern void hb_compGenPushLong( long lNumber ); /* Pushes a long number on the virtual machine stack */
extern void hb_compGenPushLong( HB_LONG lNumber ); /* Pushes a long number on the virtual machine stack */
extern void hb_compGenPushNil( void ); /* Pushes nil on the virtual machine stack */
extern void hb_compGenPushString( char * szText, ULONG ulLen ); /* Pushes a string on the virtual machine stack */
extern void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias ); /* Pushes a symbol on to the Virtual machine stack */

View File

@@ -60,16 +60,16 @@ extern "C" {
#endif
extern double hb_dateSeconds( void );
extern void hb_dateToday( long * plYear, long * plMonth, long * plDay );
extern void hb_dateToday( int * piYear, int * piMonth, int * piDay );
extern void hb_dateTimeStr( char * pszTime );
extern char * hb_dateCMonth( int iMonth );
extern char * hb_dateCDOW( int iDay );
extern long hb_dateDOW( long lYear, long lMonth, long lDay );
extern int hb_dateDOW( int iYear, int iMonth, int iDay );
extern char * hb_dateFormat( const char * szDate, char * szFormattedDate, const char * szDateFormat );
extern long hb_dateEncode( long lYear, long lMonth, long lDay );
extern void hb_dateDecode( long julian, long * plYear, long * plMonth, long * plDay );
extern void hb_dateStrPut( char * szDate, long lYear, long lMonth, long lDay );
extern void hb_dateStrGet( const char * szDate, long * plYear, long * plMonth, long * plDay );
extern long hb_dateEncode( int iYear, int iMonth, int iDay );
extern void hb_dateDecode( long julian, int * piYear, int * piMonth, int * piDay );
extern void hb_dateStrPut( char * szDate, int iYear, int iMonth, int iDay );
extern void hb_dateStrGet( const char * szDate, int * piYear, int * piMonth, int * piDay );
extern char * hb_dateDecStr( char * szDate, long lJulian );
extern long hb_dateEncStr( char * szDate );

View File

@@ -55,15 +55,7 @@
#include "hbapirdd.h"
/* 23/10/00 - maurilio.longo@libero.it
When using GCC under OS/2 pack(1) byte aligns every structure */
#if defined(__EMX__) && ! defined(__RSXNT__)
#pragma pack(1)
#endif
#if defined(HB_EXTERN_C)
extern "C" {
#endif
HB_EXTERN_BEGIN
/* DBF header */
@@ -73,9 +65,9 @@ typedef struct _DBFHEADER
BYTE bYear;
BYTE bMonth;
BYTE bDay;
ULONG ulRecCount;
USHORT uiHeaderLen;
USHORT uiRecordLen;
BYTE ulRecCount[ 4 ];
BYTE uiHeaderLen[ 2 ];
BYTE uiRecordLen[ 2 ];
BYTE bReserved1[ 16 ];
BYTE bHasTags;
BYTE bCodePage;
@@ -101,13 +93,6 @@ typedef struct _DBFFIELD
typedef DBFFIELD * LPDBFFIELD;
#if defined(HB_EXTERN_C)
}
#endif
#if defined(__EMX__) && ! defined(__RSXNT__)
#pragma pack()
#endif
HB_EXTERN_END
#endif /* HB_DBF_H_ */

View File

@@ -53,13 +53,12 @@
#ifndef HB_DBFERR_H_
#define HB_DBFERR_H_
#if defined(HB_EXTERN_C)
extern "C" {
#endif
HB_EXTERN_BEGIN
/* DBF errors */
#define EDBF_OPEN_DBF 1001
#define EDBF_CREATE_DBF 1004
#define EDBF_CREATE 1006
#define EDBF_READ 1010
#define EDBF_WRITE 1011
#define EDBF_CORRUPT 1012
@@ -73,9 +72,6 @@ extern "C" {
/* ORDER errors */
#define EDBF_INVALIDKEY 1026
#if defined(HB_EXTERN_C)
}
#endif
HB_EXTERN_END
#endif /* HB_DBFERR_H_ */

View File

@@ -61,8 +61,33 @@
#include "hbsetup.h"
#include "hbtrace.h"
/* Include windows.h if applicable and requested */
/*
#define HB_CLIPPER_INT_ITEMS
*/
#define HB_LONG_LONG_OFF
#if defined( HB_OS_WIN_32 )
#if !defined( HB_WIN32_IO_OFF )
#define HB_WIN32_IO
#endif
#if defined( HB_WIN32_IO ) && !defined( HB_OS_WIN_32_USED )
/* disabled to avoid problems with windows.h */
/* #define HB_OS_WIN_32_USED */
#endif
/*
* This is a temporary hack to resolve problem with binary
* compatibility 3-rd party binaries - mostly FWH now.
* I hope we will be able to remove it soon
#ifndef HB_LONG_HOLDERS
#define HB_FWH_COMPATIBLE
#endif
*/
#else
#undef HB_WIN32_IO
#undef HB_OS_WIN_32_USED
#endif
/* Include windows.h if applicable and requested */
#if defined(HB_OS_WIN_32_USED) && defined(HB_OS_WIN_32)
#define WIN32_LEAN_AND_MEAN
@@ -110,6 +135,10 @@
#define HB_DOS_INT86 _int86
#define HB_DOS_INT86X _int86x
#define HB_XREGS x
#elif defined( __DJGPP__ )
#define HB_DOS_INT86 int86
#define HB_DOS_INT86X int86x
#define HB_XREGS w
#else
#define HB_DOS_INT86 int86
#define HB_DOS_INT86X int86x
@@ -123,11 +152,11 @@
#undef BOOL /* boolean */
typedef int BOOL;
#undef UINT
typedef unsigned int UINT; /* compiler/target dependant */
#undef UINT /* varies with platform */
typedef unsigned int UINT;
#undef BYTE
typedef unsigned char BYTE; /* 1 byte unsigned */
#undef BYTE /* 1 byte unsigned */
typedef unsigned char BYTE;
#undef SHORT /* 2 bytes signed */
typedef short int SHORT;
@@ -135,62 +164,553 @@
#undef USHORT /* 2 bytes unsigned */
typedef unsigned short int USHORT;
#undef LONG /* 4 bytes signed */
#undef LONG /* 4 or 8 bytes signed */
typedef long LONG;
#undef ULONG /* 4 bytes unsigned */
#undef ULONG /* 4 or 8 bytes unsigned */
typedef unsigned long ULONG;
#undef FALSE
#define FALSE 0
#undef TRUE
#define TRUE !0
#define TRUE (!0)
#ifndef HB_LONG_LONG_OFF
#if ! defined(_WINNT_H)
#if !defined(LONGLONG)
#if defined(__GNUC__)
typedef long long LONGLONG;
#else
typedef __int64 LONGLONG;
#endif
#endif
#if !defined(ULONGLONG)
#if defined(__GNUC__)
typedef unsigned long long ULONGLONG;
#else
typedef unsigned __int64 ULONGLONG;
#endif
#endif
#endif
#ifdef __GNUC__
#if defined(ULLONG_MAX)
#define ULONGLONG_MAX ULLONG_MAX
#elif defined(ULONG_LONG_MAX)
#define ULONGLONG_MAX ULONG_LONG_MAX
#else
#define ULONGLONG_MAX 18446744073709551615ULL
#endif
#if defined(LLONG_MAX)
#define LONGLONG_MAX LLONG_MAX
#elif defined(LONG_LONG_MAX)
#define LONGLONG_MAX LONG_LONG_MAX
#else
#define LONGLONG_MAX 9223372036854775807LL
#endif
#if defined(LLONG_MIN)
#define LONGLONG_MIN LLONG_MIN
#elif defined(LONG_LONG_MIN)
#define LONGLONG_MIN LONG_LONG_MIN
#else
#define LONGLONG_MIN (-LONGLONG_MAX - 1LL)
#endif
#else
#if !defined(LONGLONG_MIN)
#define LONGLONG_MIN _I64_MIN
#endif
#if !defined(LONGLONG_MAX)
#define LONGLONG_MAX _I64_MAX
#endif
#if !defined(ULONGLONG_MAX)
#define ULONGLONG_MAX _UI64_MAX
#endif
#endif
#endif /* HB_LONG_LONG_OFF */
#endif /* HB_DONT_DEFINE_BASIC_TYPES */
/*
* below are some hacks which don't have to be true on some machines
* please update it if necessary
*/
#if ULONG_MAX > UINT_MAX && UINT_MAX > USHORT_MAX
# define HB_ARCH_64BIT
#elif ULONG_MAX == UINT_MAX && UINT_MAX > USHORT_MAX
# define HB_ARCH_32BIT
#elif ULONG_MAX > UINT_MAX && UINT_MAX == USHORT_MAX
# define HB_ARCH_16BIT
#endif
#if USHRT_MAX == 0xffff
# if !defined( UINT16 )
typedef USHORT UINT16;
# endif
# if !defined( INT16 )
typedef SHORT INT16;
# endif
# if !defined( UINT16_MAX )
# define UINT16_MAX USHRT_MAX
# endif
# if !defined( INT16_MAX )
# define INT16_MAX SHRT_MAX
# endif
# if !defined( INT16_MIN )
# define INT16_MIN SHRT_MIN
# endif
#endif
#if UINT_MAX == 0xffffffff
# if !defined( UINT32 )
typedef UINT UINT32;
# endif
# if !defined( INT32 )
typedef int INT32;
# endif
# if !defined( UINT32_MAX )
# define UINT32_MAX UINT_MAX
# endif
# if !defined( INT32_MAX )
# define INT32_MAX INT_MAX
# endif
# if !defined( INT32_MIN )
# define INT32_MIN INT_MIN
# endif
#elif ULONG_MAX == 0xffffffff
# if !defined( UINT32 )
typedef ULONG UINT32;
# endif
# if !defined( INT32 )
typedef LONG INT32;
# endif
# if !defined( UINT32_MAX )
# define UINT32_MAX ULONG_MAX
# endif
# if !defined( INT32_MAX )
# define INT32_MAX LONG_MAX
# endif
# if !defined( INT32_MIN )
# define INT32_MIN LONG_MIN
# endif
#endif
#if defined( HB_ARCH_64BIT )
# if !defined( UINT64 )
typedef ULONG UINT64;
# endif
# if !defined( INT64 )
typedef LONG INT64;
# endif
# if !defined( UINT64_MAX )
# define UINT64_MAX ULONG_MAX
# endif
# if !defined( INT64_MAX )
# define INT64_MAX LONG_MAX
# endif
# if !defined( INT64_MIN )
# define INT64_MIN LONG_MIN
# endif
#elif !defined( HB_LONG_LONG_OFF )
# if !defined( UINT64 )
typedef ULONGLONG UINT64;
# endif
# if !defined( INT64 )
typedef LONGLONG INT64;
# endif
# if !defined( UINT64_MAX )
# define UINT64_MAX ULONGLONG_MAX
# endif
# if !defined( INT64_MAX )
# define INT64_MAX LONGLONG_MAX
# endif
# if !defined( INT64_MIN )
# define INT64_MIN LONGLONG_MIN
# endif
#endif
#ifndef HB_LONG_DOUBLE_OFF
typedef long double HB_MAXDBL;
#else
typedef double HB_MAXDBL;
#endif
#if defined( HB_CLIPPER_INT_ITEMS )
# define HB_INT_MAX SHRT_MAX
# define HB_INT_MIN SHRT_MIN
# define HB_LONG_MAX LONG_MAX
# define HB_LONG_MIN LONG_MIN
# define HB_ULONG_MAX ULONG_MAX
typedef LONG HB_LONG;
typedef ULONG HB_ULONG;
# define PFHL "l"
#elif !defined( HB_LONG_LONG_OFF ) && ULONG_MAX == UINT_MAX
# define HB_INT_MAX INT_MAX
# define HB_INT_MIN INT_MIN
# define HB_LONG_MAX LONGLONG_MAX
# define HB_LONG_MIN LONGLONG_MIN
# define HB_ULONG_MAX ULONGLONG_MAX
typedef LONGLONG HB_LONG;
typedef ULONGLONG HB_ULONG;
#else
# define HB_INT_MAX INT_MAX
# define HB_INT_MIN INT_MIN
# define HB_LONG_MAX LONG_MAX
# define HB_LONG_MIN LONG_MIN
# define HB_ULONG_MAX ULONG_MAX
typedef LONG HB_LONG;
typedef ULONG HB_ULONG;
# define PFHL "l"
#endif
#define HB_DBL_LIM_INT(d) ( HB_INT_MIN <= (d) && (d) <= HB_INT_MAX )
#define HB_DBL_LIM_LONG(d) ( (HB_MAXDBL) HB_LONG_MIN <= (HB_MAXDBL) (d) && (HB_MAXDBL) (d) <= (HB_MAXDBL) HB_LONG_MAX )
#define HB_LIM_INT(l) ( HB_INT_MIN <= (l) && (l) <= HB_INT_MAX )
#define HB_LIM_LONG(l) ( HB_LONG_MIN <= (l) && (l) <= HB_LONG_MAX )
#define HB_DBL_LIM_INT8(d) ( -128 <= (d) && (d) <= 127 )
#define HB_DBL_LIM_INT16(d) ( INT16_MIN <= (d) && (d) <= INT16_MAX )
#define HB_DBL_LIM_INT32(d) ( INT32_MIN <= (d) && (d) <= INT32_MAX )
#define HB_DBL_LIM_INT64(d) ( (HB_MAXDBL) INT64_MIN <= (HB_MAXDBL) (d) && (HB_MAXDBL) (d) <= (HB_MAXDBL) INT64_MAX )
#define HB_LIM_INT8(l) ( -128 <= (l) && (l) <= 127 )
#define HB_LIM_INT16(l) ( INT16_MIN <= (l) && (l) <= INT16_MAX )
#define HB_LIM_INT32(l) ( INT32_MIN <= (l) && (l) <= INT32_MAX )
#define HB_LIM_INT64(l) ( INT64_MIN <= (l) && (l) <= INT64_MAX )
#if HB_LONG_MAX > 10000000000
# define HB_LONG_LENGTH( l ) ( ( (l) <= -1000000000 || (l) >= HB_LL( 10000000000 ) ) ? 20 : 10 )
#else
# define HB_LONG_LENGTH( l ) ( ( (l) <= -1000000000 ) ? 20 : 10 )
#endif
#if HB_INT_MIN <= -1000000000
# define HB_INT_LENGTH( i ) ( ( (i) <= -1000000000 ) ? 20 : 10 )
#else
# define HB_INT_LENGTH( i ) 10
#endif
/* NOTE: Yes, -999999999.0 is right instead of -1000000000.0 [vszakats] */
/* This comment is from hb_vmNeg() - if it's true only in this case then
the limit should be changed and this function fixed */
#define HB_DBL_LENGTH( d ) ( ( (d) >= 10000000000.0 || (d) <= -999999999.0 ) ? 20 : 10 )
/* uncomment this if you need strict Clipper compatibility */
/* #define PCODE_LONG_LIM(l) HB_LIM_INT32( l ) */
/* #define PCODE_LONG_LIM(l) HB_LIM_LONG( l ) */
/* type of reference counter */
typedef ULONG HB_COUNTER;
typedef unsigned long HB_COUNTER;
/* type for memory pointer diff */
typedef ULONG HB_PTRDIFF;
typedef long HB_PTRDIFF;
#ifdef HB_LONG_LONG_OFF
typedef LONG HB_FOFFSET;
/* we can add hack with double as work around what should
effectively give 52bit file size limit */
#else
typedef LONGLONG HB_FOFFSET;
#endif
/* maximum length of double number in decimal representation:
log10(2^1024) ~ 308.25 */
#define HB_MAX_DOUBLE_LENGTH 320
/* This value is used to hack the double FL value in round/int
operation - similar thing is done by CL5.3 - I do not know
only the exact factor value but it should be close to this one.
When HB_C52_STRICT is set this macro is not used.
*/
#define HB_DBLFL_PREC_FACTOR 1.0000000000000002;
/* try to detect byte order if not explicitly set */
#if !defined( HB_PDP_ENDIAN ) && !defined( HB_BIG_ENDIAN ) && \
!defined( HB_LITTLE_ENDIAN ) && \
defined( __BYTE_ORDER ) && defined( __LITTLE_ENDIAN ) && \
defined( __BIG_ENDIAN ) && defined( __PDP_ENDIAN )
# if __BYTE_ORDER == __LITTLE_ENDIAN
# define HB_LITTLE_ENDIAN
# elif __BYTE_ORDER == __BIG_ENDIAN
# define HB_BIG_ENDIAN
# elif __BYTE_ORDER == __BIG_ENDIAN
# define HB_PDP_ENDIAN
# endif
#endif
#define HB_MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
#define HB_MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
#define HB_LOBYTE( w ) ( ( BYTE ) ( w ) )
#define HB_HIBYTE( w ) ( ( BYTE ) ( ( ( USHORT ) ( w ) >> 8 ) & 0xFF ) )
#define HB_MKSHORT( lo, hi ) ( ( SHORT ) ( ( ( SHORT ) ( hi ) ) << 8 ) | ( lo ) )
#define HB_MKUSHORT( lo, hi ) ( ( USHORT ) ( ( ( USHORT ) ( hi ) ) << 8 ) | ( lo ) )
#define HB_MKLONG( b1, b2, b3, b4 ) ( ( ( ( LONG ) ( b4 ) ) << 24 ) | \
( ( ( LONG ) ( b3 ) ) << 16 ) | \
( ( ( LONG ) ( b2 ) ) << 8 ) | \
( ( ( LONG ) ( b1 ) ) ) )
#define HB_MKULONG( b1, b2, b3, b4 ) ( ( ( ( ULONG ) ( b4 ) ) << 24 ) | \
( ( ( ULONG ) ( b3 ) ) << 16 ) | \
( ( ( ULONG ) ( b2 ) ) << 8 ) | \
( ( ( ULONG ) ( b1 ) ) ) )
#define HB_HIBYTE( w ) ( ( BYTE ) ( ( ( w ) >> 8 ) & 0xFF ) )
#define HB_LOWORD( l ) ( ( UINT16 ) ( l ) )
#define HB_HIWORD( l ) ( ( UINT16 ) ( ( ( l ) >> 16 ) & 0xFFFF ) )
#define HB_MKSHORT( lo, hi ) ( ( SHORT ) ( ( ( INT16 ) ( hi ) ) << 8 ) | ( lo ) )
#define HB_MKUSHORT( lo, hi ) ( ( USHORT ) ( ( ( UINT16 ) ( hi ) ) << 8 ) | ( lo ) )
#define HB_MKLONG( b1, b2, b3, b4 ) ( ( LONG ) \
( ( ( ( INT32 ) ( b4 ) ) << 24 ) | \
( ( ( INT32 ) ( b3 ) ) << 16 ) | \
( ( ( INT32 ) ( b2 ) ) << 8 ) | \
( ( ( INT32 ) ( b1 ) ) ) ) )
#define HB_MKULONG( b1, b2, b3, b4 ) ( ( ULONG ) \
( ( ( ( UINT32 ) ( b4 ) ) << 24 ) | \
( ( ( UINT32 ) ( b3 ) ) << 16 ) | \
( ( ( UINT32 ) ( b2 ) ) << 8 ) | \
( ( ( UINT32 ) ( b1 ) ) ) ) )
#define HB_SWAP_USHORT( w ) ( ( USHORT ) ( ( ( ( USHORT ) ( w ) & 0xFF00 ) >> 8 ) | \
( ( ( USHORT ) ( w ) & 0x00FF ) << 8 ) ) )
#define HB_SWAP_ULONG( w ) ( ( ULONG ) ( ( ( ( ULONG ) ( w ) & 0x000000FFL ) << 24 ) | \
( ( ( ULONG ) ( w ) & 0x0000FF00L ) << 8 ) | \
( ( ( ULONG ) ( w ) & 0x00FF0000L ) >> 8 ) | \
( ( ( ULONG ) ( w ) & 0xFF000000L ) >> 24 ) ) )
#define HB_SWAP_UINT16( w ) ( ( UINT16 ) ( ( ( ( UINT16 ) ( w ) & 0xFF00 ) >> 8 ) | \
( ( ( UINT16 ) ( w ) & 0x00FF ) << 8 ) ) )
#define HB_SWAP_UINT32( w ) ( ( UINT32 ) ( ( ( ( UINT32 ) ( w ) & 0x000000FF ) << 24 ) | \
( ( ( UINT32 ) ( w ) & 0x0000FF00 ) << 8 ) | \
( ( ( UINT32 ) ( w ) & 0x00FF0000 ) >> 8 ) | \
( ( ( UINT32 ) ( w ) & 0xFF000000 ) >> 24 ) ) )
#if defined(HB_PDP_ENDIAN)
/*
* It's a hack for MSC which doesn't support LL suffix for LONGLONG
* numeric constant. This suffix is necessary for some compilers -
* without it they cut the number to LONG
*/
#if defined( _MSC_VER ) || defined( __BORLANDC__ )
# define HB_LL( num ) ((LONGLONG)num)
#else
# define HB_LL( num ) num##LL
#endif
#ifndef PFLL
# if defined( __BORLANDC__ ) || defined( _MSC_VER )
# define PFLL "I64"
# elif defined( __LCC__ )
# define PFLL "ll"
# else
# define PFLL "L"
# endif
#endif
#ifndef PFHL
# define PFHL PFLL
#endif
#define HB_SWAP_UINT64( w ) ( ( UINT64 ) ( ( ( ( UINT64 ) ( w ) & HB_LL( 0x00000000000000FF ) ) << 56 ) | \
( ( ( UINT64 ) ( w ) & HB_LL( 0x000000000000FF00 ) ) << 40 ) | \
( ( ( UINT64 ) ( w ) & HB_LL( 0x0000000000FF0000 ) ) >> 24 ) | \
( ( ( UINT64 ) ( w ) & HB_LL( 0x00000000FF000000 ) ) >> 8 ) | \
( ( ( UINT64 ) ( w ) & HB_LL( 0x000000FF00000000 ) ) >> 8 ) | \
( ( ( UINT64 ) ( w ) & HB_LL( 0x0000FF0000000000 ) ) >> 24 ) | \
( ( ( UINT64 ) ( w ) & HB_LL( 0x00FF000000000000 ) ) >> 40 ) | \
( ( ( UINT64 ) ( w ) & HB_LL( 0xFF00000000000000 ) ) >> 56 ) ) )
/*
* on some machines it's not safe to take numbers from BYTE buffer
* directly by C casting because they have to be stored at odd addresses
* Now this hack is only for integer numbers, if you will need it for
* double too on your machine please define proper macros/function
*/
#ifdef HB_CAST_BYTE_NUMBERS_OFF
#define HB_GET_LE_UINT16( p ) ( ( UINT16 ) \
( ( UINT16 ) (( BYTE * )( p ))[0] | \
( UINT16 ) (( BYTE * )( p ))[1] << 8 ) )
#define HB_GET_LE_UINT32( p ) ( ( UINT32 ) \
( ( UINT32 ) (( BYTE * )( p ))[0] | \
( UINT32 ) (( BYTE * )( p ))[1] << 8 | \
( UINT32 ) (( BYTE * )( p ))[2] << 16 | \
( UINT32 ) (( BYTE * )( p ))[3] << 24 ) )
#define HB_GET_LE_UINT64( p ) ( ( UINT64 ) \
( ( UINT64 ) (( BYTE * )( p ))[0] | \
( UINT64 ) (( BYTE * )( p ))[1] << 8 | \
( UINT64 ) (( BYTE * )( p ))[2] << 16 | \
( UINT64 ) (( BYTE * )( p ))[3] << 24 | \
( UINT64 ) (( BYTE * )( p ))[4] << 32 | \
( UINT64 ) (( BYTE * )( p ))[5] << 40 | \
( UINT64 ) (( BYTE * )( p ))[6] << 48 | \
( UINT64 ) (( BYTE * )( p ))[7] << 56 ) )
#define HB_PUT_LE_UINT16( p, w ) { \
(( BYTE * )( p ))[0] = ( BYTE )( w ); \
(( BYTE * )( p ))[1] = ( BYTE )( (w) >> 8 ); \
}
#define HB_PUT_LE_UINT32( p, w ) { \
(( BYTE * )( p ))[0] = ( BYTE )( w ); \
(( BYTE * )( p ))[1] = ( BYTE )( (w) >> 8 ); \
(( BYTE * )( p ))[2] = ( BYTE )( (w) >> 16 ); \
(( BYTE * )( p ))[3] = ( BYTE )( (w) >> 24 ); \
}
#define HB_PUT_LE_UINT64( p, w ) { \
(( BYTE * )( p ))[0] = ( BYTE )( w ); \
(( BYTE * )( p ))[1] = ( BYTE )( (w) >> 8 ); \
(( BYTE * )( p ))[2] = ( BYTE )( (w) >> 16 ); \
(( BYTE * )( p ))[3] = ( BYTE )( (w) >> 24 ); \
(( BYTE * )( p ))[4] = ( BYTE )( (w) >> 32 ); \
(( BYTE * )( p ))[5] = ( BYTE )( (w) >> 40 ); \
(( BYTE * )( p ))[6] = ( BYTE )( (w) >> 48 ); \
(( BYTE * )( p ))[7] = ( BYTE )( (w) >> 56 ); \
}
#define HB_GET_BE_UINT16( p ) ( ( UINT16 ) \
( ( UINT16 ) (( BYTE * )( p ))[0] << 8 | \
( UINT16 ) (( BYTE * )( p ))[1] ) )
#define HB_GET_BE_UINT32( p ) ( ( UINT32 ) \
( ( UINT32 ) (( BYTE * )( p ))[0] << 24 | \
( UINT32 ) (( BYTE * )( p ))[1] << 16 | \
( UINT32 ) (( BYTE * )( p ))[2] << 8 | \
( UINT32 ) (( BYTE * )( p ))[3] ) )
#define HB_GET_BE_UINT64( p ) ( ( UINT64 ) \
( ( UINT64 ) (( BYTE * )( p ))[0] << 56 | \
( UINT64 ) (( BYTE * )( p ))[1] << 48 | \
( UINT64 ) (( BYTE * )( p ))[2] << 40 | \
( UINT64 ) (( BYTE * )( p ))[3] << 32 | \
( UINT64 ) (( BYTE * )( p ))[4] << 24 | \
( UINT64 ) (( BYTE * )( p ))[5] << 16 | \
( UINT64 ) (( BYTE * )( p ))[6] << 8 | \
( UINT64 ) (( BYTE * )( p ))[7] ) )
#define HB_PUT_BE_UINT16( p, w ) { \
(( BYTE * )( p ))[0] = ( BYTE )( (w) >> 8 ); \
(( BYTE * )( p ))[1] = ( BYTE )( w ); \
}
#define HB_PUT_BE_UINT32( p, w ) { \
(( BYTE * )( p ))[0] = ( BYTE )( (w) >> 24 ); \
(( BYTE * )( p ))[1] = ( BYTE )( (w) >> 16 ); \
(( BYTE * )( p ))[2] = ( BYTE )( (w) >> 8 ); \
(( BYTE * )( p ))[3] = ( BYTE )( w ); \
}
#define HB_PUT_BE_UINT64( p, w ) { \
(( BYTE * )( p ))[0] = ( BYTE )( (w) >> 56 ); \
(( BYTE * )( p ))[1] = ( BYTE )( (w) >> 48 ); \
(( BYTE * )( p ))[2] = ( BYTE )( (w) >> 40 ); \
(( BYTE * )( p ))[3] = ( BYTE )( (w) >> 32 ); \
(( BYTE * )( p ))[4] = ( BYTE )( (w) >> 24 ); \
(( BYTE * )( p ))[5] = ( BYTE )( (w) >> 16 ); \
(( BYTE * )( p ))[6] = ( BYTE )( (w) >> 8 ); \
(( BYTE * )( p ))[7] = ( BYTE )( w ); \
}
#endif
/*
* 24 bit integers are not directly supported by any processor we used so far
* so we always have to build them from BYTEs and cannot use C casting
*/
#define HB_GET_LE_INT24( p ) ( ( INT32 ) \
( ( INT32 ) (( BYTE * )( p ))[0] | \
( INT32 ) (( BYTE * )( p ))[1] << 8 | \
( INT32 ) (( BYTE * )( p ))[2] << 16 | \
( INT32 ) ((( BYTE * )( p ))[2] & 0x80 ? 0xFF : 0x00 ) << 24 ) )
#define HB_GET_LE_UINT24( p ) ( ( UINT32 ) \
( ( UINT32 ) (( BYTE * )( p ))[0] | \
( UINT32 ) (( BYTE * )( p ))[1] << 8 | \
( UINT32 ) (( BYTE * )( p ))[2] << 16 ) )
#define HB_PUT_LE_UINT24( p, w ) { \
(( BYTE * )( p ))[0] = ( BYTE )( w ); \
(( BYTE * )( p ))[1] = ( BYTE )( (w) >> 8 ); \
(( BYTE * )( p ))[2] = ( BYTE )( (w) >> 16 ); \
}
#if defined( HB_PDP_ENDIAN )
#error PDP-Endian support unimplemented. If you have such machine do it yourself.
#elif !defined(HB_BIG_ENDIAN)
#elif defined( HB_BIG_ENDIAN )
/* We use Big-Endian here */
# ifndef HB_CAST_BYTE_NUMBERS_OFF
#define HB_GET_LE_UINT16( p ) HB_SWAP_UINT16( *( UINT16 * )( p ) )
#define HB_PUT_LE_UINT16( p, w ) ( *( UINT16 * )( p ) = HB_SWAP_UINT16( w ) )
#define HB_GET_LE_UINT32( p ) HB_SWAP_UINT32( *( UINT32 * )( p ) )
#define HB_PUT_LE_UINT32( p, l ) ( *( UINT32 * )( p ) = HB_SWAP_UINT32( l ) )
#define HB_GET_LE_UINT64( p ) HB_SWAP_UINT64( *( UINT64 * )( p ) )
#define HB_PUT_LE_UINT64( p, l ) ( *( UINT64 * )( p ) = HB_SWAP_UINT64( l ) )
#define HB_GET_BE_UINT16( p ) ( *( UINT16 * )( p ) )
#define HB_PUT_BE_UINT16( p, w ) ( *( UINT16 * )( p ) = ( UINT16 ) ( w ) )
#define HB_GET_BE_UINT32( p ) ( *( UINT32 * )( p ) )
#define HB_PUT_BE_UINT32( p, l ) ( *( UINT32 * )( p ) = ( UINT32 ) ( l ) )
#define HB_GET_BE_UINT64( p ) ( *( UINT64 * )( p ) )
#define HB_PUT_BE_UINT64( p, l ) ( *( UINT64 * )( p ) = ( UINT64 ) ( l ) )
# endif
#define HB_USHORT_FROM_LE( w ) HB_MKUSHORT( HB_HIBYTE( w ), HB_LOBYTE( w ) )
#define HB_ULONG_FROM_LE( l ) HB_MKULONG( HB_HIBYTE( HB_HIWORD( l ) ), HB_LOBYTE( HB_HIWORD( l ) ), HB_HIBYTE( l ), HB_LOBYTE( l ) )
#define HB_USHORT_TO_LE( w ) HB_USHORT_FROM_LE( w )
#define HB_ULONG_TO_LE( l ) HB_ULONG_FROM_LE( l )
#define HB_ORD2DBL( o, d ) { \
*( double * )( d ) = *( double * )( o ); \
if ( ( ( BYTE * ) ( d ) )[ 0 ] & 0x80 ) { \
( ( BYTE * ) ( d ) )[ 0 ] ^= 0x80; \
} else { \
( ( LONG * ) ( d ) )[ 0 ] ^= 0xFFFFFFFFL; \
( ( LONG * ) ( d ) )[ 1 ] ^= 0xFFFFFFFFL; \
} }
#define HB_DBL2ORD( d, o ) { \
*( double * )( o ) = *( double * )( d ); \
if ( *( double * )( o ) >= 0.0 ) { \
( ( BYTE * ) ( o ) )[ 0 ] ^= 0x80; \
} else { \
( ( LONG * ) ( o ) )[ 0 ] ^= 0xFFFFFFFFL; \
( ( LONG * ) ( o ) )[ 1 ] ^= 0xFFFFFFFFL; \
} }
#if defined( __GNUC__ )
/* Be careful with double conversion. Some machines can use mixed form
(Little/Big) for BYTE ORDER and WORD ORDER or even completely differ
internal representation */
#define HB_GET_LE_DOUBLE( p ) \
( { \
union { \
double d; \
BYTE buffer[ 8 ]; \
} u; \
u.buffer[ 0 ] = (( BYTE * )( p ))[ 7 ]; \
u.buffer[ 1 ] = (( BYTE * )( p ))[ 6 ]; \
u.buffer[ 2 ] = (( BYTE * )( p ))[ 5 ]; \
u.buffer[ 3 ] = (( BYTE * )( p ))[ 4 ]; \
u.buffer[ 4 ] = (( BYTE * )( p ))[ 3 ]; \
u.buffer[ 5 ] = (( BYTE * )( p ))[ 2 ]; \
u.buffer[ 6 ] = (( BYTE * )( p ))[ 1 ]; \
u.buffer[ 7 ] = (( BYTE * )( p ))[ 0 ]; \
u.d; \
} )
#define HB_PUT_LE_DOUBLE( p, d ) \
( { \
union { \
double d; \
BYTE buffer[ 8 ]; \
} u; \
u.d = d;
(( BYTE * )( p ))[ 7 ] = u.buffer[ 0 ]; \
(( BYTE * )( p ))[ 6 ] = u.buffer[ 1 ]; \
(( BYTE * )( p ))[ 5 ] = u.buffer[ 2 ]; \
(( BYTE * )( p ))[ 4 ] = u.buffer[ 3 ]; \
(( BYTE * )( p ))[ 3 ] = u.buffer[ 4 ]; \
(( BYTE * )( p ))[ 2 ] = u.buffer[ 5 ]; \
(( BYTE * )( p ))[ 1 ] = u.buffer[ 6 ]; \
(( BYTE * )( p ))[ 0 ] = u.buffer[ 7 ]; \
u.d; \
} )
#else
#error Little-Endian IEEE 754 double type conversion unimplemented with a non-GCC compiler
#endif
#else
/* We use Little-Endian here */
#define HB_GET_LE_USHORT( p ) ( *( USHORT * )( p ) )
#define HB_PUT_LE_USHORT( p, w ) ( *( USHORT * )( p ) = ( USHORT ) ( w ) )
#define HB_GET_LE_ULONG( p ) ( *( ULONG * )( p ) )
#define HB_PUT_LE_ULONG( p, l ) ( *( ULONG * )( p ) = ( ULONG ) ( l ) )
# ifndef HB_CAST_BYTE_NUMBERS_OFF
#define HB_GET_BE_USHORT( p ) HB_SWAP_USHORT( *( USHORT * )( p ) )
#define HB_PUT_BE_USHORT( p, w ) ( *( USHORT * )( p ) = HB_SWAP_USHORT( w ) )
#define HB_GET_BE_ULONG( p ) HB_SWAP_ULONG( *( ULONG * )( p ) )
#define HB_PUT_BE_ULONG( p, l ) ( *( ULONG * )( p ) = HB_SWAP_ULONG( l ) )
#define HB_GET_LE_UINT16( p ) ( *( UINT16 * )( p ) )
#define HB_PUT_LE_UINT16( p, w ) ( *( UINT16 * )( p ) = ( UINT16 ) ( w ) )
#define HB_GET_LE_UINT32( p ) ( *( UINT32 * )( p ) )
#define HB_PUT_LE_UINT32( p, l ) ( *( UINT32 * )( p ) = ( UINT32 ) ( l ) )
#define HB_GET_LE_UINT64( p ) ( *( UINT64 * )( p ) )
#define HB_PUT_LE_UINT64( p, l ) ( *( UINT64 * )( p ) = ( UINT64 ) ( l ) )
#define HB_GET_BE_UINT16( p ) HB_SWAP_UINT16( *( UINT16 * )( p ) )
#define HB_PUT_BE_UINT16( p, w ) ( *( UINT16 * )( p ) = HB_SWAP_UINT16( w ) )
#define HB_GET_BE_UINT32( p ) HB_SWAP_UINT32( *( UINT32 * )( p ) )
#define HB_PUT_BE_UINT32( p, l ) ( *( UINT32 * )( p ) = HB_SWAP_UINT32( l ) )
#define HB_GET_BE_UINT64( p ) HB_SWAP_UINT64( *( UINT64 * )( p ) )
#define HB_PUT_BE_UINT64( p, l ) ( *( UINT64 * )( p ) = HB_SWAP_UINT64( l ) )
#endif
#define HB_GET_LE_DOUBLE( p ) ( *( double * )( p ) )
#define HB_PUT_LE_DOUBLE( p, d ) ( *( double * )( p ) = ( double ) ( d ) )
@@ -199,13 +719,6 @@ typedef ULONG HB_PTRDIFF;
#define HB_ULONG_FROM_LE( l ) ( ( ULONG )( l ) )
#define HB_USHORT_TO_LE( w ) ( ( USHORT )( w ) )
#define HB_ULONG_TO_LE( l ) ( ( ULONG )( l ) )
#define HB_DOUBLE_TO_LE( d ) ( ( double )( d ) )
#define HB_PCODE_MKSHORT( p ) ( *( SHORT * )( p ) )
#define HB_PCODE_MKUSHORT( p ) ( *( USHORT * )( p ) )
#define HB_PCODE_MKLONG( p ) ( *( LONG * )( p ) )
#define HB_PCODE_MKULONG( p ) ( *( ULONG * )( p ) )
#define HB_PCODE_MKDOUBLE( p ) ( *( double * )( p ) )
#define HB_ORD2DBL( o, d ) { \
if ( ( ( BYTE * ) ( o ) )[ 0 ] & 0x80 ) { \
@@ -249,85 +762,54 @@ typedef ULONG HB_PTRDIFF;
( ( BYTE * ) ( o ) )[ 7 ] = ( ( BYTE * ) ( d ) )[ 0 ] ^ ( BYTE ) 0xFF; \
} }
#else
/* We use Big-Endian here */
#define HB_GET_LE_USHORT( p ) HB_SWAP_USHORT( *( USHORT * )( p ) )
#define HB_PUT_LE_USHORT( p, w ) ( *( USHORT * )( p ) = HB_SWAP_USHORT( w ) )
#define HB_GET_LE_ULONG( p ) HB_SWAP_ULONG( *( ULONG * )( p ) )
#define HB_PUT_LE_ULONG( p, l ) ( *( ULONG * )( p ) = HB_SWAP_ULONG( l ) )
#define HB_GET_BE_USHORT( p ) ( *( USHORT * )( p ) )
#define HB_PUT_BE_USHORT( p, w ) ( *( USHORT * )( p ) = ( USHORT ) ( w ) )
#define HB_GET_BE_ULONG( p ) ( *( ULONG * )( p ) )
#define HB_PUT_BE_ULONG( p, l ) ( *( ULONG * )( p ) = ( ULONG ) ( l ) )
#define HB_USHORT_FROM_LE( w ) HB_MKUSHORT( HB_HIBYTE( w ), HB_LOBYTE( w ) )
#define HB_ULONG_FROM_LE( l ) HB_MKULONG( HB_HIBYTE( HB_HIWORD( l ) ), HB_LOBYTE( HB_HIWORD( l ) ), HB_HIBYTE( l ), HB_LOBYTE( l ) )
#define HB_USHORT_TO_LE( w ) HB_USHORT_FROM_LE( w )
#define HB_ULONG_TO_LE( l ) HB_ULONG_FROM_LE( l )
#define HB_PCODE_MKSHORT( p ) HB_MKSHORT( *( BYTE * )( p ), ( ( BYTE * )( p ) )[ 1 ] )
#define HB_PCODE_MKUSHORT( p ) HB_MKUSHORT( *( BYTE * )( p ), ( ( BYTE * )( p ) )[ 1 ] )
#define HB_PCODE_MKLONG( p ) HB_MKLONG( *( BYTE * )( p ), ( ( BYTE * )( p ) )[ 1 ], ( ( BYTE * )( p ) )[ 2 ], ( ( BYTE * )( p ) )[ 3 ] )
#define HB_PCODE_MKULONG( p ) HB_MKULONG( *( BYTE * )( p ), ( ( BYTE * )( p ) )[ 1 ], ( ( BYTE * )( p ) )[ 2 ], ( ( BYTE * )( p ) )[ 3 ] )
#define HB_ORD2DBL( o, d ) { \
*( double * )( d ) = *( double * )( o ); \
if ( ( ( BYTE * ) ( d ) )[ 0 ] & 0x80 ) { \
( ( BYTE * ) ( d ) )[ 0 ] ^= 0x80; \
} else { \
( ( LONG * ) ( d ) )[ 0 ] ^= 0xFFFFFFFFL; \
( ( LONG * ) ( d ) )[ 1 ] ^= 0xFFFFFFFFL; \
} }
#define HB_DBL2ORD( d, o ) { \
*( double * )( o ) = *( double * )( d ); \
if ( *( double * )( o ) >= 0.0 ) { \
( ( BYTE * ) ( o ) )[ 0 ] ^= 0x80; \
} else { \
( ( LONG * ) ( o ) )[ 0 ] ^= 0xFFFFFFFFL; \
( ( LONG * ) ( o ) )[ 1 ] ^= 0xFFFFFFFFL; \
} }
#if defined( __GNUC__ )
/* Be careful with double conversion. Some machines can use mixed form
(Little/Big) for BYTE ORDER and WORD ORDER or even completely differ
internal representation */
#define HB_GET_LE_DOUBLE( p ) HB_PCODE_MKDOUBLE( p )
#define HB_PUT_LE_DOUBLE( p, d ) ( *( double * )( p ) = HB_DOUBLE_TO_LE( d ) )
#define HB_DOUBLE_TO_LE( d ) HB_DOUBLE_FROM_LE( d )
#define HB_DOUBLE_FROM_LE( d ) \
( { \
BYTE double_var[ 8 ]; \
*( double * )double_var = d; \
HB_PCODE_MKDOUBLE( double_var ); \
} )
#define HB_PCODE_MKDOUBLE( p ) \
( { \
union { \
double d; \
BYTE buffer[ 8 ]; \
} u; \
u.buffer[ 0 ] = ( p )[ 7 ]; \
u.buffer[ 1 ] = ( p )[ 6 ]; \
u.buffer[ 2 ] = ( p )[ 5 ]; \
u.buffer[ 3 ] = ( p )[ 4 ]; \
u.buffer[ 4 ] = ( p )[ 3 ]; \
u.buffer[ 5 ] = ( p )[ 2 ]; \
u.buffer[ 6 ] = ( p )[ 1 ]; \
u.buffer[ 7 ] = ( p )[ 0 ]; \
u.d; \
} )
#else
#error Little-Endian IEEE 754 double type conversion unimplemented with a non-GCC compiler
#endif
#define HB_GET_LE_INT16( p ) (( INT16 ) HB_GET_LE_UINT16( p ))
#define HB_GET_LE_INT32( p ) (( INT32 ) HB_GET_LE_UINT32( p ))
#define HB_GET_LE_INT64( p ) (( INT64 ) HB_GET_LE_UINT64( p ))
#define HB_PCODE_MKSHORT( p ) (( SHORT ) HB_GET_LE_INT16( p ))
#define HB_PCODE_MKUSHORT( p ) (( USHORT ) HB_GET_LE_UINT16( p ))
#define HB_PCODE_MKLONG( p ) (( LONG ) HB_GET_LE_INT32( p ))
#define HB_PCODE_MKULONG( p ) (( ULONG ) HB_GET_LE_UINT32( p ))
#define HB_PCODE_MKLONGLONG( p ) (( LONGLONG ) HB_GET_LE_INT64( p ))
#define HB_PCODE_MKULONGLONG( p ) (( ULONGLONG ) HB_GET_LE_UINT64( p ))
#define HB_PCODE_MKDOUBLE( p ) (( double ) HB_GET_LE_DOUBLE( p ))
#define HB_PCODE_MKINT24( p ) (( LONG ) HB_GET_LE_INT24( p ))
#define HB_PCODE_MKUINT24( p ) (( ULONG ) HB_GET_LE_UINT24( p ))
/*
* Below are hacked version of INT64 macros which operates on double
* when INT64 is not supported - they are necessary for PCODE and
* database access
*/
#if defined( HB_LONG_LONG_OFF ) && !defined( UINT64_MAX )
#undef HB_GET_LE_INT64
#undef HB_GET_LE_UINT64
#undef HB_PUT_LE_UINT64
#undef HB_PCODE_MKLONGLONG
#undef HB_PCODE_MKULONGLONG
#undef HB_DBL_LIM_INT64
#define UINT64_MAXDBL ( (( double ) UINT32_MAX + 1.0) * (( double ) UINT32_MAX + 1.0) - 1 )
#define HB_GET_LE_INT64( p ) ( ( double ) HB_GET_LE_UINT32( p ) + \
( double ) HB_GET_LE_UINT32( p + 4 ) * UINT32_MAX - \
((( BYTE * )( p ))[7] & 0x80 ? UINT64_MAXDBL : 0 ) )
#define HB_GET_LE_UINT64( p ) ( ( double ) HB_GET_LE_UINT32( p ) + \
( double ) HB_GET_LE_UINT32( p + 4 ) * UINT32_MAX )
#define HB_PUT_LE_UINT64( p, w ) { \
double _d = ( double ) ( w ); \
if ( _d < 0 ) \
_d += UINT64_MAXDBL; \
HB_PUT_LE_UINT32( p, ( UINT32 ) _d ); \
HB_PUT_LE_UINT32( p + 4, ( UINT32 ) ( _d / ( double ) UINT32_MAX ) ); \
}
#define HB_PCODE_MKLONGLONG( p ) (( double ) HB_GET_LE_INT64( p ))
#define HB_PCODE_MKULONGLONG( p ) (( double ) HB_GET_LE_UINT64( p ))
#define HB_DBL_LIM_INT64(d) ( (HB_MAXDBL) -UINT64_MAXDBL / 2 - 1 <= (HB_MAXDBL) (d) && (HB_MAXDBL) (d) <= (HB_MAXDBL) UINT64_MAXDBL / 2 )
#endif
#define HB_PCODE_MK24BIT( p ) HB_MKLONG( *( BYTE * )( p ), ( ( BYTE * )( p ) )[ 1 ], ( ( BYTE * )( p ) )[ 2 ], 0 )
#define HB_SYMBOL_UNUSED( symbol ) ( void ) symbol
#define HB_SYMBOL_UNUSED( symbol ) ( void ) symbol
/* ***********************************************************************
* The name of starting procedure
@@ -372,6 +854,9 @@ typedef PHB_FUNC HB_FUNC_PTR;
#elif defined( __BORLANDC__ )
#define HB_EXPORT _declspec( dllexport )
#elif defined( __WATCOMC__ )
#define HB_EXPORT __declspec( dllexport )
#elif defined( WIN32 ) && !defined( ASANT )
#define HB_EXPORT _declspec( dllexport )
@@ -394,10 +879,18 @@ typedef PHB_FUNC HB_FUNC_PTR;
are also prefixed with HB_. [vszakats] */
#define HB_FUNCNAME( funcname ) HB_FUN_##funcname
#define HB_FUNC( funcname ) HARBOUR HB_EXPORT HB_FUN_##funcname ( void )
#define HB_FUNC_STATIC( funcname ) static HARBOUR HB_FUN_##funcname ( void )
#define HB_FUNC_INIT( funcname ) static HARBOUR HB_FUN_##funcname ( void )
#define HB_FUNC_EXIT( funcname ) static HARBOUR HB_FUN_##funcname ( void )
#if ( defined( _MSC_VER ) || defined( __WATCOMC__ ) ) && defined( HB_FUNC_NO_DECORATION )
#define HB_EXTERN_C_ extern "C"
#else
#define HB_EXTERN_C_
#endif
#define HB_FUNC( funcname ) HB_EXTERN_C_ HARBOUR HB_EXPORT HB_FUN_##funcname ( void )
#define HB_FUNC_STATIC( funcname ) HB_EXTERN_C_ static HARBOUR HB_FUN_##funcname ( void )
#define HB_FUNC_EXTERN( funcname ) HB_EXTERN_C_ extern HARBOUR HB_FUN_##funcname ( void )
#define HB_FUNC_INIT( funcname ) HB_EXTERN_C_ static HARBOUR HB_FUN_##funcname ( void )
#define HB_FUNC_EXIT( funcname ) HB_EXTERN_C_ static HARBOUR HB_FUN_##funcname ( void )
typedef ULONG HB_HANDLE; /* handle to memvar value */
typedef char HB_SYMBOLSCOPE; /* stores symbol's scope */
@@ -426,22 +919,4 @@ typedef BYTE HB_ATTR;
#define HB_CHAR_SOFT1 ( ( char ) 141 )
#define HB_CHAR_SOFT2 ( ( char ) HB_CHAR_LF )
#ifndef HB_LONG_LONG_OFF
#if !defined(LONGLONG) && !defined(_WINNT_H)
#if defined(__GNUC__)
typedef long long LONGLONG;
#else
typedef __int64 LONGLONG;
#endif
#endif
#if !defined(ULONGLONG) && !defined(_WINNT_H)
#if defined(__GNUC__)
typedef unsigned long long ULONGLONG;
#else
typedef unsigned __int64 ULONGLONG;
#endif
#endif
#endif /* HB_LONG_LONG_OFF */
#endif /* HB_DEFS_H_ */

View File

@@ -361,25 +361,29 @@ static HB_EXPR_FUNC( hb_compExprUseString )
bValidMacro = hb_compExprIsValidMacro( szDupl, &bUseTextSubst, HB_MACRO_PARAM );
if( bUseTextSubst )
{
{
if( HB_SUPPORT_HARBOUR )
{
if( bValidMacro )
HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROTEXT );
else
hb_compErrorMacro( pSelf->value.asString.string );
HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROTEXT );
else
{
hb_compErrorMacro( pSelf->value.asString.string );
}
}
else
{
/* Clipper always generates macro substitution pcode
* even if it is not a valid expression
*/
HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROTEXT );
if( !bValidMacro )
hb_compErrorMacro( pSelf->value.asString.string );
HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROTEXT );
if( !bValidMacro )
{
hb_compErrorMacro( pSelf->value.asString.string );
}
}
}
hb_xfree( szDupl );
}
hb_xfree( szDupl );
}
break;
case HB_EA_POP_PCODE:
@@ -566,9 +570,9 @@ static void hb_compExprCodeblockEarly( HB_EXPR_PTR pSelf )
szDupl = hb_strupr( hb_strdup( pSelf->value.asCodeblock.string ) );
if( !hb_compExprIsValidMacro( szDupl, &bUseTextSubst, HB_MACRO_PARAM ) )
{
hb_compErrorCodeblock( pSelf->value.asCodeblock.string );
hb_compErrorMacro( pSelf->value.asCodeblock.string );
}
hb_compErrorCodeblock( pSelf->value.asCodeblock.string );
hb_compErrorMacro( pSelf->value.asCodeblock.string );
}
hb_xfree( szDupl );
pNew = hb_compExprNewMacro( hb_compExprNewString(pSelf->value.asCodeblock.string), 0, NULL );
HB_EXPR_USE( pNew, HB_EA_PUSH_PCODE );
@@ -1140,7 +1144,7 @@ static HB_EXPR_FUNC( hb_compExprUseArrayAt )
pExpr = pExpr->value.asList.pExprList; /* the first element in the array */
if( pIdx->value.asNum.NumType == HB_ET_LONG )
lIndex = pIdx->value.asNum.lVal;
lIndex = ( LONG ) pIdx->value.asNum.lVal;
else
lIndex = ( LONG ) pIdx->value.asNum.dVal;
@@ -1178,7 +1182,7 @@ static HB_EXPR_FUNC( hb_compExprUseArrayAt )
LONG lIndex;
if( pIdx->value.asNum.NumType == HB_ET_LONG )
lIndex = pIdx->value.asNum.lVal;
lIndex = ( LONG ) pIdx->value.asNum.lVal;
else
lIndex = ( LONG ) pIdx->value.asNum.dVal;
@@ -1478,7 +1482,7 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall )
{
HB_EXPR_PTR pName = pSelf->value.asFunCall.pFunName;
HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms;
USHORT usCount;
USHORT usCount = 0;
if( pParms )
{

View File

@@ -477,7 +477,7 @@ BOOL hb_compExprIsValidMacro( char * szText, BOOL *pbUseTextSubst, HB_MACRO_DECL
}
*pbUseTextSubst |= bTextSubst;
}
HB_SYMBOL_UNUSED( HB_MACRO_PARAM );
HB_SYMBOL_UNUSED( HB_MACRO_VARNAME ); /* to suppress BCC warning */
return bMacroText;
}
@@ -497,7 +497,7 @@ HB_EXPR_PTR hb_compExprReducePlusStrings( HB_EXPR_PTR pLeft, HB_EXPR_PTR pRight,
pLeft->value.asString.string[ pLeft->ulLength ] = '\0';
hb_compExprFree( pRight, HB_MACRO_PARAM );
HB_SYMBOL_UNUSED( HB_MACRO_PARAM ); /* to suppress BCC warning */
HB_SYMBOL_UNUSED( HB_MACRO_VARNAME ); /* to suppress BCC warning */
return pLeft;
}
#else
@@ -517,7 +517,7 @@ HB_EXPR_PTR hb_compExprReducePlusStrings( HB_EXPR_PTR pLeft, HB_EXPR_PTR pRight,
pLeft->value.asString.dealloc = TRUE;
hb_compExprFree( pRight, HB_MACRO_PARAM );
HB_SYMBOL_UNUSED( HB_MACRO_PARAM ); /* to suppress BCC warning */
HB_SYMBOL_UNUSED( HB_MACRO_VARNAME ); /* to suppress BCC warning */
return pLeft;
}
#endif

View File

@@ -187,7 +187,7 @@ typedef struct HB_EXPR_
} asRTVar; /* PUBLIC or PRIVATE variable declaration */
struct
{
long lVal; /* long value */
HB_LONG lVal; /* long value */
double dVal; /* double value */
unsigned char bWidth; /* unsigned char used intentionally */
unsigned char bDec; /* unsigned char used intentionally */
@@ -309,7 +309,7 @@ HB_EXPR_PTR hb_compExprNew( int );
HB_EXPR_PTR hb_compExprNewEmpty( void );
HB_EXPR_PTR hb_compExprNewNil( void );
HB_EXPR_PTR hb_compExprNewDouble( double, BYTE, BYTE );
HB_EXPR_PTR hb_compExprNewLong( LONG );
HB_EXPR_PTR hb_compExprNewLong( HB_LONG );
HB_EXPR_PTR hb_compExprNewString( char * );
HB_EXPR_PTR hb_compExprNewLogical( int );
HB_EXPR_PTR hb_compExprNewSelf( void );

View File

@@ -134,7 +134,7 @@ extern void hb_compGenJumpHere( ULONG ulOffset, HB_BISON_PTR pMacro );
extern ULONG hb_compGenJumpTrue( LONG lOffset, HB_BISON_PTR pMacro );
extern void hb_compMemvarGenPCode( BYTE bPCode, char * szVarName, HB_BISON_PTR pMacro );
extern void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias, HB_BISON_PTR pMacro );
extern void hb_compGenPushLong( long lNumber, HB_BISON_PTR pMacro );
extern void hb_compGenPushLong( HB_LONG lNumber, HB_BISON_PTR pMacro );
extern void hb_compGenMessage( char * szMsgName, HB_BISON_PTR pMacro );
extern void hb_compGenMessageData( char * szMsg, HB_BISON_PTR pMacro );
extern void hb_compGenPopVar( char * szVarName, HB_BISON_PTR pMacro );

View File

@@ -62,9 +62,7 @@
#include <math.h>
#endif
#if defined(HB_EXTERN_C)
extern "C" {
#endif
HB_EXTERN_BEGIN
#if defined(__WATCOMC__)
#define HB_MATH_HANDLER
@@ -92,6 +90,11 @@ extern "C" {
#define HB_MATH_HANDLER
#endif
#if !defined(HB_MATH_HANDLER) && defined(__GNUC__) && \
( defined(HB_OS_LINUX) || defined(HB_OS_UNIX) )
#define HB_MATH_ERRNO
#endif
typedef struct _HB_MATH_EXCEPTION
{
int type;
@@ -123,8 +126,6 @@ extern double hb_random_num( void );
/* include defines from math.ch */
#include <math.ch>
#if defined(HB_EXTERN_C)
}
#endif
HB_EXTERN_END
#endif /* HB_MATH_H_ */

View File

@@ -191,9 +191,9 @@ typedef enum
HB_P_MPUSHSTR, /* 124 Macro compiled pushed string */
HB_P_LOCALNEARADDINT, /* 125 Add/Subtract specified int into specified local without using the stack. */
HB_P_MACROPUSHREF, /* 126 Reference to macro variable @&mvar */
HB_P_PUSHLONGLONG, /* 127 places an integer number on the virtual machine stack */
/* NOTE: This have to be the last definition */
HB_P_LAST_PCODE /* 127 this defines the number of defined pcodes */
HB_P_LAST_PCODE /* 128 this defines the number of defined pcodes */
} HB_PCODE;
#endif /* HB_PCODE_H_ */

View File

@@ -62,18 +62,19 @@
#define HB_EXTERNAL_RDDDBF_USE
#include "hbrdddbf.h"
#if defined(HB_EXTERN_C)
extern "C" {
#endif
HB_EXTERN_BEGIN
/* CDX constants and defaults */
#define CDX_INDEXEXT ".cdx"
#define CDX_MAXKEY 240
#define CDX_MAXTAGNAMELEN 10
#define CDX_PAGELEN 512
#define CDX_INT_FREESPACE 500
#define CDX_EXT_FREESPACE 488
#define CDX_HEADERLEN 1024
#define CDX_HEADERPAGES ((CDX_HEADERLEN+CDX_PAGELEN-1)/CDX_PAGELEN)
#define CDX_INT_FREESPACE (CDX_PAGELEN-12) /* 500 */
#define CDX_EXT_FREESPACE (CDX_PAGELEN-24) /* 488 */
#define CDX_DUMMYNODE 0xFFFFFFFFL
//#define CDX_LOCKOFFSET 0x7FFFFFFEL
//#define CDX_LOCKSIZE 1L
#define CDX_STACKSIZE 64
@@ -87,14 +88,16 @@ extern "C" {
#define CDX_BALANCE_LEAFPAGES 3
#define CDX_BALANCE_INTPAGES 3
/*
#define CDX_CURKEY_UNDEF 1
#define CDX_CURKEY_REC 2
#define CDX_CURKEY_VAL 4
#define CDX_CURKEY_INPAGE 8
#define CDX_CURKEY_INSTACK 16
#define CDX_CURKEY_NOTEXIST 32
*/
#define CDX_CURKEY_UNDEF (1<< 0)
#define CDX_CURKEY_REC (1<< 1)
#define CDX_CURKEY_VAL (1<< 2)
#define CDX_CURKEY_INPAGE (1<< 3)
#define CDX_CURKEY_INSTACK (1<< 4)
#define CDX_CURKEY_NOTEXIST (1<< 5)
#define CDX_CURKEY_RAWCNT (1<< 6)
#define CDX_CURKEY_RAWPOS (1<< 7)
#define CDX_CURKEY_LOGCNT (1<< 8)
#define CDX_CURKEY_LOGPOS (1<< 9)
#define TOP_RECORD 1
#define BTTM_RECORD 2
@@ -109,6 +112,19 @@ extern "C" {
#define NODE_BALANCE 8
#define NODE_EAT 16
#define CURKEY_RAWCNT(pTag) (((pTag)->curKeyState & CDX_CURKEY_RAWCNT) != 0)
#define CURKEY_LOGCNT(pTag) (((pTag)->curKeyState & CDX_CURKEY_LOGCNT) != 0)
#define CURKEY_RAWPOS(pTag) ( ((pTag)->curKeyState & CDX_CURKEY_RAWPOS) != 0 && \
(pTag)->rawKeyRec == (pTag)->CurKey->rec )
#define CURKEY_SETRAWPOS(pTag) { (pTag)->curKeyState |= CDX_CURKEY_RAWPOS; \
(pTag)->rawKeyRec = (pTag)->CurKey->rec; }
#define CURKEY_LOGPOS(pTag) ( ((pTag)->curKeyState & CDX_CURKEY_LOGPOS) != 0 && \
(pTag)->logKeyRec == (pTag)->pIndex->pArea->ulRecNo )
#define CURKEY_SETLOGPOS(pTag) { (pTag)->curKeyState |= CDX_CURKEY_LOGPOS; \
(pTag)->logKeyRec = (pTag)->pIndex->pArea->ulRecNo; }
/*
#define CURKEY_UNDEF(pTag) (((pTag)->curKeyState & CDX_CURKEY_UNDEF) != 0)
#define CURKEY_NOTEXIST(pTag) (((pTag)->curKeyState & CDX_CURKEY_NOTEXIST) != 0)
@@ -134,6 +150,8 @@ extern "C" {
#define CDX_TYPE_COMPOUND 0x40 /* FoxPro */
#define CDX_TYPE_STRUCTURE 0x80 /* FoxPro */
typedef void ( * HB_EVALSCOPE_FUNC )( ULONG, BYTE *, ULONG, void * );
/* CDX index node strucutres */
/* Compact Index Header Record */
typedef struct _CDXTAGHEADER
@@ -150,7 +168,7 @@ typedef struct _CDXTAGHEADER
BYTE forExpLen[ 2 ]; /* length of filter expression */
BYTE keyExpPos[ 2 ]; /* offset of key expression */
BYTE keyExpLen[ 2 ]; /* length of key expression */
BYTE keyExpPool[ CDX_PAGELEN ];
BYTE keyExpPool[ CDX_HEADERLEN - 512 ];
} CDXTAGHEADER;
typedef CDXTAGHEADER * LPCDXTAGHEADER;
@@ -283,7 +301,13 @@ typedef struct _CDXTAG
BOOL TagEOF;
BOOL fRePos;
BYTE curKeyState; /* see: CDX_CURKEY_* */
int curKeyState; /* see: CDX_CURKEY_* */
ULONG rawKeyCount;
ULONG rawKeyPos;
ULONG rawKeyRec;
ULONG logKeyCount;
ULONG logKeyPos;
ULONG logKeyRec;
ULONG TagBlock; /* a page offset where a tag header is stored */
ULONG RootBlock; /* a page offset with the root of keys tree */
@@ -329,9 +353,49 @@ typedef struct _CDXINDEX
#endif
BOOL fChanged; /* changes written to index, need upadte ulVersion */
ULONG ulVersion; /* network version/update flag */
BOOL fFlush; /* changes written to index, need upadte ulVersion */
} CDXINDEX;
typedef CDXINDEX * LPCDXINDEX;
/* for index creation */
typedef struct
{
ULONG nOffset; /* offset in temporary file */
ULONG ulKeys; /* number of keys in page */
ULONG ulKeyBuf; /* number of keys in memory buffer */
ULONG ulCurKey; /* current key in memory buffer */
BYTE * pKeyPool; /* memory buffer */
} CDXSWAPPAGE;
typedef CDXSWAPPAGE * LPCDXSWAPPAGE;
typedef struct
{
LPCDXTAG pTag; /* current Tag */
FHANDLE hTempFile; /* handle to temporary file */
char * szTempFileName; /* temporary file name */
int keyLen; /* key length */
BYTE bTrl; /* filler char for shorter keys */
BOOL fUnique; /* TRUE if index is unique */
ULONG ulMaxRec; /* the highest record number */
ULONG ulTotKeys; /* total number of keys indexed */
ULONG ulKeys; /* keys in curently created page */
ULONG ulPages; /* number of pages */
ULONG ulCurPage; /* current page */
ULONG ulPgKeys; /* maximum number of key in page memory buffer */
ULONG ulMaxKey; /* maximum number of keys in single page */
BYTE * pKeyPool; /* memory buffer for current page then for pages */
LPCDXSWAPPAGE pSwapPage; /* list of pages */
LPCDXPAGE NodeList[ CDX_STACKSIZE ]; /* Stack of pages */
BYTE pLastKey[ CDX_MAXKEY ]; /* last key val */
ULONG ulLastRec;
BYTE * pRecBuff;
#ifndef HB_CDX_PACKTRAIL
int iLastTrl; /* last key trailing spaces */
#endif
} CDXSORTINFO;
typedef CDXSORTINFO * LPCDXSORTINFO;
/*
* DBF WORKAREA
@@ -384,6 +448,8 @@ typedef struct _CDXAREA
BYTE bMemoType; /* MEMO type used in DBF memo fields */
BOOL fHasMemo; /* WorkArea with Memo fields */
BOOL fHasTags; /* WorkArea with MDX or CDX index */
BOOL fDataFlush; /* data was written to DBF and not commited */
BOOL fMemoFlush; /* data was written to MEMO and not commited */
BYTE bVersion; /* DBF version ID byte */
BYTE bCodePage; /* DBF codepage ID */
BOOL fShared; /* Shared file */
@@ -418,10 +484,11 @@ typedef struct _CDXAREA
* example.
*/
BOOL fCdxAppend; /* Appended record changed */
LPCDXINDEX lpIndexes; /* Pointer to indexes array */
USHORT uiTag; /* current tag focus */
BYTE * bCdxSortTab; /* Table with storted characters */
BOOL fCdxAppend; /* Appended record changed */
LPCDXINDEX lpIndexes; /* Pointer to indexes array */
USHORT uiTag; /* current tag focus */
BYTE * bCdxSortTab; /* Table with storted characters */
LPCDXSORTINFO pSort; /* Index build structur */
} CDXAREA;
@@ -446,7 +513,7 @@ static ERRCODE hb_cdxGoBottom( CDXAREAP pArea );
#define hb_cdxGoToId NULL
static ERRCODE hb_cdxGoTop( CDXAREAP pArea );
static ERRCODE hb_cdxSeek( CDXAREAP pArea, BOOL bSoftSeek, PHB_ITEM pKey, BOOL bFindLast );
#define hb_cdxSkip NULL
static ERRCODE hb_cdxSkip( CDXAREAP pArea, LONG lToSkip );
#define hb_cdxSkipFilter NULL
static ERRCODE hb_cdxSkipRaw( CDXAREAP pArea, LONG lToSkip );
#define hb_cdxAddField NULL
@@ -506,13 +573,13 @@ static ERRCODE hb_cdxOrderListRebuild( CDXAREAP pArea );
static ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo );
static ERRCODE hb_cdxOrderDestroy( CDXAREAP pArea, LPDBORDERINFO pOrderInfo );
static ERRCODE hb_cdxOrderInfo( CDXAREAP pArea, USHORT uiIndex, LPDBORDERINFO pOrderInfo );
#define hb_cdxClearFilter NULL
static ERRCODE hb_cdxClearFilter( CDXAREAP pArea );
#define hb_cdxClearLocate NULL
static ERRCODE hb_cdxClearScope( CDXAREAP pArea );
#define hb_cdxCountScope NULL
static ERRCODE hb_cdxCountScope( CDXAREAP pArea, void * pPtr, LONG * plRec );
#define hb_cdxFilterText NULL
static ERRCODE hb_cdxScopeInfo( CDXAREAP pArea, USHORT nScope, PHB_ITEM pItem );
#define hb_cdxSetFilter NULL
static ERRCODE hb_cdxSetFilter( CDXAREAP pArea, LPDBFILTERINFO pFilterInfo );
#define hb_cdxSetLocate NULL
static ERRCODE hb_cdxSetScope( CDXAREAP pArea, LPDBORDSCOPEINFO sInfo );
#define hb_cdxSkipScope NULL
@@ -534,10 +601,6 @@ static ERRCODE hb_cdxSetScope( CDXAREAP pArea, LPDBORDSCOPEINFO sInfo );
#define hb_cdxExists NULL
#define hb_cdxWhoCares NULL
//#define hb_cdxSwapBytes( n ) HB_SWAP_ULONG( n );
#if defined(HB_EXTERN_C)
}
#endif
HB_EXTERN_END
#endif /* HB_RDDCDX_H_ */

View File

@@ -53,19 +53,17 @@
#ifndef HB_RDDDBF_H_
#define HB_RDDDBF_H_
#include "hbsetup.h"
#include "hbapirdd.h"
#include "hbdbferr.h"
#ifndef HB_CDP_SUPPORT_OFF
#include "hbapicdp.h"
#if defined(HB_EXTERN_C)
extern "C" {
#endif
HB_EXTERN_BEGIN
/* DBF default file extensions */
#define DBF_TABLEEXT ".dbf"
/* DBF lock */
#define DBF_LOCKPOS 1000000000L
#define DBF_TABLEEXT ".dbf"
/* DBF locking schemes */
#define DBF_LOCKPOS_CLIP 1000000000L
#define DBF_LOCKPOS_CL53 1000000000L
@@ -100,9 +98,6 @@ extern "C" {
#define DBF_EXLUSIVE_LOCKSIZE 1L
#endif
/*
* DBF WORKAREA
* ------------
@@ -154,6 +149,8 @@ typedef struct _DBFAREA
BYTE bMemoType; /* MEMO type used in DBF memo fields */
BOOL fHasMemo; /* WorkArea with Memo fields */
BOOL fHasTags; /* WorkArea with MDX or CDX index */
BOOL fDataFlush; /* data was written to DBF and not commited */
BOOL fMemoFlush; /* data was written to MEMO and not commited */
BYTE bVersion; /* DBF version ID byte */
BYTE bCodePage; /* DBF codepage ID */
BOOL fShared; /* Shared file */
@@ -176,7 +173,9 @@ typedef struct _DBFAREA
BYTE bLockType; /* Type of locking shemes */
ULONG * pLocksPos; /* List of records locked */
ULONG ulNumLocksPos; /* Number of records locked */
#ifndef HB_CDP_SUPPORT_OFF
PHB_CODEPAGE cdPage; /* Area's codepage pointer */
#endif
} DBFAREA;
typedef DBFAREA * LPDBFAREA;
@@ -185,7 +184,6 @@ typedef DBFAREA * LPDBFAREA;
#define DBFAREAP LPDBFAREA
#endif
#ifndef HB_EXTERNAL_RDDDBF_USE
/*
@@ -224,7 +222,7 @@ static ERRCODE hb_dbfPutRec( DBFAREAP pArea, BYTE * pBuffer );
static ERRCODE hb_dbfPutValue( DBFAREAP pArea, USHORT uiIndex, PHB_ITEM pItem );
static ERRCODE hb_dbfRecall( DBFAREAP pArea );
static ERRCODE hb_dbfRecCount( DBFAREAP pArea, ULONG * pRecCount );
#define hb_dbfRecInfo NULL
static ERRCODE hb_dbfRecInfo( DBFAREAP pArea, PHB_ITEM pRecID, USHORT uiInfoType, PHB_ITEM pInfo );
static ERRCODE hb_dbfRecNo( DBFAREAP pArea, PHB_ITEM pRecNo );
static ERRCODE hb_dbfSetFieldExtent( DBFAREAP pArea, USHORT uiFieldExtent );
#define hb_dbfAlias NULL
@@ -288,20 +286,18 @@ static ERRCODE hb_dbfWriteDBHeader( DBFAREAP pArea );
#define hb_dbfExit NULL
static ERRCODE hb_dbfDrop( PHB_ITEM pItemTable );
static BOOL hb_dbfExists( PHB_ITEM pItemTable, PHB_ITEM pItemIndex );
#define hb_dbfWhoCares NULL
#endif /* HB_EXTERNAL_RDDDBF_USE */
extern BOOL HB_EXPORT hb_dbfExists( PHB_ITEM pItemTable, PHB_ITEM pItemIndex );
extern ULONG HB_EXPORT hb_dbfGetMemoBlock( DBFAREAP pArea, USHORT uiIndex );
extern void HB_EXPORT hb_dbfPutMemoBlock( DBFAREAP pArea, USHORT uiIndex, ULONG ulBlock );
extern ERRCODE HB_EXPORT hb_dbfGetEGcode( ERRCODE errCode );
extern BOOL HB_EXPORT hb_dbfLockIdxFile( FHANDLE hFile, BYTE bScheme, USHORT usMode, ULONG *pPoolPos );
extern BOOL HB_EXPORT hb_dbfLockIdxGetData( BYTE bScheme, ULONG *ulPos, ULONG *ulPool );
#if defined(HB_EXTERN_C)
}
#endif
HB_EXTERN_END
#endif /* HB_RDDDBF_H_ */

View File

@@ -53,6 +53,7 @@
#ifndef HB_RDDDBT_H_
#define HB_RDDDBT_H_
#include "hbsetup.h"
#include "hbdbf.h"
#include "hbdbferr.h"
#include "hbapirdd.h"
@@ -62,9 +63,7 @@
#define HB_EXTERNAL_RDDDBF_USE
#include "hbrdddbf.h"
#if defined(HB_EXTERN_C)
extern "C" {
#endif
HB_EXTERN_BEGIN
/* MEMO constants and defaults */
#define DBT_MEMOEXT ".dbt"
@@ -189,12 +188,6 @@ static ERRCODE hb_dbtWriteDBHeader( DBTAREAP pArea );
#define hb_dbtExists NULL
#define hb_dbtWhoCares NULL
#if defined(HB_EXTERN_C)
}
#endif
extern ULONG hb_dbfGetMemoBlock( DBFAREAP pArea, USHORT uiIndex );
extern void hb_dbfPutMemoBlock( DBFAREAP pArea, USHORT uiIndex, ULONG ulBlock );
HB_EXTERN_END
#endif /* HB_RDDDBT */

View File

@@ -63,9 +63,7 @@
#define HB_EXTERNAL_RDDDBF_USE
#include "hbrdddbf.h"
#if defined(HB_EXTERN_C)
extern "C" {
#endif
HB_EXTERN_BEGIN
/* MEMO constants and defaults */
#define FPT_MEMOEXT ".fpt"
@@ -102,33 +100,43 @@ extern "C" {
//#define FPTIT_SIX_VREF 0x2000
//#define FPTIT_SIX_MREF 0x4000
#define FPTIT_FLEX_GC 0x03E8
#define FPTIT_FLEX_UNUSED 0x03E9
#define FPTIT_FLEX_GC 0x03E8 // 1000
#define FPTIT_FLEX_UNUSED 0x03E9 // 1001
#define FPTIT_FLEX_ARRAY 0x03EA // 1002
#define FPTIT_FLEX_OBJECT 0x03EB // 1003 *
#define FPTIT_FLEX_VOARR 0x03EC // 1004 *
#define FPTIT_FLEX_VOOBJ 0x03ED // 1005 *
#define FPTIT_FLEX_NIL 0x03EE // 1006
#define FPTIT_FLEX_TRUE 0x03EF // 1007
#define FPTIT_FLEX_FALSE 0x03F0 // 1008
#define FPTIT_FLEX_LDATE 0x03F1 // 1009
#define FPTIT_FLEX_CHAR 0x03F2 // 1010
#define FPTIT_FLEX_UCHAR 0x03F3 // 1011 *
#define FPTIT_FLEX_SHORT 0x03F4 // 1012
#define FPTIT_FLEX_USHORT 0x03F5 // 1013 *
#define FPTIT_FLEX_LONG 0x03F6 // 1014
#define FPTIT_FLEX_ULONG 0x03F7 // 1015 *
#define FPTIT_FLEX_DOUBLE 0x03F8 // 1016
#define FPTIT_FLEX_LDOUBLE 0x03F9 // 1017 *
#define FPTIT_FLEX_COMPCH 0x03FA // 1018 *
#define FPTIT_FLEX_ARRAY 0x03EA
#define FPTIT_FLEX_NIL 0x03EE
#define FPTIT_FLEX_TRUE 0x03EF
#define FPTIT_FLEX_FALSE 0x03F0
#define FPTIT_FLEX_LDATE 0x03F1
#define FPTIT_FLEX_BYTE 0x03F2
#define FPTIT_FLEX_SHORT 0x03F4
#define FPTIT_FLEX_LONG 0x03F6
#define FPTIT_FLEX_DOUBLE 0x03F8
#define FPTIT_FLEXAR_ARAY 0x0C
#define FPTIT_FLEXAR_NIL 0x00
#define FPTIT_FLEXAR_STR 0x07
#define FPTIT_FLEXAR_ARAY 0x0C
#define FPTIT_FLEXAR_DATE 0x0E
#define FPTIT_FLEXAR_DBL 0x0F
#define FPTIT_FLEXAR_BYTE 0x11
#define FPTIT_FLEXAR_CHAR 0x12
#define FPTIT_FLEXAR_SHORT 0x13
#define FPTIT_FLEXAR_USHORT 0x14
#define FPTIT_FLEXAR_LONG 0x15
#define FPTIT_FLEXAR_NUL 0x18
#define FPTIT_FLEXAR_TRUE 0x19
#define FPTIT_FLEXAR_FALSE 0x1A
#define FPTIT_FLEXAR_DATE 0x0E
#define FPTIT_FLEXAR_BYTE1 0x11
#define FPTIT_FLEXAR_BYTE 0x12
#define FPTIT_FLEXAR_BYTE2 0x1D
#define FPTIT_FLEXAR_SHORT 0x13
#define FPTIT_FLEXAR_SHORT2 0x1E
#define FPTIT_FLEXAR_LONG 0x20
#define FPTIT_FLEXAR_DBL 0x0F
#define FPTIT_FLEXAR_STR 0x07
#define FPTIT_FLEXAR_NUL 0x18
#define FPTIT_FLEXAR_LONG2 0x20
#define FPTIT_FLEXAR_ULONG 0x21
/*
#define HB_IT_NIL ( ( USHORT ) 0x0000 )
@@ -155,7 +163,7 @@ typedef struct _FPTHEADER
BYTE flexRev[ 4 ]; /* Offset of reversed GC page */
BYTE flexDir[ 4 ]; /* Offset of GC page */
BYTE counter[ 4 ]; /* cyclic counter to sign changes in network env. */
BYTE reserved3[ 4 ]; /* */
BYTE rootBlock[ 4 ]; /* Clipper 5.3 ROOT data block */
BYTE flexSize[ 2 ]; /* FlexFile3 alternative block size */
BYTE reserved4[ 482 ]; /* */
} FPTHEADER;
@@ -233,7 +241,7 @@ typedef FPTAREA * LPFPTAREA;
#define hb_fptDeleted NULL
#define hb_fptFieldCount NULL
#define hb_fptFieldDisplay NULL
#define hb_fptFieldInfo NULL
static ERRCODE hb_fptFieldInfo( FPTAREAP pArea, USHORT uiIndex, USHORT uiType, PHB_ITEM pItem );
#define hb_fptFieldName NULL
#define hb_fptFlush NULL
#define hb_fptGetRec NULL
@@ -311,8 +319,6 @@ static ERRCODE hb_fptWriteDBHeader( FPTAREAP pArea );
#define hb_fptExists NULL
#define hb_fptWhoCares NULL
#if defined(HB_EXTERN_C)
}
#endif
HB_EXTERN_END
#endif /* HB_RDDFPT */

View File

@@ -269,6 +269,8 @@ typedef struct _NTXAREA
BYTE bMemoType; /* MEMO type used in DBF memo fields */
BOOL fHasMemo; /* WorkArea with Memo fields */
BOOL fHasTags; /* WorkArea with MDX or CDX index */
BOOL fDataFlush; /* data was written to DBF and not commited */
BOOL fMemoFlush; /* data was written to MEMO and not commited */
BYTE bVersion; /* DBF version ID byte */
BYTE bCodePage; /* DBF codepage ID */
BOOL fShared; /* Shared file */

View File

@@ -129,7 +129,9 @@ typedef enum
HB_SET_DIRCASE = 103,
HB_SET_DIRSEPARATOR = 104,
HB_SET_EOF = 105,
HB_SET_DBFLOCKSCHEME = 106
HB_SET_HARDCOMMIT = 106,
HB_SET_FORCEOPT = 107,
HB_SET_DBFLOCKSCHEME = 108
} HB_set_enum;
@@ -194,6 +196,8 @@ typedef struct
int HB_SET_VIDEOMODE;
BOOL HB_SET_WRAP;
int HB_SET_DBFLOCKSCHEME;
BOOL HB_SET_HARDCOMMIT;
BOOL HB_SET_FORCEOPT;
} HB_SET_STRUCT;
#define HB_SET_CASE_MIXED 0

View File

@@ -298,8 +298,14 @@
#endif
#endif
#ifdef HB_OS_DARWIN
#if ! defined(HB_OS_BSD)
#define HB_OS_BSD
#endif
#endif
#ifndef HB_OS_UNIX
#ifdef OS_UNIX_COMPATIBLE
#if defined(OS_UNIX_COMPATIBLE) || defined(HB_OS_LINUX) || defined(HB_OS_BSD)
#define HB_OS_UNIX
#endif
#endif
@@ -334,7 +340,13 @@
#if defined(__cplusplus) && !defined(__IBMCPP__)
#define HB_EXTERN_C
#define HB_EXTERN_BEGIN extern "C" {
#define HB_EXTERN_END }
#else
#define HB_EXTERN_BEGIN
#define HB_EXTERN_END
#endif
#endif /* HB_SETUP_H_ */

View File

@@ -120,8 +120,11 @@
#define _SET_DIRCASE 103 /* Harbour extension */
#define _SET_DIRSEPARATOR 104 /* Harbour extension */
#define _SET_EOF 105 /* Harbour extension */
#define _SET_HARDCOMMIT 106 /* Harbour extension */
#define _SET_FORCEOPT 107 /* Harbour extension */
#define _SET_DBFLOCKSCHEME 108 /* Harbour extension */
#define HB_SET_BASE 100
#define HB_SET_COUNT 6
#define HB_SET_COUNT 9
#endif /* _SET_CH */

112
harbour/make_bsd.sh Normal file
View File

@@ -0,0 +1,112 @@
#!/usr/local/bin/bash
#
# $Id$
#
# ---------------------------------------------------------------
# Template to initialize the environment before starting
# the GNU make system for Harbour
#
# For further information about the GNU make system please
# check doc/gmake.txt
#
# Copyright 1999-2001 Viktor Szakats (viktor.szakats@syenar.hu)
# See doc/license.txt for licensing terms.
# ---------------------------------------------------------------
if [ -z "$HB_ARCHITECTURE" ]; then export HB_ARCHITECTURE=bsd; fi
if [ -z "$HB_COMPILER" ]; then export HB_COMPILER=gcc; fi
if [ -z "$HB_GT_LIB" ]; then export HB_GT_LIB=gtstd; fi
if [ -z "$HB_MULTI_GT" ]; then export HB_MULTI_GT=no; fi
if [ -z "$HB_MT" ]; then export HB_MT=MT; fi
# export PRG_USR=
# export C_USR=
# export L_USR=
# Set to constant value to be consistent with the non-GNU make files.
export PREFIX=/usr/local
if [ -z "$HB_BIN_INSTALL" ]; then export HB_BIN_INSTALL=$PREFIX/bin/; fi
if [ -z "$HB_LIB_INSTALL" ]; then export HB_LIB_INSTALL=$PREFIX/lib/xharbour/; fi
if [ -z "$HB_INC_INSTALL" ]; then export HB_INC_INSTALL=$PREFIX/include/xharbour/; fi
if [ -z "$HB_ARCHITECTURE" ]; then
echo "Error: HB_ARCHITECTURE is not set."
fi
if [ -z "$HB_COMPILER" ]; then
echo "Error: HB_COMPILER is not set."
fi
if [ -z "$HB_ARCHITECTURE" ] || [ -z "$HB_COMPILER" ]; then
echo
echo "Usage: make_gnu.sh [command]"
echo
echo "The following commands are supported:"
echo " - all (default)"
echo " - clean"
echo " - install"
echo
echo "Notes:"
echo
echo " - HB_ARCHITECTURE and HB_COMPILER envvars must be set."
echo " The following values are currently supported:"
echo
echo " HB_ARCHITECTURE:"
echo " - dos (HB_GT_LIB=gtdos by default)"
echo " - w32 (HB_GT_LIB=gtw32 by default)"
echo " - linux (HB_GT_LIB=gtstd by default)"
echo " - os2 (HB_GT_LIB=gtos2 by default)"
echo
read
echo " HB_COMPILER:"
echo " - When HB_ARCHITECTURE=dos"
echo " - bcc16 (Borland C++ 3.x, 4.x, 5.0x, DOS 16-bit)"
echo " - djgpp (Delorie GNU C, DOS 32-bit)"
echo " - rxs32 (EMX/RSXNT/DOS GNU C, DOS 32-bit)"
echo " - watcom (Watcom C++ 9.x, 10.x, 11.x, DOS 32-bit)"
echo " - When HB_ARCHITECTURE=w32"
echo " - bcc32 (Borland C++ 4.x, 5.x, Windows 32-bit)"
echo " - gcc (Cygnus/Cygwin GNU C, Windows 32-bit)"
echo " - mingw32 (Cygnus/Mingw32 GNU C, Windows 32-bit)"
echo " - rxsnt (EMX/RSXNT/Win32 GNU C, Windows 32-bit)"
echo " - icc (IBM Visual Age C++, Windows 32-bit)"
echo " - msvc (Microsoft Visual C++, Windows 32-bit)"
echo " - When HB_ARCHITECTURE=linux"
echo " - gcc (GNU C, 32-bit)"
echo " - When HB_ARCHITECTURE=os2"
echo " - gcc (EMX GNU C, OS/2 32-bit)"
echo " - icc (IBM Visual Age C++ 3.0, OS/2 32-bit)"
echo
read
echo " HB_GT_LIB:"
echo " - gtstd (Standard streaming) (for all architectures)"
echo " - gtdos (DOS console) (for dos architecture)"
echo " - gtwin (Win32 console) (for w32 architecture)"
echo " - gtwvt (Win32 win console) (for w32 architecture)"
echo " - gtos2 (OS/2 console) (for os2 architecture)"
echo " - gtpca (PC ANSI console) (for all architectures)"
echo " - gtcrs (Curses console) (for linux, w32 architectures)"
echo " - gtsln (Slang console) (for linux, w32 architectures)"
echo " - gtxvt (XWindow console) (for linux architecture)"
echo
echo " - Use these optional envvars to configure the make process"
echo " when using the 'all' command:"
echo
echo " PRG_USR - Extra Harbour compiler options"
echo " C_USR - Extra C compiler options"
echo " L_USR - Extra linker options"
exit
else
# ---------------------------------------------------------------
# Start the GNU make system
gmake $*
if [ "$*" = "clean" ]; then
find . -type d -name "$HB_ARCHITECTURE" | xargs rmdir 2> /dev/null
fi
fi

31
harbour/make_drw.sh Normal file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
#
# $Id$
#
# ---------------------------------------------------------------
# Template to initialize the environment before starting
# the GNU make system for Harbour
#
# For further information about the GNU make system please
# check doc/gmake.txt
#
# Copyright 1999-2001 Viktor Szakats (viktor.szakats@syenar.hu)
# See doc/license.txt for licensing terms.
# ---------------------------------------------------------------
export HB_ARCHITECTURE=darwin
export HB_COMPILER=gcc
export HB_GPM_MOUSE=no
export HB_MULTI_GT=no
export PREFIX=/usr/local
if [ -z "$HB_GT_LIB" ]; then export HB_GT_LIB=gtstd; fi
# Set to constant value to be consistent with the non-GNU make files.
if [ -z "$HB_BIN_INSTALL" ]; then export HB_BIN_INSTALL=$PREFIX/bin/; fi
if [ -z "$HB_LIB_INSTALL" ]; then export HB_LIB_INSTALL=$PREFIX/lib/xharbour/; fi
if [ -z "$HB_INC_INSTALL" ]; then export HB_INC_INSTALL=$PREFIX/include/xharbour/; fi
. `dirname $0`/make_gnu.sh $*

View File

@@ -10,25 +10,32 @@
# See doc/license.txt for licensing terms.
# ---------------------------------------------------------------
# please add your distro suffix if it not belong to the one recognized below
# and remember that order checking can be important
hb_platform=`rel=$(rpm -q --queryformat='.%{VERSION}' mandrake-release 2>/dev/null) && echo "mdk$rel"|tr -d "."`
[ "${hb_platform}" = "" ] && hb_platform=`rel=$(rpm -q --queryformat='.%{VERSION}' redhat-release 2>/dev/null) && echo "rh$rel"|tr -d "."`
[ "${hb_platform}" = "" ] || hb_platform="-${hb_platform}"
cd `dirname $0`
. bin/hb-func.sh
name="harbour"
hb_ver="0.44.0"
hb_ver=`get_hbver`
hb_platform=`get_hbplatform`
[ "${hb_platform}" = "" ] || hb_platform="-${hb_platform}"
hb_archfile="${name}-${hb_ver}${hb_platform}.bin.tar.gz"
hb_instfile="${name}-${hb_ver}${hb_platform}.inst.sh"
hb_lnkso="yes"
hb_pref="hb"
hb_libs="vm pp rtl rdd dbfdbt dbffpt dbfcdx dbfntx macro common lang codepage gtnul gtcrs gtsln gtcgi gtstd gtpca odbc ct debug profiler"
export C_USR="-DHB_FM_STATISTICS_OFF -O3"
hb_contrib="libct rdd_ads"
export C_USR="-DHB_FM_STATISTICS_OFF -O2"
if [ -z "$HB_ARCHITECTURE" ]; then export HB_ARCHITECTURE=linux; fi
if [ -z "$HB_COMPILER" ]; then export HB_COMPILER=gcc; fi
if [ -z "$HB_GPM_MOUSE" ]; then export HB_GPM_MOUSE=yes; fi
if [ -z "$HB_GT_LIB" ]; then export HB_GT_LIB=gtcrs; fi
if [ -z "$HB_MULTI_GT" ]; then export HB_MULTI_GT=no; fi
if [ -z "$HB_MT" ]; then export HB_MT=no; fi
if [ -z "$HB_COMMERCE" ]; then export HB_COMMERCE=no; fi
if [ "$HB_COMMERCE" = yes ]
then
export HB_GPM_MOUSE=no
export HB_WITHOUT_GTSLN=yes
fi
export HB_BIN_INSTALL="/usr/bin"
export HB_INC_INSTALL="/usr/include/${name}"
@@ -36,21 +43,23 @@ export HB_LIB_INSTALL="/usr/lib/${name}"
# buid
umask 022
make clean
make
pushd contrib/libct
make clean
make
popd
make -r clean
make -r
for l in ${hb_contrib}
do
(cd "contrib/$l"
make -r clean
make -r)
done
# install
if [ -z "$TMPDIR" ]; then TMPDIR="/tmp"; fi
HB_INST_PREF="$TMPDIR/$name.bin.$USER.$$"
rm -fR "${HB_INST_PREF}"
_DEFAULT_BIN_DIR=$HB_BIN_INSTALL
_DEFAULT_INC_DIR=$HB_INC_INSTALL
_DEFAULT_LIB_DIR=$HB_LIB_INSTALL
export _DEFAULT_BIN_DIR=$HB_BIN_INSTALL
export _DEFAULT_INC_DIR=$HB_INC_INSTALL
export _DEFAULT_LIB_DIR=$HB_LIB_INSTALL
export HB_BIN_INSTALL="$HB_INST_PREF/$HB_BIN_INSTALL"
export HB_INC_INSTALL="$HB_INST_PREF/$HB_INC_INSTALL"
export HB_LIB_INSTALL="$HB_INST_PREF/$HB_LIB_INSTALL"
@@ -58,326 +67,20 @@ export HB_LIB_INSTALL="$HB_INST_PREF/$HB_LIB_INSTALL"
mkdir -p $HB_BIN_INSTALL
mkdir -p $HB_INC_INSTALL
mkdir -p $HB_LIB_INSTALL
make -i install
pushd contrib/libct
make -i install
popd
# build fm lib with memory statistic
pushd source/vm
TMP_C_USR=$C_USR
C_USR=${C_USR//-DHB_FM_STATISTICS_OFF/-DHB_PARANOID_MEM_CHECK}
rm -f fm.o
make fm.o
ar -r $HB_LIB_INSTALL/libfm.a fm.o
rm -f fm.o
if [ $HB_MT = "MT" ]; then
make fm.o 'HB_LIBCOMP_MT=YES'
ar -r $HB_LIB_INSTALL/libfmmt.a fm.o
rm -f fm.o
fi
C_USR=$TMP_C_USR
popd
make -r -i install
for l in ${hb_contrib}
do
(cd "contrib/$l"
make -r -i install)
done
# Keep the size of the binaries to a minimim.
strip $HB_BIN_INSTALL/*
strip $HB_BIN_INSTALL/harbour
# Keep the size of the libraries to a minimim.
strip --strip-debug $HB_LIB_INSTALL/*
install -m755 bin/hb-mkslib.sh $HB_BIN_INSTALL/hb-mkslib
pushd $HB_LIB_INSTALL
LIBS=""
LIBSMT=""
for l in ${hb_libs}
do
case $l in
debug|profiler) ;;
*)
ls="lib${l}.a"
if [ -f lib${l}mt.a ]
then
lm="lib${l}mt.a"
else
lm="${ls}"
fi
if [ "${HB_MULTI_GT}" = "yes" ] || \
[ "${l#gt}" = "${l}" ] || \
[ "${l}" == "${HB_GT_LIB}" ]
then
if [ -f $ls ]
then
LIBS="$LIBS $ls"
fi
if [ -f $lm ]
then
LIBSMT="$LIBSMT $lm"
fi
fi
;;
esac
done
$HB_BIN_INSTALL/hb-mkslib lib${name}-${hb_ver}.so $LIBS
[ $HB_MT != "MT" ] || $HB_BIN_INSTALL/hb-mkslib lib${name}mt-${hb_ver}.so $LIBSMT
for l in lib${name}-${hb_ver}.so lib${name}mt-${hb_ver}.so
do
if [ -f $l ]
then
ll=${l%-${hb_ver}.so}.so
ln -s $l $ll && ln -s ${name}/$l $HB_INST_PREF/usr/lib/$ll
fi
done
#export LD_LIBRARY_PATH="$HB_LIB_INSTALL:$LD_LIBRARY_PATH"
popd
# Add a harbour compiler wrapper.
cat > $HB_BIN_INSTALL/${hb_pref}-build <<EOF
#!/bin/bash
if [ \$# == 0 ]; then
echo "syntax: \$0 [<options,...>] <file>[.prg|.o]
\"${hb_pref}cc\", \"${hb_pref}cmp\", \"${hb_pref}lnk\" and \"${hb_pref}mk\" parameters:
-o<outputfilename> # output file name
\"${hb_pref}lnk\" and \"${hb_pref}mk\" parameters:
-static # link with static ${name} libs
-fullstatic # link with all static libs
-shared # link with shared libs (default)
-mt # link with multi-thread libs
-gt<hbgt> # link with <hbgt> GT driver, can be repeated to
# link with more GTs. The first one will be
# the default at runtime
-fmstat # link with the memory statistics lib
-nofmstat # do not link with the memory statistics lib (default)
-main=<main_func> # set the name of main program function/procedure.
# if not set then 'MAIN' is used or if it doesn't
# exist the name of first public function/procedure
# in first linked object module (link)
"
exit 1
elif [ "\$*" == "mk-links" ]; then
DIR="\${0%/*}"
NAME="\${0##*/}"
if [ "\${DIR}" != "\${NAME}" ]; then
for n in ${hb_pref}cc ${hb_pref}cmp ${hb_pref}mk ${hb_pref}lnk gharbour harbour-link; do
ln -sf "\${NAME}" "\${DIR}/\${n}"
done
fi
exit
fi
## default parameters
HB_STATIC="no"
HB_MT=""
HB_GT="${HB_GT_LIB#gt}"
HB_MG="${HB_MULTI_GT}"
HB_GT_REQ=""
HB_FM_REQ=""
HB_MAIN_FUNC=""
_TMP_FILE_="/tmp/hb-build-\$USER-\$\$.c"
## parse params
P=( "\$@" ); n=0; DIROUT="."; FILEOUT=""
while [ \$n -lt \${#P[@]} ]; do
v=\${P[\$n]}; p=""
case "\$v" in
-o*)
d="\${v#-o}"; p="\${v}"
if [ -d "\${d}" ]; then
DIROUT="\${d%/}"
elif [ -d "\${d%/*}" ]; then
DIROUT="\${d%/*}"; FILEOUT="\${d##*/}"; p="-o\${d%.*}"
elif [ -n "\${d}" ]; then
FILEOUT="\${d}"; p="-o\${d%.*}"
fi ;;
-static) HB_STATIC="yes" ;;
-fullstatic) HB_STATIC="full" ;;
-shared) HB_STATIC="no" ;;
-mt) HB_MT="MT" ;;
-gt*) HB_GT_REQ="\${HB_GT_REQ} \${v#-gt}" ;;
-fmstat) HB_FM_REQ="STAT" ;;
-nofmstat) HB_FM_REQ="NOSTAT" ;;
-main=*) HB_MAIN_FUNC="\${v#*=}" ;;
-*) p="\${v}" ;;
*) [ -z \${FILEOUT} ] && FILEOUT="\${v##*/}"; p="\${v}" ;;
esac
[ -n "\$p" ] && PP[\$n]="\$p"
n=\$[\$n + 1]
done
P=( "\${PP[@]}" )
case "\${HB_MT}" in
[Mm][Tt]|[Yy][Ee][Ss]|1) HB_MT="MT";;
*) HB_MT="";;
esac
SYSTEM_LIBS="-lm -lncurses -lslang -lgpm"
# use pthread system library for MT programs
if [ "\${HB_MT}" = "MT" ]; then
SYSTEM_LIBS="-lpthread \${SYSTEM_LIBS}"
fi
HB_GT_STAT=""
[ -z "\${HB_GT_REQ}" ] && HB_GT_REQ="\${HB_GT}"
if [ "\${HB_MG}" != "yes" ]; then
[ "\${HB_STATIC}" = "yes" ] && HB_GT_STAT=\`echo \${HB_GT_REQ}|tr A-Z a-z\`
HB_GT_REQ=""
else
HB_GT_REQ=\`echo \${HB_GT_REQ}|tr a-z A-Z\`
fi
HB_MAIN_FUNC=\`echo \${HB_MAIN_FUNC}|tr a-z A-Z\`
# set environment variables
export HB_ARCHITECTURE="${HB_ARCHITECTURE}"
export HB_COMPILER="${HB_COMPILER}"
[ -z "\${HB_BIN_INSTALL}" ] && export HB_BIN_INSTALL="${_DEFAULT_BIN_DIR}"
[ -z "\${HB_INC_INSTALL}" ] && export HB_INC_INSTALL="${_DEFAULT_INC_DIR}"
[ -z "\${HB_LIB_INSTALL}" ] && export HB_LIB_INSTALL="${_DEFAULT_LIB_DIR}"
# be sure that ${name} binaries are in your path
export PATH="\${HB_BIN_INSTALL}:\${PATH}"
HB_PATHS="-I\${HB_INC_INSTALL}"
GCC_PATHS="\${HB_PATHS} -L\${HB_LIB_INSTALL}"
LINK_OPT=""
if [ "\${HB_STATIC}" = "full" ]; then
LINK_OPT="\${LINK_OPT} -static"
HB_STATIC="yes"
fi
HARBOUR_LIBS=""
if [ "\${HB_STATIC}" = "yes" ]; then
libs="${hb_libs}"
else
l="${name}"
[ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/lib\${l}mt.so" ] && l="\${l}mt"
[ -f "\${HB_LIB_INSTALL}/lib\${l}.so" ] && HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}"
libs="debug profiler"
fi
for l in \${libs}
do
if [ "\${HB_MG}" = "yes" ] || [ "\${l#gt}" = "\${l}" ] || [ "\${l}" == "gt\${HB_GT_STAT}" ]; then
[ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/lib\${l}mt.a" ] && l="\${l}mt"
[ -f "\${HB_LIB_INSTALL}/lib\${l}.a" ] && HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}"
fi
done
HARBOUR_LIBS="-Wl,--start-group \${HARBOUR_LIBS} -Wl,--end-group"
l="fm"
[ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/lib\${l}mt.a" ] && l="\${l}mt"
if [ -f "\${HB_LIB_INSTALL}/lib\${l}.a" ]; then
if [ "\${HB_STATIC}" = "yes" ] && [ "\${HB_FM_REQ}" = "STAT" ]; then
HARBOUR_LIBS="-l\${l} \${HARBOUR_LIBS}"
else
HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}"
fi
fi
FOUTC="\${DIROUT}/\${FILEOUT%.*}.c"
FOUTO="\${DIROUT}/\${FILEOUT%.*}.o"
FOUTE="\${DIROUT}/\${FILEOUT%.[Pp][Rr][Gg]}"
FOUTE="\${FOUTE%.[oc]}"
hb_cc()
{
harbour "\$@" \${HB_PATHS} && [ -f "\${FOUTC}" ]
}
hb_link()
{
if [ -n "\${HB_MAIN_FUNC}" ]; then
HB_MAIN_FUNC="@\${HB_MAIN_FUNC}"
elif [ -f "\${FOUTO}" ]; then
HB_MAIN_FUNC=\`hb_lnk_main "\${FOUTO}"\`
fi
if [ -n "\${HB_GT_REQ}" ] || [ -n "\${HB_FM_REQ}" ] || [ -n "\${HB_MAIN_FUNC}" ]; then
hb_lnk_request > \${_TMP_FILE_} && \\
gcc "\$@" "\${_TMP_FILE_}" \${LINK_OPT} \${GCC_PATHS} \${HARBOUR_LIBS} \${SYSTEM_LIBS} -o "\${FOUTE}"
else
gcc "\$@" \${LINK_OPT} \${GCC_PATHS} \${HARBOUR_LIBS} \${SYSTEM_LIBS} -o "\${FOUTE}"
fi
}
hb_cmp()
{
hb_cc "\$@" && \\
gcc -g -c "\${FOUTC}" -o "\${FOUTO}" \${GCC_PATHS} && \\
rm -f "\${FOUTC}"
}
hb_lnk_request()
{
echo "#include \\"hbapi.h\\""
if [ "\${HB_STATIC}" = "yes" ] || [ -n "\${HB_FM_REQ}" ]; then
for gt in \${HB_GT_REQ}; do
echo "extern HB_FUNC( HB_GT_\${gt} );"
done
if [ -n "\${HB_FM_REQ}" ]; then
echo "extern HB_FUNC( HB_FM_\${HB_FM_REQ} );"
fi
echo "void hb_lnk_ForceLink_build( void )"
echo "{"
for gt in \${HB_GT_REQ}; do
echo " HB_FUNCNAME( HB_GT_\${gt} )();"
done
if [ -n "\${HB_FM_REQ}" ]; then
echo " HB_FUNCNAME( HB_FM_\${HB_FM_REQ} )();"
fi
echo "}"
fi
gt="\${HB_GT_REQ%% *}"
if [ -n "\$gt" ] || [ -n "\${HB_MAIN_FUNC}" ]; then
echo "#include \\"hbinit.h\\""
echo "extern char * s_defaultGT;"
echo "extern char * s_pszLinkedMain;"
echo "HB_CALL_ON_STARTUP_BEGIN( hb_lnk_SetDefault_build )"
if [ -n "\$gt" ]; then
echo " s_defaultGT = \\"\$gt\\";"
fi
if [ -n "\${HB_MAIN_FUNC}" ]; then
echo " s_pszLinkedMain = \\"\${HB_MAIN_FUNC}\\";"
fi
echo "HB_CALL_ON_STARTUP_END( hb_lnk_SetDefault_build )"
fi
}
hb_lnk_main()
{
(nm \$1 -g -n --defined-only|sed -e '/HB_FUN_/ ! d' -e 's/^[0-9a-fA-F]* T HB_FUN_//'|head -1|grep -v '^MAIN\$')2>/dev/null
# (nm \$1 -n --defined-only|sed -e '/HB_FUN_/ ! d' -e 's/^[0-9a-fA-F]* [Tt] HB_FUN_//'|head -1|grep -v '^MAIN\$')2>/dev/null
}
hb_cleanup()
{
rm -f "\${_TMP_FILE_}"
}
trap hb_cleanup EXIT &>/dev/null
## get basename
HB="\${0##*/}"
case "\${HB}" in
*cc)
hb_cc "\${P[@]}"
;;
*cmp|gharbour)
hb_cmp "\${P[@]}"
;;
*lnk|harbour-link)
hb_link "\${P[@]}"
;;
*mk)
hb_cmp "\${P[@]}" && \\
hb_link "\${FOUTO}" && \\
strip "\${FOUTE}" && \\
rm -f "\${FOUTO}"
;;
esac
EOF
chmod 755 $HB_BIN_INSTALL/${hb_pref}-build
$HB_BIN_INSTALL/${hb_pref}-build mk-links
mkdir -p $HB_INST_PREF/etc/harbour
install -m644 source/rtl/gtcrs/hb-charmap.def $HB_INST_PREF/etc/harbour/hb-charmap.def
cat > $HB_INST_PREF/etc/harbour.cfg <<EOF
@@ -387,6 +90,22 @@ VERBOSE=YES
DELTMP=YES
EOF
# check if we should rebuild tools with shared libs
if [ "${hb_lnkso}" = yes ]
then
export L_USR="-L${HB_LIB_INSTALL} -l${name} -lncurses -lslang -lgpm -L/usr/X11R6/lib -lX11"
export PRG_USR="\"-D_DEFAULT_INC_DIR='${_DEFAULT_INC_DIR}'\""
for utl in hbmake hbrun hbpp hbdoc hbtest
do
(cd "utils/${utl}"
rm -fR "./${HB_ARCHITECTURE}"
make -r install
strip "${HB_BIN_INSTALL}/${utl}")
done
fi
# Create PP
pushd contrib/dot
$HB_BIN_INSTALL/${hb_pref}mk pp -n -w -D_DEFAULT_INC_DIR=\"${_DEFAULT_INC_DIR}\"
@@ -396,20 +115,28 @@ install -m644 rp_dot.ch $HB_INC_INSTALL/
rm -f pp
popd
# check if we should rebuild tools with shared libs
if [ "${hb_lnkso}" = yes ]
then
export L_USR="-L${HB_LIB_INSTALL} -l${name} -lncurses -lslang -lgpm"
for utl in hbmake hbrun hbpp hbdoc hbtest
do
pushd utils/${utl}
rm -fR "./${HB_ARCHITECTURE}"
make install
strip ${HB_BIN_INSTALL}/${utl}
popd
done
fi
tar -czvf ${name}-${hb_ver}${hb_platform}.bin.tar.gz --owner=root --group=root -C "${HB_INST_PREF}" .
tar -czvf "${hb_archfile}" --owner=root --group=root -C "${HB_INST_PREF}" .
rm -fR "${HB_INST_PREF}"
cat > "${hb_instfile}" <<EOF
#!/bin/sh
if [ "\$1" == "--extract" ]; then
sed -e '1,/^HB_INST_EOF\$/ d' \$0 > "${hb_archfile}"
exit
fi
if [ \`id -u\` != 0 ]; then
echo "This package has to be installed from root account."
exit 1
fi
echo "Do you want to install ${name} (y/n)"
read ASK
if [ "\${ASK}" != "y" ] && [ "\${ASK}" != "Y" ]; then
exit 1
fi
(sed -e '1,/^HB_INST_EOF\$/ d' \$0 | gzip -cd | tar xvf - -C /) && ldconfig
exit \$?
HB_INST_EOF
EOF
cat "${hb_archfile}" >> "${hb_instfile}"
chmod +x "${hb_instfile}"
rm -f "${hb_archfile}"

View File

@@ -5,7 +5,6 @@
ROOT = ../../
C_SOURCES=\
hbffind.c \
hbfhnd.c \
hbfsapi.c \
hbgete.c \
@@ -13,6 +12,7 @@ C_SOURCES=\
hbstr.c \
hbtrace.c \
hbver.c \
hbverdsp.c \
reserved.c \
expropt1.c \
expropt2.c \

View File

@@ -165,7 +165,7 @@ HB_EXPR_PTR hb_compExprNewDouble( double dValue, BYTE ucWidth, BYTE ucDec )
HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewDouble(%f, %i)", dValue, ucDec));
pExpr =hb_compExprNew( HB_ET_NUMERIC );
pExpr = hb_compExprNew( HB_ET_NUMERIC );
pExpr->value.asNum.dVal = dValue;
pExpr->value.asNum.bWidth = ucWidth;
@@ -176,13 +176,13 @@ HB_EXPR_PTR hb_compExprNewDouble( double dValue, BYTE ucWidth, BYTE ucDec )
return pExpr;
}
HB_EXPR_PTR hb_compExprNewLong( long lValue )
HB_EXPR_PTR hb_compExprNewLong( HB_LONG lValue )
{
HB_EXPR_PTR pExpr;
HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewLong(%li)", lValue));
HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewLong(%" PFHL "d)", lValue));
pExpr =hb_compExprNew( HB_ET_NUMERIC );
pExpr = hb_compExprNew( HB_ET_NUMERIC );
pExpr->value.asNum.lVal = lValue;
pExpr->value.asNum.bDec = 0;
@@ -195,7 +195,7 @@ HB_EXPR_PTR hb_compExprNewLong( long lValue )
int hb_compExprIsInteger( HB_EXPR_PTR pExpr )
{
return ( pExpr->ExprType == HB_ET_NUMERIC && pExpr->value.asNum.NumType == HB_ET_LONG &&
pExpr->value.asNum.lVal >= -32768 && pExpr->value.asNum.lVal <= 32767 );
HB_LIM_INT16( pExpr->value.asNum.lVal ) );
}
int hb_compExprAsInteger( HB_EXPR_PTR pExpr )
@@ -223,14 +223,14 @@ HB_EXPR_PTR hb_compExprNewCodeBlock( char *string, BOOL isMacro, BOOL lateEval )
HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewCodeBlock(%s,%u,%u)",string,isMacro,lateEval));
pExpr =hb_compExprNew( HB_ET_CODEBLOCK );
pExpr = hb_compExprNew( HB_ET_CODEBLOCK );
pExpr->value.asCodeblock.pExprList = NULL;
pExpr->value.asCodeblock.pLocals = NULL; /* this will hold local variables declarations */
pExpr->ValType = HB_EV_CODEBLOCK;
pExpr->value.asCodeblock.string = string;
pExpr->value.asCodeblock.isMacro = isMacro;
pExpr->value.asCodeblock.lateEval = lateEval;
pExpr->value.asCodeblock.string = string;
pExpr->value.asCodeblock.isMacro = isMacro;
pExpr->value.asCodeblock.lateEval = lateEval;
return pExpr;
}
@@ -258,7 +258,7 @@ HB_EXPR_PTR hb_compExprNewLogical( int iValue )
HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewLogical(%i)", iValue));
pExpr =hb_compExprNew( HB_ET_LOGICAL );
pExpr = hb_compExprNew( HB_ET_LOGICAL );
pExpr->value.asLogical = iValue;
pExpr->ValType = HB_EV_LOGICAL;
@@ -285,7 +285,7 @@ HB_EXPR_PTR hb_compExprNewSelf( void )
HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewSelf()"));
pExpr =hb_compExprNew( HB_ET_SELF );
pExpr = hb_compExprNew( HB_ET_SELF );
pExpr->ValType = HB_EV_OBJECT;
return pExpr;
@@ -297,7 +297,7 @@ HB_EXPR_PTR hb_compExprNewVarRef( char * szVarName )
HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewVarRef(%s)", szVarName));
pExpr =hb_compExprNew( HB_ET_VARREF );
pExpr = hb_compExprNew( HB_ET_VARREF );
pExpr->value.asSymbol = szVarName;
pExpr->ValType = HB_EV_VARREF;
@@ -856,9 +856,15 @@ HB_EXPR_PTR hb_compExprNewNegate( HB_EXPR_PTR pNegExpr )
if( pNegExpr->ExprType == HB_ET_NUMERIC )
{
if( pNegExpr->value.asNum.NumType == HB_ET_DOUBLE )
{
pNegExpr->value.asNum.dVal = - pNegExpr->value.asNum.dVal;
pNegExpr->value.asNum.bWidth = HB_DBL_LENGTH( pNegExpr->value.asNum.dVal );
}
else
{
pNegExpr->value.asNum.lVal = - pNegExpr->value.asNum.lVal;
pNegExpr->value.asNum.bWidth = HB_LONG_LENGTH( pNegExpr->value.asNum.lVal );
}
pExpr = pNegExpr;
}
else
@@ -901,4 +907,3 @@ ULONG hb_compExprListLen( HB_EXPR_PTR pExpr )
return ulLen;
}

View File

@@ -82,22 +82,11 @@ HB_EXPR_PTR hb_compExprReduceMod( HB_EXPR_PTR pSelf, HB_MACRO_DECL )
{
if( pRight->value.asNum.lVal )
{
double dVal = pLeft->value.asNum.lVal % pRight->value.asNum.lVal;
if( ( double ) LONG_MIN <= dVal && dVal <= ( double ) LONG_MAX )
{
pSelf->value.asNum.lVal = ( long ) dVal;
pSelf->value.asNum.bDec = 0;
pSelf->value.asNum.NumType = HB_ET_LONG;
}
else
{
pSelf->value.asNum.dVal = dVal;
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
pSelf->value.asNum.bDec = 0;
pSelf->value.asNum.NumType = HB_ET_DOUBLE;
}
HB_LONG lVal = pLeft->value.asNum.lVal % pRight->value.asNum.lVal;
pSelf->value.asNum.lVal = lVal;
pSelf->value.asNum.bDec = 0;
pSelf->value.asNum.NumType = HB_ET_LONG;
pSelf->ExprType = HB_ET_NUMERIC;
pSelf->ValType = HB_EV_NUMERIC;
hb_compExprFree( pLeft, HB_MACRO_PARAM );
@@ -130,19 +119,17 @@ HB_EXPR_PTR hb_compExprReduceDiv( HB_EXPR_PTR pSelf, HB_MACRO_DECL )
if( pRight->value.asNum.lVal )
{
double dVal = ( double ) pLeft->value.asNum.lVal / ( double ) pRight->value.asNum.lVal;
if( fmod( dVal, 1.0 ) == 0.0 )
if( pLeft->value.asNum.lVal % pRight->value.asNum.lVal == 0 )
{
/* Return integer results as long */
pSelf->value.asNum.lVal = ( long ) dVal;
pSelf->value.asNum.lVal = pLeft->value.asNum.lVal / pRight->value.asNum.lVal;
pSelf->value.asNum.bDec = 0;
pSelf->value.asNum.NumType = HB_ET_LONG;
}
else
{
/* Return non-integer results as double */
pSelf->value.asNum.dVal = dVal;
pSelf->value.asNum.dVal = ( double ) pLeft->value.asNum.lVal / ( double ) pRight->value.asNum.lVal;
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
pSelf->value.asNum.bDec = HB_DEFAULT_DECIMALS;
pSelf->value.asNum.NumType = HB_ET_DOUBLE;
@@ -220,17 +207,17 @@ HB_EXPR_PTR hb_compExprReduceMult( HB_EXPR_PTR pSelf, HB_MACRO_DECL )
{
case HB_ET_LONG:
{
double dVal = ( double ) pLeft->value.asNum.lVal * ( double ) pRight->value.asNum.lVal;
HB_MAXDBL dVal = ( HB_MAXDBL ) pLeft->value.asNum.lVal * ( HB_MAXDBL ) pRight->value.asNum.lVal;
if( ( double ) LONG_MIN <= dVal && dVal <= ( double ) LONG_MAX )
if ( HB_DBL_LIM_LONG( dVal ) )
{
pSelf->value.asNum.lVal = ( long ) dVal;
pSelf->value.asNum.lVal = ( HB_LONG ) dVal;
pSelf->value.asNum.bDec = 0;
pSelf->value.asNum.NumType = HB_ET_LONG;
}
else
{
pSelf->value.asNum.dVal = dVal;
pSelf->value.asNum.dVal = ( double ) dVal;
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
pSelf->value.asNum.bDec = 0;
pSelf->value.asNum.NumType = HB_ET_DOUBLE;
@@ -294,17 +281,17 @@ HB_EXPR_PTR hb_compExprReduceMinus( HB_EXPR_PTR pSelf, HB_MACRO_DECL )
{
case HB_ET_LONG:
{
double dVal = ( double ) pLeft->value.asNum.lVal - ( double ) pRight->value.asNum.lVal;
HB_MAXDBL dVal = ( HB_MAXDBL ) pLeft->value.asNum.lVal - ( HB_MAXDBL ) pRight->value.asNum.lVal;
if( ( double ) LONG_MIN <= dVal && dVal <= ( double ) LONG_MAX )
if ( HB_DBL_LIM_LONG( dVal ) )
{
pSelf->value.asNum.lVal = ( long ) dVal;
pSelf->value.asNum.lVal = ( HB_LONG ) dVal;
pSelf->value.asNum.bDec = 0;
pSelf->value.asNum.NumType = HB_ET_LONG;
}
else
{
pSelf->value.asNum.dVal = dVal;
pSelf->value.asNum.dVal = ( double ) dVal;
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
pSelf->value.asNum.bDec = 0;
pSelf->value.asNum.NumType = HB_ET_DOUBLE;
@@ -376,17 +363,17 @@ HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_MACRO_DECL )
{
case HB_ET_LONG:
{
double dVal = ( double ) pLeft->value.asNum.lVal + ( double ) pRight->value.asNum.lVal;
HB_MAXDBL dVal = ( HB_MAXDBL ) pLeft->value.asNum.lVal + ( HB_MAXDBL ) pRight->value.asNum.lVal;
if( ( double ) LONG_MIN <= dVal && dVal <= ( double ) LONG_MAX )
if ( HB_DBL_LIM_LONG( dVal ) )
{
pSelf->value.asNum.lVal = ( long ) dVal;
pSelf->value.asNum.lVal = ( HB_LONG ) dVal;
pSelf->value.asNum.bDec = 0;
pSelf->value.asNum.NumType = HB_ET_LONG;
}
else
{
pSelf->value.asNum.dVal = dVal;
pSelf->value.asNum.dVal = ( double ) dVal;
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
pSelf->value.asNum.bDec = 0;
pSelf->value.asNum.NumType = HB_ET_DOUBLE;
@@ -434,28 +421,28 @@ HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_MACRO_DECL )
{
if( pRight->ulLength == 0 )
{
pSelf->ExprType = HB_ET_NONE; /* suppress deletion of operator components */
hb_compExprFree( pSelf, HB_MACRO_PARAM );
pSelf->ExprType = HB_ET_NONE; /* suppress deletion of operator components */
hb_compExprFree( pSelf, HB_MACRO_PARAM );
pSelf = pLeft;
hb_compExprFree( pRight, HB_MACRO_PARAM );
}
else if( pLeft->ulLength == 0 )
{
pSelf->ExprType = HB_ET_NONE; /* suppress deletion of operator components */
hb_compExprFree( pSelf, HB_MACRO_PARAM );
pSelf->ExprType = HB_ET_NONE; /* suppress deletion of operator components */
hb_compExprFree( pSelf, HB_MACRO_PARAM );
pSelf = pRight;
hb_compExprFree( pLeft, HB_MACRO_PARAM );
}
else
{
/* Do not reduce strings with the macro operator '&'
*/
if( strchr(pLeft->value.asString.string, '&') == NULL )
{
pSelf->ExprType = HB_ET_NONE; /* suppress deletion of operator components */
hb_compExprFree( pSelf, HB_MACRO_PARAM );
/* Do not reduce strings with the macro operator '&'
*/
if( strchr(pLeft->value.asString.string, '&') == NULL )
{
pSelf->ExprType = HB_ET_NONE; /* suppress deletion of operator components */
hb_compExprFree( pSelf, HB_MACRO_PARAM );
pSelf = hb_compExprReducePlusStrings( pLeft, pRight, HB_MACRO_PARAM );
}
}
}
}
else
@@ -1203,7 +1190,7 @@ BOOL hb_compExprReduceCHR( HB_EXPR_PTR pSelf, HB_MACRO_DECL )
else
{
pExpr->value.asString.string = ( char * ) hb_xgrab( 2 );
pExpr->value.asString.string[ 0 ] = ( ( long ) pArg->value.asNum.dVal % 256 );
pExpr->value.asString.string[ 0 ] = ( ( unsigned int ) pArg->value.asNum.dVal % 256 );
pExpr->value.asString.string[ 1 ] = '\0';
pExpr->value.asString.dealloc = TRUE;
pExpr->ulLength = 1;

View File

@@ -204,6 +204,7 @@ PHB_FNAME hb_fsFNameSplit( char * pszFileName )
/* This function joins path, name and extension into a string with a filename */
char * hb_fsFNameMerge( char * pszFileName, PHB_FNAME pFileName )
{
static char szPathSep[] = {OS_PATH_DELIMITER,0}; /* see NOTE below */
char * pszName;
HB_TRACE(HB_TR_DEBUG, ("hb_fsFNameMerge(%p, %p)", pszFileName, pFileName));
@@ -213,12 +214,18 @@ char * hb_fsFNameMerge( char * pszFileName, PHB_FNAME pFileName )
/* Strip preceding path separators from the filename */
pszName = pFileName->szName;
if( pszName && pszName[ 0 ] != '\0' && strchr( OS_PATH_DELIMITER_LIST, pszName[ 0 ] ) )
if( pszName && pszName[ 0 ] != '\0' && strchr( OS_PATH_DELIMITER_LIST, pszName[ 0 ] ) != NULL )
pszName++;
/* Add path if specified */
if( pFileName->szPath )
strcat( pszFileName, pFileName->szPath );
hb_strncat( pszFileName, pFileName->szPath, _POSIX_PATH_MAX - 1 );
/*
NOTE: be _very_ careful about 'optimising' this next section code!
(specifically, initialising szPathSep) as MSVC with /Ni
(or anything that infers it like /Ox) will cause you trouble.
*/
/* If we have a path, append a path separator to the path if there
was none. */
@@ -228,18 +235,20 @@ char * hb_fsFNameMerge( char * pszFileName, PHB_FNAME pFileName )
if( strchr( OS_PATH_DELIMITER_LIST, pszFileName[ iLen ] ) == NULL )
{
char szPathSep[ 2 ];
/*
char szPathSep[2];
szPathSep[ 0 ] = OS_PATH_DELIMITER;
szPathSep[ 1 ] = '\0';
szPathSep[ 0 ] = OS_PATH_DELIMITER;
szPathSep[ 1 ] = '\0';
strcat( pszFileName, szPathSep );
*/
hb_strncat( pszFileName, szPathSep, _POSIX_PATH_MAX - 1 );
}
}
/* Add filename (without extension) if specified */
if( pszName )
strcat( pszFileName, pszName );
hb_strncat( pszFileName, pszName, _POSIX_PATH_MAX - 1 );
/* Add extension if specified */
if( pFileName->szExtension )
@@ -247,9 +256,9 @@ char * hb_fsFNameMerge( char * pszFileName, PHB_FNAME pFileName )
/* Add a dot if the extension doesn't have it */
if( pFileName->szExtension[ 0 ] != '\0' &&
pFileName->szExtension[ 0 ] != '.' )
strcat( pszFileName, "." );
hb_strncat( pszFileName, ".", _POSIX_PATH_MAX - 1 );
strcat( pszFileName, pFileName->szExtension );
hb_strncat( pszFileName, pFileName->szExtension, _POSIX_PATH_MAX - 1 );
}
HB_TRACE(HB_TR_INFO, ("hb_fsFNameMerge: szPath: |%s|\n", pFileName->szPath));
@@ -260,4 +269,3 @@ char * hb_fsFNameMerge( char * pszFileName, PHB_FNAME pFileName )
return pszFileName;
}

View File

@@ -65,6 +65,7 @@
#include <ctype.h> /* Needed by hb_strupr() */
#include "hbapi.h"
#include "hbmath.h"
ULONG hb_strAt( const char * szSub, ULONG ulSubLen, const char * szText, ULONG ulLen )
{
@@ -157,58 +158,439 @@ int hb_stricmp( const char * s1, const char * s2 )
return rc;
}
/*
* This function copies szText to destination buffer.
* NOTE: Unlike the documentation for strncpy, this routine will always append
* a null
*/
HB_EXPORT char * hb_strncpy( char * pDest, const char * pSource, ULONG ulLen )
{
char *pBuf = pDest;
HB_TRACE(HB_TR_DEBUG, ("hb_strncpy(%p, %s, %lu)", pDest, pSource, ulLen));
pDest[ ulLen ] ='\0';
while( ulLen && ( *pDest++ = *pSource++ ) != '\0' )
{
ulLen--;
}
while (ulLen--)
{
*pDest++ = '\0';
}
return pBuf;
}
/*
* This function copies szText to destination buffer.
* NOTE: Unlike the documentation for strncat, this routine will always append
* a null and the ulLen param is pDest size not pSource limit
*/
HB_EXPORT char * hb_strncat( char * pDest, const char * pSource, ULONG ulLen )
{
char *pBuf = pDest;
HB_TRACE(HB_TR_DEBUG, ("hb_strncpy(%p, %s, %lu)", pDest, pSource, ulLen));
pDest[ ulLen ] ='\0';
while( ulLen && *pDest )
{
pDest++;
ulLen--;
}
while( ulLen && ( *pDest++ = *pSource++ ) != '\0' )
{
ulLen--;
}
/* if someone will need this then please uncomment the cleaning the rest of buffer. */
/*
while (ulLen--)
{
*pDest++ = '\0';
}
*/
return pBuf;
}
/* This function copies and converts szText to upper case.
* NOTE: Unlike the documentation for strncpy, this routine will always append
* a null
*/
HB_EXPORT char * hb_strncpyUpper( char * pDest, const char * pSource, ULONG ulLen )
{
char *pBuf = pDest;
HB_TRACE(HB_TR_DEBUG, ("hb_strncpyUpper(%p, %s, %lu)", pDest, pSource, ulLen));
pDest[ ulLen ] ='\0';
/* some compilers impliment toupper as a macro, and this has side effects! */
/* *pDest++ = toupper( *pSource++ ); */
while( ulLen && (*pDest++ = toupper( *pSource )) != '\0' )
{
ulLen--;
pSource++;
}
while (ulLen--)
{
*pDest++ = '\0';
}
return pBuf;
}
/* This function copies and converts szText to upper case AND Trims it
* NOTE: Unlike the documentation for strncpy, this routine will always append
* a null
*/
HB_EXPORT char * hb_strncpyUpperTrim( char * pDest, const char * pSource, ULONG ulLen )
{
char *pBuf = pDest;
ULONG ulSLen = strlen( pSource );
HB_TRACE(HB_TR_DEBUG, ("hb_strncpyUpperTrim(%p, %s, %lu)", pDest, pSource, ulLen));
pDest[ ulLen ] ='\0';
while( ulSLen && pSource[ ulSLen - 1 ] == ' ')
{
ulSLen--;
}
/* some compilers impliment toupper as a macro, and this has side effects! */
/* *pDest++ = toupper( *pSource++ ); */
while( ulLen && ulSLen && (*pDest++ = toupper( *pSource )) != '\0' )
{
ulSLen--;
ulLen--;
pSource++;
}
while (ulLen--)
{
*pDest++ = '\0';
}
return pBuf;
}
/*
* This function copies trimed szText to destination buffer.
* NOTE: Unlike the documentation for strncpy, this routine will always append
* a null
*/
HB_EXPORT char * hb_strncpyTrim( char * pDest, const char * pSource, ULONG ulLen )
{
char *pBuf = pDest;
LONG lSLen = strlen( pSource );
HB_TRACE(HB_TR_DEBUG, ("hb_strncpyTrim(%p, %s, %lu)", pDest, pSource, ulLen));
pDest[ ulLen ] ='\0';
while( lSLen && pSource[ lSLen - 1 ] == ' ')
{
lSLen--;
}
/* some compilers impliment toupper as a macro, and this has side effects! */
/* *pDest++ = toupper( *pSource++ ); */
while( ulLen && lSLen && ( *pDest++ = *pSource++ ) != '\0' )
{
lSLen--;
ulLen--;
}
while (ulLen--)
{
*pDest++ = '\0';
}
return pBuf;
}
static double hb_numPow10( int nPrecision )
{
static double s_dPow10[16] = { 1.0, /* 0 */
10.0, /* 1 */
100.0, /* 2 */
1000.0, /* 3 */
10000.0, /* 4 */
100000.0, /* 5 */
1000000.0, /* 6 */
10000000.0, /* 7 */
100000000.0, /* 8 */
1000000000.0, /* 9 */
10000000000.0, /* 10 */
100000000000.0, /* 11 */
1000000000000.0, /* 12 */
10000000000000.0, /* 13 */
100000000000000.0, /* 14 */
1000000000000000.0 }; /* 15 */
if ( nPrecision < 16 )
{
if ( nPrecision >= 0 )
{
return s_dPow10[ nPrecision ];
}
else if ( nPrecision > -16 )
{
return 1.0 / s_dPow10[ -nPrecision ];
}
}
return pow(10.0, (double) nPrecision);
}
double hb_numRound( double dNum, int iDec )
{
static const double doBase = 10.0f;
double doComplete5, doComplete5i, dPow;
HB_TRACE(HB_TR_DEBUG, ("hb_numRound(%lf, %d)", dNum, iDec));
if( dNum == 0.0 )
return 0.0;
if ( iDec < 0 )
{
dPow = hb_numPow10( -iDec );
doComplete5 = dNum / dPow * doBase;
}
else
{
dPow = hb_numPow10( iDec );
doComplete5 = dNum * dPow * doBase;
}
if( dNum < 0.0f )
doComplete5 -= 5.0f;
else
doComplete5 += 5.0f;
doComplete5 /= doBase;
#if defined( HB_DBLFL_PREC_FACTOR ) && !defined( HB_C52_STRICT )
/* similar operation is done by Cl5.3
it's a hack to force rounding FL values UP */
doComplete5 *= HB_DBLFL_PREC_FACTOR;
#endif
modf( doComplete5, &doComplete5i );
if ( iDec < 0 )
return doComplete5i * dPow;
else
return doComplete5i / dPow;
}
double hb_numInt( double dNum )
{
double dInt;
#if defined( HB_DBLFL_PREC_FACTOR ) && !defined( HB_C52_STRICT )
/* Similar hack as in round to make this functions compatible */
dNum *= HB_DBLFL_PREC_FACTOR;
#endif
modf( dNum, &dInt );
return dInt;
}
static BOOL hb_str2number( BOOL fPCode, const char* szNum, ULONG ulLen, HB_LONG * lVal, double * dVal, int * piDec, int * piWidth )
{
BOOL fDbl = FALSE, fDec = FALSE, fNeg = FALSE, fHex = FALSE;
ULONG ulPos = 0;
int c, iWidth = 0, iDec = 0, iDecR = 0;
HB_TRACE(HB_TR_DEBUG, ("hb_str2number(%d, %p, %ul %p, %p, %p, %p)", (int) fPCode, szNum, ulLen, lVal, dVal, piDec, piWidth ));
while ( ulPos < ulLen && isspace( szNum[ulPos] ) )
ulPos++;
if ( szNum[ulPos] == '-' )
{
fNeg = TRUE;
ulPos++;
}
else
{
fNeg = FALSE;
if ( szNum[ulPos] == '+' )
ulPos++;
}
*lVal = 0;
/* Hex Number */
if( fPCode && ulPos + 1 < ulLen && szNum[ulPos] == '0' &&
( szNum[ulPos+1] == 'X' || szNum[ulPos+1] == 'x' ) )
{
ulPos += 2;
iWidth = HB_DEFAULT_WIDTH;
fHex = TRUE;
for ( ; ulPos < ulLen; ulPos++ )
{
c = szNum[ulPos];
if ( c >= '0' && c <= '9' )
c -= '0';
else if ( c >= 'A' && c <= 'F' )
c -= 'A' - 10;
else if ( c >= 'a' && c <= 'f' )
c -= 'a' - 10;
else
break;
*lVal = ( *lVal << 4 ) + c;
}
}
else
{
HB_LONG lLimV;
int iLimC;
lLimV = HB_LONG_MAX / 10;
iLimC = HB_LONG_MAX % 10;
iWidth = ulPos;
for ( ; ulPos < ulLen; ulPos++ )
{
c = szNum[ulPos];
if ( c >= '0' && c <= '9' )
{
if ( fDbl )
{
*dVal = *dVal * 10.0 + ( c - '0' );
}
else if ( *lVal < lLimV || ( *lVal <= lLimV && ( c - '0' ) <= iLimC ) )
{
*lVal = *lVal * 10 + ( c - '0' );
}
else
{
*dVal = (double) *lVal * 10.0 + ( c - '0' );
fDbl = TRUE;
}
if ( fDec )
iDec++;
else
iWidth++;
}
else if ( c == '.' && !fDec )
{
fDec = TRUE;
}
else
{
while ( !fDec && ulPos < ulLen )
{
if ( szNum[ulPos++] == '.' )
fDec = TRUE;
else
iWidth++;
}
if ( fDec )
iDecR = ulLen - ulPos;
break;
}
}
}
if ( fNeg )
{
if ( fDbl )
*dVal = -*dVal;
else
*lVal = -*lVal;
}
if ( !fDbl && (
#if defined( PCODE_LONG_LIM )
( fPCode && !fHex && !PCODE_LONG_LIM( *lVal ) ) ||
#endif
fDec ) )
{
*dVal = (double) *lVal;
fDbl = TRUE;
}
if ( fDbl && iDec )
*dVal /= hb_numPow10( iDec );
if ( piDec )
*piDec = iDec + iDecR;
if ( piWidth )
{
if ( fHex )
*piWidth = iWidth;
else
{
int iSize = fDbl ? HB_DBL_LENGTH( *dVal ) : HB_LONG_LENGTH( *lVal );
if ( fPCode )
{
if ( iWidth < 10 || fNeg )
*piWidth = iSize;
else
*piWidth = iWidth + ( iDec == 0 ? 1 : 0 );
}
else
{
if ( iSize > 10 || iWidth > 10 )
*piWidth = iSize;
else if ( iDec + iDecR == 0 )
*piWidth = ( int ) ulLen;
else if ( iWidth == 0 )
*piWidth = 1;
else if ( fNeg && iWidth == 1 && *dVal != 0 )
*piWidth = 2;
else
*piWidth = iWidth;
}
}
}
return fDbl;
}
BOOL HB_EXPORT hb_compStrToNum( const char* szNum, HB_LONG * plVal, double * pdVal, int * piDec, int * piWidth )
{
HB_TRACE(HB_TR_DEBUG, ("hb_compStrToNum( %s, %p, %p, %p, %p)", szNum, plVal, pdVal, piDec, piWidth ));
return hb_str2number( TRUE, szNum, strlen( szNum ), plVal, pdVal, piDec, piWidth );
}
BOOL HB_EXPORT hb_valStrnToNum( const char* szNum, ULONG ulLen, HB_LONG * plVal, double * pdVal, int * piDec, int * piWidth )
{
HB_TRACE(HB_TR_DEBUG, ("hb_valStrToNum( %s, %l, %p, %p, %p, %p)", szNum, ulLen, plVal, pdVal, piDec, piWidth ));
return hb_str2number( FALSE, szNum, ulLen, plVal, pdVal, piDec, piWidth );
}
BOOL HB_EXPORT hb_strToNum( const char* szNum, HB_LONG * plVal, double * pdVal )
{
HB_TRACE(HB_TR_DEBUG, ("hb_strToNum(%s, %p, %p)", szNum, plVal, pdVal ));
return hb_str2number( FALSE, szNum, strlen( szNum ), plVal, pdVal, NULL, NULL );
}
BOOL HB_EXPORT hb_strnToNum( const char* szNum, ULONG ulLen, HB_LONG * plVal, double * pdVal )
{
HB_TRACE(HB_TR_DEBUG, ("hb_strToNum(%s, %l, %p, %p)", szNum, ulLen, plVal, pdVal ));
return hb_str2number( FALSE, szNum, ulLen, plVal, pdVal, NULL, NULL );
}
/* returns the numeric value of a character string representation of a number */
double hb_strVal( const char * szText, ULONG ulLen )
{
long double ldValue = 0.0;
ULONG ulPos;
ULONG ulDecPos = 0;
BOOL bNegative = FALSE;
long double ldScale = 0.1L;
HB_LONG lVal;
double dVal;
HB_TRACE(HB_TR_DEBUG, ("hb_strVal(%s, %d)", szText, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strVal(%s)", szText));
/* Look for sign */
for( ulPos = 0; ulPos < ulLen; ulPos++ )
{
if( szText[ ulPos ] == '-' )
{
bNegative = TRUE;
ulPos++;
break;
}
else if( szText[ ulPos ] == '+' )
{
ulPos++;
break;
}
else if( ! HB_ISSPACE( szText[ ulPos ] ) )
break;
}
/* Build the number */
for(; ulPos < ulLen; ulPos++ )
{
if( szText[ ulPos ] == '.' && ulDecPos == 0 )
{
ulDecPos++;
ldScale = 0.1L;
}
else if( szText[ ulPos ] >= '0' && szText[ ulPos ] <= '9' )
{
if( ulDecPos )
{
ldValue += ldScale * ( long double )( szText[ ulPos ] - '0' );
ldScale *= 0.1L;
}
else
ldValue = ( ldValue * 10.0L ) + ( long double )( szText[ ulPos ] - '0' );
}
else
break;
}
return ( double )( bNegative && ldValue != 0.0L ? -ldValue : ldValue );
if ( ! hb_str2number( FALSE, szText, ulLen, &lVal, &dVal, NULL, NULL ) )
dVal = ( double ) lVal;
return dVal;
}

View File

@@ -271,8 +271,7 @@ char * hb_verPlatform( void )
struct utsname un;
uname( &un );
sprintf( pszPlatform, "%s %s", un.sysname, un.release );
sprintf( pszPlatform, "%s %s %s", un.sysname, un.release, un.machine );
}
#elif defined(HB_OS_MAC)
@@ -436,199 +435,3 @@ char * hb_verHarbour( void )
return pszVersion;
}
void hb_verBuildInfo( void )
{
hb_conOutErr( "Harbour Build Info", 0 );
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "---------------------------", 0 );
hb_conOutErr( hb_conNewLine(), 0 );
{
char * pszVersion = hb_verHarbour();
hb_conOutErr( "Version: ", 0 );
hb_conOutErr( pszVersion, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
hb_xfree( pszVersion );
}
{
char * pszVersion = hb_verCompiler();
hb_conOutErr( "Compiler: ", 0 );
hb_conOutErr( pszVersion, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
hb_xfree( pszVersion );
}
{
char * pszVersion = hb_verPlatform();
hb_conOutErr( "Platform: ", 0 );
hb_conOutErr( pszVersion, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
hb_xfree( pszVersion );
}
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Built on: ", 0 );
hb_conOutErr( __DATE__, 0 );
hb_conOutErr( " ", 0 );
hb_conOutErr( __TIME__, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Last ChangeLog entry: ", 0 );
hb_conOutErr( HB_VER_LENTRY, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "ChangeLog CVS version: ", 0 );
hb_conOutErr( HB_VER_CHLCVS, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
if( strlen( HB_VER_C_USR ) )
{
hb_conOutErr( "Harbour compiler switches: ", 0 );
hb_conOutErr( HB_VER_C_USR, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
}
if( strlen( HB_VER_L_USR ) )
{
hb_conOutErr( "C compiler switches: ", 0 );
hb_conOutErr( HB_VER_L_USR, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
}
if( strlen( HB_VER_PRG_USR ) )
{
hb_conOutErr( "Linker switches: ", 0 );
hb_conOutErr( HB_VER_PRG_USR, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
}
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Harbour extensions: ", 0 );
#if defined( HB_EXTENSION )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "CA-Clipper 5.2e undocumented: ", 0 );
#if defined( HB_C52_UNDOC )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "CA-Clipper 5.2e strict compatibility: ", 0 );
#if defined( HB_C52_STRICT )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "CA-Clipper 5.3x compatible extensions: ", 0 );
#if defined( HB_COMPAT_C53 )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Alaska Xbase++ compatible extensions: ", 0 );
#if defined( HB_COMPAT_XPP )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "CA-Visual Objects compatible extensions: ", 0 );
#if defined( HB_COMPAT_VO )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Multisoft Flagship compatible extensions: ", 0 );
#if defined( HB_COMPAT_FLAGSHIP )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Microsoft FoxPro compatible extensions: ", 0 );
#if defined( HB_COMPAT_FOXPRO )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "dBase compatible extensions: ", 0 );
#if defined( HB_COMPAT_DBASE )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Object file generation support: ", 0 );
#if defined( HARBOUR_OBJ_GENERATION )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "ANSI C usage: ", 0 );
#if defined( HARBOUR_STRICT_ANSI_C )
hb_conOutErr( "Strict", 0 );
#else
hb_conOutErr( "Non strict", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "C++ mode: ", 0 );
#if defined(__cplusplus)
hb_conOutErr( "On", 0 );
#else
hb_conOutErr( "Off", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Compiler YACC debug mode: ", 0 );
#if defined( HARBOUR_YYDEBUG )
hb_conOutErr( "On", 0 );
#else
hb_conOutErr( "Off", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Memory tracing and statistics: ", 0 );
hb_conOutErr( hb_xquery( HB_MEM_USEDMAX ) != 0 ? "On" : "Off", 0 );
/*
#if defined( HB_FM_STATISTICS )
hb_conOutErr( "On", 0 );
#else
hb_conOutErr( "Off", 0 );
#endif
*/
hb_conOutErr( hb_conNewLine(), 0 );
{
char buffer[ 64 ];
sprintf( buffer, "Maximum symbol name length: %i", HB_SYMBOL_NAME_LEN );
hb_conOutErr( buffer, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
}
hb_conOutErr( "---------------------------", 0 );
hb_conOutErr( hb_conNewLine(), 0 );
}

View File

@@ -0,0 +1,257 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Display build information - code moved from hb_ver.c
*
* Copyright 1999 {list of individual authors and e-mail addresses}
* 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.
*
*/
/*
*
* See doc/license.txt for licensing terms.
*
*/
#include "hbapi.h"
#include "hbver.h"
#include "hbmemory.ch"
void hb_verBuildInfo( void )
{
hb_conOutErr( "Harbour Build Info", 0 );
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "---------------------------", 0 );
hb_conOutErr( hb_conNewLine(), 0 );
{
char * pszVersion = hb_verHarbour();
hb_conOutErr( "Version: ", 0 );
hb_conOutErr( pszVersion, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
hb_xfree( pszVersion );
}
{
char * pszVersion = hb_verCompiler();
hb_conOutErr( "Compiler: ", 0 );
hb_conOutErr( pszVersion, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
hb_xfree( pszVersion );
}
{
char * pszVersion = hb_verPlatform();
hb_conOutErr( "Platform: ", 0 );
hb_conOutErr( pszVersion, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
hb_xfree( pszVersion );
}
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Built on: ", 0 );
hb_conOutErr( __DATE__, 0 );
hb_conOutErr( " ", 0 );
hb_conOutErr( __TIME__, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Last ChangeLog entry: ", 0 );
hb_conOutErr( HB_VER_LENTRY, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "ChangeLog CVS version: ", 0 );
hb_conOutErr( HB_VER_CHLCVS, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
if( strlen( HB_VER_C_USR ) )
{
hb_conOutErr( "Harbour compiler switches: ", 0 );
hb_conOutErr( HB_VER_C_USR, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
}
if( strlen( HB_VER_L_USR ) )
{
hb_conOutErr( "C compiler switches: ", 0 );
hb_conOutErr( HB_VER_L_USR, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
}
if( strlen( HB_VER_PRG_USR ) )
{
hb_conOutErr( "Linker switches: ", 0 );
hb_conOutErr( HB_VER_PRG_USR, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
}
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Harbour extensions: ", 0 );
#if defined( HB_EXTENSION )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "CA-Clipper 5.2e undocumented: ", 0 );
#if defined( HB_C52_UNDOC )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "CA-Clipper 5.2e strict compatibility: ", 0 );
#if defined( HB_C52_STRICT )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "CA-Clipper 5.3x compatible extensions: ", 0 );
#if defined( HB_COMPAT_C53 )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Alaska Xbase++ compatible extensions: ", 0 );
#if defined( HB_COMPAT_XPP )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "CA-Visual Objects compatible extensions: ", 0 );
#if defined( HB_COMPAT_VO )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Multisoft Flagship compatible extensions: ", 0 );
#if defined( HB_COMPAT_FLAGSHIP )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Microsoft FoxPro compatible extensions: ", 0 );
#if defined( HB_COMPAT_FOXPRO )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "dBase compatible extensions: ", 0 );
#if defined( HB_COMPAT_DBASE )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Object file generation support: ", 0 );
#if defined( HARBOUR_OBJ_GENERATION )
hb_conOutErr( "Yes", 0 );
#else
hb_conOutErr( "No", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "ANSI C usage: ", 0 );
#if defined( HARBOUR_STRICT_ANSI_C )
hb_conOutErr( "Strict", 0 );
#else
hb_conOutErr( "Non strict", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "C++ mode: ", 0 );
#if defined(__cplusplus)
hb_conOutErr( "On", 0 );
#else
hb_conOutErr( "Off", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Compiler YACC debug mode: ", 0 );
#if defined( HARBOUR_YYDEBUG )
hb_conOutErr( "On", 0 );
#else
hb_conOutErr( "Off", 0 );
#endif
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Memory tracing and statistics: ", 0 );
hb_conOutErr( hb_xquery( HB_MEM_USEDMAX ) != 0 ? "On" : "Off", 0 );
/*
#if defined( HB_FM_STATISTICS )
hb_conOutErr( "On", 0 );
#else
hb_conOutErr( "Off", 0 );
#endif
*/
hb_conOutErr( hb_conNewLine(), 0 );
{
char buffer[ 64 ];
sprintf( buffer, "Maximum symbol name length: %i", HB_SYMBOL_NAME_LEN );
hb_conOutErr( buffer, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
}
hb_conOutErr( "---------------------------", 0 );
hb_conOutErr( hb_conNewLine(), 0 );
}

View File

@@ -396,7 +396,7 @@ static HB_GENC_FUNC( hb_p_arraydim )
fprintf( cargo->yyc, "\tHB_P_ARRAYDIM, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -538,7 +538,7 @@ static HB_GENC_FUNC( hb_p_arraygen )
fprintf( cargo->yyc, "\tHB_P_ARRAYGEN, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -585,10 +585,7 @@ static HB_GENC_FUNC( hb_p_jumpnear )
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose )
{
LONG lOffset = ( LONG ) ( pFunc->pCode[ lPCodePos + 1 ] );
if( lOffset > 127 )
lOffset -= 256;
LONG lOffset = ( signed char ) ( pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
@@ -603,10 +600,7 @@ static HB_GENC_FUNC( hb_p_jump )
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
LONG lOffset = ( LONG ) ( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 );
if( lOffset > SHRT_MAX )
lOffset -= 65536;
LONG lOffset = HB_PCODE_MKSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
@@ -622,10 +616,7 @@ static HB_GENC_FUNC( hb_p_jumpfar )
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
LONG lOffset = ( LONG ) ( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 + pFunc->pCode[ lPCodePos + 3 ] * 65536 );
if( lOffset > 8388607L )
lOffset -= 16777216;
LONG lOffset = HB_PCODE_MKINT24( &( pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\t/* %li (abs: %08li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
@@ -638,11 +629,7 @@ static HB_GENC_FUNC( hb_p_jumpfalsenear )
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose )
{
LONG lOffset = ( LONG ) ( pFunc->pCode[ lPCodePos + 1 ] );
if( lOffset > 127 )
lOffset -= 256;
LONG lOffset = ( signed char ) ( pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
@@ -656,11 +643,7 @@ static HB_GENC_FUNC( hb_p_jumpfalse )
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
LONG lOffset = ( LONG ) ( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 );
if( lOffset > SHRT_MAX )
lOffset -= 65536;
LONG lOffset = HB_PCODE_MKSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
@@ -675,11 +658,8 @@ static HB_GENC_FUNC( hb_p_jumpfalsefar )
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
LONG lOffset = ( LONG ) ( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 + pFunc->pCode[ lPCodePos + 3 ] * 65536 );
if( lOffset > 8388607L )
lOffset -= 16777216;
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
LONG lOffset = HB_PCODE_MKINT24( &( pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\t/* %li (abs: %08li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
return 4;
@@ -691,10 +671,7 @@ static HB_GENC_FUNC( hb_p_jumptruenear )
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose )
{
LONG lOffset = ( LONG ) ( pFunc->pCode[ lPCodePos + 1 ] );
if( lOffset > 127 )
lOffset -= 256;
LONG lOffset = ( signed char ) ( pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
@@ -708,10 +685,7 @@ static HB_GENC_FUNC( hb_p_jumptrue )
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
LONG lOffset = ( LONG ) ( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 );
if( lOffset > SHRT_MAX )
lOffset -= 65536;
LONG lOffset = HB_PCODE_MKSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
@@ -726,11 +700,8 @@ static HB_GENC_FUNC( hb_p_jumptruefar )
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
LONG lOffset = ( LONG ) ( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 + pFunc->pCode[ lPCodePos + 3 ] * 65536 );
if( lOffset > 8388607L )
lOffset -= 16777216;
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
LONG lOffset = HB_PCODE_MKINT24( &( pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\t/* %li (abs: %08li) */", lOffset, ( LONG ) ( lPCodePos + lOffset ) );
}
fprintf( cargo->yyc, "\n" );
return 4;
@@ -764,7 +735,7 @@ static HB_GENC_FUNC( hb_p_line )
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %i */", pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 );
fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -896,7 +867,7 @@ static HB_GENC_FUNC( hb_p_message )
fprintf( cargo->yyc, "\tHB_P_MESSAGE, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -992,7 +963,7 @@ static HB_GENC_FUNC( hb_p_parameter )
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
fprintf( cargo->yyc, "\n" );
return 4;
}
@@ -1029,7 +1000,7 @@ static HB_GENC_FUNC( hb_p_popaliasedfield )
fprintf( cargo->yyc, "\tHB_P_POPALIASEDFIELD, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1048,7 +1019,7 @@ static HB_GENC_FUNC( hb_p_popaliasedvar )
fprintf( cargo->yyc, "\tHB_P_POPALIASEDVAR, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1058,7 +1029,7 @@ static HB_GENC_FUNC( hb_p_popfield )
fprintf( cargo->yyc, "\tHB_P_POPFIELD, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1070,7 +1041,7 @@ static HB_GENC_FUNC( hb_p_poplocal )
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
{
SHORT wVar = * ( ( SHORT * ) &( pFunc->pCode )[ lPCodePos + 1 ] );
int iVar = HB_PCODE_MKSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) );
/* Variable with negative order are local variables
* referenced in a codeblock -handle it with care
*/
@@ -1079,13 +1050,13 @@ static HB_GENC_FUNC( hb_p_poplocal )
{
/* we are accesing variables within a codeblock */
/* the names of codeblock variable are lost */
if( wVar < 0 )
fprintf( cargo->yyc, "\t/* localvar%i */", -wVar );
if( iVar < 0 )
fprintf( cargo->yyc, "\t/* localvar%i */", -iVar );
else
fprintf( cargo->yyc, "\t/* codeblockvar%i */", wVar );
fprintf( cargo->yyc, "\t/* codeblockvar%i */", iVar );
}
else
fprintf( cargo->yyc, "\t/* %s */", hb_compLocalVariableFind( pFunc, wVar )->szName );
fprintf( cargo->yyc, "\t/* %s */", hb_compLocalVariableFind( pFunc, iVar )->szName );
}
fprintf( cargo->yyc, "\n" );
return 3;
@@ -1097,7 +1068,7 @@ static HB_GENC_FUNC( hb_p_poplocalnear )
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose )
{
char wVar = ( char ) pFunc->pCode[ lPCodePos + 1 ];
int iVar = ( signed char ) pFunc->pCode[ lPCodePos + 1 ];
/* Variable with negative order are local variables
* referenced in a codeblock -handle it with care
*/
@@ -1106,13 +1077,13 @@ static HB_GENC_FUNC( hb_p_poplocalnear )
{
/* we are accesing variables within a codeblock */
/* the names of codeblock variable are lost */
if( wVar < 0 )
fprintf( cargo->yyc, "\t/* localvar%i */", -wVar );
if( iVar < 0 )
fprintf( cargo->yyc, "\t/* localvar%i */", -iVar );
else
fprintf( cargo->yyc, "\t/* codeblockvar%i */", wVar );
fprintf( cargo->yyc, "\t/* codeblockvar%i */", iVar );
}
else
fprintf( cargo->yyc, "\t/* %s */", hb_compLocalVariableFind( pFunc, wVar )->szName );
fprintf( cargo->yyc, "\t/* %s */", hb_compLocalVariableFind( pFunc, iVar )->szName );
}
fprintf( cargo->yyc, "\n" );
return 2;
@@ -1123,7 +1094,7 @@ static HB_GENC_FUNC( hb_p_popmemvar )
fprintf( cargo->yyc, "\tHB_P_POPMEMVAR, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1137,7 +1108,7 @@ static HB_GENC_FUNC( hb_p_popstatic )
{
PVAR pVar;
PFUNCTION pTmp = hb_comp_functions.pFirst;
USHORT wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256;
USHORT wVar = HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) );
while( pTmp->pNext && pTmp->pNext->iStaticsBase < wVar )
pTmp = pTmp->pNext;
pVar = hb_compVariableFind( pTmp->pStatics, wVar - pTmp->iStaticsBase );
@@ -1153,7 +1124,7 @@ static HB_GENC_FUNC( hb_p_popvariable )
fprintf( cargo->yyc, "\tHB_P_POPVARIABLE, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1181,7 +1152,7 @@ static HB_GENC_FUNC( hb_p_pushaliasedfield )
fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDFIELD, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1200,7 +1171,7 @@ static HB_GENC_FUNC( hb_p_pushaliasedvar )
fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDVAR, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1217,18 +1188,17 @@ static HB_GENC_FUNC( hb_p_pushblock )
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %i */",
pFunc->pCode[ lPCodePos + 1 ] +
pFunc->pCode[ lPCodePos + 2 ] * 256 );
HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
w = * ( ( USHORT * ) &( pFunc->pCode [ lPCodePos + 3 ] ) );
w = HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 3 ] ) );
fprintf( cargo->yyc, "\t%i, %i,",
pFunc->pCode[ lPCodePos + 3 ],
pFunc->pCode[ lPCodePos + 4 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* number of local parameters (%i) */", w );
fprintf( cargo->yyc, "\n" );
wVar = * ( ( USHORT * ) &( pFunc->pCode [ lPCodePos + 5 ] ) );
wVar = HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 5 ] ) );
fprintf( cargo->yyc, "\t%i, %i,",
pFunc->pCode[ lPCodePos + 5 ],
pFunc->pCode[ lPCodePos + 6 ] );
@@ -1239,7 +1209,7 @@ static HB_GENC_FUNC( hb_p_pushblock )
/* create the table of referenced local variables */
while( wVar-- )
{
w = * ( ( USHORT * ) &( pFunc->pCode [ lPCodePos ] ) );
w = HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos ] ) );
fprintf( cargo->yyc, "\t%i, %i,",
pFunc->pCode[ lPCodePos ],
pFunc->pCode[ lPCodePos + 1 ] );
@@ -1277,13 +1247,18 @@ static HB_GENC_FUNC( hb_p_pushdouble )
fprintf( cargo->yyc, "\tHB_P_PUSHDOUBLE," );
++lPCodePos;
for( i = 0; i < sizeof( double ) + sizeof( BYTE ) + sizeof( BYTE ); ++i )
for( i = 0; i < ( int ) ( sizeof( double ) + sizeof( BYTE ) + sizeof( BYTE ) ); ++i )
{
fprintf( cargo->yyc, " %i,", ( ( BYTE * ) pFunc->pCode )[ lPCodePos + i ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %.*f, %d, %d */",
}
if( cargo->bVerbose )
{
fprintf( cargo->yyc, "\t/* %.*f, %d, %d */",
*( ( BYTE * ) &( pFunc->pCode[ lPCodePos + sizeof( double ) ] ) ),
*( ( double * ) &( pFunc->pCode[ lPCodePos ] ) ),
HB_PCODE_MKDOUBLE( &( pFunc->pCode[ lPCodePos ] ) ),
*( ( BYTE * ) &( pFunc->pCode[ lPCodePos + sizeof( double ) ] ) ),
*( ( BYTE * ) &( pFunc->pCode[ lPCodePos + sizeof( double ) + sizeof( BYTE ) ] ) ) );
}
fprintf( cargo->yyc, "\n" );
return sizeof( double ) + sizeof( BYTE ) + sizeof( BYTE ) + 1;
@@ -1294,7 +1269,7 @@ static HB_GENC_FUNC( hb_p_pushfield )
fprintf( cargo->yyc, "\tHB_P_PUSHFIELD, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1304,7 +1279,7 @@ static HB_GENC_FUNC( hb_p_pushbyte )
fprintf( cargo->yyc, "\tHB_P_PUSHBYTE, %i,",
pFunc->pCode[ lPCodePos + 1 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */",
pFunc->pCode[ lPCodePos + 1 ] );
( signed char ) pFunc->pCode[ lPCodePos + 1 ] );
fprintf( cargo->yyc, "\n" );
return 2;
}
@@ -1314,9 +1289,7 @@ static HB_GENC_FUNC( hb_p_pushint )
fprintf( cargo->yyc, "\tHB_P_PUSHINT, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */",
pFunc->pCode[ lPCodePos + 1 ] +
pFunc->pCode[ lPCodePos + 2 ] * 256 );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1411,10 +1384,34 @@ static HB_GENC_FUNC( hb_p_pushlong )
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ],
pFunc->pCode[ lPCodePos + 4 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %li */", *( ( long * ) &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %li */", HB_PCODE_MKLONG( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 1 + sizeof( long );
return 5;
}
static HB_GENC_FUNC( hb_p_pushlonglong )
{
fprintf( cargo->yyc, "\tHB_P_PUSHLONGLONG, %i, %i, %i, %i, %i, %i, %i, %i, ",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ],
pFunc->pCode[ lPCodePos + 4 ],
pFunc->pCode[ lPCodePos + 5 ],
pFunc->pCode[ lPCodePos + 6 ],
pFunc->pCode[ lPCodePos + 7 ],
pFunc->pCode[ lPCodePos + 8 ] );
if( cargo->bVerbose )
{
#ifdef HB_LONG_LONG_OFF
fprintf( cargo->yyc, "\t/* %f */", HB_PCODE_MKLONGLONG( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
#else
fprintf( cargo->yyc, "\t/* %" PFLL "i */", HB_PCODE_MKLONGLONG( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
#endif
}
fprintf( cargo->yyc, "\n" );
return 9;
}
static HB_GENC_FUNC( hb_p_pushmemvar )
@@ -1422,7 +1419,7 @@ static HB_GENC_FUNC( hb_p_pushmemvar )
fprintf( cargo->yyc, "\tHB_P_PUSHMEMVAR, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1432,7 +1429,7 @@ static HB_GENC_FUNC( hb_p_pushmemvarref )
fprintf( cargo->yyc, "\tHB_P_PUSHMEMVARREF, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1464,7 +1461,7 @@ static HB_GENC_FUNC( hb_p_pushstatic )
{
PVAR pVar;
PFUNCTION pTmp = hb_comp_functions.pFirst;
USHORT wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256;
USHORT wVar = HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) );
while( pTmp->pNext && pTmp->pNext->iStaticsBase < wVar )
pTmp = pTmp->pNext;
pVar = hb_compVariableFind( pTmp->pStatics, wVar - pTmp->iStaticsBase );
@@ -1484,7 +1481,7 @@ static HB_GENC_FUNC( hb_p_pushstaticref )
PVAR pVar;
PFUNCTION pTmp = hb_comp_functions.pFirst;
USHORT wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256;
USHORT wVar = HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) );
while( pTmp->pNext && pTmp->pNext->iStaticsBase < wVar )
pTmp = pTmp->pNext;
pVar = hb_compVariableFind( pTmp->pStatics, wVar - pTmp->iStaticsBase );
@@ -1498,8 +1495,7 @@ static HB_GENC_FUNC( hb_p_pushstaticref )
static HB_GENC_FUNC( hb_p_pushstr )
{
ULONG ulStart = lPCodePos;
USHORT wLen = pFunc->pCode[ lPCodePos + 1 ] +
pFunc->pCode[ lPCodePos + 2 ] * 256;
USHORT wLen = HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\tHB_P_PUSHSTR, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
@@ -1576,7 +1572,7 @@ static HB_GENC_FUNC( hb_p_pushsym )
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName );
fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1596,7 +1592,8 @@ static HB_GENC_FUNC( hb_p_pushvariable )
fprintf( cargo->yyc, "\tHB_P_PUSHVARIABLE, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -1632,8 +1629,8 @@ static HB_GENC_FUNC( hb_p_seqbegin )
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
LONG lOffset = ( LONG ) ( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 + pFunc->pCode[ lPCodePos + 3 ] * 65536 );
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, lPCodePos + lOffset );
LONG lOffset = HB_PCODE_MKINT24( &( pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\t/* %li (abs: %08li) */", lOffset, lPCodePos + lOffset );
}
fprintf( cargo->yyc, "\n" );
return 4;
@@ -1649,8 +1646,8 @@ static HB_GENC_FUNC( hb_p_seqend )
pFunc->pCode[ lPCodePos + 3 ] );
if( cargo->bVerbose )
{
LONG lOffset = ( LONG ) ( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 + pFunc->pCode[ lPCodePos + 3 ] * 65536 );
fprintf( cargo->yyc, "\t/* %li (abs: %05li) */", lOffset, lPCodePos + lOffset );
LONG lOffset = HB_PCODE_MKINT24( &( pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, "\t/* %li (abs: %08li) */", lOffset, lPCodePos + lOffset );
}
fprintf( cargo->yyc, "\n" );
return 4;
@@ -1684,7 +1681,8 @@ static HB_GENC_FUNC( hb_p_statics )
pFunc->pCode[ lPCodePos + 2 ],
pFunc->pCode[ lPCodePos + 3 ],
pFunc->pCode[ lPCodePos + 4 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* symbol (_INITSTATICS), %i statics */", pFunc->pCode[ lPCodePos + 3 ] + pFunc->pCode[ lPCodePos + 4 ] * 256 );
if( cargo->bVerbose )
fprintf( cargo->yyc, "\t/* symbol (_INITSTATICS), %i statics */", HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 3 ] ) ) );
fprintf( cargo->yyc, "\n" );
return (USHORT) lByteCount;
@@ -1786,7 +1784,6 @@ static HB_GENC_FUNC( hb_p_macrolistend )
return 1;
}
#define HB_PCODE_MKSHORT( p ) ( *( SHORT * )( p ) )
static HB_GENC_FUNC( hb_p_localnearaddint )
{
fprintf( cargo->yyc, "\tHB_P_LOCALNEARADDINT, %i, %i, %i,", pFunc->pCode[ lPCodePos + 1 ],
@@ -1939,7 +1936,8 @@ static HB_GENC_FUNC_PTR s_verbose_table[] = {
hb_p_dummy,
/* end: */
hb_p_localnearaddint,
hb_p_macropushref
hb_p_macropushref,
hb_p_pushlonglong
};
static void hb_compGenCReadable( PFUNCTION pFunc, FILE * yyc )

View File

@@ -423,7 +423,7 @@ static HB_GENC_FUNC( hb_p_arraydim )
fprintf( cargo->yyc, "\tHB_P_ARRAYDIM, %i, %i,",
pFunc->pCode[ lPCodePos + 1 ],
pFunc->pCode[ lPCodePos + 2 ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
fprintf( cargo->yyc, "\n" );
return 3;
}
@@ -450,6 +450,8 @@ static HB_GENC_FUNC( hb_p_doshort )
HB_FUNCALLS_PTR pTemp = pFunCalls, pPrev = NULL;
char * szFunName;
HB_SYMBOL_UNUSED( pFunc );
while( pTemp->pNext != NULL )
{
pPrev = pTemp;
@@ -525,6 +527,10 @@ static HB_GENC_FUNC( hb_p_endblock )
static HB_GENC_FUNC( hb_p_endproc )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( cargo );
HB_SYMBOL_UNUSED( lPCodePos );
// if( (lPCodePos+1) == pFunc->lPCodePos )
// fprintf( cargo->yyc, "\tHB_P_ENDPROC\n" );
// else
@@ -605,6 +611,8 @@ static HB_GENC_FUNC( hb_p_functionshort )
HB_FUNCALLS_PTR pTemp = pFunCalls, pPrev = NULL;
char * szFunName;
HB_SYMBOL_UNUSED( pFunc );
while( pTemp->pNext != NULL )
{
pPrev = pTemp;
@@ -630,13 +638,12 @@ static HB_GENC_FUNC( hb_p_functionshort )
static HB_GENC_FUNC( hb_p_arraygen )
{
int i;
int i, n = HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) );
fprintf( cargo->yyc, " IL_%04lX: ", lPCodePos );
fprintf( cargo->yyc, "call vararg object ObjArrayGen( ..." );
for( i = 0; i < pFunc->pCode[ lPCodePos + 1 ] +
( pFunc->pCode[ lPCodePos + 2 ] * 256 ); i++ )
for( i = 0; i < n; i++ )
fprintf( cargo->yyc, ",object" );
fprintf( cargo->yyc, ")\n" );
@@ -896,6 +903,8 @@ static HB_GENC_FUNC( hb_p_lessequal )
static HB_GENC_FUNC( hb_p_line )
{
HB_SYMBOL_UNUSED( pFunc );
fprintf( cargo->yyc, " IL_%04lX: ", lPCodePos );
fprintf( cargo->yyc, "nop // HB_P_LINE\n" );
@@ -1423,7 +1432,7 @@ static HB_GENC_FUNC( hb_p_pushdouble )
fprintf( cargo->yyc, "\tHB_P_PUSHDOUBLE," );
++lPCodePos;
for( i = 0; i < sizeof( double ) + sizeof( BYTE ) + sizeof( BYTE ); ++i )
for( i = 0; i < (int) ( sizeof( double ) + sizeof( BYTE ) + sizeof( BYTE ) ); ++i )
fprintf( cargo->yyc, " %i,", ( ( BYTE * ) pFunc->pCode )[ lPCodePos + i ] );
if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %.*f, %d, %d */",
*( ( BYTE * ) &( pFunc->pCode[ lPCodePos + sizeof( double ) ] ) ),
@@ -1578,7 +1587,7 @@ static HB_GENC_FUNC( hb_p_pushlong )
// if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %li */", *( ( long * ) &( pFunc->pCode[ lPCodePos + 1 ] ) ) );
// fprintf( cargo->yyc, "\n" );
return 1 + sizeof( long );
return 5;
}
static HB_GENC_FUNC( hb_p_pushmemvar )
@@ -1606,6 +1615,7 @@ static HB_GENC_FUNC( hb_p_pushnil )
HB_FUNCALLS_PTR pTemp = pFunCalls;
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( cargo );
HB_SYMBOL_UNUSED( lPCodePos );
if( pTemp )
@@ -2013,7 +2023,6 @@ static HB_GENC_FUNC( hb_p_macrolistend )
return 1;
}
#define HB_PCODE_MKSHORT( p ) ( *( SHORT * )( p ) )
static HB_GENC_FUNC( hb_p_localnearaddint )
{
fprintf( cargo->yyc, " IL_%04lX: ", lPCodePos );

View File

@@ -2279,7 +2279,7 @@ ULONG hb_compGenJump( LONG lOffset )
}
else if( lOffset >= (-8388608L) && lOffset <= 8388607L )
{
hb_compGenPCode4( HB_P_JUMPFAR, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), ( BYTE ) ( (USHORT)( lOffset >> 16 ) & 0xFF ), ( BOOL ) 1 );
hb_compGenPCode4( HB_P_JUMPFAR, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), ( BYTE ) ( ( lOffset >> 16 ) & 0xFF ), ( BOOL ) 1 );
}
else
{
@@ -2311,7 +2311,7 @@ ULONG hb_compGenJumpFalse( LONG lOffset )
}
else if( lOffset >= (-8388608L) && lOffset <= 8388607L )
{
hb_compGenPCode4( HB_P_JUMPFALSEFAR, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), ( BYTE ) ( (USHORT)( lOffset >> 16 ) & 0xFF ), ( BOOL ) 1 );
hb_compGenPCode4( HB_P_JUMPFALSEFAR, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), ( BYTE ) ( ( lOffset >> 16 ) & 0xFF ), ( BOOL ) 1 );
}
else
{
@@ -2343,7 +2343,7 @@ ULONG hb_compGenJumpTrue( LONG lOffset )
}
else if( lOffset >= (-8388608L) && lOffset <= 8388607L )
{
hb_compGenPCode4( HB_P_JUMPTRUEFAR, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), ( BYTE ) ( (USHORT)( lOffset >> 16 ) & 0xFF ), ( BOOL ) 1 );
hb_compGenPCode4( HB_P_JUMPTRUEFAR, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), ( BYTE ) ( ( lOffset >> 16 ) & 0xFF ), ( BOOL ) 1 );
}
else
{
@@ -3131,8 +3131,7 @@ void hb_compGenPushDouble( double dNumber, BYTE bWidth, BYTE bDec )
BYTE pBuffer[ sizeof( double ) + sizeof( BYTE ) + sizeof( BYTE ) + 1 ];
pBuffer[ 0 ] = HB_P_PUSHDOUBLE;
memcpy( ( BYTE * ) &( pBuffer[ 1 ] ), ( BYTE * ) &dNumber, sizeof( double ) );
HB_PUT_LE_DOUBLE( &( pBuffer[ 1 ] ), dNumber );
pBuffer[ 1 + sizeof( double ) ] = bWidth;
pBuffer[ 1 + sizeof( double ) + sizeof( BYTE ) ] = bDec;
@@ -3156,30 +3155,29 @@ void hb_compGenPushFunCall( char * szFunName )
}
/* generates the pcode to push a long number on the virtual machine stack */
void hb_compGenPushLong( long lNumber )
void hb_compGenPushLong( HB_LONG lNumber )
{
if( lNumber == 0 )
hb_compGenPCode1( HB_P_ZERO );
else if( lNumber == 1 )
hb_compGenPCode1( HB_P_ONE );
else if( ( ( char * ) &lNumber )[ 2 ] == 0 && ( ( char * ) &lNumber )[ 3 ] == 0 )
else if( HB_LIM_INT8( lNumber ) )
hb_compGenPCode2( HB_P_PUSHBYTE, (BYTE) lNumber, TRUE );
else if( HB_LIM_INT16( lNumber ) )
hb_compGenPCode3( HB_P_PUSHINT, HB_LOBYTE( lNumber ), HB_HIBYTE( lNumber ), TRUE );
else if( HB_LIM_INT32( lNumber ) )
{
if( ( ( char * ) &lNumber )[ 1 ] == 0 )
hb_compGenPCode2( HB_P_PUSHBYTE, ( ( char * ) &lNumber )[ 0 ], ( BOOL ) 1 );
else
hb_compGenPCode3( HB_P_PUSHINT, ( ( char * ) &lNumber )[ 0 ], ( ( char * ) &lNumber )[ 1 ], ( BOOL ) 1 );
BYTE pBuffer[ 5 ];
pBuffer[ 0 ] = HB_P_PUSHLONG;
HB_PUT_LE_UINT32( pBuffer + 1, lNumber );
hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), TRUE );
}
else
{
BYTE pBuffer[5];
pBuffer[0] = HB_P_PUSHLONG;
pBuffer[1] = ( ( BYTE * ) &lNumber )[0];
pBuffer[2] = ( ( BYTE * ) &lNumber )[1];
pBuffer[3] = ( ( BYTE * ) &lNumber )[2];
pBuffer[4] = ( ( BYTE * ) &lNumber )[3];
hb_compGenPCodeN( pBuffer, 5, 1 );
BYTE pBuffer[ 9 ];
pBuffer[ 0 ] = HB_P_PUSHLONGLONG;
HB_PUT_LE_UINT64( pBuffer + 1, lNumber );
hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), TRUE );
}
}

View File

@@ -99,9 +99,8 @@ char *hb_lex_codeblock = NULL;
%}
SpaceTab [ \t]+
Number ([0-9]+)|([0-9]*\.[0-9]+)
Number ([0-9]+)|([0-9]*\.[0-9]+)|(0x[0-9A-Fa-f]+)
InvalidNumber [0-9]+\.
HexNumber 0x[0-9A-F]+
Identifier (([a-zA-Z])|([_a-zA-Z][_a-zA-Z0-9]+))
MacroVar \&{Identifier}[\.]?
@@ -1660,36 +1659,6 @@ Separator {SpaceTab}
{Number} { return yy_ConvertNumber( yytext ); }
{HexNumber} {
long lNumber = 0;
sscanf( yytext, "%lxI", &lNumber );
if( ( double ) SHRT_MIN <= lNumber &&
lNumber <= ( double ) SHRT_MAX )
{
yylval.valInteger.iNumber = lNumber;
yylval.valInteger.szValue = yytext;
return NUM_INTEGER;
}
else if( ( double ) LONG_MIN <= lNumber &&
lNumber <= ( double ) LONG_MAX )
{
yylval.valLong.lNumber = lNumber;
yylval.valLong.szValue = yytext;
return NUM_LONG;
}
else
{
/* NOTE: This will never happen */
yylval.valDouble.dNumber = lNumber;
yylval.valDouble.bWidth = HB_DEFAULT_WIDTH;
yylval.valDouble.bDec = 0;
yylval.valDouble.szValue = yytext;
return NUM_DOUBLE;
}
}
{TrueValue} { hb_comp_iState =RSEPARATOR; return TRUEVALUE; }
{FalseValue} { hb_comp_iState =RSEPARATOR; return FALSEVALUE; }
@@ -1749,42 +1718,28 @@ int yy_lex_input( char *buffer, int iBufferSize )
static int yy_ConvertNumber( char * szBuffer )
{
char * ptr;
HB_LONG lNumber;
double dNumber;
int iDec, iWidth;
yylval.valDouble.dNumber = hb_strVal( szBuffer, strlen( szBuffer ) ); /* atof( szBuffer ); */
ptr = strchr( szBuffer, '.' );
if( ptr )
if( hb_compStrToNum( szBuffer, &lNumber, &dNumber, &iDec, &iWidth ) )
{
yylval.valDouble.bDec = strlen( ptr + 1 );
yylval.valDouble.bWidth = strlen( szBuffer ) - yylval.valDouble.bDec;
if( yylval.valDouble.bDec )
yylval.valDouble.bWidth--;
yylval.valDouble.dNumber = dNumber;
yylval.valDouble.bDec = iDec;
yylval.valDouble.bWidth = iWidth;
yylval.valDouble.szValue = szBuffer;
return NUM_DOUBLE;
}
else if( SHRT_MIN <= lNumber && lNumber <= SHRT_MAX )
{
yylval.valInteger.iNumber = ( int ) lNumber;
yylval.valInteger.szValue = szBuffer;
return NUM_INTEGER;
}
else
{
if( ( double )SHRT_MIN <= yylval.valDouble.dNumber &&
yylval.valDouble.dNumber <= ( double )SHRT_MAX )
{
yylval.valInteger.iNumber = ( int ) yylval.valDouble.dNumber;
yylval.valInteger.szValue = szBuffer;
return NUM_INTEGER;
}
else if( ( double )LONG_MIN <= yylval.valDouble.dNumber &&
yylval.valDouble.dNumber <= ( double )LONG_MAX )
{
yylval.valLong.lNumber = ( long ) yylval.valDouble.dNumber;
yylval.valLong.szValue = szBuffer;
return NUM_LONG;
}
else
{
yylval.valDouble.bWidth = strlen( szBuffer ) + 1;
yylval.valDouble.bDec = 0;
yylval.valDouble.szValue = szBuffer;
return NUM_DOUBLE;
}
yylval.valLong.lNumber = lNumber;
yylval.valLong.szValue = szBuffer;
return NUM_LONG;
}
}

View File

@@ -70,7 +70,8 @@ static unsigned char iIdentifier = 0;
static char *sIdOnHold, *s_sLastBlock = NULL;
char * hb_comp_SLX_LastBlock( BOOL bReset );
long hb_comp_SLX_Hex2L( char* sHex );
static int hb_comp_SLX_Str2Num( char* szNum, HB_LONG * lVal, double * dVal, int * iDec, int * iWidth );
static int hb_comp_SLX_ElementToken( char* szToken, unsigned int iTokenLen );
static int hb_comp_SLX_InterceptAction( int iRet, char *sToken );
static int hb_comp_SLX_CustomAction( int x, int aiHold[], int *ptr_iHold, BOOL *ptr_bIgnoreWords, int iLastToken, char *sToken, char *s_szBuffer );
@@ -668,77 +669,38 @@ static int hb_comp_SLX_ElementToken( char* szToken, unsigned int iTokenLen )
{
/* ConverNumber */
HB_LONG lNumber;
double dNumber;
int iDec, iWidth;
yylval.string = (char*) hb_xgrab( TOKEN_SIZE );
yylval.string[0] = 0;
iRet = hb_comp_SLX_Str2Num( yytext, &lNumber, &dNumber, &iDec, &iWidth );
/* Hex Number */
if( yytext[0] == '0' && yytext[1] == 'X' )
if( !isdigit( yytext[0] ) && !( yytext[0] == '.' && isdigit( yytext[1] ) ) )
{
long lNumber = hb_comp_SLX_Hex2L( yytext + 2 );
if( ( double ) SHRT_MIN <= lNumber && lNumber <= ( double ) SHRT_MAX )
{
yylval.valInteger.iNumber = lNumber;
yylval.valInteger.szValue = yytext;
iRet = NUM_INTEGER;
}
else if( ( double ) LONG_MIN <= lNumber && lNumber <= ( double ) LONG_MAX )
{
yylval.valLong.lNumber = lNumber;
yylval.valLong.szValue = yytext;
iRet = NUM_LONG;
}
else
{
/* NOTE: This will never happen */
yylval.valDouble.dNumber = lNumber;
yylval.valDouble.bWidth = HB_DEFAULT_WIDTH;
yylval.valDouble.bDec = 0;
yylval.valDouble.szValue = yytext;
iRet = NUM_DOUBLE;
}
hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX, yytext, NULL );
return yytext[0];
}
else if ( iRet == NUM_DOUBLE )
{
yylval.valDouble.dNumber = dNumber;
yylval.valDouble.bDec = iDec;
yylval.valDouble.bWidth = iWidth;
yylval.valDouble.szValue = yytext;
}
else if( HB_LIM_INT16( lNumber ) )
{
yylval.valInteger.iNumber = ( int ) lNumber;
yylval.valInteger.szValue = yytext;
iRet = NUM_INTEGER;
}
else
{
yylval.valDouble.dNumber = atof( yytext );
tmpPtr = strchr( yytext, '.' );
if( tmpPtr )
{
yylval.valDouble.bDec = strlen( tmpPtr + 1 );
yylval.valDouble.bWidth = yyleng - yylval.valDouble.bDec;
if( yylval.valDouble.bDec )
{
yylval.valDouble.bWidth--;
}
yylval.valDouble.szValue = yytext;
iRet = NUM_DOUBLE;
}
else
{
if( ( double )SHRT_MIN <= yylval.valDouble.dNumber && yylval.valDouble.dNumber <= ( double )SHRT_MAX )
{
yylval.valInteger.iNumber = ( int ) yylval.valDouble.dNumber;
yylval.valInteger.szValue = yytext;
iRet = NUM_INTEGER;
}
else if( ( double )LONG_MIN <= yylval.valDouble.dNumber && yylval.valDouble.dNumber <= ( double )LONG_MAX )
{
yylval.valLong.lNumber = ( long ) yylval.valDouble.dNumber;
yylval.valLong.szValue = yytext;
iRet = NUM_LONG;
}
else
{
yylval.valDouble.bWidth = yyleng + 1;
yylval.valDouble.bDec = 0;
yylval.valDouble.szValue = yytext;
iRet = NUM_DOUBLE;
}
}
yylval.valLong.lNumber = lNumber;
yylval.valLong.szValue = yytext;
}
iRet += DONT_REDUCE;
}
@@ -746,40 +708,12 @@ static int hb_comp_SLX_ElementToken( char* szToken, unsigned int iTokenLen )
return iRet;
}
long hb_comp_SLX_Hex2L( char* sHex )
static int hb_comp_SLX_Str2Num( char* szNum, HB_LONG * plVal, double * pdVal, int * piDec, int * piWidth )
{
int i, iExp = 0, iLen = strlen( sHex ) - 1;
long lVal, lSum = 0;
char cChar;
while( iLen >= 0 )
{
cChar = sHex[ iLen-- ];
if( cChar > 64 && cChar < 91 )
{
lVal = cChar - 55;
}
else
{
lVal = cChar - 48;
}
if( lVal )
{
i = 0;
while( i++ < iExp )
{
lVal *= 16;
}
lSum += lVal;
}
iExp++;
}
return lSum;
BOOL fDbl;
fDbl = hb_compStrToNum( szNum, plVal, pdVal, piDec, piWidth );
return fDbl ? NUM_DOUBLE : NUM_LONG;
}
static int hb_comp_SLX_CustomAction( int x, int aiHold[], int *ptr_iHold, BOOL *ptr_bIgnoreWords, int iLastToken, char *sToken, char *s_szBuffer )

View File

@@ -130,7 +130,7 @@ static HB_RTVAR_PTR hb_comp_rtvars = NULL;
static BOOL bTrancuateBaseArray = FALSE;
static HB_EXPR_PTR pGetArgList = NULL, pBaseArrayName = NULL, pGetVarArray;
static s_bBlock = FALSE, s_bBlockMacro = FALSE, s_bBlockDeclared = FALSE, s_bSetGet;
static BOOL s_bBlock = FALSE, s_bBlockMacro = FALSE, s_bBlockDeclared = FALSE, s_bSetGet;
static HB_EXPR_PTR pBlockSimple;
extern int hb_compLocalGetPos( char * szVarName ); /* returns the order + 1 of a local variable */

View File

@@ -137,9 +137,9 @@ static void hb_compDebugStart( void ) { };
%union /* special structure used by lex and yacc to share info */
{
char * string; /* to hold a string returned by lex */
int iNumber; /* to hold a temporary integer number */
long lNumber; /* to hold a temporary long number */
char * string; /* to hold a string returned by lex */
int iNumber; /* to hold a temporary integer number */
HB_LONG lNumber; /* to hold a temporary long number */
struct
{
int iNumber; /* to hold a number returned by lex */
@@ -147,8 +147,8 @@ static void hb_compDebugStart( void ) { };
} valInteger;
struct
{
long lNumber; /* to hold a long number returned by lex */
char * szValue;
HB_LONG lNumber; /* to hold a long number returned by lex */
char * szValue;
} valLong;
struct
{

View File

@@ -68,8 +68,7 @@ typedef HB_FIX_FUNC_ * HB_FIX_FUNC_PTR;
static HB_FIX_FUNC( hb_p_pushstr )
{
HB_SYMBOL_UNUSED( cargo );
return 3 + pFunc->pCode[ lPCodePos + 1 ] +
pFunc->pCode[ lPCodePos + 2 ] * 256;
return 3 + HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) );
}
static HB_FIX_FUNC( hb_p_pushstrshort )
@@ -90,21 +89,23 @@ static HB_FIX_FUNC( hb_p_endblock )
static HB_FIX_FUNC( hb_p_pushblock )
{
USHORT wVar;
USHORT * pLocal;
ULONG ulStart = lPCodePos;
++cargo->iNestedCodeblock;
wVar = * ( ( USHORT * ) &( pFunc->pCode [ lPCodePos + 5 ] ) );
wVar = HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 5 ] ) );
/* opcode + codeblock size + number of parameters + number of local variables */
lPCodePos += 7;
/* fix local variable's reference */
while( wVar-- )
{
BYTE * pLocal = &( pFunc->pCode[ lPCodePos ] );
USHORT wLocal = HB_PCODE_MKUSHORT( pLocal );
pLocal = ( USHORT * ) &( pFunc->pCode [ lPCodePos ] );
*pLocal += pFunc->wParamCount;
wLocal += pFunc->wParamCount;
pLocal[ 0 ] = HB_LOBYTE( wLocal );
pLocal[ 1 ] = HB_HIBYTE( wLocal );
lPCodePos +=2;
}
return (USHORT) (lPCodePos - ulStart);
@@ -150,9 +151,12 @@ static HB_FIX_FUNC( hb_p_poplocal )
{
/* only local variables used outside of a codeblock need fixing
*/
SHORT * pVar = ( SHORT * ) &( pFunc->pCode )[ lPCodePos + 1 ];
BYTE * pVar = &( pFunc->pCode[ lPCodePos + 1 ] );
SHORT iVar = HB_PCODE_MKSHORT( pVar );
*pVar += pFunc->wParamCount;
iVar += pFunc->wParamCount;
pVar[ 0 ] = HB_LOBYTE( iVar );
pVar[ 1 ] = HB_HIBYTE( iVar );
}
return (USHORT) 3;
@@ -164,9 +168,12 @@ static HB_FIX_FUNC( hb_p_pushlocal )
{
/* only local variables used outside of a codeblock need fixing
*/
SHORT * pVar = ( SHORT * ) &( pFunc->pCode )[ lPCodePos + 1 ];
BYTE * pVar = &( pFunc->pCode[ lPCodePos + 1 ] );
SHORT iVar = HB_PCODE_MKSHORT( pVar );
*pVar += pFunc->wParamCount;
iVar += pFunc->wParamCount;
pVar[ 0 ] = HB_LOBYTE( iVar );
pVar[ 1 ] = HB_HIBYTE( iVar );
}
return (USHORT) 3;
@@ -178,9 +185,12 @@ static HB_FIX_FUNC( hb_p_pushlocalref )
{
/* only local variables used outside of a codeblock need fixing
*/
SHORT * pVar = ( SHORT * ) &( pFunc->pCode )[ lPCodePos + 1 ];
BYTE * pVar = &( pFunc->pCode[ lPCodePos + 1 ] );
SHORT iVar = HB_PCODE_MKSHORT( pVar );
*pVar += pFunc->wParamCount;
iVar += pFunc->wParamCount;
pVar[ 0 ] = HB_LOBYTE( iVar );
pVar[ 1 ] = HB_HIBYTE( iVar );
}
return (USHORT) 3;
@@ -192,10 +202,13 @@ static HB_FIX_FUNC( hb_p_poplocalnear )
{
/* only local variables used outside of a codeblock need fixing
*/
SHORT * pVar = ( SHORT * ) &( pFunc->pCode )[ lPCodePos + 1 ];
BYTE * pVar = &( pFunc->pCode[ lPCodePos + 1 ] );
SHORT iVar = HB_PCODE_MKSHORT( pVar );
*pVar += pFunc->wParamCount;
if( *pVar >= -128 && *pVar <= 127 )
iVar += pFunc->wParamCount;
pVar[ 0 ] = HB_LOBYTE( iVar );
pVar[ 1 ] = HB_HIBYTE( iVar );
if( iVar >= -128 && iVar <= 127 )
{
pFunc->pCode[ lPCodePos + 2 ] = HB_P_NOOP;
hb_compNOOPadd( pFunc, lPCodePos + 2 );
@@ -217,10 +230,13 @@ static HB_FIX_FUNC( hb_p_pushlocalnear )
{
/* only local variables used outside of a codeblock need fixing
*/
SHORT * pVar = ( SHORT * ) &( pFunc->pCode )[ lPCodePos + 1 ];
BYTE * pVar = &( pFunc->pCode[ lPCodePos + 1 ] );
SHORT iVar = HB_PCODE_MKSHORT( pVar );
*pVar += pFunc->wParamCount;
if( *pVar >= -128 && *pVar <= 127 )
iVar += pFunc->wParamCount;
pVar[ 0 ] = HB_LOBYTE( iVar );
pVar[ 1 ] = HB_HIBYTE( iVar );
if( iVar >= -128 && iVar <= 127 )
{
pFunc->pCode[ lPCodePos + 2 ] = HB_P_NOOP;
hb_compNOOPadd( pFunc, lPCodePos + 2 );
@@ -407,9 +423,10 @@ static HB_FIX_FUNC_PTR s_fixlocals_table[] =
NULL, /* HB_P_ONE, */
NULL, /* HB_P_MACROLIST, */
NULL, /* HB_P_MACROLISTEND, */
NULL, /* HB_P_MPUSHSTR */
NULL, /* HB_P_MPUSHSTR, */
hb_p_localnearaddint, /* HB_P_LOCALNEARADDINT, */
NULL /* HB_P_MACROPUSHREF */
NULL, /* HB_P_MACROPUSHREF, */
NULL /* HB_P_PUSHLONGLONG */
};
void hb_compFixFuncPCode( PFUNCTION pFunc )

View File

@@ -141,7 +141,7 @@ static BYTE s_pcode_len[] = {
3, /* HB_P_PUSHLOCAL, */
2, /* HB_P_PUSHLOCALNEAR, */
3, /* HB_P_PUSHLOCALREF, */
1 + sizeof( long ), /* HB_P_PUSHLONG, */
5, /* HB_P_PUSHLONG, */
3, /* HB_P_PUSHMEMVAR, */
3, /* HB_P_PUSHMEMVARREF, */
1, /* HB_P_PUSHNIL, */
@@ -171,7 +171,8 @@ static BYTE s_pcode_len[] = {
1, /* HB_P_MACROLISTEND, */
0, /* HB_P_MPUSHSTR */
4, /* HB_P_LOCALNEARADDINT, */
1 /* HB_P_MACROPUSHREF */
1, /* HB_P_MACROPUSHREF, */
9 /* HB_P_PUSHLONGLONG */
};
static PVAR hb_compPrivateFind( char * szPrivateName )
@@ -322,6 +323,7 @@ void hb_compStrongType( int iSize )
if( ( pFunc->pStack[ pFunc->iStackIndex ] == '-' + VT_OFFSET_VARIANT ) || pFunc->pStack[ pFunc->iStackIndex ] >= ( 'A' + VT_OFFSET_VARIANT ) )
{
cSubType1 = ( pFunc->pStack[ pFunc->iStackIndex ] -= VT_OFFSET_VARIANT );
cType1 = 'X';
}
else
{
@@ -375,7 +377,7 @@ void hb_compStrongType( int iSize )
case HB_P_DO :
case HB_P_FUNCTION :
wVar = pFunc->pCode[ ulPos + 1 ] + pFunc->pCode[ ulPos + 2 ] * 256;
wVar = HB_PCODE_MKSHORT( &( pFunc->pCode[ ulPos + 1 ] ) );
/* DON't put break; Has to fall through */
case HB_P_DOSHORT :
case HB_P_FUNCTIONSHORT :
@@ -626,7 +628,7 @@ void hb_compStrongType( int iSize )
;/* The Object is not declared. */
else if( cSubType1 == 'S' )
{
pSym = hb_compSymbolGetPos( pFunc->pCode[ ulPos + 1 ] + pFunc->pCode[ ulPos + 2 ] * 256 );
pSym = hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ ulPos + 1 ] ) ) );
if( pSym && pSym->szName && pFunc->iStackClasses && pFunc->pStackClasses[ pFunc->iStackClasses - 1 ] )
{
@@ -667,7 +669,7 @@ void hb_compStrongType( int iSize )
/* Also handled by HB_P_MESSAGE. */
case HB_P_SEND :
wVar = * ( ( SHORT * ) &( pFunc->pCode )[ ulPos + 1 ] );
wVar = HB_PCODE_MKSHORT( &( pFunc->pCode[ ulPos + 1 ] ) );
/* Fall Through - don't add break !!! */
@@ -1732,6 +1734,7 @@ void hb_compStrongType( int iSize )
/* Numerics */
case HB_P_PUSHDOUBLE :
case HB_P_PUSHLONGLONG :
case HB_P_PUSHLONG :
case HB_P_PUSHINT :
case HB_P_PUSHBYTE :
@@ -1757,13 +1760,13 @@ void hb_compStrongType( int iSize )
else
{
if( pFunc->pCode[ ulPos ] == HB_P_PUSHSYMNEAR )
{
{
pSym = hb_compSymbolGetPos( pFunc->pCode[ ulPos + 1 ] );
}
}
else
{
pSym = hb_compSymbolGetPos( pFunc->pCode[ ulPos + 1 ] + pFunc->pCode[ ulPos + 2 ] * 256 );
}
{
pSym = hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ ulPos + 1 ] ) ) );
}
/*printf( "\nSymbol: %s\n", pSym->szName );*/
@@ -1843,7 +1846,7 @@ void hb_compStrongType( int iSize )
}
else
{
wVar = * ( ( SHORT * ) &( pFunc->pCode )[ ulPos + 1 ] );
wVar = HB_PCODE_MKSHORT( &( pFunc->pCode[ ulPos + 1 ] ) );
}
/* we are accesing variables within a codeblock */
@@ -1929,7 +1932,7 @@ void hb_compStrongType( int iSize )
case HB_P_PUSHSTATICREF :
case HB_P_PUSHSTATIC :
pTmp = hb_comp_functions.pFirst;
wVar = pFunc->pCode[ ulPos + 1 ] + pFunc->pCode[ ulPos + 2 ] * 256;
wVar = HB_PCODE_MKSHORT( &( pFunc->pCode[ ulPos + 1 ] ) );
while( pTmp->pNext && pTmp->pNext->iStaticsBase < wVar )
{
@@ -2009,7 +2012,7 @@ void hb_compStrongType( int iSize )
case HB_P_PUSHALIASEDFIELD :
case HB_P_PUSHFIELD :
if( ! pSym )
pSym = hb_compSymbolGetPos( pFunc->pCode[ ulPos + 1 ] + pFunc->pCode[ ulPos + 2 ] * 256 );
pSym = hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ ulPos + 1 ] ) ) );
if( pSym && pSym->szName && pFunc->pFields )
{
@@ -2023,7 +2026,7 @@ void hb_compStrongType( int iSize )
case HB_P_PUSHMEMVARREF :
case HB_P_PUSHMEMVAR :
if( ! pSym )
pSym = hb_compSymbolGetPos( pFunc->pCode[ ulPos + 1 ] + pFunc->pCode[ ulPos + 2 ] * 256 );
pSym = hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ ulPos + 1 ] ) ) );
if( pSym )
{
@@ -2130,7 +2133,7 @@ void hb_compStrongType( int iSize )
/* Arrays. */
case HB_P_ARRAYDIM :
wVar = pFunc->pCode[ ulPos + 1 ] + pFunc->pCode[ ulPos + 2 ] * 256;
wVar = HB_PCODE_MKSHORT( &( pFunc->pCode[ ulPos + 1 ] ) );
if( pFunc->iStackIndex < wVar )
/* TODO Error Message after finalizing all possible pcodes. */
@@ -2146,7 +2149,7 @@ void hb_compStrongType( int iSize )
break;
case HB_P_ARRAYGEN :
wVar = pFunc->pCode[ ulPos + 1 ] + pFunc->pCode[ ulPos + 2 ] * 256;
wVar = HB_PCODE_MKSHORT( &( pFunc->pCode[ ulPos + 1 ] ) );
/* TODO Error Message after finalizing all possible pcodes. */
if( pFunc->iStackIndex < wVar )
@@ -2340,7 +2343,7 @@ void hb_compStrongType( int iSize )
case HB_P_POPFIELD :
if( pFunc->pCode[ ulPos ] == HB_P_POPFIELD || pFunc->pCode[ ulPos ] == HB_P_POPALIASEDFIELD )
{
wVar = pFunc->pCode[ ulPos + 1 ] + pFunc->pCode[ ulPos + 2 ] * 256;
wVar = HB_PCODE_MKSHORT( &( pFunc->pCode[ ulPos + 1 ] ) );
pSym = hb_compSymbolGetPos( wVar );
}
@@ -2370,7 +2373,7 @@ void hb_compStrongType( int iSize )
pFunc->iStackIndex--;
if( pFunc->pCode[ ulPos ] == HB_P_POPMEMVAR )
wVar = pFunc->pCode[ ulPos + 1 ] + pFunc->pCode[ ulPos + 2 ] * 256;
wVar = HB_PCODE_MKSHORT( &( pFunc->pCode[ ulPos + 1 ] ) );
if( ! pSym )
pSym = hb_compSymbolGetPos( wVar );
@@ -2682,7 +2685,7 @@ void hb_compStrongType( int iSize )
if( pFunc->pCode[ ulPos ] == HB_P_POPLOCAL )
{
wVar = * ( ( SHORT * ) &( pFunc->pCode )[ ulPos + 1 ] );
wVar = HB_PCODE_MKSHORT( &( pFunc->pCode[ ulPos + 1 ] ) );
}
else
{
@@ -2872,7 +2875,7 @@ void hb_compStrongType( int iSize )
pFunc->iStackIndex--;
pTmp = hb_comp_functions.pFirst;
wVar = pFunc->pCode[ ulPos + 1 ] + pFunc->pCode[ ulPos + 2 ] * 256;
wVar = HB_PCODE_MKSHORT( &( pFunc->pCode[ ulPos + 1 ] ) );
while( pTmp->pNext && pTmp->pNext->iStaticsBase < wVar )
pTmp = pTmp->pNext;

View File

@@ -104,7 +104,7 @@ void hb_compPrintUsage( char * szSelf )
printf( "\nSyntax: %s <file[s][.prg]> [options]"
"\n", szSelf );
for( iLine = 0; iLine < ( sizeof( szOptions ) / sizeof( char * ) ); iLine++ )
for( iLine = 0; iLine < ( int ) ( sizeof( szOptions ) / sizeof( char * ) ); iLine++ )
printf( szOptions[ iLine ], OS_OPT_DELIMITER_LIST[ 0 ] );
}
@@ -130,7 +130,7 @@ void hb_compPrintModes( void )
printf( "\nCompatibility flags (lowercase/uppercase significant): -k[options]\n" );
for( iLine = 0; iLine < ( sizeof( szOptions ) / sizeof( char * ) ); iLine++ )
for( iLine = 0; iLine < ( int ) ( sizeof( szOptions ) / sizeof( char * ) ); iLine++ )
printf( szOptions[ iLine ] );
}

View File

@@ -60,9 +60,9 @@
#endif
/* Language Definitions Readability. */
#define SELF_CONTAINED_WORDS_ARE LEX_WORD static aSelfs[] =
#define LANGUAGE_KEY_WORDS_ARE LEX_WORD static aKeys[] =
#define LANGUAGE_WORDS_ARE LEX_WORD static aWords[] =
#define SELF_CONTAINED_WORDS_ARE static LEX_WORD aSelfs[] =
#define LANGUAGE_KEY_WORDS_ARE static LEX_WORD aKeys[] =
#define LANGUAGE_WORDS_ARE static LEX_WORD aWords[] =
#define LANGUAGE_RULES_ARE static int aiRules[][ MAX_MATCH + 2 ] =
#define ACCEPT_TOKEN_AND_DROP_DELIMITER_IF_ONE_OF_THESE(x) static char *szOmmit = x
#define ACCEPT_TOKEN_AND_RETURN_DELIMITERS static LEX_DELIMITER aDelimiters[] =

View File

@@ -114,9 +114,8 @@ NOTE: -C controls the speed/size ratio of generated scanner
%}
SpaceTab [ \t]+
Number ([0-9]+)|([0-9]*\.[0-9]+)
Number ([0-9]+)|([0-9]*\.[0-9]+)|(0x[0-9A-Fa-f]+)
InvalidNumber [0-9]+\.
HexNumber 0x[0-9A-F]+
Identifier (([a-zA-Z])|([_a-zA-Z][_a-zA-Z0-9]+))
MacroVar \&{Identifier}[\.]?
@@ -247,62 +246,28 @@ MacroTxt ({MacroVar}|{MacroEnd}|{MacroId})+
%}
{Number} {
char * ptr;
HB_LONG lNumber;
double dNumber;
int iDec, iWidth;
pMacro->FlexState = LOOKUP;
yylval_ptr->valDouble.dNumber = atof( yytext );
ptr = strchr( yytext, '.' );
if( ptr )
if( hb_compStrToNum( yytext, &lNumber, &dNumber, &iDec, &iWidth ) )
{
yylval_ptr->valDouble.bDec = strlen( ptr + 1 );
yylval_ptr->valDouble.bWidth = strlen( yytext ) - yylval_ptr->valDouble.bDec;
if( yylval_ptr->valDouble.bDec )
yylval_ptr->valDouble.bWidth--;
yylval_ptr->valDouble.szValue = yytext ;
yylval_ptr->valDouble.dNumber = dNumber;
yylval_ptr->valDouble.bDec = iDec;
yylval_ptr->valDouble.bWidth = iWidth;
yylval_ptr->valDouble.szValue = yytext;
return NUM_DOUBLE;
}
else
{
if( ( double )LONG_MIN <= yylval_ptr->valDouble.dNumber &&
yylval_ptr->valDouble.dNumber <= ( double )LONG_MAX )
{
yylval_ptr->valLong.lNumber = ( long ) yylval_ptr->valDouble.dNumber;
yylval_ptr->valLong.szValue = yytext;
return NUM_LONG;
}
else
{
yylval_ptr->valDouble.bWidth = strlen( yytext ) + 1;
yylval_ptr->valDouble.bDec = 0;
yylval_ptr->valDouble.szValue = yytext;
return NUM_DOUBLE;
}
yylval_ptr->valLong.lNumber = lNumber;
yylval_ptr->valLong.szValue = yytext;
return NUM_LONG;
}
}
{HexNumber} {
long lNumber = 0;
pMacro->FlexState = LOOKUP;
sscanf( yytext, "%lxI", &lNumber );
if( ( double )LONG_MIN <= lNumber && lNumber <= ( double )LONG_MAX )
{
yylval_ptr->valLong.lNumber = lNumber;
yylval_ptr->valLong.szValue = yytext;
return NUM_LONG;
}
else
{
yylval_ptr->valDouble.dNumber = lNumber;
yylval_ptr->valDouble.bWidth = HB_DEFAULT_WIDTH;
yylval_ptr->valDouble.bDec = 0;
yylval_ptr->valDouble.szValue = yytext;
return NUM_DOUBLE;
}
}
{MacroVar} {
HB_TRACE(HB_TR_DEBUG, ("{MacroVar}(%s)", yytext));
if( yytext[ yyleng-1 ] == '.' )

View File

@@ -87,7 +87,7 @@ static YYSTYPE *pYYLVAL;
static int hb_macro_SLX_CustomAction( int x, int aiHold[], int *ptr_iHold, char *sToken );
static int hb_macro_SLX_ElementToken( char* szToken, unsigned int iTokenLen );
long hb_macro_SLX_Hex2L( char* sHex );
static int hb_comp_SLX_Str2Num( char* szNum, HB_LONG * lVal, double * dVal, int * iDec, int * iWidth );
void * yy_bytes_buffer( char * pBuffer, int iBufSize );
@@ -311,58 +311,25 @@ static int hb_macro_SLX_ElementToken( char* szToken, unsigned int iTokenLen )
}
else
{
/* ConverNumber */
if( yytext[0] == '0' && yytext[1] == 'X' )
HB_LONG lNumber;
double dNumber;
int iDec, iWidth;
iRet = hb_comp_SLX_Str2Num( yytext, &lNumber, &dNumber, &iDec, &iWidth );
if ( iRet == NUM_DOUBLE )
{
long lNumber = hb_macro_SLX_Hex2L( yytext + 2 );
if( ( double ) LONG_MIN <= lNumber && lNumber <= ( double ) LONG_MAX )
{
pYYLVAL->valLong.lNumber = lNumber;
pYYLVAL->valLong.szValue = yytext;
iRet = NUM_LONG;
}
else
{
pYYLVAL->valDouble.dNumber = lNumber;
pYYLVAL->valDouble.bWidth = HB_DEFAULT_WIDTH;
pYYLVAL->valDouble.bDec = 0;
pYYLVAL->valDouble.szValue = yytext;
iRet = NUM_DOUBLE;
}
pYYLVAL->valDouble.dNumber = dNumber;
pYYLVAL->valDouble.bDec = iDec;
pYYLVAL->valDouble.bWidth = iWidth;
pYYLVAL->valDouble.szValue = yytext;
}
else
{
pYYLVAL->valDouble.dNumber = atof( yytext );
tmpPtr = strchr( yytext, '.' );
if( tmpPtr )
{
pYYLVAL->valDouble.bDec = strlen( tmpPtr + 1 );
pYYLVAL->valDouble.bWidth = yyleng - pYYLVAL->valDouble.bDec;
if( pYYLVAL->valDouble.bDec )
{
pYYLVAL->valDouble.bWidth--;
}
pYYLVAL->valDouble.szValue = yytext;
iRet = NUM_DOUBLE;
}
else
{
if( ( double )LONG_MIN <= pYYLVAL->valDouble.dNumber && pYYLVAL->valDouble.dNumber <= ( double )LONG_MAX )
{
pYYLVAL->valLong.lNumber = ( long ) pYYLVAL->valDouble.dNumber;
pYYLVAL->valLong.szValue = yytext;
iRet = NUM_LONG;
}
else
{
pYYLVAL->valDouble.bWidth = yyleng + 1;
pYYLVAL->valDouble.bDec = 0;
pYYLVAL->valDouble.szValue = yytext;
iRet = NUM_DOUBLE;
}
}
pYYLVAL->valLong.lNumber = lNumber;
pYYLVAL->valLong.szValue = yytext;
}
}
@@ -370,40 +337,12 @@ static int hb_macro_SLX_ElementToken( char* szToken, unsigned int iTokenLen )
return iRet + DONT_REDUCE;
}
long hb_macro_SLX_Hex2L( char* sHex )
static int hb_comp_SLX_Str2Num( char* szNum, HB_LONG * plVal, double * pdVal, int * piDec, int * piWidth )
{
int i, iExp = 0, iLen = strlen( sHex ) - 1;
long lVal, lSum = 0;
char cChar;
while( iLen >= 0 )
{
cChar = sHex[ iLen-- ];
if( cChar > 64 && cChar < 91 )
{
lVal = cChar - 55;
}
else
{
lVal = cChar - 48;
}
if( lVal)
{
i = 0;
while( i++ < iExp )
{
lVal *= 16;
}
lSum += lVal;
}
iExp++;
}
return lSum;
BOOL fDbl;
fDbl = hb_compStrToNum( szNum, plVal, pdVal, piDec, piWidth );
return fDbl ? NUM_DOUBLE : NUM_LONG;
}
int hb_macro_SLX_CustomAction( int x, int aiHold[], int *ptr_iHold, char *sToken )

View File

@@ -124,9 +124,9 @@ extern void yyerror( char * ); /* parsing error management function */
%union /* special structure used by lex and yacc to share info */
{
char * string; /* to hold a string returned by lex */
int iNumber; /* to hold a temporary integer number */
long lNumber; /* to hold a temporary long number */
char * string; /* to hold a string returned by lex */
int iNumber; /* to hold a temporary integer number */
HB_LONG lNumber; /* to hold a temporary long number */
struct
{
int iNumber; /* to hold a number returned by lex */
@@ -134,15 +134,15 @@ extern void yyerror( char * ); /* parsing error management function */
} valInteger;
struct
{
long lNumber; /* to hold a long number returned by lex */
char * szValue;
HB_LONG lNumber; /* to hold a long number returned by lex */
char * szValue;
} valLong;
struct
{
double dNumber; /* to hold a double number returned by lex */
double dNumber; /* to hold a double number returned by lex */
/* NOTE: Intentionally using "unsigned char" instead of "BYTE" */
unsigned char bWidth; /* to hold the width of the value */
unsigned char bDec; /* to hold the number of decimal points in the value */
unsigned char bDec; /* to hold the number of decimal points in the value */
char * szValue;
} valDouble;
HB_EXPR_PTR asExpr;
@@ -156,6 +156,12 @@ extern void yyerror( char * ); /* parsing error management function */
int yylex( YYSTYPE *, HB_MACRO_PTR );
%}
%{
#ifdef __WATCOMC__
/* disable warnings for unreachable code */
#pragma warning 13 9
#endif
%}
%token IDENTIFIER NIL NUM_DOUBLE INASSIGN NUM_LONG
%token IIF IF LITERAL TRUEVALUE FALSEVALUE
@@ -791,6 +797,12 @@ IfInline : IIF '(' Expression ',' EmptyExpression ','
%%
#ifdef __WATCOMC__
/* enable warnings for unreachable code */
#pragma warning 13 1
#endif
/*
** ------------------------------------------------------------------------ **
*/

View File

@@ -392,6 +392,46 @@ void hb_pp_Init( void )
hb_pp_nCondCompile = 0;
{
char sOS[64];
char sVer[64];
char *pSrc, *pDst;
char * szPlatform = hb_verPlatform();
int n;
strcpy( sOS, "__PLATFORM__" );
pSrc = szPlatform;
n = strlen( sOS );
pDst = sOS;
while ( *pSrc && *pSrc != ' ' && n < ( int ) sizeof( sOS ) - 1 )
{
if ( *pSrc == '_' || ( *pSrc >= 'A' && *pSrc <= 'Z' )
|| ( *pSrc >= 'a' && *pSrc <= 'z' )
|| ( *pSrc >= '0' && *pSrc <= '9' ) )
{
pDst[n++] = *pSrc;
}
pSrc++;
}
pDst[ n ] = 0;
n = 0;
pDst = sVer;
pDst[n++] = '"';
if ( *pSrc == ' ' )
{
while ( *(++pSrc) && n < ( int ) sizeof( sVer ) - 2 )
pDst[n++] = *pSrc;
}
pDst[n++] = '"';
pDst[ n ] = 0;
hb_xfree( szPlatform );
hb_pp_AddDefine( sOS, sVer );
}
{
char szResult[ 6 ];
USHORT usHarbour = ( 256 * HB_VER_MAJOR ) + HB_VER_MINOR;
@@ -422,6 +462,22 @@ void hb_pp_Init( void )
hb_pp_AddDefine( "__TIME__", szResult );
}
#if defined( HB_ARCH_16BIT )
hb_pp_AddDefine( "__ARCH16BIT__", NULL );
#elif defined( HB_ARCH_32BIT )
hb_pp_AddDefine( "__ARCH32BIT__", NULL );
#elif defined( HB_ARCH_64BIT )
hb_pp_AddDefine( "__ARCH64BIT__", NULL );
#endif
#if defined( HB_LITTLE_ENDIAN )
hb_pp_AddDefine( "__LITTLE_ENDIAN__", NULL );
#elif defined( HB_BIG_ENDIAN )
hb_pp_AddDefine( "__BIG_ENDIAN__", NULL );
#elif defined( HB_PDP_ENDIAN )
hb_pp_AddDefine( "__PDP_ENDIAN__", NULL );
#endif
#ifdef HARBOUR_START_PROCEDURE
hb_pp_AddDefine( "__HB_MAIN__", HARBOUR_START_PROCEDURE );
#endif
@@ -493,10 +549,10 @@ int hb_pp_ParseDirective( char * sLine )
hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_TOO_MANY_INCLUDES, sLine, NULL );
else
{
#if defined(__CYGWIN__) || defined(__IBMCPP__)
hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_CANNOT_OPEN, sLine, "" );
#if defined(__CYGWIN__) || defined(__IBMCPP__) || defined(__LCC__)
hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_CANNOT_OPEN, sLine, "" );
#else
hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_CANNOT_OPEN, sLine, sys_errlist[ errno ] );
hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_CANNOT_OPEN, sLine, strerror( errno ) );
#endif
}
}
@@ -2917,7 +2973,7 @@ static BOOL ScanMacro( char * expreal, int lenitem, int * pNewLen )
static int ReplacePattern( char patttype, char * expreal, int lenreal, char * ptro, int lenres )
{
int rmlen = lenreal, ifou, lenitem, i;
int rmlen = lenreal, ifou, lenitem, i = 0;
char sQuotes[ 4 ] = "\"\",";
HB_TRACE(HB_TR_DEBUG, ("ReplacePattern(%c, %s, %d, %s, %p)", patttype, expreal, lenreal, ptro, lenres));
@@ -4197,7 +4253,7 @@ static BOOL OpenInclude( char * szFileName, HB_PATHNAMES * pSearch, PHB_FNAME pM
PHB_FNAME pFileName;
PFILE pFile;
HB_TRACE(HB_TR_DEBUG, ("OpenInclude(%s, %p, %p, %p, %d)", szFileName, pSearch, pMainFileName, fptr, (int) bStandardOnly));
HB_TRACE(HB_TR_DEBUG, ("OpenInclude(%s, %p, %p, %d, %s)", szFileName, pSearch, pMainFileName, (int) bStandardOnly, szInclude));
errno = 0;
if( bStandardOnly )

View File

@@ -4103,4 +4103,4 @@ ERRCODE hb_rddGetTempAlias( char * szAliasTmp )
{
return SUCCESS;
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,236 +0,0 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* DBFCDX RDD
*
* Copyright 1999 Bruno Cantero <bruno@issnet.net>
* Copyright 2000-2002 Horacio Roldan <harbour_ar@yahoo.com.ar> (portions)
* 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.
*
*/
#define CDX_INTERNAL_SPACE 500
#define CDX_EXTERNAL_SPACE 488
#define SORT_CHUNK_LIMIT 16384
#define SORT_ACTIVE_LIST 0
#define SORT_END_OF_KEY 1
#define SORT_END_OF_WORD 2
#define SORT_STACK_OF_CHAR 3
#define SORT_NOT_KEY 0x10
#if (__BORLANDC__ > 1040) /* Use this only above Borland C++ 3.1 */
#pragma option -a1 /* byte alignment */
#elif defined(_MSC_VER)
#pragma pack(push, 1)
#elif defined(__GNUC__)
#pragma pack(1)
#elif defined(__WATCOMC__)
#pragma pack(push, 1);
#elif defined(__cplusplus)
#pragma pack(1)
#endif
typedef struct
{
BYTE FreeSpace[2];
BYTE RecNumMask[4];
BYTE DupCntMask;
BYTE TrlCntMask;
BYTE RecNumBits;
BYTE DupCntBits;
BYTE TrlCntBits;
BYTE ShortBytes;
BYTE ExtData[ CDX_EXTERNAL_SPACE ];
} CDXEXTERNAL;
typedef struct
{
BYTE IntData[ CDX_INTERNAL_SPACE ];
} CDXINTERNAL;
typedef struct _CDXDATA
{
USHORT Node_Atr;
USHORT Entry_Ct;
LONG Left_Ptr;
LONG Rght_Ptr;
union
{
CDXEXTERNAL External;
CDXINTERNAL Internal;
} cdxu;
} CDXDATA;
typedef CDXDATA * LPCDXDATA;
typedef struct _SORTSWAPPAGE
{
char mark[2];
USHORT pageNum;
ULONG pageLen;
ULONG keyCount;
USHORT nCurPos;
USHORT nBufLeft;
ULONG nFileOffset;
ULONG nBytesLeft;
ULONG keysLeft;
ULONG tmpRecNo; /* to speed up access */
BYTE tmpKeyLen;
BYTE * tmpKeyVal;
BYTE page[ 512 ];
} SORTSWAPPAGE;
typedef SORTSWAPPAGE * LPSORTSWAPPAGE;
typedef struct _SORTSWAPITEM
{
ULONG recno;
BYTE keyLen;
char key[ 1 ];
} SORTSWAPITEM;
typedef SORTSWAPITEM * LPSORTSWAPITEM;
#if (__BORLANDC__ > 1040) /* Use this only above Borland C++ 3.1 */
#pragma option -a /* default alignment */
#elif defined(_MSC_VER)
#pragma pack(pop)
#elif defined(__GNUC__)
#pragma pack()
#elif defined(__WATCOMC__)
#pragma pack(pop);
#elif defined(__cplusplus)
#pragma pack()
#endif
/*SORT stuff*/
typedef struct
{
BYTE Character;
BYTE NUse;
USHORT WordArray;
USHORT Fill02;
USHORT LevelLink;
} SORT_A;
typedef struct
{
BYTE Fill03[ 4 ];
BYTE ChrStack[ 4 ];
} SORT_B;
typedef struct
{
LONG Fill04;
LONG ChrFill;
} SORT_C;
#define SORT_GET_NUSE( w ) (( w ) & 0x07 )
#define SORT_SET_NUSE( w, n ) (( w ) = ( ( w ) & 0xF8 ) | ( n ) )
#define SORT_GET_STACK_LEN( w ) (( w ) >> 6 )
#define SORT_SET_STACK_LEN( w, n ) (( w ) = ( ( w ) & 0x3F ) | ( ( n ) << 6 ) )
typedef struct
{
union
{
SORT_A A;
SORT_B B;
SORT_C C;
} sortu;
} SORTDATA;
typedef SORTDATA * LPSORTDATA;
typedef struct _CDXKEYINFO
{
BYTE * Value;
USHORT length;
USHORT realLength;
BOOL fString;
ULONG Tag;
ULONG Xtra;
struct _CDXKEYINFO * pNext;
} CDXKEYINFO;
typedef CDXKEYINFO * LPCDXKEYINFO;
typedef struct
{
LONG WordCount;
LONG RootLink;
LONG LevelPtr;
LONG PriorPtr;
LONG KeyTot;
LONG KeyCnt;
LONG LastTag;
LONG * ChunkList;
BYTE * SortBuffer;
USHORT SortChunk;
USHORT NodeLimit;
USHORT NodeMask;
USHORT NodeShift;
USHORT ChunkSize;
USHORT ChunkLimit;
USHORT ChunkCur;
USHORT NodeCur;
USHORT KeySize;
USHORT WCur;
BOOL Unique;
BOOL Ascend;
BOOL Closing;
USHORT nSwapPages;
LPSORTSWAPPAGE pSwapPage;
FHANDLE hTempFile;
char * szTempFileName;
LONG TotalWordCount;
BYTE WPch[ 256 ];
SORTDATA * WAdr;
struct _CDXTAG * CurTag;
LPCDXDATA NodeList[ 32 ];
LPCDXKEYINFO KeyWork;
LPCDXKEYINFO LastKey;
} SORTINFO;
typedef SORTINFO * LPSORTINFO;

File diff suppressed because it is too large Load Diff

View File

@@ -298,39 +298,28 @@ static void hb_IncString( NTXAREAP pArea, char* s, int slen )
static char * numToStr( PHB_ITEM pItem, char* szBuffer, USHORT length, USHORT dec )
{
if( HB_IS_DOUBLE( pItem ) )
char *ptr = szBuffer;
hb_itemStrBuf( szBuffer, pItem, length, dec );
while( *ptr == ' ' )
{
if( dec == 0 )
*ptr++ = '0';
}
if( *ptr == '-' )
{
*ptr = '0';
szBuffer[0] = ',';
for( ptr = &szBuffer[1]; *ptr; ptr++ )
{
if( length > 9 )
sprintf( szBuffer, "%0*.0f", length,
hb_numRound( hb_itemGetND( pItem ), 0 ) );
else
sprintf( szBuffer, "%0*li", length,
( LONG ) hb_numRound( hb_itemGetND( pItem ), 0 ) );
}
else
sprintf( szBuffer, "%0*.*f", length,
dec, hb_numRound( hb_itemGetND( pItem ),
dec ) );
}
else
{
if( dec == 0 )
sprintf( szBuffer, "%0*li", length, hb_itemGetNL( pItem ) );
else
sprintf( szBuffer, "%0*.*f", length,
dec, hb_itemGetND( pItem ) );
}
szBuffer[ length ] = 0;
if( hb_itemGetND( pItem ) < 0 )
{
char *ptr = szBuffer;
*ptr++ = ',';
for( ;*ptr;ptr++ )
if( *ptr >= '0' && *ptr <= '9' )
{
*ptr = (char) ( 92 - (int)*ptr );
}
}
}
return szBuffer;
}
@@ -856,7 +845,7 @@ static void hb_ntxGetCurrentKey( LPTAGINFO pTag, LPKEYINFO pKey )
static BOOL hb_ntxTagGoToNextKey( LPTAGINFO pTag, BOOL lContinue )
{
BOOL lCurrrentKey = FALSE;
LPPAGEINFO pPage, pChildPage;
LPPAGEINFO pPage = NULL, pChildPage;
LPNTXITEM p;
/* pTag->blockNext = 0; pTag->keyNext = 0; */
@@ -958,7 +947,7 @@ static BOOL hb_ntxTagGoToNextKey( LPTAGINFO pTag, BOOL lContinue )
static BOOL hb_ntxTagGoToPrevKey( LPTAGINFO pTag, BOOL lContinue )
{
BOOL lCurrrentKey = FALSE;
LPPAGEINFO pPage, pChildPage;
LPPAGEINFO pPage = NULL, pChildPage;
/* pTag->blockPrev = 0; pTag->keyPrev = 0; */
if( pTag->CurKeyInfo->Tag && ((ULONG)pTag->CurKeyInfo->Xtra) == pTag->Owner->Owner->ulRecNo )
@@ -1356,7 +1345,7 @@ static void hb_ntxPageFree( LPTAGINFO pTag, BOOL lFull )
static LPPAGEINFO hb_ntxPageNew( LPTAGINFO pTag )
{
LPPAGEINFO pPage;
LPPAGEINFO pPage = NULL;
if( pTag->Owner->NextAvail > 0 )
{
@@ -2148,7 +2137,7 @@ static BOOL hb_ntxGetSortedKey( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo, LPSORTI
{
char *key1, *key2;
short int nPage, iPage;
int result;
int result = 0;
BOOL fDescend = !pTag->AscendKey;
USHORT itemLength = sizeof( ULONG ) + pTag->KeyLength;
LPSORTITEM pKey = *ppKey;
@@ -2278,7 +2267,7 @@ static void hb_ntxBufferSave( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo )
/* printf( "\nhb_ntxBufferSave - 1 ( maxKeys=%d )",maxKeys ); */
if( pSortInfo->nSwappages > 1 )
{
BOOL lKeys;
BOOL lKeys = FALSE;
LPSORTITEM pKeyRoot = (LPSORTITEM) hb_xgrab( pSortInfo->itemLength );
USHORT pageItemLength = sizeof( ULONG ) + pTag->KeyLength;
USHORT maxKeysSwapPage = 512/pageItemLength, nRead;
@@ -2338,7 +2327,7 @@ static void hb_ntxBufferSave( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo )
{
while( pKey )
{
for( i = 0; ( i < maxKeys || numKey == pSortInfo->ulKeyCount-1 ) && pKey > 0; i++, numKey++, pKey = pKey->pNext )
for( i = 0; ( i < maxKeys || numKey == pSortInfo->ulKeyCount-1 ) && pKey != 0; i++, numKey++, pKey = pKey->pNext )
{
/* printf( "\nhb_ntxBufferSave - 2 ( i=%d maxKeys=%d )",i,maxKeys ); */
item = (NTXITEM *)( buffer + itemlist->item_offset[i] );
@@ -2438,7 +2427,7 @@ static BOOL hb_ntxReadBuf( NTXAREAP pArea, BYTE* readBuffer, USHORT* numRecinBuf
static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex )
{
ULONG ulRecNo, ulRecCount, ulKeyNo = 0, lStep = 0, ulRecMax;
ULONG ulRecNo = 0, ulRecCount, ulKeyNo = 0, lStep = 0, ulRecMax = 0;
USHORT uiCurLen;
char szBuffer[ HB_MAX_DOUBLE_LENGTH + 1 ];
char * pszTempName = NULL;
@@ -2450,8 +2439,8 @@ static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex )
NTXSORTINFO sortInfo;
BYTE* readBuffer;
USHORT numRecinBuf = 0, nParts = 0;
BYTE * pRecordTmp;
BOOL fValidBuffer;
BYTE * pRecordTmp = NULL;
BOOL fValidBuffer = FALSE;
PHB_CODEPAGE cdpTmp = hb_cdp_page;
ulRecCount = pArea->ulRecCount;

View File

@@ -44,6 +44,7 @@ C_SOURCES=\
gtapiu.c \
gx.c \
hardcr.c \
hbffind.c \
hbrandom.c \
idle.c \
inkey.c \
@@ -184,4 +185,3 @@ DIRS=$(HB_GT_LIBS)
include $(TOP)$(ROOT)config/lib.cf
include $(TOP)$(ROOT)config/dir.cf

View File

@@ -71,19 +71,31 @@ HB_FUNC( ABS )
if( iNumber >= 0 )
hb_retnilen( iNumber, iWidth );
#if -HB_INT_MAX > HB_INT_MIN
else if ( iNumber < -HB_INT_MAX )
#if HB_LONG_MAX > HB_INT_MAX
hb_retnint( - ( HB_LONG ) iNumber );
#else
hb_retndlen( - ( double ) iNumber, 0, iDec );
#endif
#endif
else
hb_retni( -iNumber );
}
else if( HB_IS_LONG( pNumber ) )
{
long lNumber = hb_itemGetNL( pNumber );
HB_LONG lNumber = hb_itemGetNInt( pNumber );
if( lNumber >= 0 )
hb_retnllen( lNumber, iWidth );
hb_retnintlen( lNumber, iWidth );
#if -HB_LONG_MAX > HB_LONG_MIN
else if ( lNumber < -HB_LONG_MAX )
hb_retndlen( - ( double ) lNumber, 0, iDec );
#endif
else
hb_retnl( -lNumber );
hb_retnint( -lNumber );
}
else if( HB_IS_DOUBLE( pNumber ) )
else
{
double dNumber = hb_itemGetND( pNumber );

View File

@@ -83,7 +83,7 @@ HB_FUNC( AT )
{
ULONG ulTextLength = hb_itemGetCLen( pText );
ULONG ulStart = ISNUM( 3 ) ? hb_parnl( 3 ) : 1;
ULONG ulEnd = ISNUM( 4 ) ? hb_parnl( 4 ) : ulTextLength;
ULONG ulEnd = ISNUM( 4 ) ? ( ULONG ) hb_parnl( 4 ) : ulTextLength;
ULONG ulPos;
if ( ulStart > ulTextLength || ulEnd < ulStart ) hb_retnl( 0 );

View File

@@ -76,10 +76,10 @@ HB_FUNC( CMONTH )
if( pDate )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
hb_dateDecode( hb_itemGetDL( pDate ), &lYear, &lMonth, &lDay );
hb_retc( hb_dateCMonth( lMonth ) );
hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );
hb_retc( hb_dateCMonth( iMonth ) );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 1116, NULL, "CMONTH", 1, hb_paramError( 1 ) );
@@ -95,10 +95,10 @@ HB_FUNC( CDOW )
if( lDate )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
hb_dateDecode( lDate, &lYear, &lMonth, &lDay );
hb_retc( hb_dateCDOW( hb_dateDOW( lYear, lMonth, lDay ) ) );
hb_dateDecode( lDate, &iYear, &iMonth, &iDay );
hb_retc( hb_dateCDOW( hb_dateDOW( iYear, iMonth, iDay ) ) );
}
else
hb_retc( NULL );

View File

@@ -78,43 +78,49 @@
#include "hbapi.h"
#include "hbdate.h"
long HB_EXPORT hb_dateEncode( long lYear, long lMonth, long lDay )
#ifdef HB_C52_STRICT
#define HB_DATE_YEAR_LIMIT 2999
#else
#define HB_DATE_YEAR_LIMIT 9999
#endif
LONG HB_EXPORT hb_dateEncode( int iYear, int iMonth, int iDay )
{
HB_TRACE(HB_TR_DEBUG, ("hb_dateEncode(%ld, %ld, %ld)", lYear, lMonth, lDay));
HB_TRACE(HB_TR_DEBUG, ("hb_dateEncode(%d, %d, %d)", iYear, iMonth, iDay));
/* Perform date validation */
if( lYear >= 1 && lYear <= 2999 &&
lMonth >= 1 && lMonth <= 12 &&
lDay >= 1 )
if( iYear >= 1 && iYear <= HB_DATE_YEAR_LIMIT &&
iMonth >= 1 && iMonth <= 12 &&
iDay >= 1 )
{
/* Month, year, and lower day limits are simple,
but upper day limit is dependent upon month and leap year */
USHORT auiDayLimit[ 12 ] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int auiDayLimit[ 12 ] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
if( ( ( lYear % 4 == 0 && lYear % 100 != 0 ) || lYear % 400 == 0 ) )
if( ( ( iYear % 4 == 0 && iYear % 100 != 0 ) || iYear % 400 == 0 ) )
auiDayLimit[ 1 ] = 29;
if( lDay <= ( long ) auiDayLimit[ ( int ) lMonth - 1 ] )
if( iDay <= auiDayLimit[ iMonth - 1 ] )
{
long lFactor = ( lMonth < 3 ) ? -1 : 0;
int iFactor = ( iMonth < 3 ) ? -1 : 0;
return ( 1461 * ( lFactor + 4800 + lYear ) / 4 ) +
( ( lMonth - 2 - ( lFactor * 12 ) ) * 367 ) / 12 -
( 3 * ( ( lFactor + 4900 + lYear ) / 100 ) / 4 ) +
lDay - 32075;
return ( ( LONG )( iFactor + 4800 + iYear ) * 1461 / 4 ) +
( ( LONG )( iMonth - 2 - ( iFactor * 12 ) ) * 367 ) / 12 -
( ( LONG )( ( iFactor + 4900 + iYear ) / 100 ) * 3 / 4 ) +
( LONG ) iDay - 32075;
}
}
return 0;
}
void HB_EXPORT hb_dateDecode( long lJulian, long * plYear, long * plMonth, long * plDay )
void HB_EXPORT hb_dateDecode( LONG lJulian, int *piYear, int *piMonth, int *piDay )
{
HB_TRACE(HB_TR_DEBUG, ("hb_dateDecode(%ld, %p, %p, %p)", lJulian, plYear, plMonth, plDay));
HB_TRACE(HB_TR_DEBUG, ("hb_dateDecode(%ld, %p, %p, %p)", lJulian, piYear, piMonth, piDay));
if( lJulian > 0 )
{
long U, V, W, X;
LONG U, V, W, X;
lJulian += 68569;
W = ( lJulian * 4 ) / 146097;
@@ -124,94 +130,92 @@ void HB_EXPORT hb_dateDecode( long lJulian, long * plYear, long * plMonth, long
V = 80 * lJulian / 2447;
U = V / 11;
*plYear = X + U + ( W - 49 ) * 100;
*plMonth = V + 2 - ( U * 12 );
*plDay = lJulian - ( 2447 * V / 80 );
*piYear = (int) ( X + U + ( W - 49 ) * 100 );
*piMonth = (int) ( V + 2 - ( U * 12 ) );
*piDay = (int) ( lJulian - ( 2447 * V / 80 ) );
}
else
{
*plYear =
*plMonth =
*plDay = 0;
*piYear =
*piMonth =
*piDay = 0;
}
}
void HB_EXPORT hb_dateStrPut( char * szDate, long lYear, long lMonth, long lDay )
void HB_EXPORT hb_dateStrPut( char * szDate, int iYear, int iMonth, int iDay )
{
HB_TRACE(HB_TR_DEBUG, ("hb_dateStrPut(%p, %ld, %ld, %ld)", szDate, lYear, lMonth, lDay));
HB_TRACE(HB_TR_DEBUG, ("hb_dateStrPut(%p, %d, %d, %d)", szDate, iYear, iMonth, iDay));
if( lYear >= 0 && lMonth && lDay )
if( iYear >= 0 && iMonth && iDay )
{
szDate[ 0 ] = ( ( lYear % 10000 ) / 1000 ) + '0';
szDate[ 1 ] = ( ( lYear % 1000 ) / 100 ) + '0';
szDate[ 2 ] = ( ( lYear % 100 ) / 10 ) + '0';
szDate[ 3 ] = ( lYear % 10 ) + '0';
szDate[ 0 ] = ( ( iYear % 10000 ) / 1000 ) + '0';
szDate[ 1 ] = ( ( iYear % 1000 ) / 100 ) + '0';
szDate[ 2 ] = ( ( iYear % 100 ) / 10 ) + '0';
szDate[ 3 ] = ( iYear % 10 ) + '0';
szDate[ 4 ] = ( lMonth / 10 ) + '0';
szDate[ 5 ] = ( lMonth % 10 ) + '0';
szDate[ 4 ] = ( iMonth / 10 ) + '0';
szDate[ 5 ] = ( iMonth % 10 ) + '0';
szDate[ 6 ] = ( lDay / 10 ) + '0';
szDate[ 7 ] = ( lDay % 10 ) + '0';
szDate[ 6 ] = ( iDay / 10 ) + '0';
szDate[ 7 ] = ( iDay % 10 ) + '0';
}
else if ( lYear || lMonth || lDay )
else if ( iYear || iMonth || iDay )
memset( szDate, '0', 8 );
else
memset( szDate, ' ', 8 );
}
void hb_dateStrGet( const char * szDate, long * plYear, long * plMonth, long * plDay )
void HB_EXPORT hb_dateStrGet( const char * szDate, int * piYear, int * piMonth, int * piDay )
{
HB_TRACE(HB_TR_DEBUG, ("hb_dateStrGet(%s, %p, %p, %p)", szDate, plYear, plMonth, plDay));
HB_TRACE(HB_TR_DEBUG, ("hb_dateStrGet(%s, %p, %p, %p)", szDate, piYear, piMonth, piDay));
if( szDate && szDate[ 8 ] == '\0' )
{
/* Date string has correct length, so attempt to convert */
*plYear = ( ( USHORT ) ( szDate[ 0 ] - '0' ) * 1000 ) +
*piYear = ( ( USHORT ) ( szDate[ 0 ] - '0' ) * 1000 ) +
( ( USHORT ) ( szDate[ 1 ] - '0' ) * 100 ) +
( ( USHORT ) ( szDate[ 2 ] - '0' ) * 10 ) +
( USHORT ) ( szDate[ 3 ] - '0' );
*plMonth = ( ( szDate[ 4 ] - '0' ) * 10 ) + ( szDate[ 5 ] - '0' );
*plDay = ( ( szDate[ 6 ] - '0' ) * 10 ) + ( szDate[ 7 ] - '0' );
*piMonth = ( ( szDate[ 4 ] - '0' ) * 10 ) + ( szDate[ 5 ] - '0' );
*piDay = ( ( szDate[ 6 ] - '0' ) * 10 ) + ( szDate[ 7 ] - '0' );
}
else
{
/* Date string missing or bad length, so force an empty date */
*plYear =
*plMonth =
*plDay = 0;
*piYear =
*piMonth =
*piDay = 0;
}
}
/* This function always closes the date with a zero byte, so it needs a
9 character long buffer. */
char * hb_dateDecStr( char * szDate, long lJulian )
char HB_EXPORT * hb_dateDecStr( char * szDate, LONG lJulian )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
HB_TRACE(HB_TR_DEBUG, ("hb_dateDecStr(%p, %ld)", szDate, lJulian));
hb_dateDecode( lJulian, &lYear, &lMonth, &lDay );
hb_dateStrPut( szDate, lYear, lMonth, lDay );
hb_dateDecode( lJulian, &iYear, &iMonth, &iDay );
hb_dateStrPut( szDate, iYear, iMonth, iDay );
szDate[ 8 ] = '\0';
return szDate;
}
long hb_dateEncStr( char * szDate )
LONG HB_EXPORT hb_dateEncStr( char * szDate )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
HB_TRACE(HB_TR_DEBUG, ("hb_dateEncStr(%s)", szDate));
hb_dateStrGet( szDate, &lYear, &lMonth, &lDay );
hb_dateStrGet( szDate, &iYear, &iMonth, &iDay );
return hb_dateEncode( lYear, lMonth, lDay );
return hb_dateEncode( iYear, iMonth, iDay );
}
/* NOTE: szFormattedDate must be an at least 11 chars wide buffer */
char * hb_dateFormat( const char * szDate, char * szFormattedDate, const char * szDateFormat )
char HB_EXPORT * hb_dateFormat( const char * szDate, char * szFormattedDate, const char * szDateFormat )
{
/*
* NOTE: szFormattedDate must point to a buffer of at least 11 bytes.
@@ -383,32 +387,32 @@ char * hb_dateFormat( const char * szDate, char * szFormattedDate, const char *
return szFormattedDate;
}
long hb_dateDOW( long lYear, long lMonth, long lDay )
int HB_EXPORT hb_dateDOW( int iYear, int iMonth, int iDay )
{
HB_TRACE(HB_TR_DEBUG, ("hb_dateDOW(%ld, %ld, %ld)", lYear, lMonth, lDay));
HB_TRACE(HB_TR_DEBUG, ("hb_dateDOW(%d, %d, %d)", iYear, iMonth, iDay));
if( lMonth < 3 )
if( iMonth < 3 )
{
lMonth += 13;
lYear--;
iMonth += 13;
iYear--;
}
else
lMonth++;
iMonth++;
return ( lDay + 26 * lMonth / 10 +
lYear + lYear / 4 - lYear / 100 + lYear / 400 + 6 ) % 7 + 1;
return ( iDay + 26 * iMonth / 10 +
iYear + iYear / 4 - iYear / 100 + iYear / 400 + 6 ) % 7 + 1;
}
void hb_dateToday( long * plYear, long * plMonth, long * plDay )
void HB_EXPORT hb_dateToday( int * piYear, int * piMonth, int * piDay )
{
#if defined(HB_OS_WIN_32)
{
SYSTEMTIME st;
GetLocalTime( &st );
*plYear = st.wYear;
*plMonth = st.wMonth;
*plDay = st.wDay;
*piYear = st.wYear;
*piMonth = st.wMonth;
*piDay = st.wDay;
}
#else
{
@@ -418,16 +422,16 @@ void hb_dateToday( long * plYear, long * plMonth, long * plDay )
time( &t );
oTime = localtime( &t );
*plYear = oTime->tm_year + 1900;
*plMonth = oTime->tm_mon + 1;
*plDay = oTime->tm_mday;
*piYear = oTime->tm_year + 1900;
*piMonth = oTime->tm_mon + 1;
*piDay = oTime->tm_mday;
}
#endif
}
/* NOTE: The passed buffer must be at least 9 chars long */
void hb_dateTimeStr( char * pszTime )
void HB_EXPORT hb_dateTimeStr( char * pszTime )
{
#if defined(HB_OS_WIN_32)
{

View File

@@ -220,11 +220,11 @@ HB_FUNC( YEAR )
if( pDate )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
hb_dateDecode( hb_itemGetDL( pDate ), &lYear, &lMonth, &lDay );
hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );
hb_retnllen( lYear, 5 );
hb_retnllen( iYear, 5 );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 1112, NULL, "YEAR", 1, hb_paramError( 1 ) );
@@ -236,11 +236,11 @@ HB_FUNC( MONTH )
if( pDate )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
hb_dateDecode( hb_itemGetDL( pDate ), &lYear, &lMonth, &lDay );
hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );
hb_retnllen( lMonth, 3 );
hb_retnilen( iMonth, 3 );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 1113, NULL, "MONTH", 1, hb_paramError( 1 ) );
@@ -252,11 +252,11 @@ HB_FUNC( DAY )
if( pDate )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
hb_dateDecode( hb_itemGetDL( pDate ), &lYear, &lMonth, &lDay );
hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );
hb_retnllen( lDay, 3 );
hb_retnilen( iDay, 3 );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 1114, NULL, "DAY", 1, hb_paramError( 1 ) );
@@ -271,9 +271,9 @@ HB_FUNC( TIME )
HB_FUNC( DATE )
{
long lYear, lMonth, lDay;
hb_dateToday( &lYear, &lMonth, &lDay );
hb_retd( lYear, lMonth, lDay );
int iYear, iMonth, iDay;
hb_dateToday( &iYear, &iMonth, &iDay );
hb_retd( iYear, iMonth, iDay );
}
HB_FUNC( DOW )
@@ -286,14 +286,14 @@ HB_FUNC( DOW )
if( lDate )
{
long lYear, lMonth, lDay;
int iYear, iMonth, iDay;
hb_dateDecode( lDate, &lYear, &lMonth, &lDay );
hb_dateDecode( lDate, &iYear, &iMonth, &iDay );
hb_retnllen( hb_dateDOW( lYear, lMonth, lDay ), 3 );
hb_retnilen( hb_dateDOW( iYear, iMonth, iDay ), 3 );
}
else
hb_retnllen( 0, 3 );
hb_retnilen( 0, 3 );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 1115, NULL, "DOW", 1, hb_paramError( 1 ) );

View File

@@ -62,7 +62,7 @@ HB_FUNC( STOD )
#ifdef HB_FAST_STOD
hb_retds( hb_parc( 1 ) );
#else
hb_retds( ( ISCHAR( 1 ) && hb_parclen( 1 ) == 8 ) ? hb_parc( 1 ) : " " );
hb_retds( hb_parclen( 1 ) == 8 ? hb_parc( 1 ) : " " );
#endif
}

View File

@@ -73,7 +73,7 @@ HB_FUNC( EMPTY )
break;
case HB_IT_LONG:
hb_retl( hb_itemGetNL( pItem ) == 0 );
hb_retl( hb_itemGetNInt( pItem ) == 0 );
break;
case HB_IT_DOUBLE:

View File

@@ -772,6 +772,10 @@ USHORT hb_errRT_BASE( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, ch
hb_itemArrayPut( pArray, 1, pArg );
}
}
else if ( ulArgCount == 0 )
{
pArray = NULL;
}
else
{
pArray = hb_itemArrayNew( ulArgCount );
@@ -783,18 +787,24 @@ USHORT hb_errRT_BASE( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, ch
}
va_end( va );
pError = hb_errRT_New( ES_ERROR, HB_ERR_SS_BASE, ulGenCode, ulSubCode, szDescription, szOperation, 0, EF_CANRETRY );
/* I replaced EF_CANRETRY with EF_NONE for Clipper compatibility
* If it's wrong and I missed sth please fix me, Druzus.
*/
pError = hb_errRT_New( ES_ERROR, HB_ERR_SS_BASE, ulGenCode, ulSubCode, szDescription, szOperation, 0, EF_NONE /* EF_CANRETRY */ );
/* Assign the new array to the object data item. */
hb_vmPushSymbol( hb_dynsymGet( "_ARGS" )->pSymbol );
hb_vmPush( pError );
hb_vmPush( pArray );
hb_vmDo( 1 );
/* Release the Array. */
if( bRelease )
if ( pArray )
{
hb_itemRelease( pArray );
/* Assign the new array to the object data item. */
hb_vmPushSymbol( hb_dynsymGet( "_ARGS" )->pSymbol );
hb_vmPush( pError );
hb_vmPush( pArray );
hb_vmDo( 1 );
/* Release the Array. */
if( bRelease )
{
hb_itemRelease( pArray );
}
}
/* Ok, launch... */
@@ -815,24 +825,27 @@ USHORT hb_errRT_BASE_Ext1( ULONG ulGenCode, ULONG ulSubCode, char * szDescriptio
va_list va;
ULONG ulArgPos;
pArray = hb_itemArrayNew( ulArgCount );
/* Build the array from the passed arguments. */
va_start( va, ulArgCount );
for( ulArgPos = 1; ulArgPos <= ulArgCount; ulArgPos++ )
hb_itemArrayPut( pArray, ulArgPos, va_arg( va, PHB_ITEM ) );
va_end( va );
pError = hb_errRT_New( ES_ERROR, HB_ERR_SS_BASE, ulGenCode, ulSubCode, szDescription, szOperation, uiOsCode, uiFlags );
/* Assign the new array to the object data item. */
hb_vmPushSymbol( hb_dynsymGet( "_ARGS" )->pSymbol );
hb_vmPush( pError );
hb_vmPush( pArray );
hb_vmDo( 1 );
if ( ulArgCount > 0 )
{
pArray = hb_itemArrayNew( ulArgCount );
/* Release the Array. */
hb_itemRelease( pArray );
/* Build the array from the passed arguments. */
va_start( va, ulArgCount );
for( ulArgPos = 1; ulArgPos <= ulArgCount; ulArgPos++ )
hb_itemArrayPut( pArray, ulArgPos, va_arg( va, PHB_ITEM ) );
va_end( va );
/* Assign the new array to the object data item. */
hb_vmPushSymbol( hb_dynsymGet( "_ARGS" )->pSymbol );
hb_vmPush( pError );
hb_vmPush( pArray );
hb_vmDo( 1 );
/* Release the Array. */
hb_itemRelease( pArray );
}
/* Ok, launch... */
uiAction = hb_errLaunch( pError );
@@ -851,24 +864,27 @@ PHB_ITEM hb_errRT_BASE_Subst( ULONG ulGenCode, ULONG ulSubCode, char * szDescrip
va_list va;
ULONG ulArgPos;
pArray = hb_itemArrayNew( ulArgCount );
/* Build the array from the passed arguments. */
va_start( va, ulArgCount );
for( ulArgPos = 1; ulArgPos <= ulArgCount; ulArgPos++ )
hb_itemArrayPut( pArray, ulArgPos, va_arg( va, PHB_ITEM ) );
va_end( va );
pError = hb_errRT_New_Subst( ES_ERROR, HB_ERR_SS_BASE, ulGenCode, ulSubCode, szDescription, szOperation, 0, EF_NONE );
/* Assign the new array to the object data item. */
hb_vmPushSymbol( hb_dynsymGet( "_ARGS" )->pSymbol );
hb_vmPush( pError );
hb_vmPush( pArray );
hb_vmDo( 1 );
if ( ulArgCount > 0 )
{
pArray = hb_itemArrayNew( ulArgCount );
/* Release the Array. */
hb_itemRelease( pArray );
/* Build the array from the passed arguments. */
va_start( va, ulArgCount );
for( ulArgPos = 1; ulArgPos <= ulArgCount; ulArgPos++ )
hb_itemArrayPut( pArray, ulArgPos, va_arg( va, PHB_ITEM ) );
va_end( va );
/* Assign the new array to the object data item. */
hb_vmPushSymbol( hb_dynsymGet( "_ARGS" )->pSymbol );
hb_vmPush( pError );
hb_vmPush( pArray );
hb_vmDo( 1 );
/* Release the Array. */
hb_itemRelease( pArray );
}
/* Ok, launch... */
pRetVal = hb_errLaunchSubst( pError );
@@ -904,6 +920,10 @@ void hb_errRT_BASE_SubstR( ULONG ulGenCode, ULONG ulSubCode, char * szDescriptio
hb_itemArrayPut( pArray, 1, pArg );
}
}
else if ( ulArgCount == 0 )
{
pArray = NULL;
}
else
{
pArray = hb_itemArrayNew( ulArgCount );
@@ -917,16 +937,19 @@ void hb_errRT_BASE_SubstR( ULONG ulGenCode, ULONG ulSubCode, char * szDescriptio
pError = hb_errRT_New_Subst( ES_ERROR, HB_ERR_SS_BASE, ulGenCode, ulSubCode, szDescription, szOperation, 0, EF_NONE );
/* Assign the new array to the object data item. */
hb_vmPushSymbol( hb_dynsymGet( "_ARGS" )->pSymbol );
hb_vmPush( pError );
hb_vmPush( pArray );
hb_vmDo( 1 );
/* Release the Array. */
if( bRelease )
if ( pArray )
{
hb_itemRelease( pArray );
/* Assign the new array to the object data item. */
hb_vmPushSymbol( hb_dynsymGet( "_ARGS" )->pSymbol );
hb_vmPush( pError );
hb_vmPush( pArray );
hb_vmDo( 1 );
/* Release the Array. */
if( bRelease )
{
hb_itemRelease( pArray );
}
}
/* Ok, launch... */

Some files were not shown because too many files have changed in this diff Show More