2006-09-28 23:55 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/common.ch
    - removed ISSYMBOL()
  * harbour/source/rtl/tclass.prg
    * use valtype() instead of IS*()
    * some minor modifications

  * harbour/source/vm/hvm.c
    * minor modification
This commit is contained in:
Przemyslaw Czerpak
2006-09-28 21:59:09 +00:00
parent a9c4bf5568
commit e0e9dc2808
4 changed files with 38 additions and 56 deletions

View File

@@ -8,6 +8,16 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
++:&var
:&var += :&(var2+"oo")
END
+ tests/omacro.prg
+ sample file to test the new syntax
NOTICE:
For simple assigments (=,:=), compound assignments (+=,-=,*=,/=)
and for pre/post increment operators( ++,--) the macro should
evaluate to a symbol that starts with underscore '_'.
To access a variable the macro should evaluate to a symbol
with no '_' char.

View File

@@ -69,7 +69,6 @@
#translate ISMEMO( <xValue> ) => ( ValType( <xValue> ) == "M" )
#translate ISNUMBER( <xValue> ) => ( ValType( <xValue> ) == "N" )
#translate ISOBJECT( <xValue> ) => ( ValType( <xValue> ) == "O" )
#translate ISSYMBOL( <xValue> ) => ( ValType( <xValue> ) == "S" )
/* DEFAULT and UPDATE commands */
#xcommand DEFAULT <v1> TO <x1> [, <vn> TO <xn> ] => ;

View File

