2005-03-18 11:45 UTC+0100 Ryszard Glab <rglab@imid.med.pl>

* config/dos/global.cf
      *restored creation of subdirectiories under plain DOS

   * include/hbapi.h
   * include/hbcomp.h
   * include/hbdefs.h
   * include/hbvm.h
   * source/compiler/genc.c
   * source/compiler/harbour.c
   * source/compiler/hbpcode.c
   * source/vm/dynsym.c
   * source/vm/hvm.c
   * source/vm/macro.c
      *modified creation of symbols table
         *symbol of function name never share a symbol of variable
         *symbol for INIT/EXIT procedure has now '$' suffix - this means
         that such procedures cannot be called from user code
         (Clipper compatible)
       See the following code:
       PROCEDURE MAIN
        aaa()
       RETURN
       INIT PROCEDURE aaa
        ? "In INIT procedure", PROCNAME(0)
       RETURN
       STATIC PROCEDURE aaa
        ? "In STATIC procedure", PROCNAME(0)
       RETURN
       It will print:
       In INIT procedure aaa$
       In STATIC procedure aaa

      *fixed access to static functions in a macro compiler (symbols for
      static functions never goes into dynamic symbols table)

   * source/pp/ppcore.c
      *increased numer of nested optional clauses (max 5 currently - work
      in progress)
This commit is contained in:
Ryszard Glab
2005-03-18 10:39:33 +00:00
parent 291a3f7df9
commit 971da5e61e
13 changed files with 163 additions and 96 deletions

View File

@@ -8,6 +8,47 @@
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2005-03-18 11:45 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
* config/dos/global.cf
*restored creation of subdirectiories under plain DOS
* include/hbapi.h
* include/hbcomp.h
* include/hbdefs.h
* include/hbvm.h
* source/compiler/genc.c
* source/compiler/harbour.c
* source/compiler/hbpcode.c
* source/vm/dynsym.c
* source/vm/hvm.c
* source/vm/macro.c
*modified creation of symbols table
*symbol of function name never share a symbol of variable
*symbol for INIT/EXIT procedure has now '$' suffix - this means
that such procedures cannot be called from user code
(Clipper compatible)
See the following code:
PROCEDURE MAIN
aaa()
RETURN
INIT PROCEDURE aaa
? "In INIT procedure", PROCNAME(0)
RETURN
STATIC PROCEDURE aaa
? "In STATIC procedure", PROCNAME(0)
RETURN
It will print:
In INIT procedure aaa$
In STATIC procedure aaa
*fixed access to static functions in a macro compiler (symbols for
static functions never goes into dynamic symbols table)
* source/pp/ppcore.c
*increased numer of nested optional clauses (max 5 currently - work
in progress)
2005-02-16 13:52 UTC+0100 Antonio Linares <alinares@fivetechsoft.com>
* source/vm/classes.c
hb_objGetpMethod() compiled as extern "C" for MSVC compatibility with xHarbour

View File

@@ -65,7 +65,9 @@ MD = md
RANLIB = ranlib
dirbase::
-@for %d in ($(HB_ARCHITECTURE) $(ARCH_DOS)) do if not exist %d\nul $(MD) %d
-if not exist $(HB_ARCHITECTURE) $(MD) $(HB_ARCHITECTURE)
-if not exist $(ARCH_DOS) $(MD) $(ARCH_DOS)
# -@for %d in ($(HB_ARCHITECTURE) $(ARCH_DOS)) do if not exist %d\nul $(MD) %d
clean::
-@for %f in ($(ARCH_DOS)\*.* *.bak *.obj *.o *.tds) do $(RM) %f

View File

