* config/postinst.hb
* utils/hbmk2/hbmk2.prg
+ using HB_CWD() instead of DIRCHANGE()
- tests/speedold.prg
* contrib/gtwvg/3state.prg
* contrib/gtwvg/activex.prg
* contrib/gtwvg/bitmap.prg
* contrib/gtwvg/checkbox.prg
* contrib/gtwvg/class.prg
* contrib/gtwvg/combobox.prg
* contrib/gtwvg/crt.prg
* contrib/gtwvg/dataref.prg
* contrib/gtwvg/dialog.prg
* contrib/gtwvg/drawarea.prg
* contrib/gtwvg/genrc.prg
* contrib/gtwvg/gtwvg.c
* contrib/gtwvg/htmlview.prg
* contrib/gtwvg/listbox.prg
* contrib/gtwvg/menubar.prg
* contrib/gtwvg/mle.prg
* contrib/gtwvg/paint.prg
* contrib/gtwvg/parthdlr.prg
* contrib/gtwvg/pushbut.prg
* contrib/gtwvg/radiobut.prg
* contrib/gtwvg/scrollbr.prg
* contrib/gtwvg/sle.prg
* contrib/gtwvg/statbar.prg
* contrib/gtwvg/static.prg
* contrib/gtwvg/syswnd.prg
* contrib/gtwvg/tabpage.prg
* contrib/gtwvg/tests/activex.prg
* contrib/gtwvg/tests/cuigdlgs.prg
* contrib/gtwvg/tests/demowvg.prg
* contrib/gtwvg/tests/demowvg1.prg
* contrib/gtwvg/tests/demoxbp.prg
* contrib/gtwvg/tests/dyndlgs.prg
* contrib/gtwvg/tests/modal.prg
* contrib/gtwvg/tests/tbrowser.prg
* contrib/gtwvg/tests/utils.prg
* contrib/gtwvg/tests/wvtcls.prg
* contrib/gtwvg/tests/xbp.prg
* contrib/gtwvg/toolbar.prg
* contrib/gtwvg/treeview.prg
* contrib/gtwvg/wnd.prg
* contrib/gtwvg/wvgcore.c
* contrib/gtwvg/wvgcuig.c
* contrib/gtwvg/wvtwin.ch
* contrib/hbct/getinfo.prg
* contrib/hbhttpd/readme.txt
* contrib/hbhttpd/widgets.prg
* contrib/hbmzip/tests/myunzip.prg
* contrib/hbmzip/tests/myzip.prg
* contrib/hbnetio/tests/netiot02.prg
* contrib/hbnf/hex2dec.prg
* contrib/hbsqlit3/tests/backup.prg
* contrib/hbwin/tests/pdfcreat.prg
* contrib/hbwin/tests/testole.prg
* contrib/rddsql/tests/arrayrdd.prg
* contrib/xhb/cstruct.prg
* contrib/xhb/dumpvar.prg
* contrib/xhb/trpc.prg
* contrib/xhb/ttable.ch
* contrib/xhb/txml.prg
* contrib/xhb/xcstr.prg
* contrib/xhb/xdbmodst.prg
* ChangeLog
* doc/en/command.txt
* doc/en/hvm.txt
* doc/en/menu.txt
* doc/en/tbrowse.txt
* extras/gtwvw/gtwvw.c
* extras/gtwvw/hbgtwvw.h
* extras/gtwvw/tests/cbtest1.prg
* extras/gtwvw/tests/cbtest6.prg
* extras/gtwvw/tests/drawimg.prg
* extras/gtwvw/tests/ebtest7.prg
* extras/gtwvw/tests/inpfocus.prg
* extras/gtwvw/tests/prog0.prg
* extras/gtwvw/tests/prog1.prg
* extras/gtwvw/tests/prog2.prg
* extras/gtwvw/tests/wvwmouse.prg
* extras/gtwvw/tests/wvwtest9.prg
* extras/gtwvw/wvwcheck.c
* extras/gtwvw/wvwdraw.c
* extras/gtwvw/wvwfuncs.c
* extras/gtwvw/wvwmenu.c
* extras/gtwvw/wvwpush.c
* extras/gtwvw/wvwstbar.c
* extras/gtwvw/wvwtbar.c
* extras/hbvpdf/hbvpdf.prg
* extras/hbvpdf/hbvpdft.prg
* extras/hbxlsxml/tests/example.prg
* extras/hbxlsxml/tests/example2.prg
* extras/hbxlsxml/tests/example3.prg
* extras/hbxlsxml/xlsxml_s.prg
* extras/hbxlsxml/xlsxml_y.prg
* extras/hbxlsxml/xlsxml.prg
* extras/httpsrv/cookie.prg
* extras/httpsrv/session.prg
* extras/httpsrv/uhttpd.prg
* src/compiler/hbmain.c
* src/debug/dbgtarr.prg
* src/debug/dbgthsh.prg
* src/debug/dbgtobj.prg
* src/debug/debugger.prg
* src/rdd/dbfcdx/dbfcdx1.c
* src/rdd/dbfnsx/dbfnsx1.c
* src/rdd/dbfntx/dbfntx1.c
* src/rdd/hbsix/sxcompat.prg
* src/rtl/tpersist.prg
* tests/and_or.prg
* tests/clsccast.prg
* tests/clsicast.prg
* tests/clsscast.prg
* tests/clsscope.prg
* tests/codebl.prg
* tests/cpinfo.prg
* tests/foreach.prg
* tests/inherit.prg
* tests/memvar.prg
* tests/mt/mttest01.prg
* tests/mt/mttest02.prg
* tests/mt/mttest03.prg
* tests/mt/mttest04.prg
* tests/mt/mttest05.prg
* tests/mt/mttest06.prg
* tests/mt/mttest07.prg
* tests/mt/mttest09.prg
* tests/mt/mttest10.prg
* tests/rddtest/rddmktst.prg
* tests/rddtest/rddtst.prg
* tests/rto_get.prg
* tests/rto_tb.prg
* tests/speedtst.prg
* tests/stripem.prg
* tests/testpre.prg
* tests/testwarn.prg
* tests/transtst.prg
* utils/hbtest/hbtest.prg
* utils/hbtest/rt_hvma.prg
* various formal cleanups
! fixed ==/!= operator usage in hbxlsxml
193 lines
3.6 KiB
Plaintext
193 lines
3.6 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
STATIC s_cbStatic
|
|
|
|
PROCEDURE Main()
|
|
|
|
LOCAL a := TestBlocks()
|
|
LOCAL cb
|
|
|
|
? Eval( a[ 1 ] ) // 23
|
|
? Eval( a[ 2 ], 42 ) // 42
|
|
? Eval( a[ 1 ] ) // 42
|
|
? Eval( a[ 2 ], 15 ) // 15
|
|
|
|
myout( 15, Eval( a[ 1 ] ) ) // 15 15
|
|
myout( 14, Eval( a[ 1 ] ) ) // 14 15
|
|
myout( 42, Eval( a[ 2 ], 42 ) ) // 42 42
|
|
myout( 14, Eval( a[ 2 ], 42 ) ) // 14 42
|
|
myout( 42, Eval( a[ 1 ] ) ) // 42 42
|
|
myout( 14, Eval( a[ 1 ] ) ) // 14 42
|
|
|
|
GetArray( @a )
|
|
PrintArray( @a )
|
|
|
|
? "Test for variables passed by reference in a codeblock"
|
|
DetachWithRefer()
|
|
|
|
? "Test for indirect detaching of local variables"
|
|
DetachToStatic( 1 )
|
|
myout( 2, Eval( s_cbStatic, 1 ) )
|
|
myout( 3, Eval( s_cbStatic, 2 ) )
|
|
cb := s_cbStatic
|
|
DetachToStatic( 100 )
|
|
myout( 200, Eval( s_cbStatic, 100 ) )
|
|
myout( 300, Eval( s_cbStatic, 200 ) )
|
|
myout( 4, Eval( cb, 3 ) )
|
|
|
|
ReferParam()
|
|
|
|
RETURN
|
|
|
|
STATIC FUNCTION TestBlocks()
|
|
|
|
LOCAL nFoo := 23
|
|
|
|
RETURN { {|| nFoo }, {| n | nFoo := n } }
|
|
|
|
STATIC FUNCTION myout( nExpected, nGot )
|
|
|
|
? nExpected, nGot
|
|
|
|
RETURN NIL
|
|
|
|
//
|
|
|
|
PROCEDURE GetArray( a )
|
|
|
|
LOCAL i
|
|
|
|
a := Array( 100 )
|
|
FOR i := 1 TO 100
|
|
IF ( i % 6 ) == 0
|
|
a[ i - 2 ] := NIL
|
|
a[ i - 4 ] := NIL
|
|
ENDIF
|
|
a[ i ] := TestBlocks()
|
|
NEXT
|
|
|
|
RETURN
|
|
|
|
PROCEDURE PrintArray( a )
|
|
|
|
LOCAL i
|
|
|
|
FOR i := 1 TO 100
|
|
IF a[ i ] != NIL
|
|
Eval( a[ i ][ 2 ], i )
|
|
myout( i, Eval( a[ i ][ 1 ] ) )
|
|
ENDIF
|
|
NEXT
|
|
|
|
RETURN
|
|
|
|
//
|
|
|
|
FUNCTION DetachWithRefer()
|
|
|
|
LOCAL nTest
|
|
LOCAL bBlock1 := MakeBlock()
|
|
LOCAL bBlock2 := {|| DoThing( @nTest ), QOut( nTest ) }
|
|
|
|
Eval( bBlock1 )
|
|
Eval( bBlock2 )
|
|
|
|
RETURN NIL
|
|
|
|
FUNCTION MakeBlock()
|
|
|
|
LOCAL nTest
|
|
|
|
RETURN {|| DoThing( @nTest ), QOut( nTest ) }
|
|
|
|
FUNCTION DoThing( n )
|
|
|
|
n := 42
|
|
|
|
RETURN NIL
|
|
|
|
//
|
|
|
|
FUNCTION DetachToStatic( n )
|
|
|
|
s_cbStatic := {| x | n + x }
|
|
|
|
RETURN NIL
|
|
|
|
//
|
|
|
|
FUNCTION ReferParam()
|
|
|
|
LOCAL bResult
|
|
|
|
? "Test for codeblock parameter passed by reference"
|
|
|
|
PassByValue( {| lEnd | ;
|
|
bResult := GetBlock( @lEnd ), ;
|
|
SetByRef( @lEnd ) } )
|
|
// Clipper & xHarbour it's .T.
|
|
//In Harbour it is .F.
|
|
? "Printed value in Clipper .T. =", Eval( bResult )
|
|
?
|
|
// Notice the Clipper bug: GetBlock is receiving the reference to
|
|
// the codeblock parameter than the value of EVAL(bResult) shouldn't
|
|
// depend on the order of block creation/value changing (GetBlock/SetRef).
|
|
|
|
PassByRef( {| lEnd | ;
|
|
bResult := GetBlock( @lEnd ), ;
|
|
SetByRef( @lEnd ) } )
|
|
// Clipper & xHarbour it's .T.
|
|
//In Harbour it is .F.
|
|
? "Printed value in Clipper .T. =", Eval( bResult )
|
|
?
|
|
|
|
? "2nd test for codeblock parameter passed by reference"
|
|
|
|
PassByValue( {| lEnd | ;
|
|
SetByRef( @lEnd ), ;
|
|
bResult := GetBlock( @lEnd ) } )
|
|
// Clipper & xHarbour it's .T.
|
|
//In Harbour it is .F.
|
|
? "Printed value in Clipper .F. =", Eval( bResult )
|
|
?
|
|
|
|
PassByRef( {| lEnd | ;
|
|
SetByRef( @lEnd ), ;
|
|
bResult := GetBlock( @lEnd ) } )
|
|
// Clipper & xHarbour it's .T.
|
|
//In Harbour it is .F.
|
|
? "Printed value in Clipper .F. =", Eval( bResult )
|
|
?
|
|
|
|
RETURN Nil
|
|
|
|
STATIC FUNCTION PassByValue( bBlock )
|
|
|
|
LOCAL lSomeVar := .T.
|
|
|
|
Eval( bBlock, lSomeVar )
|
|
? "lSomeVar value in Clipper .T. =", lSomeVar
|
|
|
|
RETURN .T.
|
|
|
|
STATIC FUNCTION PassByRef( bBlock )
|
|
|
|
LOCAL lSomeVar := .T.
|
|
|
|
Eval( bBlock, @lSomeVar )
|
|
? "lSomeVar value in Clipper .F. =", lSomeVar
|
|
|
|
RETURN .T.
|
|
|
|
STATIC FUNCTION SetByRef( lVar )
|
|
|
|
lVar := .F.
|
|
|
|
RETURN Nil
|
|
|
|
STATIC FUNCTION GetBlock( lVar )
|
|
|
|
RETURN {|| lVar }
|