From 18b423e72f7bf51e887c0be039d7d821545381a8 Mon Sep 17 00:00:00 2001 From: Luiz Rafael Culik Date: Wed, 20 Nov 2002 23:57:17 +0000 Subject: [PATCH] See changelog 2002-11-20 22:00 UTC-0300 --- harbour/utils/hbmake/hbmake.prg | 67 ++++++++----- harbour/utils/hbmake/hbmlang.c | 169 ++++++++++++++++++++++++++++++++ 2 files changed, 213 insertions(+), 23 deletions(-) diff --git a/harbour/utils/hbmake/hbmake.prg b/harbour/utils/hbmake/hbmake.prg index db3f0c0d68..0fa3d2bfe7 100644 --- a/harbour/utils/hbmake/hbmake.prg +++ b/harbour/utils/hbmake/hbmake.prg @@ -774,7 +774,10 @@ FUNCTION Compfiles() LOCAL lEnd := .f. LOCAL xItem LOCAL lLinux := At( 'linux', Lower( Os() ) ) > 0 + Local nFile := 1 + Local aGauge := GaugeNew( 5, 5, 7,40 , "W/B", "W+/B" ,'²') + @ 4, 5 Say "Compiling :" FOR nCount := 1 TO Len( aOrder ) IF !lExtended @@ -813,11 +816,11 @@ FUNCTION Compfiles() cComm := Strtran( cComm, "o$*", "o" + aCs[ nPos ] ) cComm := Strtran( cComm, "$**", aPrgs[ nFiles ] ) - cComm += " > test.out" + cComm += " > Test.out" Outstd( cComm ) Outstd( hb_osnewline() ) ! ( cComm ) - cErrText := Memoread( 'test.out' ) + cErrText := Memoread( 'Test.out' ) lEnd := 'C2006' $ cErrText .or. 'No code generated' $ cErrText IF !lIgnoreErrors .and. lEnd @@ -826,7 +829,7 @@ FUNCTION Compfiles() ELSE - Ferase( 'test.out' ) + Ferase( 'Test.out' ) ENDIF @@ -948,8 +951,12 @@ FUNCTION Compfiles() ENDIF IF Len( acs ) > 0 + GaugeDisplay( aGauge ) + nFile:=1 + FOR nFiles := 1 TO Len( acs ) + @ 4,16 Say space(50) xItem := Substr( acs[ nFiles ], Rat( If( lgcc, '/', '\' ), ; acs[ nFiles ] ) + 1 ) @@ -969,20 +976,25 @@ FUNCTION Compfiles() ENDIF cComm := Strtran( cComm, "$**", acs[ nFiles ] ) - cComm += " > test.out" - Outstd( cComm ) - Outstd( hb_osnewline() ) + cComm += " > Test.out" + @ 4,16 Say acs[nFiles] + GaugeUpdate(aGauge,nFile/Len( aprgs )) + +// Outstd( cComm ) +// Outstd( hb_osnewline() ) ! ( cComm ) - cErrText := Memoread( 'test.out' ) + nFile++ + cErrText := Memoread( 'Test.out' ) lEnd := 'Error' $ cErrText IF !lIgnoreErrors .and. lEnd + if(at("LINUX",upper(OS()))>0,__run("mcedit Test.out"),__run("Notepad Test.out")) QUIT ELSE - Ferase( 'test.out' ) + Ferase( 'Test.out' ) ENDIF @@ -1026,6 +1038,8 @@ FUNCTION Compfiles() ENDIF ENDIF + GaugeDisplay( aGauge ) + nFile:=1 FOR nFiles := 1 TO Len( aprgs ) @@ -1047,22 +1061,27 @@ FUNCTION Compfiles() ENDIF cComm := Strtran( cComm, "$**", aprgs[ nFiles ] ) - cComm += " > test.out" - Outstd( " " ) + cComm += " > Test.out" +// Outstd( " " ) + +// Outstd( cComm ) +// Outstd( hb_osnewline() ) + @ 4,16 Say cPrg + GaugeUpdate(aGauge,nFile/Len( aprgs )) +// Outstd( hb_osnewline() ) + nFile++ - Outstd( cComm ) - Outstd( hb_osnewline() ) ! ( cComm ) - cErrText := Memoread( 'test.out' ) + cErrText := Memoread( 'Test.out' ) lEnd := 'C2006' $ cErrText .or. 'No code generated' $ cErrText IF !lIgnoreErrors .and. lEnd - + if(at("LINUX",upper(OS()))>0,__run("mcedit Test.out"),__run("Notepad Test.out")) QUIT ELSE - Ferase( 'test.out' ) + Ferase( 'Test.out' ) ENDIF @@ -1992,7 +2011,7 @@ FUNCTION CompUpdatedfiles() Outstd( cComm ) Outstd( hb_osnewline() ) ! ( cComm ) - cErrText := Memoread( 'test.out' ) + cErrText := Memoread( 'Test.out' ) lEnd := 'C2006' $ cErrText .or. 'No code generated' $ cErrText IF !lIgnoreErrors .and. lEnd @@ -2001,7 +2020,7 @@ FUNCTION CompUpdatedfiles() ELSE - Ferase( 'test.out' ) + Ferase( 'Test.out' ) ENDIF @@ -2107,11 +2126,11 @@ FUNCTION CompUpdatedfiles() cComm := Strtran( cComm, "o$*", "o" + aobjsc[ nPos ] ) cComm := Strtran( cComm, "$**", acs[ nFiles ] ) - cComm += " > test.out" + cComm += " > Test.out" Outstd( cComm ) Outstd( hb_osnewline() ) ! ( cComm ) - cErrText := Memoread( 'test.out' ) + cErrText := Memoread( 'Test.out' ) lEnd := 'Error' $ cErrText IF !lIgnoreErrors .and. lEnd @@ -2120,7 +2139,7 @@ FUNCTION CompUpdatedfiles() ELSE - Ferase( 'test.out' ) + Ferase( 'Test.out' ) ENDIF @@ -2175,12 +2194,12 @@ FUNCTION CompUpdatedfiles() cComm := Strtran( cComm, "o$*", "o" + aObjs[ nPos ] ) cComm := Strtran( cComm, "$**", aprgs[ nFiles ] ) - cComm += " > test.out" + cComm += " > Test.out" Outstd( " " ) Outstd( cComm ) Outstd( hb_osnewline() ) ! ( cComm ) - cErrText := Memoread( 'test.out' ) + cErrText := Memoread( 'Test.out' ) lEnd := 'C2006' $ cErrText .or. 'No code generated' $ cErrText IF !lIgnoreErrors .and. lEnd @@ -2189,7 +2208,7 @@ FUNCTION CompUpdatedfiles() ELSE - Ferase( 'test.out' ) + Ferase( 'Test.out' ) ENDIF @@ -3645,6 +3664,8 @@ FUNCTION WriteMakeFileHeader() Fwrite( nLinkHandle, "BHC = $(HMAKEDIR)" + CRLF ) Fwrite( nLinkHandle, "!endif" + CRLF ) Fwrite( nLinkHandle, " " + CRLF ) + Fwrite( nLinkHandle, "RECURSE="+if(lRecurse," YES "," NO ") + CRLF ) + Fwrite( nLinkHandle, " " + CRLF ) RETURN nil diff --git a/harbour/utils/hbmake/hbmlang.c b/harbour/utils/hbmake/hbmlang.c index 0e3d15239c..c1c1b24b5c 100644 --- a/harbour/utils/hbmake/hbmlang.c +++ b/harbour/utils/hbmake/hbmlang.c @@ -132,3 +132,172 @@ HB_FUNC(GETUSERLANG) } +#include "hbapiitm.h" +#include "hbapigt.h" + +// Box array definitions +#define B_TOP 1 +#define B_LEFT 2 +#define B_BOTTOM 3 +#define B_RIGHT 4 +#define B_BACKCOLOR 5 +#define B_BARCOLOR 6 +#define B_DISPLAYNUM 8 +#define B_BARCHAR 7 +#define B_PERCENT 9 +#define B_LEN B_PERCENT + +#define B_BOXLINES "ÚÄ¿³ÙÄÀ³" + +static void hb_gaugeUpdate( PHB_ITEM pArray, float fPercent ); + +/* GaugeNew( , , , , + [], + [], + [] ) --> aGauge +*/ +HB_FUNC( GAUGENEW ) +{ + PHB_ITEM pReturn = hb_itemArrayNew( B_LEN ); /* Create array */ + PHB_ITEM pItem; + + pItem = hb_itemPutNL( NULL, ( ISNUM( B_TOP ) ? hb_parni( B_TOP ) : 0 ) ); + hb_itemArrayPut( pReturn, B_TOP, pItem ); + hb_itemRelease( pItem ); + + pItem = hb_itemPutNL( NULL, ( ISNUM( B_LEFT ) ? hb_parni( B_LEFT ) : 0 ) ); + hb_itemArrayPut( pReturn, B_LEFT, pItem ); + hb_itemRelease( pItem ); + + pItem = hb_itemPutNL( NULL, + ( ISNUM( B_BOTTOM ) ? + ( hb_parni( B_BOTTOM ) < hb_parni( B_TOP ) + 2 ? + hb_parni( B_TOP ) + 2 : hb_parni( B_BOTTOM ) ) : 0 ) ); + hb_itemArrayPut( pReturn, B_BOTTOM, pItem ); + hb_itemRelease( pItem ); + + pItem = hb_itemPutNL( NULL, + ( ISNUM( B_RIGHT ) ? + ( hb_parni( B_RIGHT ) < hb_parni( B_LEFT ) + 4 ? + hb_parni( B_LEFT ) + 4 : hb_parni( B_RIGHT ) ) : 0 ) ); + hb_itemArrayPut( pReturn, B_RIGHT, pItem ); + hb_itemRelease( pItem ); + + pItem = hb_itemPutC( NULL, ( ISCHAR( B_BACKCOLOR ) ? hb_parc( B_BACKCOLOR ) : "W/N" ) ); + hb_itemArrayPut( pReturn, B_BACKCOLOR, pItem ); + hb_itemRelease( pItem ); + + pItem = hb_itemPutC( NULL, ( ISCHAR( B_BARCOLOR ) ? hb_parc( B_BARCOLOR ) : "W+/N" ) ); + hb_itemArrayPut( pReturn, B_BARCOLOR, pItem ); + hb_itemRelease( pItem ); + + pItem = hb_itemPutL( NULL, !( ISNUM( B_RIGHT ) && + ISNUM( B_LEFT ) && + ( hb_parni( B_RIGHT ) < hb_parni( B_LEFT ) + 9 ) ) ); + hb_itemArrayPut( pReturn, B_DISPLAYNUM, pItem ); + hb_itemRelease( pItem ); + + pItem = hb_itemPutC( NULL, ( ISCHAR( B_BARCHAR ) ? hb_parc( B_BARCHAR ) : ( char * ) '\xdb') ); + hb_itemArrayPut( pReturn, B_BARCHAR, pItem ); + hb_itemRelease( pItem ); + + pItem = hb_itemPutNL( NULL, 0 ); + hb_itemArrayPut( pReturn, B_PERCENT, pItem ); + hb_itemRelease( pItem ); + + hb_itemReturn( pReturn ); + hb_itemRelease( pReturn ); +} + +/* GaugeDisplay( aGauge ) --> aGauge +*/ +HB_FUNC( GAUGEDISPLAY ) +{ + PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY ); + + if( pArray ) + { + int iCenter = ( ( hb_arrayGetNL( pArray, B_RIGHT ) - hb_arrayGetNL( pArray, B_LEFT ) ) / 2 ) + 1; + char szOldColor[ CLR_STRLEN ]; + char * szStr = " "; + + hb_gtGetColorStr( szOldColor ); + hb_gtSetColorStr( hb_arrayGetCPtr( pArray, B_BACKCOLOR ) ); + + hb_gtBox( (SHORT) hb_arrayGetNL( pArray, B_TOP ), + (SHORT) hb_arrayGetNL( pArray, B_LEFT ), + (SHORT) hb_arrayGetNL( pArray, B_BOTTOM ), + (SHORT) hb_arrayGetNL( pArray, B_RIGHT ), + (BYTE *) szStr ); + + hb_gtBox( (SHORT) hb_arrayGetNL( pArray, B_TOP ), + (SHORT) hb_arrayGetNL( pArray, B_LEFT ), + (SHORT) hb_arrayGetNL( pArray, B_BOTTOM ), + (SHORT) hb_arrayGetNL( pArray, B_RIGHT ), + (BYTE *) B_BOXLINES ); + + if( hb_arrayGetL( pArray, B_DISPLAYNUM ) ) + hb_gtWriteAt( (USHORT) hb_arrayGetNL( pArray, B_TOP ), + iCenter, ( BYTE * ) "[ ]", 8 ); + + hb_gtSetColorStr( szOldColor ); + + hb_gaugeUpdate( pArray, (float) hb_arrayGetNL( pArray, B_PERCENT ) ); + + hb_itemReturn( pArray ); + } +} + +/* GaugeUpdate( aGauge, nPercent ) --> aGauge +*/ +HB_FUNC( GAUGEUPDATE ) +{ + PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY ); + + if( pArray ) + { + hb_gaugeUpdate( pArray, ISNUM( 2 ) ? (float) hb_parnd( 2 ) : 0 ); + + hb_itemReturn( pArray ); + } +} + +static void hb_gaugeUpdate( PHB_ITEM pArray, float fPercent ) +{ + int iCenter = ( ( hb_arrayGetNL( pArray, B_RIGHT ) - hb_arrayGetNL( pArray, B_LEFT ) ) / 2 ) + 1; + int iRatio = hb_arrayGetNL( pArray, B_RIGHT ) - hb_arrayGetNL( pArray, B_LEFT ) - 1; + int iRow; + int iCols; + int iMax; + char szOldColor[ CLR_STRLEN ]; + char * szStr = " "; + char szPct[ 4 ]; + + hb_gtGetColorStr( szOldColor ); + hb_gtSetColorStr( hb_arrayGetCPtr( pArray, B_BARCOLOR ) ); + + fPercent = ( fPercent < 0 ? 0 : ( fPercent > 1 ? 1 : fPercent ) ); + iCols = (int) (fPercent * iRatio); + + if( hb_arrayGetL( pArray, B_DISPLAYNUM ) ) + { +// sprintf( szPct, "%3.0f\%", fPercent * 100 ); + sprintf( szPct, "%3.0f%%", fPercent * 100 ); + hb_gtWriteAt( (USHORT) hb_arrayGetNL( pArray, B_TOP ), + (USHORT) iCenter + 2, (BYTE *) szPct, 4 ); + } + + hb_gtBox( hb_arrayGetNL( pArray, B_TOP ) + 1, hb_arrayGetNL( pArray, B_LEFT ) + 1, + hb_arrayGetNL( pArray, B_BOTTOM ) - 1, hb_arrayGetNL( pArray, B_RIGHT ) - 1, + ( BYTE * ) szStr ); + + iMax = hb_arrayGetNL( pArray, B_BOTTOM ) - hb_arrayGetNL( pArray, B_TOP ) - 1; + for( iRow = 1; iRow <= iMax; iRow++ ) + { + hb_gtRepChar( (USHORT) (iRow + hb_arrayGetNL( pArray, B_TOP )), + (USHORT) (hb_arrayGetNL( pArray, B_LEFT ) + 1), + ( BYTE ) * hb_arrayGetCPtr( pArray, B_BARCHAR ), iCols ); + } + + hb_gtSetColorStr( szOldColor ); +}