2009-03-01 13:58 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapi.h
* harbour/include/hbstack.h
* harbour/source/vm/hvm.c
* harbour/source/vm/estack.c
* harbour/source/vm/memvars.c
! fixed __M[V]CLEAR()/ __M[V]RESTORE() to be exactly Clipper compatible
and do not release PUBLIC GetList value. Here it's small example
which illustrates current behavior and exploits bug in previous
version:
memvar getlist
proc main()
getlist:="public:getlist"
? getlist
private getlist:="private:getlist"
? getlist
CLEAR MEMORY
? getlist
return
* harbour/source/compiler/gencc.c
+ added Harbour exception to the license - it's mine code with
few lines added/modified by Ryszard and Viktor. I hope they do
not have anything against.
* harbour/source/compiler/hbmain.c
* harbour/source/compiler/hbident.c
* minor formatting
This commit is contained in:
@@ -8,6 +8,35 @@
|
||||
2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
|
||||
*/
|
||||
|
||||
2009-03-01 13:58 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbapi.h
|
||||
* harbour/include/hbstack.h
|
||||
* harbour/source/vm/hvm.c
|
||||
* harbour/source/vm/estack.c
|
||||
* harbour/source/vm/memvars.c
|
||||
! fixed __M[V]CLEAR()/ __M[V]RESTORE() to be exactly Clipper compatible
|
||||
and do not release PUBLIC GetList value. Here it's small example
|
||||
which illustrates current behavior and exploits bug in previous
|
||||
version:
|
||||
memvar getlist
|
||||
proc main()
|
||||
getlist:="public:getlist"
|
||||
? getlist
|
||||
private getlist:="private:getlist"
|
||||
? getlist
|
||||
CLEAR MEMORY
|
||||
? getlist
|
||||
return
|
||||
|
||||
* harbour/source/compiler/gencc.c
|
||||
+ added Harbour exception to the license - it's mine code with
|
||||
few lines added/modified by Ryszard and Viktor. I hope they do
|
||||
not have anything against.
|
||||
|
||||
* harbour/source/compiler/hbmain.c
|
||||
* harbour/source/compiler/hbident.c
|
||||
* minor formatting
|
||||
|
||||
2009-02-28 15:51 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
|
||||
* harbour/contrib/gtwvg/common.mak
|
||||
* harbour/contrib/gtwvg/Makefile
|
||||
|
||||
@@ -931,7 +931,7 @@ extern PHB_ITEM hb_codeblockGetRef( HB_CODEBLOCK_PTR pCBlock, LONG iItem
|
||||
extern void hb_codeblockEvaluate( HB_ITEM_PTR pItem ); /* evaluate a codeblock */
|
||||
|
||||
/* memvars subsystem */
|
||||
extern void hb_memvarsClear( void ); /* clear all PUBLIC and PRIVATE variables */
|
||||
extern void hb_memvarsClear( BOOL fAll ); /* clear all PUBLIC and PRIVATE variables optionally without GetList PUBLIC variable */
|
||||
extern void hb_memvarSetValue( PHB_SYMB pMemvarSymb, HB_ITEM_PTR pItem ); /* copy an item into a symbol */
|
||||
extern HB_ERRCODE hb_memvarGet( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb ); /* copy an symbol value into an item */
|
||||
extern void hb_memvarGetValue( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb ); /* copy an symbol value into an item, with error trapping */
|
||||
|
||||
@@ -334,7 +334,7 @@ extern void hb_stackIsStackRef( void *, PHB_TSD_FUNC );
|
||||
extern void hb_stackIdSetActionRequest( void * pStackID, USHORT uiAction );
|
||||
extern PHB_DYN_HANDLES hb_stackGetDynHandle( PHB_DYNS pDynSym );
|
||||
extern int hb_stackDynHandlesCount( void );
|
||||
extern void hb_stackClearMemvars( void );
|
||||
extern void hb_stackClearMemvars( int );
|
||||
extern BOOL hb_stackQuitState( void );
|
||||
extern void hb_stackSetQuitState( USHORT uiState );
|
||||
extern int hb_stackUnlock( void );
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
* Harbour Project source code:
|
||||
* Compiler C source with real code generation
|
||||
*
|
||||
* Copyright 2006 Przemyslaw Czerpak < druzus /at/ priv.onet.pl >
|
||||
* Copyright 2006-2009 Przemyslaw Czerpak < druzus /at/ priv.onet.pl >
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -20,9 +20,33 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ static HB_HASH_FUNC( hb_comp_IdentKey ) /* ULONG func (void *Value, void *Car
|
||||
{
|
||||
ULONG ulSum = 0;
|
||||
const char *szName = ( char * )Value;
|
||||
|
||||
|
||||
while( *szName )
|
||||
ulSum += *szName++;
|
||||
|
||||
|
||||
@@ -4078,9 +4078,9 @@ static int hb_compCompile( HB_COMP_DECL, const char * szPrg, int iFileType )
|
||||
hb_compOutputFile( HB_COMP_PARAM );
|
||||
|
||||
pFunPtr = &HB_COMP_PARAM->functions.pFirst;
|
||||
/* skip first non-startup procedure */
|
||||
if( ! HB_COMP_PARAM->fStartProc )
|
||||
{
|
||||
/* skip first non-startup procedure */
|
||||
hb_compOptimizeFrames( HB_COMP_PARAM, *pFunPtr );
|
||||
pFunPtr = &(*pFunPtr)->pNext;
|
||||
HB_COMP_PARAM->iFunctionCnt--;
|
||||
|
||||
@@ -425,17 +425,17 @@ PHB_DYN_HANDLES hb_stackGetDynHandle( PHB_DYNS pDynSym )
|
||||
return &hb_stack.pDynH[ iDynSym - 1 ];
|
||||
}
|
||||
|
||||
void hb_stackClearMemvars( void )
|
||||
void hb_stackClearMemvars( int iExcept )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
int iDynSym;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_stackClearMemvars()"));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_stackClearMemvars(%d)", iExcept));
|
||||
|
||||
iDynSym = hb_stack.iDynH;
|
||||
while( --iDynSym >= 0 )
|
||||
{
|
||||
if( hb_stack.pDynH[ iDynSym ].pMemvar )
|
||||
if( hb_stack.pDynH[ iDynSym ].pMemvar && iDynSym != iExcept )
|
||||
{
|
||||
PHB_ITEM pMemvar = ( PHB_ITEM ) hb_stack.pDynH[ iDynSym ].pMemvar;
|
||||
hb_stack.pDynH[ iDynSym ].pMemvar = NULL;
|
||||
|
||||
@@ -817,7 +817,7 @@ void hb_vmThreadQuit( void )
|
||||
hb_stackSetActionRequest( 0 );
|
||||
hb_rddCloseAll(); /* close all workareas */
|
||||
hb_stackRemove( 1 ); /* clear stack items, leave only initial symbol item */
|
||||
hb_memvarsClear(); /* clear all PUBLIC (and PRIVATE if any) variables */
|
||||
hb_memvarsClear( TRUE ); /* clear all PUBLIC (and PRIVATE if any) variables */
|
||||
hb_vmSetI18N( NULL ); /* remove i18n translation table */
|
||||
#ifndef HB_NO_DEBUG
|
||||
hb_vmDebuggerExit( FALSE ); /* deactivate debugger */
|
||||
@@ -1038,7 +1038,7 @@ int hb_vmQuit( void )
|
||||
hb_stackSetActionRequest( 0 );
|
||||
hb_rddCloseAll(); /* close all workareas */
|
||||
hb_rddShutDown(); /* remove all registered RDD drivers */
|
||||
hb_memvarsClear(); /* clear all PUBLIC (and PRIVATE if any) variables */
|
||||
hb_memvarsClear( TRUE ); /* clear all PUBLIC (and PRIVATE if any) variables */
|
||||
hb_vmSetI18N( NULL ); /* remove i18n translation table */
|
||||
hb_i18n_exit(); /* unregister i18n module */
|
||||
|
||||
|
||||
@@ -776,32 +776,35 @@ int hb_memvarScope( char * szVarName, ULONG ulLength )
|
||||
*/
|
||||
static HB_DYNS_FUNC( hb_memvarClear )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( Cargo );
|
||||
|
||||
if( hb_dynsymGetMemvar( pDynSymbol ) )
|
||||
if( pDynSymbol != ( PHB_DYNS ) Cargo &&
|
||||
hb_dynsymGetMemvar( pDynSymbol ) )
|
||||
hb_memvarDetachDynSym( pDynSymbol, NULL );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Clear all memvar variables */
|
||||
void hb_memvarsClear( void )
|
||||
/* Clear all memvar variables optionally without GetList PUBLIC variable */
|
||||
void hb_memvarsClear( BOOL fAll )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_memvarsClear()"));
|
||||
PHB_DYNS pGetList;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_memvarsClear(%d)", ( int ) fAll));
|
||||
|
||||
pGetList = fAll ? NULL : hb_dynsymFind( "GETLIST" );
|
||||
|
||||
hb_stackClearMemvarsBase();
|
||||
hb_stackGetPrivateStack()->base = 0;
|
||||
hb_memvarSetPrivatesBase( 0 );
|
||||
#if !defined( HB_MT_VM )
|
||||
hb_dynsymEval( hb_memvarClear, NULL );
|
||||
hb_dynsymEval( hb_memvarClear, ( void * ) pGetList );
|
||||
#else
|
||||
/* this is a little bit hacked but many times faster version
|
||||
* of memvars clearing because it scans only given thread stack
|
||||
* not global dynamic symbol table. It noticeable reduce the cost
|
||||
* of HVM thread releasing.
|
||||
*/
|
||||
hb_stackClearMemvars();
|
||||
hb_stackClearMemvars( pGetList ? ( int ) pGetList->uiSymNum : -1 );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1129,7 +1132,7 @@ HB_FUNC( __MVSCOPE )
|
||||
|
||||
HB_FUNC( __MVCLEAR )
|
||||
{
|
||||
hb_memvarsClear();
|
||||
hb_memvarsClear( FALSE );
|
||||
}
|
||||
|
||||
HB_FUNC( __MVDBGINFO )
|
||||
@@ -1476,7 +1479,7 @@ HB_FUNC( __MVRESTORE )
|
||||
/* Clear all memory variables if not ADDITIVE */
|
||||
|
||||
if( ! bAdditive )
|
||||
hb_memvarsClear();
|
||||
hb_memvarsClear( FALSE );
|
||||
|
||||
/* Generate filename */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user