From 7593619930b71c0e0602dec3b4428bfacc98afd4 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 8 Nov 2008 12:55:59 +0000 Subject: [PATCH] 2008-11-08 13:55 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * source/vm/set.c ! _SET_EVENTMASK RTE removed to be Clipper compatible. ! _SET_VIDEOMODE RTE removed to be Clipper compatible. ! _SET_MBLOCKSIZE default value set to 64 (was 0) to be Clipper compatible. (pls correct me if this was intentionally wrong) * utils/hbtest/rt_misc.prg + Added one C5.2 SET()s for two simple tests. + Added all C5.3 SET()s for two simple tests each. ; NOFIX: _SET_VIDEOMODE has the type wrong. ; NOTE: It wouldn't be a bad idea to add some more comprehensive tests for SET()s. --- harbour/ChangeLog | 14 ++++++++++++++ harbour/source/vm/set.c | 32 ++++++++++++++++---------------- harbour/utils/hbtest/rt_misc.prg | 27 +++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 16 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5be5342bb4..429fade56f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,20 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-11-08 13:55 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * source/vm/set.c + ! _SET_EVENTMASK RTE removed to be Clipper compatible. + ! _SET_VIDEOMODE RTE removed to be Clipper compatible. + ! _SET_MBLOCKSIZE default value set to 64 (was 0) to be Clipper compatible. + (pls correct me if this was intentionally wrong) + + * utils/hbtest/rt_misc.prg + + Added one C5.2 SET()s for two simple tests. + + Added all C5.3 SET()s for two simple tests each. + ; NOFIX: _SET_VIDEOMODE has the type wrong. + ; NOTE: It wouldn't be a bad idea to add some more comprehensive + tests for SET()s. + 2008-11-08 13:22 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/make_gcc.sh * harbour/make_gnu.bat diff --git a/harbour/source/vm/set.c b/harbour/source/vm/set.c index f6ef19adc3..6170d14eb5 100644 --- a/harbour/source/vm/set.c +++ b/harbour/source/vm/set.c @@ -605,7 +605,12 @@ HB_FUNC( SET ) case HB_SET_EVENTMASK: hb_retni( pSet->HB_SET_EVENTMASK ); if( args > 1 ) - pSet->HB_SET_EVENTMASK = set_number( pArg2, pSet->HB_SET_EVENTMASK ); + { + if( set_number( pArg2, pSet->HB_SET_EVENTMASK ) < 0 ) + hb_errRT_BASE( EG_ARG, 2020, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); + else + pSet->HB_SET_EVENTMASK = set_number( pArg2, pSet->HB_SET_EVENTMASK ); + } break; case HB_SET_EXACT: hb_retl( pSet->HB_SET_EXACT ); @@ -812,12 +817,7 @@ HB_FUNC( SET ) case HB_SET_VIDEOMODE: hb_retni( pSet->HB_SET_VIDEOMODE ); if( args > 1 ) - { - if( set_number( pArg2, pSet->HB_SET_VIDEOMODE ) < 0 ) - hb_errRT_BASE( EG_ARG, 2020, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); - else - pSet->HB_SET_VIDEOMODE = set_number( pArg2, pSet->HB_SET_VIDEOMODE ); - } + pSet->HB_SET_VIDEOMODE = set_number( pArg2, pSet->HB_SET_VIDEOMODE ); break; case HB_SET_WRAP: hb_retl( pSet->HB_SET_WRAP ); @@ -1030,7 +1030,7 @@ void hb_setInitialize( PHB_SET_STRUCT pSet ) pSet->HB_SET_INSERT = FALSE; pSet->HB_SET_INTENSITY = TRUE; pSet->HB_SET_MARGIN = 0; - pSet->HB_SET_MBLOCKSIZE = 0; + pSet->HB_SET_MBLOCKSIZE = 64; pSet->HB_SET_MCENTER = FALSE; pSet->HB_SET_MESSAGE = 0; pSet->HB_SET_MFILEEXT = hb_strdup( "" ); @@ -1595,8 +1595,12 @@ HB_EXPORT BOOL hb_setSetItem( HB_set_enum set_specifier, PHB_ITEM pItem ) case HB_SET_EVENTMASK: if( HB_IS_NUMERIC( pItem ) ) { - pSet->HB_SET_EVENTMASK = hb_itemGetNI( pItem ); - fResult = TRUE; + iValue = hb_itemGetNI( pItem ); + if( iValue >= 0 ) + { + pSet->HB_SET_EVENTMASK = iValue; + fResult = TRUE; + } } break; case HB_SET_MARGIN: @@ -1640,12 +1644,8 @@ HB_EXPORT BOOL hb_setSetItem( HB_set_enum set_specifier, PHB_ITEM pItem ) case HB_SET_VIDEOMODE: if( HB_IS_NUMERIC( pItem ) ) { - iValue = hb_itemGetNI( pItem ); - if( iValue >= 0 ) - { - pSet->HB_SET_VIDEOMODE = iValue; - fResult = TRUE; - } + pSet->HB_SET_VIDEOMODE = hb_itemGetNI( pItem ); + fResult = TRUE; } break; diff --git a/harbour/utils/hbtest/rt_misc.prg b/harbour/utils/hbtest/rt_misc.prg index ea9a1cb1c5..b85b79150c 100644 --- a/harbour/utils/hbtest/rt_misc.prg +++ b/harbour/utils/hbtest/rt_misc.prg @@ -84,6 +84,33 @@ PROCEDURE Main_MISC() TEST_LINE( Len( oError ) , 12 ) #endif + /* SET()s */ + + TEST_LINE( Set( _SET_MARGIN ) , 0 ) + TEST_LINE( Set( _SET_MARGIN , -1 ) , "E BASE 2020 Argument error SET A:2:N:25;N:-1 " ) + +#ifdef HB_COMPAT_C53 + TEST_LINE( Set( _SET_EVENTMASK ) , 128 ) + TEST_LINE( Set( _SET_VIDEOMODE ) , NIL ) + TEST_LINE( Set( _SET_MBLOCKSIZE ) , 64 ) + TEST_LINE( Set( _SET_MFILEEXT ) , "" ) + TEST_LINE( Set( _SET_STRICTREAD ) , .F. ) + TEST_LINE( Set( _SET_OPTIMIZE ) , .T. ) + TEST_LINE( Set( _SET_AUTOPEN ) , .T. ) + TEST_LINE( Set( _SET_AUTORDER ) , 0 ) + TEST_LINE( Set( _SET_AUTOSHARE ) , 0 ) + + TEST_LINE( Set( _SET_EVENTMASK , -1 ) , "E BASE 2020 Argument error SET A:2:N:39;N:-1 " ) + TEST_LINE( Set( _SET_VIDEOMODE , -1 ) , NIL ) + TEST_LINE( Set( _SET_MBLOCKSIZE, -1 ) , "E BASE 2020 Argument error SET A:2:N:41;N:-1 " ) + TEST_LINE( Set( _SET_MFILEEXT , {} ) , "" ) + TEST_LINE( Set( _SET_STRICTREAD, {} ) , .F. ) + TEST_LINE( Set( _SET_OPTIMIZE , {} ) , .T. ) + TEST_LINE( Set( _SET_AUTOPEN , {} ) , .T. ) + TEST_LINE( Set( _SET_AUTORDER , -1 ) , "E BASE 2020 Argument error SET A:2:N:46;N:-1 " ) + TEST_LINE( Set( _SET_AUTOSHARE , -1 ) , "E BASE 2020 Argument error SET A:2:N:47;N:-1 " ) +#endif + /* Some color handling tests */ TEST_LINE( ( SetColor( "N/N,N/N,N/N,N/N,N/N" ), SetColor( "T" ), SetColor() ) , "N/N,N/N,N/N,N/N,N/N" )