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

@@ -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 );
}
}