@@ -156,18 +156,18 @@ STATIC FUNCTION New( cClassName, xSuper, sClassFunc, lModuleFriendly )
IF Empty( xSuper )
::asSuper := {}
ELSEIF ISCHARACTER( xSuper )
ELSEIF VALTYPE( xSuper ) == "C"
::asSuper := { __DynsN2Sym( xSuper ) }
ELSEIF ISSYMBOL( xSuper )
ELSEIF VALTYPE( xSuper ) == "S"
::asSuper := { xSuper }
ELSEIF ISARRAY( xSuper )
ELSEIF VALTYPE( xSuper ) == "A"
::asSuper := {}
nSuper := Len( xSuper )
FOR i := 1 TO nSuper
IF !Empty( xSuper[ i ] )
IF ISCHARACTER( xSuper[ i ] )
IF VALTYPE( xSuper[ i ] ) == "C"
AADD( ::asSuper, __DynsN2Sym( xSuper[ i ] ) )
ELSEIF ISSYMBOL( xSuper[ i ] )
ELSEIF VALTYPE( xSuper[ i ] ) == "S"
AADD( ::asSuper, xSuper[ i ] )
ENDIF
ENDIF
@@ -306,8 +306,6 @@ RETURN oInstance
STATIC PROCEDURE AddData( cData, xInit, cType, nScope, lNoinit, lPersistent )
LOCAL Self := QSelf()
DEFAULT lNoInit TO .F.
DEFAULT lPersistent TO .F.
DEFAULT nScope TO HB_OO_CLSTP_EXPORTED
@@ -321,7 +319,7 @@ STATIC PROCEDURE AddData( cData, xInit, cType, nScope, lNoinit, lPersistent )
ENDIF
ENDIF
AAdd( ::aDatas, { cData, xInit, cType, nScope, lPersistent } )
AAdd( QSelf():aDatas, { cData, xInit, cType, nScope, lPersistent } )
RETURN
@@ -329,23 +327,14 @@ STATIC PROCEDURE AddData( cData, xInit, cType, nScope, lNoinit, lPersistent )
STATIC PROCEDURE AddMultiData( cType, xInit, nScope, aData, lNoInit, lPersistent )
LOCAL Self := QSelf()
LOCAL i
LOCAL nParam := Len( aData )
FOR i := 1 TO nParam
IF ! ISCHARACTER( aData[ i ] )
EXIT
IF VALTYPE( aData[ i ] ) == "C"
QSelf():AddData( aData[ i ], xInit, cType, nScope, lNoInit, lPersistent )
ENDIF
NEXT
IF i < nParam
nParam := i - 1
ASize( aData, nParam )
ENDIF
FOR i := 1 TO nParam
::AddData( aData[ i ], xInit, cType, nScope, lNoInit, lPersistent )
NEXT
RETURN
@@ -353,20 +342,21 @@ STATIC PROCEDURE AddMultiData( cType, xInit, nScope, aData, lNoInit, lPersistent
STATIC PROCEDURE AddClassData( cData, xInit, cType, nScope, lNoInit )
LOCAL Self := QSelf()
LOCAL c
DEFAULT lNoInit TO .F.
// Default Init for Logical and numeric
IF ! lNoInit .AND. cType != NIL .AND. xInit == NIL
IF Upper( Left( cType, 1 ) ) == "L"
c := Upper( Left( cType, 1 ) )
IF c == "L" /* Logical */
xInit := .F.
ELSEIF Upper( Left( cType, 1 ) ) $ "NI" /* Numeric Int */
ELSEIF c $ "NI" /* Numeric or Integer */
xInit := 0
ENDIF
ENDIF
AAdd( ::aClsDatas, { cData, xInit, cType, nScope } )
AAdd( QSelf():aClsDatas, { cData, xInit, cType, nScope } )
RETURN
@@ -374,23 +364,14 @@ STATIC PROCEDURE AddClassData( cData, xInit, cType, nScope, lNoInit )
STATIC PROCEDURE AddMultiClsData( cType, xInit, nScope, aData, lNoInit )
LOCAL Self := QSelf()
LOCAL i
LOCAL nParam := Len( aData )
FOR i := 1 TO nParam
IF ! ISCHARACTER( aData[ i ] )
EXIT
IF VALTYPE( aData[ i ] ) == "C"
QSelf():AddClassData( aData[ i ], xInit, cType, nScope, lNoInit )
ENDIF
NEXT
IF i < nParam
nParam := i - 1
ASize( aData, nParam )
ENDIF
FOR i := 1 TO nParam
::AddClassData( aData[ i ], xInit, cType, nScope, lNoInit )
NEXT
RETURN
@@ -398,7 +379,7 @@ STATIC PROCEDURE AddMultiClsData( cType, xInit, nScope, aData, lNoInit )
STATIC PROCEDURE AddInline( cMethod, bCode, nScope, lPersistent )
LOCAL Self := QSelf(), nAt
LOCAL nAt
DEFAULT lPersistent TO .F.
DEFAULT nScope TO HB_OO_CLSTP_EXPORTED
@@ -412,7 +393,7 @@ STATIC PROCEDURE AddInline( cMethod, bCode, nScope, lPersistent )
cMethod := RTrim( Left( cMethod, nAt - 1 ) )
ENDIF
AAdd( ::aInlines, { cMethod, bCode, nScope, lPersistent } )
AAdd( QSelf():aInlines, { cMethod, bCode, nScope, lPersistent } )
RETURN
@@ -420,7 +401,7 @@ STATIC PROCEDURE AddInline( cMethod, bCode, nScope, lPersistent )
STATIC PROCEDURE AddMethod( cMethod, nFuncPtr, nScope, lPersistent )
LOCAL Self := QSelf(), nAt
LOCAL nAt
DEFAULT lPersistent TO .F.
DEFAULT nScope TO HB_OO_CLSTP_EXPORTED
@@ -434,7 +415,7 @@ STATIC PROCEDURE AddMethod( cMethod, nFuncPtr, nScope, lPersistent )
cMethod := RTrim( Left( cMethod, nAt - 1 ) )
ENDIF
AAdd( ::aMethods, { cMethod, nFuncPtr, nScope, lPersistent } )
AAdd( QSelf():aMethods, { cMethod, nFuncPtr, nScope, lPersistent } )
RETURN
@@ -442,14 +423,14 @@ STATIC PROCEDURE AddMethod( cMethod, nFuncPtr, nScope, lPersistent )
STATIC PROCEDURE AddClsMethod( cMethod, nFuncPtr, nScope )
LOCAL Self := QSelf(), nAt
LOCAL nAt
/* Remove possible ( <x,...> )*/
IF ( nAt := At( "(", cMethod ) ) > 0
cMethod := RTrim( Left( cMethod, nAt - 1 ) )
ENDIF
AAdd( ::aClsMethods, { cMethod, nFuncPtr, nScope } )
AAdd( QSelf():aClsMethods, { cMethod, nFuncPtr, nScope } )
RETURN
@@ -457,14 +438,14 @@ STATIC PROCEDURE AddClsMethod( cMethod, nFuncPtr, nScope )
STATIC PROCEDURE AddVirtual( cMethod )
LOCAL Self := QSelf(), nAt
LOCAL nAt
/* Remove possible ( <x,...> )*/
IF ( nAt := At( "(", cMethod ) ) > 0
cMethod := RTrim( Left( cMethod, nAt - 1 ) )
ENDIF
AAdd( ::aVirtuals, cMethod )
AAdd( QSelf():aVirtuals, cMethod )
RETURN
@@ -492,17 +473,13 @@ STATIC PROCEDURE AddFriendFunc( ... )
STATIC PROCEDURE SetOnError( nFuncPtr )
LOCAL Self := QSelf()
::nOnError := nFuncPtr
QSelf():nOnError := nFuncPtr
RETURN
STATIC PROCEDURE SetDestructor( nFuncPtr )
LOCAL Self := QSelf()
::nDestructor := nFuncPtr
QSelf():nDestructor := nFuncPtr
RETURN
@@ -510,9 +487,7 @@ STATIC PROCEDURE SetDestructor( nFuncPtr )
STATIC FUNCTION InitClass()
LOCAL Self := QSelf()
RETURN Self
RETURN QSelf()
//----------------------------------------------------------------------------//

View File

@@ -4171,10 +4171,9 @@ HB_EXPORT void hb_vmDo( USHORT uiParams )
HB_EXPORT void hb_vmSend( USHORT uiParams )
{
PHB_ITEM pItem;
HB_STACK_STATE sStackState;
PHB_SYMB pSym;
PHB_SYMB pExecSym;
HB_STACK_STATE sStackState;
PHB_ITEM pSelf;
BOOL bDebugPrevState;
#ifndef HB_NO_PROFILER
@@ -4195,8 +4194,7 @@ HB_EXPORT void hb_vmSend( USHORT uiParams )
#endif
*/
pItem = hb_stackNewFrame( &sStackState, uiParams ); /* procedure name */
pSym = pItem->item.asSymbol.value;
pSym = hb_stackNewFrame( &sStackState, uiParams )->item.asSymbol.value;
pSelf = hb_stackSelfItem(); /* NIL, OBJECT or BLOCK */
bDebugPrevState = s_bDebugging;
s_bDebugging = FALSE;