From db664c6f61372e87fc9e3114969efc7cd6999843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Mon, 7 Sep 2015 16:19:22 +0200 Subject: [PATCH] 2015-09-07 16:19 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/rtl/gtos2/gtos2.c + added support for HB_GTI_CODEPAGE ! removed code which sets CP437 at application start Now the default codepage is the same set by system. If someone wants to use CP437 regardless of default OS2 settings then he should add to his code: hb_gtInfo( HB_GTI_CODEPAGE, 437 ) --- ChangeLog.txt | 9 +++++++++ src/rtl/gtos2/gtos2.c | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 6d73cdd7f6..3ea1e9c2cd 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,15 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2015-09-07 16:19 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * src/rtl/gtos2/gtos2.c + + added support for HB_GTI_CODEPAGE + ! removed code which sets CP437 at application start + Now the default codepage is the same set by system. + If someone wants to use CP437 regardless of default OS2 settings + then he should add to his code: + hb_gtInfo( HB_GTI_CODEPAGE, 437 ) + 2015-09-06 23:33 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/rtl/hbproces.c * use native OS2 system functions in hb_fsProcessOpen(), diff --git a/src/rtl/gtos2/gtos2.c b/src/rtl/gtos2/gtos2.c index ec90f30813..395e178ff2 100644 --- a/src/rtl/gtos2/gtos2.c +++ b/src/rtl/gtos2/gtos2.c @@ -850,6 +850,22 @@ static HB_BOOL hb_gt_os2_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) pInfo->pResult = hb_itemPutL( pInfo->pResult, HB_TRUE ); break; + case HB_GTI_CODEPAGE: + { + USHORT usCodePageNew = ( USHORT ) hb_itemGetNI( pInfo->pNewVal ); + USHORT usCodePage = 0; + + VioGetCp( 0, &usCodePage, 0 ); + pInfo->pResult = hb_itemPutNI( pInfo->pResult, usCodePage ); + if( ( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC ) && + usCodePageNew != usCodePage ) + { + if( VioSetCp( 0, usCodePageNew, 0 ) != NO_ERROR ) + VioSetCp( 0, usCodePage, 0 ); + } + break; + } + default: return HB_GTSUPER_INFO( pGT, iType, pInfo ); }