2006-09-10 13:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapi.h
* harbour/source/vm/hvm.c
* harbour/source/vm/codebloc.c
* harbour/source/vm/arrays.c
* moved static base offset from hb_struBlock structure
to HB_CODEBLOCK structure
+ added hclass member to hb_struBlock - it will be used in
the future for checking codeblock scope in classy so we will
real scope checking also for messages sent from codeblocks.
- removed supercast and superoffset members from hb_struArray
structure.
* harbour/include/hbclass.ch
* added class(y) like
@:<MessageName>([<MsgParams,...>])
send operator. It's not exactly the same as in class(y) where
this operator is hardcoded to executing function directly,
needs method name instead of message name and is linked statically.
In Harbour this operator uses message name so can be used also for
instance variables and make dynamic casting to the class from which
current method is inherited. In short words sending messages to @:
instead of :: causes that they work like non-virtual messages in
C++ mode.
If you do not use the same method body in different classes
then you can also use explicitly self casting:
::<myclass>:<msgname>[(...)]
and it will be a little bit faster
* harbour/include/hboo.ch
+ added: HB_OO_MSG_ASSIGN, HB_OO_MSG_ACCESS,
HB_OO_MSG_CLSASSIGN, HB_OO_MSG_CLSACCESS
They should be used insted of HB_OO_MSG_DATA and HB_OO_MSG_CLSDATA
This resolves problems with name conflicts when we were detecting
type of message (ACCESS/ASSIGN) by checking the first character
in message name. F.e. now it's possible to create exported instance
variable called __WithObject and it will be used in all WITH OBJECT
statement instead of the base object value. It's simple and effective
WITH OBJECT overloading.
I kept backward compatibility for HB_OO_MSG_DATA and HB_OO_MSG_CLSDATA
but I strongly suggest to update code to use new constants.
+ added HB_OO_MSG_REALCLASS
* harbour/source/rtl/objfunc.prg
* harbour/source/rtl/tobject.prg
* harbour/source/rtl/tclass.prg
* use HB_OO_MSG_[CLS]{ASSIGN,ACCESS} instead of HB_OO_MSG_[CLS]DATA
* harbour/source/rtl/tclass.prg
+ added REALCLASS message to creted classes - it's used for @: operator
* harbour/source/vm/classes.c
* updated for above modifications
* calculate instance area offset in supercasting dynamically - it
will allow to eliminate multiple instance area allocating when
in the inheritance tree the same class exists more then once and
also quite easy add support for non-virtual messages.
! fixed GPF in __CLSINSTSUPER() class function generate HVM exception
% do not inherit unaccessible inline blocks
* some other minor optimization, fixes and code cleanups
* harbour/source/rdd/usrrdd/usrrdd.c
! fixed HB_TRACE message
* harbour/source/rtl/errorapi.c
! generate internal error if ErrorNew() function does not return an object
This commit is contained in:
@@ -8,6 +8,73 @@
|
||||
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2006-09-10 14:02 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/ChangeLog
|
||||
! added missing changelog entry about __MVPUT() fix
|
||||
|
||||
* harbour/source/vm/itemapi.c
|
||||
* removed redundant pItem->type = HB_IT_NIL (thanks for Manu Exposito)
|
||||
|
||||
2006-09-10 14:02 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/ChangeLog
|
||||
! added missing changelog entry about __MVPUT() fix
|
||||
|
||||
* harbour/source/vm/itemapi.c
|
||||
* removed redundant pItem->type = HB_IT_NIL (thanks for Manu Exposito)
|
||||
|
||||
2006-09-10 13:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbapi.h
|
||||
* harbour/source/vm/hvm.c
|
||||
* harbour/source/vm/codebloc.c
|
||||
* harbour/source/vm/arrays.c
|
||||
* moved static base offset from hb_struBlock structure
|
||||
to HB_CODEBLOCK structure
|
||||
+ added hclass member to hb_struBlock - it will be used in
|
||||
the future for checking codeblock scope in classy so we will
|
||||
real scope checking also for messages sent from codeblocks.
|
||||
- removed supercast and superoffset members from hb_struArray
|
||||
structure.
|
||||
|
||||
* harbour/include/hbclass.ch
|
||||
* added class(y) like
|
||||
@:<MessageName>([<MsgParams,...>])
|
||||
send operator. It's not exactly the same as in class(y) where
|
||||
this operator is hardcoded to executing function directly,
|
||||
needs method name instead of message name and is linked statically.
|
||||
In Harbour this operator uses message name so can be used also for
|
||||
instance variables and make dynamic casting to the class from which
|
||||
current method is inherited. In short words sending messages to @:
|
||||
instead of :: causes that they work like non-virtual messages in
|
||||
C++ mode.
|
||||
If you do not use the same method body in different classes
|
||||
then you can also use explicitly self casting:
|
||||
::<myclass>:<msgname>[(...)]
|
||||
and it will be a little bit faster
|
||||
|
||||
* harbour/include/hboo.ch
|
||||
+ added: HB_OO_MSG_ASSIGN, HB_OO_MSG_ACCESS,
|
||||
HB_OO_MSG_CLSASSIGN, HB_OO_MSG_CLSACCESS
|
||||
They should be used insted of HB_OO_MSG_DATA and HB_OO_MSG_CLSDATA
|
||||
This resolves problems with name conflicts when we were detecting
|
||||
type of message (ACCESS/ASSIGN) by checking the first character
|
||||
in message name. F.e. now it's possible to create exported instance
|
||||
variable called __WithObject and it will be used in all WITH OBJECT
|
||||
statement instead of the base object value. It's simple and effective
|
||||
WITH OBJECT overloading.
|
||||
I kept backward compatibility for HB_OO_MSG_DATA and HB_OO_MSG_CLSDATA
|
||||
but I strongly suggest to update code to use new constants.
|
||||
+ added HB_OO_MSG_REALCLASS
|
||||
|
||||
* harbour/source/rtl/objfunc.prg
|
||||
* harbour/source/rtl/tobject.prg
|
||||
* harbour/source/rtl/tclass.prg
|
||||
* use HB_OO_MSG_[CLS]{ASSIGN,ACCESS} instead of HB_OO_MSG_[CLS]DATA
|
||||
|
||||
* harbour/source/rtl/tclass.prg
|
||||
+ added REALCLASS message to creted classes - it's used for @: operator
|
||||
|
||||
* harbour/source/vm/classes.c
|
||||
* updated for above modifications
|
||||
! fixed GPF in __CLSINSTSUPER() class function generate HVM exception
|
||||
% do not inherit unaccessible inline blocks
|
||||
* some other minor optimization, fixes and code cleanups
|
||||
|
||||
@@ -238,16 +238,14 @@ typedef struct _HB_STACK_STATE
|
||||
struct hb_struArray
|
||||
{
|
||||
struct _HB_BASEARRAY * value;
|
||||
USHORT supercast;
|
||||
USHORT superoffset;
|
||||
};
|
||||
|
||||
struct hb_struBlock
|
||||
{
|
||||
LONG statics;
|
||||
struct _HB_CODEBLOCK * value;
|
||||
USHORT lineno;
|
||||
USHORT paramcnt;
|
||||
struct _HB_CODEBLOCK * value;
|
||||
USHORT hclass;
|
||||
};
|
||||
|
||||
struct hb_struDate
|
||||
@@ -363,6 +361,7 @@ typedef struct _HB_CODEBLOCK
|
||||
PHB_SYMB pSymbols; /* codeblocks symbols */
|
||||
PHB_SYMB pDefSymb; /* symbol where the codeblock was created */
|
||||
PHB_ITEM pLocals; /* table with referenced local variables */
|
||||
LONG lStatics; /* STATICs base address */
|
||||
USHORT uiLocals; /* number of referenced local variables */
|
||||
SHORT dynBuffer; /* is pcode buffer allocated dynamically, SHORT used instead of BOOL intentionally to force optimal alignment */
|
||||
} HB_CODEBLOCK, * PHB_CODEBLOCK, * HB_CODEBLOCK_PTR;
|
||||
|
||||
@@ -150,6 +150,10 @@ DECLARE HBClass ;
|
||||
#xtranslate CREATE CLASS => CLASS
|
||||
#xtranslate _HB_MEMBER {AS Num => _HB_MEMBER {AS Numeric
|
||||
#xtranslate _HB_MEMBER {AS Char => _HB_MEMBER {AS Character
|
||||
|
||||
#translate @:<MessageName>([<MsgParams,...>]) => ;
|
||||
::realclass:<MessageName>([<MsgParams>])
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HB_CLS_ALLOWCLASS /* DONT DECLARE IT ! WORK IN PROGRESS !!! */
|
||||
|
||||
@@ -93,7 +93,13 @@
|
||||
#define HB_OO_MSG_SUPER 5
|
||||
#define HB_OO_MSG_ONERROR 6
|
||||
#define HB_OO_MSG_CLSMTHD 7 /* for the future */
|
||||
#define HB_OO_MSG_INITIALIZED 8
|
||||
#define HB_OO_MSG_ASSIGN 8
|
||||
#define HB_OO_MSG_ACCESS 9
|
||||
#define HB_OO_MSG_CLSASSIGN 10
|
||||
#define HB_OO_MSG_CLSACCESS 11
|
||||
#define HB_OO_MSG_REALCLASS 12
|
||||
#define HB_OO_MSG_INITIALIZED 13
|
||||
|
||||
/* Data */
|
||||
#define HB_OO_DATA_SYMBOL 1
|
||||
#define HB_OO_DATA_VALUE 2
|
||||
|
||||
@@ -2305,7 +2305,7 @@ static ERRCODE hb_usrFilterText( AREAP pArea, PHB_ITEM pFilter )
|
||||
{
|
||||
LONG lOffset;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_usrFilterText(%p,%hu,%p)", pArea, uiRelNo, pFilter));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_usrFilterText(%p,%p)", pArea, pFilter));
|
||||
|
||||
lOffset = hb_stackTopOffset() - hb_stackBaseOffset();
|
||||
hb_vmPush( pFilter );
|
||||
|
||||
@@ -176,7 +176,11 @@ PHB_ITEM hb_errNew( void )
|
||||
hb_vmPushNil();
|
||||
hb_vmDo( 0 );
|
||||
|
||||
hb_itemCopy( pReturn, hb_stackReturnItem() );
|
||||
hb_itemMove( pReturn, hb_stackReturnItem() );
|
||||
if( ! HB_IS_OBJECT( pReturn ) )
|
||||
{
|
||||
hb_errInternal( HB_EI_ERRRECFAILURE, NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
return pReturn;
|
||||
}
|
||||
@@ -215,7 +219,7 @@ USHORT hb_errLaunch( PHB_ITEM pError )
|
||||
*/
|
||||
s_errorHandler->Error = pError;
|
||||
s_errorHandler->ErrorBlock = s_errorBlock;
|
||||
pResult = (s_errorHandler->Func)( s_errorHandler );
|
||||
pResult = ( s_errorHandler->Func )( s_errorHandler );
|
||||
s_errorHandler->Error = NULL;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -211,8 +211,8 @@ FUNCTION __objAddData( oObject, cSymbol )
|
||||
ELSEIF !__objHasMsg( oObject, cSymbol ) .AND. !__objHasMsg( oObject, "_" + cSymbol )
|
||||
hClass := oObject:ClassH
|
||||
nSeq := __cls_IncData( hClass ) // Allocate new Seq#
|
||||
__clsAddMsg( hClass, cSymbol, nSeq, HB_OO_MSG_DATA, NIL, 1 )
|
||||
__clsAddMsg( hClass, "_" + cSymbol, nSeq, HB_OO_MSG_DATA, NIL, 1 )
|
||||
__clsAddMsg( hClass, cSymbol, nSeq, HB_OO_MSG_ACCESS, NIL, 1 )
|
||||
__clsAddMsg( hClass, "_" + cSymbol, nSeq, HB_OO_MSG_ASSIGN, NIL, 1 )
|
||||
ENDIF
|
||||
|
||||
RETURN oObject
|
||||
|
||||
@@ -101,28 +101,28 @@ FUNCTION HBClass()
|
||||
__clsAddMsg( s_hClass, "InitClass" , @InitClass() , HB_OO_MSG_METHOD )
|
||||
__clsAddMsg( s_hClass, "cSuper" , {| Self | iif( ::acSuper == NIL .OR. Len( ::acSuper ) == 0, NIL, ::acSuper[ 1 ] ) }, HB_OO_MSG_INLINE )
|
||||
__clsAddMsg( s_hClass, "_cSuper" , {| Self, xVal | iif( ::acSuper == NIL .OR. Len( ::acSuper ) == 0, ( ::acSuper := { xVal } ), ::acSuper[ 1 ] := xVal ), xVal }, HB_OO_MSG_INLINE )
|
||||
__clsAddMsg( s_hClass, "hClass" , 1, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "_hClass" , 1, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "cName" , 2, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "_cName" , 2, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "aDatas" , 3, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "_aDatas" , 3, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "aMethods" , 4, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "_aMethods" , 4, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "aClsDatas" , 5, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "_aClsDatas" , 5, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "aClsMethods" , 6, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "_aClsMethods" , 6, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "aInlines" , 7, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "_aInlines" , 7, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "aVirtuals" , 8, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "_aVirtuals" , 8, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "acSuper" , 9, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "_acSuper" , 9, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "nOnError" , 10, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "_nOnError" , 10, HB_OO_MSG_DATA )
|
||||
/* __clsAddMsg( s_hClass, "class" , 11, HB_OO_MSG_DATA )
|
||||
__clsAddMsg( s_hClass, "_class" , 11, HB_OO_MSG_DATA ) */
|
||||
__clsAddMsg( s_hClass, "hClass" , 1, HB_OO_MSG_ACCESS )
|
||||
__clsAddMsg( s_hClass, "_hClass" , 1, HB_OO_MSG_ASSIGN )
|
||||
__clsAddMsg( s_hClass, "cName" , 2, HB_OO_MSG_ACCESS )
|
||||
__clsAddMsg( s_hClass, "_cName" , 2, HB_OO_MSG_ASSIGN )
|
||||
__clsAddMsg( s_hClass, "aDatas" , 3, HB_OO_MSG_ACCESS )
|
||||
__clsAddMsg( s_hClass, "_aDatas" , 3, HB_OO_MSG_ASSIGN )
|
||||
__clsAddMsg( s_hClass, "aMethods" , 4, HB_OO_MSG_ACCESS )
|
||||
__clsAddMsg( s_hClass, "_aMethods" , 4, HB_OO_MSG_ASSIGN )
|
||||
__clsAddMsg( s_hClass, "aClsDatas" , 5, HB_OO_MSG_ACCESS )
|
||||
__clsAddMsg( s_hClass, "_aClsDatas" , 5, HB_OO_MSG_ASSIGN )
|
||||
__clsAddMsg( s_hClass, "aClsMethods" , 6, HB_OO_MSG_ACCESS )
|
||||
__clsAddMsg( s_hClass, "_aClsMethods" , 6, HB_OO_MSG_ASSIGN )
|
||||
__clsAddMsg( s_hClass, "aInlines" , 7, HB_OO_MSG_ACCESS )
|
||||
__clsAddMsg( s_hClass, "_aInlines" , 7, HB_OO_MSG_ASSIGN )
|
||||
__clsAddMsg( s_hClass, "aVirtuals" , 8, HB_OO_MSG_ACCESS )
|
||||
__clsAddMsg( s_hClass, "_aVirtuals" , 8, HB_OO_MSG_ASSIGN )
|
||||
__clsAddMsg( s_hClass, "acSuper" , 9, HB_OO_MSG_ACCESS )
|
||||
__clsAddMsg( s_hClass, "_acSuper" , 9, HB_OO_MSG_ASSIGN )
|
||||
__clsAddMsg( s_hClass, "nOnError" , 10, HB_OO_MSG_ACCESS )
|
||||
__clsAddMsg( s_hClass, "_nOnError" , 10, HB_OO_MSG_ASSIGN )
|
||||
/* __clsAddMsg( s_hClass, "class" , 11, HB_OO_MSG_ACCESS )
|
||||
__clsAddMsg( s_hClass, "_class" , 11, HB_OO_MSG_ASSIGN ) */
|
||||
|
||||
ENDIF
|
||||
|
||||
@@ -205,7 +205,8 @@ STATIC PROCEDURE Create()
|
||||
nClassBegin += __cls_CntClsData( ahSuper[ n ] ) // Get offset for new ClassData
|
||||
NEXT
|
||||
ENDIF
|
||||
__clsAddMsg( hClass, ::cName , 0, HB_OO_MSG_SUPER, hClass, HB_OO_CLSTP_EXPORTED )
|
||||
__clsAddMsg( hClass, ::cName , 0, HB_OO_MSG_SUPER , hClass, HB_OO_CLSTP_EXPORTED )
|
||||
__clsAddMsg( hClass, "REALCLASS" , 0, HB_OO_MSG_REALCLASS, 0 , HB_OO_CLSTP_EXPORTED )
|
||||
|
||||
::hClass := hClass
|
||||
|
||||
@@ -221,10 +222,10 @@ STATIC PROCEDURE Create()
|
||||
|
||||
FOR n := 1 TO nLenDatas
|
||||
__clsAddMsg( hClass, ::aDatas[ n ][ HB_OO_DATA_SYMBOL ] , n + nDataBegin, ;
|
||||
HB_OO_MSG_DATA, ::aDatas[ n ][ HB_OO_DATA_VALUE ], ::aDatas[ n ][ HB_OO_DATA_SCOPE ],;
|
||||
HB_OO_MSG_ACCESS, ::aDatas[ n ][ HB_OO_DATA_VALUE ], ::aDatas[ n ][ HB_OO_DATA_SCOPE ],;
|
||||
::aDatas[ n ][ HB_OO_DATA_PERSISTENT ] )
|
||||
__clsAddMsg( hClass, "_" + ::aDatas[ n ][ HB_OO_DATA_SYMBOL ] , n + nDataBegin, ;
|
||||
HB_OO_MSG_DATA, , ::aDatas[ n ][ HB_OO_DATA_SCOPE ] )
|
||||
HB_OO_MSG_ASSIGN, , ::aDatas[ n ][ HB_OO_DATA_SCOPE ] )
|
||||
NEXT
|
||||
|
||||
nLen := Len( ::aMethods )
|
||||
@@ -236,9 +237,9 @@ STATIC PROCEDURE Create()
|
||||
nLen := Len( ::aClsDatas )
|
||||
FOR n := 1 TO nLen
|
||||
__clsAddMsg( hClass, ::aClsDatas[ n ][ HB_OO_CLSD_SYMBOL ] , n + nClassBegin,;
|
||||
HB_OO_MSG_CLASSDATA, ::aClsDatas[ n ][ HB_OO_CLSD_VALUE ], ::aClsDatas[ n ][ HB_OO_CLSD_SCOPE ] )
|
||||
HB_OO_MSG_CLSACCESS, ::aClsDatas[ n ][ HB_OO_CLSD_VALUE ], ::aClsDatas[ n ][ HB_OO_CLSD_SCOPE ] )
|
||||
__clsAddMsg( hClass, "_" + ::aClsDatas[ n ][ HB_OO_CLSD_SYMBOL ], n + nClassBegin,;
|
||||
HB_OO_MSG_CLASSDATA, , ::aClsDatas[ n ][ HB_OO_CLSD_SCOPE ] )
|
||||
HB_OO_MSG_CLSASSIGN, , ::aClsDatas[ n ][ HB_OO_CLSD_SCOPE ] )
|
||||
NEXT
|
||||
|
||||
nLen := Len( ::aInlines )
|
||||
|
||||
@@ -107,8 +107,8 @@ FUNCTION HBObject()
|
||||
/*s_oClass:AddMultiData(,,nScope,{"CLASS"}, .F. )*/
|
||||
|
||||
/*s_oClass:AddInline( "ADDMETHOD" , { | Self, cMeth, pFunc, nScopeMeth | __clsAddMsg( __CLASSH( Self ) , cMeth , pFunc ,HB_OO_MSG_METHOD , NIL, iif(nScopeMeth==NIL,1,nScopeMeth) ) }, nScope ) */
|
||||
/*s_oClass:AddInline( "ADDVAR" , { | Self, cVAR, nScopeMeth, uiData , hClass | __clsAddMsg( hClass:=__CLASSH( Self ) , cVar , uidata := __CLS_INCDATA(hClass) , HB_OO_MSG_DATA, NIL , iif(nScopeMeth==NIL,1,nScopeMeth) ) , ; */
|
||||
/* __clsAddMsg( hClass , "_"+cVar , uiData , HB_OO_MSG_DATA, NIL , iif(nScopeMeth==NIL,1,nScopeMeth) ) }, nScope ) */
|
||||
/*s_oClass:AddInline( "ADDVAR" , { | Self, cVAR, nScopeMeth, uiData , hClass | __clsAddMsg( hClass:=__CLASSH( Self ) , cVar , uidata := __CLS_INCDATA(hClass) , HB_OO_MSG_ACCESS, NIL , iif(nScopeMeth==NIL,1,nScopeMeth) ) , ; */
|
||||
/* __clsAddMsg( hClass , "_"+cVar , uiData , HB_OO_MSG_ASSIGN, NIL , iif(nScopeMeth==NIL,1,nScopeMeth) ) }, nScope ) */
|
||||
|
||||
/* Those one exist within Class(y), so we will probably try to implement it */
|
||||
|
||||
|
||||
@@ -134,7 +134,6 @@ HB_EXPORT BOOL hb_arrayNew( PHB_ITEM pItem, ULONG ulLen ) /* creates a new array
|
||||
|
||||
pItem->type = HB_IT_ARRAY;
|
||||
pItem->item.asArray.value = pBaseArray;
|
||||
pItem->item.asArray.superoffset = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -210,6 +210,7 @@ HB_CODEBLOCK_PTR hb_codeblockNew( const BYTE * pBuffer,
|
||||
pCBlock->dynBuffer = usLen != 0;
|
||||
pCBlock->pDefSymb = hb_stackBaseItem()->item.asSymbol.value;
|
||||
pCBlock->pSymbols = pSymbols;
|
||||
pCBlock->lStatics = hb_stackGetStaticsBase();
|
||||
pCBlock->uiLocals = uiLocals;
|
||||
pCBlock->pLocals = pLocals;
|
||||
|
||||
@@ -240,12 +241,13 @@ HB_CODEBLOCK_PTR hb_codeblockMacroNew( BYTE * pBuffer, USHORT usLen )
|
||||
|
||||
pCBlock = ( HB_CODEBLOCK_PTR ) hb_gcAlloc( sizeof( HB_CODEBLOCK ), hb_codeblockDeleteGarbage );
|
||||
/* Store the number of referenced local variables */
|
||||
pCBlock->uiLocals = 0;
|
||||
pCBlock->pLocals = NULL;
|
||||
pCBlock->pCode = pCode;
|
||||
pCBlock->dynBuffer = TRUE;
|
||||
pCBlock->pDefSymb = hb_stackBaseItem()->item.asSymbol.value;
|
||||
pCBlock->pSymbols = NULL; /* macro-compiled codeblock cannot acces a local symbol table */
|
||||
pCBlock->lStatics = hb_stackGetStaticsBase();
|
||||
pCBlock->uiLocals = 0;
|
||||
pCBlock->pLocals = NULL;
|
||||
|
||||
HB_TRACE(HB_TR_INFO, ("codeblock created %p", pCBlock));
|
||||
|
||||
@@ -262,7 +264,7 @@ void hb_codeblockEvaluate( HB_ITEM_PTR pItem )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_codeblockEvaluate(%p)", pItem));
|
||||
|
||||
hb_stackSetStaticsBase( pItem->item.asBlock.statics );
|
||||
hb_stackSetStaticsBase( pItem->item.asBlock.value->lStatics );
|
||||
hb_vmExecute( pItem->item.asBlock.value->pCode, pItem->item.asBlock.value->pSymbols );
|
||||
}
|
||||
|
||||
|
||||
@@ -4633,16 +4633,13 @@ static void hb_vmPushBlock( const BYTE * pCode, PHB_SYMB pSymbols, USHORT usLen
|
||||
usLen );
|
||||
|
||||
pItem->type = HB_IT_BLOCK;
|
||||
|
||||
/* store the statics base of function where the codeblock was defined
|
||||
*/
|
||||
pItem->item.asBlock.statics = hb_stackGetStaticsBase();
|
||||
/* store the number of expected parameters
|
||||
*/
|
||||
pItem->item.asBlock.paramcnt = HB_PCODE_MKUSHORT( pCode );
|
||||
/* store the line number where the codeblock was defined
|
||||
*/
|
||||
pItem->item.asBlock.lineno = hb_stackBaseItem()->item.asSymbol.lineno;
|
||||
pItem->item.asBlock.hclass = hb_stackBaseItem()->item.asSymbol.stackstate->uiClass;
|
||||
}
|
||||
|
||||
/* -2 -> HB_P_PUSHBLOCKSHORT
|
||||
@@ -4666,15 +4663,13 @@ static void hb_vmPushBlockShort( const BYTE * pCode, PHB_SYMB pSymbols, USHORT u
|
||||
|
||||
pItem->type = HB_IT_BLOCK;
|
||||
|
||||
/* store the statics base of function where the codeblock was defined
|
||||
*/
|
||||
pItem->item.asBlock.statics = hb_stackGetStaticsBase();
|
||||
/* store the number of expected parameters
|
||||
*/
|
||||
pItem->item.asBlock.paramcnt = 0;
|
||||
/* store the line number where the codeblock was defined
|
||||
*/
|
||||
pItem->item.asBlock.lineno = hb_stackBaseItem()->item.asSymbol.lineno;
|
||||
pItem->item.asBlock.hclass = hb_stackBaseItem()->item.asSymbol.stackstate->uiClass;
|
||||
}
|
||||
|
||||
/* +0 -> HB_P_MPUSHBLOCK
|
||||
@@ -4696,15 +4691,13 @@ static void hb_vmPushMacroBlock( BYTE * pCode, PHB_SYMB pSymbols )
|
||||
|
||||
pItem->type = HB_IT_BLOCK;
|
||||
|
||||
/* store the statics base of function where the codeblock was defined
|
||||
*/
|
||||
pItem->item.asBlock.statics = hb_stackGetStaticsBase();
|
||||
/* store the number of expected parameters
|
||||
*/
|
||||
pItem->item.asBlock.paramcnt = HB_PCODE_MKUSHORT( &( pCode[ 3 ] ) );
|
||||
/* store the line number where the codeblock was defined
|
||||
*/
|
||||
pItem->item.asBlock.lineno = hb_stackBaseItem()->item.asSymbol.lineno;
|
||||
pItem->item.asBlock.hclass = hb_stackBaseItem()->item.asSymbol.stackstate->uiClass;
|
||||
}
|
||||
|
||||
/* pushes current workarea number on the eval stack
|
||||
@@ -5612,7 +5605,7 @@ HB_EXPORT PHB_SYMB hb_vmProcessSymbolsEx( PHB_SYMB pSymbols, USHORT uiModuleSymb
|
||||
char * szModuleName, ULONG ulID,
|
||||
USHORT uiPCodeVer )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_vmProcessSymbolsEx(%p,%hu,%s,%lu,%hu)", pSymbols, uiModuleSymbols, szModuleName, ulID, uiPcodeVer));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_vmProcessSymbolsEx(%p,%hu,%s,%lu,%hu)", pSymbols, uiModuleSymbols, szModuleName, ulID, uiPCodeVer));
|
||||
|
||||
if( uiPCodeVer != 0 )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user