From c4957bf8549ef54f65b7f697ab966d32abca2acd Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 26 Nov 2012 17:54:13 +0000 Subject: [PATCH] 2012-11-26 18:51 UTC+0100 Viktor Szakats (harbour syenar.net) * contrib/hbhttpd/widgets.prg * contrib/hbtip/client.prg + support function pointers where codeblocks are accepted * contrib/hbnf/ontick.prg + FT_ONIDLE(): support Harbour function pointers as Harbour extension * contrib/xhb/xhberr.prg % Use DO() instead of EVAL( __DYNSN2SYM() ) thus avoiding internal core functions. --- harbour/ChangeLog | 12 ++++++++++++ harbour/contrib/hbhttpd/widgets.prg | 2 +- harbour/contrib/hbnf/ontick.prg | 3 ++- harbour/contrib/hbtip/client.prg | 27 ++++++++++++++------------- harbour/contrib/xhb/xhberr.prg | 12 ++++++------ 5 files changed, 35 insertions(+), 21 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 7416d58470..ea4b5cd1d7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -10,6 +10,18 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2012-11-26 18:51 UTC+0100 Viktor Szakats (harbour syenar.net) + * contrib/hbhttpd/widgets.prg + * contrib/hbtip/client.prg + + support function pointers where codeblocks are accepted + + * contrib/hbnf/ontick.prg + + FT_ONIDLE(): support Harbour function pointers as Harbour extension + + * contrib/xhb/xhberr.prg + % Use DO() instead of EVAL( __DYNSN2SYM() ) thus avoiding + internal core functions. + 2012-11-26 15:25 UTC+0100 Viktor Szakats (harbour syenar.net) * src/rtl/dbedit.prg + also accept function pointers as user functions diff --git a/harbour/contrib/hbhttpd/widgets.prg b/harbour/contrib/hbhttpd/widgets.prg index e7d08780a6..7198fedb14 100644 --- a/harbour/contrib/hbhttpd/widgets.prg +++ b/harbour/contrib/hbhttpd/widgets.prg @@ -382,7 +382,7 @@ METHOD Output() CLASS UWBrowse xField := Self:aColumns[ nI, 3 ] IF HB_ISSTRING( xField ) xI := FieldGet( FieldPos( xField ) ) - ELSEIF HB_ISBLOCK( xField ) + ELSEIF HB_ISEVALITEM( xField ) xI := Eval( xField ) ENDIF SWITCH ValType( xI ) diff --git a/harbour/contrib/hbnf/ontick.prg b/harbour/contrib/hbnf/ontick.prg index ac4c1a2659..c7c4d6692d 100644 --- a/harbour/contrib/hbnf/ontick.prg +++ b/harbour/contrib/hbnf/ontick.prg @@ -66,7 +66,8 @@ STATIC PROCEDURE __ft_OnTick() PROCEDURE ft_OnTick( bOnTick, nTickInterval ) - IF HB_ISBLOCK( bOnTick ) + /* Harbour extension: Harbour will also accept function pointers */ + IF HB_ISEVALITEM( bOnTick ) t_bOnTick := bOnTick IF HB_ISNUMERIC( nTickInterval ) t_nTickInterval := ( 1 / 18.20648 ) * nTickInterval * 1000 diff --git a/harbour/contrib/hbtip/client.prg b/harbour/contrib/hbtip/client.prg index db95864acb..907f685405 100644 --- a/harbour/contrib/hbtip/client.prg +++ b/harbour/contrib/hbtip/client.prg @@ -194,7 +194,7 @@ METHOD New( oUrl, xTrace, oCredentials ) CLASS TIPClient ( HB_ISLOGICAL( xTrace ) .AND. xTrace ) oLog := TIPLog():New( iif( HB_ISSTRING( xTrace ), xTrace, NIL ) ) ::bTrace := {| cMsg | iif( PCount() > 0, oLog:Add( cMsg ), oLog:Close() ) } - ELSEIF HB_ISBLOCK( xTrace ) + ELSEIF HB_ISEVALITEM( xTrace ) ::bTrace := xTrace ENDIF @@ -382,7 +382,7 @@ METHOD Close() CLASS TIPClient ::isOpen := .F. ENDIF - IF HB_ISBLOCK( ::bTrace ) + IF HB_ISEVALITEM( ::bTrace ) /* Call with no parameter to signal end of logging session */ Eval( ::bTrace ) ENDIF @@ -560,9 +560,9 @@ METHOD WriteFromFile( cFile ) CLASS TIPClient RETURN .T. -/* -HZ: METHOD :getOk() is not declared in TIPClient +#if 0 +/* HZ: METHOD :getOk() is not declared in TIPClient */ METHOD Data( cData ) CLASS TIPClient ::InetSendall( ::SocketCon, "DATA" + ::cCRLF ) IF ! ::GetOk() @@ -570,7 +570,8 @@ METHOD Data( cData ) CLASS TIPClient ENDIF ::InetSendall(::SocketCon, cData + ::cCRLF + "." + ::cCRLF ) RETURN ::GetOk() -*/ + +#endif METHOD Write( cData, nLen, bCommit ) CLASS TIPClient @@ -610,7 +611,7 @@ METHOD inetSendAll( SocketCon, cData, nLen ) CLASS TIPClient nRet := hb_inetSendAll( SocketCon, cData, nLen ) ENDIF - IF HB_ISBLOCK( ::bTrace ) + IF HB_ISEVALITEM( ::bTrace ) ::Log( SocketCon, nlen, cData, nRet ) ENDIF @@ -620,7 +621,7 @@ METHOD inetCount( SocketCon ) CLASS TIPClient LOCAL nRet := hb_inetCount( SocketCon ) - IF HB_ISBLOCK( ::bTrace ) + IF HB_ISEVALITEM( ::bTrace ) ::Log( SocketCon, nRet ) ENDIF @@ -644,7 +645,7 @@ METHOD inetRecv( SocketCon, cStr1, len ) CLASS TIPClient nRet := hb_inetRecv( SocketCon, @cStr1, len ) ENDIF - IF HB_ISBLOCK( ::bTrace ) + IF HB_ISEVALITEM( ::bTrace ) ::Log( SocketCon, "", len, iif( nRet >= 0, cStr1, nRet ) ) ENDIF @@ -672,7 +673,7 @@ METHOD inetRecvLine( SocketCon, nRet, size ) CLASS TIPClient cRet := hb_inetRecvLine( SocketCon, @nRet, size ) ENDIF - IF HB_ISBLOCK( ::bTrace ) + IF HB_ISEVALITEM( ::bTrace ) ::Log( SocketCon, "", size, cRet ) ENDIF @@ -700,7 +701,7 @@ METHOD inetRecvAll( SocketCon, cRet, size ) CLASS TIPClient nRet := hb_inetRecvAll( SocketCon, @cRet, size ) ENDIF - IF HB_ISBLOCK( ::bTrace ) + IF HB_ISEVALITEM( ::bTrace ) ::Log( SocketCon, "", size, iif( nRet >= 0, cRet, nRet ) ) ENDIF @@ -722,7 +723,7 @@ METHOD inetErrorCode( SocketCon ) CLASS TIPClient ::nLastError := nRet - IF HB_ISBLOCK( ::bTrace ) + IF HB_ISEVALITEM( ::bTrace ) ::Log( SocketCon, nRet ) ENDIF @@ -768,7 +769,7 @@ METHOD inetConnect( cServer, nPort, SocketCon ) CLASS TIPClient /* TODO: Add error handling */ ENDIF - IF HB_ISBLOCK( ::bTrace ) + IF HB_ISEVALITEM( ::bTrace ) ::Log( cServer, nPort, SocketCon ) ENDIF @@ -812,7 +813,7 @@ METHOD Log( ... ) CLASS TIPClient LOCAL xVar LOCAL cMsg - IF HB_ISBLOCK( ::bTrace ) + IF HB_ISEVALITEM( ::bTrace ) cMsg := DToS( Date() ) + "-" + Time() + Space( 2 ) + ; SubStr( ProcName( 1 ), RAt( ":", ProcName( 1 ) ) ) + ; diff --git a/harbour/contrib/xhb/xhberr.prg b/harbour/contrib/xhb/xhberr.prg index b25446b2dd..f1a9de52df 100644 --- a/harbour/contrib/xhb/xhberr.prg +++ b/harbour/contrib/xhb/xhberr.prg @@ -481,22 +481,22 @@ STATIC FUNCTION LogError( oerr ) hb_WAEval( {|| IF hb_IsFunction( "Select" ) - FWriteLine( nHandle, "Work Area No ......: " + strvalue( Eval( __dynsN2Sym( "Select" ) ) ) ) + FWriteLine( nHandle, "Work Area No ......: " + strvalue( Do( "Select" ) ) ) ENDIF IF hb_IsFunction( "Alias" ) - FWriteLine( nHandle, "Alias .............: " + Eval( __dynsN2Sym( "Alias" ) ) ) + FWriteLine( nHandle, "Alias .............: " + Do( "Alias" ) ) ENDIF IF hb_IsFunction( "RecNo" ) - FWriteLine( nHandle, "Current Recno .....: " + strvalue( Eval( __dynsN2Sym( "RecNo" ) ) ) ) + FWriteLine( nHandle, "Current Recno .....: " + strvalue( Do( "RecNo" ) ) ) ENDIF IF hb_IsFunction( "dbFilter" ) - FWriteLine( nHandle, "Current Filter ....: " + Eval( __dynsN2Sym( "dbFilter" ) ) ) + FWriteLine( nHandle, "Current Filter ....: " + Do( "dbFilter" ) ) ENDIF IF hb_IsFunction( "dbRelation" ) - FWriteLine( nHandle, "Relation Exp. .....: " + Eval( __dynsN2Sym( "dbRelation" ) ) ) + FWriteLine( nHandle, "Relation Exp. .....: " + Do( "dbRelation" ) ) ENDIF IF hb_IsFunction( "IndexOrd" ) - FWriteLine( nHandle, "Index Order .......: " + strvalue( Eval( __dynsN2Sym( "IndexOrd" ) ) ) ) + FWriteLine( nHandle, "Index Order .......: " + strvalue( Do( "IndexOrd" ) ) ) ENDIF IF hb_IsFunction( "IndexKey" ) FWriteLine( nHandle, "Active Key ........: " + strvalue( Eval( hb_macroBlock( "IndexKey( 0 )" ) ) ) )