From b78c1d59e215c359433b2fd8be65d822a5ae8081 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 4 Apr 2000 09:04:39 +0000 Subject: [PATCH] 20000404-11:06 GMT+1 Victor Szakats --- harbour/ChangeLog | 26 ++++++++++++++++++++++++++ harbour/source/rdd/dbstrux.prg | 13 +++---------- harbour/source/rtl/console.c | 4 ++-- harbour/source/rtl/dircmd.prg | 11 ++++++++++- harbour/source/rtl/gt_tpl/gt_tpl.c | 2 +- harbour/source/rtl/gtapi.c | 2 +- harbour/source/rtl/gtdos/gtdos.c | 2 +- harbour/source/rtl/gtos2/gtos2.c | 2 +- harbour/source/rtl/gtpca/gtpca.c | 2 +- harbour/source/rtl/gtsln/gtsln.c | 2 +- harbour/source/rtl/gtstd/gtstd.c | 2 +- harbour/source/rtl/input.prg | 5 +++-- harbour/source/rtl/tgetlist.prg | 17 +++++++++++++---- harbour/source/rtl/wait.prg | 14 +++++--------- harbour/tests/tstprag.prg | 10 ++++++---- 15 files changed, 75 insertions(+), 39 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e8ae4acdd9..19140fc131 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,29 @@ +20000404-11:06 GMT+1 Victor Szakats + + * source/rtl/dircmd.prg + + Changed to use NationMsg() instead of the hard-wired English + string. The previous 100% compatible version left in STRICT_COMPAT + branch. + + * source/rtl/console.c + * source/rtl/gtapi.c + * source/rtl/gt*/gt*.c + ! Fixed some TRACE calls. + + * source/rtl/wait.prg + * source/rtl/input.prg + % Small optimization. + * Variable renamed to better reflect purpose and types. + + * source/rtl/tgetlist.prg + ! Using NationMsg() instead of the hard-coded strings. + + * source/rdd/dbstrux.prg + % Some optimizations. + + * tests/tstprag.prg + + New tests changed. + 20000404-08:55 GMT+2 Chen Kedem * doc/en/dbstrux.txt + documentation for __dbCreate() diff --git a/harbour/source/rdd/dbstrux.prg b/harbour/source/rdd/dbstrux.prg index 0c922ddc55..c60b557f99 100644 --- a/harbour/source/rdd/dbstrux.prg +++ b/harbour/source/rdd/dbstrux.prg @@ -42,10 +42,7 @@ FUNCTION __dbCopyStruct( cFileName, aFieldList ) FUNCTION __dbCopyXStruct( cFileName ) LOCAL nOldArea - - LOCAL lError := .F. LOCAL oError - LOCAL aStruct IF Empty( aStruct := dbStruct() ) @@ -69,9 +66,9 @@ FUNCTION __dbCopyXStruct( cFileName ) FIELD->FIELD_DEC := aField[ DBS_DEC ] } ) /* NOTE: CA-Cl*pper has a bug, where only a plain RECOVER statement is - used here, so oError will always be NIL. */ + used here (without the USING keyword), so oError will always be + NIL. */ RECOVER USING oError - lError := .T. END SEQUENCE IF Select() != nOldArea @@ -79,7 +76,7 @@ FUNCTION __dbCopyXStruct( cFileName ) dbSelectArea( nOldArea ) ENDIF - IF lError + IF oError != NIL Break( oError ) ENDIF @@ -91,14 +88,11 @@ FUNCTION __dbCreate( cFileName, cFileFrom, cRDDName, lNew, cAlias ) LOCAL oError DEFAULT lNew TO .F. - DEFAULT cAlias TO cFileName IF Used() .AND. !lNew dbCloseArea() ENDIF - hb_FNameSplit( cAlias, NIL, @cAlias ) - BEGIN SEQUENCE IF Empty( cFileFrom ) @@ -153,7 +147,6 @@ FUNCTION __FLEDIT( aStruct, aFieldList ) /* NOTE: Internal helper function, CA-Cl*pper name is: __FLEDIT() */ - FUNCTION __dbStructFilter( aStruct, aFieldList ) LOCAL aStructFiltered LOCAL bFindName diff --git a/harbour/source/rtl/console.c b/harbour/source/rtl/console.c index 3b7cb1bf6e..4826434b95 100644 --- a/harbour/source/rtl/console.c +++ b/harbour/source/rtl/console.c @@ -160,7 +160,7 @@ static void hb_conOut( USHORT uiParam, hb_out_func_typedef * pOutFunc ) ULONG ulLen; BOOL bFreeReq; - HB_TRACE(HB_TR_DEBUG, ("hb_conOut(%hu, %p)", uiParam, hb_out_func)); + HB_TRACE(HB_TR_DEBUG, ("hb_conOut(%hu, %p)", uiParam, pOutFunc)); pItem = hb_param( uiParam, HB_IT_ANY ); pszString = hb_itemString( pItem, &ulLen, &bFreeReq ); @@ -367,7 +367,7 @@ HB_FUNC( PCOL ) /* Returns the current printer row position */ static void hb_conDevPos( SHORT iRow, SHORT iCol ) { - HB_TRACE(HB_TR_DEBUG, ("hb_conDevPos(%hd, %hd)", row, col)); + HB_TRACE(HB_TR_DEBUG, ("hb_conDevPos(%hd, %hd)", iRow, iCol)); /* Position printer if SET DEVICE TO PRINTER and valid printer file otherwise position console */ diff --git a/harbour/source/rtl/dircmd.prg b/harbour/source/rtl/dircmd.prg index c12fbae799..482ce03e0b 100644 --- a/harbour/source/rtl/dircmd.prg +++ b/harbour/source/rtl/dircmd.prg @@ -33,9 +33,13 @@ * */ +#include "hbsetup.ch" + #include "directry.ch" #include "fileio.ch" +#define _DIR_HEADER 1 + PROCEDURE __Dir( cFileMask ) LOCAL cPath LOCAL cName @@ -45,9 +49,14 @@ PROCEDURE __Dir( cFileMask ) /* NOTE: Although Cl*pper has this string in the national language modul, it will not use it from here. - This is hard wired to English. */ + This is hard wired to English. So this is a small + incompatibility */ +#ifdef HARBOUR_STRICT_CLIPPER_COMPATIBILITY QOut( "Database Files # Records Last Update Size" ) +#else + QOut( NationMsg( _DIR_HEADER ) ) +#endif aEval( Directory( hb_FNameMerge( Set( _SET_DEFAULT ), "*", ".dbf" ) ),; {| aDirEntry | PutDbf( aDirEntry ) } ) diff --git a/harbour/source/rtl/gt_tpl/gt_tpl.c b/harbour/source/rtl/gt_tpl/gt_tpl.c index 9d5d4adfd7..3ff9bd8644 100644 --- a/harbour/source/rtl/gt_tpl/gt_tpl.c +++ b/harbour/source/rtl/gt_tpl/gt_tpl.c @@ -57,7 +57,7 @@ void hb_gt_Done( void ) int hb_gt_ReadKey( HB_inkey_enum eventmask ) { - HB_TRACE(HB_TR_DEBUG, ("hb_gt_ReadKey(%d)", (int) event_mask)); + HB_TRACE(HB_TR_DEBUG, ("hb_gt_ReadKey(%d)", (int) eventmask)); HB_SYMBOL_UNUSED( eventmask ); diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 5d05493715..fa2332fe41 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -132,7 +132,7 @@ void hb_gtExit( void ) int hb_gtReadKey( HB_inkey_enum eventmask ) { - HB_TRACE(HB_TR_DEBUG, ("hb_gtReadKey(%d)", (int) event_mask)); + HB_TRACE(HB_TR_DEBUG, ("hb_gtReadKey(%d)", (int) eventmask)); return hb_gt_ReadKey( eventmask ); } diff --git a/harbour/source/rtl/gtdos/gtdos.c b/harbour/source/rtl/gtdos/gtdos.c index 7ec1cf76d9..fa5e9fb423 100644 --- a/harbour/source/rtl/gtdos/gtdos.c +++ b/harbour/source/rtl/gtdos/gtdos.c @@ -216,7 +216,7 @@ int hb_gt_ReadKey( HB_inkey_enum eventmask ) { int ch = 0; - HB_TRACE(HB_TR_DEBUG, ("hb_gt_ReadKey(%d)", (int) event_mask)); + HB_TRACE(HB_TR_DEBUG, ("hb_gt_ReadKey(%d)", (int) eventmask)); #if defined(__DJGPP__) /* Check to see if Ctrl+Break has been detected */ diff --git a/harbour/source/rtl/gtos2/gtos2.c b/harbour/source/rtl/gtos2/gtos2.c index 05b3ab0584..5139aeaac3 100644 --- a/harbour/source/rtl/gtos2/gtos2.c +++ b/harbour/source/rtl/gtos2/gtos2.c @@ -140,7 +140,7 @@ int hb_gt_ReadKey( HB_inkey_enum eventmask ) { int ch; - HB_TRACE(HB_TR_DEBUG, ("hb_gt_ReadKey(%d)", (int) event_mask)); + HB_TRACE(HB_TR_DEBUG, ("hb_gt_ReadKey(%d)", (int) eventmask)); #if defined(HARBOUR_GCC_OS2) /* 25/03/2000 - maurilio.longo@libero.it diff --git a/harbour/source/rtl/gtpca/gtpca.c b/harbour/source/rtl/gtpca/gtpca.c index 205d9349a5..507959b576 100644 --- a/harbour/source/rtl/gtpca/gtpca.c +++ b/harbour/source/rtl/gtpca/gtpca.c @@ -185,7 +185,7 @@ BOOL hb_gt_AdjustPos( BYTE * pStr, ULONG ulLen ) #else int hb_gt_ReadKey( HB_inkey_enum eventmask ) { - HB_TRACE(HB_TR_DEBUG, ("hb_gt_ReadKey(%d)", (int) event_mask)); + HB_TRACE(HB_TR_DEBUG, ("hb_gt_ReadKey(%d)", (int) eventmask)); HB_SYMBOL_UNUSED( eventmask ); /* TODO: */ return 0; diff --git a/harbour/source/rtl/gtsln/gtsln.c b/harbour/source/rtl/gtsln/gtsln.c index 13e420cacf..c767929963 100644 --- a/harbour/source/rtl/gtsln/gtsln.c +++ b/harbour/source/rtl/gtsln/gtsln.c @@ -67,7 +67,7 @@ void hb_gt_Done( void ) int hb_gt_ReadKey( HB_inkey_enum eventmask ) { - HB_TRACE(HB_TR_DEBUG, ("hb_gt_ReadKey(%d)", (int) event_mask)); + HB_TRACE(HB_TR_DEBUG, ("hb_gt_ReadKey(%d)", (int) eventmask)); HB_SYMBOL_UNUSED( eventmask ); diff --git a/harbour/source/rtl/gtstd/gtstd.c b/harbour/source/rtl/gtstd/gtstd.c index 0b2bb22014..2a330db3ea 100644 --- a/harbour/source/rtl/gtstd/gtstd.c +++ b/harbour/source/rtl/gtstd/gtstd.c @@ -85,7 +85,7 @@ int hb_gt_ReadKey( HB_inkey_enum eventmask ) { int ch; - HB_TRACE(HB_TR_DEBUG, ("hb_gt_ReadKey(%d)", (int) event_mask)); + HB_TRACE(HB_TR_DEBUG, ("hb_gt_ReadKey(%d)", (int) eventmask)); HB_SYMBOL_UNUSED( eventmask ); diff --git a/harbour/source/rtl/input.prg b/harbour/source/rtl/input.prg index ad04a9da06..511749e69b 100644 --- a/harbour/source/rtl/input.prg +++ b/harbour/source/rtl/input.prg @@ -33,7 +33,8 @@ * */ -FUNCTION __Input( cMessage ) - LOCAL cString := __Accept( cMessage ) +FUNCTION __Input( xPrompt ) + LOCAL cString := __Accept( xPrompt ) RETURN iif( Empty( cString ), NIL, &cString ) + diff --git a/harbour/source/rtl/tgetlist.prg b/harbour/source/rtl/tgetlist.prg index 98d78e7499..2e7b3aec36 100644 --- a/harbour/source/rtl/tgetlist.prg +++ b/harbour/source/rtl/tgetlist.prg @@ -42,7 +42,11 @@ #define SCORE_ROW 0 #define SCORE_COL 60 -#define K_UNDO K_CTRL_U +#define _GET_INSERT_ON 7 +#define _GET_INSERT_OFF 8 +#define _GET_INVD_DATE 9 + +#define K_UNDO K_CTRL_U CLASS TGetList @@ -463,12 +467,17 @@ METHOD ShowScoreboard() CLASS TGetList local nRow, nCol, nOldCursor if Set( _SET_SCOREBOARD ) + nRow := Row() nCol := Col() + nOldCursor := SetCursor( SC_NONE ) - DispOutAt( SCORE_ROW, SCORE_COL, If( Set( _SET_INSERT ), "Ins", " " ) ) + + DispOutAt( SCORE_ROW, SCORE_COL, iif( Set( _SET_INSERT ), NationMsg( _GET_INSERT_ON ), NationMsg( _GET_INSERT_OFF ) ) ) SetPos( nRow, nCol ) + SetCursor( nOldCursor ) + endif return Self @@ -483,13 +492,13 @@ METHOD DateMsg() CLASS TGetList nRow := Row() nCol := Col() - DispOutAt( SCORE_ROW, SCORE_COL, "Invalid date" ) + DispOutAt( SCORE_ROW, SCORE_COL, NationMsg( _GET_INVD_DATE ) ) SetPos( nRow, nCol ) do while NextKey() == 0 enddo - DispOutAt( SCORE_ROW, SCORE_COL, Space( Len( "Invalid date" ) ) ) + DispOutAt( SCORE_ROW, SCORE_COL, Space( Len( NationMsg( _GET_INVD_DATE ) ) ) ) SetPos( nRow, nCol ) endif diff --git a/harbour/source/rtl/wait.prg b/harbour/source/rtl/wait.prg index fd3abdef9d..71be48f68d 100644 --- a/harbour/source/rtl/wait.prg +++ b/harbour/source/rtl/wait.prg @@ -35,17 +35,12 @@ #include "inkey.ch" -FUNCTION __Wait( cString ) +FUNCTION __Wait( xPrompt ) LOCAL nKey LOCAL bBlock - IF cString == NIL - /* TODO: Here we can use LangApi to localize default message - */ - ? "Press any key to continue..." - ELSE - ? cString - ENDIF + /* TODO: Here we can use LangApi to localize default message */ + QOut( iif( xPrompt == NIL, "Press any key to continue...", xPrompt ) ) DO WHILE .T. @@ -55,7 +50,7 @@ FUNCTION __Wait( cString ) Eval( bBlock, ProcName( 1 ), ProcLine( 1 ), "" ) ELSE IF nKey >= 32 .and. nKey <= 255 - ?? Chr( nKey ) + QQOut( Chr( nKey ) ) ELSE nKey := 0 ENDIF @@ -66,3 +61,4 @@ FUNCTION __Wait( cString ) ENDDO RETURN Chr( nKey ) + diff --git a/harbour/tests/tstprag.prg b/harbour/tests/tstprag.prg index b657a388a2..728877d23c 100644 --- a/harbour/tests/tstprag.prg +++ b/harbour/tests/tstprag.prg @@ -13,13 +13,13 @@ function Main() #pragma Shortcut=On -#pragma Shortcut= On +#pragma Shortcut= Off #pragma Shortcut = On -#pragma Shortcut(On) +#pragma Shortcut(OFF) #pragma Shortcut( On) #pragma Shortcut( OFF ) #pragma Shortcut( On ) -#pragma Shortcut( ON ) +#pragma Shortcut( OFF ) #pragma Shortcut( ON /* or #pragma /Z+ */ @@ -38,8 +38,10 @@ function Main() #pragma Exitseverity=0 #pragma Exitseverity=1 #pragma Exitseverity(0) -#pragma Exitseverity( 0 ) #pragma Exitseverity( 1 ) +#pragma Exitseverity( 0 ) +#pragma Exitseverity= 2 +#pragma Exitseverity= 1 /* Pragmas with bad values will cause an error */ #pragma WarningLevel=8