2006-03-10 21:15 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/config/rules.cf
  * harbour/config/bsd/gcc.cf
  * harbour/config/darwin/gcc.cf
  * harbour/config/dos/bcc16.cf
  * harbour/config/dos/djgpp.cf
  * harbour/config/dos/owatcom.cf
  * harbour/config/dos/rsx32.cf
  * harbour/config/dos/watcom.cf
  * harbour/config/linux/gcc.cf
  * harbour/config/os2/gcc.cf
  * harbour/config/os2/icc.cf
  * harbour/config/sunos/gcc.cf
  * harbour/config/w32/bcc32.cf
  * harbour/config/w32/gcc.cf
  * harbour/config/w32/global.cf
  * harbour/config/w32/icc.cf
  * harbour/config/w32/mingw32.cf
  * harbour/config/w32/msvc.cf
  * harbour/config/w32/rsxnt.cf
  * harbour/config/w32/watcom.cf
    * use F macro extension to extract file name from given macros.
      It simplified some rules and allow to use vpath and differ file
      locations in GNU Makefiles
    * moved the BCC16 excpetion for C_RULE from global rules.cf to
      DOS bcc16.cf file
    * use mainstd library in MinGW build

  * harbour/include/hbapi.h
    + added two new functions: hb_winmainArgInit() and hb_winmainArgGet()
      to set/retrieve WinMain() parameters.
    + added hb_strMatchWildExact()

  * harbour/source/pp/ppcore.c
    * initialized variable to avoid compiler warning

  * harbour/source/rtl/console.c
    * cleaned comment

  * harbour/source/rtl/hbffind.c
    ! Fixed invalid handle error in Windows when file() fails
      (fix borrowed from xHarbour)

  * harbour/source/rtl/strmatch.c
    + added hb_strMatchWildExact()
    + added 3-rd parameter <lExact> to WildMatch() - when it's TRUE
      WildMatch() will check if given pattern cover the whole string.
      Without it it check if pattern is valid prefix only.

  * harbour/source/rtl/gtcrs/gtcrs.c
  * harbour/source/rtl/gtcrs/gtcrs.h
  * harbour/source/rtl/gtsln/mousesln.c
    * do not call Gpm_GetSnapshot() to avoid stupid message on stderr
      generated from GPM library - I lost the the hope that it will be
      fixed ;-)

  * harbour/source/rtl/gtpca/gtpca.c
    * use select() in *nixes for cursor position terminal feedback.

  * harbour/source/rtl/gtwin/gtwin.c
    * try to always allocate console when compiled without
      HB_NO_ALLOC_CONSOLE. It allow to use GTWIN also in real windows
      programs.

  + harbour/source/rtl/gtwvt/Makefile
  + harbour/source/rtl/gtwvt/gtwvt.c
  + harbour/source/rtl/gtwvt/gtwvt.h
    + added new GT driver GTWVT - the core of this driver it's Peter Ress
      work in xHarbour. In Harbour GTWVT contains only pure GT code without
      local to GTWVT xHarbour extensions and GTWVT contrib libraries.
      This extensions can be added but later but I want to keep them
      separated from the core GTWVT code and add them as upper level GT
      which can inherit from GTWVT. Just like I've implemented CTWIN.
      Please update non GNU make files and test this GT in Windows.
      The programs which want to use GTWVT should be compiled as standard
      Windows GUI programs. GTWVT replaces window console code.
      if you add to your code:
         proc GTSYS()
         request HB_GT_WIN
         request HB_GT_WVT
         return
      then the final binaries will be linked with both GT drivers and you
      can switch between them using //gt[:]<name> switch. F.e.:
         ./my_prog //gtwin
      or
         ./my_prog //gtwvt
      this feature works in all platforms.
      People who works in shell environment (*nixes, MSYS, DJGPP) and use
      hb* scripts does not have to use GTSYS() in source code but can simply
      use -gt<name> switch in hblnk and hbmk.

  * harbour/source/rtl/gtxwc/gtxwc.c
    * some minor cleanups and code formatting

  * harbour/source/vm/Makefile
  + harbour/source/vm/mainstd/Makefile
    * moved mainstd.c to separate mainstd library for MinGW32 build.
      Unfortunately MinGW always link main() function if it locate
      it in libraries and ignores WinMain() what effectively makes
      impossible to create Windows GUI programs if we have main() in
      VM library. People who are using MinGW and wants to create only
      pure console programs should now include mainstd library to linked
      library list.

  * harbour/source/vm/cmdarg.c
  * harbour/source/vm/mainwin.c
    + added two new functions: hb_winmainArgInit() and hb_winmainArgGet()
      to set/retrieve WinMain() parameters.
This commit is contained in:
Przemyslaw Czerpak
2006-03-10 20:16:35 +00:00
parent 23c07b16d9
commit d8ef95e7be
39 changed files with 2816 additions and 196 deletions

View File

@@ -8,6 +8,115 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
* harbour/makefile.vc
* fixed to force max recurse preprocessor passed bigger then 0
* source/pp/ppcore.c
* suppressed memory access error in getExpReal
+ added missing '.' in valid match markers (ConvertOptional)
2006-03-11 09:45 UTC+0100 Ryszard Glab <rglab//imid.med.pl>
* source/pp/ppcomp.c
* source/pp/ppcore.c
* source/rtl/gtcrs/gtcrs.c
* fixed to suppress warning messages in some compilers
2006-03-10 21:15 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/config/rules.cf
* harbour/config/bsd/gcc.cf
* harbour/config/darwin/gcc.cf
* harbour/config/dos/bcc16.cf
* harbour/config/dos/djgpp.cf
* harbour/config/dos/owatcom.cf
* harbour/config/dos/rsx32.cf
* harbour/config/dos/watcom.cf
* harbour/config/linux/gcc.cf
* harbour/config/os2/gcc.cf
* harbour/config/os2/icc.cf
* harbour/config/sunos/gcc.cf
* harbour/config/w32/bcc32.cf
* harbour/config/w32/gcc.cf
* harbour/config/w32/global.cf
* harbour/config/w32/icc.cf
* harbour/config/w32/mingw32.cf
* harbour/config/w32/msvc.cf
* harbour/config/w32/rsxnt.cf
* harbour/config/w32/watcom.cf
* use F macro extension to extract file name from given macros.
It simplified some rules and allow to use vpath and differ file
locations in GNU Makefiles
* moved the BCC16 excpetion for C_RULE from global rules.cf to
DOS bcc16.cf file
* use mainstd library in MinGW build
* harbour/include/hbapi.h
+ added two new functions: hb_winmainArgInit() and hb_winmainArgGet()
to set/retrieve WinMain() parameters.
+ added hb_strMatchWildExact()
* harbour/source/pp/ppcore.c
* initialized variable to avoid compiler warning
* harbour/source/rtl/console.c
* cleaned comment
* harbour/source/rtl/hbffind.c
! Fixed invalid handle error in Windows when file() fails
(fix borrowed from xHarbour)
* harbour/source/rtl/strmatch.c
+ added hb_strMatchWildExact()
+ added 3-rd parameter <lExact> to WildMatch() - when it's TRUE
WildMatch() will check if given pattern cover the whole string.
Without it it check if pattern is valid prefix only.
* harbour/source/rtl/gtcrs/gtcrs.c
* harbour/source/rtl/gtcrs/gtcrs.h
* harbour/source/rtl/gtsln/mousesln.c
* do not call Gpm_GetSnapshot() to avoid stupid message on stderr
generated from GPM library - I lost the the hope that it will be
fixed ;-)
* harbour/source/rtl/gtpca/gtpca.c
* use select() in *nixes for cursor position terminal feedback.
* harbour/source/rtl/gtwin/gtwin.c
* try to always allocate console when compiled without
HB_NO_ALLOC_CONSOLE. It allow to use GTWIN also in real windows
programs.
+ harbour/source/rtl/gtwvt/Makefile
proc GTSYS()
+ harbour/source/rtl/gtwvt/gtwvt.h
+ added new GT driver GTWVT - the core of this driver it's Peter Ress
work in xHarbour. In Harbour GTWVT contains only pure GT code without
local to GTWVT xHarbour extensions and GTWVT contrib libraries.
This extensions can be added but later but I want to keep them
separated from the core GTWVT code and add them as upper level GT
which can inherit from GTWVT. Just like I've implemented CTWIN.
Please update non GNU make files and test this GT in Windows.
The programs which want to use GTWVT should be compiled as standard
Windows GUI programs. GTWVT replaces window console code.
hb* scripts does not have to use GTSYS() in source code but can simply
use -gt<name> switch in hblnk and hbmk.
request HB_GT_WIN
request HB_GT_WVT
return
then the final binaries will be linked with both GT drivers and you
can switch between them using //gt[:]<name> switch. F.e.:
./my_prog //gtwin
or
./my_prog //gtwvt
this feature works in all platforms.
People who works in shell environment (*nixes, MSYS, DJGPP) and use
hb* scripts does not have to use HB_GTSYS() in source code but can
simply use -gt<name> switch in hblnk and hbmk.
* harbour/source/rtl/gtxwc/gtxwc.c
* some minor cleanups and code formatting
* harbour/source/vm/Makefile
+ harbour/source/vm/mainstd/Makefile
* moved mainstd.c to separate mainstd library for MinGW32 build.
Unfortunately MinGW always link main() function if it locate
it in libraries and ignores WinMain() what effectively makes
impossible to create Windows GUI programs if we have main() in

