diff --git a/ChangeLog.txt b/ChangeLog.txt index 23ed2b863b..f31b6dc0c5 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,20 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2015-03-27 16:21 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * src/debug/dbgentry.c + % small optimizations + + * src/rtl/gtwvt/gtwvt.c + ! fixed extended keycodes generated for ASCII characters + + * src/rtl/gtwin/gtwin.c + % removed meaningless code + + * src/rtl/inkeyapi.c + * added translation for extended keycodes to ASCII characters + in hb_keyChar() + 2015-03-24 14:53 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/rtl/hbsocket.c * use inet_pton() or inet_aton() if available instead of inet_addr() diff --git a/src/debug/dbgentry.c b/src/debug/dbgentry.c index f54cddf64f..3625a907b8 100644 --- a/src/debug/dbgentry.c +++ b/src/debug/dbgentry.c @@ -491,7 +491,6 @@ static void hb_dbgActivate( HB_DEBUGINFO * info ) void hb_dbgEntry( int nMode, int nLine, const char * szName, int nIndex, PHB_ITEM pFrame ) { int i; - HB_ULONG nProcLevel; char szProcName[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 5 ]; HB_DEBUGINFO ** infoPtr = ( HB_DEBUGINFO ** ) hb_stackDebugInfo(); HB_DEBUGINFO * info = *infoPtr; @@ -560,20 +559,19 @@ void hb_dbgEntry( int nMode, int nLine, const char * szName, int nIndex, PHB_ITE case HB_DBG_SHOWLINE: { HB_CALLSTACKINFO * pTop = &info->aCallStack[ info->nCallStackLen - 1 ]; - HB_BOOL bOldClsScope; HB_TRACE( HB_TR_DEBUG, ( "SHOWLINE %d", nLine ) ); - nProcLevel = hb_dbg_ProcLevel(); - /* Check if we've hit a tracepoint */ - bOldClsScope = hb_clsSetScope( HB_FALSE ); for( i = 0; i < info->nTracePoints; i++ ) { HB_TRACEPOINT * tp = &info->aTrace[ i ]; + HB_BOOL bOldClsScope; PHB_ITEM xValue; + bOldClsScope = hb_clsSetScope( HB_FALSE ); xValue = hb_dbgEval( info, &info->aWatch[ tp->nIndex ], NULL ); + hb_clsSetScope( bOldClsScope ); if( xValue != tp->xValue && ( xValue == NULL || tp->xValue == NULL || @@ -584,42 +582,38 @@ void hb_dbgEntry( int nMode, int nLine, const char * szName, int nIndex, PHB_ITE hb_itemRelease( tp->xValue ); tp->xValue = xValue; - pTop->nLine = nLine; - info->nProcLevel = nProcLevel - ( hb_dbgIsAltD() ? 2 : 0 ); - info->bTraceOver = HB_FALSE; info->bCodeBlock = HB_FALSE; + info->bTraceOver = HB_FALSE; + info->bNextRoutine = HB_FALSE; info->bGo = HB_FALSE; if( info->bToCursor ) { info->bToCursor = HB_FALSE; hb_xfree( info->szToCursorModule ); } - info->bNextRoutine = HB_FALSE; - - hb_dbgActivate( info ); - return; + break; } if( xValue ) hb_itemRelease( xValue ); } - hb_clsSetScope( bOldClsScope ); - if( hb_dbgIsBreakPoint( info, pTop->szModule, nLine ) >= 0 || - hb_dbg_InvokeDebug( HB_FALSE ) || - ( info->pFunInvoke && info->pFunInvoke() ) ) + if( i >= info->nTracePoints && + ( hb_dbgIsBreakPoint( info, pTop->szModule, nLine ) >= 0 || + hb_dbg_InvokeDebug( HB_FALSE ) || + ( info->pFunInvoke && info->pFunInvoke() ) ) ) { info->bTraceOver = HB_FALSE; + info->bNextRoutine = HB_FALSE; + info->bGo = HB_FALSE; if( info->bToCursor ) { info->bToCursor = HB_FALSE; hb_xfree( info->szToCursorModule ); } - info->bNextRoutine = HB_FALSE; - info->bGo = HB_FALSE; } /* Check if we must skip every level above info->nTraceLevel */ - if( info->bTraceOver ) + else if( info->bTraceOver ) { if( info->nTraceLevel < info->nCallStackLen ) return; @@ -653,7 +647,7 @@ void hb_dbgEntry( int nMode, int nLine, const char * szName, int nIndex, PHB_ITE pTop->nLine = nLine; if( ! info->bGo ) { - info->nProcLevel = nProcLevel - ( hb_dbgIsAltD() ? 2 : 0 ); + info->nProcLevel = hb_dbg_ProcLevel() - ( hb_dbgIsAltD() ? 2 : 0 ); hb_dbgActivate( info ); } return; @@ -1558,10 +1552,10 @@ PHB_ITEM hb_dbgGetSourceFiles( void * handle ) static HB_BOOL hb_dbgIsAltD( void ) { - char szName[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 5 ]; + HB_ISIZ nOffset = hb_stackBaseProcOffset( 1 ); - hb_procinfo( 1, szName, NULL, NULL ); - return ! strcmp( szName, "ALTD" ); + return nOffset > 0 && + strcmp( hb_itemGetSymbol( hb_stackItem( nOffset ) )->szName, "ALTD" ); } diff --git a/src/rtl/gtwin/gtwin.c b/src/rtl/gtwin/gtwin.c index 9086c3c2ff..a9adab4d26 100644 --- a/src/rtl/gtwin/gtwin.c +++ b/src/rtl/gtwin/gtwin.c @@ -1744,8 +1744,6 @@ static int hb_gt_win_ReadKey( PHB_GT pGT, int iEventMask ) ch = HB_INKEY_NEW_UNICODE( u ); #endif } - else - ch = 0; } } else if( s_bMouseEnable && diff --git a/src/rtl/gtwvt/gtwvt.c b/src/rtl/gtwvt/gtwvt.c index 1a6299f61f..d09facf191 100644 --- a/src/rtl/gtwvt/gtwvt.c +++ b/src/rtl/gtwvt/gtwvt.c @@ -2610,7 +2610,7 @@ static HB_BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, if( iKey >= 128 ) iKey = HB_INKEY_NEW_UNICODEF( iKey, iFlags ); else - iKey = HB_INKEY_NEW_KEY( iKey, iFlags ); + iKey = HB_INKEY_NEW_CHARF( iKey, iFlags ); #else int u = HB_GTSELF_KEYTRANS( pWVT->pGT, iKey ); if( u ) @@ -2619,7 +2619,7 @@ static HB_BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, { if( pWVT->CodePage == OEM_CHARSET ) iKey = hb_gt_wvt_key_ansi_to_oem( iKey ); - iKey = HB_INKEY_NEW_KEY( iKey, iFlags ); + iKey = HB_INKEY_NEW_CHARF( iKey, iFlags ); } #endif } diff --git a/src/rtl/inkeyapi.c b/src/rtl/inkeyapi.c index 653174ae00..f7825dd02b 100644 --- a/src/rtl/inkeyapi.c +++ b/src/rtl/inkeyapi.c @@ -353,30 +353,6 @@ void hb_inkeyReset( void ) } } -HB_SIZE hb_inkeyKeyString( int iKey, char * buffer, HB_SIZE nSize ) -{ - HB_SIZE nLen = 0; - - HB_TRACE( HB_TR_DEBUG, ( "hb_inkeyKeyString(%d,%p, %" HB_PFS "u)", iKey, buffer, nSize ) ); - - if( HB_INKEY_ISUNICODE( iKey ) ) - { - nLen = hb_cdpTextPutU16( hb_vmCDP(), buffer, nSize, HB_INKEY_VALUE( iKey ) ); - } - else - { - if( HB_INKEY_ISCHAR( iKey ) ) - iKey = HB_INKEY_VALUE( iKey ); - if( iKey >= 32 && iKey <= 255 && iKey != 127 ) - { - PHB_CODEPAGE cdp = hb_vmCDP(); - nLen = hb_cdpTextPutU16( cdp, buffer, nSize, - hb_cdpGetU16( cdp, ( HB_UCHAR ) iKey ) ); - } - } - return nLen; -} - static int s_inkeyTransChar( int iKey, int iFlags, const HB_KEY_VALUE * pKeyVal ) { if( ( iFlags & HB_KF_KEYPAD ) != 0 && @@ -427,6 +403,41 @@ static int s_inkeyTransChar( int iKey, int iFlags, const HB_KEY_VALUE * pKeyVal return pKeyVal->key; } +HB_SIZE hb_inkeyKeyString( int iKey, char * buffer, HB_SIZE nSize ) +{ + HB_SIZE nLen = 0; + + HB_TRACE( HB_TR_DEBUG, ( "hb_inkeyKeyString(%d,%p, %" HB_PFS "u)", iKey, buffer, nSize ) ); + + if( HB_INKEY_ISUNICODE( iKey ) ) + { + nLen = hb_cdpTextPutU16( hb_vmCDP(), buffer, nSize, HB_INKEY_VALUE( iKey ) ); + } + else + { + if( HB_INKEY_ISCHAR( iKey ) ) + iKey = HB_INKEY_VALUE( iKey ); + else if( HB_INKEY_ISKEY( iKey ) ) + { + int iFlags = HB_INKEY_FLAGS( iKey ); + + iKey = HB_INKEY_VALUE( iKey ); + + if( iKey > 0 && iKey <= ( int ) HB_SIZEOFARRAY( s_transKeyFun ) ) + iKey = s_inkeyTransChar( iKey, iFlags, &s_transKeyFun[ iKey - 1 ] ); + else if( iKey >= 32 && iKey <= 127 ) + iKey = s_inkeyTransChar( iKey, iFlags, &s_transKeyStd[ iKey - 32 ] ); + } + if( iKey >= 32 && iKey <= 255 && iKey != 127 ) + { + PHB_CODEPAGE cdp = hb_vmCDP(); + nLen = hb_cdpTextPutU16( cdp, buffer, nSize, + hb_cdpGetU16( cdp, ( HB_UCHAR ) iKey ) ); + } + } + return nLen; +} + int hb_inkeyKeyStd( int iKey ) { HB_TRACE( HB_TR_DEBUG, ( "hb_inkeyKeyStd(%d)", iKey ) );