2008-10-20 00:15 UTC+0200 Francesco Saverio Giudice (info fsgiudice com)

+ contrib/hbdbgfx
    + contrib/hbdbgfx/dbgfxc.c
    + contrib/hbdbgfx/dbgfxc.prg
    + contrib/hbdbgfx/hbdbgfx.h
    + contrib/hbdbgfx/sprintf.prg
      + hbdbgfx lib add some functions usefull for debugging purpose:
        hb_ToOutDebug( cMsg, p1, p2, ... )
           that outputs to OutDebug from Microsoft debugview
        HB_ToLogFile( cLogFile, cMsg, p1, p2, ... )
           that outputs to a file
        where cMsg is formatted like printf()
        example:
          hb_ToOutDebug( "fields: name = %s, address = %s", field->name, field->address )
        and some utility functions:
        HB_ToOutDebugOnOff( lOnOff )
        HB_LogFileOnOff( lOnOff )
        HB_EmptyLogFileOnOff( lOnOff )
        Above functions are available either at prg than at C level.
        Actually it is only for window platform.
This commit is contained in:
Francesco Saverio Giudice
2008-10-19 22:16:39 +00:00
parent a349e146c1
commit 9f77350dcc
9 changed files with 723 additions and 93 deletions

View File

@@ -8,13 +8,34 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2008-10-20 00:15 UTC+0200 Francesco Saverio Giudice (info fsgiudice com)
+ contrib/hbdbgfx
+ contrib/hbdbgfx/dbgfxc.c
+ contrib/hbdbgfx/dbgfxc.prg
+ contrib/hbdbgfx/hbdbgfx.h
+ contrib/hbdbgfx/sprintf.prg
+ hbdbgfx lib add some functions usefull for debugging purpose:
hb_ToOutDebug( cMsg, p1, p2, ... )
that outputs to OutDebug from Microsoft debugview
HB_ToLogFile( cLogFile, cMsg, p1, p2, ... )
that outputs to a file
where cMsg is formatted like printf()
example:
hb_ToOutDebug( "fields: name = %s, address = %s", field->name, field->address )
and some utility functions:
HB_ToOutDebugOnOff( lOnOff )
HB_LogFileOnOff( lOnOff )
HB_EmptyLogFileOnOff( lOnOff )
Above functions are available either at prg than at C level.
Actually it is only for window platform.
2008-10-19 23:15 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* contrib/mtpl_b32.mak
* contrib/mtpl_gcc.mak
* contrib/mtpl_vc.mak
* Fine tuning latest setting changes. I've rather removed
-gc3 as contrib default switch. For those contribs where
speed is critical, this switch should be turned on
* Fine tuning latest setting changes. I've rather removed
-gc3 as contrib default switch. For those contribs where
speed is critical, this switch should be turned on
on a per contrib basis.
2008-10-19 09:34 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
@@ -31,15 +52,15 @@
* contrib/mtpl_b32.mak
* contrib/mtpl_gcc.mak
* contrib/mtpl_vc.mak
+ Made -gc3 switch the default. This will result in
noticeably faster .prg code execution at the cost of
a slightly bigger executable. Speaking of the core,
this can result at maximum 250K of extra executable
size increase, if the final executable uses _all_
core .prg functions. Usually though it's much lower
than that, especially for GUI programs, since the
majority of core .prg code deals with CUI elements,
like TBrowse(), TGet(), 5.3 compatible CUI controls,
+ Made -gc3 switch the default. This will result in
noticeably faster .prg code execution at the cost of
a slightly bigger executable. Speaking of the core,
this can result at maximum 250K of extra executable
size increase, if the final executable uses _all_
core .prg functions. Usually though it's much lower
than that, especially for GUI programs, since the
majority of core .prg code deals with CUI elements,
like TBrowse(), TGet(), 5.3 compatible CUI controls,
.frm and .lbl support, MemoEdit().
* contrib/examples/dbu/bld_b32.bat
@@ -75,7 +96,7 @@
* source/rtl/tpersist.prg
* utils/hbmake/hbmake.prg
* utils/hbrun/hbrun.prg
* Renamed hb_N2S() to hb_NToS() which feels more
* Renamed hb_N2S() to hb_NToS() which feels more
natural in Clipper.
2008-10-19 00:17 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
@@ -105,7 +126,7 @@
* source/rtl/Makefile
+ source/rtl/strtrim.c
+ Added function HB_N2S( <number> ) -> <string>.
This is equivalent to LTrim( Str( <number> ) ),
This is equivalent to LTrim( Str( <number> ) ),
just faster.
* source/rtl/dircmd.prg
@@ -122,7 +143,7 @@
2008-10-18 22:03 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* contrib/xhb/hbcrypt.c
! Fixed lower level crypt functions to not do
! Fixed lower level crypt functions to not do
zero division on zero length key input.
2008-10-18 21:16 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
@@ -130,9 +151,9 @@
! Fixed recent warning on Win32 platforms.
* contrib/xhb/hbcrypt.c
* Changed to just work instead of RTE-ing if any
of the params are empty on non-strings. If
non-string is passed, it's considered as
* Changed to just work instead of RTE-ing if any
of the params are empty on non-strings. If
non-string is passed, it's considered as
empty string.
2008-10-18 16:15 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
@@ -202,15 +223,15 @@
* contrib/hbwhat/tests/bld_vc.bat
* contrib/examples/hbsqlit2/tests/bld_b32.bat
* contrib/examples/hbsqlit2/tests/bld_vc.bat
* Renamed bin\bld*.* files to bin\hbmk*.*. This
dir may be put in the path in user environments,
so it's necessary to put the name into the Harbour
namespace. The new name is also the one supported
on *nix/bash platforms, albeit with slightly
* Renamed bin\bld*.* files to bin\hbmk*.*. This
dir may be put in the path in user environments,
so it's necessary to put the name into the Harbour
namespace. The new name is also the one supported
on *nix/bash platforms, albeit with slightly
different usage.
INCOMPATIBLE. Please update your environment.
To achieve compatbility with older Harbour versions
and xhb, you can locally add a bld.bat file with
To achieve compatbility with older Harbour versions
and xhb, you can locally add a bld.bat file with
the content: '@call hbmk.bat %1 %2 %3 %4 %5 %6 %7 %8 %9'
* source/common/hbgete.c
@@ -236,10 +257,10 @@
2008-10-18 10:27 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* include/hbapi.h
* source/common/hbgete.c
+ Added hb_getenv_buffer(). Similar to hb_getenv() but
this one needs a buffer+size to be passed, so no memory
allocation is done by the function. It also return
a BOOL to signal success. It doesn't signal if passed
+ Added hb_getenv_buffer(). Similar to hb_getenv() but
this one needs a buffer+size to be passed, so no memory
allocation is done by the function. It also return
a BOOL to signal success. It doesn't signal if passed
buffer was too small to store the value.
2008-10-18 08:36 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
@@ -255,12 +276,12 @@
* source/debug/tbrwtext.prg
* source/debug/debugger.prg
! Fixed to not crash after switching to mono display.
DISCLAIMER: This is a quick patch (but even this took
hours) and it absolutely can be wrong, incomplete in
any ways. I'm not using or knowing debugger code, pls
DISCLAIMER: This is a quick patch (but even this took
hours) and it absolutely can be wrong, incomplete in
any ways. I'm not using or knowing debugger code, pls
patch it further on.
NOTE: Color refresh after switching mono/color mode
is still wrong and I've given up after trying
NOTE: Color refresh after switching mono/color mode
is still wrong and I've given up after trying
for a few hours.
* Minor formatting.
@@ -301,7 +322,7 @@
* Changed rest of GETs to __dbgInput()
* source/rtl/listbox.prg
- Removed saving cursor position and color,
- Removed saving cursor position and color,
and changing default color.
; NOTE: Couldn't replicate Mono display RTE.
@@ -347,12 +368,12 @@
* make_vc.bat
* make_vc.mak
* make_gcc.mak
* HB_BUILD_VERBOSE=yes is now the default. If someone
is wanting to build Harbour from source and is bothered
by the compiler command-lines being shown, these can
* HB_BUILD_VERBOSE=yes is now the default. If someone
is wanting to build Harbour from source and is bothered
by the compiler command-lines being shown, these can
be turned off with HB_BUILD_VERBOSE=no.
These lines are IMO very important to see, which options
were exactly used when Harbour was built, I personally
These lines are IMO very important to see, which options
were exactly used when Harbour was built, I personally
archive these logs along with the builds.
2008-10-16 14:22 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
@@ -363,7 +384,7 @@
* contrib/mtpl_gcc.mak
* contrib/mtpl_vc.mak
* Changed -b switch to -l-.
-b debug mode causes more problems than good for Harbour
-b debug mode causes more problems than good for Harbour
core/contrib.
2008-10-16 13:21 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
@@ -380,7 +401,7 @@
* contrib/mtpl_gcc.mak
* contrib/mtpl_vc.mak
% Deleted -l- switch when HB_BUILD_STATIC=yes.
Line numbers are automatically enabled when
Line numbers are automatically enabled when
-b switch is used.
* source/debug/debugger.prg
@@ -452,7 +473,7 @@
* Minor formatting.
* source/rtl/tobject.prg
* Removed '#pragma DEBUGINFO=OFF' as it's no more
* Removed '#pragma DEBUGINFO=OFF' as it's no more
needed.
* source/debug/dbgthsh.prg
@@ -528,9 +549,9 @@
* source/debug/tbrwtext.prg
* Replaced with new implementation from Lorenzo Fiorini.
Sent to the list on 2008.07.26.
; NOTE: Some issue were reported with this, but it's again
a step into the right direction, please try to update
this code to better resemble to Clipper and to fix
; NOTE: Some issue were reported with this, but it's again
a step into the right direction, please try to update
this code to better resemble to Clipper and to fix
possible error. Thanks.
; Remaining RTL .prg dependencies:
- ACHOICE() (just one call)
@@ -555,7 +576,7 @@
+ Replaced Alert() with __dbgAlert() calls.
+ Added minimal TBColumn() implementation, named HBDbColumn().
+ Replaced TBColumnNew() with HBDbColumnNew() calls.
+ Enabled HB_NO_READDBG for all sources. This isn't
+ Enabled HB_NO_READDBG for all sources. This isn't
perfect, just a step into the right direction.
; Please test above modifications.
; Remaining RTL .prg dependencies:
@@ -570,7 +591,7 @@
* source/rtl/tobject.prg
* source/rtl/tclass.prg
+ Added '#pragma DEBUGINFO=OFF'.
; NOTE: Maybe it'd be better to rewrite these in .c,
; NOTE: Maybe it'd be better to rewrite these in .c,
also for speed. If possible.
* source/rtl/alert.prg
@@ -619,11 +640,11 @@
* make_vc.mak
* make_gcc.mak
* Removed disabling -b for non-debug builds.
; We aim to remove RTL .prg dependencies from hbdebug.lib,
either by local implementation, .c rewrite, or force
; We aim to remove RTL .prg dependencies from hbdebug.lib,
either by local implementation, .c rewrite, or force
disabling debug mode in more core files.
Until this happens, one will have to be careful with
using -b switch to compile Harbour. These are the core .prg
Until this happens, one will have to be careful with
using -b switch to compile Harbour. These are the core .prg
modules currently used by hbdebug.lib:
- HBGETLIST(), GET(), __GET(), __GETLISTACTIVE(), __GETLISTSETACTIVE(), READINSERT(), READMODAL()
- HBCLASS() [DONE]
@@ -670,9 +691,9 @@
* make_b32.mak
* make_gcc.mak
* make_vc.mak
* Forcing -b- (disabling debug info) for all core
.prg functions. Compiling anything in core with
-b would cause infinite loops, when trying to use
* Forcing -b- (disabling debug info) for all core
.prg functions. Compiling anything in core with
-b would cause infinite loops, when trying to use
the debugger.
QUESTION: Is HB_NO_READDBG still needed?
@@ -683,7 +704,7 @@
- bin/vc
- obj/b32
- obj/vc
- Removed dirs from SVN. They are automatically created
- Removed dirs from SVN. They are automatically created
by the build scripts.
2008-10-15 01:39 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
@@ -703,16 +724,16 @@
* source/debug/dbgtarr.prg
* source/debug/dbgtmenu.prg
* source/debug/dbgtmitm.prg
+ Added '#pragma DEBUGINFO=OFF' to debugger
sources. Otherwise compiling full Harbour with
+ Added '#pragma DEBUGINFO=OFF' to debugger
sources. Otherwise compiling full Harbour with
-b was causing an infinite loop in app.
(-b is now default when building with 'HB_BUILD_DEBUG=yes').
* source/rdd/nulsys/nulsys.c
! Added DBSELECTAREA(), DBSTRUCT(), HEADER(),
! Added DBSELECTAREA(), DBSTRUCT(), HEADER(),
RECSIZE(), LUPDATE()
so that programs can be built with -b and
hbnulrdd.lib. hbdebug.lib/dgbwa.prg uses
so that programs can be built with -b and
hbnulrdd.lib. hbdebug.lib/dgbwa.prg uses
symbols above.
2008-10-15 00:31 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
@@ -728,9 +749,9 @@
* source/rtl/tgetint.prg
* source/rtl/tlabel.prg
* source/rtl/treport.prg
* Changed '&( "{||" + c + "}" )' expressions to
* Changed '&( "{||" + c + "}" )' expressions to
hb_macroBlock() calls.
To me these places seemed safe to change, but
To me these places seemed safe to change, but
please verify me.
* source/rtl/alert.prg
@@ -852,7 +873,7 @@
2008-10-13 20:19 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* contrib/hbmisc/strfmt.c
! Fixed GPF when non-string was passed as
! Fixed GPF when non-string was passed as
first parameter.
2008-10-13 18:01 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
@@ -940,10 +961,10 @@
2008-10-13 11:22 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* source/rtl/teditor.prg
+ Added :LineCount(), :ExitState() methods.
* Changed to use hb_MemoWrit() to write text content to
* Changed to use hb_MemoWrit() to write text content to
disk, to avoid Chr(26) to be appended.
! Fixed :InsertState() to also modify physical cursor state.
! Fixed :BrowseText() to not go into an infinite loop in
! Fixed :BrowseText() to not go into an infinite loop in
view mode.
[TOMERGE 1.0]
@@ -984,15 +1005,15 @@
! Minor formatting.
* include/hbapierr.h
! Fixed casting in macro HB_ERR_FUNCNAME, as it was
! Fixed casting in macro HB_ERR_FUNCNAME, as it was
generating a new warning with MSVC in 64-bit mode.
'( ( char * ) 1 )' -> '( ( const char * ) NULL + 1 )'
('const' keyword was not enough to silence it)
* include/hbapierr.h
* source/rtl/errorapi.c
- Disabled (marked with HB_LEGACY_LEVEL) hb_errFuncName
symbol. No longer supported, pls use HB_ERR_FUNCNAME
- Disabled (marked with HB_LEGACY_LEVEL) hb_errFuncName
symbol. No longer supported, pls use HB_ERR_FUNCNAME
instead.
2008-10-11 13:40 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
@@ -1035,7 +1056,7 @@
* bin/bld.bat
* bin/bld_os2.cmd
+ Enabled cleanup of .c/object/.tds files after build.
+ Under Windows NT OSes, it's now possible to pass full .prg
+ Under Windows NT OSes, it's now possible to pass full .prg
name with extension.
! Few minor fixes.
* Formatting, cleanup and help update.
@@ -1044,8 +1065,8 @@
2008-10-11 14:49 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* source/rtl/fnsplit.c
* source/rtl/hbtoken.c
! HB_FNAMESPLIT(), HB_TOKENPTR() fixed to
reset parameters passed by reference in
! HB_FNAMESPLIT(), HB_TOKENPTR() fixed to
reset parameters passed by reference in
error cases.
2008-10-11 13:06 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
@@ -1236,25 +1257,25 @@
* make_b32.mak
* make_vc.mak
* make_gcc.mak
* Removed special 'set HB_GT_LIB=gtXXX' support. For the exact
same effect - in case you want to modify default GT at
* Removed special 'set HB_GT_LIB=gtXXX' support. For the exact
same effect - in case you want to modify default GT at
build time, which is not recommended -, pls use this:
'set C_USR=-DHB_GT_LIB=XXX' where XXX is 'wvt', 'std', etc.
- Removed HARBOURFLAGSDLL, LDFLAGSDLL, CFLAGSDLL as public options.
It's better to keep these settings common IMO, and handle
- Removed HARBOURFLAGSDLL, LDFLAGSDLL, CFLAGSDLL as public options.
It's better to keep these settings common IMO, and handle
all DLL subtleties in our make files.
+ L_USR is now respected for .dlls, too.
! Fixed make_gcc.mak internal HARBOURFLAGSDLL to be in sync
! Fixed make_gcc.mak internal HARBOURFLAGSDLL to be in sync
with the other .mak files (removed -l switch).
- Removed HB_BUILD_MODE for VC builds. Now C/C++ is left to
the default value (which is C mode for core), and it's possible
- Removed HB_BUILD_MODE for VC builds. Now C/C++ is left to
the default value (which is C mode for core), and it's possible
to override using:
'set C_USR=-TP' for C++ mode (or -TC for forced C mode).
% Other minor cleanups.
* contrib/mtpl_b32.mak
* contrib/mtpl_vc.mak
- Removed HB_BUILD_MODE undocumented options from contrib
- Removed HB_BUILD_MODE undocumented options from contrib
make files. For Borland C++ mode, use 'set C_USR=-P'.
For VC, see above.
- Removed HB_BUILD_ST undocumented option.
@@ -1269,10 +1290,10 @@
* make_b32.mak
* make_vc.mak
* make_gcc.mak
- Removed option HB_BUILD_ST to build another version
of Harbour MT build [for non-GNU builds], or forced
- Removed option HB_BUILD_ST to build another version
of Harbour MT build [for non-GNU builds], or forced
SingleThreaded (non -tWM) Harbour builds.
* Modified to not allow CFLAGSMT to be tweaked from the
* Modified to not allow CFLAGSMT to be tweaked from the
outside [for non-GNU builds].
2008-10-10 09:27 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
@@ -1394,22 +1415,22 @@
2008-10-09 10:11 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* bin/bld.bat
* bin/bld_os2.cmd
+ CLEANUP section now tries to clean object files and
+ CLEANUP section now tries to clean object files and
Borland .tds files, too.
2008-10-09 09:57 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* include/hbextern.ch
+ Added missing HB_DISABLEWAITLOCKS().
; NOTE: This looks like a hack to add FLX_WAIT flag
; NOTE: This looks like a hack to add FLX_WAIT flag
for locks app-wide, and on Windows systems only.
IMO we should not have such hacks in core, or if
this is really important it should support all
IMO we should not have such hacks in core, or if
this is really important it should support all
possible platforms.
It also has a low-level function equivalent,
which is missing from hbapifs.h. There is no
reference to these function in any Harbour or
It also has a low-level function equivalent,
which is missing from hbapifs.h. There is no
reference to these function in any Harbour or
xhb changelogs.
If there are no objections, I'd like remove
If there are no objections, I'd like remove
this functionality.
* source/rtl/hbrandom.c
@@ -1465,14 +1486,14 @@
2008-10-08 14:57 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* make_b32.mak
* contrib/mtpl_b32.mak
+ Added -Q switch to BCC defaults. This will print
+ Added -Q switch to BCC defaults. This will print
verbose error messages.
2008-10-08 14:36 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* bin/bld.bat
* bin/bld_os2.cmd
+ Added support for HB_INSTALL_PREFIX.
+ Added experimental support for 'set HB_MT=MT' flag,
+ Added experimental support for 'set HB_MT=MT' flag,
to create an MT executable.
* source/rtl/seconds.c