View File

@@ -66,6 +66,6 @@ LDFLAGS += $(LINKPATHS)
AR = ar
ARFLAGS = $(A_USR)
AR_RULE = $(AR) $(ARFLAGS) r $@ $^ || $(RM) $@
AR_RULE = $(AR) $(ARFLAGS) r $@ $(^F) || $(RM) $@
include $(TOP)$(ROOT)config/rules.cf

View File

@@ -99,13 +99,13 @@ endif
LINKLIBS += -lm
LDFLAGS = $(LINKPATHS)
LD_RULE = $(LD) $(CFLAGS) $(LD_OUT) $@ $^ $(LDFLAGS) $(L_USR) $(LINKLIBS) $(LINKLIBS)
LD_RULE = $(LD) $(CFLAGS) $(LD_OUT) $@ $(^F) $(LDFLAGS) $(L_USR) $(LINKLIBS) $(LINKLIBS)
#AR = ar
#ARFLAGS = $(A_USR)
#AR_RULE = $(AR) $(ARFLAGS) r $@ $^ || $(RM) $@
#AR_RULE = $(AR) $(ARFLAGS) r $@ $(^F) || $(RM) $@
LIBTOOL = libtool
LIBTOOLFLAGS = $(LIBTOOL_USR)
AR_RULE = $(LIBTOOL) -static $(LIBTOOLFLAGS) -o $@ $^ || $(RM) $@
AR_RULE = $(LIBTOOL) -static $(LIBTOOLFLAGS) -o $@ $(^F) || $(RM) $@
RANLIB = ranlib
include $(TOP)$(ROOT)config/rules.cf

View File

@@ -27,6 +27,10 @@ CC_OUT = -o
CPPFLAGS = -I$($(HB_ARCHITECTURE)_$(HB_COMPILER)_GRANDP) -I$(_HB_INC_COMPILE)
CFLAGS = -i48 -O2 -mh -d -DHB_LONG_LONG_OFF
# BCC (at least version 3.1) requires that the output file be listed ahead of the input file
CC_RULE = $(CC) $(CPPFLAGS) $(CFLAGS) $(C_USR) $(CC_OUT)$(?F:.c=$(OBJ_EXT)) $(CC_IN) $?
#Note: The empty line below HAVE TO exist!
define link_file
echo. $(file) >> __link__.tmp
@@ -36,7 +40,7 @@ endef
define link_exe_file
echo. $(LDFLAGS) -e$@ > __link__.tmp
$(foreach file, $^, $(link_file))
$(foreach file, $(^F), $(link_file))
$(foreach file, $(LINKLIBS), $(link_file))
-$(LD) @__link__.tmp
endef
@@ -79,7 +83,7 @@ endef
define create_library
echo. $@ &> __lib__.tmp
$(foreach file, $^, $(lib_object))
$(foreach file, $(^F), $(lib_object))
echo. ,, >> __lib__.tmp
$(AR) $(ARFLAGS) @__lib__.tmp
del __lib__.tmp

View File

@@ -58,7 +58,7 @@ endef
# in commmand line
define create_library
echo. CREATE $@ > __lib__.tmp
$(foreach file, $^, $(lib_object))
$(foreach file, $(^F), $(lib_object))
echo. SAVE >> __lib__.tmp
echo. END >> __lib__.tmp
$(AR) $(ARFLAGS) -M < __lib__.tmp
@@ -72,7 +72,7 @@ endef
define link_exe_file
echo. $(LDFLAGS) $(L_USR) $(LD_OUT)$@ > __link__.tmp
$(foreach file, $^, $(link_file))
$(foreach file, $(^F), $(link_file))
$(foreach file, $(LINKPATHS), $(link_file))
echo. -Wl,--start-group >> __link__.tmp
$(foreach file, $(LINKLIBS), $(link_file))

View File

@@ -56,7 +56,7 @@ endef
define link_exe_file
echo. $(LDFLAGS) NAME $@ > __link__.tmp
$(foreach file, $^, $(link_file))
$(foreach file, $(^F), $(link_file))
$(foreach lib, $(HB_USER_LIBS), $(link_lib))
$(foreach lib, $(LINKLIBS), $(link_lib))
$(foreach lib, $(RDDLIBS), $(link_lib))
@@ -103,7 +103,7 @@ endef
define create_library
echo. $@ > __lib__.tmp
$(foreach file, $^, $(lib_object))
$(foreach file, $(^F), $(lib_object))
$(AR) $(ARFLAGS) @__lib__.tmp
endef

View File

@@ -65,6 +65,6 @@ LDFLAGS += $(LINKPATHS)
AR = ar
ARFLAGS = $(A_USR)
AR_RULE = $(AR) $(ARFLAGS) r $@ $^ || $(RM) $@
AR_RULE = $(AR) $(ARFLAGS) r $@ $(^F) || $(RM) $@
include $(TOP)$(ROOT)config/rules.cf

View File

@@ -34,7 +34,7 @@ endef
define link_exe_file
$(COMSPEC) /E:2048 /Cecho $(LDFLAGS) NAME $@ > __link__.tmp
$(foreach file, $^, $(link_file))
$(foreach file, $(^F), $(link_file))
$(foreach lib, $(LINKLIBS), $(link_lib))
$(foreach lib, $(RDDLIBS), $(link_lib))
$(foreach lib, $(GTLIBS), $(link_lib))
@@ -69,13 +69,12 @@ endef
define create_library
$(COMSPEC) /E:2048 /Cecho $@ > __lib__.tmp
$(foreach file, $^, $(lib_object))
$(foreach file, $(^F), $(lib_object))
$(AR) $(ARFLAGS) @__lib__.tmp
endef
AR = wlib
ARFLAGS = -p=32 -c $(A_USR)
AR_RULE = $(create_library)
include $(TOP)$(ROOT)config/rules.cf

View File

@@ -112,6 +112,6 @@ LDFLAGS = $(LINKPATHS)
AR = ar
ARFLAGS = $(A_USR)
AR_RULE = $(AR) $(ARFLAGS) cr $@ $^ || $(RM) $@
AR_RULE = $(AR) $(ARFLAGS) cr $@ $(^F) || $(RM) $@
include $(TOP)$(ROOT)config/rules.cf

View File

@@ -80,7 +80,7 @@ LDFLAGS += $(LINKPATHS)
ifeq ($(C_MAIN),)
ifeq ($(HB_GT_LIB),os2pm)
# Override the default link rule in order to add a call to emxbind
LD_RULE = $(LD) $(CFLAGS) $(LD_OUT)$@ $^ $(LDFLAGS) $(L_USR) $(LINKLIBS) & emxbind -ep $@
LD_RULE = $(LD) $(CFLAGS) $(LD_OUT)$@ $(^F) $(LDFLAGS) $(L_USR) $(LINKLIBS) & emxbind -ep $@
endif
endif
@@ -96,7 +96,7 @@ endef
define create_library
IF EXIST $@ $(RM) $@
echo CREATE $@ > __lib__.tmp
$(foreach file, $^, $(lib_object))
$(foreach file, $(^F), $(lib_object))
echo SAVE >> __lib__.tmp
echo END >> __lib__.tmp
$(AR) -M < __lib__.tmp

