From aae392a7efb40a93174e6a18ddba25cd64b8ea05 Mon Sep 17 00:00:00 2001 From: Ryszard Glab Date: Tue, 13 Jun 2000 17:51:13 +0000 Subject: [PATCH] ChangeLog 2000-06-13 19:55 UTC+0100 --- harbour/ChangeLog | 15 ++++++++++++ harbour/include/hbapigt.h | 2 ++ harbour/source/rtl/gtapi.c | 7 ++++++ harbour/source/rtl/gtcrs/gtcrs.c | 41 ++++++++++++++++++++++---------- harbour/source/rtl/run.c | 15 ++++-------- 5 files changed, 56 insertions(+), 24 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c3065b2150..3a51624400 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,18 @@ +2000-06-13 19:55 UTC+0100 Ryszard Glab + + *include/hbapigt.h + *added declaration of hb_gt_Suspend()/hb_gt_Resume() + + *source/rtl/gtapi.c + *hb_gtPreExt()/hb_gtPostExt() calls driver dependend functions + to save/restore terminal settings + + *source/rtl/run.c + *fixed to properly use hb_gtPreExt()/hb_gtPosExt() + + *source/rtl/gtcrs/gtcrs.c + *added full support for suspend/resume terminal settings + 2000-06-13 08:08 UTC-0800 Ron Pinkas * source/pp/ppcomp.c diff --git a/harbour/include/hbapigt.h b/harbour/include/hbapigt.h index c3a08f0047..565a71790f 100644 --- a/harbour/include/hbapigt.h +++ b/harbour/include/hbapigt.h @@ -184,6 +184,8 @@ extern void hb_gt_SetPos( SHORT iRow, SHORT iCol ); extern void hb_gt_Tone( double dFrequency, double dDuration ); extern char * hb_gt_Version( void ); extern USHORT hb_gt_VertLine( USHORT uiCol, USHORT uiTop, USHORT uiBottom, BYTE byChar, BYTE byAttr ); +extern BOOL hb_gt_Suspend(); +extern BOOL hb_gt_Resume(); /* Keyboard related declarations */ diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 9f64ec715e..c0e8d3359e 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -317,6 +317,10 @@ USHORT hb_gtPreExt( void ) while( uidc-- ) hb_gt_DispEnd(); + /* call platform depend layer to flush all pending outputs and + * to prepare screen for direct updating + */ + hb_gt_Suspend(); } s_uiPreCNest = 1; @@ -333,6 +337,9 @@ USHORT hb_gtPostExt( void ) if( s_uiPreCNest == 1 ) { + /* call platform depend layer to restore all settings */ + hb_gt_Resume(); + while( s_uiPreCount-- ) hb_gt_DispBegin(); diff --git a/harbour/source/rtl/gtcrs/gtcrs.c b/harbour/source/rtl/gtcrs/gtcrs.c index 405be3a8ae..cafbb2d849 100644 --- a/harbour/source/rtl/gtcrs/gtcrs.c +++ b/harbour/source/rtl/gtcrs/gtcrs.c @@ -59,6 +59,7 @@ extern void hb_gt_Exit_Keyboard( void ); static void hb_gt_Initialize_Terminal( void ) { + initscr(); if( has_colors() ) { int i; @@ -128,13 +129,19 @@ static void hb_gt_Initialize_Terminal( void ) } +static void hb_gt_Exit_Terminal( void ) +{ + noraw(); + refresh(); + endwin(); +} + void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_Init()")); s_uiDispCount = 0; - initscr(); hb_gt_Initialize_Terminal(); /* Mouse sub-sytem have to be initialized after ncurses initialization */ hb_gt_Initialize_Mouse(); @@ -146,10 +153,7 @@ void hb_gt_Exit( void ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_Exit()")); - noraw(); - refresh(); - endwin(); - + hb_gt_Exit_Terminal(); hb_gt_Exit_Mouse(); hb_gt_Exit_Keyboard(); } @@ -497,19 +501,22 @@ void hb_gt_DispEnd() BOOL hb_gt_SetMode( USHORT uiRows, USHORT uiCols ) { - BOOL success; - HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetMode(%hu, %hu)", uiRows, uiCols)); /* NOTE: Not tested!!! Use it on your own risk! */ - endwin(); - success = ( ( resizeterm( uiRows, uiCols) == OK) ? TRUE : FALSE ); - initscr(); - hb_gt_Initialize_Terminal(); - - return success; +#if defined(NCURSES_VERSION) + { + BOOL success; + hb_gt_Exit_Terminal(); + success = ( ( resizeterm( uiRows, uiCols) == OK) ? TRUE : FALSE ); + hb_gt_Initialize_Terminal(); + return success; + } +#else + return 0; +#endif } BOOL hb_gt_GetBlink() @@ -747,10 +754,18 @@ USHORT hb_gt_VertLine( USHORT uiCol, USHORT uiTop, USHORT uiBottom, BYTE byChar, BOOL hb_gt_Suspend() { + hb_gt_Exit_Terminal(); + hb_gt_Exit_Mouse(); + hb_gt_Exit_Keyboard(); + return 1; } BOOL hb_gt_Resume() { + hb_gt_Initialize_Terminal(); + hb_gt_Initialize_Mouse(); + hb_gt_Initialize_Keyboard(); + return 1; } diff --git a/harbour/source/rtl/run.c b/harbour/source/rtl/run.c index 67b0b36b61..585e41d901 100644 --- a/harbour/source/rtl/run.c +++ b/harbour/source/rtl/run.c @@ -35,9 +35,7 @@ #include "hbapi.h" #include "hbapierr.h" - -extern BOOL hb_gt_Suspend(); -extern BOOL hb_gt_Resume(); +#include "hbapigt.h" /* TOFIX: The screen buffer handling is not right for all platforms (Win32) The output of the launched (DOS?) app is not visible. */ @@ -47,14 +45,9 @@ HB_FUNC( __RUN ) #if defined(__TURBOC__) || defined(__BORLANDC__) || defined(_MSC_VER) || defined(__IBMCPP__) || defined(__GNUC__) if( ISCHAR( 1 ) ) { - if ( hb_gt_Suspend() ) - { - system( hb_parc( 1 ) ); - if ( hb_gt_Resume() ) - { - /* indicate internal error here */ - } - } + hb_gtPreExt(); + system( hb_parc( 1 ) ); + hb_gtPostExt(); } #else hb_errRT_BASE_Ext1( EG_UNSUPPORTED, 9999, NULL, "__RUN", 0, EF_CANDEFAULT );