2004-01-12 18:25 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/hbgtmk.sh
  * harbour/make_rpm.sh
  * harbour/harbour.spec
    * added flex to dependences
    * added --without gpl swich to exclude code which needs 3-rd party
      GPL libs (GPM, SLANG) - necessary for people who want to create
      commercial closed source application

  * harbour/make_gnu.sh
    * modified DJGPP detection - try to use env var first
    * set HB_GT_LIB depending on platform information
    * check PREFIX env var for default installation

  * harbour/make_tgz.sh
    * modified to work with DJGPP and 8.3 file names

  * harbour/bin/hb-func.sh
    * DJGPP support

  * harbour/bin/pack_src.sh
    * autodetect Harbour version number

  * harbour/config/linux/gcc.cf
    * added small comment

  + harbour/config/linux/owatcom.cf
    + OpenWatcom support on Linux

  * harbour/config/w32/global.cf
  * harbour/config/w32/mingw32.cf
    * small modification in clean procedure
    + added Phil's modification for MINGW cross compilation in Linux and BSD

  * harbour/source/compiler/gencobj.c
    + added Phil's modification for MINGW cross compilation in Linux and BSD

  * harbour/include/hbsetup.h
    * added OS_HAS_DRIVE_LETTER, OS_PATH_DELIMITER_STRING, OS_FILE_MASK,
      OS_DRIVE_DELIMITER and HOST_OS_UNIX_COMPATIBLE
    * modified for OW on Linux and MINGW cross compilation
    * added snprintf macro for compilers which do not support it

  * harbour/source/rtl/mod.c
    ! fixed bug in mod(a,b) when a/b exceeds LONG limit

  * harbour/source/rtl/filesys.c
    * removed HB_FS_DRIVE_LETTER - use OS_HAS_DRIVE_LETTER
    * modified for OW on Linux and MINGW cross compilation

  * harbour/contrib/libct/files.c
  * harbour/include/hb_io.h
  * harbour/include/hbdefs.h
  * harbour/source/rtl/diskspac.c
  * harbour/source/rtl/disksphb.c
  * harbour/source/rtl/fssize.c
  * harbour/source/rtl/fstemp.c
  * harbour/source/rtl/hbffind.c
  * harbour/source/rtl/net.c
  * harbour/source/rtl/seconds.c
  * harbour/source/rtl/gtcrs/Makefile
  * harbour/source/rtl/gtcrs/kbdcrs.c
  * harbour/source/rtl/gtpca/gtpca.c
  * harbour/source/rtl/gtsln/Makefile
  * harbour/source/rtl/gtsln/gtsln.c
  * harbour/source/rtl/gtsln/kbsln.c
  * harbour/source/rtl/gtstd/gtstd.c
  * harbour/source/vm/hvm.c
  * harbour/source/vm/mainstd.c
  * harbour/source/vm/mainwin.c
    * modified for OW on Linux and MINGW cross compilation

  * harbour/source/vm/memvars.c
    - removed unnecessary checking for s_globalTable == NULL in
      hb_memvarValueDecRef() - in Harbour it cannot happen
  * harbour/source/vm/itemapi.c
    - removed snprintf macros (see hbsetup.h)
    * fixed possible GPF in hb_itemCopyC()
    * modified hb_itemGetPtr() to check item type
This commit is contained in:
Przemyslaw Czerpak
2005-01-12 17:28:05 +00:00
parent 1f694e7a7b
commit 21ddfc5d47
38 changed files with 658 additions and 339 deletions

View File

@@ -8,6 +8,88 @@
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2004-01-12 18:25 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/hbgtmk.sh
* harbour/make_rpm.sh
* harbour/harbour.spec
* added flex to dependences
* added --without gpl swich to exclude code which needs 3-rd party
GPL libs (GPM, SLANG) - necessary for people who want to create
commercial closed source application
* harbour/make_gnu.sh
* modified DJGPP detection - try to use env var first
* set HB_GT_LIB depending on platform information
* check PREFIX env var for default installation
* harbour/make_tgz.sh
* modified to work with DJGPP and 8.3 file names
* harbour/bin/hb-func.sh
* DJGPP support
* harbour/bin/pack_src.sh
* autodetect Harbour version number
* harbour/config/linux/gcc.cf
* added small comment
+ harbour/config/linux/owatcom.cf
+ OpenWatcom support on Linux
* harbour/config/w32/global.cf
* harbour/config/w32/mingw32.cf
* small modification in clean procedure
+ added Phil's modification for MINGW cross compilation in Linux and BSD
* harbour/source/compiler/gencobj.c
+ added Phil's modification for MINGW cross compilation in Linux and BSD
* harbour/include/hbsetup.h
* added OS_HAS_DRIVE_LETTER, OS_PATH_DELIMITER_STRING, OS_FILE_MASK,
OS_DRIVE_DELIMITER and HOST_OS_UNIX_COMPATIBLE
* modified for OW on Linux and MINGW cross compilation
* added snprintf macro for compilers which do not support it
* harbour/source/rtl/mod.c
! fixed bug in mod(a,b) when a/b exceeds LONG limit
* harbour/source/rtl/filesys.c
* removed HB_FS_DRIVE_LETTER - use OS_HAS_DRIVE_LETTER
* modified for OW on Linux and MINGW cross compilation
* harbour/contrib/libct/files.c
* harbour/include/hb_io.h
* harbour/include/hbdefs.h
* harbour/source/rtl/diskspac.c
* harbour/source/rtl/disksphb.c
* harbour/source/rtl/fssize.c
* harbour/source/rtl/fstemp.c
* harbour/source/rtl/hbffind.c
* harbour/source/rtl/net.c
* harbour/source/rtl/seconds.c
* harbour/source/rtl/gtcrs/Makefile
* harbour/source/rtl/gtcrs/kbdcrs.c
* harbour/source/rtl/gtpca/gtpca.c
* harbour/source/rtl/gtsln/Makefile
* harbour/source/rtl/gtsln/gtsln.c
* harbour/source/rtl/gtsln/kbsln.c
* harbour/source/rtl/gtstd/gtstd.c
* harbour/source/vm/hvm.c
* harbour/source/vm/mainstd.c
* harbour/source/vm/mainwin.c
* modified for OW on Linux and MINGW cross compilation
* harbour/source/vm/memvars.c
- removed unnecessary checking for s_globalTable == NULL in
hb_memvarValueDecRef() - in Harbour it cannot happen
* harbour/source/vm/itemapi.c
- removed snprintf macros (see hbsetup.h)
* fixed possible GPF in hb_itemCopyC()
* modified hb_itemGetPtr() to check item type
2005-01-06 12:15 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
* source/pp/ppcore.c
* defined pseudo-functions' parameters are case sensitive now

View File