View File

@@ -67,7 +67,7 @@ endif
AR = ilib
ARFLAGS = /NOE /NOIgnoreCase $(A_USR)
AROBJS = $(foreach file, $^, -+$(file))
AROBJS = $(foreach file, $(^F), -+$(file))
AR_RULE = $(AR) $(ARFLAGS) $@ $(AROBJS),,
include $(TOP)$(ROOT)config/rules.cf

View File

@@ -25,9 +25,16 @@ HB_FLAGS = -n -q0 -w -es2 -gc0 -I$(TOP) -I$(HB_INC_COMPILE)
# The rule to link an executable.
ifeq ($(LD_RULE),)
# Use default rule if architecture/compiler specific rule is not defined
LD_RULE = $(LD) $(CFLAGS) $(LD_OUT)$@ $^ $(LDFLAGS) $(L_USR) $(LINKLIBS)
LD_RULE = $(LD) $(CFLAGS) $(LD_OUT)$@ $(^F) $(LDFLAGS) $(L_USR) $(LINKLIBS)
endif
# The rule to compile a C source file.
ifeq ($(CC_RULE),)
# Use default rule if architecture/compiler specific rule is not defined
CC_RULE = $(CC) $(CPPFLAGS) $(CFLAGS) $(C_USR) $(CC_IN) $? $(CC_OUT)$(?F:.c=$(OBJ_EXT))
endif
# Eliminate these rules.
%.c : %.y
@@ -42,24 +49,13 @@ ifeq ($(SOURCE_DIR),)
SOURCE_DIR = $(GRANDP)
endif
# BCC (at least version 3.1) requires that the output file be listed ahead of the input file
ifeq ($(CC),bcc)
# Rule to generate an object file from a C source file in the parent.
%$(OBJ_EXT) : $(SOURCE_DIR)%.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(C_USR) $(CC_OUT)$(subst .c,$(OBJ_EXT),$(subst $(SOURCE_DIR),,$?)) $(CC_IN) $?
$(CC_RULE)
# Rule to generate an object file from a C source file.
%$(OBJ_EXT) : %.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(C_USR) $(CC_OUT)$(?:.c=$(OBJ_EXT)) $(CC_IN) $?
else
# Rule to generate an object file from a C source file in the parent.
%$(OBJ_EXT) : $(SOURCE_DIR)%.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(C_USR) $(CC_IN) $? $(CC_OUT)$(subst .c,$(OBJ_EXT),$(subst $(SOURCE_DIR),,$?))
# Rule to generate an object file from a C source file.
%$(OBJ_EXT) : %.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(C_USR) $(CC_IN) $? $(CC_OUT)$(?:.c=$(OBJ_EXT))
endif
$(CC_RULE)
# Rule to generate an executable file from an object file.
%$(EXE_EXT) : %$(OBJ_EXT)

View File

@@ -91,6 +91,6 @@ LDFLAGS = $(LINKPATHS)
AR = ar
ARFLAGS = $(A_USR)
AR_RULE = $(AR) $(ARFLAGS) cr $@ $^ || $(RM) $@
AR_RULE = $(AR) $(ARFLAGS) cr $@ $(^F) || $(RM) $@
include $(TOP)$(ROOT)config/rules.cf

View File

@@ -81,7 +81,7 @@ LDFLAGS = $(LINKPATHS)
AR = tlib
ARFLAGS = $(A_USR)
AROBJS = $(foreach file, $^, -+$(file))
AROBJS = $(foreach file, $(^F), -+$(file))
AR_RULE = $(AR) $(ARFLAGS) $@ $(AROBJS),,
include $(TOP)$(ROOT)config/rules.cf

View File

@@ -79,6 +79,6 @@ LDFLAGS = $(LINKPATHS)
AR = ar
ARFLAGS = $(A_USR)
AR_RULE = $(AR) $(ARFLAGS) r $@ $^ || $(RM) $@
AR_RULE = $(AR) $(ARFLAGS) r $@ $(^F) || $(RM) $@
include $(TOP)$(ROOT)config/rules.cf

View File

@@ -9,6 +9,7 @@ HB_GT_LIBS=\
gtpca \
gtstd \
gtwin \
gtwvt \
# gtcrs \
# gtsln \

View File

@@ -38,7 +38,7 @@ endef
define link_exe_file
echo $(LDFLAGS) -Fe$@ > __link__.tmp
$(foreach file, $^, $(link_file))
$(foreach file, $(^F), $(link_file))
echo $(LINKLIBS) >> __link__.tmp
-$(LD) @__link__.tmp
endef
@@ -57,7 +57,7 @@ endef
define create_library
echo $@ > __lib__.tmp
$(foreach file, $^, $(lib_object))
$(foreach file, $(^F), $(lib_object))
$(AR) @__lib__.tmp
del __lib__.tmp
endef

View File

