diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 007485212f..f38cb0766d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,13 @@ +20000411-21:08 GMT+1 Victor Szakats + + * source/rtl/gtapi.c + % Some var++/var-- changed back to ++var/--var. Since they produce + better code when compiler optimization is turned off. + + * source/vm/cmdarg.c + + tests/tscmdarg.c + * Tests moved to the test dir. + 20000411-20:45 GMT+1 Victor Szakats * source/rtl/gtapi.c diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 5be403335d..9f4eaf35dd 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -291,7 +291,7 @@ USHORT hb_gtDispBegin( void ) if( s_uiPreCount == 0 ) hb_gt_DispBegin(); else - s_uiPreCount++; + ++s_uiPreCount; return 0; } @@ -310,7 +310,7 @@ USHORT hb_gtDispEnd( void ) if( s_uiPreCount == 0 ) hb_gt_DispEnd(); else - s_uiPreCount--; + --s_uiPreCount; return 0; } @@ -336,7 +336,7 @@ USHORT hb_gtPreExt( void ) s_uiPreCNest = 1; } else - s_uiPreCNest++; + ++s_uiPreCNest; return 0; @@ -355,7 +355,7 @@ USHORT hb_gtPostExt( void ) s_uiPreCNest = 0; } else - s_uiPreCNest--; + --s_uiPreCNest; return 0; } @@ -468,7 +468,7 @@ USHORT hb_gtSetColorStr( char * szColorString ) } if( i > 0 ) { - i--; + --i; nColor = 0; /* TODO: this can probably be replaced with atoi() */ /* ie: nColor = atoi( buff ); */ @@ -544,7 +544,7 @@ USHORT hb_gtSetColorStr( char * szColorString ) if( nPos == s_uiColorCount ) { s_Color = ( int * ) hb_xrealloc( s_Color, sizeof( int ) * ( nPos + 1 ) ); - s_uiColorCount++; + ++s_uiColorCount; } if( bHasX ) nFore &= 0x88F8; @@ -903,7 +903,7 @@ USHORT hb_gtWriteCon( BYTE * pStr, ULONG ulLength ) break; default: - iCol++; + ++iCol; if( iCol > iMaxCol || iCol <= 0 ) { /* If the cursor position started off the left edge, @@ -975,15 +975,15 @@ USHORT hb_gtDrawShadow( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiR uiMaxCol = hb_gtMaxCol(); uiLeft += 2; - uiBottom++; + ++uiBottom; /* Draw the bottom edge */ if( uiBottom <= uiMaxRow && uiLeft <= uiMaxCol ) hb_gt_SetAttribute( uiBottom, uiLeft, uiBottom, HB_MIN( uiRight, uiMaxCol ), byAttr ); - uiRight++; - uiTop++; + ++uiRight; + ++uiTop; /* Draw the right edge */ diff --git a/harbour/source/vm/cmdarg.c b/harbour/source/vm/cmdarg.c index c7666286cf..20178e22fd 100644 --- a/harbour/source/vm/cmdarg.c +++ b/harbour/source/vm/cmdarg.c @@ -254,25 +254,6 @@ HB_FUNC( HB_ARGV ) hb_retc( "" ); } -#ifdef TEST - -void hb_cmdargTEST( void ) -{ - char * pszArg; - - printf("INFO: %i\n", hb_cmdargCheck( "INFO" ) ); - printf(" F: %s\n", pszArg = hb_cmdargString( "F" ) ); if( pszArg ) hb_xfree( pszArg ); - printf(" Fn: %i\n", hb_cmdargNum( "F" ) ); - printf("TEMP: %s\n", pszArg = hb_cmdargString( "TEMP" ) ); if( pszArg ) hb_xfree( pszArg ); - - printf("INFO: %i\n", hb_cmdargCheck( "INFO" ) ); - printf(" F: %s\n", pszArg = hb_cmdargString( "F" ) ); if( pszArg ) hb_xfree( pszArg ); - printf(" Fn: %i\n", hb_cmdargNum( "F" ) ); - printf("TEMP: %s\n", pszArg = hb_cmdargString( "TEMP" ) ); if( pszArg ) hb_xfree( pszArg ); -} - -#endif - /* Check for command line internal arguments */ void hb_cmdargProcessVM( void ) { diff --git a/harbour/tests/tscmdarg.c b/harbour/tests/tscmdarg.c new file mode 100644 index 0000000000..8cd010139b --- /dev/null +++ b/harbour/tests/tscmdarg.c @@ -0,0 +1,21 @@ +/* + * $Id$ + */ + +#include "hbapi.h" + +void hb_cmdargTEST( void ) +{ + char * pszArg; + + printf("INFO: %i\n", hb_cmdargCheck( "INFO" ) ); + printf(" F: %s\n", pszArg = hb_cmdargString( "F" ) ); if( pszArg ) hb_xfree( pszArg ); + printf(" Fn: %i\n", hb_cmdargNum( "F" ) ); + printf("TEMP: %s\n", pszArg = hb_cmdargString( "TEMP" ) ); if( pszArg ) hb_xfree( pszArg ); + + printf("INFO: %i\n", hb_cmdargCheck( "INFO" ) ); + printf(" F: %s\n", pszArg = hb_cmdargString( "F" ) ); if( pszArg ) hb_xfree( pszArg ); + printf(" Fn: %i\n", hb_cmdargNum( "F" ) ); + printf("TEMP: %s\n", pszArg = hb_cmdargString( "TEMP" ) ); if( pszArg ) hb_xfree( pszArg ); +} + diff --git a/harbour/tests/tstgtapi.c b/harbour/tests/tstgtapi.c new file mode 100644 index 0000000000..7b72db5782 --- /dev/null +++ b/harbour/tests/tstgtapi.c @@ -0,0 +1,77 @@ +/* + * $Id$ + */ + +#include "hbapigt.h" + +void main( void ) +{ + BYTE * test = "Testing GT API Functions"; + BYTE * test2 = "This message wraps!"; + int iRow, iCol; + + /* NOTE: always have to initialze video subsystem */ + hb_gtInit(); + + /* save screen (doesn't work under DOS) */ + /* + BYTE * scr; + USHORT size; + + hb_gtRectSize( 1, 1, hb_gtMaxRow(), hb_gtMaxCol(), &size ); + scr = ( BYTE * ) hb_xgrab( size ); + hb_gtSave( 1, 1, hb_gtMaxRow() - 1, hb_gtMaxCol() - 1, scr ); + */ + + /* writing text */ + hb_gtSetPos( 3, 3 ); + hb_gtWrite( test, strlen( test ) ); + hb_gtSetPos( 12, 42 ); + hb_gtWrite( test, strlen( test ) ); + + /* wrapping text */ + hb_gtSetPos( 7, 70 ); + hb_gtWrite( test2, strlen( test2 ) ); + + /* writing color text */ + hb_gtSetColorStr( "W+/B, B/W" ); + hb_gtColorSelect( _CLR_STANDARD ); + hb_gtWrite( "Enhanced color (B/W)", 20 ); + hb_gtSetPos( 22, 62 ); + hb_gtColorSelect( _CLR_ENHANCED ); + hb_gtWrite( "Standard Color (W+/B)", 21 ); + + /* boxes */ + hb_gtBoxS( 10, 10, 20, 20 ); + hb_gtBoxD( 10, 40, 15, 45 ); + + /* cursor functions */ + hb_gtSetPos( 12, 1 ); + + /* none */ + hb_gtSetCursor( _SC_NONE ); + getch(); + + /* underline */ + hb_gtSetCursor( _SC_NORMAL ); + getch(); + + /* lower half block */ + hb_gtSetCursor( _SC_INSERT ); + getch(); + + /* full block */ + hb_gtSetCursor( _SC_SPECIAL1 ); + getch(); + + /* upper half block */ + hb_gtSetCursor( _SC_SPECIAL2 ); + getch(); + + /* restore screen (doesn't work under DOS) */ + /* + hb_gtRest( 1, 1, hb_gtMaxRow() - 1, hb_gtMaxCol() - 1, scr ); + hb_xfree( scr ); + */ +} +