Files
harbour-core/harbour/tests/omacro.prg
Viktor Szakats 00c09ce91f 2010-12-08 21:53 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/debug/debugger.prg
  * contrib/hbodbc/tests/odbccall.prg
  * contrib/hbblat/tests/blattest.prg
  * contrib/hbgd/gd.prg
  * contrib/hbtip/tests/tipmail.prg
  * examples/rddado/adordd.prg
  * examples/httpsrv/cgifunc.prg
    * Eliminated using WITH OBJECT.
    % Some optimizations, little fixes.

  * tests/omacro.prg
    * Formatting.
2010-12-08 20:54:55 +00:00

52 lines
945 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 '
ENDWITH
obj:&( "_"+ SUBSTR(send1,2) ) += "Error object"
? send1, "=", obj:&( SUBSTR(send1,2) )
? send2, "=", obj:tries
RETURN