View File

@@ -0,0 +1,28 @@
#
# $Id: Makefile 7358 2007-05-09 08:08:49Z lf_sfnet $
#
ROOT = ../../
C_SOURCES=\
dbgfxc.c \
PRG_SOURCES=\
dbgfx.prg \
sprinf.prg \
LIBNAME=hbdbgfx
ifeq ($(HB_COMPILER),mingw32)
CFLAGS := $(CFLAGS) -I/usr/include
else
CFLAGS := $(CFLAGS) -I/usr/include
endif
include $(TOP)$(ROOT)config/header.cf
INSTALL_RULE_HEADERS := $(INSTALL_RULE)
include $(TOP)$(ROOT)config/lib.cf
install::
$(INSTALL_RULE_HEADERS)

View File

@@ -0,0 +1,19 @@
#
# $Id: common.mak 7935 2007-11-10 11:31:17Z vszakats $
#
LIBNAME = hbdbgfx
LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT)
#
# LIB rules
#
LIB_OBJS = \
$(OBJ_DIR)\dbgfxc$(OBJEXT) \
$(OBJ_DIR)\dbgfx$(OBJEXT) \
$(OBJ_DIR)\sprintf$(OBJEXT) \
all: \
$(LIB_PATH) \

View File

@@ -0,0 +1,128 @@
/*
* $Id: gd.prg 7887 2007-10-30 18:25:37Z lf_sfnet $
*/
/*
* Harbour Project source code:
* Debug Functions
*
* Copyright 2007 Francesco Saverio Giudice <info / at /fsgiudice.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "common.ch"
#include "fileio.ch"
REQUEST HB_SPRINTF
STATIC s_lToOutDebug := TRUE
STATIC s_lToLogFile := TRUE
STATIC s_lEmptyLogFile := TRUE
FUNCTION HB_ToOutDebugOnOff( lOnOff )
LOCAL lOld := s_lToOutDebug
IF HB_ISLOGICAL( lOnOff )
s_lToOutDebug := lOnOff
ENDIF
RETURN lOld
PROCEDURE HB_ToOutDebug( ... )
//LOCAL cString
IF !s_lToOutDebug
RETURN
ENDIF
//cString := HB_ExecFromArray( "HB_SPRINTF", hb_aParams() )
hb_OutDebug( hb_sprintf( ... ) )
RETURN
FUNCTION HB_ToLogFileOnOff( lOnOff )
LOCAL lOld := s_lToLogFile
IF HB_ISLOGICAL( lOnOff )
s_lToLogFile := lOnOff
ENDIF
RETURN lOld
FUNCTION HB_EmptyLogFileOnOff( lOnOff )
LOCAL lOld := s_lEmptyLogFile
IF HB_ISLOGICAL( lOnOff )
s_lEmptyLogFile := lOnOff
ENDIF
RETURN lOld
PROCEDURE HB_ToLogFile( cLogFile, ... )
LOCAL nHandle
IF !s_lToLogFile
RETURN
ENDIF
DEFAULT cLogFile TO "logfile.log"
IF cLogFile <> NIL
IF !s_lEmptyLogFile .AND. FILE( cLogFile )
nHandle := FOpen( cLogFile, FO_READWRITE + FO_SHARED)
ELSE
nHandle := FCreate( cLogFile )
s_lEmptyLogFile := FALSE
// Dopo che lo creato, lo richiudo immediatamente e lo riapro in modo condiviso
// nel caso arrivasse una nuova scrittura
IF Ferror() == 0 .AND. nHandle > 0
FClose( nHandle )
nHandle := FOpen( cLogFile, FO_READWRITE + FO_SHARED)
ENDIF
//__OutDebug( "Create ", nHandle )
ENDIF
// Writing
IF nHandle > 0
FSeek( nHandle, 0, FS_END )
FWrite( nHandle, hb_sprintf( ... ) )
FWrite( nHandle, HB_OSNewLine() )
FClose( nHandle )
ENDIF
ENDIF
RETURN

View File

@@ -0,0 +1,148 @@
/*
* $Id: gd.prg 7887 2007-10-30 18:25:37Z lf_sfnet $
*/
/*
* Harbour Project source code:
* Debug Functions
*
* Copyright 2007 Francesco Saverio Giudice <info / at /fsgiudice.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include <windows.h>
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbvm.h"
#include "item.api"
#ifndef __XHARBOUR__
#include "hbapicls.h"
#endif
static BOOL s_bToOutputDebug = TRUE;
static BOOL s_bToLogFile = TRUE;
static BOOL s_bEmptyLogFile = TRUE;
HB_EXPORT BOOL hb_ToOutDebugOnOff( BOOL bOnOff )
{
BOOL bOld = s_bToOutputDebug;
s_bToOutputDebug = bOnOff;
return ( bOld );
}
HB_EXPORT void hb_ToOutDebug( const char * sTraceMsg, ... )
{
//BOOL bExec = TRUE; //FALSE;
if ( s_bToOutputDebug )
{
char buffer[ 1024 ];
va_list ap;
va_start( ap, sTraceMsg );
vsprintf( buffer, sTraceMsg, ap );
va_end( ap );
OutputDebugString( buffer );
}
}
HB_EXPORT BOOL hb_ToLogFileOnOff( BOOL bOnOff )
{
BOOL bOld = s_bToLogFile;
s_bToLogFile = bOnOff;
return ( bOld );
}
HB_EXPORT BOOL hb_EmptyLogFile( BOOL bOnOff )
{
BOOL bOld = s_bEmptyLogFile;
s_bEmptyLogFile = bOnOff;
return ( bOld );
}
HB_EXPORT void hb_ToLogFile( const char * sFile, const char * sTraceMsg, ... )
{
FILE *hFile;
if( ! s_bToLogFile )
{
return;
}
if( sFile == NULL )
{
if( s_bEmptyLogFile )
{
s_bEmptyLogFile = FALSE;
/* Empty the file if it exists. */
hFile = fopen( "logfile.log", "w" );
}
else
{
hFile = fopen( "logfile.log", "a" );
}
}
else
{
hFile = fopen( sFile, "a" );
}
if( hFile )
{
va_list ap;
va_start( ap, sTraceMsg );
vfprintf( hFile, sTraceMsg, ap );
va_end( ap );
fclose( hFile );
}
}