@@ -42,6 +42,16 @@ LINKPATHS += $(foreach drv, $(HB_DB_DRIVERS), -L$(TOP)$(ROOT)source/rdd/$(drv)/$
LINKLIBS += $(foreach drv, $(HB_DB_DRIVERS), -l$(drv))
endif
# Add the standard C main() entry
ifeq ($(HB_MAIN),std)
ifeq ($(findstring vm,$(LIBS)),vm)
ifneq ($(HB_GT_LIB),gtwvt)
LINKPATHS += -L$(TOP)$(ROOT)source/vm/mainstd/$(HB_ARCH)
LINKLIBS += -lmainstd
endif
endif
endif
# Add the specified GT driver library
ifeq ($(findstring rtl,$(LIBS)),rtl)
LINKPATHS += -L$(TOP)$(ROOT)source/rtl/$(HB_GT_LIB)/$(HB_ARCH)
@@ -87,7 +97,7 @@ endef
# in commmand line
define create_library
echo. CREATE $@ > __lib__.tmp
$(foreach file, $^, $(lib_object))
$(foreach file, $(^F), $(lib_object))
echo. SAVE >> __lib__.tmp
echo. END >> __lib__.tmp
$(AR) $(ARFLAGS) -M < __lib__.tmp
@@ -101,7 +111,7 @@ endef
define link_exe_file
echo. $(LDFLAGS) $(L_USR) $(LD_OUT)$@ > __link__.tmp
$(foreach file, $^, $(link_file))
$(foreach file, $(^F), $(link_file))
$(foreach file, $(LINKPATHS), $(link_file))
$(foreach file, $(LINKLIBS), $(link_file))
-$(LD) @__link__.tmp
@@ -118,7 +128,7 @@ ifeq ($(SHLVL),) # COMMAND.COM - length of command line is limited
AR_RULE = $(create_library)
LD_RULE = $(link_exe_file)
else
AR_RULE = $(AR) $(ARFLAGS) cr $@ $^ && $(RANLIB) $@ || $(RM) $@
AR_RULE = $(AR) $(ARFLAGS) cr $@ $(^F) && $(RANLIB) $@ || $(RM) $@
endif
include $(TOP)$(ROOT)config/rules.cf

View File

@@ -44,6 +44,6 @@ LDFLAGS = $(LINKPATHS)
AR = lib.exe
ARFLAGS = $(A_USR)
AR_RULE = $(AR) $(ARFLAGS) /out:$@ $^ || $(RM) $@
AR_RULE = $(AR) $(ARFLAGS) /out:$@ $(^F) || $(RM) $@
include $(TOP)$(ROOT)config/rules.cf

View File

@@ -78,6 +78,6 @@ LDFLAGS += $(LINKPATHS)
AR = ar
ARFLAGS = $(A_USR)
AR_RULE = $(AR) $(ARFLAGS) r $@ $^ || $(RM) $@
AR_RULE = $(AR) $(ARFLAGS) r $@ $(^F) || $(RM) $@
include $(TOP)$(ROOT)config/rules.cf

View File

@@ -41,7 +41,7 @@ endef
define link_exe_file
echo $(LDFLAGS) NAME $@ > __link__.tmp
echo LIB kernel32.lib, user32.lib, winspool.lib, oleaut32.lib, uuid.lib >> __link__.tmp
$(foreach file, $^, $(link_file))
$(foreach file, $(^F), $(link_file))
$(foreach lib, $(LINKLIBS), $(link_lib))
$(foreach lib, $(RDDLIBS), $(link_lib))
$(foreach lib, $(GTLIBS), $(link_lib))
@@ -80,7 +80,7 @@ endef
define create_library
echo $@ > __lib__.tmp
$(foreach file, $^, $(lib_object))
$(foreach file, $(^F), $(lib_object))
$(AR) $(ARFLAGS) @__lib__.tmp
endef

View File

@@ -487,7 +487,8 @@ extern HB_EXPORT BOOL hb_strToNum( const char* szNum, HB_LONG * plVal, doubl
extern HB_EXPORT BOOL hb_strnToNum( const char* szNum, ULONG ulLen, HB_LONG * plVal, double * pdVal ); /* converts string to number, returns TRUE if results is double */
extern HB_EXPORT BOOL hb_strMatchRegExp( const char * szString, const char * szMask ); /* compare two strings using a regular expression pattern */
extern HB_EXPORT BOOL hb_strMatchWild(const char *szString, const char *szPattern ); /* compare two strings using pattern with wildcard (?*) */
extern HB_EXPORT BOOL hb_strMatchWild(const char *szString, const char *szPattern ); /* compare two strings using pattern with wildcard (?*) - patern have to be prefix of given string */
extern HB_EXPORT BOOL hb_strMatchWildExact( const char *szString, const char *szPattern ); /* compare two strings using pattern with wildcard (?*) - patern have to cover whole string */
extern HB_EXPORT BOOL hb_strEmpty( const char * szText, ULONG ulLen ); /* returns whether a string contains only white space */
extern HB_EXPORT void hb_strDescend( char * szStringTo, const char * szStringFrom, ULONG ulLen ); /* copy a string to a buffer, inverting each character */
extern HB_EXPORT ULONG hb_strAt( const char * szSub, ULONG ulSubLen, const char * szText, ULONG ulLen ); /* returns an index to a sub-string within another string */
@@ -555,13 +556,17 @@ extern HB_EXPORT void hb_dynsymSetAreaHandle( PHB_DYNS pDynSym, int iArea )
/* Command line and environment argument management */
extern HB_EXPORT void hb_cmdargInit( int argc, char * argv[] ); /* initialize command line argument API's */
extern int hb_cmdargARGC( void ); /* retrieve command line argument count */
extern char ** hb_cmdargARGV( void ); /* retrieve command line argument buffer pointer */
extern BOOL hb_cmdargIsInternal( const char * szArg ); /* determine if a string is an internal setting */
extern BOOL hb_cmdargCheck( const char * pszName ); /* Check if a given internal switch (like //INFO) was set */
extern char * hb_cmdargString( const char * pszName ); /* Returns the string value of an internal switch (like //TEMPPATH:"C:\") */
extern int hb_cmdargNum( const char * pszName ); /* Returns the numeric value of an internal switch (like //F:90) */
extern ULONG hb_cmdargProcessVM( int*, int* ); /* Check for command line internal arguments */
extern int hb_cmdargARGC( void ); /* retrieve command line argument count */
extern char ** hb_cmdargARGV( void ); /* retrieve command line argument buffer pointer */
extern BOOL hb_cmdargIsInternal( const char * szArg ); /* determine if a string is an internal setting */
extern BOOL hb_cmdargCheck( const char * pszName ); /* Check if a given internal switch (like //INFO) was set */
extern char * hb_cmdargString( const char * pszName ); /* Returns the string value of an internal switch (like //TEMPPATH:"C:\") */
extern int hb_cmdargNum( const char * pszName ); /* Returns the numeric value of an internal switch (like //F:90) */
extern ULONG hb_cmdargProcessVM( int*, int* ); /* Check for command line internal arguments */
#if defined( HB_OS_WIN_32 ) && defined( HB_OS_WIN_32_USED )
extern HB_EXPORT void hb_winmainArgInit( HANDLE hInstance, HANDLE hPrevInstance, int iCmdShow ); /* Set WinMain() parameters */
extern HB_EXPORT BOOL hb_winmainArgGet( HANDLE * phInstance, HANDLE * phPrevInstance, int * piCmdShow ); /* Retrieve WinMain() parameters */
#endif
/* Symbol management */
extern PHB_SYMB hb_symbolNew( char * szName ); /* create a new symbol */

View File

@@ -783,7 +783,7 @@ static int ParseIfdef( char * sLine, int usl )
{
char defname[ MAX_NAME ];
DEFINES * stdef;
int len;
int len = 0;
HB_TRACE(HB_TR_DEBUG, ("ParseIfdef(%s, %d)", sLine, usl));

View File

@@ -153,7 +153,7 @@ void hb_conRelease( void )
* have to be restored on exit then it should does it in its Exit()
* method. Here we cannot force any actions because it may cause bad
* results in some GTs, f.e. when the screen size is controlled by remote
* user and not xHarbour application (some terminal modes), [Druzus]
* user and not Harbour application (some terminal modes), [Druzus]
*/
hb_setkeyExit(); /* April White, May 6, 2000 */

View File

@@ -121,7 +121,7 @@ typedef struct InOutBase {
char *acsc, *beep, *flash, *civis, *cnorm, *cvvis;
int is_mouse;
int mouse_type;
int mButtons;
int nTermMouseChars;
unsigned char cTermMouseBuf[3];
@@ -1186,31 +1186,34 @@ static void flush_gpmevt( mouseEvent * mEvt )
}
#endif
static void disp_mousecursor( InOutBase * ioBase )
{
#ifdef HAVE_GPM_H
if ( ioBase->mouse_type == MOUSE_GPM && gpm_visiblepointer )
{
Gpm_DrawPointer( ioBase->mLastEvt.col, ioBase->mLastEvt.row,
gpm_consolefd );
}
#endif
}
static void mouse_init( InOutBase * ioBase )
{
if ( ioBase->terminal_type == TERM_XTERM )
{
/* save old hilit tracking & enable mouse tracking */
write_ttyseq( ioBase, "\033[?1001s\033[?1002h" );
ioBase->is_mouse = 1;
ioBase->mouse_type = MOUSE_XTERM;
memset( ( void * ) &ioBase->mLastEvt, 0, sizeof( ioBase->mLastEvt ) );
ioBase->mLastEvt.click_delay = DBLCLK_DELAY;
/* curses mouse buttons check */
ioBase->mButtons = tigetnum( "btns" );
if ( ioBase->mButtons < 1 )
ioBase->mButtons = 2;
ioBase->mButtons = 3;
}
#ifdef HAVE_GPM_H
else if ( ioBase->terminal_type == TERM_LINUX )
{
#ifdef HB_GPM_NOICE_DISABLE
int iNull, iErr;
iErr = dup( 2 );
iNull = open( "/dev/null", O_RDWR );
dup2( iNull, 2 );
close( iNull );
#endif
ioBase->Conn.eventMask =
GPM_MOVE | GPM_DRAG | GPM_UP | GPM_DOWN | GPM_DOUBLE;
/* give me move events but handle them anyway */
@@ -1218,43 +1221,47 @@ static void mouse_init( InOutBase * ioBase )
/* only pure mouse events, no Ctrl,Alt,Shft events */
ioBase->Conn.minMod = ioBase->Conn.maxMod = 0;
gpm_zerobased = 1;
gpm_visiblepointer = 1;
gpm_visiblepointer = 0;
if ( Gpm_Open( &ioBase->Conn, 0 ) >= 0 && gpm_fd >= 0 )
{
ioBase->is_mouse = 1;
int flags;
if ( ( flags = fcntl( gpm_fd, F_GETFL, 0 ) ) != -1 )
fcntl( gpm_fd, F_SETFL, flags | O_NONBLOCK );
ioBase->mouse_type = MOUSE_GPM;
memset( ( void * ) &ioBase->mLastEvt, 0, sizeof( ioBase->mLastEvt ) );
ioBase->mLastEvt.click_delay = DBLCLK_DELAY;
flush_gpmevt( &ioBase->mLastEvt );
add_efds( ioBase, gpm_fd, O_RDONLY, set_gpmevt,
( void * ) &ioBase->mLastEvt );
/*
* In recent GPM versions it produce unpleasure noice on the screen
* so I covered it with this macro, [druzus]
*/
#ifdef HB_GPM_USE_XTRA
ioBase->mButtons = Gpm_GetSnapshot( NULL );
if ( gpm_visiblepointer )
Gpm_DrawPointer( ioBase->mLastEvt.col, ioBase->mLastEvt.row,
gpm_consolefd );
}
#ifdef HB_GPM_NOICE_DISABLE
dup2( iErr, 2 );
close( iErr );
#else
ioBase->mButtons = 3;
#endif
}
}
#endif
}
static void mouse_exit( InOutBase * ioBase )
{
if ( ioBase->terminal_type == TERM_XTERM )
if ( ioBase->mouse_type == MOUSE_XTERM )
{
/* disable mouse tracking & restore old hilit tracking */
write_ttyseq( ioBase, "\033[?1002l\033[?1001r" );
}
#ifdef HAVE_GPM_H
else if ( ioBase->terminal_type == TERM_LINUX )
else if ( ioBase->mouse_type == MOUSE_GPM && gpm_fd >= 0 )
{
if ( ioBase->is_mouse && gpm_fd >= 0 )
{
del_efds( ioBase, gpm_fd );
Gpm_Close();
}
del_efds( ioBase, gpm_fd );
Gpm_Close();
}
#endif
}
@@ -1343,12 +1350,7 @@ static void gt_refresh( InOutBase * ioBase )
wmove( ioBase->stdscr, ioBase->row, ioBase->col );
wrefresh( ioBase->stdscr );
disp_cursor( ioBase );
#ifdef HAVE_GPM_H
if ( ioBase->is_mouse && ioBase->terminal_type == TERM_LINUX )
if ( gpm_visiblepointer )
Gpm_DrawPointer( ioBase->mLastEvt.col, ioBase->mLastEvt.row,
gpm_consolefd );
#endif
disp_mousecursor( ioBase );
}
}
@@ -2642,7 +2644,7 @@ static BOOL hb_gt_crs_mouse_IsPresent( void )
{
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_IsPresent()" ) );
return s_ioBase->is_mouse;
return s_ioBase->mouse_type != 0;
}
/* *********************************************************************** */
@@ -2652,13 +2654,10 @@ static void hb_gt_crs_mouse_Show( void )
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_Show()" ) );
#ifdef HAVE_GPM_H
if( s_ioBase->terminal_type == TERM_LINUX && s_ioBase->is_mouse )
{
if( s_ioBase->mouse_type == MOUSE_GPM )
gpm_visiblepointer = 1;
Gpm_DrawPointer( s_ioBase->mLastEvt.col, s_ioBase->mLastEvt.row,
gpm_consolefd );
}
#endif
disp_mousecursor( s_ioBase );
}
/* *********************************************************************** */
@@ -2668,7 +2667,7 @@ static void hb_gt_crs_mouse_Hide( void )
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_Hide()" ) );
#ifdef HAVE_GPM_H
if( s_ioBase->terminal_type == TERM_LINUX && s_ioBase->is_mouse )
if( s_ioBase->mouse_type == MOUSE_GPM )
{
gpm_visiblepointer = 0;
}
@@ -2694,11 +2693,7 @@ static void hb_gt_crs_mouse_SetPos( int iRow, int iCol )
/* it does really nothing */
s_ioBase->mLastEvt.col = iCol;
s_ioBase->mLastEvt.row = iRow;
#ifdef HAVE_GPM_H
if( s_ioBase->terminal_type == TERM_LINUX && s_ioBase->is_mouse )
if( gpm_visiblepointer )
Gpm_DrawPointer( iCol, iRow, gpm_consolefd );
#endif
disp_mousecursor( s_ioBase );
}
/* *********************************************************************** */
@@ -2709,7 +2704,7 @@ static BOOL hb_gt_crs_mouse_ButtonState( int iButton )
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_mouse_ButtonState(%i)", iButton ) );
if( s_ioBase->is_mouse )
if( s_ioBase->mouse_type != 0 )
{
int mask;

View File

@@ -144,9 +144,13 @@ extern int hb_gt_crs_chrmapinit( int *piTransTbl, char *pszTerm );
#define EVTFDSTAT_STOP 0x02
#define EVTFDSTAT_DEL 0x03
#define CTRL_SEQ "\036"
#define ALT_SEQ "\037"
//#define NATION_SEQ "\016"
#define CTRL_SEQ "\036"
#define ALT_SEQ "\037"
/*#define NATION_SEQ "\016"*/
#define MOUSE_NONE 0
#define MOUSE_GPM 1
#define MOUSE_XTERM 2
#define K_UNDEF 0x10000
#define K_METAALT 0x10001

View File

@@ -206,30 +206,73 @@ static void hb_gt_pca_AnsiSetAutoMargin( int iAM )
static void hb_gt_pca_AnsiGetCurPos( int * iRow, int * iCol )
{
static BOOL s_fIsAnswer = TRUE;
HB_TRACE(HB_TR_DEBUG, ("hb_gt_pca_AnsiGetCurPos(%p, %p)", iRow, iCol));
if( s_bStdinConsole && s_bStdoutConsole )
if( s_fIsAnswer && s_bStdinConsole && s_bStdoutConsole )
{
USHORT ch, value = 0, index = 0;
hb_gt_pca_termOut( ( BYTE * ) "\x1B[6n", 4 );
hb_gt_pca_termFlush();
do
#ifdef OS_UNIX_COMPATIBLE
{
ch = getc( stdin );
if( isdigit( ch ) )
char rdbuf[ 64 ];
int i, n, y, x;
struct timeval tv;
fd_set rdfds;
FD_ZERO( &rdfds );
FD_SET( s_hFilenoStdin, &rdfds );
tv.tv_sec = 2;
tv.tv_usec = 0;
*iRow = *iCol = -1;
n = 0;
s_fIsAnswer = FALSE;
while( select( s_hFilenoStdin + 1, &rdfds, NULL, NULL, &tv ) > 0 )
{
value = ( value * 10 ) + ( ch - '0' );
}
else if( ch == ';' )
{
*iRow = value - 1;
value = 0;
i = read( s_hFilenoStdin, rdbuf + n, sizeof( rdbuf ) - 1 - n );
if( i <= 0 )
break;
n += i;
if( n >= 6 )
{
rdbuf[ n ] = '\0';
if( sscanf( rdbuf, "\033[%d;%dR", &y, &x ) == 2 )
{
*iRow = y;
*iCol = x;
s_fIsAnswer = TRUE;
break;
}
}
}
if( !s_fIsAnswer )
*iRow = *iCol = -1;
}
while( ch != 'R' && index < 10 );
*iCol = value - 1;
#else
{
USHORT ch, value = 0, index = 0;
do
{
ch = getc( stdin );
if( isdigit( ch ) )
{
value = ( value * 10 ) + ( ch - '0' );
}
else if( ch == ';' )
{
*iRow = value - 1;
value = 0;
}
}
while( ch != 'R' && index < 10 );
*iCol = value - 1;
s_fIsAnswer = ch == 'R' && *iCol != -1 && *iRow != -1;
}
#endif
}
}

View File

@@ -343,8 +343,8 @@ void hb_gt_sln_mouse_Init( void )
s_iMouseButtons = SLtt_tgetnum( "BT" );
/* force two buttons mouse under xterm */
if( s_iMouseButtons == -1 )
s_iMouseButtons = 2;
if( s_iMouseButtons < 1 )
s_iMouseButtons = 3;
s_bMousePresent = TRUE;
}
@@ -378,7 +378,15 @@ void hb_gt_sln_mouse_Init( void )
s_iMouseCol = Evt.x;
}
/*
* In recent GPM versions it produce unpleasure noice on the screen
* so I covered it with this macro, [druzus]
*/
#ifdef HB_GPM_USE_XTRA
s_iMouseButtons = Gpm_GetSnapshot( NULL );
#else
s_iMouseButtons = 3;
#endif
hb_gt_sln_mouse_FixTrash();
}
#ifdef HB_GPM_NOICE_DISABLE

