2017-03-28 23:02 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* include/hbcomp.h
  * include/hbcompdf.h
  * include/hberrors.h
  * include/hbexprb.c
  * src/common/expropt1.c
  * src/compiler/hbgenerr.c
  * src/compiler/hbmain.c
    + added new macros HB_ET_MACRO_NOLIST and HB_ET_MACRO_NOPARE
    % use new HB_ET_MACRO_* macros
    + added new compile time error:
         "Code block contains both macro and with object messages ':%s'"
      NOTE: -kd compiler switch allows to compile codeblocks with macros
            and declared symbols / with object messages
    * replaced hb_compErrorCodeblock() with hb_compErrorCodeblockDecl() and
      hb_compErrorCodeblockWith()
    + added new C function hb_compPushMacroVar()
    * code simplification
    ; added few comments

  * utils/hbtest/rt_math.prg
    * extended test code for macro messages and macro <op>=, pre/post ++/--
      operations

  * src/vm/hvm.c
    ! protection against executing hb_threadStateNew() during GC pass
      inside hb_vmRequestReenterExt()

  * src/vm/garbage.c
    ! add volatile attribute to s_bCollecting variable
    * small modification in hb_gcAll() parameter

  * src/rtl/errsys.prg
    ; minor comment cleanup

  * doc/xhb-diff.txt
    * extended a little bit section STRONG TYPED VARIABLES
This commit is contained in:
Przemysław Czerpak
2017-03-28 23:02:28 +02:00
parent 5f1da37fd2
commit 9153285bdf
13 changed files with 215 additions and 113 deletions

View File

@@ -1366,12 +1366,8 @@ HB_SIZE hb_compExprParamListCheck( HB_COMP_DECL, PHB_EXPR pExpr )
while( pElem )
{
if( ( pElem->ExprType == HB_ET_MACRO && HB_SUPPORT_XBASE &&
pElem->value.asMacro.SubType != HB_ET_MACRO_SYMBOL &&
pElem->value.asMacro.SubType != HB_ET_MACRO_REFER &&
pElem->value.asMacro.SubType != HB_ET_MACRO_ALIASED &&
( pElem->value.asMacro.SubType & HB_ET_MACRO_PARE ) == 0 ) ||
( pElem->ExprType == HB_ET_ARGLIST &&
pElem->value.asList.reference ) ||
( pElem->value.asMacro.SubType & HB_ET_MACRO_NOLIST ) == 0 ) ||
( pElem->ExprType == HB_ET_ARGLIST && pElem->value.asList.reference ) ||
hb_compExprIsArrayToParams( pElem ) )
{
/* &macro was passed

View File

@@ -98,6 +98,7 @@ const char * const hb_comp_szErrors[] =
"ENDWITH does not match WITH OBJECT",
"ENDSWITCH does not match SWITCH",
"END SEQUENCE does not match BEGIN SEQUENCE",
"Code block contains both macro and with object messages ':%s'",
/* Some historical, funny sounding error messages from original CA-Cl*pper.
They serve no purpose whatsoever. [vszakats] */
"END wreaks terrible vengeance on control stack",
@@ -246,11 +247,19 @@ PHB_EXPR hb_compWarnMeaningless( HB_COMP_DECL, PHB_EXPR pExpr )
return pExpr;
}
void hb_compErrorCodeblock( HB_COMP_DECL, const char * szBlock )
void hb_compErrorCodeblockDecl( HB_COMP_DECL, const char * szVarName )
{
HB_BOOL fError = HB_COMP_PARAM->fError;
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_BLOCK, szBlock, NULL );
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_BLOCK, szVarName, NULL );
HB_COMP_PARAM->fError = fError; /* restore error flag for this line */
}
void hb_compErrorCodeblockWith( HB_COMP_DECL, const char * szMessage )
{
HB_BOOL fError = HB_COMP_PARAM->fError;
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_WITHOBJECT_MACROBLOCK, szMessage, NULL );
HB_COMP_PARAM->fError = fError; /* restore error flag for this line */
}

View File

