From a13ea3a88385bbdb3238947e64c71c31762c5c87 Mon Sep 17 00:00:00 2001 From: "David G. Holm" Date: Wed, 20 Jun 2001 18:55:21 +0000 Subject: [PATCH] See ChangeLog entry 2001-06-20 14:50 UTC-0400 David G. Holm --- harbour/ChangeLog | 12 ++++++++++++ harbour/include/hbvm.h | 7 ++++--- harbour/source/debug/debugger.prg | 8 +++----- harbour/source/rtl/inkey.c | 21 ++++++++++++++++----- harbour/source/rtl/set.c | 2 +- harbour/source/vm/hvm.c | 6 ++++++ harbour/tests/inkeytst.prg | 10 ++++++++-- 7 files changed, 50 insertions(+), 16 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 7f70ff01ba..5a64bebc31 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,15 @@ +2001-06-20 14:50 UTC-0400 David G. Holm + + * include/hbvm.h + * source/debug/debugger.prg + * source/rtl/inkey.c + * source/rtl/set.c + * source/vm/hvm.c + * tests/inkeytst.prg + * Integrate the ALTD() function with SET( _SET_DEBUG ). + Start at integrating the debugger with the Alt+D key. + Cleanup for dealing with the Alt+C key. + 2001-06-20 12:30 UTC-0400 David G. Holm * doc\license.txt diff --git a/harbour/include/hbvm.h b/harbour/include/hbvm.h index 269ca377c5..38706f4ea6 100644 --- a/harbour/include/hbvm.h +++ b/harbour/include/hbvm.h @@ -69,11 +69,12 @@ extern void hb_vmProcessSymbols( PHB_SYMB pSymbols, USHORT uiSymbols ); /* st extern void hb_vmSymbolInit_RT( void ); /* initialization of runtime support symbols */ /* Harbour virtual machine escaping API */ -extern void hb_vmRequestQuit( void ); -extern void hb_vmRequestEndProc( void ); -extern void hb_vmRequestCancel( void ); extern void hb_vmRequestBreak( PHB_ITEM pItem ); +extern void hb_vmRequestCancel( void ); +extern void hb_vmRequestDebug( void ); +extern void hb_vmRequestEndProc( void ); extern USHORT hb_vmRequestQuery( void ); +extern void hb_vmRequestQuit( void ); /* Return values of hb_vmRequestQuery() */ #define HB_QUIT_REQUESTED 1 /* immediately quit the application */ diff --git a/harbour/source/debug/debugger.prg b/harbour/source/debug/debugger.prg index aa99879865..7126ac3838 100644 --- a/harbour/source/debug/debugger.prg +++ b/harbour/source/debug/debugger.prg @@ -75,20 +75,18 @@ static s_lExit := .F. memvar __DbgStatics procedure AltD( nAction ) - static s_lEnabled := .t. - do case case nAction == nil - if s_lEnabled + if SET( _SET_DEBUG ) s_lExit := .f. __dbgEntry( ProcLine( 2 ) ) endif case nAction == ALTD_DISABLE - s_lEnabled := .f. + SET( _SET_DEBUG, .F. ) case nAction == ALTD_ENABLE - s_lEnabled := .t. + SET( _SET_DEBUG, .T. ) endcase return diff --git a/harbour/source/rtl/inkey.c b/harbour/source/rtl/inkey.c index 62f60cb98f..31d58d85a1 100644 --- a/harbour/source/rtl/inkey.c +++ b/harbour/source/rtl/inkey.c @@ -208,11 +208,22 @@ void hb_inkeyPoll( void ) /* Poll the console keyboard to stuff the Harbour switch( ch ) { case HB_BREAK_FLAG: /* Check for Ctrl+Break */ - if( ! hb_set.HB_SET_CANCEL ) /* If cancel is disabled, */ - ch = 0; /* then ignore the keystroke */ - /* In either case, handle like Alt+C */ - case K_ALT_C: /* Alt+C was pressed */ - hb_vmRequestCancel(); + if( !hb_set.HB_SET_CANCEL ) ch = 0; /* Ignore if cancel disabled */ + case HB_K_ALT_C: /* Check for extended Alt+C */ + case K_ALT_C: /* Check for normal Alt+C */ + if( hb_set.HB_SET_CANCEL ) + { + ch = 3; /* Pretend it's a Ctrl+C */ + hb_vmRequestCancel();/* Request cancellation */ + } + break; + case HB_K_ALT_D: /* Check for extended Alt+D */ + case K_ALT_D: /* Check for normal Alt+D */ + if( hb_set.HB_SET_DEBUG ) + { + ch = 0; /* Make the keystroke disappear */ + hb_vmRequestDebug(); /* Request the debugger */ + } } hb_inkeyPut( ch ); diff --git a/harbour/source/rtl/set.c b/harbour/source/rtl/set.c index d1b58c01a9..3a6c457e9e 100644 --- a/harbour/source/rtl/set.c +++ b/harbour/source/rtl/set.c @@ -663,7 +663,7 @@ void hb_setInitialize( void ) hb_set.HB_SET_CONSOLE = TRUE; hb_set.HB_SET_DATEFORMAT = ( char * ) hb_xgrab( 9 ); memcpy( hb_set.HB_SET_DATEFORMAT, "mm/dd/yy", 9 ); - hb_set.HB_SET_DEBUG = FALSE; + hb_set.HB_SET_DEBUG = TRUE; hb_set.HB_SET_DECIMALS = 2; hb_set.HB_SET_DEFAULT = ( char * ) hb_xgrab( 1 ); hb_set.HB_SET_DEFAULT[ 0 ] = '\0'; diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index ba53101bf9..805c7b0f76 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -4321,6 +4321,12 @@ void hb_vmRequestCancel( void ) } } +void hb_vmRequestDebug( void ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_vmRequestCancel()")); + /* TODO: Cause the debugger to be invoked */ +} + /* $Doc$ * $FuncName$ __vmVarSList() * $Description$ Return the statics array. Please aClone before assignments diff --git a/harbour/tests/inkeytst.prg b/harbour/tests/inkeytst.prg index 4d1d25e8cd..3836a8604a 100644 --- a/harbour/tests/inkeytst.prg +++ b/harbour/tests/inkeytst.prg @@ -15,6 +15,8 @@ PROCEDURE main( cSkip, cRaw ) +ALTD(0) + IF EMPTY( cSkip ) TEST1() @@ -213,9 +215,13 @@ LOCAL nKey, nMask, cText IF ! EMPTY( cSkip ) IF UPPER( cSkip ) == "BREAK" - SETCANCEL( .T. ) + SETCANCEL(.T.) + ALTD(1) + tone( 440, 6 ) ELSE - SETCANCEL( .F. ) + SETCANCEL(.F.) + ALTD(0) + tone( 660, 6 ) END IF END IF