* tests/onidle.prg
* tests/codebloc.prg
* tests/keywords.prg
* tests/wvtext.prg
* tests/test_all.prg
* tests/ainstest.prg
* doc/es/compiler.txt
* doc/es/file.txt
* contrib/hbct/numconv.prg
* contrib/hbct/tests/expomant.prg
* contrib/hbwhat32/whatutil.prg
* contrib/hbwhat32/winrbar.prg
* contrib/hbwhat32/wintabs.prg
* contrib/hbwhat32/wincomm.prg
* contrib/hbwhat32/wincdlg.prg
* contrib/hbwhat32/wintbar.prg
* contrib/hbwhat32/_wininet.c
* contrib/hbwhat32/wincore.prg
* contrib/hbw32/w32_ole.c
* contrib/hbapollo/tests/apollo.prg
* contrib/hbnf/dispmsg.prg
* contrib/hbnf/fttext.c
* contrib/hbnf/mouse1.prg
* contrib/hbnf/menu1.prg
* contrib/hbnf/sleep.prg
* contrib/hbnf/xbox.prg
* contrib/hbnf/popadder.prg
* contrib/hbnf/mouse2.prg
* contrib/hbnf/pchr.prg
* contrib/hbhpdf/tests/harupdf.prg
* contrib/gtwvg/wvgclass.prg
* contrib/gtwvg/tests/demowvg.prg
* contrib/gtwvg/wvgpaint.prg
* contrib/rddads/tests/testmg.prg
* contrib/hbclipsm/tests/testgaug.prg
* contrib/hbfimage/tests/fitest.prg
* contrib/hbmisc/twirler.prg
* contrib/hbtip/httpcln.prg
* contrib/hbtip/ftpcln.prg
* contrib/hbvpdf/hbvpdft.prg
* utils/hbmake/hbmake.prg
* Some more general code cleanups.
* iif(), quote char, #include, filename-casing, = usage cleanups,
hardcoded absolute paths, non-ASCII drawing chars in source.
Using mixed-case filenames to #include .ch files breaks on
non-WinDOS platforms.
122 lines
2.4 KiB
Plaintext
122 lines
2.4 KiB
Plaintext
//
|
|
// $Id$
|
|
//
|
|
|
|
// codeblocks test
|
|
|
|
function Main()
|
|
local B := "this will never print"
|
|
local a := { |b,c| OutStd( "I am a codeblock" + b + c ) }
|
|
local d
|
|
local de
|
|
local ar := { 1, 2 }
|
|
local crlf:=CHR(13)+chr(10)
|
|
local YY, X
|
|
local x1, x2
|
|
|
|
OutStd( "this should print first" )
|
|
OutStd( crlf )
|
|
|
|
Eval( a, " with parameters", " ... and it works!" )
|
|
OutStd( crlf )
|
|
|
|
d ="with access to local variables"
|
|
|
|
a ={ |b,c| OutStd( "I am a second codeblock " +d +b +;
|
|
IIF(c==NIL, ' empty second parameter ', c)), OutStd(crlf), "WITH return value" }
|
|
EVAL( a, ", codeblock parameters" )
|
|
OutStd( crlf )
|
|
|
|
EVAL( a, ", codeblock parameters ", "and with second parameter" )
|
|
OutStd( crlf )
|
|
|
|
OutStd( MyEval( a ) )
|
|
OutStd( crlf )
|
|
|
|
OtherTest( a )
|
|
OutStd( crlf )
|
|
|
|
AnotherTest( a, "==> Another " )
|
|
OutStd( crlf )
|
|
|
|
a ={|c| IIF( c==NIL, {|a| "First "+a}, {|a| "Second "+a}) }
|
|
a =EVAL( a )
|
|
OutStd( crlf )
|
|
OutStd( EVAL( a, "codeblock created in a codeblock" ) )
|
|
OutStd( crlf )
|
|
|
|
OutStd( ar[ 1 ] )
|
|
OutStd( crlf )
|
|
a :={|| ar[ 1 ]++}
|
|
EVAL( a )
|
|
OutStd( ar[ 1 ] )
|
|
OutStd( crlf )
|
|
|
|
yy :=5
|
|
x :={|xx| OutStd(LTRIM(STR(xx))), OutStd("+"), OutStd(LTRIM(STR(yy))), OutStd("="), xx + yy }
|
|
OutStd( EVAL( x, 1 ) ) //this is OK
|
|
OutStd( CRLF )
|
|
OutStd( EVAL( x, 1, 2 ) ) //this should ignore unnecesary parameters
|
|
|
|
QOut( EVAL( RetBlock(), 5 ) )
|
|
|
|
// BugToFix()
|
|
OutStd( crlf )
|
|
|
|
OutStd( "Trying to use detached variable ..." )
|
|
OutStd( crlf )
|
|
x1 :=5
|
|
x2 :=6
|
|
de =DetachLocal( x1, x2 )
|
|
OutStd( EVAL( de ) )
|
|
//changing the value of variables
|
|
OutStd( crlf )
|
|
x1 := 10
|
|
x2 := 11
|
|
QOut( EVAL( de ) )
|
|
de =DetachLocal( x1, x2 )
|
|
QOut( EVAL( de ) )
|
|
|
|
return nil
|
|
|
|
FUNCTION MyEval( bCodeBlock )
|
|
LOCAL D:="this is another variable"
|
|
|
|
RETURN( EVAL(bCodeBlock, " from ", "MyEval Function" ) )
|
|
|
|
PROCEDURE OtherTest( cblock )
|
|
LOCAL cb
|
|
|
|
cb :={|a,b| EVAL( cblock,a,b ) }
|
|
|
|
EVAL( cb, "--> with nested ", "EVAL" )
|
|
|
|
RETURN
|
|
|
|
PROCEDURE AnotherTest( cb, a )
|
|
OutStd( EVAL( cb, a ) )
|
|
OutStd( chr(13)+chr(10) )
|
|
OutStd( EVAL( cb, a, "again and again" ) )
|
|
OutStd( chr(13)+chr(10) )
|
|
RETURN
|
|
|
|
FUNCTION DetachLocal( x, y )
|
|
//NOTE! this should work
|
|
LOCAL z:=x+y
|
|
LOCAL cb:={|| QOut("z=x+y="), QOut(z), QOut("x*x="), QOut(x*x), QOut("x*x+z="), x*x+z}
|
|
RETURN( cb )
|
|
|
|
PROCEDURE BugToFix()
|
|
|
|
LOCAL b, a := {|| a+b }
|
|
|
|
b ="bug "
|
|
EVAL( a )
|
|
|
|
RETURN
|
|
|
|
FUNCTION RetBlock()
|
|
|
|
RETURN( {|x| x*x} )
|
|
|