View File

@@ -0,0 +1,68 @@
/*
* $Id: hbdate.h 7705 2007-09-05 14:50:23Z druzus $
*/
/*
* Harbour Project source code:
* Header file for Debug Functions API
*
* Copyright 2007 Francesco Saverio Giudice <info / at /fsgiudice.com>
* 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_DBGFX_H_
#define HB_DBGFX_H_
#include "hbsetup.h"
HB_EXTERN_BEGIN
extern HB_EXPORT BOOL hb_ToOutDebugOnOff( BOOL bOnOff );
extern HB_EXPORT void hb_ToOutDebug( const char * sTraceMsg, ... );
extern HB_EXPORT BOOL hb_ToLogFileOnOff( BOOL bOnOff );
extern HB_EXPORT BOOL hb_EmptyLogFile( BOOL bOnOff );
extern HB_EXPORT void hb_ToLogFile( const char * sFile, const char * sTraceMsg, ... );
HB_EXTERN_END
#endif /* HB_DBGFX_H_ */

View File

@@ -0,0 +1,6 @@
@echo off
rem
rem $Id: make_b32.bat 7995 2007-11-19 14:13:53Z vszakats $
rem
call ..\mtpl_b32.bat %1 %2 %3 %4 %5 %6 %7 %8 %9

