2009-12-09 19:13 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* src/common/hbtrace.c
    + Added support for HB_TR_WINOUT envvar (on Windows platform-only)
      to enable pushing trace output via OutputDebugString() calls.
      Use this before running an app:
         set HB_TR_WINOUT=yes
         (anything non-empty would work, not just 'yes')

  * src/rtl/trace.c
    + HB_TRACESTRING(): Added support to accept multiple parameters,
      it also handles non-string parameters, just like OUTSTD()/QOUT().
    % Minor optimization to HB_TRACE() call.

  ; NOTE: Above two changes make it unnecessary to use custom made
          debug/trace solutions inside each contrib, and it also makes
          it unnecessary to use xhb lib for other proprietary trace solutions.

  * src/rtl/console.c
    * Variable scope optimization.

  * contrib/hbgd/gdwrp.c
    * Minor formatting.
This commit is contained in:
Viktor Szakats
2009-12-09 18:16:36 +00:00
parent 5316185bd8
commit 1102852cdd
5 changed files with 114 additions and 16 deletions

View File

@@ -17,6 +17,29 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-12-09 19:13 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/common/hbtrace.c
+ Added support for HB_TR_WINOUT envvar (on Windows platform-only)
to enable pushing trace output via OutputDebugString() calls.
Use this before running an app:
set HB_TR_WINOUT=yes
(anything non-empty would work, not just 'yes')
* src/rtl/trace.c
+ HB_TRACESTRING(): Added support to accept multiple parameters,
it also handles non-string parameters, just like OUTSTD()/QOUT().
% Minor optimization to HB_TRACE() call.
; NOTE: Above two changes make it unnecessary to use custom made
debug/trace solutions inside each contrib, and it also makes
it unnecessary to use xhb lib for other proprietary trace solutions.
* src/rtl/console.c
* Variable scope optimization.
* contrib/hbgd/gdwrp.c
* Minor formatting.
2009-12-09 17:51 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbnf/dispc.c
* contrib/hbfimage/fi_winfu.c
@@ -632,7 +655,7 @@
warning: implicit declaration of function 'hb_setGetOSCP'
and it's probably too late, but I couldn't find a way to
include hbset.h without errors or with least side-effects.
Przemek, could you help?
Przemek, could you help? [DONE]
* contrib/hbwin/win_prn1.c
* Formatting.
@@ -1591,7 +1614,7 @@
; TODO: Makefile support. I've completely failed to make a working
make system. I can compile library by copying Cairo *.h files into
source folder and making .dll import library manualy. I guess
Viktor can solve the issues in 3 minutes.
Viktor can solve the issues in 3 minutes. [DONE]
+ harbour/contrib/hbcairo/tests
+ harbour/contrib/hbcairo/tests/hbmk.hbm
@@ -4893,7 +4916,7 @@
support (preferably accepting any types) to HB_TRACESTRING().
Since my .c skill would kill this effort, or at least make it quite bumpy,
I'd kindly ask someone (Przemek, are you there? ;) to implement it.
Preferably both.
Preferably both. [DONE]
; TODO: Regenerate all hbqt sources. [DONE]
2009-11-15 08:37 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

View File

@@ -674,7 +674,7 @@ HB_FUNC( GDIMAGECREATETRUECOLOR ) /* gdImageCreateTrueColor(sx, sy) */
HB_FUNC( GDIMAGECREATEFROMJPEG ) /* gdImageCreateFromJpegPtr(int size, void *data) */
/* implementation: gdImagePtr gdImageCreateFromJpeg( char *szFile ) */
{
GDImageCreateFrom( IMAGE_JPEG );
GDImageCreateFrom( IMAGE_JPEG );
}

View File

