2008-11-08 18:40 UTC+0100 Francesco Saverio Giudice (info fsgiudice com)

- contrib/hbdbgfx
  - contrib/hbdbgfx/common.mak
  - contrib/hbdbgfx/dbgfx.prg
  - contrib/hbdbgfx/dbgfxc.c
  - contrib/hbdbgfx/hbdbgfx.h
  - contrib/hbdbgfx/make_b32.bat
  - contrib/hbdbgfx/make_gcc.sh
  - contrib/hbdbgfx/make_vc.bat
  - contrib/hbdbgfx/Makefile
  - contrib/hbdbgfx/sprintf.prg
  + contrib/xhb/dbgfx.prg
  + contrib/xhb/dbgfxc.c
  + contrib/xhb/sprintf.prg
  + contrib/xhb/xhb.h
  * contrib/make_b32_all.bat
  * contrib/make_vc_all.bat
  * contrib/xhb/common.mak
  * contrib/xhb/Makefile
    * moved hbdbgfx to xhb folder
This commit is contained in:
Francesco Saverio Giudice
2008-11-08 17:41:00 +00:00
parent 0a3c1096aa
commit c68dbc0cb0
14 changed files with 577 additions and 623 deletions

View File

@@ -8,6 +8,27 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2008-11-08 18:40 UTC+0100 Francesco Saverio Giudice (info fsgiudice com)
- contrib/hbdbgfx
- contrib/hbdbgfx/common.mak
- contrib/hbdbgfx/dbgfx.prg
- contrib/hbdbgfx/dbgfxc.c
- contrib/hbdbgfx/hbdbgfx.h
- contrib/hbdbgfx/make_b32.bat
- contrib/hbdbgfx/make_gcc.sh
- contrib/hbdbgfx/make_vc.bat
- contrib/hbdbgfx/Makefile
- contrib/hbdbgfx/sprintf.prg
+ contrib/xhb/dbgfx.prg
+ contrib/xhb/dbgfxc.c
+ contrib/xhb/sprintf.prg
+ contrib/xhb/xhb.h
* contrib/make_b32_all.bat
* contrib/make_vc_all.bat
* contrib/xhb/common.mak
* contrib/xhb/Makefile
* moved hbdbgfx to xhb folder
2008-11-08 16:43 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* source/rtl/version.c
% Minor.
@@ -35,12 +56,12 @@
- Removed debug switches from OpenWatcom C compiler cmdline.
* bin/hbmk_os2.cmd
+ Added OpenWatcom support. Pls update it, f.e. I don't know
+ Added OpenWatcom support. Pls update it, f.e. I don't know
what is the name of the compiler executable.
! Fixed HB_COMPILER branching. Looks like nobody uses this
file if this problem didn't show up so far, so I'd like to
propose again to remove this file completely, as there is
not much point spending time on maintaining stuff which
! Fixed HB_COMPILER branching. Looks like nobody uses this
file if this problem didn't show up so far, so I'd like to
propose again to remove this file completely, as there is
not much point spending time on maintaining stuff which
nobody uses or needs, is there?
* bin/hbmk.bat
@@ -57,9 +78,9 @@
* contrib/mtpl_vc.bat
* Sync with GNU make system:
HB_MAKE_FLAGS -> MK_USR
; TOFIX: Maybe it's a good time now to resolve the missing HB_
; TOFIX: Maybe it's a good time now to resolve the missing HB_
prefixes for C_USR, L_USR, A_USR, MK_USR.
If there are no objections / better ideas I'd like
If there are no objections / better ideas I'd like
to make these changes:
HB_USER_LIBS -> HB_USR_LIBS
PRG_USR -> HB_USR_PRG
@@ -67,7 +88,7 @@
L_USR -> HB_USR_LINK (or HB_USR_L ?)
A_USR -> HB_USR_LIB (or HB_USR_A ?)
MK_USR -> HB_USR_MAKE (or HB_USR_MAK ?)
As an option we may keep the old names for
As an option we may keep the old names for
compatibility to give some transition time.
2008-11-08 13:55 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
@@ -81,7 +102,7 @@
+ Added one C5.2 SET()s for two simple tests.
+ Added all C5.3 SET()s for two simple tests each.
; NOFIX: _SET_VIDEOMODE has the type wrong.
; NOTE: It wouldn't be a bad idea to add some more comprehensive
; NOTE: It wouldn't be a bad idea to add some more comprehensive
tests for SET()s.
2008-11-08 13:22 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
@@ -99,21 +120,21 @@
2008-11-08 12:46 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* source/rtl/gtwvt/gtwvt.c
* hb_gt_wvt_ResetWindowSize(): Not very good looking (or
overly efficient) solution added for the windows
resize/positioning problem in case the initally set size
* hb_gt_wvt_ResetWindowSize(): Not very good looking (or
overly efficient) solution added for the windows
resize/positioning problem in case the initally set size
cannot fit on the screen (Windows desktop).
2008-11-08 10:25 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* source/vm/set.c
+ Implemented rest of hb_setSetItem() values.
; TODO: Please review. [DONE]
! Fixed HB_SET_FILECASE and HB_SET_DIRCASE to not allow
! Fixed HB_SET_FILECASE and HB_SET_DIRCASE to not allow
invalid numeric values to be set.
! Added missing 'break;' to hb_setSetItem2();
* source/rtl/gtwvt/gtwvt.c
! Fixed a few places where '+' operator was used
! Fixed a few places where '+' operator was used
instead of '|'.
* Minor opt/formatting.
; TOFIX: The window positioning bug is still to be solved. [DONE]

