2009-06-17 14:06 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/compiler/hbmain.c
    * extended -n2 to work also with code without starup procedure but with
      local variables

  * harbour/utils/hbrun/hbrun.prg
    + added -n2 to compiler parameters when .prg file is compiled and
      executed. It allows to use with hbrun .prg files with and without
      startup procedure
This commit is contained in:
Przemyslaw Czerpak
2009-06-17 11:56:30 +00:00
parent c3dcec4713
commit d364d762d9
3 changed files with 24 additions and 6 deletions

View File

@@ -17,6 +17,16 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-06-17 14:06 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/compiler/hbmain.c
* extended -n2 to work also with code without starup procedure but with
local variables
* harbour/utils/hbrun/hbrun.prg
+ added -n2 to compiler parameters when .prg file is compiled and
executed. It allows to use with hbrun .prg files with and without
startup procedure
2009-06-17 13:08 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* source/rtl/hbinet.c
! Typo in 2009-06-13 23:51 UTC+0200 fixed.

View File

@@ -64,6 +64,7 @@
static int hb_compCompile( HB_COMP_DECL, const char * szPrg, int iFileType );
static int hb_compProcessRSPFile( HB_COMP_DECL, const char * ); /* process response file */
static int hb_compAutoOpen( HB_COMP_DECL, const char * szPrg, BOOL * bSkipGen, int iFileType );
static BOOL hb_compRegisterFunc( HB_COMP_DECL, const char * szFunName, HB_SYMBOLSCOPE cScope, BOOL fError );
/* ************************************************************************* */
@@ -385,14 +386,21 @@ void hb_compVariableAdd( HB_COMP_DECL, const char * szVarName, PHB_VARTYPE pVarT
PVAR pVar;
BOOL bFreeVar = TRUE;
if( ( HB_COMP_PARAM->functions.pLast->funFlags & FUN_FILE_DECL ) != 0 &&
if( ( pFunc->funFlags & FUN_FILE_DECL ) != 0 &&
( HB_COMP_PARAM->iVarScope == VS_LOCAL ||
HB_COMP_PARAM->iVarScope == ( VS_PRIVATE | VS_PARAMETER ) ) )
{
/* Variable declaration is outside of function/procedure body.
In this case only STATICs, MEMVARs and FIELDs declarations are allowed. */
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_OUTSIDE, NULL, NULL );
return;
if( HB_COMP_PARAM->iStartProc == 2 &&
HB_COMP_PARAM->functions.iCount == 1 && pFunc->szName[0] &&
hb_compRegisterFunc( HB_COMP_PARAM, pFunc->szName, pFunc->cScope, FALSE ) )
pFunc->funFlags &= ~FUN_FILE_DECL;
else
{
/* Variable declaration is outside of function/procedure body.
In this case only STATICs, MEMVARs and FIELDs declarations are allowed. */
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_OUTSIDE, NULL, NULL );
return;
}
}
/* check if we are declaring local/static variable after some

View File

@@ -107,7 +107,7 @@ PROCEDURE _APPMAIN( cFile, ... )
OTHERWISE
hb_FNameSplit( cFile, NIL, NIL, @cExt )
IF Lower( cExt ) == ".prg"
cFile := HB_COMPILEBUF( HB_ARGV( 0 ), "-n", "-w", "-es2", "-q0", ;
cFile := HB_COMPILEBUF( HB_ARGV( 0 ), "-n2", "-w", "-es2", "-q0", ;
s_aIncDir, cFile )
IF cFile == NIL
ERRORLEVEL( 1 )