@@ -6,6 +6,7 @@
* Harbour Project source code:
* Tracing functions.
*
* Copyright 2009 Viktor Szakats (harbour.01 syenar.hu)
* Copyright 1999 Gonzalo Diethelm <gonzalo.diethelm@iname.com>
* www - http://www.harbour-project.org
*
@@ -50,6 +51,8 @@
*
*/
#define HB_OS_WIN_USED
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@ -66,6 +69,9 @@ int hb_tr_level_ = 0;
static int s_enabled = 1;
static int s_flush = 0;
#if defined( HB_OS_WIN ) && ! defined( HB_OS_WIN_CE )
static int s_winout = 0;
#endif
static FILE * s_fp = NULL;
@@ -151,6 +157,21 @@ int hb_tr_level( void )
/* ; */
#if defined( HB_OS_WIN ) && ! defined( HB_OS_WIN_CE )
env = hb_getenv( "HB_TR_WINOUT" );
if( env != NULL && env[ 0 ] != '\0' )
s_winout = 1;
else
s_winout = 0;
if( env )
hb_xfree( ( void * ) env );
#endif
/* ; */
env = hb_getenv( "HB_TR_FLUSH" );
if( env != NULL && env[ 0 ] != '\0' )
s_flush = 1;
@@ -209,6 +230,32 @@ void hb_tr_trace( const char * fmt, ... )
*/
fprintf( s_fp, "\n" );
#if defined( HB_OS_WIN ) && ! defined( HB_OS_WIN_CE )
if( s_winout )
{
char buffer1[ 1024 ];
char buffer2[ 1024 ];
va_start( ap, fmt );
hb_vsnprintf( buffer1, sizeof( buffer1 ), fmt, ap );
va_end( ap );
hb_snprintf( buffer2, sizeof( buffer2 ), "%s:%d: %s %s", hb_tr_file_ + i, hb_tr_line_, s_slevel[ hb_tr_level_ ], buffer1 );
#if defined( UNICODE )
{
LPTSTR lpOutputString = HB_TCHAR_CONVTO( buffer2 );
OutputDebugString( lpOutputString );
HB_TCHAR_FREE( lpOutputString );
}
#else
OutputDebugString( buffer2 );
#endif
}
#endif
/*
* Reset file and line.
*/

View File

@@ -289,12 +289,13 @@ static char * hb_itemStringCon( PHB_ITEM pItem, ULONG * pulLen, BOOL * pfFreeReq
HB_FUNC( OUTSTD ) /* writes a list of values to the standard output device */
{
int iPCount = hb_pcount(), iParam;
char * pszString;
ULONG ulLen;
BOOL fFree;
for( iParam = 1; iParam <= iPCount; iParam++ )
{
char * pszString;
ULONG ulLen;
BOOL fFree;
if( iParam > 1 )
hb_conOutStd( " ", 1 );
pszString = hb_itemString( hb_param( iParam, HB_IT_ANY ), &ulLen, &fFree );
@@ -308,12 +309,13 @@ HB_FUNC( OUTSTD ) /* writes a list of values to the standard output device */
HB_FUNC( OUTERR ) /* writes a list of values to the standard error device */
{
int iPCount = hb_pcount(), iParam;
char * pszString;
ULONG ulLen;
BOOL fFree;
for( iParam = 1; iParam <= iPCount; iParam++ )
{
char * pszString;
ULONG ulLen;
BOOL fFree;
if( iParam > 1 )
hb_conOutErr( " ", 1 );
pszString = hb_itemString( hb_param( iParam, HB_IT_ANY ), &ulLen, &fFree );
@@ -327,12 +329,13 @@ HB_FUNC( OUTERR ) /* writes a list of values to the standard error device */
HB_FUNC( QQOUT ) /* writes a list of values to the current device (screen or printer) and is affected by SET ALTERNATE */
{
int iPCount = hb_pcount(), iParam;
char * pszString;
ULONG ulLen;
BOOL fFree;
for( iParam = 1; iParam <= iPCount; iParam++ )
{
char * pszString;
ULONG ulLen;
BOOL fFree;
if( iParam > 1 )
hb_conOutAlt( " ", 1 );
pszString = hb_itemString( hb_param( iParam, HB_IT_ANY ), &ulLen, &fFree );

View File

@@ -6,6 +6,7 @@
* Harbour Project source code:
* The Clipper tracing API.
*
* Copyright 2009 Viktor Szakats (harbour.01 syenar.hu)
* Copyright 1999 Gonzalo A. Diethelm <gonzalo.diethelm@iname.com>
* www - http://www.harbour-project.org
*
@@ -51,6 +52,7 @@
*/
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbtrace.h"
HB_FUNC( HB_TRACESTATE )
@@ -65,9 +67,32 @@ HB_FUNC( HB_TRACELEVEL )
HB_FUNC( HB_TRACESTRING )
{
const char * szMessage = hb_parc( 1 );
if( szMessage )
int iPCount = hb_pcount();
if( iPCount > 0 )
{
HB_TRACE(HB_TR_ALWAYS, ("%s", szMessage) );
char buffer[ 1024 ];
int iParam;
buffer[ 0 ] = '\0';
for( iParam = 1; iParam <= iPCount; iParam++ )
{
char * pszString;
ULONG ulLen;
BOOL fFree;
if( iParam > 1 )
hb_strncat( buffer, " ", sizeof( buffer ) - 1 );
pszString = hb_itemString( hb_param( iParam, HB_IT_ANY ), &ulLen, &fFree );
hb_strncat( buffer, pszString, sizeof( buffer ) - 1 );
if( fFree )
hb_xfree( pszString );
}
HB_TRACE(HB_TR_ALWAYS, ("%s", buffer) );
}
}