Files
harbour-core/tests/statics.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

69 lines
879 B
Plaintext

// Testing Harbour statics variables management
#ifndef __HARBOUR__
#include "clipper.ch"
#endif
STATIC s_z := "First"
PROCEDURE Main()
LOCAL i, cb
STATIC a := "Hello", b := { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
? a
? b[ 2 ]
Two()
? "Ok!"
FOR i := 1 TO 10
NumStat()
NEXT
cb := DetachVar( 10 )
FOR i := 1 TO 10
? Eval( cb, b[ i ] )
NEXT
RETURN
FUNCTION Two()
STATIC a := "Test"
? a
RETURN NIL
FUNCTION THREE( p )
? p
RETURN p
PROCEDURE NumStat( a )
STATIC s_n := 1
LOCAL cb
// STATIC m := s_n // uncomment it to see an error
// STATIC m := Time() // uncomment it to see an error
HB_SYMBOL_UNUSED( a )
cb := {| x | s_z + Str( x ) }
? ++s_n
? Eval( cb, s_n )
RETURN
FUNCTION DetachVar( xLocal )
STATIC xStatic := 100
RETURN {| x | ++xStatic, x + xStatic + xLocal }