View File

@@ -1,24 +0,0 @@
#
# $Id: Makefile 7358 2007-05-09 08:08:49Z lf_sfnet $
#
ROOT = ../../
C_SOURCES=\
dbgfxc.c \
C_HEADERS=\
hbdbgfx.h \
PRG_SOURCES=\
dbgfx.prg \
sprintf.prg \
LIBNAME=hbdbgfx
include $(TOP)$(ROOT)config/header.cf
INSTALL_RULE_HEADERS := $(INSTALL_RULE)
include $(TOP)$(ROOT)config/lib.cf
install::
$(INSTALL_RULE_HEADERS)

View File

@@ -1,19 +0,0 @@
#
# $Id$
#
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

@@ -1,6 +0,0 @@
@echo off
rem
rem $Id$
rem
call ..\mtpl_b32.bat %1 %2 %3 %4 %5 %6 %7 %8 %9

View File

@@ -1,7 +0,0 @@
#!/bin/sh
#
# $Id$
#
../mtpl_gcc.sh $1 $2 $3 $4 $5 $6 $7 $8 $9

View File

@@ -1,6 +0,0 @@
@echo off
rem
rem $Id$
rem
call ..\mtpl_vc.bat %1 %2 %3 %4 %5 %6 %7 %8 %9

View File

@@ -42,7 +42,7 @@ rem *******************************************************
set _HB_DIRS=%HB_CONTRIBLIBS%
if not "%_HB_DIRS%" == "" goto :OVERRIDE
set _HB_DIRS=gtwvg hbbmcdx hbbtree hbclipsm hbct hbdbgfx hbgt hbmisc
set _HB_DIRS=gtwvg hbbmcdx hbbtree hbclipsm hbct hbgt hbmisc
for %%n in ( %_HB_DIRS% ) do %COMSPEC% /c %_HB_BATWORKER% %%n %1 %2 %3 %4 %5 %6 %7 %8 %9
set _HB_DIRS=hbmsql hbmzip hbnf hbodbc hbole hbsqlit3

View File

