diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 99c12fbb2a..7aeb190714 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,30 @@ +Mon Oct 25 13:14:42 1999 Gonzalo A. Diethelm + + * doc/tracing.txt: + * include/hbtrace.h: + * source/common/hbtrace.c: + * source/pp/hbpp.c: + * source/pp/hbppint.c: + * source/pp/hbpplib.c: + * source/pp/table.c: + * source/pp/stdalone/hbpp.c: + Changed the environment variables that enable tracing in Harbour, + and added a document explaining how to do tracing. + + * include/hbsetup.h: + * source/rtl/gt/gtcrs.c: + * source/rtl/gt/gtlin.c: + * source/rtl/gtxxx.c: + Changed the name for the curses-based GT implementation file to + gtcrs.c, leaving room for other linux-oriented implementations + such as s-lang, etc. + + * source/rtl/arrays.c: + * source/rtl/fm.c: + * source/rtl/gtapi.c: + * source/rtl/inkey.c: + Added/corrected a few calls to HB_TRACE(). + 19991025-15:20 GMT+1 Victor Szel * tests/memory.prg + Using hbmemory.ch diff --git a/harbour/doc/tracing.txt b/harbour/doc/tracing.txt new file mode 100644 index 0000000000..6c422d221b --- /dev/null +++ b/harbour/doc/tracing.txt @@ -0,0 +1,45 @@ +# +# $Id$ +# + +INTRODUCTION +============ + +This file explains how to enable tracing in Harbour. + + +TRACING +======= + +You can enable tracing in Harbour by setting the following environment +variable to any number greater than zero and then recompiling Harbour: + + HB_TRACE_LEVEL + +The value is of no importance right now, just the fact that the +variable is defined to a value greater than zero is taken into +account. In the future, it may be possible to enable different +tracing levels by setting the variable to different values. + +When Harbour is compiled with the variable is set as described above, +and then used to compile a regular Harbour application, the app will +output LOTS of tracing information to stderr. If you are using a +sensible command shell (such as bash) you can redirect stderr to a +file like this: + + my_app 2>trace.txt + + +TRACING THE PREPROCESSOR AND COMPILER +===================================== + +Usually, you will not want tracing enabled in the preprocessor and +compiler; otherwise, you will see the trace output while compiling +Harbour itself. If you REALLY want to enable tracing in the +preprocessor and/or compiler, you must define, in addition to +HB_TRACE_LEVEL as described above, the following variable, and then +recompile the preprocessor/compiler: + + HB_TRACE_UTILS + +The value is of no importance. diff --git a/harbour/include/hbsetup.h b/harbour/include/hbsetup.h index 06acb28a86..ed1bf8a125 100644 --- a/harbour/include/hbsetup.h +++ b/harbour/include/hbsetup.h @@ -156,14 +156,14 @@ /*#define HARBOUR_USE_DOS_GTAPI*/ /*#define HARBOUR_USE_OS2_GTAPI*/ /*#define HARBOUR_USE_WIN_GTAPI*/ -/*#define HARBOUR_USE_LIN_GTAPI*/ +/*#define HARBOUR_USE_CRS_GTAPI*/ /* Indicate that one of the GTAPIs is defined */ #if defined(HARBOUR_USE_STD_GTAPI) || \ defined(HARBOUR_USE_DOS_GTAPI) || \ defined(HARBOUR_USE_OS2_GTAPI) || \ defined(HARBOUR_USE_WIN_GTAPI) || \ - defined(HARBOUR_USE_LIN_GTAPI) + defined(HARBOUR_USE_CRS_GTAPI) #define HARBOUR_USE_GTAPI #endif diff --git a/harbour/include/hbtrace.h b/harbour/include/hbtrace.h index fd856832be..e0b5855ba6 100644 --- a/harbour/include/hbtrace.h +++ b/harbour/include/hbtrace.h @@ -36,7 +36,7 @@ #ifndef HB_TRACE_H_ #define HB_TRACE_H_ -#if defined(HB_DO_TRACE) +#if (defined(HB_TRACE_LEVEL) && (HB_TRACE_LEVEL > 0)) extern char * hb_tr_file_; extern int hb_tr_line_; @@ -54,6 +54,6 @@ do { \ #define HB_TRACE( x ) -#endif /* #if defined(HB_DO_TRACE) */ +#endif /* #if (defined(HB_TRACE_LEVEL) && (HB_TRACE_LEVEL > 0)) */ #endif /* HB_TRACE_H_ */ diff --git a/harbour/source/common/hbtrace.c b/harbour/source/common/hbtrace.c index 748f2e15dd..b700f81586 100644 --- a/harbour/source/common/hbtrace.c +++ b/harbour/source/common/hbtrace.c @@ -33,7 +33,7 @@ * */ -#if defined(HB_DO_TRACE) +#if (defined(HB_TRACE_LEVEL) && (HB_TRACE_LEVEL > 0)) #include #include @@ -93,5 +93,4 @@ void hb_tr_trace( char * fmt, ... ) hb_tr_line_ = 0; } -#endif /* #if defined(HB_DO_TRACE) */ - +#endif /* #if (defined(HB_TRACE_LEVEL) && (HB_TRACE_LEVEL > 0)) */ diff --git a/harbour/source/pp/hbpp.c b/harbour/source/pp/hbpp.c index cd025e8a70..8292355744 100644 --- a/harbour/source/pp/hbpp.c +++ b/harbour/source/pp/hbpp.c @@ -36,9 +36,9 @@ /* * Avoid tracing in preprocessor/compiler. */ -#if ! defined(HB_REALLY_DO_TRACE) -#if defined(HB_DO_TRACE) -#undef HB_DO_TRACE +#if ! defined(HB_TRACE_UTILS) +#if defined(HB_TRACE_LEVEL) +#undef HB_TRACE_LEVEL) #endif #endif diff --git a/harbour/source/pp/hbppint.c b/harbour/source/pp/hbppint.c index e571b846cf..59fff7938a 100644 --- a/harbour/source/pp/hbppint.c +++ b/harbour/source/pp/hbppint.c @@ -36,9 +36,9 @@ /* * Avoid tracing in preprocessor/compiler. */ -#if ! defined(HB_REALLY_DO_TRACE) -#if defined(HB_DO_TRACE) -#undef HB_DO_TRACE +#if ! defined(HB_TRACE_UTILS) +#if defined(HB_TRACE_LEVEL) +#undef HB_TRACE_LEVEL) #endif #endif diff --git a/harbour/source/pp/hbpplib.c b/harbour/source/pp/hbpplib.c index 9c109b78a0..0a11116ae1 100644 --- a/harbour/source/pp/hbpplib.c +++ b/harbour/source/pp/hbpplib.c @@ -36,9 +36,9 @@ /* * Avoid tracing in preprocessor/compiler. */ -#if ! defined(HB_REALLY_DO_TRACE) -#if defined(HB_DO_TRACE) -#undef HB_DO_TRACE +#if ! defined(HB_TRACE_UTILS) +#if defined(HB_TRACE_LEVEL) +#undef HB_TRACE_LEVEL) #endif #endif diff --git a/harbour/source/pp/stdalone/hbpp.c b/harbour/source/pp/stdalone/hbpp.c index 68cacce2a9..98747722eb 100644 --- a/harbour/source/pp/stdalone/hbpp.c +++ b/harbour/source/pp/stdalone/hbpp.c @@ -36,9 +36,9 @@ /* * Avoid tracing in preprocessor/compiler. */ -#if ! defined(HB_REALLY_DO_TRACE) -#if defined(HB_DO_TRACE) -#undef HB_DO_TRACE +#if ! defined(HB_TRACE_UTILS) +#if defined(HB_TRACE_LEVEL) +#undef HB_TRACE_LEVEL) #endif #endif diff --git a/harbour/source/pp/table.c b/harbour/source/pp/table.c index e7820c1870..739debafed 100644 --- a/harbour/source/pp/table.c +++ b/harbour/source/pp/table.c @@ -36,9 +36,9 @@ /* * Avoid tracing in preprocessor/compiler. */ -#if ! defined(HB_REALLY_DO_TRACE) -#if defined(HB_DO_TRACE) -#undef HB_DO_TRACE +#if ! defined(HB_TRACE_UTILS) +#if defined(HB_TRACE_LEVEL) +#undef HB_TRACE_LEVEL) #endif #endif diff --git a/harbour/source/rtl/arrays.c b/harbour/source/rtl/arrays.c index f8376986ad..0675ef6b22 100644 --- a/harbour/source/rtl/arrays.c +++ b/harbour/source/rtl/arrays.c @@ -757,7 +757,11 @@ PHB_ITEM hb_arrayClone( PHB_ITEM pSrcArray ) */ static void hb_arrayNewRagged( PHB_ITEM pArray, int iDimension ) { - ULONG ulElements = ( ULONG ) hb_parnl( iDimension ); + ULONG ulElements; + + HB_TRACE(("hb_arrayNewRagged(%p, %d)", pArray, iDimension)); + + ulElements = ( ULONG ) hb_parnl( iDimension ); /* create an array */ hb_arrayNew( pArray, ulElements ); diff --git a/harbour/source/rtl/fm.c b/harbour/source/rtl/fm.c index 07d1eb734d..3dfed36c58 100644 --- a/harbour/source/rtl/fm.c +++ b/harbour/source/rtl/fm.c @@ -283,6 +283,8 @@ ULONG hb_xquery( USHORT uiMode ) { ULONG ulResult; + HB_TRACE(("hb_xquery(%hu)", uiMode)); + /* TODO: Return the correct values instead of 9999 [vszel] */ switch( uiMode ) diff --git a/harbour/source/rtl/gt/gtlin.c b/harbour/source/rtl/gt/gtcrs.c similarity index 99% rename from harbour/source/rtl/gt/gtlin.c rename to harbour/source/rtl/gt/gtcrs.c index f881eb5581..48636c33ed 100644 --- a/harbour/source/rtl/gt/gtlin.c +++ b/harbour/source/rtl/gt/gtcrs.c @@ -4,7 +4,7 @@ /* * Harbour Project source code: - * Video subsystem for Linux (based on ncurses). + * Video subsystem based on ncurses. * * Copyright 1999 Gonzalo Diethelm * diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 17c500e19b..2cc58fb9e0 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -751,6 +751,8 @@ USHORT hb_gtRepChar( USHORT uiRow, USHORT uiCol, BYTE byChar, USHORT uiCount ) USHORT hb_gtRest( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, void * vlpScrBuff ) { + HB_TRACE(("hb_gtRest(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, vlpScrBuff)); + hb_gt_PutText( uiTop, uiLeft, uiBottom, uiRight, ( BYTE * ) vlpScrBuff ); return 0; @@ -758,6 +760,8 @@ USHORT hb_gtRest( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, USHORT hb_gtSave( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, void * vlpScrBuff ) { + HB_TRACE(("hb_gtSave(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, vlpScrBuff)); + hb_gt_GetText( uiTop, uiLeft, uiBottom, uiRight, ( BYTE * ) vlpScrBuff ); return 0; @@ -967,8 +971,13 @@ USHORT hb_gtScroll( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight USHORT hb_gtDrawShadow( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE byAttr ) { - USHORT uiMaxRow = hb_gtMaxRow(); - USHORT uiMaxCol = hb_gtMaxCol(); + USHORT uiMaxRow; + USHORT uiMaxCol; + + HB_TRACE(("hb_gtDrawShadow(%hu, %hu, %hu, %hu, %d)", uiTop, uiLeft, uiBottom, uiRight, (int) byAttr)); + + uiMaxRow = hb_gtMaxRow(); + uiMaxCol = hb_gtMaxCol(); uiLeft += 2; uiBottom++; diff --git a/harbour/source/rtl/gtxxx.c b/harbour/source/rtl/gtxxx.c index 42fe8003c7..1627ae9fbe 100644 --- a/harbour/source/rtl/gtxxx.c +++ b/harbour/source/rtl/gtxxx.c @@ -43,8 +43,8 @@ #include "gt/gtos2.c" #elif defined(HARBOUR_USE_WIN_GTAPI) #include "gt/gtwin.c" -#elif defined(HARBOUR_USE_LIN_GTAPI) - #include "gt/gtlin.c" +#elif defined(HARBOUR_USE_CRS_GTAPI) + #include "gt/gtcrs.c" #else #include "gt/gtstd.c" #endif diff --git a/harbour/source/rtl/inkey.c b/harbour/source/rtl/inkey.c index 1f68bd369d..7293c36702 100644 --- a/harbour/source/rtl/inkey.c +++ b/harbour/source/rtl/inkey.c @@ -777,7 +777,7 @@ printf("\nhb_inkeyPoll: wKey is %d", wKey); case 396: /* Alt + F12 */ ch = 349 - ch; } -#elif defined(OS_UNIX_COMPATIBLE) +#elif defined(HARBOUR_USE_CRS_GTAPI) #if 1 ch = hb_gtReadKey(); #else