2012-06-11 15:31 UTC+0200 Viktor Szakats (harbour syenar.net)

* include/harbour.hbx
  * src/vm/dynsym.c
    + added HB_ISFUNCTION( <cName> ) -> <lExists>
      uses Przemek's code from hbfship/ISFUNCTION() with minor
      adaptation for VM.
      Use it instead of __DYNSISFUN() and TYPE( <cName> ) == "UI".

  * include/harbour.hbx
    * formatted HB_IS*() functions used for type checking

  * contrib/hbfship/isfunc.c
    % converted ISFUNCTION() to wrapper for HB_ISFUNCTION()

  * contrib/hbide/ideplugins.prg
  * contrib/hbrun/hbrun.prg
  * contrib/hbxpp/xppop.prg
  * contrib/xhb/xhbcomp.prg
  * contrib/xhb/xhberr.prg
  * examples/hbdoc/hbdoc.prg
    % Using HB_ISFUNCTION() instead of __DYNSISFUN() and TYPE( <cName> ) == "UI"
This commit is contained in:
Viktor Szakats
2012-06-11 13:32:11 +00:00
parent 47e086d36c
commit 924db6f7ed
10 changed files with 77 additions and 45 deletions

View File

@@ -16,6 +16,28 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-06-11 15:31 UTC+0200 Viktor Szakats (harbour syenar.net)
* include/harbour.hbx
* src/vm/dynsym.c
+ added HB_ISFUNCTION( <cName> ) -> <lExists>
uses Przemek's code from hbfship/ISFUNCTION() with minor
adaptation for VM.
Use it instead of __DYNSISFUN() and TYPE( <cName> ) == "UI".
* include/harbour.hbx
* formatted HB_IS*() functions used for type checking
* contrib/hbfship/isfunc.c
% converted ISFUNCTION() to wrapper for HB_ISFUNCTION()
* contrib/hbide/ideplugins.prg
* contrib/hbrun/hbrun.prg
* contrib/hbxpp/xppop.prg
* contrib/xhb/xhbcomp.prg
* contrib/xhb/xhberr.prg
* examples/hbdoc/hbdoc.prg
% Using HB_ISFUNCTION() instead of __DYNSISFUN() and TYPE( <cName> ) == "UI"
2012-06-11 14:14 UTC+0200 Viktor Szakats (harbour syenar.net)
* bin/hbcommit.hb
+ To configure your own name and e-mail address used

View File

@@ -55,17 +55,9 @@
#include "hbapi.h"
HB_FUNC_EXTERN( HB_ISFUNCTION );
HB_FUNC( ISFUNCTION )
{
const char * szProc = hb_parc( 1 );
HB_BOOL fResult = HB_FALSE;
if( szProc )
{
PHB_DYNS pDynSym = hb_dynsymFindName( szProc );
if( pDynSym )
fResult = hb_dynsymIsFunction( pDynSym );
}
hb_retl( fResult );
HB_FUNC_EXEC( HB_ISFUNCTION );
}

View File

@@ -309,7 +309,7 @@ FUNCTION hbide_loadPersistentScripts()
FUNCTION hbide_execScriptFunction( cFunc, ... )
IF type( "script_" + cFunc + "()" ) == "UI"
IF hb_IsFunction( "script_" + cFunc )
RETURN eval( &( "{|...| " + "script_" + cFunc + "( ... )" + "}" ), ... )
ENDIF

View File

@@ -275,7 +275,7 @@ STATIC PROCEDURE hbrun_extensionlist_init( aDynamic )
STATIC s_lInit := .F.
IF ! s_lInit
IF Type( "__hbrun_extensions_static_init()" ) == "UI"
IF hb_IsFunction( "__hbrun_extensions_static_init" )
Do( "__hbrun_extensions_static_init" )
ENDIF
__hbrun_extensions_dynamic_init( aDynamic )

View File

@@ -58,7 +58,7 @@ ANNOUNCE XPP_OP_OVERLOAD
* It should not be used in user code. [druzus]
*/
#xcommand OPTIONAL INHERIT <!className!> => ;
IF Type( <"className">+"()" ) == "UI" ;;
IF hb_IsFunction( <"className"> ) ;;
AAdd( oClass:asSuper, @__<className>() ) ;;
ENDIF

View File

@@ -60,7 +60,7 @@ ANNOUNCE XHB_LIB
* It should not be used in user code. [druzus]
*/
#xcommand OPTIONAL INHERIT <!className!> => ;
IF Type( <"className">+"()" ) == "UI" ;;
IF hb_IsFunction( <"className"> ) ;;
AAdd( oClass:asSuper, @__<className>() ) ;;
ENDIF

View File