@@ -42,7 +42,7 @@ rem *******************************************************
set _HB_DIRS=%HB_CONTRIBLIBS%
if not "%_HB_DIRS%" == "" goto :OVERRIDE
set _HB_DIRS=gtwvg hbbmcdx hbbtree hbclipsm hbct hbdbgfx hbgt hbmisc
set _HB_DIRS=gtwvg hbbmcdx hbbtree hbclipsm hbct hbgt hbmisc
for %%n in ( %_HB_DIRS% ) do %COMSPEC% /c %_HB_BATWORKER% %%n %1 %2 %3 %4 %5 %6 %7 %8 %9
set _HB_DIRS=hbmsql hbmzip hbnf hbodbc hbole hbsqlit3

View File

@@ -19,9 +19,11 @@ C_SOURCES=\
xhbwith.c \
hbcomprs.c \
xstrdel.c \
dbgfxc.c \
C_HEADERS=\
hbcompat.h \
xhb.h \
PRG_SOURCES=\
arrayblk.prg \
@@ -32,6 +34,8 @@ PRG_SOURCES=\
hbstruct.prg \
dirrec.prg \
xhbcomp.prg \
dbgfx.prg \
sprintf.prg \
PRG_HEADERS=\
hbcompat.ch \

View File

@@ -8,6 +8,7 @@ LIB_PATH = $(LIB_DIR)$(LIBNAME)$(LIBEXT)
C_HEADERS = \
hbcompat.h \
xhb.h \
PRG_HEADERS = \
hbcompat.ch \
@@ -28,6 +29,7 @@ LIB_OBJS = \
$(OBJ_DIR)xhbwith$(OBJEXT) \
$(OBJ_DIR)hbcomprs$(OBJEXT) \
$(OBJ_DIR)xstrdel$(OBJEXT) \
$(OBJ_DIR)dbgfxc$(OBJEXT) \
\
$(OBJ_DIR)arrayblk$(OBJEXT) \
$(OBJ_DIR)txml$(OBJEXT) \
@@ -37,6 +39,8 @@ LIB_OBJS = \
$(OBJ_DIR)hbstruct$(OBJEXT) \
$(OBJ_DIR)dirrec$(OBJEXT) \
$(OBJ_DIR)xhbcomp$(OBJEXT) \
$(OBJ_DIR)dbgfx$(OBJEXT) \
$(OBJ_DIR)sprintf$(OBJEXT) \
all: \
$(LIB_PATH) \

View File

