From 4cb3e0433533c9366a4c12e3aa75068f75b80612 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 19 Jun 2011 22:15:34 +0000 Subject: [PATCH] 2011-06-20 00:14 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/xhb/trpccli.prg * contrib/xhb/trpc.prg ! fixed '!=' operator on strings * contrib/xhb/sprintf.prg ! indenting, formatting (verified) * contrib/xhb/xhbmemo.prg * whitespace --- harbour/ChangeLog | 14 +- harbour/contrib/xhb/sprintf.prg | 226 ++++++++++++++++---------------- harbour/contrib/xhb/trpc.prg | 2 +- harbour/contrib/xhb/trpccli.prg | 4 +- harbour/contrib/xhb/xhbmemo.prg | 14 +- 5 files changed, 135 insertions(+), 125 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index bdc9a0f98e..00610aaa77 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,17 @@ The license applies to all entries newer than 2009-04-28. */ +2011-06-20 00:14 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/xhb/trpccli.prg + * contrib/xhb/trpc.prg + ! fixed '!=' operator on strings + + * contrib/xhb/sprintf.prg + ! indenting, formatting (verified) + + * contrib/xhb/xhbmemo.prg + * whitespace + 2011-06-19 18:09 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/xhb/xhbtedit.prg ! fixed to not use deprecated internal functions __str*() @@ -28,8 +39,7 @@ 2011-06-19 17:18 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/xhb/xhbtedit.prg ! fixed to handle some of the "extended" keys without build-time hacks, - so selection/copy/paste should now work (I don't have Ins/Del keys, - so can't test it all) + so selection/copy/paste should now work * formatting + contrib/xhb/xhbmemo.prg diff --git a/harbour/contrib/xhb/sprintf.prg b/harbour/contrib/xhb/sprintf.prg index eb52139072..1ad695ef8d 100644 --- a/harbour/contrib/xhb/sprintf.prg +++ b/harbour/contrib/xhb/sprintf.prg @@ -60,148 +60,148 @@ FUNCTION sprintf( ... ) aPar := HB_aParams() cReturn := "" - cString := aPar[1] + cString := aPar[ 1 ] nPar := 2 - DO WHILE !Empty( cString ) + DO WHILE ! Empty( cString ) nPos := Len( cString ) + 1 cTok := NIL - IF '%' $ cString - nPos := At( '%', cString ) - cTok := '%' + IF "%" $ cString + nPos := At( "%", cString ) + cTok := "%" ENDIF - IF '\' $ cString .AND. At( '\', cString ) < nPos - nPos := At( '\', cString ) - cTok := '\' + IF "\" $ cString .AND. At( "\", cString ) < nPos + nPos := At( "\", cString ) + cTok := "\" ENDIF cReturn += Left( cString, nPos - 1 ) DO CASE CASE cTok == NIL - EXIT + EXIT - CASE cTok == '\' + CASE cTok == "\" - SWITCH SubStr( cString, ++nPos, 1 ) - CASE 't' - cReturn += ' ' - EXIT + SWITCH SubStr( cString, ++nPos, 1 ) + CASE "t" + cReturn += " " + EXIT - CASE 'n' - cReturn += Chr( 13 ) - EXIT + CASE "n" + cReturn += Chr( 13 ) + EXIT - CASE 'r' - cReturn += Chr( 10 ) - EXIT + CASE "r" + cReturn += Chr( 10 ) + EXIT - OTHERWISE - cReturn += SubStr( cString, nPos, 1 ) - EXIT - ENDSWITCH + OTHERWISE + cReturn += SubStr( cString, nPos, 1 ) + EXIT + ENDSWITCH - CASE cTok == '%' - lUnsigned := .F. + CASE cTok == "%" + lUnsigned := .F. - SWITCH SubStr( cString, ++nPos, 1 ) - CASE '%' - cReturn += '%' - EXIT + SWITCH SubStr( cString, ++nPos, 1 ) + CASE "%" + cReturn += "%" + EXIT - CASE '+' - cString := Left( cString, nPos - 1 ) + SubStr( cString, nPos + 1 ) - nPos := At( '%', cString ) - 1 - lSign := .T. - EXIT + CASE "+" + cString := Left( cString, nPos - 1 ) + SubStr( cString, nPos + 1 ) + nPos := At( "%", cString ) - 1 + lSign := .T. + EXIT - CASE '0' - cString := Left( cString, nPos - 1 ) + SubStr( cString, nPos + 1 ) - nPos := At( '%', cString ) - 1 - l0 := .T. - EXIT + CASE "0" + cString := Left( cString, nPos - 1 ) + SubStr( cString, nPos + 1 ) + nPos := At( "%", cString ) - 1 + l0 := .T. + EXIT - CASE '1' - CASE '2' - CASE '3' - CASE '4' - CASE '5' - CASE '6' - CASE '7' - CASE '8' - CASE '9' - nLen := Val( SubStr( cString, nPos ) ) - cTok := Left( cString, nPos - 1 ) - DO WHILE SubStr( cString, nPos, 1 ) $ '1234567890.' - nPos++ - ENDDO - cString := cTok + SubStr( cString, nPos ) - nPos := At( '%', cString ) - 1 - EXIT - - CASE 'u' - lUnsigned := .T. + CASE "1" + CASE "2" + CASE "3" + CASE "4" + CASE "5" + CASE "6" + CASE "7" + CASE "8" + CASE "9" + nLen := Val( SubStr( cString, nPos ) ) + cTok := Left( cString, nPos - 1 ) + DO WHILE SubStr( cString, nPos, 1 ) $ "1234567890." nPos++ + ENDDO + cString := cTok + SubStr( cString, nPos ) + nPos := At( "%", cString ) - 1 + EXIT - CASE 'd' - CASE 'l' - CASE 'f' - CASE 'i' - xVal := aPar[nPar++] - IF !ISNUMBER( xVal ) - xVal := 0 - ENDIF - IF nLen != 0 - IF nLen - Int( nLen ) > 0.0 - nDec := Str( nLen ) - DO WHILE Right( nDec, 1 ) == '0' - nDec := Left( nDec, Len( nDec ) - 1 ) - END - nDec := Val( SubStr( nDec, At( '.', nDec ) + 1 ) ) - ELSE - nDec := 0 - ENDIF - cTok := Str( IIF( lUnsigned, Abs( xVal ), xVal ), nLen, nDec ) - ELSE - cTok := hb_NToS( IIF( lUnsigned, Abs( xVal ), xVal ) ) - ENDIF - IF l0 - IF '-' $ cTok .AND. Left( cTok, 1 ) != '-' - cTok := StrTran( cTok, '-', ' ' ) - cTok := '-' + SubStr( cTok, 2 ) - ENDIF - cTok := StrTran( cTok, ' ', '0' ) - l0 := .F. - ENDIF - IF lSign .AND. Left( cTok, 1 ) != '-' - IF nLen == 0 - cTok := '+' + cTok - ELSE - cTok := '+' + SubStr( cTok, 2 ) - ENDIF - lSign := .F. - ENDIF - nLen := 0 - cReturn += cTok - EXIT + CASE "u" + lUnsigned := .T. + nPos++ - CASE 'c' - CASE 's' - IF nLen == 0 - nLen := Len( hb_cStr( aPar[nPar] ) ) - ENDIF - cReturn += PadL( hb_cStr( aPar[nPar++] ), nLen ) - nLen := 0 - l0 := .F. - lSign := .F. - EXIT + CASE "d" + CASE "l" + CASE "f" + CASE "i" + xVal := aPar[nPar++] + IF !ISNUMBER( xVal ) + xVal := 0 + ENDIF + IF nLen != 0 + IF nLen - Int( nLen ) > 0.0 + nDec := Str( nLen ) + DO WHILE Right( nDec, 1 ) == "0" + nDec := Left( nDec, Len( nDec ) - 1 ) + END + nDec := Val( SubStr( nDec, At( ".", nDec ) + 1 ) ) + ELSE + nDec := 0 + ENDIF + cTok := Str( IIF( lUnsigned, Abs( xVal ), xVal ), nLen, nDec ) + ELSE + cTok := hb_NToS( IIF( lUnsigned, Abs( xVal ), xVal ) ) + ENDIF + IF l0 + IF "-" $ cTok .AND. !( Left( cTok, 1 ) == "-" ) + cTok := StrTran( cTok, "-", " " ) + cTok := "-" + SubStr( cTok, 2 ) + ENDIF + cTok := StrTran( cTok, " ", "0" ) + l0 := .F. + ENDIF + IF lSign .AND. !( Left( cTok, 1 ) == "-" ) + IF nLen == 0 + cTok := "+" + cTok + ELSE + cTok := "+" + SubStr( cTok, 2 ) + ENDIF + lSign := .F. + ENDIF + nLen := 0 + cReturn += cTok + EXIT - ENDSWITCH + CASE "c" + CASE "s" + IF nLen == 0 + nLen := Len( hb_cStr( aPar[nPar] ) ) + ENDIF + cReturn += PadL( hb_cStr( aPar[nPar++] ), nLen ) + nLen := 0 + l0 := .F. + lSign := .F. + EXIT + + ENDSWITCH ENDCASE cString := SubStr( cString, nPos + 1 ) ENDDO -RETURN cReturn + RETURN cReturn diff --git a/harbour/contrib/xhb/trpc.prg b/harbour/contrib/xhb/trpc.prg index 048b170329..b3c4d3e1bf 100644 --- a/harbour/contrib/xhb/trpc.prg +++ b/harbour/contrib/xhb/trpc.prg @@ -339,7 +339,7 @@ METHOD CheckTypes( aParams ) CLASS tRPCFunction FOR EACH oElem in ::aParameters i++ - IF ValType( aParams[i] ) != oElem[1] + IF !( ValType( aParams[ i ] ) == oElem[ 1 ] ) RETURN .F. ENDIF NEXT diff --git a/harbour/contrib/xhb/trpccli.prg b/harbour/contrib/xhb/trpccli.prg index 3b619c1f60..57fdc5b423 100644 --- a/harbour/contrib/xhb/trpccli.prg +++ b/harbour/contrib/xhb/trpccli.prg @@ -490,7 +490,7 @@ METHOD ManageChallenge() CLASS tRPCClient RETURN .F. ENDIF - IF cCode != "XHBR94" + IF !( cCode == "XHBR94" ) RETURN .F. ENDIF @@ -514,7 +514,7 @@ METHOD ManageChallenge() CLASS tRPCClient cCode := Space( 8 ) hb_inetRecvAll( ::skTCP, @cCode ) - IF hb_inetErrorCode( ::skTCP ) != 0 .or. cCode != "XHBR91OK" + IF hb_inetErrorCode( ::skTCP ) != 0 .OR. !( cCode == "XHBR91OK" ) RETURN .F. ENDIF /* SUCCESS! */ diff --git a/harbour/contrib/xhb/xhbmemo.prg b/harbour/contrib/xhb/xhbmemo.prg index e92d829062..8f4e9bb257 100644 --- a/harbour/contrib/xhb/xhbmemo.prg +++ b/harbour/contrib/xhb/xhbmemo.prg @@ -68,15 +68,15 @@ CREATE CLASS XHB_TMemoEditor FROM XHBEditor VAR aAsciiKeys VAR aConfigurableKeys VAR aMouseKeys - VAR aExtKeys // Extended keys. For HB_EXT_INKEY use only. + VAR aExtKeys // Extended keys. For HB_EXT_INKEY use only. - METHOD MemoInit( xUDF ) // This method is called after ::New() returns to perform ME_INIT actions - METHOD Edit() // Calls ::Super:Edit(nKey) but is needed to handle configurable keys - METHOD KeyboardHook( nKey ) // Gets called every time there is a key not handled directly by HBEditor + METHOD MemoInit( xUDF ) // This method is called after ::New() returns to perform ME_INIT actions + METHOD Edit() // Calls ::Super:Edit(nKey) but is needed to handle configurable keys + METHOD KeyboardHook( nKey ) // Gets called every time there is a key not handled directly by HBEditor - METHOD ExistUdf() INLINE HB_IsString( ::xUserFunction ) - METHOD HandleUdf( nKey, nUdfReturn, lEdited ) // Handles requests returned to MemoEdit() by udf - METHOD CallUdf( nMode ) // Call user function. ( old xDo ) + METHOD ExistUdf() INLINE HB_IsString( ::xUserFunction ) + METHOD HandleUdf( nKey, nUdfReturn, lEdited ) // Handles requests returned to MemoEdit() by udf + METHOD CallUdf( nMode ) // Call user function. ( old xDo ) ENDCLASS