From 339c86f1bc6d95d2b14416a3faa312fb40688803 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 12 May 2009 14:11:21 +0000 Subject: [PATCH] 2009-05-12 16:10 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * utils/hbmk2/hbmk2.prg + Added -hbrun option which will run the target without trying to build it. If target is missing, the command will fail. + -run/-hbrun options will now run GUI target executable using 'start' command on Windows platforms so that hbmk2 will return and leave the app running. * include/hbextern.ch + Added HB_GZPUTC(). * include/hbsetup.ch - Removed HB_EXTENSION from documented list of build modified macros. * source/common/hbverdsp.c - Deleted HB_EXTENSION dependent part. * source/rtl/mlcfunc.c - Deleted HB_EXTENSION branch. Please modify your program to use Set( _SET_EOL ) instead of passing EOLs explicitly to memo functions. This works also in xhb. INCOMPATIBLE when for HB_EXTENSION builds. * source/rtl/alert.prg ! Minor in comment. * source/rtl/saverest.c - Removed SAVESCREEN()/RESTSCREEN() extra "lNoCheck" parameter when HB_EXTENSION is enabled. Please report on the list if you need this functionality. * source/compiler/hbfunchk.c ! Fix to prev: AT() declaration. ; TODO: Clean rest of HB_EXTENSION stuff. --- harbour/ChangeLog | 39 +++++++++++++++- harbour/include/hbextern.ch | 1 + harbour/include/hbsetup.ch | 1 - harbour/source/common/hbverdsp.c | 3 -- harbour/source/compiler/hbfunchk.c | 4 -- harbour/source/rtl/alert.prg | 4 +- harbour/source/rtl/mlcfunc.c | 65 ++++----------------------- harbour/source/rtl/saverest.c | 8 ---- harbour/utils/hbmk2/hbmk2.prg | 72 +++++++++++++++++------------- 9 files changed, 89 insertions(+), 108 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index dc1889e904..a4289528ee 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,42 @@ past entries belonging to these authors: Viktor Szakats. */ +2009-05-12 16:10 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * utils/hbmk2/hbmk2.prg + + Added -hbrun option which will run the target without trying to + build it. If target is missing, the command will fail. + + -run/-hbrun options will now run GUI target executable using 'start' + command on Windows platforms so that hbmk2 will return and leave + the app running. + + * include/hbextern.ch + + Added HB_GZPUTC(). + + * include/hbsetup.ch + - Removed HB_EXTENSION from documented list of build modified macros. + + * source/common/hbverdsp.c + - Deleted HB_EXTENSION dependent part. + + * source/rtl/mlcfunc.c + - Deleted HB_EXTENSION branch. Please modify your program to + use Set( _SET_EOL ) instead of passing EOLs explicitly to + memo functions. This works also in xhb. + INCOMPATIBLE when for HB_EXTENSION builds. + + * source/rtl/alert.prg + ! Minor in comment. + + * source/rtl/saverest.c + - Removed SAVESCREEN()/RESTSCREEN() extra "lNoCheck" parameter + when HB_EXTENSION is enabled. Please report on the list + if you need this functionality. + + * source/compiler/hbfunchk.c + ! Fix to prev: AT() declaration. + + ; TODO: Clean rest of HB_EXTENSION stuff. + 2009-05-12 15:48 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/rtl/hbzlib.c + added HB_GZPUTC( , ) => @@ -31,8 +67,7 @@ * source/rtl/memofile.c - Deleted HB_EXTENSION branches. Users of extended GETENV(), GETE(), AT() and MEMOWRIT() functionality - will have to use hbcompat.ch to stay compatible with xhb - (this isn't needed for MEMOWRIT()). + will have to use hbcompat.ch to stay compatible with xhb. INCOMPATIBLE change for those who enabled HB_EXTENSION in Harbour. Hopefully xhb will implement HB_AT() and HB_GETENV() in the future so hbcompat.ch will become diff --git a/harbour/include/hbextern.ch b/harbour/include/hbextern.ch index 47e2dba8ce..ffd99e55ce 100644 --- a/harbour/include/hbextern.ch +++ b/harbour/include/hbextern.ch @@ -1315,6 +1315,7 @@ EXTERNAL HB_GZSETPARAMS EXTERNAL HB_GZREAD EXTERNAL HB_GZWRITE EXTERNAL HB_GZGETS +EXTERNAL HB_GZPUTC EXTERNAL HB_GZPUTS EXTERNAL HB_GZGETC EXTERNAL HB_GZUNGETC diff --git a/harbour/include/hbsetup.ch b/harbour/include/hbsetup.ch index b8263e37b3..a85577db6c 100644 --- a/harbour/include/hbsetup.ch +++ b/harbour/include/hbsetup.ch @@ -68,7 +68,6 @@ /* #define HB_COMPAT_FOXPRO */ /* Enable FoxPro extensions */ /* #define HB_COMPAT_DBASE */ /* Enable dBase extensions */ /* #define HB_COMPAT_CLIP */ /* Enable CLIP extensions */ -/* #define HB_EXTENSION */ /* Enable Harbour non-portable extensions */ /* *********************************************************************** * Leave this #define if you want to allow usage of legacy Harbour 1.0.0/Clipper diff --git a/harbour/source/common/hbverdsp.c b/harbour/source/common/hbverdsp.c index ed6335566a..598e89476c 100644 --- a/harbour/source/common/hbverdsp.c +++ b/harbour/source/common/hbverdsp.c @@ -180,9 +180,6 @@ void hb_verBuildInfo( void ) #endif #if defined( HB_COMPAT_CLIP ) hb_conOutErr( "(CLIP) ", 0 ); -#endif -#if defined( HB_EXTENSION ) - hb_conOutErr( "(dirty extensions) ", 0 ); #endif hb_conOutErr( hb_conNewLine(), 0 ); diff --git a/harbour/source/compiler/hbfunchk.c b/harbour/source/compiler/hbfunchk.c index b4f2c54e95..aad5b08392 100644 --- a/harbour/source/compiler/hbfunchk.c +++ b/harbour/source/compiler/hbfunchk.c @@ -47,11 +47,7 @@ static HB_FUNCINFO hb_StdFunc[] = { "AADD" , 2, 2 }, { "ABS" , 1, 1 }, { "ASC" , 1, 1 }, -#if defined( HB_EXTENSION ) - { "AT" , 2, 4 }, -#else { "AT" , 2, 2 }, -#endif { "BOF" , 0, 0 }, { "BREAK" , 0, 1 }, { "CDOW" , 1, 1 }, diff --git a/harbour/source/rtl/alert.prg b/harbour/source/rtl/alert.prg index c45ac74dff..2b30b1360f 100644 --- a/harbour/source/rtl/alert.prg +++ b/harbour/source/rtl/alert.prg @@ -32,9 +32,7 @@ /* TOFIX: Clipper defines a clipped window for Alert() [vszakats] */ /* NOTE: Clipper will return NIL if the first parameter is not a string, but - this is not documented. This implementation converts the first - parameter to a string if another type was passed. You can switch back - to Clipper compatible mode by undefining constant HB_EXTENSION. [vszakats] */ + this is not documented. [vszakats] */ /* NOTE: Clipper handles these buttons { "Ok", "", "Cancel" } in a buggy way. This is fixed. [vszakats] */ diff --git a/harbour/source/rtl/mlcfunc.c b/harbour/source/rtl/mlcfunc.c index d5ad2c510a..c8d96fa5e7 100644 --- a/harbour/source/rtl/mlcfunc.c +++ b/harbour/source/rtl/mlcfunc.c @@ -151,67 +151,18 @@ static ULONG hb_mlGetLine( char * pszString, ULONG ulLen, ULONG ulOffset, return ulOffset; } -static PHB_EOL_INFO hb_mlGetEOLs( int iParam, int * piEOLs ) +static PHB_EOL_INFO hb_mlGetEOLs( int * piEOLs ) { PHB_EOL_INFO pEOLs = NULL; - int iEOLs = 0; -#ifdef HB_EXTENSION - char * szEOL; - ULONG ulLen, ul; + pEOLs = ( PHB_EOL_INFO ) hb_xgrab( sizeof( HB_EOL_INFO ) ); + pEOLs->szEOL = hb_setGetEOL(); + if( !pEOLs->szEOL || !pEOLs->szEOL[ 0 ] ) + pEOLs->szEOL = hb_conNewLine(); + pEOLs->ulLen = strlen( pEOLs->szEOL ); - szEOL = hb_parc( iParam ); - if( szEOL ) - { - ulLen = hb_parclen( iParam ); - if( ulLen ) - { - pEOLs = ( PHB_EOL_INFO ) hb_xgrab( sizeof( HB_EOL_INFO ) ); - pEOLs->szEOL = szEOL; - pEOLs->ulLen = ulLen; - iEOLs = 1; - } - } - else if( ISARRAY( iParam ) ) - { - PHB_ITEM pArray = hb_param( iParam, HB_IT_ARRAY ); - ULONG ulSize = hb_arrayLen( pArray ); - for( ul = 1; ul <= ulSize; ++ul ) - { - if( hb_arrayGetCLen( pArray, ul ) > 0 ) - ++iEOLs; - } - if( iEOLs ) - { - iEOLs = 0; - pEOLs = ( PHB_EOL_INFO ) hb_xgrab( sizeof( HB_EOL_INFO ) * iEOLs ); - for( ul = 1; ul <= ulSize; ++ul ) - { - ulLen = hb_arrayGetCLen( pArray, ul ); - if( ulLen > 0 ) - { - pEOLs[ iEOLs ].szEOL = hb_arrayGetCPtr( pArray, ul ); - pEOLs[ iEOLs ].ulLen = ulLen; - ++iEOLs; - } - } - } - } -#else - HB_SYMBOL_UNUSED( iParam ); -#endif + * piEOLs = pEOLs->ulLen ? 1 : 0; - if( iEOLs == 0 ) - { - pEOLs = ( PHB_EOL_INFO ) hb_xgrab( sizeof( HB_EOL_INFO ) ); - pEOLs->szEOL = hb_setGetEOL(); - if( !pEOLs->szEOL || !pEOLs->szEOL[ 0 ] ) - pEOLs->szEOL = hb_conNewLine(); - pEOLs->ulLen = strlen( pEOLs->szEOL ); - iEOLs = pEOLs->ulLen ? 1 : 0; - } - - * piEOLs = iEOLs; return pEOLs; } @@ -233,7 +184,7 @@ static char * hb_mlGetParams( int iParAdd, ULONG * pulLen, ULONG * pulLineLength * pulLen = hb_parclen( 1 ); * pulTabSize = ISNUM( 3 + iParAdd ) ? hb_parnl( 3 + iParAdd ) : 4; * pfWordWrap = ISLOG( 4 + iParAdd ) ? hb_parl( 4 + iParAdd ) : TRUE; - * pEOLs = hb_mlGetEOLs( 5 + iParAdd, piEOLs ); + * pEOLs = hb_mlGetEOLs( piEOLs ); #ifdef HB_C52_STRICT if( * pulLineLength > 254 ) * pulLineLength = 79; diff --git a/harbour/source/rtl/saverest.c b/harbour/source/rtl/saverest.c index 3e634d5d13..96900fbc33 100644 --- a/harbour/source/rtl/saverest.c +++ b/harbour/source/rtl/saverest.c @@ -98,11 +98,7 @@ HB_FUNC( SAVESCREEN ) USHORT uiTop, uiLeft, uiBottom, uiRight; ULONG ulSize; void * pBuffer; -#if defined( HB_EXTENSION ) - BOOL fNoCheck = hb_parl( 5 ); -#else BOOL fNoCheck = FALSE; -#endif hb_getScreenRange( &uiTop, &uiBottom, fNoCheck, TRUE ); hb_getScreenRange( &uiLeft, &uiRight, fNoCheck, FALSE ); @@ -119,11 +115,7 @@ HB_FUNC( RESTSCREEN ) if( ISCHAR( 5 ) ) { USHORT uiTop, uiLeft, uiBottom, uiRight; -#if defined( HB_EXTENSION ) - BOOL fNoCheck = hb_parl( 6 ); -#else BOOL fNoCheck = FALSE; -#endif hb_getScreenRange( &uiTop, &uiBottom, fNoCheck, TRUE ); hb_getScreenRange( &uiLeft, &uiRight, fNoCheck, FALSE ); diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 2a889a57aa..1847c7d049 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -376,6 +376,7 @@ FUNCTION hbmk( aArgs ) LOCAL cPostfix LOCAL nEmbedLevel + LOCAL lSkipBuild := .F. LOCAL lStopAfterInit := .F. LOCAL lStopAfterHarbour := .F. LOCAL lStopAfterCComp := .F. @@ -442,6 +443,7 @@ FUNCTION hbmk( aArgs ) CASE cParamL == "-quiet" ; s_lQuiet := .T. ; s_lInfo := .F. CASE Left( cParamL, 6 ) == "-comp=" ; s_cCOMP := SubStr( cParam, 7 ) CASE Left( cParamL, 6 ) == "-arch=" ; s_cARCH := SubStr( cParam, 7 ) + CASE cParamL == "-hbrun" ; lSkipBuild := .T. ; s_lRUN := .T. CASE cParamL == "-hbcmp" .OR. ; cParamL == "-clipper" ; s_lInfo := .F. ; lStopAfterHarbour := .F. ; lStopAfterCComp := .T. ; lCreateLib := .F. ; lCreateDyn := .F. CASE cParamL == "-hbcc" ; s_lInfo := .F. ; lStopAfterHarbour := .F. ; lStopAfterCComp := .F. ; lAcceptCFlag := .T. @@ -1048,6 +1050,7 @@ FUNCTION hbmk( aArgs ) DO CASE CASE Left( cParamL, 6 ) == "-comp=" .OR. ; Left( cParamL, 6 ) == "-arch=" .OR. ; + cParamL == "-hbrun" .OR. ; cParamL == "-hbcmp" .OR. ; cParamL == "-hbcc" .OR. ; cParamL == "-hblnk" .OR. ; @@ -1275,6 +1278,7 @@ FUNCTION hbmk( aArgs ) cParam := ArchCompFilter( cParam ) IF ! Empty( cParam ) lStopAfterInit := .T. + s_lRUN := .F. ENDIF CASE Left( cParamL, Len( "-prgflag=" ) ) == "-prgflag=" @@ -2372,7 +2376,7 @@ FUNCTION hbmk( aArgs ) IF !( s_cCOMP $ "icc|iccia64" ) cBin_Res := "rc.exe" - cOpt_Res := "{FR} /fo {OS} {IR}" + cOpt_Res := "{FR} /fo {OS} {IR}" /* NOTE: No /nologo option as of MSVC 2008. [vszakats] */ cResExt := ".res" ENDIF @@ -2492,7 +2496,7 @@ FUNCTION hbmk( aArgs ) /* Generate header with repository ID information */ - IF ! lStopAfterInit .AND. ! lStopAfterHarbour + IF ! lSkipBuild .AND. ! lStopAfterInit .AND. ! lStopAfterHarbour IF ! Empty( s_cVCSHEAD ) tmp1 := VCSID( s_cVCSDIR, @tmp2 ) /* Use the same EOL for all platforms to avoid unnecessary rebuilds. */ @@ -2511,7 +2515,7 @@ FUNCTION hbmk( aArgs ) /* Header paths */ - IF ! lStopAfterInit .AND. ! lStopAfterHarbour + IF ! lSkipBuild .AND. ! lStopAfterInit .AND. ! lStopAfterHarbour FOR EACH tmp IN s_aINCPATH AAdd( s_aOPTPRG, "-i" + tmp ) AAdd( s_aOPTC, StrTran( cOptIncMask, "{DI}", tmp ) ) @@ -2521,7 +2525,7 @@ FUNCTION hbmk( aArgs ) /* Do header detection and create incremental file list for .c files */ - IF ! lStopAfterInit .AND. ! lStopAfterHarbour + IF ! lSkipBuild .AND. ! lStopAfterInit .AND. ! lStopAfterHarbour headstate := NIL @@ -2556,7 +2560,7 @@ FUNCTION hbmk( aArgs ) /* Create incremental file list for .prg files */ - IF ! lStopAfterInit .AND. ! lStopAfterHarbour + IF ! lSkipBuild .AND. ! lStopAfterInit .AND. ! lStopAfterHarbour /* Incremental */ @@ -2584,7 +2588,7 @@ FUNCTION hbmk( aArgs ) /* Harbour compilation */ - IF ! lStopAfterInit .AND. Len( s_aPRG_TODO ) > 0 .AND. ! s_lCLEAN + IF ! lSkipBuild .AND. ! lStopAfterInit .AND. Len( s_aPRG_TODO ) > 0 .AND. ! s_lCLEAN IF s_lINC .AND. ! s_lQuiet hbmk_OutStd( I_( "Compiling Harbour sources..." ) ) @@ -2677,7 +2681,7 @@ FUNCTION hbmk( aArgs ) ENDIF ENDIF - IF ! lStopAfterInit .AND. ! lStopAfterHarbour + IF ! lSkipBuild .AND. ! lStopAfterInit .AND. ! lStopAfterHarbour /* Do entry function detection on platform required and supported */ IF ! s_lDONTEXEC .AND. ! lStopAfterCComp .AND. s_cMAIN == NIL @@ -3373,29 +3377,6 @@ FUNCTION hbmk( aArgs ) ENDIF ENDIF ENDIF - - IF s_lBEEP - DoBeep( nErrorLevel == 0 ) - s_lBEEP := .F. - ENDIF - - IF s_lRUN .AND. ! lCreateLib .AND. ! lCreateDyn - #if defined( __PLATFORM__UNIX ) - IF Empty( FN_DirGet( s_cPROGNAME ) ) - s_cPROGNAME := "." + hb_osPathSeparator() + s_cPROGNAME - ENDIF - #endif - cCommand := AllTrim( PathSepToTarget( s_cPROGNAME ) + " " + ArrayToList( s_aOPTRUN ) ) - IF s_lTRACE - IF ! s_lQuiet - hbmk_OutStd( I_( "Running executable:" ) ) - ENDIF - OutStd( cCommand, hb_osNewLine() ) - ENDIF - IF ! s_lDONTEXEC - nErrorLevel := hbmk_run( cCommand ) - ENDIF - ENDIF ENDIF ENDIF @@ -3407,6 +3388,36 @@ FUNCTION hbmk( aArgs ) DoBeep( nErrorLevel == 0 ) ENDIF + IF ! lStopAfterHarbour .AND. ! lStopAfterCComp .AND. ; + ! lCreateLib .AND. ! lCreateDyn .AND. ; + nErrorLevel == 0 .AND. ! s_lCLEAN .AND. s_lRUN + #if defined( __PLATFORM__UNIX ) + IF Empty( FN_DirGet( s_cPROGNAME ) ) + s_cPROGNAME := "." + hb_osPathSeparator() + s_cPROGNAME + ENDIF + #endif + cCommand := PathSepToTarget( s_cPROGNAME ) + #if defined( __PLATFORM__WINDOWS ) + IF s_lGUI + IF hb_osIsWinNT() + cCommand := 'start "" "' + cCommand + '"' + ELSE + cCommand := 'start ' + cCommand + ENDIF + ENDIF + #endif + cCommand := AllTrim( cCommand + " " + ArrayToList( s_aOPTRUN ) ) + IF s_lTRACE + IF ! s_lQuiet + hbmk_OutStd( I_( "Running executable:" ) ) + ENDIF + OutStd( cCommand, hb_osNewLine() ) + ENDIF + IF ! s_lDONTEXEC + nErrorLevel := hb_run( cCommand ) + ENDIF + ENDIF + RETURN nErrorLevel STATIC PROCEDURE DoBeep( lSuccess ) @@ -5580,6 +5591,7 @@ STATIC PROCEDURE ShowHelp( lLong ) { "-lng=" , I_( "list of languages to be replaced in ${lng} macros in .pot/.po filenames and output .hbl/.po filenames. Comma separared list:\n-lng=en-EN,hu-HU,de" ) },; { "-po=" , I_( "create/update .po file from source. Merge it with previous .po file of the same name" ) },; NIL,; + { "-hbrun" , I_( "run target" ) },; { "-hbcmp|-clipper" , I_( "stop after creating the object files\ncreate link/copy hbmk to hbcmp/clipper for the same effect" ) },; { "-hbcc" , I_( "stop after creating the object files and accept raw C flags\ncreate link/copy hbmk to hbcc for the same effect" ) },; { "-hblnk" , I_( "accept raw linker flags" ) },;