@@ -1,119 +1,119 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Debug Functions
*
* Copyright 2007-2008 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"
STATIC s_lToOutDebug := .T.
STATIC s_lToLogFile := .T.
STATIC s_lEmptyLogFile := .T.
FUNCTION HB_ToOutDebugOnOff( lOnOff )
LOCAL lOld := s_lToOutDebug
IF hb_isLogical( lOnOff )
s_lToOutDebug := lOnOff
ENDIF
RETURN lOld
PROCEDURE HB_ToOutDebug( ... )
IF s_lToOutDebug
hb_OutDebug( hb_sprintf( ... ) )
ENDIF
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. hb_FileExists( cLogFile )
nHandle := FOpen( cLogFile, FO_READWRITE + FO_SHARED )
ELSE
nHandle := FCreate( cLogFile )
s_lEmptyLogFile := .F.
// After I have create it I have to close and open in shared way
IF FError() == 0 .AND. nHandle != F_ERROR
FClose( nHandle )
nHandle := FOpen( cLogFile, FO_READWRITE + FO_SHARED )
ENDIF
ENDIF
// Writing
IF nHandle != F_ERROR
FSeek( nHandle, 0, FS_END )
FWrite( nHandle, hb_sprintf( ... ) )
FWrite( nHandle, HB_OSNewLine() )
FClose( nHandle )
ENDIF
ENDIF
RETURN
/*
* $Id: dbgfx.prg 9738 2008-10-26 07:10:19Z vszakats $
*/
/*
* Harbour Project source code:
* Debug Functions
*
* Copyright 2007-2008 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"
STATIC s_lToOutDebug := .T.
STATIC s_lToLogFile := .T.
STATIC s_lEmptyLogFile := .T.
FUNCTION HB_ToOutDebugOnOff( lOnOff )
LOCAL lOld := s_lToOutDebug
IF hb_isLogical( lOnOff )
s_lToOutDebug := lOnOff
ENDIF
RETURN lOld
PROCEDURE HB_ToOutDebug( ... )
IF s_lToOutDebug
hb_OutDebug( hb_sprintf( ... ) )
ENDIF
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. hb_FileExists( cLogFile )
nHandle := FOpen( cLogFile, FO_READWRITE + FO_SHARED )
ELSE
nHandle := FCreate( cLogFile )
s_lEmptyLogFile := .F.
// After I have create it I have to close and open in shared way
IF FError() == 0 .AND. nHandle != F_ERROR
FClose( nHandle )
nHandle := FOpen( cLogFile, FO_READWRITE + FO_SHARED )
ENDIF
ENDIF
// Writing
IF nHandle != F_ERROR
FSeek( nHandle, 0, FS_END )
FWrite( nHandle, hb_sprintf( ... ) )
FWrite( nHandle, HB_OSNewLine() )
FClose( nHandle )
ENDIF
ENDIF
RETURN

View File

@@ -1,151 +1,133 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Debug Functions
*
* Copyright 2007-2008 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.
*
*/
#define HB_OS_WIN_32_USED
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbapifs.h"
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, ... )
{
if( sTraceMsg && s_bToOutputDebug )
{
#if defined( HB_OS_WIN_32 )
/* TOFIX: Convert to/from Unicode */
char buffer[ 1024 ];
va_list ap;
va_start( ap, sTraceMsg );
vsnprintf( buffer, sizeof( buffer ), sTraceMsg, ap );
va_end( ap );
#if defined(UNICODE)
{
TCHAR buf[1024];
HB_TCHAR_CPTO( buf, buffer, sizeof( buffer ) - 1 );
OutputDebugString( buf );
}
#else
OutputDebugString( ( LPCTSTR ) buffer );
#endif
#else
/* TODO: Implement. */
#endif
}
}
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, ... )
{
if( s_bToLogFile )
{
FILE * hFile;
if( sFile == NULL )
{
if( s_bEmptyLogFile )
{
s_bEmptyLogFile = FALSE;
/* Empty the file if it exists. */
hFile = hb_fopen( "logfile.log", "w" );
}
else
hFile = hb_fopen( "logfile.log", "a" );
}
else
hFile = hb_fopen( sFile, "a" );
if( hFile )
{
va_list ap;
va_start( ap, sTraceMsg );
vfprintf( hFile, sTraceMsg, ap );
va_end( ap );
fclose( hFile );
}
}
}
HB_FUNC( HB_OUTDEBUG )
{
hb_ToOutDebug( hb_parc( 1 ) );
}
/*
* $Id: dbgfxc.c 9838 2008-11-05 02:01:15Z druzus $
*/
/*
* Harbour Project source code:
* Debug Functions
*
* Copyright 2007-2008 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 "hbapi.h"
#include "hbapiitm.h"
#include "hbapifs.h"
#include "xhb.h"
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, ... )
{
if( sTraceMsg && s_bToOutputDebug )
{
char buffer[ 1024 ];
va_list ap;
va_start( ap, sTraceMsg );
vsnprintf( buffer, sizeof( buffer ), sTraceMsg, ap );
va_end( ap );
hb_OutDebug( ( const char * ) buffer, strlen( 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, ... )
{
if( s_bToLogFile )
{
FILE * hFile;
if( sFile == NULL )
{
if( s_bEmptyLogFile )
{
s_bEmptyLogFile = FALSE;
/* Empty the file if it exists. */
hFile = hb_fopen( "logfile.log", "w" );
}
else
hFile = hb_fopen( "logfile.log", "a" );
}
else
hFile = hb_fopen( sFile, "a" );
if( hFile )
{
va_list ap;
va_start( ap, sTraceMsg );
vfprintf( hFile, sTraceMsg, ap );
va_end( ap );
fclose( hFile );
}
}
}

