2004-03-30 16:30 UTC+0100 Ryszard Glab <rglab@imid.med.pl>

* include/hbapi.h
   * source/vm/macro.c
      * added HB_ITEM_PTR pError member to HB_MACRO structure
      * fixed bug in macro compiler - calls to static
        functions are not allowed in macro compiler

   * source/common/expropt1.c
   * source/common/hbffind.c
      *fixed minor warnings reported by Randy Portnoff

   * source/rtl/set.c
      *SET(_SET_DEBUG) defaults to FALSE (Clipper compatible)

   * source/rtl/idle.c
      *small optimization of hb_idleState()

   * source/compiler/harbour.y
      *the compiler generates line number for DO CASE
      (if debug info requested - to allow breakpoint)

   * source/debug/debugger.prg
      *the debugger shows the line number for modules where
      no source code is available
This commit is contained in:
Ryszard Glab
2004-03-30 14:13:52 +00:00
parent 83b41c99c0
commit e3971c5905
10 changed files with 102 additions and 51 deletions

View File

@@ -8,6 +8,31 @@
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2004-03-30 16:30 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
* include/hbapi.h
* source/vm/macro.c
* added HB_ITEM_PTR pError member to HB_MACRO structure
* fixed bug in macro compiler - calls to static
functions are not allowed in macro compiler
* source/common/expropt1.c
* source/common/hbffind.c
*fixed minor warnings reported by Randy Portnoff
* source/rtl/set.c
*SET(_SET_DEBUG) defaults to FALSE (Clipper compatible)
* source/rtl/idle.c
*small optimization of hb_idleState()
* source/compiler/harbour.y
*the compiler generates line number for DO CASE
(if debug info requested - to allow breakpoint)
* source/debug/debugger.prg
*the debugger shows the line number for modules where
no source code is available
2004-03-29 15:00 UTC-0500 David G. Holm <dholm@jsd-llc.com>
* source/pp/ppcore.c
! Added missing type conversions on calls to hb_xgrab

View File

@@ -542,6 +542,7 @@ typedef struct HB_MACRO_ /* a macro compiled pcode container */
ULONG pos; /* current position inside of compiled string */
int Flags; /* some flags we may need */
int status; /* status of compilation */
HB_ITEM_PTR pError; /* error object returned from the parser */
ULONG supported; /* various flags for supported capabilities */
int FlexState; /* internal flex state during parsing */
HB_PCODE_INFO_PTR pCodeInfo; /* pointer to pcode buffer and info */

View File

@@ -430,14 +430,15 @@ HB_EXPR_PTR hb_compExprNewMacro( HB_EXPR_PTR pMacroExpr, unsigned char cMacroOp,
* ? &var // this is OK
* ? &var.ext // this is invalid
*/
char *szDupl;
BOOL bUseTextSubst;
char *szDupl;
BOOL bUseTextSubst;
szDupl = hb_strupr( hb_strdup( szName ) );
if( ! hb_compExprIsValidMacro( szDupl, &bUseTextSubst, NULL ) )
hb_compErrorMacro( szName );
hb_xfree( szDupl );
szDupl = hb_strupr( hb_strdup( szName ) );
if( ! hb_compExprIsValidMacro( szDupl, &bUseTextSubst, NULL ) )
{
hb_compErrorMacro( szName );
}
hb_xfree( szDupl );
}
}
else

View File

@@ -592,7 +592,7 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind )
nDay =
nHour =
nMin =
nSec =
nSec = 0;
raw_attr = 0;
}
}

View File

@@ -1446,7 +1446,7 @@ EndCase : ENDCASE
}
;
DoCaseStart : DOCASE { ++hb_comp_wCaseCounter; } Crlf
DoCaseStart : DOCASE { ++hb_comp_wCaseCounter; hb_compLinePushIfDebugger();} Crlf
;
DoCaseBegin : DoCaseStart { }

View File

