2008-10-20 08:39 UTC+0200 Viktor Szakats (harbour.01 syenar hu)

* contrib/hbdbgfx/Makefile
  * contrib/hbdbgfx/common.mak
  + contrib/hbdbgfx/make_gcc.sh
  * contrib/hbdbgfx/make_b32.bat
  * contrib/hbdbgfx/make_vc.bat
  * contrib/hbdbgfx/hbdbgfx.h
  * contrib/hbdbgfx/dbgfxc.c
  * contrib/hbdbgfx/dbgfx.prg
  * contrib/hbdbgfx/sprintf.prg
    * Some cleanups and fixes.
    ; TOFIX: hb_ToOutDebug() for WinCE/Unicode.
             Maybe adding other platforms.
This commit is contained in:
Viktor Szakats
2008-10-20 06:47:13 +00:00
parent 38e2cf2339
commit aef588d027
10 changed files with 577 additions and 568 deletions

View File

@@ -8,6 +8,20 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2008-10-20 08:39 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* contrib/hbdbgfx/Makefile
* contrib/hbdbgfx/common.mak
+ contrib/hbdbgfx/make_gcc.sh
* contrib/hbdbgfx/make_b32.bat
* contrib/hbdbgfx/make_vc.bat
* contrib/hbdbgfx/hbdbgfx.h
* contrib/hbdbgfx/dbgfxc.c
* contrib/hbdbgfx/dbgfx.prg
* contrib/hbdbgfx/sprintf.prg
* Some cleanups and fixes.
; TOFIX: hb_ToOutDebug() for WinCE/Unicode.
Maybe adding other platforms.
2008-10-19 20:18 UTC-0500 Teo Fonrouge (teo/at/windtelsoft/dot/com)
* source/debug/dbgbrwsr.prg
! Fixed out of range error ( BASE/1133 ) when scrolling out the source

View File

@@ -7,22 +7,18 @@ ROOT = ../../
C_SOURCES=\
dbgfxc.c \
C_HEADERS=\
hbdbgfx.h \
PRG_SOURCES=\
dbgfx.prg \
sprinf.prg \
dbgfx.prg \
sprintf.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

@@ -1,19 +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) \
#
# $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,122 +1,119 @@
/*
* $Id: gd.prg 7887 2007-10-30 18:25:37Z lf_sfnet $
*/
/*
* 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"
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( ... )
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. FILE( cLogFile )
nHandle := FOpen( cLogFile, FO_READWRITE + FO_SHARED)
ELSE
nHandle := FCreate( cLogFile )
s_lEmptyLogFile := FALSE
// After I have create it I have to close and open in shared way
IF Ferror() == 0 .AND. nHandle > 0
FClose( nHandle )
nHandle := FOpen( cLogFile, FO_READWRITE + FO_SHARED)
ENDIF
ENDIF
// Writing
IF nHandle > 0
FSeek( nHandle, 0, FS_END )
FWrite( nHandle, hb_sprintf( ... ) )
FWrite( nHandle, HB_OSNewLine() )
FClose( nHandle )
ENDIF
ENDIF
RETURN
/*
* $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 := 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( ... )
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 := FALSE
// After I have create it I have to close and open in shared way
IF Ferror() == 0 .AND. nHandle > 0
FClose( nHandle )
nHandle := FOpen( cLogFile, FO_READWRITE + FO_SHARED)
ENDIF
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

@@ -1,142 +1,136 @@
/*
* $Id: gd.prg 7887 2007-10-30 18:25:37Z lf_sfnet $
*/
/*
* 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 <windows.h>
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbvm.h"
#include "item.api"
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 ( 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 );
}
}
/*
* $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( 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 );
OutputDebugString( ( LPCWSTR ) buffer );
#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, ... )
{
FILE * hFile;
if( s_bToLogFile )
{
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,68 +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-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$
*/
/*
* 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_ */

View File

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

View File

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

View File

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

View File

@@ -1,206 +1,207 @@
/*
* $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
/*
* $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