View File

@@ -1,207 +1,207 @@
/*
* $Id$
*/
/*
* 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"
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
OTHERWISE
cReturn += SubStr( cString, nPos, 1 )
EXIT
ENDSWITCH
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 SubStr( cString, nPos, 1 ) $ '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 := hb_NToS( IIF( lUnsigned, Abs( xVal ), xVal ) )
ENDIF
IF l0
IF '-' $ cTok .AND. Left( cTok, 1 ) != '-'
cTok := StrTran( cTok, '-', ' ' )
cTok := '-' + SubStr( cTok, 2 )
ENDIF
cTok := StrTran( cTok, ' ', '0' )
l0 := .F.
ENDIF
IF lSign .AND. Left( cTok, 1 ) != '-'
IF nLen == 0
cTok := '+' + cTok
ELSE
cTok := '+' + SubStr( cTok, 2 )
ENDIF
lSign := .F.
ENDIF
nLen := 0
cReturn += cTok
EXIT
CASE 'c'
CASE 's'
IF nLen == 0
nLen := Len( hb_cStr( aPar[nPar] ) )
ENDIF
cReturn += PadL( hb_cStr( aPar[nPar++] ), nLen )
nLen := 0
l0 := .F.
lSign := .F.
EXIT
ENDSWITCH
ENDCASE
cString := SubStr( cString, nPos + 1 )
ENDDO
RETURN cReturn
/*
* $Id: sprintf.prg 9693 2008-10-20 06:47:13Z vszakats $
*/
/*
* 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"
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
OTHERWISE
cReturn += SubStr( cString, nPos, 1 )
EXIT
ENDSWITCH
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 SubStr( cString, nPos, 1 ) $ '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 := hb_NToS( IIF( lUnsigned, Abs( xVal ), xVal ) )
ENDIF
IF l0
IF '-' $ cTok .AND. Left( cTok, 1 ) != '-'
cTok := StrTran( cTok, '-', ' ' )
cTok := '-' + SubStr( cTok, 2 )
ENDIF
cTok := StrTran( cTok, ' ', '0' )
l0 := .F.
ENDIF
IF lSign .AND. Left( cTok, 1 ) != '-'
IF nLen == 0
cTok := '+' + cTok
ELSE
cTok := '+' + SubStr( cTok, 2 )
ENDIF
lSign := .F.
ENDIF
nLen := 0
cReturn += cTok
EXIT
CASE 'c'
CASE 's'
IF nLen == 0
nLen := Len( hb_cStr( aPar[nPar] ) )
ENDIF
cReturn += PadL( hb_cStr( aPar[nPar++] ), nLen )
nLen := 0
l0 := .F.
lSign := .F.
EXIT
ENDSWITCH
ENDCASE
cString := SubStr( cString, nPos + 1 )
ENDDO
RETURN cReturn

View File

@@ -1,68 +1,73 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Header file for Debug Functions API
*
* Copyright 2007-2008 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_ */
/*
* $Id: hbcompat.h 9702 2008-10-21 20:19:00Z druzus $
*/
/*
* Harbour Project source code:
* Header file for C functions in xhb contrib folder
*
* Copyright 2008 {list of individual authors and e-mail addresses}
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#ifndef HB_XHB_H_
#define HB_XHB_H_
#include "hbsetup.h"
HB_EXTERN_BEGIN
/* functions in hboutdbg.c */
extern HB_EXPORT BOOL hb_OutDebugName( PHB_ITEM pName );
extern HB_EXPORT void hb_OutDebug( const char * szMsg, ULONG ulMsgLen );
/* functions in dbgfxc.c */
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