View File

@@ -662,20 +662,18 @@ static void hb_gt_win_Init( FHANDLE hFilenoStdin, FHANDLE hFilenoStdout, FHANDLE
if( ( s_HInput = GetStdHandle( STD_INPUT_HANDLE ) ) == INVALID_HANDLE_VALUE )
{
#ifdef HB_ALLOC_CONSOLE
AllocConsole(); /* It is a Windows app without a console, so we create one */
s_HInput = GetStdHandle( STD_INPUT_HANDLE );
if( s_HInput == INVALID_HANDLE_VALUE )
{
hb_errInternal( 10001, "Can't allocate console", "", "" );
}
#else
if( hb_dynsymFindName( "__DBGENTRY" ) ) /* the debugger is linked */
#ifdef HB_NO_ALLOC_CONSOLE
/* allocate console only when debugger is linked */
if( hb_dynsymFindName( "__DBGENTRY" ) )
#endif
{
AllocConsole(); /* It is a Windows app without a console, so we create one */
s_HInput = GetStdHandle( STD_INPUT_HANDLE );
}
#endif
if( s_HInput == INVALID_HANDLE_VALUE )
{
hb_errInternal( 10001, "Can't allocate console", "", "" );
}
}
HB_GTSUPER_INIT( hFilenoStdin, hFilenoStdout, hFilenoStderr );
@@ -1558,7 +1556,7 @@ static void hb_gt_win_Tone( double dFrequency, double dDuration )
/*
* According to the Clipper NG, the duration in 'ticks' is truncated to the
* interger portion ... Depending on the platform, xHarbour allows a finer
* interger portion ... Depending on the platform, Harbour allows a finer
* resolution, but the minimum is 1 tick (for compatibility)
*/
/* Convert from ticks to seconds */

View File

@@ -0,0 +1,12 @@
#
# $Id$
#
ROOT = ../../../
C_SOURCES=\
gtwvt.c \
LIBNAME=gtwvt
include $(TOP)$(ROOT)config/lib.cf

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,162 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Header File for Video subsystem for Win32 using GUI windows instead of Console
* Copyright 2003 Peter Rees <peter@rees.co.nz>
* Rees Software & Systems Ltd
* 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.
*
*/
#ifndef HB_WVT_H_
#define HB_WVT_H_
#define HB_GT_NAME WVT
/* #define WVT_DEBUG */
#include <windows.h>
/*#include <winuser.h>*/
/*#include <commctrl.h>*/
#include "hbset.h"
#include "hbgtcore.h"
#include "hbinit.h"
#include "hbapierr.h"
#include "hbapiitm.h"
#include "inkey.ch"
#include "error.ch"
#include "hbvm.h"
#include "hbgfxdef.ch"
#define WVT_CHAR_QUEUE_SIZE 128
#define WVT_MAX_ROWS 256
#define WVT_MAX_COLS 256
#define WVT_DEFAULT_ROWS 25
#define WVT_DEFAULT_COLS 80
#define BLACK RGB( 0x0 ,0x0 ,0x0 )
#define BLUE RGB( 0x0 ,0x0 ,0x85 )
#define GREEN RGB( 0x0 ,0x85,0x0 )
#define CYAN RGB( 0x0 ,0x85,0x85 )
#define RED RGB( 0x85,0x0 ,0x0 )
#define MAGENTA RGB( 0x85,0x0 ,0x85 )
#define BROWN RGB( 0x85,0x85,0x0 )
#define WHITE RGB( 0xC6,0xC6,0xC6 )
#define LIGHT_GRAY RGB( 0x60,0x60,0x60 )
#define BRIGHT_BLUE RGB( 0x00,0x00,0xFF )
#define BRIGHT_GREEN RGB( 0x60,0xFF,0x60 )
#define BRIGHT_CYAN RGB( 0x60,0xFF,0xFF )
#define BRIGHT_RED RGB( 0xF8,0x00,0x26 )
#define BRIGHT_MAGENTA RGB( 0xFF,0x60,0xFF )
#define YELLOW RGB( 0xFF,0xFF,0x00 )
#define BRIGHT_WHITE RGB( 0xFF,0xFF,0xFF )
#define WM_MY_UPDATE_CARET ( WM_USER + 0x0101 )
typedef struct global_data
{
USHORT ROWS; /* number of displayable rows in window */
USHORT COLS; /* number of displayable columns in window */
COLORREF foreground; /* forground colour */
COLORREF background; /* background colour */
BOOL CaretExist; /* TRUE if a caret has been created */
BOOL CaretHidden; /* TRUE if a caret has been hiden */
int CaretSize; /* Size of solid caret */
POINT mousePos; /* the last mouse position */
BOOL MouseMove; /* Flag to say whether to return mouse movement events */
int Keys[ WVT_CHAR_QUEUE_SIZE ]; /* Array to hold the characters & events */
int keyPointerIn; /* Offset into key array for character to be placed */
int keyPointerOut; /* Offset into key array of next character to read */
int keyLast; /* last inkey code value in buffer */
POINT PTEXTSIZE; /* size of the fixed width font */
BOOL FixedFont; /* TRUE if current font is a fixed font */
int FixedSize[ WVT_MAX_COLS ]; /* buffer for ExtTextOut() to emulate fixed pitch when Proportional font selected */
int fontHeight; /* requested font height */
int fontWidth ; /* requested font width */
int fontWeight; /* Bold level */
int fontQuality; /* requested font quality */
char fontFace[ LF_FACESIZE ]; /* requested font face name LF_FACESIZE #defined in wingdi.h */
HFONT hFont; /* current font handle */
HWND hWnd; /* the window handle */
HDC hdc; /* Handle to Windows Device Context */
int CodePage; /* Code page to use for display characters */
BOOL Win9X; /* Flag to say if running on Win9X not NT/2000/XP */
BOOL AltF4Close; /* Can use Alt+F4 to close application */
BOOL CentreWindow; /* True if window is to be Reset into centre of window */
BOOL fIgnoreWM_SYSCHAR;
} GLOBAL_DATA;
typedef GLOBAL_DATA * LPGLOBAL_DATA;
/* Harbour compatible definitions */
#define K_SH_LEFT K_LEFT /* Shift-Left == Left */
#define K_SH_UP K_UP /* Shift-Up == Up */
#define K_SH_RIGHT K_RIGHT /* Shift-Right == Right */
#define K_SH_DOWN K_DOWN /* Shift-Down == Down */
#define K_SH_INS K_INS /* Shift-Ins == Ins */
#define K_SH_DEL K_DEL /* Shift-Del == Del */
#define K_SH_HOME K_HOME /* Shift-Home == Home */
#define K_SH_END K_END /* Shift-End == End */
#define K_SH_PGUP K_PGUP /* Shift-PgUp == PgUp */
#define K_SH_PGDN K_PGDN /* Shift-PgDn == PgDn */
#define K_SH_RETURN K_RETURN /* Shift-Enter == Enter */
#define K_SH_ENTER K_ENTER /* Shift-Enter == Enter */
#ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0x020A
#endif
#endif /* HB_WVT_H_ */

View File

@@ -2818,18 +2818,21 @@ static void hb_gt_xwc_ProcessMessages( PXWND_DEF wnd )
{
XEvent evt;
if( s_cursorBlinkRate == 0 )
if( wnd->cursorType != SC_NONE )
{
s_cursorState = TRUE;
}
else
{
ULONG ulCurrentTime = hb_gt_xwc_CurrentTime();
if( ulCurrentTime - s_cursorStateTime > s_cursorBlinkRate )
if( s_cursorBlinkRate == 0 )
{
s_cursorState = !s_cursorState;
s_cursorStateTime = ulCurrentTime;
s_cursorState = TRUE;
}
else
{
ULONG ulCurrentTime = hb_gt_xwc_CurrentTime();
if( ulCurrentTime - s_cursorStateTime > s_cursorBlinkRate )
{
s_cursorState = !s_cursorState;
s_cursorStateTime = ulCurrentTime;
}
}
}
@@ -3383,7 +3386,7 @@ static char * hb_gt_xwc_Version( int iType )
if( iType == 0 )
return HB_GT_DRVNAME( HB_GT_NAME );
return "xHarbour Terminal: XWindow Console XWC";
return "Harbour Terminal: XWindow Console XWC";
}
/* *********************************************************************** */
@@ -3432,6 +3435,8 @@ static void hb_gt_xwc_Tone( double dFrequency, double dDuration )
static BOOL hb_gt_xwc_mouse_IsPresent( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_xwc_mouse_IsPresent()"));
return s_wnd->mouseNumButtons > 0;
}
@@ -3439,6 +3444,8 @@ static BOOL hb_gt_xwc_mouse_IsPresent( void )
static void hb_gt_xwc_mouse_GetPos( int * piRow, int * piCol )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_xwc_mouse_GetPos(%p,%p)", piRow, piCol));
hb_gt_xwc_LateRefresh();
*piRow = s_wnd->mouseGotoRow;
*piCol = s_wnd->mouseGotoCol;
@@ -3448,6 +3455,8 @@ static void hb_gt_xwc_mouse_GetPos( int * piRow, int * piCol )
static void hb_gt_xwc_mouse_SetPos( int iRow, int iCol )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_xwc_mouse_SetPos(%d,%d)", iRow, iCol));
s_wnd->mouseGotoRow = iRow;
s_wnd->mouseGotoCol = iCol;
hb_gt_xwc_LateRefresh();
@@ -3457,7 +3466,7 @@ static void hb_gt_xwc_mouse_SetPos( int iRow, int iCol )
static BOOL hb_gt_xwc_mouse_ButtonState( int iButton )
{
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_mouse_ButtonState(%i)", iButton ) );
HB_TRACE(HB_TR_DEBUG, ("hb_gt_xwc_mouse_ButtonState(%i)", iButton));
if( iButton >= 0 && iButton < s_wnd->mouseNumButtons )
return ( s_wnd->mouseButtonsState & 1 << iButton ) != 0;
@@ -3469,7 +3478,7 @@ static BOOL hb_gt_xwc_mouse_ButtonState( int iButton )
static int hb_gt_xwc_mouse_CountButton( void )
{
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_xwc_mouse_CountButton()") );
HB_TRACE(HB_TR_DEBUG, ("hb_gt_xwc_mouse_CountButton()"));
hb_gt_xwc_RealRefresh();
@@ -3612,7 +3621,7 @@ static BOOL hb_gt_xwc_Info( int iType, PHB_GT_INFO pInfo )
pInfo->pResult = hb_itemPutNI( pInfo->pResult, s_wnd->fontWidth );
iVal = hb_itemGetNI( pInfo->pNewVal );
if( iVal > 0 ) /* TODO */
s_wnd->fontWidth = iVal;
s_wnd->fontWidth = iVal;
break;
case GTI_FONTNAME:
@@ -3857,7 +3866,16 @@ static void hb_gt_xwc_Redraw( int iRow, int iCol, int iSize )
{
if( s_wnd->fInit )
{
#if 1
hb_gt_xwc_InvalidateChar( s_wnd, iCol, iRow, iCol + iSize - 1, iRow );
#else
hb_gt_xwc_RepaintChar( s_wnd, iCol, iRow, iCol + iSize - 1, iRow );
iCol *= s_wnd->fontWidth;
iRow *= s_wnd->fontHeight;
hb_gt_xwc_InvalidatePts( s_wnd, iCol, iRow,
iCol + iSize * s_wnd->fontWidth - 1,
iRow + s_wnd->fontHeight - 1 );
#endif
}
else if( !s_wnd->fData )
{

View File

@@ -876,6 +876,7 @@ void hb_fsFindClose( PHB_FFIND ffind )
#elif defined(HB_OS_WIN_32)
if( info->hFindFile != INVALID_HANDLE_VALUE )
{
FindClose( info->hFindFile );
}

View File

@@ -102,7 +102,9 @@ static BOOL hb_strMatchDOS( const char * pszString, const char * pszMask )
HB_EXPORT BOOL hb_strMatchWild( const char *szString, const char *szPattern )
{
BOOL fMatch = TRUE, fAny = FALSE;
ULONG ulAnyPosP[HB_MAX_WILDPATTERN], ulAnyPosV[HB_MAX_WILDPATTERN],
ULONG pulBufPosP[ HB_MAX_WILDPATTERN ], pulBufPosV[ HB_MAX_WILDPATTERN ],
ulBufSize = HB_MAX_WILDPATTERN;
ULONG * ulAnyPosP = pulBufPosP, * ulAnyPosV = pulBufPosV,
ulSize, ulLen, ulAny, i, j;
i = j = ulAny = 0;
@@ -119,12 +121,24 @@ HB_EXPORT BOOL hb_strMatchWild( const char *szString, const char *szPattern )
{
if ( fAny )
{
if ( ulAny < HB_MAX_WILDPATTERN )
if ( ulAny >= ulBufSize )
{
ulAnyPosP[ulAny] = i;
ulAnyPosV[ulAny] = j;
ulAny++;
if( ( ulBufSize <<= 1 ) == ( HB_MAX_WILDPATTERN << 1 ) )
{
ulAnyPosP = ( ULONG * ) hb_xgrab( ulBufSize * sizeof( ULONG ) );
ulAnyPosV = ( ULONG * ) hb_xgrab( ulBufSize * sizeof( ULONG ) );
memcpy( ulAnyPosP, pulBufPosP, HB_MAX_WILDPATTERN * sizeof( ULONG ) );
memcpy( ulAnyPosV, pulBufPosV, HB_MAX_WILDPATTERN * sizeof( ULONG ) );
}
else
{
ulAnyPosP = ( ULONG * ) hb_xrealloc( ulAnyPosP, ulBufSize * sizeof( ULONG ) );
ulAnyPosV = ( ULONG * ) hb_xrealloc( ulAnyPosV, ulBufSize * sizeof( ULONG ) );
}
}
ulAnyPosP[ulAny] = i;
ulAnyPosV[ulAny] = j;
ulAny++;
fAny = FALSE;
}
j++;
@@ -147,9 +161,92 @@ HB_EXPORT BOOL hb_strMatchWild( const char *szString, const char *szPattern )
break;
}
}
if( ulBufSize > HB_MAX_WILDPATTERN )
{
hb_xfree( ulAnyPosP );
hb_xfree( ulAnyPosV );
}
return fMatch;
}
HB_EXPORT BOOL hb_strMatchWildExact( const char *szString, const char *szPattern )
{
BOOL fMatch = TRUE, fAny = FALSE;
ULONG pulBufPosP[ HB_MAX_WILDPATTERN ], pulBufPosV[ HB_MAX_WILDPATTERN ],
ulBufSize = HB_MAX_WILDPATTERN;
ULONG * ulAnyPosP = pulBufPosP, * ulAnyPosV = pulBufPosV,
ulSize, ulLen, ulAny, i, j;
i = j = ulAny = 0;
ulLen = strlen( szString );
ulSize = strlen( szPattern );
while ( i < ulSize || ( j < ulLen && !fAny ) )
{
if ( i < ulSize && szPattern[i] == '*' )
{
fAny = TRUE;
i++;
}
else if ( j < ulLen && i < ulSize &&
( szPattern[i] == '?' || szPattern[i] == szString[j] ) )
{
if ( fAny )
{
if ( ulAny >= ulBufSize )
{
if( ( ulBufSize <<= 1 ) == ( HB_MAX_WILDPATTERN << 1 ) )
{
ulAnyPosP = ( ULONG * ) hb_xgrab( ulBufSize * sizeof( ULONG ) );
ulAnyPosV = ( ULONG * ) hb_xgrab( ulBufSize * sizeof( ULONG ) );
memcpy( ulAnyPosP, pulBufPosP, HB_MAX_WILDPATTERN * sizeof( ULONG ) );
memcpy( ulAnyPosV, pulBufPosV, HB_MAX_WILDPATTERN * sizeof( ULONG ) );
}
else
{
ulAnyPosP = ( ULONG * ) hb_xrealloc( ulAnyPosP, ulBufSize * sizeof( ULONG ) );
ulAnyPosV = ( ULONG * ) hb_xrealloc( ulAnyPosV, ulBufSize * sizeof( ULONG ) );
}
}
ulAnyPosP[ulAny] = i;
ulAnyPosV[ulAny] = j;
ulAny++;
fAny = FALSE;
}
j++;
i++;
}
else if ( fAny && j < ulLen )
{
j++;
}
else if ( ulAny > 0 )
{
ulAny--;
i = ulAnyPosP[ulAny];
j = ulAnyPosV[ulAny] + 1;
fAny = TRUE;
}
else
{
fMatch = FALSE;
break;
}
}
if( ulBufSize > HB_MAX_WILDPATTERN )
{
hb_xfree( ulAnyPosP );
hb_xfree( ulAnyPosV );
}
return fMatch;
}
HB_FUNC( WILDMATCH )
{
hb_retl( ( ! ISCHAR( 1 ) || ! ISCHAR( 2 ) ) ? FALSE :
hb_parl( 3 ) ? hb_strMatchWildExact( hb_parc( 2 ), hb_parc( 1 ) ) :
hb_strMatchWild( hb_parc( 2 ), hb_parc( 1 ) ) );
}
/* TODO: Replace it with a code that supports real regular expressions
*
@@ -162,11 +259,14 @@ BOOL hb_strMatchRegExp( const char * szString, const char * szMask )
}
/*
* WildMatch( cPattern, cValue ) compares cValue ith cPattern, cPattern
* may contain wildcard characters (?*)
* WildMatch( cPattern, cValue [, lExact] ) compares
* cValue with cPattern, cPattern * may contain wildcard characters (?*)
* When lExact is TRUE then it will check if whole cValue is covered by
* cPattern else if will check if cPatern is a prefix of cValue
*/
HB_FUNC( HB_WILDMATCH )
{
hb_retl( ( ! ISCHAR( 1 ) || ! ISCHAR( 2 ) ) ? FALSE :
hb_strMatchWild( hb_parc( 2 ), hb_parc( 1 ) ) );
hb_parl( 3 ) ? hb_strMatchWildExact( hb_parc( 2 ), hb_parc( 1 ) ) :
hb_strMatchWild( hb_parc( 2 ), hb_parc( 1 ) ) );
}

View File

@@ -5,12 +5,17 @@
ROOT = ../../
ifeq ($(HB_ARCHITECTURE),w32)
C_MAIN := mainstd.c mainwin.c
ifeq ($(HB_COMPILER),mingw32)
C_MAIN = mainwin.c
DIRS = mainstd
else
C_MAIN = mainstd.c mainwin.c
endif
else
ifeq ($(HB_ARCHITECTURE),os2)
C_MAIN := mainstd.c mainpm.c
C_MAIN = mainstd.c mainpm.c
else
C_MAIN := main.c
C_MAIN = main.c
endif
endif
@@ -50,3 +55,6 @@ PRG_SOURCES=\
LIBNAME=vm
include $(TOP)$(ROOT)config/lib.cf
ifneq ($(DIRS),)
include $(TOP)$(ROOT)config/dir.cf
endif

View File

@@ -50,6 +50,8 @@
*
*/
#define HB_OS_WIN_32_USED
#include "hbvmopt.h"
#include "hbapi.h"
#include "hbapiitm.h"
@@ -61,7 +63,38 @@
static int s_argc = 0;
static char ** s_argv = NULL;
static char * hb_cmdargGet( const char * pszName, BOOL bRetValue );
#if defined( HB_OS_WIN_32 ) && defined( HB_OS_WIN_32_USED )
HB_EXTERN_BEGIN
HANDLE hb_hInstance = 0;
HANDLE hb_hPrevInstance = 0;
int s_iCmdShow = 0;
BOOL s_WinMainParam = FALSE;
HB_EXTERN_END
HB_EXPORT void hb_winmainArgInit( HANDLE hInstance, HANDLE hPrevInstance, int iCmdShow )
{
hb_hInstance = hInstance;
hb_hPrevInstance = hPrevInstance;
s_iCmdShow = iCmdShow;
s_WinMainParam = TRUE;
}
HB_EXPORT BOOL hb_winmainArgGet( HANDLE * phInstance, HANDLE * phPrevInstance, int * piCmdShow )
{
if( phInstance )
*phInstance = hb_hInstance;
if( phPrevInstance )
*phPrevInstance = hb_hPrevInstance;
if( piCmdShow )
*piCmdShow = s_iCmdShow;
return s_WinMainParam;
}
#endif
HB_EXPORT void hb_cmdargInit( int argc, char * argv[] )
{

View File

@@ -0,0 +1,14 @@
#
# $Id$
#
vpath %.c ../
ROOT = ../../../
C_SOURCES=\
mainstd.c \
LIBNAME=mainstd
include $(TOP)$(ROOT)config/lib.cf

View File

@@ -56,67 +56,72 @@
#include "hbvm.h"
#if defined(HB_OS_WIN_32)
HB_EXTERN_BEGIN
int argc = 0;
char * argv[ 20 ];
#define MAX_ARGS 128
HANDLE hb_hInstance = 0;
HANDLE hb_hPrevInstance = 0;
static int s_argc = 0;
static char * s_argv[ MAX_ARGS ];
static char s_szAppName[ 256 ];
int WINAPI WinMain( HINSTANCE hInstance, /* handle to current instance */
HINSTANCE hPrevInstance, /* handle to previous instance */
LPSTR lpCmdLine, /* pointer to command line */
int iCmdShow ) /* show state of window */
{
LPSTR pArgs, pArg, pDst, pSrc;
BOOL fQuoted;
#ifdef HB_INCLUDE_WINEXCHANDLER
{
LONG WINAPI hb_UnhandledExceptionFilter( struct _EXCEPTION_POINTERS * ExceptionInfo );
LPTOP_LEVEL_EXCEPTION_FILTER ef = SetUnhandledExceptionFilter( hb_UnhandledExceptionFilter );
#endif
LPSTR pArgs = ( LPSTR ) LocalAlloc( LMEM_FIXED, strlen( lpCmdLine ) + 1 ), pArg = pArgs;
char szAppName[ 250 ];
#ifdef HB_INCLUDE_WINEXCHANDLER
HB_SYMBOL_UNUSED( ef );
}
#endif
strcpy( pArgs, lpCmdLine );
HB_TRACE(HB_TR_DEBUG, ("WinMain(%p, %p, %s, %d)", hInstance, hPrevInstance, lpCmdLine, iCmdShow));
HB_SYMBOL_UNUSED( hPrevInstance );
HB_SYMBOL_UNUSED( iCmdShow );
GetModuleFileName( hInstance, s_szAppName, sizeof( s_szAppName ) - 1 );
s_argv[ s_argc++ ] = s_szAppName;
hb_hInstance = hInstance;
GetModuleFileName( hInstance, szAppName, 249 );
argv[ 0 ] = szAppName;
pDst = pArgs = ( LPSTR ) LocalAlloc( LMEM_FIXED, strlen( lpCmdLine ) + 1 );
pArg = NULL;
pSrc = lpCmdLine;
fQuoted = FALSE;
if( * pArgs != 0 )
argv[ ++argc ] = pArgs;
while( *pArg != 0 )
while( *pSrc != 0 && s_argc < MAX_ARGS )
{
if( *pArg == ' ' )
if( *pSrc == '"' )
{
*pArg++ = 0;
argc++;
while( *pArg == ' ' )
pArg++;
if( *pArg != 0 )
argv[ argc ] = pArg++;
else
argc--;
if( pArg == NULL )
pArg = pDst;
fQuoted = !fQuoted;
}
else if( fQuoted || !HB_ISSPACE ( *pSrc ) )
{
if( pArg == NULL )
pArg = pDst;
*pDst++ = *pSrc;
}
else
pArg++;
{
if( pArg )
{
*pDst++ = '\0';
s_argv[ s_argc++ ] = pArg;
pArg = NULL;
}
}
++pSrc;
}
if( pArg )
{
*pDst = '\0';
s_argv[ s_argc++ ] = pArg;
}
argc++;
hb_cmdargInit( argc, argv );
hb_winmainArgInit( hInstance, hPrevInstance, iCmdShow );
hb_cmdargInit( s_argc, s_argv );
hb_vmInit( TRUE );
hb_vmQuit();
@@ -127,12 +132,12 @@ int WINAPI WinMain( HINSTANCE hInstance, /* handle to current instance */
/* NOTE: This point is never reached */
return 0;
}
}
#if ( defined(__WATCOMC__) || defined(__MINGW32__) ) && !defined(__EXPORT__)
HB_EXTERN_BEGIN
HB_EXPORT void hb_forceLinkMainWin( void ) {}
#endif
HB_EXTERN_END
#endif
#endif