19991026-18:10 GMT+1 Victor Szel <info@szelvesz.hu>

This commit is contained in:
Viktor Szakats
1999-10-26 16:27:40 +00:00
parent f48a51de2d
commit 11ca4ffbfd
4 changed files with 173 additions and 0 deletions

View File

@@ -1,3 +1,17 @@
19991026-18:10 GMT+1 Victor Szel <info@szelvesz.hu>
* source/rtl/gt/gtwin.c
+ Ctrl+Break handler added for Win32 console mode, now Ctrl+Break will not
break an application with SetCancel(.F.), and will terminate it with
the proper message with SetCancel(.T.).
INCOMPATIBILITY: With SetCancel(.F.) the inkey code 876 will be passed
to Harbour which should be ignored and not returned by Inkey().
David, could you check this ?
* source/rtl/gt/gtdos.c
+ Ctrl+Break handler added for DOS character mode.
Please test this, since I could only test if it compile.
* tests/tstalias.prg
+ New alias related tests added.
Tue Oct 26 13:11:19 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
* source/tools/dates2.c:

View File

@@ -33,6 +33,18 @@
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://www.harbour-project.org
*
* Copyright 1999 Victor Szel <info@szelvesz.hu>
* hb_gt_CtrlBrkHandler()
* hb_gt_CtrlBrkRestore()
*
* See doc/license.txt for licensing terms.
*
*/
/*
* This module is based on VIDMGR by Andrew Clarke and modified for
* the Harbour project
@@ -43,6 +55,8 @@
#include <string.h>
#include <dos.h>
#include "gtapi.h"
#include "set.h" /* For Ctrl+Break handling */
#include "ctoharb.h" /* For Ctrl+Break handling */
#if defined(__POWERC) || (defined(__TURBOC__) && !defined(__BORLANDC__)) || \
(defined(__ZTC__) && !defined(__SC__))
@@ -79,8 +93,32 @@ static void hb_gt_GetCursorSize( char * start, char * end );
static char FAR * hb_gt_ScreenAddress( void );
#endif
static int s_iOldCtrlBreak = 0;
static int hb_gt_CtrlBrkHandler( void )
{
if( hb_set.HB_SET_CANCEL )
hb_vmRequestCancel();
return 1;
}
static void hb_gt_CtrlBrkRestore( void )
{
setcbrk( s_iOldCtrlBreak );
}
void hb_gt_Init( void )
{
/* Set the Ctrl+Break handler [vszel] */
ctrlbrk( hb_gt_CtrlBrkHandler );
s_iOldCtrlBreak = getcbrk();
setcbrk( 1 );
atexit( hb_gt_CtrlBrkRestore );
/* */
#ifdef __DJGPP__
gppconio_init();
#else

View File

@@ -34,6 +34,17 @@
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://www.harbour-project.org
*
* Copyright 1999 Victor Szel <info@szelvesz.hu>
* hb_gt_CtrlHandler()
*
* See doc/license.txt for licensing terms.
*
*/
/*
* Portions of this module are based (somewhat) on VIDMGR by
* Andrew Clarke and modified for the Harbour project
@@ -52,6 +63,8 @@
#include <windows.h>
#include "gtapi.h"
#include "set.h" /* For Ctrl+Break handling */
#include "ctoharb.h" /* For Ctrl+Break handling */
#if defined(__IBMCPP__)
#undef WORD /* 2 bytes unsigned */
@@ -90,6 +103,34 @@ static HANDLE HCursor; /* When DispBegin is in effect, all cursor related
be different than the one being written to.
*/
static BOOL hb_gt_CtrlHandler( DWORD dwCtrlType )
{
BOOL bHandled;
switch( dwCtrlType )
{
case CTRL_C_EVENT:
bHandled = FALSE;
break;
case CTRL_BREAK_EVENT:
if( hb_set.HB_SET_CANCEL )
hb_vmRequestCancel();
bHandled = TRUE;
break;
case CTRL_CLOSE_EVENT:
case CTRL_LOGOFF_EVENT:
case CTRL_SHUTDOWN_EVENT:
default:
bHandled = FALSE;
}
return bHandled;
}
void hb_gt_Init( void )
{
HB_TRACE(("hb_gt_Init()"));
@@ -111,6 +152,9 @@ void hb_gt_Init( void )
NULL, /* security attributes */
OPEN_EXISTING, /* create mode */
0, 0 );
/* Add Ctrl+Break handler [vszel] */
SetConsoleCtrlHandler( hb_gt_CtrlHandler, TRUE );
}
void hb_gt_Done( void )
@@ -140,6 +184,9 @@ void hb_gt_Done( void )
CloseHandle( HStealth );
HStealth = INVALID_HANDLE_VALUE;
}
/* Remove Ctrl+Break handler [vszel] */
SetConsoleCtrlHandler( hb_gt_CtrlHandler, FALSE );
}
BOOL hb_gt_IsColor( void )