View File

@@ -0,0 +1,6 @@
@echo off
rem
rem $Id: make_vc.bat 7995 2007-11-19 14:13:53Z vszakats $
rem
call ..\mtpl_vc.bat %1 %2 %3 %4 %5 %6 %7 %8 %9

View File

@@ -0,0 +1,206 @@
/*
* $Id: sprintf.prg,v 1.3 2003/12/21 02:17:39 maurifull Exp $
*/
/*
* xHarbour Project source code:
* hb_sprintf() function
*
* Copyright 2003 Mauricio Abre <maurifull@datafull.com>
* www - http://www.xharbour.org
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "common.ch"
#include "..\xhb\hbcompat.ch"
FUNCTION hb_sprintf(...)
LOCAL aPar, cReturn, nPar, nPos, cTok
LOCAL nLen := 0, lUnsigned := .F., l0 := .F., lSign := .F., nDec, xVal
LOCAL cString
aPar := HB_aParams()
cReturn := ""
cString := aPar[1]
nPar := 2
DO WHILE !Empty( cString )
nPos := Len( cString ) + 1
cTok := NIL
IF '%' $ cString
nPos := At( '%', cString )
cTok := '%'
ENDIF
IF '\' $ cString .AND. At( '\', cString ) < nPos
nPos := At( '\', cString )
cTok := '\'
ENDIF
cReturn += Left( cString, nPos - 1 )
DO CASE
CASE cTok == NIL
EXIT
CASE cTok == '\'
SWITCH SubStr( cString, ++nPos, 1 )
CASE 't'
cReturn += ' '
EXIT
CASE 'n'
cReturn += Chr( 13 )
EXIT
CASE 'r'
cReturn += Chr( 10 )
EXIT
DEFAULT
cReturn += cString[nPos]
EXIT
END
CASE cTok == '%'
lUnsigned := .F.
SWITCH SubStr( cString, ++nPos, 1 )
CASE '%'
cReturn += '%'
EXIT
CASE '+'
cString := Left( cString, nPos - 1 ) + SubStr( cString, nPos + 1 )
nPos := At( '%', cString ) - 1
lSign := .T.
EXIT
CASE '0'
cString := Left( cString, nPos - 1 ) + SubStr( cString, nPos + 1 )
nPos := At( '%', cString ) - 1
l0 := .T.
EXIT
CASE '1'
CASE '2'
CASE '3'
CASE '4'
CASE '5'
CASE '6'
CASE '7'
CASE '8'
CASE '9'
nLen := Val( SubStr( cString, nPos ) )
cTok := Left( cString, nPos - 1 )
DO WHILE cString[nPos] $ '1234567890.'
nPos++
ENDDO
cString := cTok + SubStr( cString, nPos )
nPos := At( '%', cString ) - 1
EXIT
CASE 'u'
lUnsigned := .T.
nPos++
CASE 'd'
CASE 'l'
CASE 'f'
CASE 'i'
xVal := aPar[nPar++]
IF !ISNUMBER( xVal )
xVal := 0
ENDIF
IF nLen != 0
IF nLen - Int( nLen ) > 0.0
nDec := Str( nLen )
DO WHILE Right( nDec, 1 ) == '0'
nDec := Left( nDec, Len( nDec ) - 1 )
END
nDec := Val( SubStr( nDec, At( '.', nDec ) + 1 ) )
ELSE
nDec := 0
ENDIF
cTok := Str( IIF( lUnsigned, Abs( xVal ), xVal ), nLen, nDec )
ELSE
cTok := LTrim( Str( IIF( lUnsigned, Abs( xVal ), xVal ) ) )
ENDIF
IF l0
IF '-' $ cTok .AND. cTok[1] != '-'
cTok := StrTran( cTok, '-', ' ' )
cTok[1] := '-'
ENDIF
cTok := StrTran( cTok, ' ', '0' )
l0 := .F.
ENDIF
IF lSign .AND. cTok[1] != '-'
IF nLen == 0
cTok := '+' + cTok
ELSE
cTok[1] := '+'
ENDIF
lSign := .F.
ENDIF
nLen := 0
cReturn += cTok
EXIT
CASE 'c'
CASE 's'
IF nLen == 0
nLen := Len( cStr( aPar[nPar] ) )
END
cReturn += PadL( cStr( aPar[nPar++] ), nLen )
nLen := 0
l0 := .F.
lSign := .F.
EXIT
END
ENDCASE
cString := SubStr( cString, nPos + 1 )
ENDDO
RETURN cReturn