@@ -904,6 +904,17 @@ static int hb_compVariableScope( HB_COMP_DECL, const char * szVarName )
return iScope;
}
void hb_compPushMacroVar( HB_COMP_DECL, const char * szVarName )
{
/* save and restore iEarlyEvalPass to not disable early
evaluation when only macrovar and/or macrotex is used */
int iEarlyEvalPass = HB_COMP_PARAM->functions.pLast->iEarlyEvalPass;
hb_compGenPushVar( szVarName, HB_COMP_PARAM );
HB_COMP_PARAM->functions.pLast->iEarlyEvalPass = iEarlyEvalPass;
}
void hb_compPushMacroText( HB_COMP_DECL, const char * szText, HB_SIZE nLen, HB_BOOL fMacro )
{
int iEarlyEvalPass = HB_COMP_PARAM->functions.pLast->iEarlyEvalPass;
@@ -2626,6 +2637,14 @@ void hb_compGenMessage( const char * szMsgName, HB_BOOL bIsObject, HB_COMP_DECL
wSym = 0xFFFF;
hb_compGenPCode3( HB_P_WITHOBJECTMESSAGE, HB_LOBYTE( wSym ), HB_HIBYTE( wSym ), HB_COMP_PARAM );
}
if( ! bIsObject && HB_COMP_PARAM->functions.pLast->iEarlyEvalPass == 1 )
{
if( HB_SUPPORT_MACRODECL )
HB_COMP_PARAM->functions.pLast->iEarlyEvalPass = 0;
else
hb_compErrorCodeblockWith( HB_COMP_PARAM, szMsgName ? szMsgName : "&..." );
}
}
void hb_compGenMessageData( const char * szMsg, HB_BOOL bIsObject, HB_COMP_DECL ) /* generates an underscore-symbol name for a data assignment */
@@ -2659,7 +2678,7 @@ static void hb_compCheckEarlyMacroEval( HB_COMP_DECL, const char * szVarName, in
HB_SUPPORT_MACRODECL )
HB_COMP_PARAM->functions.pLast->iEarlyEvalPass = 0;
else
hb_compErrorCodeblock( HB_COMP_PARAM, szVarName );
hb_compErrorCodeblockDecl( HB_COMP_PARAM, szVarName );
}
}

View File

@@ -68,7 +68,7 @@ STATIC FUNCTION DefError( oError )
RETURN 0
ENDIF
// By default, retry on RDD lock error failure */
// By default, retry on RDD lock error failure
IF oError:genCode == EG_LOCK .AND. ;
oError:canRetry
// oError:tries++

View File

@@ -153,7 +153,7 @@ static PHB_GARBAGE s_pLockedBlock = NULL;
static PHB_GARBAGE s_pDeletedBlock = NULL;
/* marks if block releasing is requested during garbage collecting */
static HB_BOOL s_bCollecting = HB_FALSE;
static HB_BOOL volatile s_bCollecting = HB_FALSE;
/* flag for used/unused blocks - the meaning of the HB_GC_USED_FLAG bit
* is reversed on every collecting attempt
@@ -779,7 +779,7 @@ HB_FUNC( HB_GCALL )
*/
hb_ret();
hb_gcCollectAll( hb_pcount() < 1 || hb_parl( 1 ) );
hb_gcCollectAll( hb_parldef( 1, 1 ) );
}
#ifdef HB_GC_AUTO

View File

@@ -889,7 +889,6 @@ void hb_vmThreadInit( void * Cargo )
if( pState->pSet )
{
/* TODO: add set sharing */
memcpy( hb_stackSetStruct(), pState->pSet, sizeof( HB_SET_STRUCT ) );
hb_xfree( pState->pSet );
pState->pSet = NULL;
@@ -9021,11 +9020,26 @@ HB_BOOL hb_vmRequestReenterExt( void )
if( hb_stackId() == NULL )
{
uiAction = HB_VMSTACK_REQUESTED;
/* TODO: add protection against executing hb_threadStateNew()
* during GC pass
*/
/* protection against executing hb_threadStateNew() during GC pass */
HB_VM_LOCK();
for( ;; )
{
if( hb_vmThreadRequest & HB_THREQUEST_STOP )
hb_threadCondWait( &s_vmCond, &s_vmMtx );
else
break;
}
s_iRunningCount++;
HB_VM_UNLOCK();
hb_vmThreadInit( NULL );
HB_STACK_TLS_RELOAD
HB_VM_LOCK();
s_iRunningCount--;
hb_threadCondBroadcast( &s_vmCond );
HB_VM_UNLOCK();
}
else
{