Files
harbour-core/tests/omacro.prg
vszakats 9687850865 2013-03-16 02:10 UTC+0100 Viktor Szakats (harbour syenar.net)
* (all files)
    * stripped svn header
    * minor cleanups
    ; use following command to find out the history of files:
       git log
       git log --follow
       git blame
       git annotate
2013-03-16 02:11:42 +01:00

51 lines
1009 B
Plaintext

/*
* This file tests support for passing object methods and vars
* using macro syntax
*/
PROCEDURE Main()
LOCAL obj := ErrorNew()
MEMVAR m_send1
MEMVAR m_send2
PRIVATE m_send1 := "_description"
PRIVATE m_send2 := "_tries"
obj:tries := 1
obj:&m_send1 := "test"
obj:tries += 1
obj:tries++
++obj:tries
WITH OBJECT obj
:tries += 1
:tries++
++:tries
/*
Notice that for post/pre increment decrement operators and
for assigments (:=,+=,-=,*=,/=) the macro have to
start from the underscore symbol '_'
To access the object variable using macro the '_' should be omitted
*/
:&m_send2 += 1
:&m_send2++
++:&m_send2
++:&( m_send2 )
:&( m_send2 ) := :&( SubStr( m_send2, 2 ) ) + 1
:&m_send1 += " description"
:&( m_send1 ) += " of "
ENDWITH
obj:&( "_" + SubStr( m_send1, 2 ) ) += "Error object"
? m_send1, "=", obj:&( SubStr( m_send1, 2 ) )
? m_send2, "=", obj:tries
RETURN