@@ -1396,7 +1396,7 @@ LOCAL nlevel, nPos
//a procedure with debug info
::aProcStack[i-nDebugLevel+1] := ::aCallStack[ nPos ]
ELSE
::aProcStack[i-nDebugLevel+1] := { PROCNAME( i ), ,,,, nLevel }
::aProcStack[i-nDebugLevel+1] := { PROCNAME( i )+"("+NTRIM(PROCLINE(i))+")", ,,,, nLevel }
ENDIF
NEXT
@@ -3152,7 +3152,6 @@ static function PathToArray( cList )
local cSep
cSep := HB_OsPathListSeparator()
if ( cList <> NIL )
do while ( nPos := at( cSep, cList ) ) <> 0

View File

@@ -122,8 +122,8 @@ C_SOURCES=\
PRG_SOURCES=\
achoice.prg \
adir.prg \
alert.prg \
altd.prg \
alert.prg \
browdb.prg \
browdbx.prg \
browse.prg \

View File

@@ -90,7 +90,7 @@ static USHORT s_uiIdleTask = 0;
static USHORT s_uiIdleMaxTask = 0;
/* flag to indicate GarbageCollection should be done in idle state. */
BOOL hb_vm_bCollectGarbage = TRUE;
static BOOL hb_vm_bCollectGarbage = TRUE;
void hb_releaseCPU( void )
{
@@ -153,45 +153,35 @@ void hb_idleState( void )
{
s_bIamIdle = TRUE;
hb_releaseCPU();
if( hb_vm_bCollectGarbage )
{
hb_vm_bCollectGarbage = FALSE;
hb_gcCollectAll();
s_bIamIdle = FALSE;
return;
hb_vm_bCollectGarbage = FALSE;
}
if( s_pIdleTasks && s_uiIdleTask < s_uiIdleMaxTask )
{
hb_vmEvalBlock( s_pIdleTasks[ s_uiIdleTask ] );
++s_uiIdleTask;
s_bIamIdle = FALSE;
return;
if( hb_set.HB_SET_IDLEREPEAT && s_uiIdleTask == s_uiIdleMaxTask )
{
s_uiIdleTask = 0; /* restart processing of idle tasks */
hb_vm_bCollectGarbage = TRUE;
}
}
if( hb_set.HB_SET_IDLEREPEAT && s_uiIdleTask == s_uiIdleMaxTask )
{
s_uiIdleTask = 0;
hb_vm_bCollectGarbage = TRUE;
hb_releaseCPU();
s_bIamIdle = FALSE;
return;
}
hb_releaseCPU();
s_bIamIdle = FALSE;
}
}
void hb_idleReset( void )
{
if( s_uiIdleTask == s_uiIdleMaxTask )
if( (! hb_set.HB_SET_IDLEREPEAT) && s_uiIdleTask == s_uiIdleMaxTask )
{
s_uiIdleTask = 0;
hb_vm_bCollectGarbage = TRUE;
}
hb_vm_bCollectGarbage = TRUE;
}
/* close all active background task on program exit */
@@ -205,6 +195,7 @@ void hb_idleShutDown( void )
}
while( s_uiIdleMaxTask );
hb_xfree( s_pIdleTasks );
s_uiIdleTask = 0;
s_pIdleTasks = NULL;
}
}
@@ -212,13 +203,8 @@ void hb_idleShutDown( void )
/* signal that the user code is in idle state */
HB_FUNC( HB_IDLESTATE )
{
hb_vm_bCollectGarbage = TRUE;
hb_idleState();
if( s_uiIdleTask == s_uiIdleMaxTask )
{
s_uiIdleTask = 0;
hb_vm_bCollectGarbage = TRUE;
}
}
/* add a new background task and return its handle */
@@ -267,6 +253,7 @@ HB_FUNC( HB_IDLEDEL )
if( ulID == ( ULONG ) pItem->item.asBlock.value )
{
hb_itemClear( hb_itemReturn( pItem ) ); /* return a codeblock */
hb_itemRelease( pItem );
--s_uiIdleMaxTask;
if( s_uiIdleMaxTask )
@@ -277,10 +264,13 @@ HB_FUNC( HB_IDLEDEL )
sizeof( HB_ITEM_PTR ) * ( s_uiIdleMaxTask - iTask ) );
}
s_pIdleTasks = ( HB_ITEM_PTR * ) hb_xrealloc( s_pIdleTasks, sizeof( HB_ITEM_PTR ) * s_uiIdleMaxTask );
if( s_uiIdleTask >= s_uiIdleMaxTask )
s_uiIdleTask = 0;
}
else
{
hb_xfree( s_pIdleTasks );
s_uiIdleTask = 0;
s_pIdleTasks = NULL;
}
bFound = TRUE;

