2004-09-08 16:40 UTC+0100 Ryszard Glab <rglab@imid.med.pl>

* include/hbapi.h
   * source/vm/dynsym.c
      * a new function 'hb_dynsymScope' was added to check if the
      passed symbol has requested scope

   * source/vm/macro.c
   * source/vm/hvm.c
      * fixed support for static functions used in macro compiled
      expressions (the runtime error is generated during evaluation
      instead of macro compilation - like in Clipper)

   * source/pp/ppcore.c
      * fixed support for '&macro.' in complex expressions
This commit is contained in:
Ryszard Glab
2004-09-08 14:32:51 +00:00
parent 83183d2cd3
commit ec407c3d59
6 changed files with 45 additions and 21 deletions

View File

@@ -8,6 +8,22 @@
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2004-09-08 16:40 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
* include/hbapi.h
* source/vm/dynsym.c
* a new function 'hb_dynsymScope' was added to check if the
passed symbol has requested scope
* source/vm/macro.c
* source/vm/hvm.c
* fixed support for static functions used in macro compiled
expressions (the runtime error is generated during evaluation
instead of macro compilation - like in Clipper)
* source/pp/ppcore.c
* fixed support for '&macro.' in complex expressions
2004-09-07 10:30 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
* source/pp/ppcore.c
* fixed support for Clipper undocumented <x:&> match marker,

View File

@@ -465,6 +465,7 @@ extern PHB_DYNS hb_dynsymFindName( char * szName ); /* converts to uppercase and
extern void hb_dynsymLog( void ); /* displays all dynamic symbols */
extern void hb_dynsymRelease( void ); /* releases the memory of the dynamic symbol table */
extern void hb_dynsymEval( PHB_DYNS_FUNC pFunction, void * Cargo ); /* enumerates all dynamic symbols */
extern BOOL hb_dynsymScope( PHB_DYNS pSym, HB_SYMBOLSCOPE scope ); /* check if given symbol has a required scope */
/* Command line and environment argument management */
extern void HB_EXPORT hb_cmdargInit( int argc, char * argv[] ); /* initialize command line argument API's */

View File

@@ -2515,6 +2515,11 @@ static int getExpReal( char * expreal, char ** ptri, BOOL prlist, int maxrez, BO
{
State = STATE_ID_END;
}
else if( **ptri == '&' )
{
State = STATE_ID;
continue;
}
else
{
State = STATE_EXPRES;

View File

@@ -200,6 +200,16 @@ PHB_DYNS HB_EXPORT hb_dynsymGet( char * szName ) /* finds and creates a symbol
return pDynSym;
}
BOOL hb_dynsymScope( PHB_DYNS pSym, HB_SYMBOLSCOPE scope )
{
if( pSym->pSymbol->cScope != SYM_ALLOCATED )
{
return pSym->pSymbol->cScope & scope;
}
return FALSE;
}
PHB_DYNS HB_EXPORT hb_dynsymFindName( char * szName ) /* finds a symbol */
{
char szUprName[ HB_SYMBOL_NAME_LEN + 1 ];

View File

@@ -1643,7 +1643,7 @@ void HB_EXPORT hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols )
case HB_P_MPUSHSYM:
{
HB_DYNS_PTR * pDynSym = ( HB_DYNS_PTR * ) ( pCode + w + 1 );
hb_vmPushSymbol( ( *pDynSym )->pSymbol );
hb_vmPushMacroSymbol( ( *pDynSym )->pSymbol );
w += sizeof( HB_DYNS_PTR ) + 1;
break;
}
@@ -3408,11 +3408,9 @@ void HB_EXPORT hb_vmDo( USHORT uiParams )
{
/* static functions are not allowed in macro
*/
HB_ITEM_PTR pError = hb_errRT_New( ES_ERROR, NULL, EG_NOFUNC, 1001,
NULL, pSym->szName,
0, EF_NONE );
hb_errLaunch( pError );
hb_errRelease( pError );
PHB_ITEM pArgsArray = hb_arrayFromStack( uiParams );
hb_errRT_BASE_SubstR( EG_NOFUNC, 1001, NULL, pSym->szName, 1, pArgsArray );
hb_itemRelease( pArgsArray );
}
else
{

View File

@@ -1219,25 +1219,19 @@ void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias, HB_
* NULL value for pSym
*/
}
else if( bFunction )
{
if( pSym && hb_dynsymScope(pSym, HB_FS_STATIC) )
{
/* static functions are not allowed in macro */
HB_MACRO_DATA->status |= HB_MACRO_UNKN_SYM;
HB_MACRO_DATA->status &= ~HB_MACRO_CONT; /* don't run this pcode */
}
}
}
else
pSym = hb_dynsymGet( szSymbolName );
if( bFunction )
{
if( pSym && ((pSym->pSymbol->value.pFunPtr == NULL) || (pSym->pSymbol->cScope & HB_FS_STATIC)) )
{
/* static functions are not allowed in macro */
HB_MACRO_DATA->status |= HB_MACRO_UNKN_SYM;
HB_MACRO_DATA->status &= ~HB_MACRO_CONT; /* don't run this pcode */
if( !(HB_MACRO_DATA->Flags & HB_MACRO_GEN_TYPE) )
{
HB_MACRO_DATA->pError = hb_errRT_New( ES_ERROR, NULL, EG_NOFUNC, 1001,
NULL, szSymbolName,
0, EF_NONE );
}
}
}
hb_compGenPCode1( HB_P_MPUSHSYM, HB_MACRO_PARAM );
hb_compGenPCodeN( ( BYTE * ) &pSym, sizeof( pSym ), HB_MACRO_PARAM );