From a0365016006a21eb4b9043e55c64feb2b793851d Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 26 Sep 2012 14:43:02 +0000 Subject: [PATCH] 2012-09-26 16:41 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbnf/dosver.prg * contrib/hbnf/eltime.prg * contrib/hbnf/floptst.prg * contrib/hbnf/miltime.prg * contrib/hbnf/min2dhm.prg * contrib/hbnf/mouse1.prg * contrib/hbnf/mouse2.prg * contrib/hbnf/nwsem.prg * contrib/hbnf/popadder.prg % use hb_ntos(). (lots of them can be further reduced to StrZero()) % minors --- harbour/ChangeLog | 13 +++++++++++++ harbour/contrib/hbnf/dosver.prg | 4 ++-- harbour/contrib/hbnf/eltime.prg | 10 +++++----- harbour/contrib/hbnf/floptst.prg | 2 +- harbour/contrib/hbnf/miltime.prg | 12 ++++++------ harbour/contrib/hbnf/min2dhm.prg | 12 ++++-------- harbour/contrib/hbnf/mouse1.prg | 10 +++++----- harbour/contrib/hbnf/mouse2.prg | 6 +++--- harbour/contrib/hbnf/nwsem.prg | 4 ++-- harbour/contrib/hbnf/popadder.prg | 4 ++-- 10 files changed, 43 insertions(+), 34 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ab16755d7f..f990dfc0b0 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,19 @@ The license applies to all entries newer than 2009-04-28. */ +2012-09-26 16:41 UTC+0200 Viktor Szakats (harbour syenar.net) + * contrib/hbnf/dosver.prg + * contrib/hbnf/eltime.prg + * contrib/hbnf/floptst.prg + * contrib/hbnf/miltime.prg + * contrib/hbnf/min2dhm.prg + * contrib/hbnf/mouse1.prg + * contrib/hbnf/mouse2.prg + * contrib/hbnf/nwsem.prg + * contrib/hbnf/popadder.prg + % use hb_ntos(). (lots of them can be further reduced to StrZero()) + % minors + 2012-09-26 16:29 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbnf/acctadj.prg * contrib/hbnf/acctmnth.prg diff --git a/harbour/contrib/hbnf/dosver.prg b/harbour/contrib/hbnf/dosver.prg index f78a31b67f..4435dbd325 100644 --- a/harbour/contrib/hbnf/dosver.prg +++ b/harbour/contrib/hbnf/dosver.prg @@ -47,8 +47,8 @@ FUNCTION FT_DOSVER() /* aRegs[ AX ] := MAKEHI( DOSVER ) IF FT_INT86( DOS, aRegs ) - cResult := AllTrim( Str( LOWBYTE( aRegs[ AX ] ) ) ) + "." + ; - AllTrim( Str( HIGHBYTE( aRegs[ AX ] ) ) ) + cResult := hb_ntos( LOWBYTE( aRegs[ AX ] ) ) + "." + ; + hb_ntos( HIGHBYTE( aRegs[ AX ] ) ) ENDIF */ cResult := _get_dosver() diff --git a/harbour/contrib/hbnf/eltime.prg b/harbour/contrib/hbnf/eltime.prg index e85ba59bcc..a3a188b1c4 100644 --- a/harbour/contrib/hbnf/eltime.prg +++ b/harbour/contrib/hbnf/eltime.prg @@ -37,8 +37,8 @@ FUNCTION FT_ELTIME( cTIME1, cTIME2 ) nMINS := Int( ( nDELSECS - nHRS * 3600 ) / 60 ) nSECS := nDELSECS - ( nHRS * 3600 ) - ( nMINS * 60 ) - RETURN Right( "00" + LTrim( Str( nHRS ) ), 2 ) + ; - ":" + ; - Right( "00" + LTrim( Str( nMINS ) ), 2 ) + ; - ":" + ; - Right( "00" + LTrim( Str( nSECS ) ), 2 ) + RETURN Right( "00" + hb_ntos( nHRS ), 2 ) + ; + ":" + ; + Right( "00" + hb_ntos( nMINS ), 2 ) + ; + ":" + ; + Right( "00" + hb_ntos( nSECS ), 2 ) diff --git a/harbour/contrib/hbnf/floptst.prg b/harbour/contrib/hbnf/floptst.prg index 0a15ba3c19..af40c4e058 100644 --- a/harbour/contrib/hbnf/floptst.prg +++ b/harbour/contrib/hbnf/floptst.prg @@ -55,7 +55,7 @@ PROCEDURE Main( cArg1 ) IF HB_ISSTRING( cArg1 ) nErrCode := FT_FLOPTST( Asc( Upper( cArg1 ) ) - Asc( "A" ) ) - OutStd( "Return Code is " + LTrim( Str( nErrCode ) ) + hb_eol() ) + OutStd( "Return Code is " + hb_ntos( nErrCode ) + hb_eol() ) ELSE OutStd( "Usage: floptst cDrive" + hb_eol() + " where cDrive is 'A' or 'B' etc..." + hb_eol() ) ENDIF diff --git a/harbour/contrib/hbnf/miltime.prg b/harbour/contrib/hbnf/miltime.prg index 1f7e454b55..d1816648c1 100644 --- a/harbour/contrib/hbnf/miltime.prg +++ b/harbour/contrib/hbnf/miltime.prg @@ -71,8 +71,8 @@ FUNCTION FT_MIN2MIL( nMIN ) nMIN := nMIN % 1440 - RETURN Right( "00" + LTrim( Str( Int( nMIN / 60 ) ) ), 2 ) + ; - Right( "00" + LTrim( Str( Int( nMIN % 60 ) ) ), 2 ) + RETURN Right( "00" + hb_ntos( Int( nMIN / 60 ) ), 2 ) + ; + Right( "00" + hb_ntos( Int( nMIN % 60 ) ), 2 ) FUNCTION FT_MIL2CIV( cMILTIME ) @@ -94,12 +94,12 @@ FUNCTION FT_MIL2CIV( cMILTIME ) IF nHRS == 0 cHRS := "12" ELSE - cHRS := Right( " " + LTrim( Str( Int( nHRS ) ) ), 2 ) + cHRS := Right( " " + hb_ntos( Int( nHRS ) ), 2 ) ENDIF cCIVTIME := cHRS + ":" + cMINS + " am" OTHERWISE // PM - cCIVTIME := Right( " " + LTrim( Str( Int( nHRS - 12 ) ) ), 2 ) + ; + cCIVTIME := Right( " " + hb_ntos( Int( nHRS - 12 ) ), 2 ) + ; ":" + cMINS + " pm" ENDCASE @@ -134,10 +134,10 @@ FUNCTION FT_CIV2MIL( cTIME ) cMILTIME := " " ENDIF CASE Upper( cKEY ) == "A" // am - cMILTIME := Right( "00" + LTrim( Str( Val( Left( cTIME, 2 ) ) ) ), 2 ) + ; + cMILTIME := Right( "00" + hb_ntos( Val( Left( cTIME, 2 ) ) ), 2 ) + ; SubStr( cTIME, 4, 2 ) CASE Upper( cKEY ) == "P" // pm - cMILTIME := Right( "00" + LTrim( Str( Val( Left( cTIME, 2 ) ) + 12 ) ), 2 ) + ; + cMILTIME := Right( "00" + hb_ntos( Val( Left( cTIME, 2 ) ) + 12 ), 2 ) + ; SubStr( cTIME, 4, 2 ) OTHERWISE cMILTIME := " " // error diff --git a/harbour/contrib/hbnf/min2dhm.prg b/harbour/contrib/hbnf/min2dhm.prg index 60353c66a6..a2b7e93e08 100644 --- a/harbour/contrib/hbnf/min2dhm.prg +++ b/harbour/contrib/hbnf/min2dhm.prg @@ -28,11 +28,7 @@ */ FUNCTION FT_MIN2DHM( nMINS ) - - LOCAL aDHM_[ 3 ] - - aDHM_[ 1 ] := LTrim( ( Str( Int( nMINS / 1440 ) ) ) ) - aDHM_[ 2 ] := LTrim( Str( Int( ( nMINS % 1440 ) / 60 ) ) ) - aDHM_[ 3 ] := LTrim( Str( Int( ( nMINS % 1440 ) % 60 ) ) ) - - RETURN aDHM_ + RETURN {; + hb_ntos( Int( nMINS / 1440 ) ) ,; + hb_ntos( Int( ( nMINS % 1440 ) / 60 ) ) ,; + hb_ntos( Int( ( nMINS % 1440 ) % 60 ) ) } \ No newline at end of file diff --git a/harbour/contrib/hbnf/mouse1.prg b/harbour/contrib/hbnf/mouse1.prg index 7ce0d511d9..455a178d5f 100644 --- a/harbour/contrib/hbnf/mouse1.prg +++ b/harbour/contrib/hbnf/mouse1.prg @@ -53,12 +53,12 @@ PROCEDURE Main( nRow, nCol ) SetColor( "GR+/RB" ) -// ..... Start the demo + // ..... Start the demo @MaxRow(), 0 SAY "Driver version: " + ; - AllTrim( Str( FT_MVERSION(@nMinor,@nType,@nIRQ ),2,0 ) ) + "." + ; - AllTrim( Str( nMinor,2,0 ) ) - @ Row(), Col() SAY " " + aType[nType] + " mouse using IRQ " + Str( nIRQ, 1, 0 ) + AllTrim( Str( FT_MVERSION( @nMinor, @nType, @nIRQ ), 2, 0 ) ) + "." + ; + AllTrim( Str( nMinor, 2, 0 ) ) + @ Row(), Col() SAY " " + aType[ nType ] + " mouse using IRQ " + Str( nIRQ, 1, 0 ) FT_MGETSENS( @nHoriz, @nVert, @nDouble ) // Get the current sensitivities FT_MSETSENS( 70, 70, 60 ) // Bump up the sensitivity of the mouse @@ -66,7 +66,7 @@ PROCEDURE Main( nRow, nCol ) FT_MSHOWCRS() FT_MSETCOORD( 10, 20 ) // just an arbitrary place for demo -// put the unchanging stuff + // put the unchanging stuff DevPos( 9, 10 ) DevOut( "FT_MMICKEYS :" ) diff --git a/harbour/contrib/hbnf/mouse2.prg b/harbour/contrib/hbnf/mouse2.prg index 17e5846ea5..6e2c6eb552 100644 --- a/harbour/contrib/hbnf/mouse2.prg +++ b/harbour/contrib/hbnf/mouse2.prg @@ -127,9 +127,9 @@ PROCEDURE Main( nRow, nCol ) // ..... Start the demo @MaxRow(), 0 SAY "Driver version: " + ; - AllTrim( Str( FT_MVERSION(@nMinor,@nType,@nIRQ ),2,0 ) ) + "." + ; - AllTrim( Str( nMinor,2,0 ) ) - @ Row(), Col() SAY " " + aType[nType] + " mouse using IRQ " + Str( nIRQ, 1, 0 ) + AllTrim( Str( FT_MVERSION( @nMinor, @nType, @nIRQ ), 2, 0 ) ) + "." + ; + AllTrim( Str( nMinor, 2, 0 ) ) + @ Row(), Col() SAY " " + aType[ nType ] + " mouse using IRQ " + Str( nIRQ, 1, 0 ) FT_MGETSENS( @nHoriz, @nVert, @nDouble ) // Get the current sensitivities FT_MSETSENS( 70, 70, 60 ) // Bump up the sensitivity of the mouse diff --git a/harbour/contrib/hbnf/nwsem.prg b/harbour/contrib/hbnf/nwsem.prg index 4a6b23eaa7..25c97ae6fe 100644 --- a/harbour/contrib/hbnf/nwsem.prg +++ b/harbour/contrib/hbnf/nwsem.prg @@ -80,9 +80,9 @@ PROCEDURE Main() ft_nwSemEx( nHandle, @nValue, @nOpenCnt ) WHILE .T. @ 23, 0 SAY "Semaphore test -> Open at [" + ; - AllTrim( Str( nOpenCnt ) ) + ; + hb_ntos( nOpenCnt ) + ; "] stations, value is [" + ; - AllTrim( Str( nValue ) ) + "]" + hb_ntos( nValue ) + "]" IF Inkey( WAIT_SECONDS ) != 0 EXIT diff --git a/harbour/contrib/hbnf/popadder.prg b/harbour/contrib/hbnf/popadder.prg index 75c0b532f3..ce89cffeb0 100644 --- a/harbour/contrib/hbnf/popadder.prg +++ b/harbour/contrib/hbnf/popadder.prg @@ -469,7 +469,7 @@ STATIC FUNCTION _ftDispTotal( aAdder ) LOCAL cTotStr IF nTotal > Val( _ftCharRem( ",", cTotPict ) ) - cTotStr := _ftStuffComma( LTrim( Str( nTotal ) ) ) + cTotStr := _ftStuffComma( hb_ntos( nTotal ) ) @ 4 + nTopOS, 8 + nAddSpace SAY "**** ERROR **** " _ftError( "that number is to big to display! I believe the answer was " + ; cTotStr + "." ) @@ -503,7 +503,7 @@ STATIC FUNCTION _ftDispSubTot( aAdder ) LOCAL cStotStr IF nNumTotal > Val( _ftCharRem( ",", cTotPict ) ) - cStotStr := _ftStuffComma( LTrim( Str( nNumTotal ) ) ) + cStotStr := _ftStuffComma( hb_ntos( nNumTotal ) ) @ 4 + nTopOS, 8 + nAddSpace SAY "**** ERROR **** " _ftError( "that number is to big to display! I believe the answer was " + ; cStotStr + "." )