View File

@@ -916,7 +916,7 @@ void hb_setInitialize( void )
hb_set.HB_SET_CONSOLE = TRUE;
hb_set.HB_SET_DATEFORMAT = ( char * ) hb_xgrab( 9 );
memcpy( hb_set.HB_SET_DATEFORMAT, "mm/dd/yy", 9 );
hb_set.HB_SET_DEBUG = TRUE;
hb_set.HB_SET_DEBUG = FALSE;
hb_set.HB_SET_DECIMALS = 2;
hb_set.HB_SET_DEFAULT = ( char * ) hb_xgrab( 1 );
hb_set.HB_SET_DEFAULT[ 0 ] = '\0';

View File

@@ -215,22 +215,32 @@ static void hb_macroEvaluate( HB_MACRO_PTR pMacro )
static void hb_macroSyntaxError( HB_MACRO_PTR pMacro )
{
HB_ITEM_PTR pResult;
HB_ITEM_PTR pError = NULL;
HB_TRACE(HB_TR_DEBUG, ("hb_macroSyntaxError(%p)", pMacro));
if( pMacro )
{
HB_TRACE(HB_TR_DEBUG, ("hb_macroSyntaxError.(%s)", pMacro->string));
hb_macroDelete( pMacro ); /* TODO: use pMacro->status for more detailed error messagess */
pError = pMacro->pError;
hb_macroDelete( pMacro );
}
pResult = hb_errRT_BASE_Subst( EG_SYNTAX, 1449, NULL, "&", 0 );
if( pResult )
if( pError )
{
hb_vmPush( pResult );
hb_itemRelease( pResult );
hb_errLaunch( pError );
hb_errRelease( pError );
}
else
{
pResult = hb_errRT_BASE_Subst( EG_SYNTAX, 1449, NULL, "&", 0 );
if( pResult )
{
hb_vmPush( pResult );
hb_itemRelease( pResult );
}
}
}
@@ -759,6 +769,16 @@ void hb_macroPushSymbol( HB_ITEM_PTR pItem )
/* NOTE: checking for valid function name (valid pointer) is done
* in hb_vmDo()
*/
if( pDynSym && ((pDynSym->pSymbol->pFunPtr == NULL) || (pDynSym->pSymbol->cScope & HB_FS_STATIC)) )
{
/* static functions are not allowed in macro */
HB_ITEM_PTR pError = hb_errRT_New( ES_ERROR, NULL, EG_NOFUNC, 1001,
NULL, szString,
0, EF_NONE );
hb_errLaunch( pError );
hb_errRelease( pError );
}
hb_vmPushSymbol( pDynSym->pSymbol ); /* push compiled symbol instead of a string */
if( bNewBuffer )
@@ -1112,7 +1132,6 @@ void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias, HB_
{
HB_DYNS_PTR pSym;
HB_SYMBOL_UNUSED( bFunction );
HB_SYMBOL_UNUSED( bAlias );
if( HB_MACRO_DATA->Flags & HB_MACRO_GEN_TYPE )
@@ -1131,7 +1150,23 @@ void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias, HB_
}
}
else
pSym = hb_dynsymGet( szSymbolName );
pSym = hb_dynsymGet( szSymbolName );
if( bFunction )
{
if( pSym && ((pSym->pSymbol->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 );
@@ -1390,12 +1425,12 @@ void hb_compGenPushFunCall( char * szFunName, HB_MACRO_DECL )
{
/* Abbreviated function name was used - change it for whole name
*/
hb_compGenPushSymbol( szFunction, FALSE, FALSE, HB_MACRO_PARAM );
hb_compGenPushSymbol( szFunction, TRUE, FALSE, HB_MACRO_PARAM );
}
else
{
HB_MACRO_DATA->status |= HB_MACRO_UDF; /* this is used in hb_macroGetType */
hb_compGenPushSymbol( szFunName, FALSE, FALSE, HB_MACRO_PARAM );
hb_compGenPushSymbol( szFunName, TRUE, FALSE, HB_MACRO_PARAM );
}
}