View File

@@ -24,4 +24,78 @@ FUNCTION Main()
TEST->( FieldPut( FieldPos( 'AGE' ), 6 ) )
? FIELD->Age
dbCloseArea()
SELE 2
USE test
// ? ("0")->FIRST
? ("B")->FIRST
? ("2")->FIRST
? 2->FIRST
? B->FIRST
Inkey( 0 )
// ? ("0")->FIRST
? SELECT()
? SELECT( 1 )
? SELECT( 2 )
? "0", SELECT( "0" )
? "1", SELECT( "1" )
? "2", SELECT( "2" )
? "A", SELECT( "A" )
? "B", SELECT( "B" )
? "C", SELECT( "C" )
? "D", SELECT( "D" )
? "E", SELECT( "E" )
? "F", SELECT( "F" )
? "G", SELECT( "G" )
? "H", SELECT( "H" )
? "I", SELECT( "I" )
? "J", SELECT( "J" )
? "K", SELECT( "K" )
? "L", SELECT( "L" )
? "M", SELECT( "M" )
? "N", SELECT( "N" )
? "O", SELECT( "O" )
? "P", SELECT( "P" )
? "Q", SELECT( "Q" )
? "R", SELECT( "R" )
? "S", SELECT( "S" )
? "T", SELECT( "T" )
? "U", SELECT( "U" )
? "V", SELECT( "V" )
? "W", SELECT( "W" )
? "X", SELECT( "X" )
? "Y", SELECT( "Y" )
? "Z", SELECT( "Z" )
Inkey( 0 )
? "" , dbSelectArea() , SELECT()
? "" , dbSelectArea( NIL ), SELECT()
? "" , dbSelectArea( "" ) , SELECT()
? " " , dbSelectArea( " " ), SELECT()
? "0" , dbSelectArea( "0" ), SELECT()
? "1" , dbSelectArea( "1" ), SELECT()
? "2" , dbSelectArea( "2" ), SELECT()
? "A" , dbSelectArea( "A" ), SELECT()
? "B" , dbSelectArea( "B" ), SELECT()
? "C" , dbSelectArea( "C" ), SELECT()
? "D" , dbSelectArea( "D" ), SELECT()
? "E" , dbSelectArea( "E" ), SELECT()
? "F" , dbSelectArea( "F" ), SELECT()
? "G" , dbSelectArea( "G" ), SELECT()
? "H" , dbSelectArea( "H" ), SELECT()
? "I" , dbSelectArea( "I" ), SELECT()
? "J" , dbSelectArea( "J" ), SELECT()
? "K" , dbSelectArea( "K" ), SELECT()
? "L" , dbSelectArea( "L" ), SELECT()
? "M" , dbSelectArea( "M" ), SELECT()
? "Z" , dbSelectArea( "Z" ), SELECT()
? "AA", dbSelectArea( "AA" ), SELECT()
return NIL