eg:
o:&send()
o:&send.end()
o:&(expr)()
o:&var++
o:&var := 0
o:&(expr)++
WITH OBJECT obj
++:&var
:&var += :&(var2+"oo")
END
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.
48 lines
963 B
Plaintext
48 lines
963 B
Plaintext
/*
|
|
* $Id$
|
|
*
|
|
* This file tests support for passing object methods and vars
|
|
* using macro syntax
|
|
*/
|
|
PROCEDURE MAIN()
|
|
LOCAL obj:=ErrorNew()
|
|
MEMVAR send1, send2
|
|
|
|
PRIVATE send1:="_description"
|
|
PRIVATE send2:="_tries"
|
|
|
|
obj:tries := 1
|
|
obj:&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
|
|
*/
|
|
:&send2 +=1
|
|
:&send2++
|
|
++:&send2
|
|
++:&(send2)
|
|
|
|
:&( send2 ) := :&( SUBSTR(send2,2) ) +1
|
|
|
|
:&send1 +=' description'
|
|
:&(send1) += ' of '
|
|
END
|
|
|
|
obj:&( "_"+ SUBSTR(send1,2) ) += "Error object"
|
|
? send1, "=", obj:&( SUBSTR(send1,2) )
|
|
? send2, "=", obj:tries
|
|
|
|
RETURN |