diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 58028add69..4cb462f85e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,21 @@ The license applies to all entries newer than 2009-04-28. */ +2012-10-11 15:07 UTC+0200 Viktor Szakats (harbour syenar.net) + * contrib/hbamf/readme.txt + * contrib/hbcairo/tests/table.prg + * contrib/hbpgsql/tests/cache.prg + * contrib/hbwin/tests/testprn3.prg + * contrib/hbxpp/tthreadx.prg + * contrib/xhb/txml.prg + * contrib/xhb/xhbtedit.prg + * src/rtl/hbi18n2.prg + * ValType() related optimizations + + * contrib/hbwin/tests/testsim.prg + * contrib/hbct/tests/datetime.prg + * formatting + 2012-10-11 14:38 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbfbird/tests/stress.prg * minor diff --git a/harbour/contrib/hbamf/readme.txt b/harbour/contrib/hbamf/readme.txt index 41a3d1567f..2203fc904f 100644 --- a/harbour/contrib/hbamf/readme.txt +++ b/harbour/contrib/hbamf/readme.txt @@ -53,7 +53,7 @@ Short description of Harbour functions STATIC FUNCTION ConvOut( xVal, pOuterContext ) LOCAL lClose - IF ValType( xVal ) = "O" + IF HB_ISOBJECT( xVal ) IF xVal:className == "WORKAREAEXPORT" lClose := xVal:lCloseWA SELECT ( xVal:nWorkArea ) diff --git a/harbour/contrib/hbcairo/tests/table.prg b/harbour/contrib/hbcairo/tests/table.prg index 8dc3a66038..f516587c80 100644 --- a/harbour/contrib/hbcairo/tests/table.prg +++ b/harbour/contrib/hbcairo/tests/table.prg @@ -83,16 +83,20 @@ STATIC PROC draw_table( hCairo, nX, nY, aCol ) nDX := nX FOR nI := 1 TO LEN( aCol ) xValue := FIELDGET( FIELDPOS( aCol[ nI, 2 ] ) ) - IF VALTYPE( xValue ) == "C" + SWITCH VALTYPE( xValue ) + CASE "C" cairo_move_to( hCairo, nDX + 10, nY + 10 ) cairo_show_text( hCairo, xValue ) - ELSEIF VALTYPE( xValue ) == "N" + EXIT + CASE "N" cairo_move_to( hCairo, nDX + aWidth[ nI ] - 10, nY + 10 ) show_text_right( hCairo, STR( xValue ) ) - ELSEIF VALTYPE( xValue ) == "D" + EXIT + CASE "D" cairo_move_to( hCairo, nDX + 10, nY + 10 ) show_text_right( hCairo, DTOC( xValue ) ) - ENDIF + EXIT + ENDSWITCH nDX += aWidth[ nI ] IF nI < LEN( aCol ) cairo_move_to( hCairo, nDX, nY ) diff --git a/harbour/contrib/hbct/tests/datetime.prg b/harbour/contrib/hbct/tests/datetime.prg index 65c57ebb86..a8754e40a1 100644 --- a/harbour/contrib/hbct/tests/datetime.prg +++ b/harbour/contrib/hbct/tests/datetime.prg @@ -97,7 +97,7 @@ PROCEDURE Main() cScr := SaveScreen( 4, 5, 21, 66 ) @ 4, 5 TO 21, 66 - nchoice := AChoice( 5, 7, 20, 65, farr ) //, ,1) + nchoice := AChoice( 5, 7, 20, 65, farr ) //, ,1) IF Empty( nchoice ) RETURN @@ -373,7 +373,7 @@ FUNCTION ctodowtest() IF nKey == K_ESC c := .F. ELSE - @ 11, 10 SAY "The day number is " + Str( ctodow( Upper(AllTrim(cDow ) ) ) ) + @ 11, 10 SAY "The day number is " + Str( ctodow( Upper( AllTrim( cDow ) ) ) ) SET CURSOR OFF Inkey( 0 ) @@ -1026,7 +1026,7 @@ FUNCTION ntocdowtest() ELSE @ 11, 10 SAY "The day selected is " + ; - PadR( ntocdow( Val(cDay ) ), 10 ) + PadR( ntocdow( Val( cDay ) ), 10 ) SET CURSOR OFF Inkey( 0 ) @@ -1076,7 +1076,7 @@ FUNCTION ntocmthtest() ELSE @ 11, 10 SAY "The month selected is " + ; - PadR( ntocmonth( Val(cMonth ) ), 10 ) + PadR( ntocmonth( Val( cMonth ) ), 10 ) SET CURSOR OFF Inkey( 0 ) @@ -1202,7 +1202,7 @@ FUNCTION chkansi( cAnsidate ) LOCAL nDay LOCAL lretval := .T. - nYear := Val( Left( cAnsidate, 4 ) ) + nYear := Val( Left( cAnsidate, 4 ) ) nMonth := Val( SubStr( cAnsidate, 5, 2 ) ) nDay := Val( Right( cAnsidate, 2 ) ) @@ -1257,7 +1257,7 @@ FUNCTION weektest() ELSE @ 8, 10 SAY "The week number is " + ; - PadR( LTrim( Str(week( ddate, cMode == "Y" ) ) ), 10 ) + PadR( LTrim( Str( week( ddate, cMode == "Y" ) ) ), 10 ) SET CURSOR OFF Inkey( 0 ) diff --git a/harbour/contrib/hbpgsql/tests/cache.prg b/harbour/contrib/hbpgsql/tests/cache.prg index 4f98e57684..aa15af64a9 100644 --- a/harbour/contrib/hbpgsql/tests/cache.prg +++ b/harbour/contrib/hbpgsql/tests/cache.prg @@ -429,7 +429,7 @@ FUNCTION SQLPrepare( cQuery, ... ) ELSEIF ValType( x ) == "L" x := iif( x, "'t'", "'f'" ) - ELSEIF ValType( x ) == "C" .OR. ValType( x ) == "M" + ELSEIF ValType( x ) $ "CM" x := SToQ( RTrim( x ) ) ELSE diff --git a/harbour/contrib/hbwin/tests/testprn3.prg b/harbour/contrib/hbwin/tests/testprn3.prg index c6397be834..840fada026 100644 --- a/harbour/contrib/hbwin/tests/testprn3.prg +++ b/harbour/contrib/hbwin/tests/testprn3.prg @@ -30,7 +30,7 @@ STATIC PROCEDURE Dump( a ) ? "==================" FOR EACH b IN a ? - IF ValType( b ) == "A" + IF HB_ISARRAY( b ) FOR EACH c IN b ?? c:__enumIndex(), c IF c:__enumIndex() == 2 diff --git a/harbour/contrib/hbwin/tests/testsim.prg b/harbour/contrib/hbwin/tests/testsim.prg index 9b9bca71b9..e2e5b47e94 100644 --- a/harbour/contrib/hbwin/tests/testsim.prg +++ b/harbour/contrib/hbwin/tests/testsim.prg @@ -26,47 +26,47 @@ PROCEDURE Main() l := o:lInitialize() IF l - Alert("Api Sim initialized!!"+STR( o:nLastError)) - Else - Alert("Api Sim NOT initialized!!. Error "+STR(o:nLastError)) + Alert( "Api Sim initialized!!" + Str( o:nLastError ) ) + ELSE + Alert( "Api Sim NOT initialized!!. Error " + Str( o:nLastError ) ) ENDIF -/* - IF o:lNumberOfPhoneBookEntries(SIM_PBSTORAGE_SIM, @nTotal, @nUsed ) - Alert("Total Entries: "+STR(nTotal)+" ---- Used Entries: "+STR(nUsed)) +#if 0 + IF o:lNumberOfPhoneBookEntries( SIM_PBSTORAGE_SIM, @nTotal, @nUsed ) + Alert( "Total Entries: " + Str( nTotal ) + " ---- Used Entries: " + Str( nUsed ) ) ELSE - Alert("Error "+STR(o:nLastError)+" phone book entries") + Alert( "Error " + Str( o:nLastError ) + " phone book entries" ) ENDIF a := o:aGetAllPhoneBookEntries() - Aeval(a, {| n, m | Alert("Phone: "+n[1]+hb_eol()+"Name: "+n[2]+hb_eol()+"Adr. Type: "+STR( n[3])+hb_eol()+"Plan Type: "+STR( n[4])) }) -*/ + AEval( a, {| n, m | Alert( "Phone: " + n[ 1 ] + hb_eol() + "Name: " + n[ 2 ] + hb_eol() + "Adr. Type: " + Str( n[ 3 ] ) + hb_eol() + "Plan Type: " + Str( n[ 4 ] ) ) } ) +#endif IF !o:lGetSimPhoneEntry( 1, SIM_PBSTORAGE_SIM, @a ) - Alert("Pos 1 error") + Alert( "Pos 1 error" ) ELSE - Alert("VALTYPE-> "+VALTYPE(a)+" LEN -> "+STR(LEN(a)),a[1][1]) - Aeval(a, {| n, m | Alert("Phone: "+n[1]+hb_eol()+"Name: "+n[2]+hb_eol()+"Adr. Type: "+STR( n[3])+hb_eol()+"Plan Type: "+STR( n[4]),"pos 1") }) + Alert( "VALTYPE-> " + ValType( a ) + " LEN -> " + Str( Len(a ) ), a[ 1 ][ 1 ] ) + AEval( a, {| n, m | Alert( "Phone: " + n[ 1 ] + hb_eol() + "Name: " + n[ 2 ] + hb_eol() + "Adr. Type: " + Str( n[ 3 ] ) + hb_eol() + "Plan Type: " + Str( n[ 4 ] ),"pos 1" ) } ) ENDIF IF !o:lGetSimPhoneEntry( 110, SIM_PBSTORAGE_SIM, @a ) - Alert("Pos 123 error") + Alert( "Pos 123 error" ) ELSE - Aeval(a, {| n, m | Alert("Phone: "+n[1]+hb_eol()+"Name: "+n[2]+hb_eol()+"Adr. Type: "+STR( n[3])+hb_eol()+"Plan Type: "+STR( n[4]),"pos 110") }) + AEval( a, {| n, m | Alert( "Phone: " + n[ 1 ] + hb_eol() + "Name: " + n[ 2 ] + hb_eol() + "Adr. Type: " + Str( n[ 3 ] ) + hb_eol() + "Plan Type: " + Str( n[ 4 ] ),"pos 110" ) } ) ENDIF IF !o:lSetSimPhoneEntry( 80, SIM_PBSTORAGE_SIM, "660099696", "pepeluis", SIM_NUMPLAN_UNKNOWN, SIM_ADDRTYPE_NATIONAL ) - Alert("Error writing pos 80 Errpr=>"+STR(o:nLastError)) + Alert( "Error writing pos 80 Errpr=>" + Str( o:nLastError ) ) ENDIF IF !o:lDelSimPhoneEntry( 80, SIM_PBSTORAGE_SIM ) - Alert("Error deletein pos 80 Errpr=>"+STR(o:nLastError)) + Alert( "Error deletein pos 80 Errpr=>" + Str( o:nLastError ) ) ENDIF l := o:lDeInitialize() IF !l - Alert("Not De-Initialized SIM api. Error :"+STR(o:nLastError)) + Alert( "Not De-Initialized SIM api. Error :" + Str( o:nLastError ) ) ELSE - Alert("Api Sim Deinitialized!!!") + Alert( "Api Sim Deinitialized!!!" ) ENDIF o:End() diff --git a/harbour/contrib/hbxpp/tthreadx.prg b/harbour/contrib/hbxpp/tthreadx.prg index 3019b65caa..1e37fc9cef 100644 --- a/harbour/contrib/hbxpp/tthreadx.prg +++ b/harbour/contrib/hbxpp/tthreadx.prg @@ -225,7 +225,7 @@ METHOD start( xAction, ... ) CLASS THREAD ENDIF ::atStart( ... ) - IF ValType( ::_atStart ) == "B" + IF HB_ISBLOCK( ::_atStart ) EVAL( ::_atStart, ... ) ENDIF @@ -264,7 +264,7 @@ METHOD start( xAction, ... ) CLASS THREAD ENDDO ::atEnd( ... ) - IF ValType( ::_atEnd ) == "B" + IF HB_ISBLOCK( ::_atEnd ) EVAL( ::_atEnd, ... ) ENDIF ::active := .F. diff --git a/harbour/contrib/xhb/txml.prg b/harbour/contrib/xhb/txml.prg index 41e623a5d5..33ce4c0666 100644 --- a/harbour/contrib/xhb/txml.prg +++ b/harbour/contrib/xhb/txml.prg @@ -415,7 +415,7 @@ METHOD Write( fHandle, nStyle ) CLASS TXmlDocument LOCAL nResult := HBXML_STATUS_ERROR - IF ValType( fHandle ) == "C" // It's a filename! + IF HB_ISSTRING( fHandle ) // It's a filename! fHandle := FCreate( fHandle ) IF fHandle != F_ERROR IF Empty( ::oRoot:oChild ) .OR. !( ::oRoot:oChild:cName == "xml" ) diff --git a/harbour/contrib/xhb/xhbtedit.prg b/harbour/contrib/xhb/xhbtedit.prg index 29de5f210d..345f381cb2 100644 --- a/harbour/contrib/xhb/xhbtedit.prg +++ b/harbour/contrib/xhb/xhbtedit.prg @@ -1743,7 +1743,7 @@ METHOD K_Esc() CLASS XHBEditor nCurRow := ::Row() cScreenMsg := SaveScreen( 0, 60, 0, 77 ) nCursor := SetCursor( SC_NORMAL ) - @ 0, 60 SAY '(Abort Edit? Y/N)' + @ 0, 60 SAY "(Abort Edit? Y/N)" nKey := Inkey( 0 ) Inkey() RestScreen( 0, 60, 0, 77, cScreenMsg ) @@ -2075,7 +2075,7 @@ STATIC FUNCTION GetParagraph( oSelf, nRow ) LOCAL cLine := "" // V@ - DO WHILE nRow <= oSelf:LastRow() .AND. ValType( oSelf:aText[ nRow ]:lSoftCR ) == 'L' .AND. oSelf:aText[ nRow ]:lSoftCR + DO WHILE nRow <= oSelf:LastRow() .AND. HB_ISLOGICAL( oSelf:aText[ nRow ]:lSoftCR ) .AND. oSelf:aText[ nRow ]:lSoftCR cLine += oSelf:aText[ nRow ]:cText oSelf:RemoveLine( nRow ) IF oSelf:LastRow() <= 0 // V@ diff --git a/harbour/src/rtl/hbi18n2.prg b/harbour/src/rtl/hbi18n2.prg index 8e883acf76..75db0096d4 100644 --- a/harbour/src/rtl/hbi18n2.prg +++ b/harbour/src/rtl/hbi18n2.prg @@ -573,7 +573,7 @@ FUNCTION HB_I18N_SAVEPOT( cFile, pI18N, cErrorMsg ) cPOT += "msgid " cPOT += __I18N_strEncode( trans:__enumKey() ) cPOT += cEol - IF valtype( trans ) == "A" + IF HB_ISARRAY( trans ) FOR EACH msgstr IN trans cPOT += "msgstr[" cPOT += hb_nToS( msgstr:__enumIndex() - 1 )