Files
harbour-core/harbour/tests/objarr.prg
Viktor Szakats 3c38398a5d 2008-08-16 02:19 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* contrib/hbmzip/hbmzip.c
     ! Fixed potential GPF in executable type detection.
       Fixes GCC 4.3.1 warnings in openSUSE 11.

   * tests/debugtst.prg
   * tests/funcarr.prg
   * tests/inherit.prg
   * tests/objarr.prg
   * tests/objasign.prg
   * doc/en/hvm.txt
   * doc/es/hvm.txt
   * include/hbextern.ch
   * source/vm/debug.c
   * source/vm/hvm.c
   * source/debug/dbgtobj.prg
   * source/debug/debugger.prg
   * source/rtl/altd.prg
     * Harbour level HB_DBG_*() functions renamed to __DBG*() to 
       reflect their internal nature.
     - Removed old __VM*() synonyms to Harbour level __DBG*() functions.
       INCOMPATIBLE.
     ! Fixed a few minor doc bugs along the way.
2008-08-16 00:21:13 +00:00

91 lines
1.8 KiB
Plaintext

//
// $Id$
//
//
// Object Array syntax test
//
// Written by Eddie Runia <eddie@runia.com>
// www - http://www.harbour-project.org
//
// Placed in the public domain
//
Function Main
local o := TNumber():New()
QOut( "Direct reference : ", ToChar( o:x ) )
o:x[1] := "I am a data"
o:Get()[2] := "I am a method"
QOut( "Assign text : ", ToChar( o:x ) )
o:x[1] := 4
o:Get()[2] := 4
QOut( "Assign 4 : ", ToChar( o:x ) )
QOut( "Post increment : ", o:x[1]++ , o:Get()[2]++ )
QOut( "After : ", o:x[1] , o:Get()[2] )
QOut( "Pre decrement : ", --o:x[1] , --o:Get()[2] )
QOut( "After : ", o:x[1] , o:Get()[2] )
o:x[1] += 2
o:Get()[2] += 2
QOut( "Plus 2 : ", ToChar( o:x ) )
o:x[1] -= 3
o:Get()[2] -= 3
QOut( "Minus 3 : ", ToChar( o:x ) )
o:x[1] *= 3
o:Get()[2] *= 3
QOut( "Times 3 : ", ToChar( o:x ) )
o:x[1] /= 1.5
o:Get()[2] /= 1.5
QOut( "Divide by 1.5 : ", ToChar( o:x ) )
o:x[1] %= 4
o:Get()[2] %= 4
QOut( "Modulus 4 : ", ToChar( o:x ) )
o:x[1] ^= 3
o:Get()[2] ^= 3
QOut( "To the power 3 : ", ToChar( o:x ) )
QOut( "Global stack" )
Debug( __dbgvmStkGList() )
QOut( "Statics")
Debug( __dbgvmVarSList() )
return NIL
Function TNumber() // Very simple class
static oNumber
if oNumber == NIL
oNumber := HBClass():New( "TNumber" )
oNumber:AddData ( "x" )
oNumber:AddMethod( "Get", @Get() )
oNumber:AddMethod( "New", @New() )
oNumber:Create()
endif
return oNumber:Instance()
static function New()
local self := QSelf()
::x := {1,1}
return self
static function Get()
local self := QSelf()
return ::x