2012-01-10 14:38 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* harbour/include/hbhrb.ch
  * harbour/src/vm/runner.c
    * disabled access to INIT and EXIT functions in
      HB_HRBGETFUNSYM() and HB_HRBGETFUNLIST()
    + added 2-nd parameter <nType> to HB_HRBGETFUNLIST()
         HB_HRBGETFUNLIST( <pHRB> [, <nType>] ) -> <aFuncList>
      <nType> is defined in hbhrb.ch:
         HB_HRB_FUNC_PUBLIC - locally defined public functions
         HB_HRB_FUNC_STATIC - locally defined static functions
         HB_HRB_FUNC_LOCAL  - locally defined functions
         HB_HRB_FUNC_EXTERN - external functions used in HRB module
This commit is contained in:
Przemyslaw Czerpak
2012-01-10 13:38:50 +00:00
parent b61a3a5b20
commit d8aa9b52c3
3 changed files with 39 additions and 3 deletions

View File

@@ -16,6 +16,19 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-01-10 14:38 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* harbour/include/hbhrb.ch
* harbour/src/vm/runner.c
* disabled access to INIT and EXIT functions in
HB_HRBGETFUNSYM() and HB_HRBGETFUNLIST()
+ added 2-nd parameter <nType> to HB_HRBGETFUNLIST()
HB_HRBGETFUNLIST( <pHRB> [, <nType>] ) -> <aFuncList>
<nType> is defined in hbhrb.ch:
HB_HRB_FUNC_PUBLIC - locally defined public functions
HB_HRB_FUNC_STATIC - locally defined static functions
HB_HRB_FUNC_LOCAL - locally defined functions
HB_HRB_FUNC_EXTERN - external functions used in HRB module
2012-01-09 22:20 UTC+0100 Viktor Szakats (harbour syenar.net)
* contrib/hbtip/sendmail.prg
* contrib/hbtip/smtpcli.prg

View File

@@ -77,4 +77,11 @@
with unresolved or cross function
references */
#define HB_HRB_FUNC_PUBLIC 0x1 /* locally defined public functions */
#define HB_HRB_FUNC_STATIC 0x2 /* locally defined static functions */
#define HB_HRB_FUNC_LOCAL 0x3 /* locally defined functions */
#define HB_HRB_FUNC_EXTERN 0x4 /* external functions used in HRB module */
#endif /* HB_HRB_CH_ */

View File

@@ -857,7 +857,9 @@ HB_FUNC( HB_HRBGETFUNSYM )
for( nPos = 0, pSym = pHrbBody->pSymRead; nPos < pHrbBody->ulSymbols; ++pSym, ++nPos )
{
if( pSym->value.pFunPtr != NULL && hb_stricmp( szName, pSym->szName ) == 0 )
if( pSym->value.pFunPtr != NULL &&
( pSym->scope.value & HB_FS_INITEXIT ) == 0 &&
hb_stricmp( szName, pSym->szName ) == 0 )
{
hb_itemPutSymbol( hb_stackReturnItem(), pSym );
break;
@@ -878,11 +880,25 @@ HB_FUNC( HB_HRBGETFUNLIST )
HB_ULONG nPos;
PHB_ITEM paList = hb_itemArrayNew( 0 );
PHB_ITEM pFuncName = hb_itemNew( NULL );
int iType = hb_parni( 2 );
for( nPos = 0, pSym = pHrbBody->pSymRead; nPos < pHrbBody->ulSymbols; ++pSym, ++nPos )
{
if( pSym->value.pFunPtr != NULL )
hb_arrayAdd( paList, hb_itemPutC( pFuncName, pSym->szName ) );
if( pSym->value.pFunPtr != NULL &&
( pSym->scope.value & HB_FS_INITEXIT ) == 0 )
{
if( iType == 0 ||
( ( iType & HB_HRB_FUNC_EXTERN ) &&
( pSym->scope.value & HB_FS_LOCAL ) == 0 ) ||
( ( pSym->scope.value & HB_FS_LOCAL ) &&
( ( ( iType & HB_HRB_FUNC_STATIC ) &&
( pSym->scope.value & HB_FS_STATIC ) ) ||
( ( iType & HB_HRB_FUNC_PUBLIC ) &&
( pSym->scope.value & HB_FS_STATIC ) == 0 ) ) ) )
{
hb_arrayAdd( paList, hb_itemPutC( pFuncName, pSym->szName ) );
}
}
}
hb_itemRelease( pFuncName );