@@ -219,6 +219,7 @@ struct hb_struRefer
{
union {
struct _HB_CODEBLOCK * block; /* codeblock */
struct _HB_ITEM * itemPtr; /* item pointer */
struct _HB_ITEM ** itemsbase; /* static variables */
struct _HB_ITEM ** *itemsbasePtr; /* local variables */
} BasePtr;
@@ -240,7 +241,6 @@ struct hb_struString
struct hb_struSymbol
{
BOOL macro; /* if symbol was pushed by the macro compiler */
LONG stackbase;
USHORT lineno;
USHORT paramcnt;
@@ -532,7 +532,6 @@ 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

@@ -209,6 +209,7 @@ typedef struct _COMSYMBOL
char * szName; /* the name of the symbol */
char cScope; /* the scope of the symbol */
BYTE cType;
BOOL bFunc; /* is it a function name (TRUE) or memvar (FALSE) */
PCOMCLASS pClass;
struct _COMSYMBOL * pNext; /* pointer to the next defined symbol */
} COMSYMBOL, * PCOMSYMBOL;
@@ -300,9 +301,11 @@ extern PVAR hb_compVariableFind( PVAR pVars, USHORT wOrder ); /* returns a varia
extern PVAR hb_compLocalVariableFind( PFUNCTION pFunc, USHORT wVar );
extern USHORT hb_compVariableGetPos( PVAR pVars, char * szVarName ); /* returns the order + 1 of a variable if defined or zero */
extern PCOMSYMBOL hb_compSymbolAdd( char *, USHORT * );
#define HB_SYM_MEMVAR FALSE
#define HB_SYM_FUNCNAME TRUE
extern PCOMSYMBOL hb_compSymbolAdd( char *, USHORT *, BOOL );
extern PCOMSYMBOL hb_compSymbolKill( PCOMSYMBOL ); /* releases all memory allocated by symbol and returns the next one */
extern PCOMSYMBOL hb_compSymbolFind( char *, USHORT * ); /* returns a symbol pointer from the symbol table */
extern PCOMSYMBOL hb_compSymbolFind( char *, USHORT *, BOOL ); /* returns a symbol pointer from the symbol table */
extern PCOMSYMBOL hb_compSymbolGetPos( USHORT ); /* returns a symbol based on its index on the symbol table */
extern PCOMDECLARED hb_compDeclaredAdd( char * );

View File

@@ -987,6 +987,8 @@ typedef PHB_FUNC HB_FUNC_PTR;
are also prefixed with HB_. [vszakats] */
#define HB_FUNCNAME( funcname ) HB_FUN_##funcname
#define HB_INIT_FUNCNAME( funcname ) HB_FUN_init_##funcname
#define HB_EXIT_FUNCNAME( funcname ) HB_FUN_exit_##funcname
#if ( defined( _MSC_VER ) || defined( __WATCOMC__ ) ) && defined( HB_FUNC_NO_DECORATION )
#define HB_EXTERN_C_ extern "C"
@@ -997,8 +999,8 @@ typedef PHB_FUNC HB_FUNC_PTR;
#define HB_FUNC( funcname ) HB_EXTERN_C_ HARBOUR HB_EXPORT HB_FUN_##funcname ( void )
#define HB_FUNC_STATIC( funcname ) HB_EXTERN_C_ static HARBOUR HB_FUN_##funcname ( void )
#define HB_FUNC_EXTERN( funcname ) HB_EXTERN_C_ extern HARBOUR HB_FUN_##funcname ( void )
#define HB_FUNC_INIT( funcname ) HB_EXTERN_C_ static HARBOUR HB_FUN_##funcname ( void )
#define HB_FUNC_EXIT( funcname ) HB_EXTERN_C_ static HARBOUR HB_FUN_##funcname ( void )
#define HB_FUNC_INIT( funcname ) HB_EXTERN_C_ static HARBOUR HB_FUN_init_##funcname ( void )
#define HB_FUNC_EXIT( funcname ) HB_EXTERN_C_ static HARBOUR HB_FUN_exit_##funcname ( void )
typedef ULONG HB_HANDLE; /* handle to memvar value */
typedef char HB_SYMBOLSCOPE; /* stores symbol's scope */

View File

@@ -101,7 +101,6 @@ extern void hb_vmPushString( char * szText, ULONG length ); /* pushes a stri
extern void hb_vmPushStringPcode( char * szText, ULONG length ); /* pushes a string from pcode on to the stack */
extern void hb_vmPushDate( long lDate ); /* pushes a long date onto the stack */
extern void hb_vmPushSymbol( PHB_SYMB pSym ); /* pushes a function pointer onto the stack */
extern void hb_vmPushMacroSymbol( PHB_SYMB pSym ); /* pushes a symbol created by the macro compiler onto the stack */
extern void hb_vmPushPointer( void * ); /* push an item of HB_IT_POINTER type */
/* various flags for supported features

View File

@@ -32,6 +32,7 @@
static void hb_compGenCReadable( PFUNCTION pFunc, FILE * yyc );
static void hb_compGenCCompact( PFUNCTION pFunc, FILE * yyc );
static void hb_compGenCFunc( FILE *yyc, char *cDecor, char *szName, int iStrip );
/* helper structure to pass information */
typedef struct HB_stru_genc_info
@@ -108,10 +109,10 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou
fprintf( yyc, "static HARBOUR hb_INITSTATICS( void );\n" ); /* NOTE: hb_ intentionally in lower case */
/* Is it an INIT FUNCTION/PROCEDURE */
else if ( bIsInitFunction )
fprintf( yyc, "HB_FUNC_INIT( %s );\n", pFunc->szName );
hb_compGenCFunc( yyc, "HB_FUNC_INIT( %s );\n", pFunc->szName, 1 );
/* Is it an EXIT FUNCTION/PROCEDURE */
else if ( bIsExitFunction )
fprintf( yyc, "HB_FUNC_EXIT( %s );\n", pFunc->szName );
hb_compGenCFunc( yyc, "HB_FUNC_EXIT( %s );\n", pFunc->szName, 1 );
/* Then it must be a STATIC FUNCTION/PROCEDURE */
else
fprintf( yyc, "HB_FUNC_STATIC( %s );\n", pFunc->szName );
@@ -178,11 +179,7 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou
if( pSym->cScope & HB_FS_STATIC )
{
fprintf( yyc, "HB_FS_STATIC" );
if( pSym->cScope & HB_FS_PUBLIC )
fprintf( yyc, " | HB_FS_PUBLIC" );
}
else if( pSym->cScope & HB_FS_INIT )
fprintf( yyc, "HB_FS_INIT" );
@@ -203,9 +200,16 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou
/* specify the function address if it is a defined function or an
external called function */
if( hb_compFunctionFind( pSym->szName ) ) /* is it a function defined in this module */
fprintf( yyc, ", {HB_FUNCNAME( %s )}, NULL }", pSym->szName );
else if( hb_compFunCallFind( pSym->szName ) ) /* is it a function called from this module */
if( pSym->bFunc && hb_compFunctionFind( pSym->szName ) ) /* is it a function defined in this module */
{
if( pSym->cScope & HB_FS_INIT )
hb_compGenCFunc( yyc, ", {HB_INIT_FUNCNAME( %s )}, NULL }", pSym->szName, 1 );
else if( pSym->cScope & HB_FS_EXIT )
hb_compGenCFunc( yyc, ", {HB_EXIT_FUNCNAME( %s )}, NULL }", pSym->szName, 1 );
else
fprintf( yyc, ", {HB_FUNCNAME( %s )}, NULL }", pSym->szName );
}
else if( pSym->bFunc && hb_compFunCallFind( pSym->szName ) ) /* is it a function called from this module */
fprintf( yyc, ", {HB_FUNCNAME( %s )}, NULL }", pSym->szName );
else
fprintf( yyc, ", {NULL}, NULL }" ); /* memvar */
@@ -259,10 +263,10 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou
fprintf( yyc, "static HARBOUR hb_INITSTATICS( void )" ); /* NOTE: hb_ intentionally in lower case */
/* Is it an INIT FUNCTION/PROCEDURE */
else if ( bIsInitFunction )
fprintf( yyc, "HB_FUNC_INIT( %s )", pFunc->szName );
hb_compGenCFunc( yyc, "HB_FUNC_INIT( %s )", pFunc->szName, 1 );
/* Is it an EXIT FUNCTION/PROCEDURE */
else if ( bIsExitFunction )
fprintf( yyc, "HB_FUNC_EXIT( %s )", pFunc->szName );
hb_compGenCFunc( yyc, "HB_FUNC_EXIT( %s )", pFunc->szName, 1 );
/* Then it must be a STATIC FUNCTION/PROCEDURE */
else
fprintf( yyc, "HB_FUNC_STATIC( %s )", pFunc->szName );
@@ -373,6 +377,30 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou
printf( "Done.\n" );
}
static void hb_compGenCFunc( FILE * yyc, char *cDecor, char *szName, int iStrip )
{
int i=0;
while( cDecor[i] )
{
if( cDecor[i] == '%' && cDecor[i+1] == 's' )
{
int j=0;
while( szName[j+iStrip] )
{
fwrite( (void*)(szName+j), 1, 1, yyc );
j++;
}
i +=2;
}
else
{
fwrite( (void*)(cDecor+i), 1, 1, yyc );
i++;
}
}
}
static HB_GENC_FUNC( hb_p_and )
{
HB_SYMBOL_UNUSED( pFunc );

View File

@@ -581,9 +581,9 @@ void hb_compVariableAdd( char * szVarName, BYTE cValueType )
hb_comp_functions.pLast->wParamCount = hb_comp_functions.pLast->wParamNum;
}
pSym = hb_compSymbolFind( szVarName, &wPos ); /* check if symbol exists already */
pSym = hb_compSymbolFind( szVarName, &wPos, HB_SYM_MEMVAR ); /* check if symbol exists already */
if( ! pSym )
pSym = hb_compSymbolAdd( hb_strdup( szVarName ), &wPos );
pSym = hb_compSymbolAdd( hb_strdup( szVarName ), &wPos, HB_SYM_MEMVAR );
pSym->cScope |= VS_MEMVAR;
@@ -625,9 +625,9 @@ void hb_compVariableAdd( char * szVarName, BYTE cValueType )
case VS_PRIVATE:
{
pSym = hb_compSymbolFind( szVarName, &wPos ); /* check if symbol exists already */
pSym = hb_compSymbolFind( szVarName, &wPos, HB_SYM_MEMVAR ); /* check if symbol exists already */
if( ! pSym )
pSym = hb_compSymbolAdd( hb_strdup( szVarName ), &wPos );
pSym = hb_compSymbolAdd( hb_strdup( szVarName ), &wPos, HB_SYM_MEMVAR );
pSym->cScope |= VS_MEMVAR;
@@ -667,9 +667,9 @@ void hb_compVariableAdd( char * szVarName, BYTE cValueType )
case VS_PUBLIC:
{
pSym = hb_compSymbolFind( szVarName, &wPos ); /* check if symbol exists already */
pSym = hb_compSymbolFind( szVarName, &wPos, HB_SYM_MEMVAR ); /* check if symbol exists already */
if( ! pSym )
pSym = hb_compSymbolAdd( hb_strdup( szVarName ), &wPos );
pSym = hb_compSymbolAdd( hb_strdup( szVarName ), &wPos, HB_SYM_MEMVAR );
pSym->cScope |= VS_MEMVAR;
}
@@ -1436,7 +1436,7 @@ PCOMDECLARED hb_compDeclaredAdd( char * szDeclaredName )
return pDeclared;
}
PCOMSYMBOL hb_compSymbolAdd( char * szSymbolName, USHORT * pwPos )
PCOMSYMBOL hb_compSymbolAdd( char * szSymbolName, USHORT * pwPos, BOOL bFunction )
{
PCOMSYMBOL pSym;
@@ -1449,9 +1449,10 @@ PCOMSYMBOL hb_compSymbolAdd( char * szSymbolName, USHORT * pwPos )
pSym = ( PCOMSYMBOL ) hb_xgrab( sizeof( COMSYMBOL ) );
pSym->szName = szSymbolName;
pSym->cScope = HB_FS_PUBLIC;
pSym->cScope = 0; /* HB_FS_PUBLIC; */
pSym->cType = hb_comp_cVarType;
pSym->pNext = NULL;
pSym->bFunc = bFunction;
if( ! hb_comp_symbols.iCount )
{
@@ -1542,6 +1543,19 @@ void hb_compFunctionAdd( char * szFunName, HB_SYMBOLSCOPE cScope, int iType )
hb_compFinalizeFunction(); /* fix all previous function returns offsets */
if( cScope & (HB_FS_INIT | HB_FS_EXIT) )
{
char *szNewName;
int iLen;
iLen = strlen(szFunName);
szNewName =(char *)hb_xgrab( iLen+2 );
szNewName[0] = '\0';
strcpy( szNewName, szFunName );
szNewName[ iLen ] ='$';
szNewName[ iLen+1 ] = '\0';
szFunName = szNewName;
}
pFunc = hb_compFunctionFind( szFunName );
if( pFunc )
{
@@ -1562,10 +1576,14 @@ void hb_compFunctionAdd( char * szFunName, HB_SYMBOLSCOPE cScope, int iType )
hb_comp_iFunctionCnt++;
pSym = hb_compSymbolFind( szFunName, NULL );
pSym = hb_compSymbolFind( szFunName, NULL, HB_SYM_FUNCNAME );
if( ! pSym )
{
/* there is not a symbol on the symbol table for this function name */
pSym = hb_compSymbolAdd( szFunName, NULL );
pSym = hb_compSymbolAdd( szFunName, NULL, HB_SYM_FUNCNAME );
if( pSym )
pSym->cScope = cScope;
}
if( pSym && cScope != HB_FS_PUBLIC )
pSym->cScope |= cScope; /* we may have a non public function and a object message */
@@ -1618,10 +1636,10 @@ PINLINE hb_compInlineAdd( char * szFunName )
if( szFunName )
{
pSym = hb_compSymbolFind( szFunName, NULL );
pSym = hb_compSymbolFind( szFunName, NULL, HB_SYM_FUNCNAME );
if( ! pSym )
{
pSym = hb_compSymbolAdd( szFunName, NULL );
pSym = hb_compSymbolAdd( szFunName, NULL, HB_SYM_FUNCNAME );
}
if( pSym )
{
@@ -1668,7 +1686,7 @@ void hb_compAnnounce( char * szFunName )
/* create a new procedure
*/
pSym = hb_compSymbolAdd( szFunName, NULL );
pSym = hb_compSymbolAdd( szFunName, NULL, HB_SYM_FUNCNAME );
pSym->cScope = HB_FS_PUBLIC;
pFunc = hb_compFunctionNew( szFunName, HB_FS_PUBLIC );
@@ -1778,14 +1796,14 @@ void hb_compExternGen( void ) /* generates the symbols for the EXTERN names */
while( hb_comp_pExterns )
{
if( hb_compSymbolFind( hb_comp_pExterns->szName, NULL ) )
if( hb_compSymbolFind( hb_comp_pExterns->szName, NULL, HB_SYM_FUNCNAME ) )
{
if( ! hb_compFunCallFind( hb_comp_pExterns->szName ) )
hb_compFunCallAdd( hb_comp_pExterns->szName );
}
else
{
hb_compSymbolAdd( hb_comp_pExterns->szName, NULL );
hb_compSymbolAdd( hb_comp_pExterns->szName, NULL, HB_SYM_FUNCNAME );
hb_compFunCallAdd( hb_comp_pExterns->szName );
}
pDelete = hb_comp_pExterns;
@@ -2133,7 +2151,7 @@ PCOMDECLARED hb_compDeclaredFind( char * szDeclaredName )
return NULL;
}
PCOMSYMBOL hb_compSymbolFind( char * szSymbolName, USHORT * pwPos )
PCOMSYMBOL hb_compSymbolFind( char * szSymbolName, USHORT * pwPos, BOOL bFunction )
{
PCOMSYMBOL pSym = hb_comp_symbols.pFirst;
USHORT wCnt = 0;
@@ -2144,20 +2162,21 @@ PCOMSYMBOL hb_compSymbolFind( char * szSymbolName, USHORT * pwPos )
{
if( ! strcmp( pSym->szName, szSymbolName ) )
{
if( pwPos )
*pwPos = wCnt;
return pSym;
if( bFunction == pSym->bFunc )
{
if( pwPos )
*pwPos = wCnt;
return pSym;
}
}
if( pSym->pNext )
{
pSym = pSym->pNext;
++wCnt;
}
else
{
if( pSym->pNext )
{
pSym = pSym->pNext;
++wCnt;
}
else
return NULL;
}
return NULL;
}
return NULL;
}
@@ -2657,9 +2676,9 @@ void hb_compGenVarPCode( BYTE bPCode, char * szVarName )
/* Check if this variable name is placed into the symbol table
*/
pSym = hb_compSymbolFind( szVarName, &wVar );
pSym = hb_compSymbolFind( szVarName, &wVar, HB_SYM_MEMVAR );
if( ! pSym )
pSym = hb_compSymbolAdd( szVarName, &wVar );
pSym = hb_compSymbolAdd( szVarName, &wVar, HB_SYM_MEMVAR );
pSym->cScope |= VS_MEMVAR;
if( bPCode == HB_P_PUSHALIASEDFIELD && wVar <= 255 )
@@ -2673,10 +2692,10 @@ void hb_compGenVarPCode( BYTE bPCode, char * szVarName )
void hb_compGenMessage( char * szMsgName ) /* sends a message to an object */
{
USHORT wSym;
PCOMSYMBOL pSym = hb_compSymbolFind( szMsgName, &wSym );
PCOMSYMBOL pSym = hb_compSymbolFind( szMsgName, &wSym, HB_SYM_FUNCNAME );
if( ! pSym ) /* the symbol was not found on the symbol table */
pSym = hb_compSymbolAdd( szMsgName, &wSym );
pSym = hb_compSymbolAdd( szMsgName, &wSym, HB_SYM_FUNCNAME );
pSym->cScope |= HB_FS_MESSAGE;
hb_compGenPCode3( HB_P_MESSAGE, HB_LOBYTE( wSym ), HB_HIBYTE( wSym ), ( BOOL ) 1 );
}
@@ -3246,7 +3265,7 @@ void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias )
PCOMSYMBOL pSym;
USHORT wSym;
if( ( pSym = hb_compSymbolFind( szSymbolName, &wSym ) ) != NULL ) /* the symbol was found on the symbol table */
if( ( pSym = hb_compSymbolFind( szSymbolName, &wSym, bFunction ) ) != NULL ) /* the symbol was found on the symbol table */
{
if( bFunction && ! hb_compFunCallFind( szSymbolName ) )
hb_compFunCallAdd( szSymbolName );
@@ -3256,10 +3275,17 @@ void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias )
}
else
{
hb_compSymbolAdd( szSymbolName, &wSym );
pSym = hb_compSymbolAdd( szSymbolName, &wSym, bFunction );
if( bFunction )
{
if( pSym )
{
/* reset symbol scope because the real scope is unknown now */
pSym->cScope = 0;
}
hb_compFunCallAdd( szSymbolName );
}
}
if( wSym > 255 )
@@ -3384,7 +3410,7 @@ static void hb_compOptimizeFrames( PFUNCTION pFunc )
if( pFunc->pCode[ 0 ] == HB_P_STATICS &&
pFunc->pCode[ 5 ] == HB_P_SFRAME )
{
hb_compSymbolFind( hb_comp_pInitFunc->szName, &w );
hb_compSymbolFind( hb_comp_pInitFunc->szName, &w, HB_SYM_FUNCNAME );
pFunc->pCode[ 1 ] = HB_LOBYTE( w );
pFunc->pCode[ 2 ] = HB_HIBYTE( w );
pFunc->pCode[ 6 ] = HB_LOBYTE( w );
@@ -3459,7 +3485,7 @@ static void hb_compOptimizeFrames( PFUNCTION pFunc )
if( pFunc->bFlags & FUN_USES_STATICS )
{
hb_compSymbolFind( hb_comp_pInitFunc->szName, &w );
hb_compSymbolFind( hb_comp_pInitFunc->szName, &w, HB_SYM_FUNCNAME );
pFunc->pCode[ 4 ] = HB_LOBYTE( w );
pFunc->pCode[ 5 ] = HB_HIBYTE( w );
bSkipSFRAME = FALSE;
@@ -4234,7 +4260,7 @@ int hb_compCompile( char * szPrg, int argc, char * argv[] )
hb_comp_pInitFunc->pCode[ 4 ] = HB_HIBYTE( hb_comp_iStaticCnt );
hb_comp_pInitFunc->iStaticsBase = hb_comp_iStaticCnt;
pSym = hb_compSymbolAdd( hb_comp_pInitFunc->szName, NULL );
pSym = hb_compSymbolAdd( hb_comp_pInitFunc->szName, NULL, HB_SYM_FUNCNAME );
pSym->cScope |= hb_comp_pInitFunc->cScope;
hb_comp_functions.pLast->pNext = hb_comp_pInitFunc;
hb_comp_functions.pLast = hb_comp_pInitFunc;

View File

@@ -275,7 +275,7 @@ void hb_compStrongType( int iSize )
pFunc->iStackIndex--;
pSym = hb_compSymbolFind( pFunc->szName, NULL );
pSym = hb_compSymbolFind( pFunc->szName, NULL, HB_SYM_FUNCNAME );
if( pSym && pSym->szName )
{

View File

@@ -1672,11 +1672,13 @@ static int WorkTranslate( char * ptri, char * ptro, COMMANDS * sttra, int * lens
return -1;
}
#define MAX_OPTIONALS 5
static int CommandStuff( char * ptrmp, char * inputLine, char * ptro, int * lenres, BOOL com_or_tra, BOOL com_or_xcom )
{
BOOL endTranslation = FALSE;
int ipos;
char * lastopti[ 3 ], * strtopti = NULL, * strtptri = NULL;
char * lastopti[ MAX_OPTIONALS ], * strtopti = NULL, * strtptri = NULL;
char * ptri = inputLine, * ptr, tmpname[ MAX_NAME ];
int isWordInside = 0;

View File

@@ -203,16 +203,6 @@ 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

@@ -1661,7 +1661,7 @@ void HB_EXPORT hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols )
case HB_P_MPUSHSYM:
{
HB_DYNS_PTR pDynSym = ( HB_DYNS_PTR ) HB_GET_PTR( pCode + w + 1 );
hb_vmPushMacroSymbol( pDynSym->pSymbol );
hb_vmPushSymbol( pDynSym->pSymbol );
w += sizeof( HB_DYNS_PTR ) + 1;
break;
}
@@ -3586,16 +3586,6 @@ void HB_EXPORT hb_vmDo( USHORT uiParams )
if( pFunc )
{
if( pItem->item.asSymbol.macro && (pSym->cScope & HB_FS_STATIC) )
{
/* static functions are not allowed in macro
*/
PHB_ITEM pArgsArray = hb_arrayFromStack( uiParams );
hb_errRT_BASE_SubstR( EG_NOFUNC, 1001, NULL, pSym->szName, 1, pArgsArray );
hb_itemRelease( pArgsArray );
}
else
{
if( bProfiler && pSym->pDynSym ) {
pSym->pDynSym->ulRecurse++;
}
@@ -3618,7 +3608,6 @@ void HB_EXPORT hb_vmDo( USHORT uiParams )
if( bProfiler && pSym->pDynSym ) {
pSym->pDynSym->ulRecurse--;
}
}
}
else
{
@@ -4391,20 +4380,6 @@ void HB_EXPORT hb_vmPushSymbol( PHB_SYMB pSym )
pStackTopItem->type = HB_IT_SYMBOL;
pStackTopItem->item.asSymbol.value = pSym;
pStackTopItem->item.asSymbol.stackbase = hb_stackTopOffset();
pStackTopItem->item.asSymbol.macro = FALSE;
hb_stackPush();
}
void hb_vmPushMacroSymbol( PHB_SYMB pSym )
{
PHB_ITEM pStackTopItem = hb_stackTopItem();
HB_TRACE(HB_TR_DEBUG, ("hb_vmPushSymbol(%p)", pSym));
pStackTopItem->type = HB_IT_SYMBOL;
pStackTopItem->item.asSymbol.value = pSym;
pStackTopItem->item.asSymbol.stackbase = hb_stackTopOffset();
pStackTopItem->item.asSymbol.macro = TRUE;
hb_stackPush();
}

View File

@@ -831,7 +831,7 @@ void hb_macroPushSymbol( HB_ITEM_PTR pItem )
/* NOTE: checking for valid function name (valid pointer) is done
* in hb_vmDo()
*/
hb_vmPushMacroSymbol( pDynSym->pSymbol ); /* push compiled symbol instead of a string */
hb_vmPushSymbol( pDynSym->pSymbol ); /* push compiled symbol instead of a string */
if( bNewBuffer )
hb_xfree( szString ); /* free space allocated in hb_macroTextSubst */
@@ -1227,7 +1227,7 @@ void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias, HB_
}
else if( bFunction )
{
if( pSym && hb_dynsymScope(pSym, HB_FS_STATIC) )
if( pSym && pSym->pFunPtr==NULL )
{
/* static functions are not allowed in macro */
HB_MACRO_DATA->status |= HB_MACRO_UNKN_SYM;