@@ -26,7 +26,7 @@ get_hbplatform()
[ "${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/'`
[ "${id}" = "" ] && id=`uname -sr | tr "[A-Z]" "[a-z]" | tr -d " "`
[ "${id}" = "" ] && id=`uname -sr | tr '[A-Z]' '[a-z]' | tr -d " "`
echo -n "${id}"
}
@@ -81,8 +81,14 @@ mk_hbtools()
hb_cmpname="${HB_CMPNAME-harbour}"
if [ "${HB_ARCHITECTURE}" = "dos" ]; then
hb_tool="$1/${hb_pref}-bld"
hb_path_separator=";"
hb_static="yes"
hb_static_default=" (default)"
else
hb_tool="$1/${hb_pref}-build"
hb_path_separator=":"
hb_static="no"
hb_shared_default=" (default)"
fi
hb_libs=`mk_hbgetlibs "$2"`
hb_libsc=`mk_hbgetlibsctb "$3"`
@@ -130,9 +136,9 @@ if [ \$# = 0 ]; then
\"${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
-static # link with static ${name} libs${hb_static_default}
-fullstatic # link with all static libs
-shared # link with shared libs (default)
-shared # link with shared libs${hb_shared_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
@@ -165,7 +171,7 @@ elif [ "\$*" = "mk-links" ]; then
fi
## default parameters
HB_STATIC="no"
HB_STATIC="${hb_static}"
HB_MT=""
HB_GT="${HB_GT_LIB#gt}"
HB_MG="${HB_MULTI_GT}"
@@ -230,13 +236,13 @@ 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]"\`
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]"\`
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]"\`
HB_MAIN_FUNC=\`echo \${HB_MAIN_FUNC}|tr '[a-z]' '[A-Z]'\`
# set environment variables
export HB_ARCHITECTURE="${HB_ARCHITECTURE}"
@@ -246,7 +252,7 @@ export HB_COMPILER="${HB_COMPILER}"
[ -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}"
export PATH="\${HB_BIN_INSTALL}${hb_path_separator}\${PATH}"
HB_PATHS="-I\${HB_INC_INSTALL}"
GCC_PATHS="\${HB_PATHS} -L\${HB_LIB_INSTALL}"
@@ -363,10 +369,12 @@ hb_cc()
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}"\`
if [ "\${HB_COMPILER}" != "djgpp" ]; then
if [ -n "\${HB_MAIN_FUNC}" ]; then
HB_MAIN_FUNC="@\${HB_MAIN_FUNC}"
elif [ -f "\${FOUTO}" ]; then
HB_MAIN_FUNC=\`hb_lnk_main "\${FOUTO}"\`
fi
fi
if [ -n "\${HB_LNK_REQ}" ] || [ -n "\${HB_GT_REQ}" ] || [ -n "\${HB_MAIN_FUNC}" ]; then
hb_lnk_request > \${_TMP_FILE_} && \\

View File

@@ -4,22 +4,22 @@
#
# This script requires "TAR" utilities for compression.
hb_ver="0.44.0"
hb_archbin="tar"
hb_archopt="-cz --ignore-failed-read -f"
hb_ext=".tar.gz"
if [ -f bin/hb-func.sh ]; then
hb_rootdir="."
else
hb_rootdir=`dirname $0`
hb_rootdir="${hb_rootdir}/.."
hb_archopt="-C $hb_rootdir $hb_archopt"
fi
. ${hb_rootdir}/bin/hb-func.sh
hb_ver=`get_hbver ${hb_rootdir}`
hb_filename="harbour-${hb_ver}.src${hb_ext}"
[ -f $hb_filename ] && rm -f $hb_filename
if [ ! -f bin/pack_src.sh ]; then
hb_rootdir=`dirname $0`
hb_rootdir="${hb_rootdir}/../"
hb_archopt="-C $hb_rootdir $hb_archopt"
else
hb_rootdir="."
fi
#[ -z "$TZ" ] && export TZ=PST8PDT
hb_collect_all()
@@ -53,12 +53,12 @@ $hb_collect config/os2/*.cf
$hb_collect config/w32/*.cf
# DOC
$hb_collect doc/Makefile
$hb_collect doc/[Mm]akefile*
$hb_collect doc/*.txt
$hb_collect doc/en/*.txt
$hb_collect doc/en/[Mm]akefile*
$hb_collect doc/es/*.txt
$hb_collect doc/en/*.txt
$hb_collect doc/es/[Mm]akefile*
$hb_collect doc/es/*.txt
# INCLUDE
$hb_collect include/Makefile

View File

@@ -36,7 +36,11 @@ LINKPATHS += $(foreach lib, $(LIBS), -L$(TOP)$(ROOT)source/$(lib)/$(HB_ARCH))
else
LINKPATHS += -L$(HB_LIB_COMPILE)
endif
# our libs have a lot of cross referenced now and we have to group them
# untill we don't clean them
LINKLIBS += -Wl,--start-group
LINKLIBS += $(foreach lib, $(CONTRIBS), -l$(subst lib,,$(lib)))
LINKLIBS += $(foreach lib, $(LIBS), -l$(lib))

View File

@@ -0,0 +1,85 @@
#
# $Id$
#
# The Harbour project
# GNU MAKE file for OpenWatcom C/C++
include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/global.cf
OBJ_EXT = .o
EXE_EXT =
LIB_PREF =
LIB_EXT = .lib
CC = wpp386
CC_IN =
CC_OUT = -fo=
# important: -j is necessary for proper build
#CPPFLAGS = -j -w3 -d1 -5s -5r -fp5 -oehtz -s -zq -zt0 -bt=linux
CPPFLAGS = -j -w2 -d1 -zq -bt=linux
#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
empty:=
space:= $(empty) $(empty)
comma:= ,
LD = wlink
LDFLAGS = debug all sys Linux OP CASEEXACT
ifeq ($(HB_LIB_COMPILE),)
LINKLIBS := $(foreach lib, $(CONTRIBS), $(TOP)$(ROOT)contrib/$(lib)/$(HB_ARCH)/$(subst lib,,$(lib)))
LINKLIBS += $(foreach lib, $(LIBS), $(TOP)$(ROOT)source/$(lib)/$(HB_ARCH)/$(lib))
else
LINKLIBS := $(foreach lib, $(CONTRIBS), $(HB_LIB_COMPILE)/$(lib))
LINKLIBS += $(foreach lib, $(LIBS), $(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), $(TOP)$(ROOT)source/rdd/$(drv)/$(HB_ARCH)/$(drv))
else
RDDLIBS := $(foreach drv, $(HB_DB_DRIVERS), $(HB_LIB_COMPILE)/$(drv))
endif
endif
ifeq ($(findstring rtl,$(LIBS)),rtl)
ifeq ($(HB_LIB_COMPILE),)
GTLIBS := $(TOP)$(ROOT)source/rtl/$(HB_GT_LIB)/$(HB_ARCH)/$(HB_GT_LIB)
else
GTLIBS := $(HB_LIB_COMPILE)/$(HB_GT_LIB)
endif
ifeq ($(HB_MULTI_GT),yes)
GTLIBS += $(TOP)$(ROOT)source/rtl/gtnul/$(HB_ARCH)/gtnul
endif
endif
LDFILES = $(subst $(space),$(comma) ,$(^F))
LDLIBS = $(subst $(space),$(comma) ,$(strip $(LINKLIBS) $(RDDLIBS) $(GTLIBS)))
LD_RULE = $(LD) $(LDFLAGS) NAME $@ FILE $(LDFILES)
ifneq ($(LDLIBS),)
LD_RULE += LIB $(LDLIBS)
endif
AR = wlib
# ARFLAGS = -c -n -fa $(A_USR)
ARFLAGS = -c -n $(A_USR)
AR_RULE = $(AR) $(ARFLAGS) $@ $(foreach file, $(^F), -+$(file))
include $(TOP)$(ROOT)config/rules.cf

View File

@@ -40,19 +40,13 @@ MV = move
MD = md
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\. $(MD) %%d
clean::
-for %f in ($(ARCH_DOS)\*.*) do $(RM) %f
-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
-if exist *.tds $(RM) *.tds
-$(RD) $(ARCH_DOS)
-$(RD) $(HB_ARCHITECTURE)
-@for %%f in ($(ARCH_DOS)\*.* *.bak *.obj *.o *.tds) do $(RM) %%f
-@for %f in ($(ARCH_DOS)\*.* *.bak *.obj *.o *.tds) do $(RM) %f
-@for %%d in ($(ARCH_DOS) $(HB_ARCHITECTURE)) do if exist %%d\. $(RD) %%d
-@for %d in ($(ARCH_DOS) $(HB_ARCHITECTURE)) do if exist %d\NUL $(RD) %d
else # bash
ARCH_DIR = $(HB_ARCH)/

View File

@@ -9,17 +9,16 @@ EXE_EXT = .exe
LIB_PREF = lib
LIB_EXT = .a
CC = gcc
CC = $(CCPREFIX)gcc
CC_IN = -c
CC_OUT = -o
CPPFLAGS = -I. -I$(HB_INC_COMPILE) -mno-cygwin
CFLAGS = -Wall -W
ifeq ($(HB_LEX),SIMPLEX)
CFLAGS = -Wall -DSIMPLEX
else
CFLAGS = -Wall
CFLAGS += -DSIMPLEX
endif
LD = gcc
LD = $(CCPREFIX)gcc
LD_OUT = -o
# Add all libraries specified in CONTRIBS and LIBS.
@@ -30,12 +29,13 @@ else
LINKPATHS += -L$(HB_LIB_COMPILE)
endif
# our libs have a lot of cross referenced now and we have to group them
# untill we don't clean them
LINKLIBS += -Wl,--start-group
LINKLIBS += $(foreach lib, $(CONTRIBS), -l$(subst lib,,$(lib)))
LINKLIBS += $(foreach lib, $(LIBS), -l$(lib))
# This library is needed for CharToOemBuff() and OemToCharBuff() support.
LINKLIBS += -luser32 -lwinspool
# 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)/$(HB_ARCH))
@@ -70,6 +70,11 @@ endif
# cyclic dependencies, but I think it is not really necessary if the
# libraries are kept in proper order.
# LINKLIBS += -Wl,-)
LINKLIBS += -Wl,--end-group
# This library is needed for CharToOemBuff() and OemToCharBuff() support.
LINKLIBS += -luser32 -lwinspool
# NOTE: The empty line directly before 'endef' HAVE TO exist!
# It causes that every echo command will be separated by LF
@@ -85,7 +90,7 @@ echo. CREATE $@ > __lib__.tmp
$(foreach file, $^, $(lib_object))
echo. SAVE >> __lib__.tmp
echo. END >> __lib__.tmp
$(AR) -M < __lib__.tmp
$(AR) $(ARFLAGS) -M < __lib__.tmp
endef
# NOTE: The empty line below HAVE TO exist!
@@ -104,11 +109,16 @@ endef
LDFLAGS = $(LINKPATHS) -mno-cygwin
AR = ar
ARFLAGS = $(A_USR)
AR_RULE = $(AR) $(ARFLAGS) r $@ $^ || $(RM) $@
#AR_RULE = $(create_library)
RANLIB = $(CCPREFIX)ranlib
#LD_RULE = $(link_exe_file)
AR = $(CCPREFIX)ar
ARFLAGS = $(A_USR)
ifeq ($(SHLVL),) # COMMAND.COM - length of command line is limited
AR_RULE = $(create_library)
LD_RULE = $(link_exe_file)
else
AR_RULE = $(AR) $(ARFLAGS) r $@ $^ && $(RANLIB) $@ || $(RM) $@
endif
include $(TOP)$(ROOT)config/rules.cf

View File

@@ -52,8 +52,9 @@
*/
#define HB_OS_WIN_32_USED
#include <hbapi.h>
#include <hbapifs.h>
#include "hbapi.h"
#include "hbapifs.h"
#include "hb_io.h"
#if defined( HB_OS_DOS ) && !defined( __WATCOMC__ )
static struct ffblk fsOldFiles;
@@ -61,8 +62,6 @@
#if defined(HB_OS_OS2) && defined(__GNUC__)
#include "hb_io.h"
#if defined(__EMX__)
#include <emx/syscalls.h>
#define gethostname __gethostname
@@ -78,14 +77,12 @@
#include <sys/farptr.h>
#include <sys/param.h>
#endif
#include "hb_io.h"
#include "dos.h"
#if defined( __WATCOMC__ )
#else
#include "dos.h"
#if !defined( __WATCOMC__ )
#include <dir.h>
#endif
#endif
#if defined(__GNUC__) && !defined(__MINGW32__)
#if defined(OS_UNIX_COMPATIBLE) || (defined(__GNUC__) && !defined(__MINGW32__))
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

View File

@@ -17,8 +17,9 @@
# --with mysql - build mysql lib (unused)
# --with pgsql - build pgsql lib (unused)
# --with odbc - build build odbc lib
# --without gpl - do not build libs which needs GPL 3-rd party code
# --without nf - do not build nanforum lib
# --without x11 - do not build GTXVT and GTXWC
# --without x11 - do not build GTXVT and GTXWC (unused)
# --without gpm - build GTSLN and GTCRS without GPM support
# --without gtsln - do not build GTSLN
######################################################################
@@ -69,7 +70,7 @@
%define hb_idir export HB_INC_INSTALL=%{_includedir}/%{name}
%define hb_ldir export HB_LIB_INSTALL=%{_libdir}/%{name}
%define hb_opt export HB_GTALLEG=%{?_with_allegro:yes}
%define hb_cmrc export HB_COMMERCE=no
%define hb_cmrc export HB_COMMERCE=%{?_without_gpl:yes}
%define hb_env %{hb_arch} ; %{hb_cc} ; %{hb_cflag} ; %{hb_lflag} ; %{hb_mt} ; %{hb_gt} ; %{hb_gpm} ; %{hb_sln} ; %{hb_x11} ; %{hb_mgt} ; %{hb_bdir} ; %{hb_idir} ; %{hb_ldir} ; %{hb_opt} ; %{hb_cmrc}
%define hb_host www.harbour-project.org
@@ -91,7 +92,7 @@ Vendor: %{hb_host}
URL: http://%{hb_host}/
Source: %{name}-%{version}.src.tar.gz
Packager: Przemys³aw Czerpak <druzus@polbox.com> Luiz Rafael Culik Guimaraes <culikr@uol.com.br>
BuildPrereq: gcc binutils bash bison ncurses ncurses-devel %{!?_without_gpm: gpm-devel}
BuildPrereq: gcc binutils bison flex bash ncurses ncurses-devel %{!?_without_gpm: gpm-devel}
Requires: gcc binutils bash sh-utils %{name}-lib = %{version}
Provides: %{name} harbour
BuildRoot: /tmp/%{name}-%{version}-root

View File

@@ -7,7 +7,7 @@
# Copyright 2003 Przemyslaw Czerpak <druzus@polbox.com>
# This script checks you have all tools to build Harbour binaries
# installed then takes current Harbour sources from SourceForge CVS
# and build binaries RPMs at your local host
# and build binary RPMs at your local host
#
# See doc/license.txt for licensing terms.
# ---------------------------------------------------------------
@@ -23,7 +23,7 @@ test_reqrpm()
}
TOINST_LST=""
for i in cvs gcc binutils bash bison ncurses ncurses-devel
for i in cvs make gcc binutils bison flex bash ncurses ncurses-devel
do
test_reqrpm "$i" || TOINST_LST="${TOINST_LST} $i"
done

View File

@@ -53,10 +53,13 @@
#ifndef HB__IO_H_
#define HB__IO_H_
#if defined(__GNUC__) && ! defined(__MINGW32__)
#if defined(OS_UNIX_COMPATIBLE) || \
( defined(__GNUC__) && ! defined(__MINGW32__) )
#include <unistd.h>
#endif
#if !defined(OS_UNIX_COMPATIBLE)
#if defined(__DJGPP__) || defined(__CYGWIN__) || defined(__EMX__)
#include <io.h>
#endif
#else
#include <io.h>
#endif

View File

@@ -74,14 +74,6 @@
/* 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

View File

@@ -125,6 +125,14 @@
#define HB_FM_STATISTICS
#endif
/* ***********************************************************************
* Use native Windows memory allocation functions (HB_OS_WIN_32)
* This option can disabled compiler memory allocation optimization
* so you should really have a good reason to enable it
*/
/* #define HB_FM_WIN32_ALLOC */
/* ***********************************************************************
* This symbol defines if we want an ability to create and link OBJ files
* generated by Harbour compiler
@@ -211,7 +219,7 @@
/* ***********************************************************************
* Detect GCC/OS2
* Detect GCC/OS2
*/
#if defined(__EMX__) && ! defined(__RSXNT__)
#define HARBOUR_GCC_OS2
@@ -220,32 +228,33 @@
/* ***********************************************************************
* Operating system specific definitions
*/
#if defined(__GNUC__)
/* The GNU C compiler is used */
#if defined(__DJGPP__) || defined(__EMX__) || defined(_Windows) || defined(_WIN32) || defined(__RSXNT__)
/* The DJGPP port of GNU C is used - for DOS platform */
#define OS_DOS_COMPATIBLE
#define OS_PATH_LIST_SEPARATOR ';'
#define OS_PATH_DELIMITER '\\'
#define OS_PATH_DELIMITER_LIST "\\/:"
#define OS_OPT_DELIMITER_LIST "/-"
#define OS_EOL_LEN 2 /* # of bytes in End of Line marker */
#else
#define OS_UNIX_COMPATIBLE
#define OS_PATH_LIST_SEPARATOR ':'
#define OS_PATH_DELIMITER '/'
#define OS_PATH_DELIMITER_LIST "/"
#define OS_OPT_DELIMITER_LIST "-"
#define OS_EOL_LEN 1
#endif
#if ( defined(__GNUC__) && \
! ( defined(__DJGPP__) || defined(__EMX__) || defined(__RSXNT__) || \
defined(_Windows) || defined(_WIN32) ) ) || \
( defined(__WATCOMC__) && defined(__LINUX__) )
#define HOST_OS_UNIX_COMPATIBLE
#define OS_UNIX_COMPATIBLE
#define OS_PATH_LIST_SEPARATOR ':'
#define OS_PATH_DELIMITER '/'
#define OS_PATH_DELIMITER_STRING "/"
#define OS_PATH_DELIMITER_LIST "/"
#define OS_FILE_MASK "*"
#undef OS_DRIVE_DELIMITER
#undef OS_HAS_DRIVE_LETTER
#define OS_OPT_DELIMITER_LIST "-"
#define OS_EOL_LEN 1
#else
/* we are assuming here the DOS compatible OS */
#define OS_DOS_COMPATIBLE
#define OS_PATH_LIST_SEPARATOR ';'
#define OS_PATH_DELIMITER '\\'
#define OS_PATH_DELIMITER_STRING "\\"
#define OS_PATH_DELIMITER_LIST "\\/:"
#define OS_FILE_MASK "*.*"
#define OS_DRIVE_DELIMITER ':'
#define OS_HAS_DRIVE_LETTER
#define OS_OPT_DELIMITER_LIST "/-"
#define OS_EOL_LEN 2
#define OS_EOL_LEN 2 /* # of bytes in End of Line marker */
#endif
#ifndef _POSIX_PATH_MAX
@@ -263,6 +272,8 @@
#define HB_OS_OS2
#elif defined(__NT__) || defined(__WINDOWS_386__) || defined(__WINDOWS__)
#define HB_OS_WIN_32
#elif defined(__LINUX__)
#define HB_OS_LINUX
#elif defined(__386__)
#define HB_OS_DOS
#define HB_OS_DOS_32
@@ -333,6 +344,26 @@
* hbmath.h - math errors handling
*/
/* ***********************************************************************
* Fix DJGPP in call to: toupper(), tolower(), is...()
*
*/
#if defined(__DJGPP__)
#include "hbfixdj.h"
/* Substitute snprintf() by sprintf() for DJGPP <= 2.03.
* This is a temporary hack, should implement a C99 snprintf() ourselves. */
#if ( __DJGPP__ < 2 || ( __DJGPP__ == 2 && __DJGPP_MINOR__ <= 3 ) )
#define snprintf(s, len, args...) sprintf( (s), ##args )
#endif
#elif defined( _MSC_VER ) && !defined(__XCC__)
#define snprintf _snprintf
#elif defined(__WATCOMC__)
#if __WATCOMC__ < 1200
#define snprintf _bprintf
#endif
#endif
/* ***********************************************************************
* Extern "C" detection
@@ -347,6 +378,4 @@
#define HB_EXTERN_END
#endif
#endif /* HB_SETUP_H_ */

View File

@@ -1,4 +1,5 @@
#!/bin/bash
#!/bin/sh
[ "$BASH" ] || exec bash `which $0` ${1+"$@"}
#
# $Id$
#
@@ -15,53 +16,86 @@
# ---------------------------------------------------------------
if [ -z "$HB_ARCHITECTURE" ]; then
hb_arch=`uname -s | tr -d "[-]" | tr "[A-Z]" "[a-z]" 2>/dev/null`
case "$hb_arch" in
*windows*) hb_arch="w32" ;;
*dos) hb_arch="dos" ;;
*bsd) hb_arch="bsd" ;;
esac
if [ "$OSTYPE" = "msdosdjgpp" ]; then
hb_arch="dos"
else
hb_arch=`uname -s | tr -d "[-]" | tr '[A-Z]' '[a-z]' 2>/dev/null`
case "$hb_arch" in
*windows*) hb_arch="w32" ;;
*dos) hb_arch="dos" ;;
*bsd) hb_arch="bsd" ;;
esac
fi
export HB_ARCHITECTURE="$hb_arch"
fi
if [ -z "$HB_COMPILER" ]; then
case "$HB_ARCHITECTURE" in
w32) hb_comp="mingw32" ;;
dos) hb_comp="djgpp" ;;
*) hb_comp="gcc" ;;
w32) HB_COMPILER="mingw32" ;;
dos) HB_COMPILER="djgpp" ;;
*) HB_COMPILER="gcc" ;;
esac
export HB_COMPILER="$hb_comp"
export HB_COMPILER
fi
if [ -z "$HB_GT_LIB" ]; then
case "$HB_ARCHITECTURE" in
w32) HB_GT_LIB="gtwin" ;;
dos) HB_GT_LIB="gtdos" ;;
os2) HB_GT_LIB="gtos2" ;;
*) HB_GT_LIB="gtstd" ;;
esac
export HB_GT_LIB
fi
if [ -z "$HB_GPM_MOUSE" ]; then
if [ "$HB_ARCHITECTURE" = "linux" ] && \
( [ -f /usr/include/gpm.h ] || [ -f /usr/local/include/gpm.h ]); then
HB_GPM_MOUSE=yes
else
HB_GPM_MOUSE=no
fi
export HB_GPM_MOUSE
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
if [ -z "$HB_GT_LIB" ]; then export HB_GT_LIB=; fi
# export PRG_USR=
# export C_USR=
# export L_USR=
if [ -z "$PREFIX" ]; then export PREFIX=/usr/local; fi
# Set to constant value to be consistent with the non-GNU make files.
if [ -z "$HB_BIN_INSTALL" ]; then export HB_BIN_INSTALL=bin/; fi
if [ -z "$HB_LIB_INSTALL" ]; then export HB_LIB_INSTALL=lib/; fi
if [ -z "$HB_INC_INSTALL" ]; then export HB_INC_INSTALL=include/; fi
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/harbour/; fi
if [ -z "$HB_INC_INSTALL" ]; then export HB_INC_INSTALL=$PREFIX/include/harbour/; fi
if [ -z "$HB_ARCHITECTURE" ]; then
echo Error: HB_ARCHITECTURE is not set.
echo "Error: HB_ARCHITECTURE is not set."
fi
if [ -z "$HB_COMPILER" ]; then
echo Error: HB_COMPILER is not set.
echo "Error: HB_COMPILER is not set."
fi
if [ -z "$HB_ARCHITECTURE" ] || [ -z "$HB_COMPILER" ]; then
echo
echo Usage: make_gnu.sh [command]
echo "Usage: make_gnu.sh [command]"
echo
echo The following commands are supported:
echo "The following commands are supported:"
echo " - all (default)"
echo " - clean"
echo " - install"
echo
echo Notes:
echo "Notes:"
echo
echo " - HB_ARCHITECTURE and HB_COMPILER envvars must be set."
echo " The following values are currently supported:"
@@ -86,8 +120,8 @@ if [ -z "$HB_ARCHITECTURE" ] || [ -z "$HB_COMPILER" ]; then
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 " - mingw32 (MinGW32 GNU C, Windows 32-bit)"
echo " - rsxnt (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"
@@ -119,7 +153,7 @@ else
# ---------------------------------------------------------------
# Start the GNU make system
if [ "$HB_ARCHITECTURE" = "bsd" ]; then
if [ "$HB_ARCHITECTURE" = "bsd" ] || [ `uname` = "FreeBSD" ]; then
gmake $*
else
make $*

View File

@@ -18,8 +18,9 @@
# --with pgsql - build pgsql lib
# --with odbc - build build odbc lib
# --with allegro - build GTALLEG - Allegro based GT driver
# --without gpl - do not build libs which needs GPL 3-rd party code
# --without nf - do not build nanforum lib
# --without x11 - do not build GTXVT
# --without x11 - do not build GTXVT and GTXWC
# --without gpm - build GTSLN and GTCRS without GPM support
# --without gtsln - do not build GTSLN
######################################################################
@@ -49,7 +50,7 @@ get_rpmmacro()
echo -n "${R}"
}
NEED_RPM="gcc binutils bash bison ncurses ncurses-devel"
NEED_RPM="make gcc binutils bison flex bash ncurses ncurses-devel"
FORCE=""
BUGGY_RPM=""
@@ -100,10 +101,19 @@ if test_reqrpm "allegro-devel"
then
INST_PARAM="${INST_PARAM} --with allegro"
fi
if ! test_reqrpm "gpm-devel"
if [ "${HB_COMMERCE}" = "yes" ]
then
INST_PARAM="${INST_PARAM} --without gpl"
fi
if [ "${HB_COMMERCE}" = "yes" ] || ! test_reqrpm "gpm-devel"
then
INST_PARAM="${INST_PARAM} --without gpm"
fi
if ! test_reqrpm "XFree86-devel"
then
INST_PARAM="${INST_PARAM} --without X11"
fi
TOINST_LST=""
for i in ${NEED_RPM}

View File

@@ -22,30 +22,46 @@ hb_instfile="${name}-${hb_ver}${hb_platform}.inst.sh"
hb_lnkso="yes"
hb_pref="hb"
hb_contrib=""
hb_sysdir="yes"
hb_exesuf=""
export C_USR="-DHB_FM_STATISTICS_OFF -O2"
if [ -z "$TMPDIR" ]; then TMPDIR="/tmp"; fi
HB_INST_PREF="$TMPDIR/$name.bin.$USER.$$"
if [ -z "$HB_ARCHITECTURE" ]; then
hb_arch=`uname -s | tr -d "[-]" | tr "[A-Z]" "[a-z]" 2>/dev/null`
case "$hb_arch" in
*windows*) hb_arch="w32" ;;
*dos) hb_arch="dos" ;;
*bsd) hb_arch="bsd" ;;
esac
export HB_ARCHITECTURE="$hb_arch"
if [ "$OSTYPE" = "msdosdjgpp" ]; then
hb_arch="dos"
else
hb_arch=`uname -s | tr -d "[-]" | tr '[A-Z]' '[a-z]' 2>/dev/null`
case "$hb_arch" in
*windows*) hb_arch="w32" ;;
*dos) hb_arch="dos" ;;
*bsd) hb_arch="bsd" ;;
esac
export HB_ARCHITECTURE="$hb_arch"
fi
fi
if [ -z "$HB_COMPILER" ]; then
case "$HB_ARCHITECTURE" in
w32) hb_comp="mingw32" ;;
dos) hb_comp="djgpp" ;;
*) hb_comp="gcc" ;;
w32) HB_COMPILER="mingw32" ;;
dos) HB_COMPILER="djgpp" ;;
*) HB_COMPILER="gcc" ;;
esac
export HB_COMPILER="$hb_comp"
export HB_COMPILER
fi
if [ -z "$HB_GT_LIB" ]; then
case "$HB_ARCHITECTURE" in
w32) HB_GT_LIB="gtwin" ;;
dos) HB_GT_LIB="gtdos" ;;
*) HB_GT_LIB="gtcrs" ;;
esac
export HB_GT_LIB
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
# default lib dir name
@@ -59,6 +75,15 @@ case "$HB_ARCHITECTURE" in
[ -d "$HB_INSTALL_PREFIX/lib64" ] && HB_LIBDIRNAME="lib64"
HB_INSTALL_GROUP=root
;;
dos)
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/${name}"
HB_INSTALL_GROUP=root
hb_sysdir="no"
hb_exesuf=".exe"
hb_instfile=""
hb_archfile="${name}.tgz"
HB_INST_PREF="$TMPDIR/hb-$$"
;;
*)
[ -z "$HB_INSTALL_PREFIX" ] && HB_INSTALL_PREFIX="/usr/local"
HB_INSTALL_GROUP=wheel
@@ -75,9 +100,21 @@ case "$HB_ARCHITECTURE" in
esac
# Set other platform-specific build options
if [ -z "$HB_GPM_MOUSE" ]; then
if [ "$HB_ARCHITECTURE" = "linux" ] && \
( [ -f /usr/include/gpm.h ] || [ -f /usr/local/include/gpm.h ]); then
HB_GPM_MOUSE=yes
else
HB_GPM_MOUSE=no
fi
export HB_GPM_MOUSE
fi
case "$HB_ARCHITECTURE" in
linux)
export HB_GPM_MOUSE=yes
;;
dos)
hb_lnkso="no"
;;
darwin)
# Autodetect old Darwin versions and set appropriate build options
@@ -97,9 +134,15 @@ then
export HB_WITHOUT_GTSLN=yes
fi
export HB_BIN_INSTALL="$HB_INSTALL_PREFIX/bin"
export HB_INC_INSTALL="$HB_INSTALL_PREFIX/include/${name}"
export HB_LIB_INSTALL="$HB_INSTALL_PREFIX/$HB_LIBDIRNAME/${name}"
if [ "${hb_sysdir}" = "yes" ]; then
export HB_BIN_INSTALL="$HB_INSTALL_PREFIX/bin"
export HB_INC_INSTALL="$HB_INSTALL_PREFIX/include/${name}"
export HB_LIB_INSTALL="$HB_INSTALL_PREFIX/$HB_LIBDIRNAME/${name}"
else
export HB_BIN_INSTALL="$HB_INSTALL_PREFIX/bin"
export HB_INC_INSTALL="$HB_INSTALL_PREFIX/include"
export HB_LIB_INSTALL="$HB_INSTALL_PREFIX/$HB_LIBDIRNAME"
fi
# build
umask 022
@@ -113,8 +156,6 @@ do
done
# install
if [ -z "$TMPDIR" ]; then TMPDIR="/tmp"; fi
HB_INST_PREF="$TMPDIR/$name.bin.$USER.$$"
rm -fR "${HB_INST_PREF}"
export _DEFAULT_BIN_DIR=$HB_BIN_INSTALL
@@ -135,20 +176,24 @@ do
done
# Keep the size of the binaries to a minimim.
strip $HB_BIN_INSTALL/harbour
strip $HB_BIN_INSTALL/harbour${hb_exesuf}
# Keep the size of the libraries to a minimim, but don't try to strip symlinks.
strip -S `find $HB_LIB_INSTALL -type f`
if [ "${hb_sysdir}" = "yes" ]; then
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
CC=gcc
CFLAGS=-c -I$_DEFAULT_INC_DIR -O2
CFLAGS=-c -I$_DEFAULT_INC_DIR -O3
VERBOSE=YES
DELTMP=YES
EOF
fi
# check if we should rebuild tools with shared libs
if [ "${hb_lnkso}" = yes ]
then
@@ -182,15 +227,18 @@ rm -f pp
popd
$TAR -czvf "${hb_archfile}" --owner=${HB_INSTALL_OWNER} --group=${HB_INSTALL_GROUP} -C "${HB_INST_PREF}" .
CURDIR=$(pwd)
(cd "${HB_INST_PREF}"; $TAR -czvf "${CURDIR}/${hb_archfile}" --owner=${HB_INSTALL_OWNER} --group=${HB_INSTALL_GROUP} .)
rm -fR "${HB_INST_PREF}"
if [ "${HB_ARCHITECTURE}" = darwin ]; then
DO_LDCONFIG=""
else
DO_LDCONFIG="&& ldconfig"
fi
cat > "${hb_instfile}" <<EOF
if [ -n "${hb_instfile}" ]; then
if [ "${HB_ARCHITECTURE}" = linux ]; then
DO_LDCONFIG="&& ldconfig"
else
DO_LDCONFIG=""
fi
cat > "${hb_instfile}" <<EOF
#!/bin/sh
if [ "\$1" == "--extract" ]; then
sed -e '1,/^HB_INST_EOF\$/ d' \$0 > "${hb_archfile}"
@@ -209,6 +257,8 @@ fi
exit \$?
HB_INST_EOF
EOF
cat "${hb_archfile}" >> "${hb_instfile}"
chmod +x "${hb_instfile}"
rm -f "${hb_archfile}"
cat "${hb_archfile}" >> "${hb_instfile}"
chmod +x "${hb_instfile}"
rm -f "${hb_archfile}"
fi

View File

@@ -48,7 +48,7 @@ void hb_compGenCObj( PHB_FNAME pFileName )
char szOptions[ HB_CFG_LINE_LEN ] = "";
char szCommandLine[ HB_CFG_LINE_LEN * 2 ];
char szOutPath[ _POSIX_PATH_MAX ] = "\0";
#if defined( OS_UNIX_COMPATIBLE )
#if defined( HOST_OS_UNIX_COMPATIBLE )
char szDefaultUnixPath[ _POSIX_PATH_MAX ] = "/etc:/usr/local/etc";
#define HB_NULL_STR " > /dev/null"
#define HB_ACCESS_FLAG F_OK

View File

@@ -69,7 +69,7 @@
#include <sys/mount.h>
#elif defined(HB_OS_SUNOS)
#include <sys/statvfs.h>
#elif defined(HB_OS_UNIX)
#elif defined(HB_OS_UNIX) && !defined(__WATCOMC__)
#include <sys/vfs.h>
#endif
@@ -203,7 +203,7 @@ HB_FUNC( DISKSPACE )
bError = TRUE;
}
#elif defined(HB_OS_UNIX)
#elif defined(HB_OS_UNIX) && !defined(__WATCOMC__)
{
char *szName = ISCHAR( 1 ) ? hb_parc( 1 ) : "/";

View File

@@ -67,7 +67,7 @@
#include <sys/mount.h>
#elif defined(HB_OS_SUNOS)
#include <sys/statvfs.h>
#elif defined( HB_OS_UNIX )
#elif defined( HB_OS_UNIX ) && !defined(__WATCOMC__)
#include <sys/vfs.h>
#endif
@@ -306,7 +306,7 @@ HB_FUNC( HB_DISKSPACE )
}
}
#elif defined(HB_OS_UNIX)
#elif defined(HB_OS_UNIX) && !defined(__WATCOMC__)
{
#if defined(HB_OS_SUNOS)

View File

@@ -108,83 +108,84 @@
#if defined(OS_UNIX_COMPATIBLE)
#include <unistd.h>
#endif
#if defined(__GNUC__) && !defined(__MINGW32__)
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#if defined(__CYGWIN__)
#include <io.h>
#include <sys/wait.h>
#if !defined( HB_OS_DARWIN )
extern char **environ;
#else
#include <crt_externs.h>
#define environ (*_NSGetEnviron())
#endif
#if defined(__DJGPP__)
#include <dir.h>
#define _getdrive getdisk
#define _chdrive setdisk
#endif
#if !defined(HAVE_POSIX_IO)
#define HAVE_POSIX_IO
#endif
extern int rename( const char *, const char * );
#endif
#if defined(__WATCOMC__)
#if ( defined(__BORLANDC__) || defined(__IBMCPP__) || defined(_MSC_VER) || \
defined(__MINGW32__) || defined(__WATCOMC__) ) && !defined( HB_OS_UNIX )
#include <sys/stat.h>
#include <share.h>
#include <fcntl.h>
#include <direct.h>
#include <errno.h>
#include <dos.h>
#if !defined(HAVE_POSIX_IO)
#define HAVE_POSIX_IO
#endif
#define ftruncate chsize
#endif
#if defined(__BORLANDC__) || defined(__IBMCPP__) || defined(_MSC_VER) || defined(__MINGW32__)
#include <sys\stat.h>
#include <share.h>
#include <fcntl.h>
#include <direct.h>
#include <process.h>
#if defined(__BORLANDC__)
#include <dir.h>
#include <dos.h>
#include <windows.h>
#elif defined(__WATCOMC__)
#include <dos.h>
#endif
#if defined(_MSC_VER) || defined(__MINGW32__)
#include <sys\locking.h>
#include <sys/locking.h>
#define ftruncate _chsize
#if defined(__MINGW32__) && !defined(_LK_UNLCK)
#define _LK_UNLCK _LK_UNLOCK
#endif
#if defined(_MSC_VER) && !defined(HAVE_POSIX_IO)
#define HAVE_POSIX_IO
#endif
#else
#define ftruncate chsize
#if !defined(HAVE_POSIX_IO)
#define HAVE_POSIX_IO
#endif
#endif
#if !defined(HAVE_POSIX_IO)
#define HAVE_POSIX_IO
#endif
#elif defined(__GNUC__) || defined( HB_OS_UNIX )
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#if defined(__CYGWIN__)
#include <io.h>
#elif defined(__DJGPP__)
#include <dir.h>
#endif
#if !defined(HAVE_POSIX_IO)
#define HAVE_POSIX_IO
#endif
#endif
#if defined(__MPW__)
#include <fcntl.h>
#endif
#if defined(HB_OS_HPUX)
extern int fdatasync(int fildes);
#endif
#if defined(HB_OS_DOS)
#include <dos.h>
#endif
#if defined( HB_WIN32_IO )
#include <windows.h>
#if ( defined( _MSC_VER ) || defined( __LCC__ ) ) && !defined( INVALID_SET_FILE_POINTER )
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
#endif
#endif
#ifdef HB_OS_OS2
#include <sys/signal.h>
#include <sys/process.h>
#include <sys/wait.h>
#endif
#ifndef O_BINARY
#define O_BINARY 0 /* O_BINARY not defined on Linux */
#endif
@@ -274,11 +275,6 @@ static USHORT s_uiErrorLast = 0;
#define HB_FS_SOPEN
#endif
#if ( defined(HAVE_POSIX_IO) && ( defined(HB_OS_OS2) || defined(HB_OS_DOS) || defined(HB_OS_WIN_32) ) && ! defined(__CYGWIN__) ) || defined(__MINGW32__)
/* These platforms and/or compilers have common drive letter support */
#define HB_FS_DRIVE_LETTER
#endif
#if UINT_MAX == USHRT_MAX
#define LARGE_MAX ( UINT_MAX - 1L )
#else
@@ -301,8 +297,6 @@ static USHORT s_uiErrorLast = 0;
#if defined(HB_FS_FILE_IO)
extern char **environ;
static int convert_open_flags( USHORT uiFlags )
{
/* by default FO_READ + FO_COMPAT is set */
@@ -550,7 +544,7 @@ FHANDLE hb_fsPOpen( BYTE * pFilename, BYTE * pMode )
ULONG ulLen;
int iMaxFD;
ulLen = strlen( pFilename );
ulLen = strlen( ( char * ) pFilename );
if( pMode && ( *pMode == 'r' || *pMode == 'w' ) )
bRead = ( *pMode == 'r' );
else
@@ -570,7 +564,7 @@ FHANDLE hb_fsPOpen( BYTE * pFilename, BYTE * pMode )
}
if( pFilename[ ulLen - 1 ] == '|' )
{
pbyTmp = hb_strdup( pFilename );
pbyTmp = hb_strdup( ( char * ) pFilename );
pbyTmp[--ulLen] = 0;
pFilename = pbyTmp;
} else
@@ -1275,7 +1269,6 @@ BOOL HB_EXPORT hb_fsLock ( FHANDLE hFileHandle, ULONG ulStart,
}
#elif defined(HB_OS_OS2)
{
struct _FILELOCK fl, ful;
@@ -1308,12 +1301,9 @@ BOOL HB_EXPORT hb_fsLock ( FHANDLE hFileHandle, ULONG ulStart,
default:
bResult = FALSE;
}
s_uiErrorLast = errno;
}
#elif defined(_MSC_VER)
{
ULONG ulOldPos = hb_fsSeek( hFileHandle, ulStart, FS_SET );
@@ -1335,9 +1325,7 @@ BOOL HB_EXPORT hb_fsLock ( FHANDLE hFileHandle, ULONG ulStart,
hb_fsSeek( hFileHandle, ulOldPos, FS_SET );
}
#elif defined(__MINGW32__)
{
ULONG ulOldPos = hb_fsSeek( hFileHandle, ulStart, FS_SET );
@@ -1359,9 +1347,7 @@ BOOL HB_EXPORT hb_fsLock ( FHANDLE hFileHandle, ULONG ulStart,
hb_fsSeek( hFileHandle, ulOldPos, FS_SET );
}
#elif defined(__GNUC__) && defined(HB_OS_UNIX)
#elif defined(HB_OS_UNIX)
{
/* TODO: check for append locks (SEEK_END)
*/
@@ -1396,7 +1382,6 @@ BOOL HB_EXPORT hb_fsLock ( FHANDLE hFileHandle, ULONG ulStart,
default:
bResult = FALSE;
}
s_uiErrorLast = bResult ? 0 : errno;
}
@@ -1747,11 +1732,13 @@ BOOL HB_EXPORT hb_fsMkDir( BYTE * pDirname )
errno = 0;
#if !defined(__WATCOMC__) && !defined(__BORLANDC__) && !defined(__IBMCPP__) && !defined(__MINGW32__)
bResult = ( mkdir( ( char * ) pDirname, S_IWUSR | S_IRUSR | S_IXUSR ) == 0 );
#else
# if ! defined(HB_OS_UNIX) && \
( defined(__WATCOMC__) || defined(__BORLANDC__) || \
defined(__IBMCPP__) || defined(__MINGW32__) )
bResult = ( mkdir( ( char * ) pDirname ) == 0 );
#endif
# else
bResult = ( mkdir( ( char * ) pDirname, S_IRWXU | S_IRWXG | S_IRWXO ) == 0 );
# endif
s_uiErrorLast = errno;
@@ -1931,7 +1918,7 @@ USHORT HB_EXPORT hb_fsChDrv( BYTE nDrive )
HB_TRACE(HB_TR_DEBUG, ("hb_fsChDrv(%d)", (int) nDrive));
#if defined(HB_FS_DRIVE_LETTER)
#if defined(OS_HAS_DRIVE_LETTER)
#if defined( __WATCOMC__ )
@@ -2003,7 +1990,7 @@ USHORT HB_EXPORT hb_fsIsDrv( BYTE nDrive )
HB_TRACE(HB_TR_DEBUG, ("hb_fsIsDrv(%d)", (int) nDrive));
#if defined(HB_FS_DRIVE_LETTER)
#if defined(OS_HAS_DRIVE_LETTER)
#if defined( __WATCOMC__ )
@@ -2068,10 +2055,10 @@ BOOL HB_EXPORT hb_fsIsDevice( FHANDLE hFileHandle )
HB_TRACE(HB_TR_DEBUG, ("hb_fsIsDevice(%p)", hFileHandle));
#if defined(HB_FS_DRIVE_LETTER)
#if defined(HB_FS_FILE_IO)
errno = 0;
bResult = ( isatty( hFileHandle ) == 0 );
bResult = ( isatty( hFileHandle ) != 0 );
s_uiErrorLast = errno;
#else
@@ -2093,8 +2080,22 @@ BYTE HB_EXPORT hb_fsCurDrv( void )
HB_TRACE(HB_TR_DEBUG, ("hb_fsCurDrv()"));
#if defined(HB_FS_DRIVE_LETTER)
#if defined(OS_HAS_DRIVE_LETTER)
#if defined( __WATCOMC__ )
{
/* 'unsigned int' _have to_ be used in Watcom
*/
unsigned uiDrive;
/* 1 = A:, 2 = B:, 3 = C:, etc
* _dos_*() functions don't set 'errno'
*/
_dos_getdrive( &uiDrive );
s_uiErrorLast = 0;
uiResult = ( USHORT ) uiDrive - 1;
}
#else
{
errno = 0;
uiResult = _getdrive();
@@ -2114,21 +2115,7 @@ BYTE HB_EXPORT hb_fsCurDrv( void )
#endif
s_uiErrorLast = errno;
}
#elif defined( __WATCOMC__ )
{
/* 'unsigned int' _have to_ be used in Watcom
*/
unsigned uiDrive;
/* 1 = A:, 2 = B:, 3 = C:, etc
* _dos_*() functions don't set 'errno'
*/
_dos_getdrive( &uiDrive );
s_uiErrorLast = 0;
uiResult = ( USHORT ) uiDrive - 1;
}
#endif
#else

View File

@@ -55,13 +55,8 @@
#include "hbapifs.h"
#include <errno.h>
#if defined( OS_UNIX_COMPATIBLE )
#include <sys/types.h>
#include <sys/stat.h>
#else
#include <sys\types.h>
#include <sys\stat.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
ULONG hb_fsFSize( BYTE * pszFileName, BOOL bUseDirEntry )
{

View File

@@ -65,7 +65,7 @@
/* NOTE: The buffer must be at least _POSIX_PATH_MAX chars long */
#if !defined( HB_OS_UNIX )
#if !defined( HB_OS_UNIX ) || defined( __WATCOMC__ )
static BOOL hb_fsTempName( BYTE * pszBuffer, const BYTE * pszDir, const BYTE * pszPrefix )
{
/* TODO: Implement these: */
@@ -92,7 +92,7 @@ FHANDLE hb_fsCreateTemp( const BYTE * pszDir, const BYTE * pszPrefix, USHORT uiA
errno = 0;
#if !defined( HB_OS_UNIX )
#if !defined( HB_OS_UNIX ) || defined( __WATCOMC__ )
while( --nAttemptLeft )
{
if( hb_fsTempName( pszName, pszDir, pszPrefix ) )
@@ -117,7 +117,7 @@ FHANDLE hb_fsCreateTemp( const BYTE * pszDir, const BYTE * pszPrefix, USHORT uiA
#else
HB_SYMBOL_UNUSED( uiAttr );
if( ( ( pszDir ? strlen( pszDir ) : 0 ) + ( pszPrefix ? strlen( pszPrefix ) : 0 ) + 6 ) < _POSIX_PATH_MAX )
if( ( ( pszDir ? strlen( ( char * ) pszDir ) : 0 ) + ( pszPrefix ? strlen( ( char * ) pszPrefix ) : 0 ) + 6 ) < _POSIX_PATH_MAX )
{
FHANDLE fhnd;
char cTemplate[_POSIX_PATH_MAX];
@@ -126,7 +126,7 @@ FHANDLE hb_fsCreateTemp( const BYTE * pszDir, const BYTE * pszPrefix, USHORT uiA
if( pszDir )
{
int nLen;
strcpy( cTemplate, pszDir );
strcpy( cTemplate, ( char * ) pszDir );
nLen = strlen( cTemplate );
if( cTemplate[nLen] != hb_set.HB_SET_DIRSEPARATOR )
{
@@ -136,7 +136,7 @@ FHANDLE hb_fsCreateTemp( const BYTE * pszDir, const BYTE * pszPrefix, USHORT uiA
}
if( pszPrefix )
{
strcat( cTemplate, pszPrefix );
strcat( cTemplate, ( char * ) pszPrefix );
}
strcat( cTemplate, "XXXXXX" ); /* required by mkstemp */
while( --nAttemptLeft )
@@ -144,7 +144,7 @@ FHANDLE hb_fsCreateTemp( const BYTE * pszDir, const BYTE * pszPrefix, USHORT uiA
fhnd = mkstemp( cTemplate );
if( fhnd >= 0 )
{
strcpy( pszName, cTemplate );
strcpy( ( char * ) pszName, cTemplate );
return fhnd;
}
}

View File

@@ -21,3 +21,27 @@ PRG_HEADERS=\
LIBNAME=gtcrs
include $(TOP)$(ROOT)config/lib.cf
# a workaround of a problem with different include directories
# for slang curses files between different unix distributions
ifeq ($(HB_NCURSES_FINK),yes)
CFLAGS += -I/sw/include -I/sw/include/ncurses
else
ifeq ($(HB_NCURSES_194),yes)
CFLAGS += -I/usr/include/ncur194
CFLAGS += -DHB_NCURSES_194
else
CFLAGS += -I/usr/include/ncurses
ifeq ($(HB_GT_CRS_BCEHACK),yes)
CFLAGS += -DHB_GT_CRS_BCEHACK
endif
endif
endif
ifeq ($(HB_GPM_MOUSE),yes)
CFLAGS += -DHAVE_GPM_H
endif
ifeq ($(HB_MULTI_GT),yes)
CFLAGS += -DHB_MULTI_GT
endif

View File

@@ -352,7 +352,7 @@ fflush( stderr );
if( memcmp( s_mouse_event_seq, key_codes, s_mouse_event_len ) == 0 )
{
/* Convert the mouse event into INKEY keycodes */
return hb_mouse_xevent( key_codes+s_mouse_event_len, eventmask );
return hb_mouse_xevent( ( char * ) key_codes+s_mouse_event_len, eventmask );
}
}
/* keymap not found */
@@ -385,7 +385,7 @@ static void hb_gt_Add_keymap( int InkeyCode, char *key_string, BOOL bxfree )
sum += key_string[ i++ ];
sum &= HB_HASH_KEY - 1;
keymap = hb_xgrab( sizeof( struct key_map_struc ) );
keymap = ( struct key_map_struc * ) hb_xgrab( sizeof( struct key_map_struc ) );
keymap->inkey_code = InkeyCode;
keymap->key_string = key_string;
keymap->length = iLength;
@@ -465,7 +465,7 @@ HB_FUNC( HB_GT_ADDKEYMAP )
char * code;
int len = hb_parclen(2);
code = hb_xgrab( len + 1 );
code = ( char * ) hb_xgrab( len + 1 );
memcpy( code, hb_parc(2), len );
code[ len ] = '\0';
hb_gt_Add_keymap( hb_parni( 1 ), code, TRUE );

View File

@@ -57,22 +57,14 @@
/* NOTE: User programs should never call this layer directly! */
#if defined(__GNUC__) && ! defined(__MINGW32__)
#include <unistd.h>
#if defined(__DJGPP__) || defined(__CYGWIN__) || defined(__EMX__)
#include <io.h>
#endif
#else
#include <io.h>
#endif
#include "hbapigt.h"
#include "hb_io.h"
#include "hbset.h"
#include "inkey.ch"
#include <ctype.h>
#include <string.h>
#include "hbapigt.h"
#include "hbset.h"
#include "inkey.ch"
static USHORT s_usRow, s_usCol, s_usMaxRow, s_usMaxCol;
static int s_iFilenoStdin, s_iFilenoStdout, s_iFilenoStderr;
static int s_iAttribute;

View File

@@ -16,6 +16,14 @@ include $(TOP)$(ROOT)config/lib.cf
# a workaround of a problem with different include directories
# for slang header files between different unix distributions
CFLAGS := -I/usr/include/slang -I/usr/local/include \
-I/usr/local/include/slang $(CFLAGS)
-I/usr/local/include/slang -I/sw/include $(CFLAGS)
#LDFLAGS := -L/usr/lib/slang -L/usr/local/lib -L/usr/local/lib/slang $(LDFLAGS)
ifeq ($(HB_GPM_MOUSE),yes)
CFLAGS += -DHAVE_GPM_H
endif
ifeq ($(HB_MULTI_GT),yes)
CFLAGS += -DHB_MULTI_GT
endif

View File

@@ -54,6 +54,13 @@
/* *********************************************************************** */
#include "hbapi.h"
#include "hbapigt.h"
#include "inkey.ch"
#if defined(HB_OS_DARWIN) || ( defined(HB_OS_LINUX) && defined(__WATCOMC__) )
#define REAL_UNIX_SYSTEM /* this is for slang.h to include some defs */
#endif
#include <slang.h>
/* missing defines in previous versions of Slang - this can not work ! */
@@ -87,10 +94,6 @@
#include <time.h>
#endif
#include "hbapi.h"
#include "hbapigt.h"
#include "inkey.ch"
/* *********************************************************************** */
/* if we can not manipulate cursor state */
@@ -109,7 +112,7 @@ static void hb_gt_build_conv_tabs();
/* A definition is a list of pairs of chars. The first char in each pair is */
/* an ASCII key, which should be pressed *after* a "DeadKey" was pressed to */
/* get the nation char, a second in that pair is a corresponding nation char */
unsigned char *hb_NationCharsEnvName = "HRBNATIONCHARS";
static char *hb_NationCharsEnvName = "HRBNATIONCHARS";
/* *********************************************************************** */
@@ -427,9 +430,6 @@ USHORT hb_gt_GetCursorStyle( void )
void hb_gt_SetCursorStyle( USHORT uiStyle )
{
/* keyseq to define cursor shape under linux console */
static char cursDefseq[] = { 27, '[', '?', '1', 'c', 0 };
HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetCursorStyle(%hu)", uiStyle));
/* TODO: How to set the shape of the cursor on terminals ? */
@@ -439,10 +439,12 @@ void hb_gt_SetCursorStyle( USHORT uiStyle )
if( ( s_sCursorStyle >= SC_NONE ) && ( s_sCursorStyle <= SC_SPECIAL2 ) )
{
/* keyseq to define cursor shape under linux console */
static char cursDefseq[] = { 27, '[', '?', '1', 'c', 0 };
s_sCursorStyle = uiStyle;
SLtt_set_cursor_visibility( s_sCursorStyle != SC_NONE );
#ifdef __linux__
/* NOTE: cursor apearence works only under linux console */
if( s_linuxConsole )
{
@@ -473,7 +475,6 @@ void hb_gt_SetCursorStyle( USHORT uiStyle )
SLtt_write_string( cursDefseq );
}
#endif
if( s_uiDispCount == 0 )
/* SLsmg_refresh(); */
@@ -1248,7 +1249,7 @@ static void hb_gt_build_conv_tabs()
/* init an alternate chars table */
if( ( p = SLtt_Graphics_Char_Pairs ) )
{
len = strlen( p );
len = strlen( ( char * ) p );
/* alternate char set should be even */
if( ( len != ( ( len / 2 ) * 2 ) ) && ( len > 0 ) )
@@ -1371,7 +1372,7 @@ static void hb_gt_build_conv_tabs()
{
unsigned char Pos, Msk;
len = strlen( p );
len = strlen( ( char * ) p );
/* a len of definition of National chars should be even */
if( ( len != ( ( len / 2 ) * 2 ) ) && ( len > 0 ) )

View File

@@ -54,6 +54,12 @@
/* *********************************************************************** */
#include "hbapigt.h"
#include "inkey.ch"
#if defined(HB_OS_DARWIN) || ( defined(HB_OS_LINUX) && defined(__WATCOMC__) )
#define REAL_UNIX_SYSTEM /* this is for slang.h to include some defs */
#endif
#include <slang.h>
#include <sys/ioctl.h>
@@ -64,9 +70,6 @@
#include <termios.h> /* we're assuming target has termios - should be better done */
#include "hbapigt.h"
#include "inkey.ch"
/* *********************************************************************** */
/* keyboard states - these should be taken
@@ -110,7 +113,7 @@ extern BOOL hb_gt_sln_bScreen_Size_Changed;
/* DeadKey definition's ENVVAR name. This EnvVar contains */
/* an ASCII value of a key, which serves as a DeadKey */
unsigned char *hb_DeadKeyEnvName = "HRBNATIONDEADKEY";
static char *hb_DeadKeyEnvName = "HRBNATIONDEADKEY";
/* a table for Keys work with a Dead key. The first
element contains a number of defined keys */
@@ -236,7 +239,7 @@ int hb_gt_Init_Terminal( int phase )
if( p && p[ 0 ] != '\0' )
{
int len = strlen( p );
int len = strlen( ( char * ) p );
if( len > 0 )
hb_DeadKey = ( int ) *p;
}

View File

@@ -72,10 +72,8 @@
#include <time.h>
#if defined( HB_OS_BSD )
#include <sys/time.h>
#elif defined( OS_UNIX_COMPATIBLE )
#include <sys/timeb.h>
#else
#include <sys\timeb.h>
#include <sys/timeb.h>
#endif

View File

@@ -145,7 +145,9 @@ HB_FILE_VER( "$Id$" )
#include <errno.h>
#include <dirent.h>
#include <time.h>
#if !defined( __WATCOMC__ )
#include <fnmatch.h>
#endif
typedef struct
{
@@ -727,7 +729,11 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind )
{
strcpy( string, info->entry->d_name );
#if defined( __WATCOMC__ )
if( hb_strMatchWild( string, info->pattern ) )
#else
if( fnmatch( info->pattern, string, FNM_PERIOD | FNM_PATHNAME ) == 0 )
#endif
{
bFound = TRUE;
break;

View File

@@ -53,6 +53,7 @@
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbapierr.h"
#include "hbmath.h"
/* NOTE: In CA-Cl*pper this is written in Clipper, see the source below,
and the error handling is NOT made here, but in the % operator.
@@ -75,12 +76,7 @@ HB_FUNC( MOD )
if( dBase )
{
double dResult = dNumber - ( ( long ) ( dNumber / dBase ) * dBase );
if( dResult * dBase < 0 )
hb_retnd( dResult + dBase );
else
hb_retnd( dResult );
hb_retnd( fmod( dNumber, dBase ) );
}
else
{

View File

@@ -100,12 +100,17 @@ HB_FUNC( NETNAME )
#if defined(HB_OS_UNIX) || ( defined(HB_OS_OS2) && defined(__GNUC__) )
{
#if defined(__WATCOMC__)
char * pszValue = hb_getenv( "HOSTNAME" );
hb_retc_buffer( pszValue );
#else
char szValue[ MAXGETHOSTNAME + 1 ];
szValue[ 0 ] = '\0';
gethostname( szValue, MAXGETHOSTNAME );
hb_retc( szValue );
#endif
}
#elif defined(HB_OS_DOS)

View File

@@ -55,14 +55,12 @@
#include <time.h>
#if defined( HB_OS_BSD)
#include <sys/time.h>
#include <sys/times.h>
#include <unistd.h>
#elif defined( OS_UNIX_COMPATIBLE )
#include <sys/timeb.h>
#include <sys/times.h>
#include <unistd.h>
#else
#include <sys\timeb.h>
#include <sys/timeb.h>
#endif
#if defined( OS_UNIX_COMPATIBLE )
#include <sys/times.h>
#include <unistd.h>
#endif
double hb_dateSeconds( void )

View File

@@ -5519,13 +5519,6 @@ HB_FUNC( __OPGETPRF ) /* profiler: It returns an array with an opcode called and
}
}
#if defined(HB_OS_WIN_32) && defined(__WATCOMC__)
extern void HB_EXPORT hb_froceLinkMain();
void _hb_froceLinkMain()
{
hb_froceLinkMain();
}
#endif
HB_FUNC( __VMVARSLIST )
{
@@ -5546,3 +5539,27 @@ HB_FUNC( __VMVARSSET )
{
HB_FUNCNAME(HB_DBG_VMVARSSET)();
}
#undef HB_FORCE_LINK_MAIN
#if defined(HB_OS_WIN_32) && !defined(__EXPORT__) && \
( defined(__WATCOMC__) || defined(__MINGW32__) )
# define HB_FORCE_LINK_MAIN hb_forceLinkMainWin
#elif defined(HB_OS_LINUX) && defined(__WATCOMC__)
# define HB_FORCE_LINK_MAIN hb_forceLinkMainStd
#endif
#ifdef HB_FORCE_LINK_MAIN
HB_EXTERN_BEGIN
extern void HB_EXPORT HB_FORCE_LINK_MAIN( void );
HB_EXTERN_END
void _hb_forceLinkMain()
{
HB_FORCE_LINK_MAIN();
}
#endif

View File

@@ -102,13 +102,6 @@
#include "hbmath.h"
#include "hbapicdp.h"
#if defined(__GNUC__) && defined(OS_UNIX_COMPATIBLE)
#define HB_HAS_SNPRINTF
#elif defined(__WATCOMC__)
#define HB_HAS_SNPRINTF
#define snprintf _bprintf
#endif
extern PHB_CODEPAGE hb_cdp_page;
extern char *hb_vm_sNull;
extern char *hb_vm_acAscii[256];
@@ -390,7 +383,7 @@ ULONG HB_EXPORT hb_itemCopyC( PHB_ITEM pItem, char * szBuffer, ULONG ulLen )
if( pItem && HB_IS_STRING( pItem ) )
{
if( ulLen == 0 )
if( ulLen == 0 || ulLen > pItem->item.asString.length )
ulLen = pItem->item.asString.length;
hb_xmemcpy( szBuffer, pItem->item.asString.value, ulLen );
@@ -601,7 +594,7 @@ void * HB_EXPORT hb_itemGetPtr( PHB_ITEM pItem )
{
HB_TRACE(HB_TR_DEBUG, ("hb_itemGetPtr(%p)", pItem));
if( pItem )
if( pItem && HB_IS_POINTER( pItem ) )
return pItem->item.asPointer.value;
else
return NULL;
@@ -1760,11 +1753,7 @@ char * HB_EXPORT hb_itemString( PHB_ITEM pItem, ULONG * ulLen, BOOL * bFreeReq )
buffer = ( char * ) hb_xgrab( size );
do
{
#ifndef HB_HAS_SNPRINTF
n = sprintf( buffer, "%p", hb_itemGetPtr( pItem ) );
#else
n = snprintf( buffer, size, "%p", hb_itemGetPtr( pItem ) );
#endif
if( (n > -1) && (n < size) )
{
bFail = FALSE;

View File

@@ -53,6 +53,7 @@
#include "hbapi.h"
#include "hbvm.h"
HB_EXTERN_BEGIN
#if defined(__MINGW32__)
int _CRT_glob = 0;
#endif
@@ -81,3 +82,8 @@ char ** __crt0_glob_function( char * _arg )
}
#endif
#if defined(HB_OS_LINUX) && defined(__WATCOMC__)
void HB_EXPORT hb_forceLinkMainStd( void ) {}
#endif
HB_EXTERN_END

View File

@@ -56,6 +56,7 @@
#include "hbvm.h"
#if defined(HB_OS_WIN_32)
HB_EXTERN_BEGIN
int argc = 0;
char * argv[ 20 ];
@@ -118,8 +119,10 @@ int WINAPI WinMain( HINSTANCE hInstance, /* handle to current instance */
return 0;
}
#if defined(__WATCOMC__)
void HB_EXPORT hb_froceLinkMain() {}
#if ( defined(__WATCOMC__) || defined(__MINGW32__) ) && !defined(__EXPORT__)
void HB_EXPORT hb_forceLinkMainWin( void ) {}
#endif
HB_EXTERN_END
#endif

View File

@@ -400,14 +400,6 @@ void hb_memvarValueDecGarbageRef( HB_HANDLE hValue )
HB_TRACE(HB_TR_DEBUG, ("hb_memvarValueDecRef(%lu)", hValue));
/* Might be called from hb_gcAll() after hb_memvarsRelease()
* if HB_FM_STATISTICS defined.
*/
if( s_globalTable == NULL )
{
return;
}
pValue = s_globalTable + hValue;
HB_TRACE(HB_TR_INFO, ("Memvar item (%i) decrement refCounter=%li", hValue, pValue->counter-1));