From cd0cc92c3d1f6e627cdaf5d50dc0f8e50f2a1a17 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 23 Apr 2012 18:31:42 +0000 Subject: [PATCH] 2012-04-23 20:31 UTC+0200 Viktor Szakats (harbour syenar.net) * utils/hbmk2/hbmk2.prg + added experimental framework for -ku: option. It is processed by hbmk2 and HVM CP set appropriately before calling the embedded Harbour compiler. As discussed here: https://groups.google.com/d/msg/harbour-devel/a1_-DDXVVYM/CE3NspTzHV4J I couldn't spot or test the effect of this yet. Accepted values: "utf8", "cp1250", "cp852", etc... + added TODO to switch the internal codepage to UTF8EX. it should help further in handling filenames with accents. non-priority. * src/rtl/menuto.prg * formatting * contrib/hbqt/gtqtc/gtqtc.cpp - delete recently commented lines --- harbour/ChangeLog | 26 ++++++++-- harbour/contrib/hbqt/gtqtc/gtqtc.cpp | 2 - harbour/src/rtl/menuto.prg | 2 +- harbour/utils/hbmk2/hbmk2.prg | 73 ++++++++++++++++++++++++++-- 4 files changed, 91 insertions(+), 12 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6b27e416d2..74f46db1d5 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,24 @@ The license applies to all entries newer than 2009-04-28. */ +2012-04-23 20:31 UTC+0200 Viktor Szakats (harbour syenar.net) + * utils/hbmk2/hbmk2.prg + + added experimental framework for -ku: option. It is + processed by hbmk2 and HVM CP set appropriately before calling + the embedded Harbour compiler. As discussed here: + https://groups.google.com/d/msg/harbour-devel/a1_-DDXVVYM/CE3NspTzHV4J + I couldn't spot or test the effect of this yet. + Accepted values: "utf8", "cp1250", "cp852", etc... + + added TODO to switch the internal codepage to UTF8EX. + it should help further in handling filenames with accents. + non-priority. + + * src/rtl/menuto.prg + * formatting + + * contrib/hbqt/gtqtc/gtqtc.cpp + - delete recently commented lines + 2012-04-23 14:16 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/src/rtl/gtwin/gtwin.c * redirect OUTSTD() and OUTERR() to GT buffer if corresponding handles @@ -36,13 +54,13 @@ * contrib/hbide/ideprojmanager.prg * contrib/hbide/idesaveload.prg * contrib/hbide/idethemes.prg - ! Fixed: changes due to HBQT engine which now checks the + ! Fixed: changes due to HBQT engine which now checks the object validity by looking at object inheritance. This covers - many cases but not all. For all practical purposes hbIDE is + many cases but not all. For all practical purposes hbIDE is working ok now but in some extended usage, it again fails. - Looking at the ways if this could be covered under object + Looking at the ways if this could be covered under object inheritance chain, which looks to be dim, so far. - So probably we have to revert back that change but let me + So probably we have to revert back that change but let me build the hypothesis before reverting. 2012-04-20 11:02 UTC+0200 Viktor Szakats (harbour syenar.net) diff --git a/harbour/contrib/hbqt/gtqtc/gtqtc.cpp b/harbour/contrib/hbqt/gtqtc/gtqtc.cpp index 9caa04d04b..d7c5985ccb 100644 --- a/harbour/contrib/hbqt/gtqtc/gtqtc.cpp +++ b/harbour/contrib/hbqt/gtqtc/gtqtc.cpp @@ -1161,8 +1161,6 @@ static HB_BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) pFuncTable->Version = hb_gt_wvt_Version; pFuncTable->Tone = hb_gt_wvt_Tone; pFuncTable->Info = hb_gt_wvt_Info; -// pFuncTable->SetDispCP = hb_gt_wvt_SetDispCP; -// pFuncTable->SetKeyCP = hb_gt_wvt_SetKeyCP; pFuncTable->ReadKey = hb_gt_wvt_ReadKey; pFuncTable->MouseIsPresent = hb_gt_wvt_mouse_IsPresent; diff --git a/harbour/src/rtl/menuto.prg b/harbour/src/rtl/menuto.prg index 5fa6441dad..e741718d3f 100644 --- a/harbour/src/rtl/menuto.prg +++ b/harbour/src/rtl/menuto.prg @@ -240,7 +240,7 @@ FUNCTION __MenuTo( bBlock, cVariable ) EXIT OTHERWISE // did user hit a hot key? - IF Len( cKey := Upper ( hb_keyChar( nKey ) ) ) > 0 + IF Len( cKey := Upper( hb_keyChar( nKey ) ) ) > 0 FOR y := 1 TO nArrLen IF Upper( Left( LTrim( t_aLevel[ nPointer - 1, y, 3 ] ), Len( cKey ) ) ) == cKey n := y diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 3454e1093d..4a7d1e326c 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -98,6 +98,8 @@ writing, most of them has one created. Thank you. [vszakats] */ +/* TODO: Switch to UTF8EX codepage internally. (non-priority) */ + /* TODO: Support debug/release modes. Some default setting can be set accordingly, and user can use it to further tweak settings. */ /* TODO: Further clean hbmk context var usage (hbmk2 scope, project scope, @@ -460,8 +462,9 @@ REQUEST hbmk_KEYW #define _HBMK_cHBX 147 #define _HBMK_aGT 148 +#define _HBMK_cCPPRG 149 -#define _HBMK_MAX_ 148 +#define _HBMK_MAX_ 149 #define _HBMK_DEP_CTRL_MARKER ".control." /* must be an invalid path */ @@ -2553,6 +2556,38 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel ) l_cIMPLIBNAME := NIL ENDIF + /* NOTE: Using ':' as value separator to emulate Harbour compiler options */ + /* EXPERIMENTAL */ + CASE Left( cParamL, Len( "-ku:" ) ) == "-ku:" + + IF hbmk[ _HBMK_nHBMODE ] == _HBMODE_NATIVE + cParam := MacroProc( hbmk, SubStr( cParam, Len( "-ku:" ) + 1 ), aParam[ _PAR_cFileName ] ) + IF ! Empty( cParam ) + SWITCH Lower( cParam ) + CASE "utf8" + hbmk[ _HBMK_cCPPRG ] := "UTF8" + EXIT + OTHERWISE + hbmk[ _HBMK_cCPPRG ] := NIL + FOR EACH tmp IN hb_cdpList() + IF Lower( cParam ) == Lower( hb_cdpUniID( tmp ) ) + hbmk[ _HBMK_cCPPRG ] := tmp + EXIT + ENDIF + NEXT + IF Empty( hbmk[ _HBMK_cCPPRG ] ) + IF hbmk[ _HBMK_lInfo ] + hbmk_OutErr( hbmk, hb_StrFormat( I_( "Warning: Ignored unsupported codepage value: %1$s" ), cParam ) ) + ENDIF + ENDIF + ENDSWITCH + ENDIF + ELSE + IF hbmk[ _HBMK_lInfo ] + hbmk_OutErr( hbmk, hb_StrFormat( I_( "Warning: Option available only when using embedded Harbour compiler: %1$s" ), cParam ) ) + ENDIF + ENDIF + CASE Left( cParamL, Len( "-ln=" ) ) == "-ln=" cParam := MacroProc( hbmk, SubStr( cParam, Len( "-ln=" ) + 1 ), aParam[ _PAR_cFileName ] ) @@ -3146,7 +3181,7 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel ) IF lHarbourInfo IF hbmk[ _HBMK_nHBMODE ] == _HBMODE_NATIVE /* Use integrated compiler */ - hb_compile( "harbour", hbmk[ _HBMK_aOPTPRG ] ) + hbmk2_hb_compile( hbmk, "harbour", hbmk[ _HBMK_aOPTPRG ] ) ELSE /* Use external compiler */ cCommand := FNameEscape( hb_DirSepAdd( PathSepToSelf( l_cHB_INSTALL_BIN ) ) + cBin_CompPRG + cBinExt, hbmk[ _HBMK_nCmd_Esc ] ) +; @@ -5288,9 +5323,9 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel ) IF ! hbmk[ _HBMK_lDONTEXEC ] IF hb_mtvm() .AND. Len( aTO_DO:__enumBase() ) > 1 - AAdd( aThreads, { hb_threadStart( @hb_compile(), "harbour", aCommand ), aCommand } ) + AAdd( aThreads, { hb_threadStart( @hbmk2_hb_compile(), hbmk, "harbour", aCommand ), aCommand } ) ELSE - IF ( tmp := hb_compile( "harbour", aCommand ) ) != 0 + IF ( tmp := hbmk2_hb_compile( hbmk, "harbour", aCommand ) ) != 0 hbmk_OutErr( hbmk, hb_StrFormat( I_( "Error: Running Harbour compiler (embedded). %1$s" ), hb_ntos( tmp ) ) ) IF ! hbmk[ _HBMK_lQuiet ] OutErr( "(" + FNameEscape( hb_DirSepAdd( hb_DirBase() ) + cBin_CompPRG + cBinExt, hbmk[ _HBMK_nCmd_Esc ] ) + ")" +; @@ -7159,6 +7194,34 @@ STATIC PROCEDURE DoBeep( lSuccess ) RETURN +STATIC FUNCTION hbmk2_hb_compile( hbmk, ... ) + LOCAL cSaveCP + LOCAL xRetVal + + IF Empty( hbmk[ _HBMK_cCPPRG ] ) + RETURN hb_compile( ... ) + ELSE + cSaveCP := hb_cdpSelect( hbmk[ _HBMK_cCPPRG ] ) + xRetVal := hb_compile( ... ) + hb_cdpSelect( cSaveCP ) + ENDIF + + RETURN xRetVal + +STATIC FUNCTION hbmk2_hb_compileBuf( hbmk, ... ) + LOCAL cSaveCP + LOCAL xRetVal + + IF Empty( hbmk[ _HBMK_cCPPRG ] ) + RETURN hb_compileBuf( ... ) + ELSE + cSaveCP := hb_cdpSelect( hbmk[ _HBMK_cCPPRG ] ) + xRetVal := hb_compileBuf( ... ) + hb_cdpSelect( cSaveCP ) + ENDIF + + RETURN xRetVal + STATIC FUNCTION CompileCLoop( hbmk, aTO_DO, cBin_CompC, cOpt_CompC, cObjExt, nOpt_Esc, nOpt_FNF, nJob, nJobs ) LOCAL lResult := .T. LOCAL cCommand @@ -7311,7 +7374,7 @@ STATIC FUNCTION FindNewerHeaders( hbmk, cFileName, tTimeParent, lCMode, cBin_Com ListToArray( iif( ! Empty( GetEnv( "HB_USER_PRGFLAGS" ) ), " " + GetEnv( "HB_USER_PRGFLAGS" ), "" ) ),; hbmk[ _HBMK_aOPTPRG ] } ) - IF ! hb_isString( tmp := hb_compileBuf( "harbour", aCommand ) ) + IF ! hb_isString( tmp := hbmk2_hb_compileBuf( hbmk, "harbour", aCommand ) ) RETURN .F. ENDIF