@@ -358,7 +358,7 @@ STATIC FUNCTION LogError( oerr )
FWriteLine( nHandle, "Multi Threading....: " + If( hb_mtvm(),"YES","NO" ) )
FWriteLine( nHandle, "VM Optimization....: " + strvalue( Hb_VmMode() ) )
IF __dynsIsFun( "Select" )
IF hb_IsFunction( "Select" )
FWriteLine( nHandle, "" )
FWriteLine( nHandle, "Current Area ......:" + strvalue( &("Select()") ) )
ENDIF
@@ -476,25 +476,25 @@ STATIC FUNCTION LogError( oerr )
FWriteLine( nHandle, "" )
HB_WAEval( {||
IF __dynsIsFun( "Select" )
IF hb_IsFunction( "Select" )
FWriteLine( nHandle, "Work Area No ......: " + strvalue( &("Select()") ) )
ENDIF
IF __dynsIsFun( "Alias" )
IF hb_IsFunction( "Alias" )
FWriteLine( nHandle, "Alias .............: " + &("Alias()") )
ENDIF
IF __dynsIsFun( "RecNo" )
IF hb_IsFunction( "RecNo" )
FWriteLine( nHandle, "Current Recno .....: " + strvalue( &("RecNo()") ) )
ENDIF
IF __dynsIsFun( "DbFilter" )
IF hb_IsFunction( "DbFilter" )
FWriteLine( nHandle, "Current Filter ....: " + &("DbFilter()") )
ENDIF
IF __dynsIsFun( "DbRelation" )
IF hb_IsFunction( "DbRelation" )
FWriteLine( nHandle, "Relation Exp. .....: " + &("DbRelation()") )
ENDIF
IF __dynsIsFun( "IndexOrd" )
IF hb_IsFunction( "IndexOrd" )
FWriteLine( nHandle, "Index Order .......: " + strvalue( &("IndexOrd(0)") ) )
ENDIF
IF __dynsIsFun( "IndexKey" )
IF hb_IsFunction( "IndexKey" )
FWriteLine( nHandle, "Active Key ........: " + strvalue( &("IndexKey(0)") ) )
ENDIF
FWriteLine( nHandle, "" )

View File

@@ -146,7 +146,7 @@ PROCEDURE Main( ... )
FOR idx := Len( p_hsSwitches[ "format-list" ] ) TO 1 STEP -1
IF p_hsSwitches[ "format-list" ][ idx ] == "all"
ELSEIF Type( "Generate" + p_hsSwitches[ "format-list" ][ idx ] + "()" ) != "UI"
ELSEIF hb_IsFunction( "Generate" + p_hsSwitches[ "format-list" ][ idx ] )
ASize( ADel( p_hsSwitches[ "format-list" ], idx), Len( p_hsSwitches[ "format-list" ] ) - 1 )
ENDIF
NEXT

View File

@@ -607,25 +607,26 @@ DYNAMIC hb_iniReadStr
DYNAMIC hb_iniSetComment
DYNAMIC hb_iniWrite
DYNAMIC hb_iniWriteStr
DYNAMIC hb_isArray
DYNAMIC hb_isBlock
DYNAMIC hb_isChar
DYNAMIC hb_isDate
DYNAMIC hb_isDateTime
DYNAMIC hb_isHash
DYNAMIC hb_isHashKey
DYNAMIC hb_isLogical
DYNAMIC hb_isMemo
DYNAMIC hb_isNil
DYNAMIC hb_isNull
DYNAMIC hb_isNumeric
DYNAMIC hb_isObject
DYNAMIC hb_isPointer
DYNAMIC hb_isPrinter
DYNAMIC hb_isRegex
DYNAMIC hb_isString
DYNAMIC hb_isSymbol
DYNAMIC hb_isTimeStamp
DYNAMIC HB_ISARRAY
DYNAMIC HB_ISBLOCK
DYNAMIC HB_ISCHAR
DYNAMIC HB_ISDATE
DYNAMIC HB_ISDATETIME
DYNAMIC hb_IsFunction
DYNAMIC HB_ISHASH
DYNAMIC HB_ISHASHKEY
DYNAMIC HB_ISLOGICAL
DYNAMIC HB_ISMEMO
DYNAMIC HB_ISNIL
DYNAMIC HB_ISNULL
DYNAMIC HB_ISNUMERIC
DYNAMIC HB_ISOBJECT
DYNAMIC HB_ISPOINTER
DYNAMIC hb_IsPrinter
DYNAMIC hb_IsRegex
DYNAMIC HB_ISSTRING
DYNAMIC HB_ISSYMBOL
DYNAMIC HB_ISTIMESTAMP
DYNAMIC hb_jsonDecode
DYNAMIC hb_jsonEncode
DYNAMIC hb_keyChar

View File

@@ -695,8 +695,25 @@ HB_FUNC( __DYNSGETINDEX ) /* Gimme index number of symbol: dsIndex = __dynsymGet
hb_retnint( uiPos );
}
HB_FUNC( __DYNSISFUN ) /* returns .t. if a symbol has a function/procedure pointer,
given its symbol index */
HB_FUNC( HB_ISFUNCTION ) /* returns .T. if a symbol has a function/procedure pointer,
given its name */
{
HB_STACK_TLS_PRELOAD
const char * szProc = hb_parc( 1 );
HB_BOOL fResult = HB_FALSE;
if( szProc )
{
PHB_DYNS pDynSym = hb_dynsymFindName( szProc );
if( pDynSym )
fResult = hb_dynsymIsFunction( pDynSym );
}
hb_retl( fResult );
}
HB_FUNC( __DYNSISFUN ) /* returns .T. if a symbol has a function/procedure pointer,
given its symbol index or name */
{
HB_STACK_TLS_PRELOAD
const char * szName = hb_parc( 1 );