From e02b04be3ece02b80fa146c73074a459020de3e3 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 23 Feb 2000 17:39:03 +0000 Subject: [PATCH] 20000223-18:36 GMT+1 Victor Szakats --- harbour/ChangeLog | 26 ++++++++++++++++++++ harbour/contrib/rdd_ads/ads1.c | 12 ++++----- harbour/include/set.h | 2 -- harbour/source/rtl/console.c | 45 ++++------------------------------ harbour/source/rtl/dummy.prg | 2 -- harbour/source/rtl/filesys.c | 1 - harbour/source/rtl/gt/gtstd.c | 5 ++-- harbour/source/rtl/inkey.c | 2 +- harbour/source/rtl/oemansi.c | 4 ++- harbour/source/rtl/set.c | 2 -- harbour/source/rtl/setcolor.c | 32 ++++-------------------- harbour/source/rtl/strings.c | 1 + harbour/source/rtl/tbrowse.prg | 10 ++++---- harbour/source/vm/hvm.c | 14 +++++------ 14 files changed, 61 insertions(+), 97 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9fa9b39c97..f242dc5e4e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,29 @@ +20000223-18:36 GMT+1 Victor Szakats + * source/rtl/tbrowse.prg + ! Fixed return values of methods to be Clipper compatible. + * source/vm/hvm.c + + HB_INCLUDE_WINEXCHANDLER #ifdef added to control the inclusion of + the Windows specific exception handler. Temporary solution. + * contrib/rdd_ads/ads1.c + ! Extentions converted to lower case. + ! Some small fixes. + * include/set.h + source/rtl/set.c + source/rtl/setcolor.c + source/rtl/console.c + source/rtl/gt/gtstd.c + % Reduced the GT vs. non-GT branches. Heading in the direction where + there's no non-GT API mode, just a Standard/Stream GT API mode. + In other words the point is to eliminate *all* HARBOUR_USE_GTAPI + checks. + * source/rtl/inkey.c + ! __KEYBOARD() fix by Matteo. + * source/rtl/strings.c + source/rtl/dummy.prg + source/rtl/filesys.c + source/rtl/oemansi.c + ! Minor formatting fixes. + 20000222-07:30 GMT-3 Luiz Rafael Culik *doc/harbext.txt *Small changes diff --git a/harbour/contrib/rdd_ads/ads1.c b/harbour/contrib/rdd_ads/ads1.c index 4ceb216686..eeacfb3813 100644 --- a/harbour/contrib/rdd_ads/ads1.c +++ b/harbour/contrib/rdd_ads/ads1.c @@ -703,12 +703,12 @@ static ERRCODE adsInfo( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem ) break; case DBI_TABLEEXT: - hb_itemPutC( pItem, ((adsFileType==ADS_ADT) ? ".ADT" : ".DBF") ); + hb_itemPutC( pItem, ((adsFileType==ADS_ADT) ? ".adt" : ".dbf") ); break; case DBI_MEMOEXT: - hb_itemPutC( pItem, ((adsFileType==ADS_ADT) ? ".ADM" : - (adsFileType==ADS_CDX) ? ".FPT" : ".DBT") ); + hb_itemPutC( pItem, ((adsFileType==ADS_ADT) ? ".adm" : + (adsFileType==ADS_CDX) ? ".fpt" : ".dbt") ); break; case DBI_GETLOCKARRAY: @@ -945,7 +945,7 @@ static ERRCODE adsOrderInfo( ADSAREAP pArea, USHORT uiIndex, LPDBORDERINFO pOrde HB_TRACE(HB_TR_DEBUG, ("adsOrderInfo(%p, %hu, %p)", pArea, uiIndex, pInfo)); - if( !IS_NIL(pOrderInfo->itmOrder) ) + if( pOrderInfo->itmOrder && !IS_NIL(pOrderInfo->itmOrder) ) { if( IS_NUMERIC( pOrderInfo->itmOrder ) ) ulRetVal = AdsGetIndexHandleByOrder( pArea->hTable, @@ -959,8 +959,8 @@ static ERRCODE adsOrderInfo( ADSAREAP pArea, USHORT uiIndex, LPDBORDERINFO pOrde switch( uiIndex ) { case DBOI_BAGEXT: - pOrderInfo->itmResult = hb_itemPutC( pOrderInfo->itmResult, - ((adsFileType==ADS_ADT) ? ".ADI" : (adsFileType==ADS_CDX)? ".CDX" : ".NTX") ); + hb_itemPutC( pOrderInfo->itmResult, + ((adsFileType==ADS_ADT) ? ".adi" : (adsFileType==ADS_CDX)? ".cdx" : ".ntx") ); break; case DBOI_EXPRESSION: AdsGetIndexExpr( phIndex, aucBuffer, &pusLen); diff --git a/harbour/include/set.h b/harbour/include/set.h index a86eb4c729..957e4ebde2 100644 --- a/harbour/include/set.h +++ b/harbour/include/set.h @@ -85,7 +85,6 @@ #include "hbdefs.h" #include "filesys.h" #include "gtapi.h" -#include "setcurs.h" #include "inkey.h" typedef enum @@ -168,7 +167,6 @@ typedef struct BOOL HB_SET_DEBUG; int HB_SET_TYPEAHEAD; char HB_SET_COLOR[ CLR_STRLEN ]; - HB_cursor_enum HB_SET_CURSOR; BOOL HB_SET_CONSOLE; BOOL HB_SET_ALTERNATE; char * HB_SET_ALTFILE; diff --git a/harbour/source/rtl/console.c b/harbour/source/rtl/console.c index d5a6d1199f..35e9676851 100644 --- a/harbour/source/rtl/console.c +++ b/harbour/source/rtl/console.c @@ -613,7 +613,8 @@ HARBOUR HB_SETPOSBS( void ) #ifdef HARBOUR_USE_GTAPI SHORT iRow, iCol; - /* NOTE: Clipper does no checks about reaching the border or anything */ + /* NOTE: Clipper does no checks about reaching the border or anything. + [vszakats] */ hb_gtGetPos( &iRow, &iCol ); hb_gtSetPos( iRow, iCol + 1 ); #endif @@ -679,7 +680,7 @@ HARBOUR HB_DISPOUTAT( void ) /* writes a single value to the screen at speficic { if( hb_pcount() >= 3 ) { - /* NOTE: Clipper does no checks here. */ + /* NOTE: Clipper does no checks here. [vszakats] */ hb_setpos( hb_parni( 1 ), hb_parni( 2 ) ); #ifdef HARBOUR_USE_GTAPI @@ -841,11 +842,11 @@ HARBOUR HB_DISPBOX( void ) /* Set limits on the box coordinates to (0,0) and (max_row(),max_col()) */ if( i_top < 0 ) top = 0; else top = ( USHORT ) i_top; if( i_left < 0 ) left = 0; else left = ( USHORT ) i_left; - if( i_bottom < 0 ) bottom = 0; else bottom = ( USHORT ) i_bottom; + if( i_bottom < 0 ) bottom = 0; else bottom = ( USHORT ) i_bottom; if( i_right < 0 ) right = 0; else right = ( USHORT ) i_right; if( top > hb_max_row() ) top = hb_max_row(); if( left > hb_max_col() ) left = hb_max_col(); - if( bottom > hb_max_row() ) bottom = hb_max_row(); + if( bottom > hb_max_row() ) bottom = hb_max_row(); if( right > hb_max_col() ) right = hb_max_col(); /* Force the box to be drawn from top left to bottom right */ @@ -945,47 +946,32 @@ HARBOUR HB_DISPBOX( void ) HARBOUR HB_DISPBEGIN( void ) { -#ifdef HARBOUR_USE_GTAPI hb_gtDispBegin(); -#endif } HARBOUR HB_DISPEND( void ) { -#ifdef HARBOUR_USE_GTAPI hb_gtDispEnd(); -#endif } HARBOUR HB_DISPCOUNT( void ) { -#ifdef HARBOUR_USE_GTAPI hb_retni( hb_gtDispCount() ); -#else - hb_retni( 0 ); -#endif } HARBOUR HB_ISCOLOR( void ) { -#ifdef HARBOUR_USE_GTAPI hb_retl( hb_gtIsColor() ); -#else - hb_retl( FALSE ); -#endif } HARBOUR HB_NOSNOW( void ) { -#ifdef HARBOUR_USE_GTAPI if( ISLOG( 1 ) ) hb_gtSetSnowFlag( hb_parl( 1 ) ); -#endif } HARBOUR HB___SHADOW( void ) { -#ifdef HARBOUR_USE_GTAPI if( hb_pcount() >= 4 ) { hb_gtDrawShadow( hb_parni( 1 ), @@ -994,7 +980,6 @@ HARBOUR HB___SHADOW( void ) hb_parni( 4 ), ISNUM( 5 ) ? hb_parni( 5 ) : 7 ); } -#endif } HARBOUR HB_DBGSHADOW( void ) @@ -1004,7 +989,6 @@ HARBOUR HB_DBGSHADOW( void ) HARBOUR HB_SAVESCREEN( void ) { -#ifdef HARBOUR_USE_GTAPI USHORT uiX; USHORT uiCoords[ 4 ]; void * pBuffer; @@ -1023,14 +1007,10 @@ HARBOUR HB_SAVESCREEN( void ) hb_gtSave( uiCoords[ 0 ], uiCoords[ 1 ], uiCoords[ 2 ], uiCoords[ 3 ], pBuffer ); hb_retclen( ( char * ) pBuffer, uiX ); hb_xfree( ( char * ) pBuffer ); -#else - hb_retc( "" ); -#endif } HARBOUR HB_RESTSCREEN( void ) { -#ifdef HARBOUR_USE_GTAPI if( hb_pcount() == 5 ) { USHORT uiX; @@ -1048,7 +1028,6 @@ HARBOUR HB_RESTSCREEN( void ) hb_gtRest( uiCoords[ 0 ], uiCoords[ 1 ], uiCoords[ 2 ], uiCoords[ 3 ], ( void * ) hb_parc( 5 ) ); } -#endif } USHORT hb_setCursor( BOOL bSetCursor, USHORT usNewCursor ) @@ -1057,16 +1036,10 @@ USHORT hb_setCursor( BOOL bSetCursor, USHORT usNewCursor ) HB_TRACE(HB_TR_DEBUG, ("hb_setCursor(%d, %hu)", (int) bSetCursor, usNewCursor)); -#ifdef HARBOUR_USE_GTAPI hb_gtGetCursor( &usPreviousCursor ); if( bSetCursor ) hb_gtSetCursor( usNewCursor ); -#else - usPreviousCursor = hb_set.HB_SET_CURSOR; - if( bSetCursor ) - hb_set.HB_SET_CURSOR = ( HB_cursor_enum ) usNewCursor; -#endif return usPreviousCursor; } @@ -1080,7 +1053,6 @@ HARBOUR HB_SETCURSOR( void ) HARBOUR HB_SETBLINK( void ) { -#ifdef HARBOUR_USE_GTAPI BOOL bPreviousBlink; hb_gtGetBlink( &bPreviousBlink ); @@ -1088,19 +1060,12 @@ HARBOUR HB_SETBLINK( void ) hb_gtSetBlink( hb_parl( 1 ) ); hb_retl( bPreviousBlink ); -#else - hb_retl( FALSE ); -#endif } HARBOUR HB_SETMODE( void ) { -#ifdef HARBOUR_USE_GTAPI hb_retl( hb_gtSetMode( ISNUM( 1 ) ? hb_parni( 1 ) : ( hb_gtMaxRow() + 1 ), ISNUM( 2 ) ? hb_parni( 2 ) : ( hb_gtMaxCol() + 1 ) ) == 0 ); -#else - hb_retl( FALSE ); -#endif } HARBOUR HB___ACCEPT( void ) /* Internal Clipper function used in ACCEPT command */ diff --git a/harbour/source/rtl/dummy.prg b/harbour/source/rtl/dummy.prg index 76e1d3bf1e..6d5191cc8e 100644 --- a/harbour/source/rtl/dummy.prg +++ b/harbour/source/rtl/dummy.prg @@ -79,5 +79,3 @@ FUNCTION __dbOpenSDF() ; RETURN NIL FUNCTION __dbTrans() ; RETURN NIL FUNCTION __dbTransRec() ; RETURN NIL - - diff --git a/harbour/source/rtl/filesys.c b/harbour/source/rtl/filesys.c index 74916ca15a..a14f904cae 100644 --- a/harbour/source/rtl/filesys.c +++ b/harbour/source/rtl/filesys.c @@ -1,4 +1,3 @@ - /* * $Id$ */ diff --git a/harbour/source/rtl/gt/gtstd.c b/harbour/source/rtl/gt/gtstd.c index 378265842b..3fd928d3f7 100644 --- a/harbour/source/rtl/gt/gtstd.c +++ b/harbour/source/rtl/gt/gtstd.c @@ -58,7 +58,7 @@ void hb_gt_Init( void ) s_uiMaxRow = 25; #endif s_uiMaxCol = 80; - s_uiCursorStyle = SC_NONE; + s_uiCursorStyle = SC_NORMAL; s_bBlink = FALSE; } @@ -240,4 +240,5 @@ int hb_gt_ReadKey( void ) { return 0; } -#endif \ No newline at end of file +#endif + diff --git a/harbour/source/rtl/inkey.c b/harbour/source/rtl/inkey.c index aa0ab5e801..63ff5efd06 100644 --- a/harbour/source/rtl/inkey.c +++ b/harbour/source/rtl/inkey.c @@ -1076,7 +1076,7 @@ HARBOUR HB___KEYBOARD( void ) if( size != 0 ) { /* Stuff the string */ - char *fPtr = hb_parc( 1 ); + BYTE * fPtr = ( BYTE * ) hb_parc( 1 ); if( size >= hb_set.HB_SET_TYPEAHEAD ) { diff --git a/harbour/source/rtl/oemansi.c b/harbour/source/rtl/oemansi.c index 5b7eecaa8c..2e587d82e4 100644 --- a/harbour/source/rtl/oemansi.c +++ b/harbour/source/rtl/oemansi.c @@ -38,11 +38,13 @@ * www - http://www.harbour-project.org * * Copyright 2000 Luiz Rafael Culik - * * HB_OEMTOANSI() Documentation * HB_ANSITOOEM() Documentation * + * See doc/license.txt for licensing terms. + * */ + /* NOTE: These are Win32 specific, for other platforms it will return the passed parameter unchanged. */ diff --git a/harbour/source/rtl/set.c b/harbour/source/rtl/set.c index b4e2a9abe6..bab8c6b3aa 100644 --- a/harbour/source/rtl/set.c +++ b/harbour/source/rtl/set.c @@ -751,7 +751,6 @@ HARBOUR HB___SETCENTURY( void ) * $END$ */ - HARBOUR HB_SET( void ) { BOOL bFlag; @@ -1064,7 +1063,6 @@ void hb_setInitialize( void ) hb_set.HB_SET_COLOR[ sizeof( hb_set.HB_SET_COLOR ) - 1 ] = '\0'; hb_set.HB_SET_CONFIRM = FALSE; hb_set.HB_SET_CONSOLE = TRUE; - hb_set.HB_SET_CURSOR = SC_NORMAL; /* Only needed for non-GTAPI */ 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; diff --git a/harbour/source/rtl/setcolor.c b/harbour/source/rtl/setcolor.c index 4bde5647ea..4e7e1b9dff 100644 --- a/harbour/source/rtl/setcolor.c +++ b/harbour/source/rtl/setcolor.c @@ -35,38 +35,18 @@ #include "extend.h" #include "set.h" -#ifdef HARBOUR_USE_GTAPI - #include "gtapi.h" -#else - static char s_old_string[ sizeof( hb_set.HB_SET_COLOR ) ]; -#endif +#include "gtapi.h" -char * hb_setColor( char * sColor ) +char * hb_setColor( char * szColor ) { HB_TRACE(HB_TR_DEBUG, ("hb_setColor(%s)", sColor)); -#ifdef HARBOUR_USE_GTAPI hb_gtGetColorStr( hb_set.HB_SET_COLOR ); -#else - strncpy( s_old_string, hb_set.HB_SET_COLOR, sizeof( hb_set.HB_SET_COLOR ) ); - s_old_string[ sizeof( hb_set.HB_SET_COLOR ) - 1 ] = '\0'; -#endif - if( sColor != ( char * ) NULL ) - { - #ifdef HARBOUR_USE_GTAPI - hb_gtSetColorStr( sColor ); - #else - strncpy( hb_set.HB_SET_COLOR, sColor, sizeof( hb_set.HB_SET_COLOR ) ); - hb_set.HB_SET_COLOR[ sizeof( hb_set.HB_SET_COLOR ) - 1 ] = 0; - hb_strUpper( hb_set.HB_SET_COLOR, strlen( hb_set.HB_SET_COLOR ) ); - #endif - } -#ifdef HARBOUR_USE_GTAPI + if( szColor != ( char * ) NULL ) + hb_gtSetColorStr( szColor ); + return hb_set.HB_SET_COLOR; -#else - return s_old_string; -#endif } HARBOUR HB_SETCOLOR( void ) @@ -76,8 +56,6 @@ HARBOUR HB_SETCOLOR( void ) HARBOUR HB_COLORSELECT( void ) { -#ifdef HARBOUR_USE_GTAPI if( ISNUM( 1 ) ) hb_gtColorSelect( hb_parni( 1 ) ); -#endif } diff --git a/harbour/source/rtl/strings.c b/harbour/source/rtl/strings.c index bcb52b31d7..62ba626bcc 100644 --- a/harbour/source/rtl/strings.c +++ b/harbour/source/rtl/strings.c @@ -45,6 +45,7 @@ * hb_strMatchDOS() * HB_STRZERO() * hb_strnicmp() + * * Copyright 2000 Luiz Rafael Culik * ISALPHA() Documentation * ISDIGIT() Documentation diff --git a/harbour/source/rtl/tbrowse.prg b/harbour/source/rtl/tbrowse.prg index be821a8f48..1a523e42c5 100644 --- a/harbour/source/rtl/tbrowse.prg +++ b/harbour/source/rtl/tbrowse.prg @@ -133,7 +133,7 @@ CLASS TBrowse METHOD Invalidate() // Forces entire redraw during next stabilization METHOD RefreshAll() INLINE ::Invalidate() // Causes all data to be recalculated during the next stabilize - METHOD RefreshCurrent() INLINE ::aRedraw[ ::RowPos ] := .f., ::Stable := .f. // Causes the current row to be refilled and repainted on next stabilize + METHOD RefreshCurrent() INLINE ::aRedraw[ ::RowPos ] := .f., ::Stable := .f., Self // Causes the current row to be refilled and repainted on next stabilize METHOD SetColumn( nColumn, oCol ) INLINE If( 0 < nColumn .and. nColumn <= Len( ::aColumns ),; ::aColumns[ nColumn ] := oCol, nil ), oCol // Replaces one TBColumn object with another @@ -267,7 +267,7 @@ METHOD Invalidate() CLASS TBrowse AFill( ::aRedraw, .f. ) ::Stable := .f. -return nil +return Self METHOD Left() CLASS TBrowse @@ -454,14 +454,14 @@ METHOD DeHilite() CLASS TBrowse ::DispCell( ::ColPos, cColor ) SetPos( nRow, nCol ) -return nil +return Self METHOD ForceStable() CLASS TBrowse while !::Stabilize() end -return nil +return Self METHOD Hilite() CLASS TBrowse @@ -484,7 +484,7 @@ METHOD Hilite() CLASS TBrowse SetPos( nRow, nCol ) endif -return nil +return Self METHOD Stabilize() CLASS TBrowse diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 104ee8199f..33baa65b50 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -3835,17 +3835,16 @@ HARBOUR HB___VMVARSGET( void ) hb_stack.iStatics + hb_parni( 1 ) - 1 ); } -#if 0 +/* NOTE: Temporary name [vszakats] */ +#ifdef HB_INCLUDE_WINEXCHANDLER #include "windows.h" -WINBASEAPI LONG WINAPI UnhandledExceptionFilter( - struct _EXCEPTION_POINTERS * ExceptionInfo ) +WINBASEAPI LONG WINAPI UnhandledExceptionFilter( struct _EXCEPTION_POINTERS * ExceptionInfo ) { PHB_ITEM pBase = hb_stack.pBase; - char buffer[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 32 ]; - char msg[ 2048 ]; + char msg[ ( HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 32 ) * 32 ]; HB_SYMBOL_UNUSED( ExceptionInfo ); @@ -3858,16 +3857,15 @@ WINBASEAPI LONG WINAPI UnhandledExceptionFilter( pBase = hb_stack.pItems + pBase->item.asSymbol.stackbase; if( ( pBase + 1 )->type == IT_ARRAY ) - sprintf( buffer, "Called from %s:%s(%i)", hb_objGetClsName( pBase + 1 ), + sprintf( buffer, "Called from %s:%s(%i)\n", hb_objGetClsName( pBase + 1 ), pBase->item.asSymbol.value->szName, pBase->item.asSymbol.lineno ); else - sprintf( buffer, "Called from %s(%i)", + sprintf( buffer, "Called from %s(%i)\n", pBase->item.asSymbol.value->szName, pBase->item.asSymbol.lineno ); strcat( msg, buffer ); - strcat( msg, "\n" ); } MessageBox( NULL, msg, "Harbour Exception", MB_ICONSTOP );