2012-10-02 13:52 UTC+0200 Viktor Szakats (harbour syenar.net)

* tests/adirtest.prg
  * tests/ainstest.prg
  * tests/and_or.prg
  * tests/array16.prg
  * tests/arrayidx.prg
  * tests/arrays.prg
  * tests/arrindex.prg
  * tests/atest.prg
  * tests/base64.prg
  * tests/byref.prg
  * tests/calling.prg
  * tests/cdow.prg
  * tests/clasinit.prg
  * tests/clasname.prg
  * tests/classch.prg
  * tests/classes.prg
  * tests/clsdata.prg
  * tests/cmphello.prg
  * tests/codebl.prg
  * tests/curdirt.prg
  * tests/cursrtst.prg
  * tests/dates.prg
  * tests/dates2.prg
  * tests/dates3.prg
  * tests/debugtst.prg
  * tests/delimtst.prg
  * tests/devtest.prg
  * tests/dirtest.prg
  * tests/disptest.prg
  * tests/docase.prg
  * tests/dosshell.prg
  * tests/dttest.prg
  * tests/dupvars.prg
  * tests/dynobj.prg
  * tests/dynsym.prg
  * tests/exittest.prg
  * tests/extend1.prg
  * tests/fib.prg
  * tests/fornext.prg
  * tests/fortest.prg
  * tests/funcarr.prg
  * tests/hbdoctst.prg
  * tests/hsxtest.prg
  * tests/ifelse.prg
  * tests/inifiles.prg
  * tests/initexit.prg
  * tests/inkeytst.prg
  * tests/inline_c.prg
  * tests/inline.prg
  * tests/iotest.prg
  * tests/iotest2.prg
  * tests/ipclnt.prg
  * tests/ipsvr.prg
  * tests/longstr.prg
  * tests/mathtest.prg
  * tests/memvar.prg
  * tests/multiarg.prg
  * tests/nums.prg
  * tests/objarr.prg
  * tests/objasign.prg
  * tests/objects.prg
  * tests/os.prg
  * tests/overload.prg
  * tests/parexpr.prg
  * tests/passref.prg
  * tests/procname.prg
  * tests/recursiv.prg
  * tests/returns.prg
  * tests/round.prg
  * tests/sdf_test.prg
  * tests/seconds.prg
  * tests/set_num.prg
  * tests/set_test.prg
  * tests/sound.prg
  * tests/statfun.prg
  * tests/statics.prg
  * tests/statics1.prg
  * tests/statics2.prg
  * tests/strdelim.prg
  * tests/stripem.prg
  * tests/t1.prg
  * tests/test.prg
  * tests/testerro.prg
  * tests/testfor.prg
  * tests/testget.prg
  * tests/testhtml.prg
  * tests/testid.prg
  * tests/testop.prg
  * tests/teststr.prg
  * tests/testtok.prg
  * tests/testvars.prg
  * tests/tflock.prg
  * tests/tstalias.prg
  * tests/version.prg
  * tests/videotst.prg
  * tests/while.prg
  * tests/wvtext.prg
    ! various cleanups and fixes after running almost all of them

  * ChangeLog
    * changed hbqt new repository to its new location:
        http://sourceforge.net/projects/qtcontribs/
This commit is contained in:
Viktor Szakats
2012-10-02 11:59:22 +00:00
parent 4a9809fedc
commit 7e7aaf9044
98 changed files with 1347 additions and 1282 deletions

View File

@@ -16,6 +16,110 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-10-02 13:52 UTC+0200 Viktor Szakats (harbour syenar.net)
* tests/adirtest.prg
* tests/ainstest.prg
* tests/and_or.prg
* tests/array16.prg
* tests/arrayidx.prg
* tests/arrays.prg
* tests/arrindex.prg
* tests/atest.prg
* tests/base64.prg
* tests/byref.prg
* tests/calling.prg
* tests/cdow.prg
* tests/clasinit.prg
* tests/clasname.prg
* tests/classch.prg
* tests/classes.prg
* tests/clsdata.prg
* tests/cmphello.prg
* tests/codebl.prg
* tests/curdirt.prg
* tests/cursrtst.prg
* tests/dates.prg
* tests/dates2.prg
* tests/dates3.prg
* tests/debugtst.prg
* tests/delimtst.prg
* tests/devtest.prg
* tests/dirtest.prg
* tests/disptest.prg
* tests/docase.prg
* tests/dosshell.prg
* tests/dttest.prg
* tests/dupvars.prg
* tests/dynobj.prg
* tests/dynsym.prg
* tests/exittest.prg
* tests/extend1.prg
* tests/fib.prg
* tests/fornext.prg
* tests/fortest.prg
* tests/funcarr.prg
* tests/hbdoctst.prg
* tests/hsxtest.prg
* tests/ifelse.prg
* tests/inifiles.prg
* tests/initexit.prg
* tests/inkeytst.prg
* tests/inline_c.prg
* tests/inline.prg
* tests/iotest.prg
* tests/iotest2.prg
* tests/ipclnt.prg
* tests/ipsvr.prg
* tests/longstr.prg
* tests/mathtest.prg
* tests/memvar.prg
* tests/multiarg.prg
* tests/nums.prg
* tests/objarr.prg
* tests/objasign.prg
* tests/objects.prg
* tests/os.prg
* tests/overload.prg
* tests/parexpr.prg
* tests/passref.prg
* tests/procname.prg
* tests/recursiv.prg
* tests/returns.prg
* tests/round.prg
* tests/sdf_test.prg
* tests/seconds.prg
* tests/set_num.prg
* tests/set_test.prg
* tests/sound.prg
* tests/statfun.prg
* tests/statics.prg
* tests/statics1.prg
* tests/statics2.prg
* tests/strdelim.prg
* tests/stripem.prg
* tests/t1.prg
* tests/test.prg
* tests/testerro.prg
* tests/testfor.prg
* tests/testget.prg
* tests/testhtml.prg
* tests/testid.prg
* tests/testop.prg
* tests/teststr.prg
* tests/testtok.prg
* tests/testvars.prg
* tests/tflock.prg
* tests/tstalias.prg
* tests/version.prg
* tests/videotst.prg
* tests/while.prg
* tests/wvtext.prg
! various cleanups and fixes after running almost all of them
* ChangeLog
* changed hbqt new repository to its new location:
http://sourceforge.net/projects/qtcontribs/
2012-10-02 11:26 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/hbnf/popadder.prg
* src/rtl/listbox.prg
@@ -744,7 +848,7 @@
* utils/hbmk2/examples/plug_bis.hb
% minor cleanup
- contrib/hbnetio/utils/hbnetioq
- deleted (find it here or from repo history: http://sourceforge.net/projects/hbqt/)
- deleted (find it here or from repo history: http://sourceforge.net/projects/qtcontribs/)
* utils/hbmk2/examples/contribf.hbc
* updated
@@ -853,7 +957,7 @@
- deleted hbqt, hbxbp, hbide as final step of contrib
split to separate project.
find them in this (temporary) repository:
http://sourceforge.net/projects/hbqt/
http://sourceforge.net/projects/qtcontribs/
or checkout from Harbour repository using:
svn co -r 18153 https://harbour-project.svn.sourceforge.net/svnroot/harbour-project/trunk/harbour
@@ -1434,7 +1538,7 @@
* contrib/hbplist
* disabled HBQT, HBXBP and HBIDE components.
See this place for their new home:
http://sourceforge.net/projects/hbqt/
http://sourceforge.net/projects/qtcontribs/
2012-09-24 10:39 UTC+0200 Viktor Szakats (harbour syenar.net)
* utils/hbmk2/hbmk2.prg

View File

@@ -20,12 +20,12 @@ STATIC FUNCTION TestIt( cSpec )
LOCAL a4
LOCAL a5
// In order to account for documented behavour, this call will ensure
// that Adir() returns the same length array in both cases.
// ie: adir( cSpec ) could return a different length array than
// ADIR( cSpec,,,,,{} )
// In order to account for documented behavour, this call will ensure
// that Adir() returns the same length array in both cases.
// ie: adir( cSpec ) could return a different length array than
// ADir( cSpec,,,,,{} )
a := ADIR( cSpec,,,,,{} )
a := ADir( cSpec, , , , , {} )
SET DATE ANSI
SET CENTURY ON
@@ -39,14 +39,14 @@ STATIC FUNCTION TestIt( cSpec )
OutStd( "--------------------------------------------------------" )
OutStd( hb_eol() )
ADIR( cSpec , a1, a2, a3, a4, a5 )
ADir( cSpec , a1, a2, a3, a4, a5 )
aEval(a1, {|tmp| OutStd( tmp ), OutStd( hb_eol() ) } )
aEval(a2, {|tmp| OutStd( tmp ), OutStd( hb_eol() ) } )
aEval(a3, {|tmp| OutStd( tmp ), OutStd( hb_eol() ) } )
aEval(a4, {|tmp| OutStd( tmp ), OutStd( hb_eol() ) } )
aEval(a5, {|tmp| OutStd( tmp ), OutStd( hb_eol() ) } )
AEval( a1, {| tmp | OutStd( tmp ), OutStd( hb_eol() ) } )
AEval( a2, {| tmp | OutStd( tmp ), OutStd( hb_eol() ) } )
AEval( a3, {| tmp | OutStd( tmp ), OutStd( hb_eol() ) } )
AEval( a4, {| tmp | OutStd( tmp ), OutStd( hb_eol() ) } )
AEval( a5, {| tmp | OutStd( tmp ), OutStd( hb_eol() ) } )
ADIR( cSpec, 10, "A", NIL, NIL, NIL )
ADir( cSpec, 10, "A", NIL, NIL, NIL )
RETURN NIL

View File

@@ -15,44 +15,44 @@ PROCEDURE Main()
aFirst := AClone( { 1, 2, 4 } )
AIns( aFirst, 3 )
aFirst[ 3 ] := "3"
QQOut( "Testing aIns .. " )
?? "Testing aIns .. "
aDump( aFirst )
aSecond := { 1, 2, 4 }
ASize( aSecond, 4 )
QQOut( "Testing aSize .. " )
?? "Testing aSize .. "
aDump( aSecond )
aSecond := { 1, 2, 4 }
ASize( aSecond, 4 )
AIns( aSecond, 3 )
aSecond[ 3 ] := "3"
QQOut( "Testing aSize + aIns .. " )
?? "Testing aSize + aIns .. "
aDump( aSecond )
aSecond := { 1, 2, 3, 3, 4, 5 }
ADel( aSecond, 3 )
QQOut( "Testing aDel .. " )
?? "Testing aDel .. "
aDump( aSecond )
aSecond := { 1, 2, 3, 3, 4, 5 }
ADel( aSecond, 3 )
ASize( aSecond, Len( aSecond ) - 1 )
QQOut( "Testing aSize + aDel .. " )
?? "Testing aSize + aDel .. "
aDump( aSecond )
AFill( aSecond, "!" )
QQOut( "Testing aFill .. " )
?? "Testing aFill .. "
aDump( aSecond )
aMore := { 1, 2, 3, 4, 5, 6 }
AFill( aMore, "X", 3 )
QQOut( "Testing aFill with start .. " )
?? "Testing aFill with start .. "
aDump( aMore )
aMore := { 1, 2, 3, 4, 5, 6 }
AFill( aMore, "X", 3, 2 )
QQOut( "Testing aFill with start and count .. " )
?? "Testing aFill with start and count .. "
aDump( aMore )
aMore := { { 1, 2 }, { 3, 4 } }
@@ -65,29 +65,29 @@ FUNCTION aDump( aShow )
LOCAL n
QQOut( "Len=", hb_ntos( Len( aShow ) ) )
QQOut( ": " )
?? "Len=", hb_ntos( Len( aShow ) )
?? ": "
FOR n := 1 TO Len( aShow )
QQOut( "[" )
QQOut( hb_ntos( n ) )
QQOut( "]= " )
QQOut( ValType( aShow[ n ] ) )
QQOut( ":" )
?? "["
?? hb_ntos( n )
?? "]= "
?? ValType( aShow[ n ] )
?? ":"
IF ValType( aShow[ n ] ) == "A" /* Iterate array */
QQOut( hb_eol() )
QQOut( "[" )
?? hb_eol()
?? "["
aDump( aShow[ n ] )
QQOut( "]" )
?? "]"
ELSE
QQOut( aShow[ n ] )
?? aShow[ n ]
ENDIF
IF n != Len( aShow )
QQOut( ", " )
?? ", "
ENDIF
NEXT
QQOut( hb_eol() )
?? hb_eol()
RETURN NIL

View File

@@ -6,37 +6,43 @@
PROCEDURE Main()
QOut( "Testing logical shortcuts" )
? "Testing logical shortcuts"
IF .F. .AND. QOut( "this should not show!" ) // and it should not break!
IF .F. .AND. DispAndReturnNIL() // and it should not break!
ENDIF
QOut( "Testing .t. .t." )
? "Testing .t. .t."
AndOr( .T. , .T. )
QOut( "Testing .t. .f." )
? "Testing .t. .f."
AndOr( .T. , .F. )
QOut( "Testing .f. .f." )
? "Testing .f. .f."
AndOr( .F. , .F. )
QOut( "Testing errors..." )
? "Testing errors..."
AndOr( 1, .T. )
RETURN
FUNCTION DispAndReturnNIL()
QOut( "this should not show!" )
RETURN NIL
FUNCTION AndOr( lValue1, lValue2 )
IF lValue1 .AND. lValue2
QOut( "They are both true" )
? "They are both true"
ELSE
QOut( "They are not both true" )
? "They are not both true"
ENDIF
IF lValue1 .OR. lValue2
QOut( "At least one of them is true" )
? "At least one of them is true"
ELSE
QOut( "None of them are true" )
? "None of them are true"
ENDIF
RETURN NIL

View File

@@ -9,52 +9,52 @@ PROCEDURE Main()
LOCAL a := { 100, 200, "Third" }
LOCAL b := Array( 8832 ) // 8832 elements !!! Maximum for 16 Bit !!!
QOut( ValType( a ) )
QOut( ValType( { "A" } ) )
? ValType( a )
? ValType( { "A" } )
AAdd( a, "new element" )
QOut( Len( a ) )
? Len( a )
QOut( a[ 1 ] )
QOut( a[ 2 ] )
QOut( a[ 3 ] )
QOut( a[ 4 ] )
? a[ 1 ]
? a[ 2 ]
? a[ 3 ]
? a[ 4 ]
QOut( ATail( a ) )
? ATail( a )
a[ 3 ] := { "this", { "seems", "to", { "work", "so", "well" } } }
QOut( a[ 3 ][ 2 ][ 3 ][ 1 ] ) // "work"
? a[ 3 ][ 2 ][ 3 ][ 1 ] // "work"
a[ 3, 2 ][ 3, 1 ] := "Harbour power!" // different ways to specify the indexes
QOut( a[ 3, 2, 3, 1 ] )
? a[ 3, 2, 3, 1 ]
QOut( ValType( b ) )
QOut( Len( b ) )
? ValType( b )
? Len( b )
b[ 8832 ] := "Harbour"
QOut( b[ 8832 ] )
? b[ 8832 ]
QOut( ATail( b ) )
? ATail( b )
ASize( b, 200 )
QOut( Len( b ) )
? Len( b )
b[ 100 ] := 10
Test( b[ 100 ]++ )
QOut( b[ 100 ] )
? b[ 100 ]
b[ 100 ] := 10
Test( ++b[ 100 ] )
QOut( b[ 100 ] )
? b[ 100 ]
b := { 1, { 2, { 4, 5 } } }
Test( b[ 2 ][ 2 ][ 1 ]++ )
QOut( b[ 2 ][ 2 ][ 1 ] )
? b[ 2 ][ 2 ][ 1 ]
b[ 2 ][ 2 ][ 1 ] := 2
Test( ++b[ 2 ][ 2 ][ 1 ] )
QOut( b[ 2 ][ 2 ][ 1 ] )
? b[ 2 ][ 2 ][ 1 ]
ReleaseTest()
@@ -62,7 +62,7 @@ PROCEDURE Main()
FUNCTION Test( n )
QOut( n )
? n
RETURN NIL

View File

@@ -15,17 +15,17 @@ PROCEDURE Main()
LOCAL aList := { 1, 2, 3, 4, 5, 6 }
QOut( aList[ 1 ] += 5 )
QOut( aList[ 1 ] )
QOut( aList[ 2 ] -= 5 )
QOut( aList[ 2 ] )
QOut( aList[ 3 ] *= 5 )
QOut( aList[ 3 ] )
QOut( aList[ 4 ] /= 5 )
QOut( aList[ 4 ] )
QOut( aList[ 5 ] ^= 5 )
QOut( aList[ 5 ] )
QOut( aList[ 6 ] %= 5 )
QOut( aList[ 6 ] )
? aList[ 1 ] += 5
? aList[ 1 ]
? aList[ 2 ] -= 5
? aList[ 2 ]
? aList[ 3 ] *= 5
? aList[ 3 ]
? aList[ 4 ] /= 5
? aList[ 4 ]
? aList[ 5 ] ^= 5
? aList[ 5 ]
? aList[ 6 ] %= 5
? aList[ 6 ]
RETURN

View File

@@ -9,50 +9,50 @@ PROCEDURE Main()
LOCAL a := { 100, 200, "Third" }
LOCAL b := Array( 10000 ) // 10.000 elements !!!
QOut( ValType( a ) )
QOut( ValType( { "A" } ) )
? ValType( a )
? ValType( { "A" } )
AAdd( a, "new element" )
QOut( Len( a ) )
? Len( a )
QOut( a[ 1 ] )
QOut( a[ 2 ] )
QOut( a[ 3 ] )
QOut( a[ 4 ] )
? a[ 1 ]
? a[ 2 ]
? a[ 3 ]
? a[ 4 ]
QOut( ATail( a ) )
? ATail( a )
a[ 3 ] := { "this", { "seems", "to", { "work", "so", "well" } } }
QOut( a[ 3 ][ 2 ][ 3 ][ 1 ] ) // "work"
? a[ 3 ][ 2 ][ 3 ][ 1 ] // "work"
a[ 3, 2 ][ 3, 1 ] := "Harbour power!" // different ways to specify the indexes
QOut( a[ 3, 2, 3, 1 ] )
? a[ 3, 2, 3, 1 ]
QOut( ValType( b ) )
QOut( Len( b ) )
? ValType( b )
? Len( b )
b[ 8000 ] := "Harbour"
QOut( b[ 8000 ] )
? b[ 8000 ]
ASize( b, 2000 )
QOut( Len( b ) )
? Len( b )
b[ 1000 ] := 10
Test( b[ 1000 ]++ )
QOut( b[ 1000 ] )
? b[ 1000 ]
b[ 1000 ] := 10
Test( ++b[ 1000 ] )
QOut( b[ 1000 ] )
? b[ 1000 ]
b := { 1, { 2, { 4, 5 } } }
Test( b[ 2 ][ 2 ][ 1 ]++ )
QOut( b[ 2 ][ 2 ][ 1 ] )
? b[ 2 ][ 2 ][ 1 ]
b[ 2 ][ 2 ][ 1 ] := 2
Test( ++b[ 2 ][ 2 ][ 1 ] )
QOut( b[ 2 ][ 2 ][ 1 ] )
? b[ 2 ][ 2 ][ 1 ]
ReleaseTest()
@@ -60,7 +60,7 @@ PROCEDURE Main()
FUNCTION Test( n )
QOut( n )
? n
RETURN NIL

View File

@@ -14,6 +14,6 @@ PROCEDURE Main()
b := a[ c[ 1 ] ][ val( [ 2 ] ) ]
QOut( b )
? b
RETURN

View File

@@ -11,6 +11,6 @@ PROCEDURE Main()
a[ 1 ] := a
a[ 1 ] := NIL
QOut( "The array will try to be released now..." )
? "The array will try to be released now..."
RETURN

View File

@@ -4,9 +4,6 @@
/* RFC4648 test vectors for base64 */
#pragma warninglevel=3
#pragma exitseverity=2
REQUEST HB_GT_CGI_DEFAULT
PROCEDURE Main()
@@ -26,21 +23,19 @@ PROCEDURE Main()
cStr := hb_base64encode( aVector:__enumKey )
IF cStr != aVector
OutStd( hb_strFormat( "hb_base64encode(): expected '%s' got '%s' while encoding '%s'" + hb_eol(), ;
aVector:__enumKey(), cStr, aVector ) )
? hb_strFormat( "hb_base64encode(): expected '%s' got '%s' while encoding '%s'", ;
aVector:__enumKey(), cStr, aVector )
ELSE
OutStd( hb_strFormat( "hb_base64encode(): passed '%s'" + hb_eol(), aVector:__enumKey ) )
? hb_strFormat( "hb_base64encode(): passed '%s'", aVector:__enumKey )
ENDIF
cStr := hb_base64decode( aVector )
IF cStr != aVector:__enumKey()
OutStd( hb_strFormat( "hb_base64decode(): expected '%s' got '%s' while decoding '%s'" + hb_eol(), ;
aVector, cStr, aVector:__enumKey() ) )
? hb_strFormat( "hb_base64decode(): expected '%s' got '%s' while decoding '%s'", ;
aVector, cStr, aVector:__enumKey() )
ELSE
OutStd( hb_strFormat( "hb_base64decode(): passed '%s'" + hb_eol(), aVector ) )
ENDIF
? hb_strFormat( "hb_base64decode(): passed '%s'", aVector )
ENDIF
NEXT
RETURN

View File

@@ -10,34 +10,34 @@ PROCEDURE Main()
LOCAL x := 0
QOut( "Managing LOCAL variables by reference" )
QOut( "In main before ref1 x=", x )
? "Managing LOCAL variables by reference"
? "In main before ref1 x=", x
ref1( @x )
QOut( " In main after ref1 x=", x )
? " In main after ref1 x=", x
QOut( "Managing STATIC variables by reference" )
QOut( "In main before ref1 s=", s )
? "Managing STATIC variables by reference"
? "In main before ref1 s=", s
ref1( @s )
QOut( " In main after ref1 s=", s )
? " In main after ref1 s=", s
RETURN
FUNCTION ref1( x )
x++
QOut( " In ref1 before ref2 =", x )
? " In ref1 before ref2 =", x
Ref2( @x )
QOut( " In ref1 after ref2 =", x )
? " In ref1 after ref2 =", x
RETURN NIL
FUNCTION ref2( x )
x++
QOut( " In ref2 before ref3 =", x )
? " In ref2 before ref3 =", x
Ref3( @x )
QOut( " In ref2 after ref3 =", x )
? " In ref2 after ref3 =", x
RETURN NIL
@@ -46,16 +46,16 @@ FUNCTION ref3( x )
STATIC a
x++
QOut( " In ref3 before ref4 =", x )
? " In ref3 before ref4 =", x
a := { x, x }
Ref4( @a )
QOut( " In ref3 after ref4 =", x )
? " In ref3 after ref4 =", x
RETURN NIL
FUNCTION ref4( a )
a[ 1 ]++
QOut( " In ref4 =", a[ 1 ] )
? " In ref4 =", a[ 1 ]
RETURN NIL

View File

@@ -10,13 +10,13 @@ PROCEDURE Main()
DO Fourth WITH "from Fourth() function" // Testing the old fashion DO ...
QOut( "Ok, back to Main()" )
? "Ok, back to Main()"
RETURN
FUNCTION SecondOne()
QOut( "Ok, this is from Second() function call" )
? "Ok, this is from Second() function call"
Third()
@@ -24,12 +24,12 @@ FUNCTION SecondOne()
FUNCTION Third()
QOut( "Ok, this is from Third() function call" )
? "Ok, this is from Third() function call"
RETURN NIL
FUNCTION Fourth( cText )
QOut( cText )
? cText
RETURN NIL

View File

@@ -4,12 +4,12 @@
PROCEDURE Main()
OutStd( cMonth( date() ) + hb_eol() )
OutStd( cMonth( date() + 31 ) + hb_eol() )
OutStd( cMonth( date() + 60 ) + hb_eol() )
? CMonth( Date() )
? CMonth( Date() + 31 )
? CMonth( Date() + 60 )
OutStd( cDow( date() ) + hb_eol() )
OutStd( cDow( date() + 6 ) + hb_eol() )
OutStd( cDow( date() + 7 ) + hb_eol() )
? CDow( Date() )
? CDow( Date() + 6 )
? CDow( Date() + 7 )
RETURN

View File

@@ -9,18 +9,18 @@ PROCEDURE Main()
LOCAL oForm := TForm():New()
LOCAL oSecond
QOut( "What's the default oForm and calculate area" )
? "What's the default oForm and calculate area"
Debug( oForm )
QOut( oForm:CalcArea() )
QOut( "Set nTop to 5 and recalculate" )
? oForm:CalcArea()
? "Set nTop to 5 and recalculate"
oForm:nTop := 5
Debug( oForm )
QOut( oForm:CalcArea() )
? oForm:CalcArea()
QOut( "Create a new instance and calculate area" )
? "Create a new instance and calculate area"
oSecond := TForm():New()
Debug( oSecond )
QOut( oSecond:CalcArea() )
? oSecond:CalcArea()
RETURN
@@ -57,6 +57,9 @@ STATIC FUNCTION Show()
LOCAL Self := QSelf()
QOut( "lets show a form from here :-)" )
? "lets show a form from here :-)"
RETURN NIL
STATIC PROCEDURE Debug()
RETURN

View File

@@ -21,36 +21,36 @@ PROCEDURE Main()
?
QOut( NIL:className )
QOut( {}:className )
QOut( "":className )
QOut( 0:className )
QOut( CToD( "" ):className )
QOut( .F. :className )
QOut( {|| NIL }:className )
QOut( ErrorNew():className )
? NIL:className
? {}:className
? "":className
? 0:className
? CToD( "" ):className
? .F. :className
? {|| NIL }:className
? ErrorNew():className
// For fun, do it again while ensuring the parser doesn't care about
// whitespace.
?
QOut( NIL : className )
QOut( {} : className )
QOut( "" : className )
QOut( 0 : className )
QOut( CToD( "" ) : className )
QOut( .F. : className )
QOut( {|| NIL } : className )
QOut( ErrorNew() : className )
? NIL : className
? {} : className
? "" : className
? 0 : className
? CToD( "" ) : className
? .F. : className
? {|| NIL } : className
? ErrorNew() : className
// Now for some sillier ones. If the above work the following should
// work too.
?
QOut( ( NIL:className ):className )
? ( NIL:className ):className
?
QOut( ( ( NIL:className ):className ):className )
? ( ( NIL:className ):className ):className
RETURN

View File

@@ -6,7 +6,7 @@
#include "hbclass.ch"
//--------------------------------------------------------------------//
// ;
PROCEDURE Main()
@@ -20,7 +20,7 @@ PROCEDURE Main()
RETURN
//--------------------------------------------------------------------//
// ;
CREATE CLASS TTest INHERIT TParent
@@ -32,7 +32,7 @@ CREATE CLASS TTest INHERIT TParent
ENDCLASS
//--------------------------------------------------------------------//
// ;
METHOD New( One, Two ) CLASS TTest
@@ -43,7 +43,7 @@ METHOD New( One, Two ) CLASS TTest
RETURN Self
//--------------------------------------------------------------------//
// ;
CREATE CLASS TParent
@@ -53,7 +53,7 @@ CREATE CLASS TParent
ENDCLASS
//--------------------------------------------------------------------//
// ;
METHOD New() CLASS TParent
@@ -61,4 +61,4 @@ METHOD New() CLASS TParent
RETURN Self
//--------------------------------------------------------------------//
// ;

View File

@@ -8,7 +8,7 @@ PROCEDURE Main()
LOCAL oForm := TForm():New()
QOut( oForm:ClassName() )
? oForm:ClassName()
oForm:Show()
@@ -50,6 +50,6 @@ STATIC FUNCTION Show()
LOCAL Self := QSelf()
QOut( "lets show a form from here :-)" )
? "lets show a form from here :-)"
RETURN NIL

View File

@@ -6,10 +6,10 @@ PROCEDURE Main()
LOCAL o := HBObject():New()
QOut( "o:Data1 => ", o:Data1 )
QOut( "o:ClassData1 => ", o:ClassData1 )
QOut( "o:Data2 => ", o:Data2 )
QOut( "o:ClassData2 => ", o:ClassData2 )
? "o:Data1 => ", o:Data1
? "o:ClassData1 => ", o:ClassData1
? "o:Data2 => ", o:Data2
? "o:ClassData2 => ", o:ClassData2
o:Test()
RETURN
@@ -44,8 +44,8 @@ STATIC FUNCTION Test()
LOCAL self := QSelf()
QOut( "Inside ::Test() " )
QOut( "calling ::Method1() " )
? "Inside ::Test()"
? "calling ::Method1()"
::Method1()
RETURN self
@@ -54,7 +54,7 @@ STATIC FUNCTION Method1Base()
LOCAL self := QSelf()
QOut( "I am Method1 from TBaseObject" )
? "I am Method1 from TBaseObject"
::Method2()
RETURN self
@@ -63,7 +63,7 @@ STATIC FUNCTION Method2Base()
LOCAL self := QSelf()
QOut( "I am Method2 from TBaseObject" )
? "I am Method2 from TBaseObject"
RETURN self
@@ -100,7 +100,7 @@ STATIC FUNCTION Method1()
LOCAL self := QSelf()
QOut( "I am Method1 from HBObject" )
? "I am Method1 from HBObject"
::TBaseObject:Method1()
RETURN self
@@ -109,6 +109,6 @@ STATIC FUNCTION Method2()
LOCAL self := QSelf()
QOut( "I am Method2 from HBObject" )
? "I am Method2 from HBObject"
RETURN self

View File

@@ -15,16 +15,9 @@
PROCEDURE Main()
LOCAL cOs := Upper( OS() )
QOut( "About to compile Hello.prg" )
QOut()
IF At( "WINDOWS", cOs ) != 0 .OR. At( "DOS", cOs ) != 0 .OR. ;
At( "OS/2", cOs ) != 0 // OS/2, DOS, Windows version
__Run( "..\bin\harbour.exe hello.prg /gHRB" )
ELSE // Unix / Linux version
__Run( "../bin/harbour hello.prg /gHRB" )
ENDIF
QOut( "Finished compiling" )
? "About to compile hello.prg"
?
hb_run( ".." + hb_ps() + "bin" + hb_ps() + "harbour hello.prg -gh" )
? "Finished compiling"
RETURN

View File

@@ -9,10 +9,10 @@ PROCEDURE Main()
LOCAL a := TestBlocks()
LOCAL cb
QOut( Eval( a[ 1 ] ) ) // 23
QOut( Eval( a[ 2 ], 42 ) ) // 42
QOut( Eval( a[ 1 ] ) ) // 42
QOut( Eval( a[ 2 ], 15 ) ) // 15
? Eval( a[ 1 ] ) // 23
? Eval( a[ 2 ], 42 ) // 42
? Eval( a[ 1 ] ) // 42
? Eval( a[ 2 ], 15 ) // 15
mqout( 15, Eval( a[ 1 ] ) ) // 15 15
mqout( 14, Eval( a[ 1 ] ) ) // 14 15
@@ -24,10 +24,10 @@ PROCEDURE Main()
GetArray( @a )
PrintArray( @a )
QOut( "Test for variables passed by reference in a codeblock" )
? "Test for variables passed by reference in a codeblock"
DetachWithRefer()
QOut( "Test for indirect detaching of local variables" )
? "Test for indirect detaching of local variables"
DetachToStatic( 1 )
mqout( 2, Eval( s_cbStatic, 1 ) )
mqout( 3, Eval( s_cbStatic, 2 ) )
@@ -49,7 +49,7 @@ STATIC FUNCTION TestBlocks()
STATIC FUNCTION mqout( nExpected, nGot )
QOut( nExpected, nGot )
? nExpected, nGot
RETURN NIL

View File

@@ -4,10 +4,10 @@
PROCEDURE Main()
OutStd( CurDir() + hb_eol() )
OutStd( CurDir( "C" ) + hb_eol() )
OutStd( CurDir( "C:" ) + hb_eol() )
OutStd( CurDir( "D:" ) + hb_eol() )
OutStd( CurDir( "A" ) + hb_eol() )
? CurDir()
? CurDir( "C" )
? CurDir( "C:" )
? CurDir( "D:" )
? CurDir( "A" )
RETURN

View File

@@ -2,7 +2,7 @@
* $Id$
*/
PROCEDURE main()
PROCEDURE Main()
LOCAL x

View File

@@ -10,82 +10,84 @@ PROCEDURE Main()
LOCAL dDate, dDate2, cMask, cDate
OutStd( hb_eol(), "Testing Harbour dates management on", Date() )
? "Testing Harbour dates management on", Date()
TestCentury()
OutStd( hb_eol(), "" )
OutStd( hb_eol(), "dDate := CToD( '02/04/1999' ) =>", dDate := CToD( "02/04/1999" ) )
?
? "dDate := CToD( '02/04/1999' ) =>", dDate := CToD( "02/04/1999" )
OutStd( hb_eol(), "ValType( dDate ) =", ValType( dDate ) )
? "ValType( dDate ) =", ValType( dDate )
OutStd( hb_eol(), "Day( dDate ) =", Day( dDate ) )
OutStd( hb_eol(), "Month( dDate ) =", Month( dDate ) )
OutStd( hb_eol(), "Year( dDate ) =", Year( dDate ), hb_eol() )
? "Day( dDate ) =", Day( dDate )
? "Month( dDate ) =", Month( dDate )
? "Year( dDate ) =", Year( dDate )
?
OutStd( hb_eol(), "dDate + 5 =", dDate2 := dDate + 5 )
OutStd( hb_eol(), "dDate - 5 =", dDate - 5, hb_eol() )
? "dDate + 5 =", dDate2 := dDate + 5
? "dDate - 5 =", dDate - 5
?
OutStd( hb_eol(), "dDate2 - dDate =", dDate2 - dDate )
? "dDate2 - dDate =", dDate2 - dDate
OutStd( hb_eol(), "" )
OutStd( hb_eol(), dDate, DToS( dDate ) )
?
? dDate, DToS( dDate )
OutStd( hb_eol(), "19990429", SToD( "19990429" ) )
? "19990429", SToD( "19990429" )
OutStd( hb_eol(), "" )
SET( _SET_EPOCH, 1950 )
?
Set( _SET_EPOCH, 1950 )
cMask := "dd/mm/yyyy"
cDate := "02/04/49"
SET( _SET_DATEFORMAT, cMask )
Set( _SET_DATEFORMAT, cMask )
dDate := CToD( cDate )
OutStd( hb_eol(), cDate, cMask, dDate, DToS( dDate ), DToC( dDate ) )
? cDate, cMask, dDate, DToS( dDate ), DToC( dDate )
OutStd( hb_eol(), "" )
?
cMask := "mm/dd/yyyy"
SET( _SET_DATEFORMAT, cMask )
Set( _SET_DATEFORMAT, cMask )
dDate := CToD( cDate )
OutStd( hb_eol(), cDate, cMask, dDate, DToS( dDate ), DToC( dDate ) )
? cDate, cMask, dDate, DToS( dDate ), DToC( dDate )
OutStd( hb_eol(), "" )
?
cMask := "yyyy/mm/dd"
SET( _SET_DATEFORMAT, cMask )
Set( _SET_DATEFORMAT, cMask )
dDate := CToD( cDate )
OutStd( hb_eol(), cDate, cMask, dDate, DToS( dDate ), DToC( dDate ) )
OutStd( hb_eol(), "" )
OutStd( hb_eol(), "49/02/04", cMask, CToD( "49/02/04" ) )
? cDate, cMask, dDate, DToS( dDate ), DToC( dDate )
?
? "49/02/04", cMask, CToD( "49/02/04" )
TestCentury( hb_eol() )
TestCentury()
OutStd( hb_eol(), "" )
?
cMask := "yyyy/dd/mm"
SET( _SET_DATEFORMAT, cMask )
Set( _SET_DATEFORMAT, cMask )
dDate := CToD( cDate )
OutStd( hb_eol(), cDate, cMask, dDate, DToS( dDate ), DToC( dDate ) )
OutStd( hb_eol(), "" )
OutStd( hb_eol(), "49/02/04", cMask, CToD( "49/02/04" ) )
? cDate, cMask, dDate, DToS( dDate ), DToC( dDate )
?
? "49/02/04", cMask, CToD( "49/02/04" )
OutStd( hb_eol(), "" )
?
cMask := "ddd/mmm/yy"
SET( _SET_DATEFORMAT, cMask )
Set( _SET_DATEFORMAT, cMask )
dDate := CToD( cDate )
OutStd( hb_eol(), cDate, cMask, dDate, DToS( dDate ), DToC( dDate ) )
? cDate, cMask, dDate, DToS( dDate ), DToC( dDate )
RETURN
PROCEDURE TestCentury()
OutStd( hb_eol(), "" )
OutStd( hb_eol(), __SetCentury() )
?
? __SetCentury()
__SetCentury( "ON" )
OutStd( __SetCentury() )
?? __SetCentury()
__SetCentury( "OFF" )
OutStd( __SetCentury() )
?? __SetCentury()
__SetCentury( "GIBBERISH" )
OutStd( __SetCentury() )
?? __SetCentury()
__SetCentury( .T. )
OutStd( __SetCentury() )
?? __SetCentury()
__SetCentury( 5 )
OutStd( __SetCentury() )
?? __SetCentury()
RETURN

View File

@@ -8,36 +8,36 @@ PROCEDURE Main()
LOCAL dDate := hb_SToD( "19990430" )
OutStd( Set( _SET_DATEFORMAT ), dDate, hb_eol() )
SET( _SET_DATEFORMAT, "yyy/mm/ddd" )
OutStd( Set( _SET_DATEFORMAT ), dDate, hb_eol() )
? Set( _SET_DATEFORMAT ), dDate
Set( _SET_DATEFORMAT, "yyy/mm/ddd" )
? Set( _SET_DATEFORMAT ), dDate
__SetCentury( "on" )
OutStd( Set( _SET_DATEFORMAT ), dDate, hb_eol() )
? Set( _SET_DATEFORMAT ), dDate
__SetCentury( "off" )
OutStd( Set( _SET_DATEFORMAT ), dDate, hb_eol() )
SET( _SET_DATEFORMAT, "yyy/m/d/yyy" )
OutStd( Set( _SET_DATEFORMAT ), dDate, hb_eol() )
? Set( _SET_DATEFORMAT ), dDate
Set( _SET_DATEFORMAT, "yyy/m/d/yyy" )
? Set( _SET_DATEFORMAT ), dDate
__SetCentury( "on" )
OutStd( Set( _SET_DATEFORMAT ), dDate, hb_eol() )
? Set( _SET_DATEFORMAT ), dDate
__SetCentury( "off" )
OutStd( Set( _SET_DATEFORMAT ), dDate, hb_eol() )
SET( _SET_DATEFORMAT, "m/d/y/m/d" )
OutStd( Set( _SET_DATEFORMAT ), dDate, hb_eol() )
? Set( _SET_DATEFORMAT ), dDate
Set( _SET_DATEFORMAT, "m/d/y/m/d" )
? Set( _SET_DATEFORMAT ), dDate
__SetCentury( "on" )
OutStd( Set( _SET_DATEFORMAT ), dDate, hb_eol() )
? Set( _SET_DATEFORMAT ), dDate
__SetCentury( "off" )
OutStd( Set( _SET_DATEFORMAT ), dDate, hb_eol() )
SET( _SET_DATEFORMAT, "mmmm/ddddd" )
OutStd( Set( _SET_DATEFORMAT ), dDate, hb_eol() )
? Set( _SET_DATEFORMAT ), dDate
Set( _SET_DATEFORMAT, "mmmm/ddddd" )
? Set( _SET_DATEFORMAT ), dDate
__SetCentury( "on" )
OutStd( Set( _SET_DATEFORMAT ), dDate, hb_eol() )
? Set( _SET_DATEFORMAT ), dDate
__SetCentury( "off" )
OutStd( Set( _SET_DATEFORMAT ), dDate, hb_eol() )
SET( _SET_DATEFORMAT, "mmmmm/dd" )
OutStd( Set( _SET_DATEFORMAT ), dDate, hb_eol() )
? Set( _SET_DATEFORMAT ), dDate
Set( _SET_DATEFORMAT, "mmmmm/dd" )
? Set( _SET_DATEFORMAT ), dDate
__SetCentury( "on" )
OutStd( Set( _SET_DATEFORMAT ), dDate, hb_eol() )
? Set( _SET_DATEFORMAT ), dDate
__SetCentury( "off" )
OutStd( Set( _SET_DATEFORMAT ), dDate, hb_eol() )
? Set( _SET_DATEFORMAT ), dDate
RETURN

View File

@@ -10,39 +10,39 @@ PROCEDURE Main()
LOCAL dDate, i
SET( _SET_DATEFORMAT, "dd/mm/yyyy" )
Set( _SET_DATEFORMAT, "dd/mm/yyyy" )
dDate := hb_SToD( "19990525" )
OutStd( dDate, DOW( dDate ), hb_eol() )
? dDate, DOW( dDate )
OutStd( LastMonday( dDate ), hb_eol() )
? LastMonday( dDate )
dDate += 3
OutStd( dDate, DOW( dDate ), hb_eol() )
? dDate, DOW( dDate )
dDate += 4
OutStd( dDate, DOW( dDate ), hb_eol() )
? dDate, DOW( dDate )
SET( _SET_DATEFORMAT, "mm/dd/yyyy" )
Set( _SET_DATEFORMAT, "mm/dd/yyyy" )
dDate := hb_SToD( "19990525" )
OutStd( dDate, DOW( dDate ), hb_eol() )
? dDate, DOW( dDate )
OutStd( LastMonday( dDate ), hb_eol() )
? LastMonday( dDate )
dDate += 3
OutStd( dDate, DOW( dDate ), hb_eol() )
? dDate, DOW( dDate )
dDate += 4
OutStd( dDate, DOW( dDate ), hb_eol() )
? dDate, DOW( dDate )
OutStd( hb_eol() )
?
dDate := Date ()
FOR i := 1 TO 7
OutStd( dDate, DOW( dDate ), hb_eol() )
? dDate, DOW( dDate )
dDate++
NEXT
OutStd( CToD( "" ), DOW( CToD( "" ) ), hb_eol() )
? CToD( "" ), DOW( CToD( "" ) )
RETURN

View File

@@ -6,9 +6,6 @@
* $Doc$
* $Description$ Debug function tests.
* Based on classes.prg
* $Requirement$ source\tools\stringp.prg
* source\rtl\objfunc.prg
* source\rtl\asort.prg
* $End$
*
* Written by Eddie Runia <eddie@runia.com>
@@ -24,43 +21,43 @@ PROCEDURE Main()
LOCAL oForm := TForm():New()
LOCAL nNumber := 15
QOut( oForm:ClassName() )
? oForm:ClassName()
oForm:Show()
QOut()
?
QOut( "-OBJECT additions-" )
QOut( "What is in oForm ? " )
? "-OBJECT additions-"
? "What is in oForm ? "
Debug( oForm:Transfer() )
QOut( "Does transfer exists ? ", __objHasMsg ( oForm, "Transfer" ) )
QOut( "Is transfer DATA ? ", __objHasData ( oForm, "Transfer" ) )
QOut( "Is transfer METHOD ? ", __objHasMethod( oForm, "Transfer" ) )
QOut( "Does nLeft exists ? ", __objHasMsg ( oForm, "nLeft" ) )
QOut( "Is nLeft DATA ? ", __objHasData ( oForm, "nLeft" ) )
QOut( "Is nLeft METHOD ? ", __objHasMethod( oForm, "nLeft" ) )
QOut( "Does unknown exists ? ", __objHasMsg ( oForm, "Unknown" ) )
QOut( "Is unknown DATA ? ", __objHasData ( oForm, "Unknown" ) )
QOut( "Is unknown METHOD ? ", __objHasMethod( oForm, "Unknown" ) )
? "Does transfer exists ? ", __objHasMsg ( oForm, "Transfer" )
? "Is transfer DATA ? ", __objHasData ( oForm, "Transfer" )
? "Is transfer METHOD ? ", __objHasMethod( oForm, "Transfer" )
? "Does nLeft exists ? ", __objHasMsg ( oForm, "nLeft" )
? "Is nLeft DATA ? ", __objHasData ( oForm, "nLeft" )
? "Is nLeft METHOD ? ", __objHasMethod( oForm, "nLeft" )
? "Does unknown exists ? ", __objHasMsg ( oForm, "Unknown" )
? "Is unknown DATA ? ", __objHasData ( oForm, "Unknown" )
? "Is unknown METHOD ? ", __objHasMethod( oForm, "Unknown" )
QOut( "Set nLeft to 50 and nRight to 100" )
? "Set nLeft to 50 and nRight to 100"
oForm:Transfer( { "nLeft", 50 }, { "nRight", 100 } )
Debug( oForm:Transfer() )
Pause()
QOut( "-DEBUG Functions-" )
QOut( "-Statics-" )
? "-DEBUG Functions-"
? "-Statics-"
Debug( __dbgVMVarSList() )
QOut( "-Global Stack-" )
Debug ( __dbgVMStkGList() )
? "-Global Stack-"
Debug( __dbgVMStkGList() )
QOut( "-Local Stack-" )
Debug ( __dbgVMStkLList() )
? "-Local Stack-"
Debug( __dbgVMStkLList() )
QOut( "-Parameters-" )
Debug ( __dbgVMParLList() )
? "-Parameters-"
Debug( __dbgVMParLList() )
Pause()
@@ -79,26 +76,26 @@ FUNCTION FuncSecond( nParam, cParam, uParam )
LOCAL xParam
LOCAL xStack
QOut()
QOut( "-Second procedure-" )
QOut()
?
? "-Second procedure-"
?
QOut( "-Statics-" )
Debug ( __dbgVMVarSList() )
QOut()
? "-Statics-"
Debug( __dbgVMVarSList() )
?
QOut( "-Global Stack- Len=", __dbgVMStkGCount() )
Debug ( __dbgVMStkGList() )
QOut()
? "-Global Stack- Len=", __dbgVMStkGCount()
Debug( __dbgVMStkGList() )
?
QOut( "-Local Stack- Len=", __dbgVMStkLCount() )
xStack := Debug ( __dbgVMStkLList() )
QOut()
? "-Local Stack- Len=", __dbgVMStkLCount()
xStack := Debug( __dbgVMStkLList() )
?
QOut( "-Parameters-" )
? "-Parameters-"
xParam := Debug( __dbgVMParLList() )
IF xParam[ xStack[ 7 ] ] == "Hello"
QOut( ":-)" )
? ":-)"
ENDIF
Pause()
@@ -162,7 +159,7 @@ STATIC FUNCTION Show()
LOCAL Self := QSelf()
QOut( "lets show a form from here :-)" )
? "lets show a form from here :-)"
RETURN NIL
@@ -252,10 +249,13 @@ STATIC FUNCTION Transfer( x1, x2, x3, x4, x5, x6, x7, x8, x9, x10 ) /* etc */
ELSEIF ValType( xData ) == "O" // Object passed
xRet := ::Transfer( xData:Transfer() )
ELSEIF !( ValType( xData ) == "U" )
QOut( "TRANSFER: Incorrect argument(", n, ") ", xData )
? "TRANSFER: Incorrect argument(", n, ") ", xData
ENDIF
NEXT
ENDIF
RETURN xRet
STATIC PROCEDURE Debug()
RETURN

View File

@@ -29,25 +29,26 @@ PROCEDURE Main()
// Try to copy 10 records, starting 5 records from EOF, using WHILE
GO BOTTOM
skip -4
SKIP -4
COPY WHILE ncount++ < 9 TO test4a DELIMITED
// Copy the last 10 records.
GO BOTTOM
skip -9
SKIP -9
COPY REST TO test5 DELIMITED
// Copy the last 10 records again.
GO BOTTOM
skip -9
SKIP -9
COPY TO test6 delimited WHILE ! EOF()
// Copy only some of the last 10 records.
GO BOTTOM
skip -9
SKIP -9
COPY REST TO test7 DELIMITED FOR _field->married
// Try to append from a file that we know does not exist.
DELETE file test8.txt
APPEND FROM test8 delimited
QUIT
RETURN

View File

@@ -14,13 +14,12 @@
PROCEDURE Main()
#ifdef __HARBOUR__
SET PRINTER TO devtesth
#else
SET PRINTER TO devtestc
#endif
SET DEVICE TO PRINTER
DevPos( - 2, 76 )
DevPos( -2, 76 )
? PRow(), PCol()
DevOut( "First text written!" )
? PRow(), PCol()
@@ -30,9 +29,9 @@ PROCEDURE Main()
? PRow(), PCol()
DevOut( "Off to the side!!" )
? PRow(), PCol()
DevPos( 8, - 12 )
DevPos( 8, -12 )
? PRow(), PCol()
DevPos( 13, - 12 )
DevPos( 13, -12 )
? PRow(), PCol()
DevOut( "More test text!" )
? PRow(), PCol()
@@ -44,4 +43,5 @@ PROCEDURE Main()
? PRow(), PCol()
DevOut( "!" )
? PRow(), PCol()
QUIT
RETURN

View File

@@ -15,18 +15,17 @@ PROCEDURE Main( filespec, attribs, cshort )
lShort := .T.
ENDIF
// aDir := ASort( Directory( filespec, attribs, lShort ),,, {| x, y | Upper( x[ F_NAME ] ) < Upper( y[ F_NAME ] ) } )
// aDir := ASort( Directory( filespec, attribs, lShort ),,, {| x, y | Upper( x[ F_NAME ] ) < Upper( y[ F_NAME ] ) } )
aDir := Directory( filespec, attribs, lShort )
SET CENTURY ON
FOR x := 1 TO Len( aDir )
OutStd( hb_eol() )
OutStd( PadR( aDir[ x, F_NAME ], 20 ), "|", ;
Transform( aDir[ x, F_SIZE ], "9,999,999,999" ), "|", ;
aDir[ x, F_DATE ], "|", ;
aDir[ x, F_TIME ], "|", ;
aDir[ x, F_ATTR ] )
? PadR( aDir[ x, F_NAME ], 20 ), "|", ;
Transform( aDir[ x, F_SIZE ], "9,999,999,999" ), "|", ;
aDir[ x, F_DATE ], "|", ;
aDir[ x, F_TIME ], "|", ;
aDir[ x, F_ATTR ]
NEXT
RETURN

View File

@@ -16,7 +16,7 @@ PROCEDURE Main()
LOCAL a, b, c, d, e, f, g, h, i, j, k, l
SetPos( - 2, 76 )
SetPos( -2, 76 )
DispOut( "You won't see this!" )
Tone( 440, 1 )
Inkey( 0 )
@@ -61,7 +61,7 @@ PROCEDURE Main()
SetPos( 6, 74 )
DispOut( "Partly off screen!" )
? Row(), Col()
SetPos( 8, - 12 )
SetPos( 8, -12 )
a := Row()
b := Col()
?? "PA"
@@ -73,7 +73,7 @@ PROCEDURE Main()
? a, b
? c, d
? e, f
SetPos( 13, - 12 )
SetPos( 13, -12 )
a := Row()
b := Col()
DispOut( "All off screen!" )
@@ -91,4 +91,5 @@ PROCEDURE Main()
Inkey( 0 )
SetPos( 50, 20 )
?? "On screen??"
QUIT
RETURN

View File

@@ -8,26 +8,26 @@ PROCEDURE Main()
LOCAL n := 2
QOut( "testing Harbour Do case" )
? "testing Harbour DO CASE"
DO CASE
CASE n == 1
QOut( "n is 1" )
QOut( "first case" )
? "n is 1"
? "first case"
CASE n == 2
QOut( "n is 2" )
QOut( "second case" )
? "n is 2"
? "second case"
CASE n == 3
QOut( "n is 3" )
QOut( "third case" )
? "n is 3"
? "third case"
OTHERWISE
QOut( "Sorry, I don't know what n is :-)" )
QOut( "otherwise" )
OTHERWISE
? "Sorry, I don't know what n is :-)"
? "otherwise"
ENDCASE
QOut( "Ok!" )
? "Ok!"
RETURN

View File

@@ -8,8 +8,6 @@
//
// This program shell to DOS
//
// Warning : DOS only
//
// Written by Eddie Runia <eddie@runia.com>
// www - http://harbour-project.org
//
@@ -18,16 +16,16 @@
PROCEDURE Main()
LOCAL cOs := Upper( OS() )
LOCAL cShell := GetEnv( "COMSPEC" )
LOCAL cShell
IF At( "WINDOWS", cOs ) != 0 .OR. At( "DOS", cOs ) != 0 ;
.OR. At( "OS/2", cOs ) != 0
? "About to shell to DOS.."
! ( cShell )
? "Hey, I am back !"
ELSE
? "Sorry this program is for Windows, DOS, and OS/2 only"
ENDIF
#if defined( __PLATFORM__UNIX )
cShell := GetEnv( "SHELL" )
#else
cShell := GetEnv( "COMSPEC" )
#endif
? "About to shell to OS.."
! ( cShell )
? "Hey, I am back !"
RETURN

View File

@@ -14,35 +14,35 @@
PROCEDURE Main()
? HB_DATETIME( 1974 )
? hb_DateTime( 1974 )
? " VALTYPE( HB_DATETIME() ) =>", VALTYPE( HB_DATETIME() )
? " YEAR( HB_DATETIME() ) =>", YEAR( HB_DATETIME() )
? " MONTH( HB_DATETIME() ) =>", MONTH( HB_DATETIME() )
? " DAY( HB_DATETIME() ) =>", DAY( HB_DATETIME() )
? " ValType( hb_DateTime() ) =>", ValType( hb_DateTime() )
? " Year( hb_DateTime() ) =>", Year( hb_DateTime() )
? " Month( hb_DateTime() ) =>", Month( hb_DateTime() )
? " Day( hb_DateTime() ) =>", Day( hb_DateTime() )
?
? " VALTYPE( HB_DATETIME( 1974, 5, 31 ) ) =>", VALTYPE( HB_DATETIME( 1974, 5, 31 ) )
? " YEAR( HB_DATETIME( 1974, 5, 31 ) ) =>", YEAR( HB_DATETIME( 1974, 5, 31 ) )
? " MONTH( HB_DATETIME( 1974, 5, 31 ) ) =>", MONTH( HB_DATETIME( 1974, 5, 31 ) )
? " DAY( HB_DATETIME( 1974, 5, 31 ) ) =>", DAY( HB_DATETIME( 1974, 5, 31 ) )
? " DTOC( HB_DATETIME( 1974, 5, 31 ) ) =>", DTOC( HB_DATETIME( 1974, 5, 31 ) )
? " ValType( hb_DateTime( 1974, 5, 31 ) ) =>", ValType( hb_DateTime( 1974, 5, 31 ) )
? " Year( hb_DateTime( 1974, 5, 31 ) ) =>", Year( hb_DateTime( 1974, 5, 31 ) )
? " Month( hb_DateTime( 1974, 5, 31 ) ) =>", Month( hb_DateTime( 1974, 5, 31 ) )
? " Day( hb_DateTime( 1974, 5, 31 ) ) =>", Day( hb_DateTime( 1974, 5, 31 ) )
? " DToC( hb_DateTime( 1974, 5, 31 ) ) =>", DToC( hb_DateTime( 1974, 5, 31 ) )
?
? " VALTYPE( HB_DATETIME( 1974, 31, 5, NIL, NIL, NIL ) ) =>", VALTYPE( HB_DATETIME( 1974, 31, 5, NIL, NIL, NIL ) )
? " ValType( hb_DateTime( 1974, 31, 5, NIL, NIL, NIL ) ) =>", ValType( hb_DateTime( 1974, 31, 5, NIL, NIL, NIL ) )
?
? " VALTYPE( HB_DATETIME( 2001, 10, 13, 18, 42, 16 ) ) =>", VALTYPE( HB_DATETIME( 2001, 10, 13, 18, 42, 16 ) )
? " ValType( hb_DateTime( 2001, 10, 13, 18, 42, 16 ) ) =>", ValType( hb_DateTime( 2001, 10, 13, 18, 42, 16 ) )
?
? " VALTYPE( HB_DATETIME( NIL, NIL, NIL, 10, 36, 05 ) ) =>", VALTYPE( HB_DATETIME( NIL, NIL, NIL, 10, 36, 05 ) )
? " HB_DATETIME( NIL, NIL, NIL, 10, 36, 05 ) =>", HB_DATETIME( NIL, NIL, NIL, 10, 36, 05 )
? " ValType( hb_DateTime( NIL, NIL, NIL, 10, 36, 05 ) ) =>", ValType( hb_DateTime( NIL, NIL, NIL, 10, 36, 05 ) )
? " hb_DateTime( NIL, NIL, NIL, 10, 36, 05 ) =>", hb_DateTime( NIL, NIL, NIL, 10, 36, 05 )
?
? " VALTYPE( HB_DATETIME( NIL, NIL, NIL, 10, 36, 05, 176 ) ) =>", VALTYPE( HB_DATETIME( NIL, NIL, NIL, 10, 36, 05, 176 ) )
? " HB_DATETIME( NIL, NIL, NIL, 10, 36, 05, 176 ) =>", HB_DATETIME( NIL, NIL, NIL, 10, 36, 05, 176 )
? " ValType( hb_DateTime( NIL, NIL, NIL, 10, 36, 05, 176 ) ) =>", ValType( hb_DateTime( NIL, NIL, NIL, 10, 36, 05, 176 ) )
? " hb_DateTime( NIL, NIL, NIL, 10, 36, 05, 176 ) =>", hb_DateTime( NIL, NIL, NIL, 10, 36, 05, 176 )
? " VALTYPE( HB_DATETIME( 0, 0, 0, 10, 36, 05, 176 ) ) =>", VALTYPE( HB_DATETIME( 0, 0, 0, 10, 36, 05, 176 ) )
? " HB_DATETIME( 0, 0, 0, 10, 36, 05, 176 ) =>", HB_DATETIME( 0, 0, 0, 10, 36, 05, 176 )
? " ValType( hb_DateTime( 0, 0, 0, 10, 36, 05, 176 ) ) =>", ValType( hb_DateTime( 0, 0, 0, 10, 36, 05, 176 ) )
? " hb_DateTime( 0, 0, 0, 10, 36, 05, 176 ) =>", hb_DateTime( 0, 0, 0, 10, 36, 05, 176 )
RETURN

View File

@@ -9,6 +9,6 @@ PROCEDURE Main()
LOCAL a, a
QOut( "ok" )
? "ok"
RETURN

View File

@@ -17,91 +17,91 @@ PROCEDURE Main()
LOCAL oForm := TForm():New()
QOut( "What methods are in the class :" )
? "What methods are in the class :"
Debug( __objGetMethodList( oForm ) )
/* Let's add an inline at run-time. Should already be possible */
QOut( "Let's add inline 'CalcArea' at run-time to an already instanced class" )
? "Let's add inline 'CalcArea' at run-time to an already instanced class"
__objAddInline( oForm, "CalcArea", ;
{| self | ( ::nRight - ::nLeft ) * ( ::nBottom - ::nTop ) } )
QOut( "What methods are in the class :" )
? "What methods are in the class :"
Debug( __objGetMethodList( oForm ) )
QOut( "What is the Form area ?" )
QOut( oForm:CalcArea() )
? "What is the Form area ?"
? oForm:CalcArea()
QOut( "Let's add method 'Smile' at run-time to an already instanced class" )
? "Let's add method 'Smile' at run-time to an already instanced class"
__objAddMethod( oForm, "Smile", @Smile() )
QOut( "What methods are in the class :" )
? "What methods are in the class :"
Debug( __objGetMethodList( oForm ) )
QOut( "Smile please " )
? "Smile please "
oForm:Smile()
Pause()
QOut( "Data items before" )
? "Data items before"
Debug( oForm )
QOut( "Let's add an additional data item" )
? "Let's add an additional data item"
__objAddData( oForm, "cHelp" )
oForm:cHelp := "This is a real tricky test"
QOut( "Data items after" )
? "Data items after"
Debug( oForm )
Pause()
QOut( "Let's attach a bigger smile" )
? "Let's attach a bigger smile"
__objModMethod( oForm, "Smile", @BigSmile() )
QOut( "Let's smile" )
? "Let's smile"
oForm:Smile()
QOut( "And CalcArea() will now give a result in square inches" )
? "And CalcArea() will now give a result in square inches"
__objModInline( oForm, "CalcArea", ;
{| self | ( ::nRight - ::nLeft ) * ( ::nBottom - ::nTop ) / ( 2.54 * 2.54 ) } )
QOut( "What is the Form area ?" )
QOut( oForm:CalcArea() )
? "What is the Form area ?"
? oForm:CalcArea()
QOut( "What methods are in the class :" )
? "What methods are in the class :"
Debug( __objGetMethodList( oForm ) )
QOut( "Delete CalcArea" )
? "Delete CalcArea"
__objDelInline( oForm, "CalcArea" )
QOut( "What methods are in the class :" )
? "What methods are in the class :"
Debug( __objGetMethodList( oForm ) )
QOut( "Delete Smile" )
? "Delete Smile"
__objDelMethod( oForm, "Smile" )
QOut( "What methods are in the class :" )
? "What methods are in the class :"
Debug( __objGetMethodList( oForm ) )
Pause()
QOut( "Data items before" )
? "Data items before"
Debug( oForm )
QOut( "Let's delete cHelp" )
? "Let's delete cHelp"
__objDelData( oForm, "cHelp" )
QOut( "Data items after" )
? "Data items after"
Debug( oForm )
/* oForm:cHelp := "Please crash" */
/* oForm:cHelp := "Please crash" */
RETURN
@@ -142,9 +142,9 @@ STATIC FUNCTION Smile()
LOCAL self := QSelf()
IF ::CalcArea() == 300
QOut( ":-)" )
? ":-)"
ELSE
QOut( ":-(" )
? ":-("
ENDIF
RETURN self
@@ -153,7 +153,7 @@ STATIC FUNCTION BigSmile()
LOCAL self := QSelf()
QOut( ":-)))" )
? ":-)))"
RETURN self
@@ -162,3 +162,6 @@ FUNCTION Pause()
__Accept( "Pause :" )
RETURN NIL
STATIC PROCEDURE Debug()
RETURN

View File

@@ -7,7 +7,7 @@ PROCEDURE Main()
LOCAL nPos
FOR nPos := 1 TO nCount
OutStd( __dynsGetName( nPos ), Chr(13) + Chr(10) )
? __dynsGetName( nPos )
NEXT
nPos := __dynsGetIndex( "MAIN" )

View File

@@ -15,7 +15,7 @@ PROCEDURE Main()
ENDIF
ENDDO
QOut( "do exit test", iif( x == 5, "passed", "fail" ) )
? "do exit test", iif( x == 5, "passed", "fail" )
FOR x := 1 TO 10
IF x == 5
@@ -23,6 +23,6 @@ PROCEDURE Main()
ENDIF
NEXT
QOut( "for exit test", iif( x == 5, "passed", "fail" ) )
? "for exit test", iif( x == 5, "passed", "fail" )
RETURN

View File

@@ -12,271 +12,271 @@ PROCEDURE Main()
SET CENTURY ON
QOut( "Testing Harbour Extended system:" )
QOut( "================================" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
? "Testing Harbour Extended system:"
? "================================"
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
__Accept( "Press return to continue..." )
QOut( "Strings:" )
QOut( "========" )
QOut( "" )
QOut( ' _parc() and _retc() with Strings1( "Hello" ) =>', Strings1( "Hello" ) )
QOut( ' _parc() and _retc() with Strings2( { "Hello" } ) =>', Strings2( { "Hello" } ) )
QOut( ' _retclen() with Strings3( "Hello word", 5 ) =>', Strings3( "Hello", 5 ) )
QOut( ' _parclen() with Strings4( "Hello word" ) => ', Strings4( "Hello word" ) )
? "Strings:"
? "========"
?
? ' _parc() and _retc() with Strings1( "Hello" ) =>', Strings1( "Hello" )
? ' _parc() and _retc() with Strings2( { "Hello" } ) =>', Strings2( { "Hello" } )
? ' _retclen() with Strings3( "Hello word", 5 ) =>', Strings3( "Hello", 5 )
? ' _parclen() with Strings4( "Hello word" ) => ', Strings4( "Hello word" )
uVar := "Hello word"
QOut( ' uVar := "Hello word"' )
? ' uVar := "Hello word"'
Strings5( @uVar, "Harbour power!!!" )
QOut( ' _storc() with Strings5( @uVar, "Harbour power!!!" ) => ', uVar )
? ' _storc() with Strings5( @uVar, "Harbour power!!!" ) => ', uVar
Strings6( @uVar, "Harbour power!!!", 7 )
QOut( ' _storclen() with Strings6( @uVar, "Harbour power!!!", 7 ) => ', uVar )
? ' _storclen() with Strings6( @uVar, "Harbour power!!!", 7 ) => ', uVar
uVar := { "Hello word" }
QOut( ' uVar := { "Hello word" }' )
? ' uVar := { "Hello word" }'
Strings7( uVar, "Harbour power!!!" )
QOut( ' _storc() with Strings7( uVar, "Harbour power!!!" ) => ', uVar[ 1 ] )
? ' _storc() with Strings7( uVar, "Harbour power!!!" ) => ', uVar[ 1 ]
Strings8( uVar, "Harbour power!!!", 7 )
QOut( ' _storclen() with Strings8( uVar, "Harbour power!!!", 7 ) => ', uVar[ 1 ] )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
? ' _storclen() with Strings8( uVar, "Harbour power!!!", 7 ) => ', uVar[ 1 ]
?
?
?
?
?
?
?
?
?
?
?
__Accept( "Press return to continue..." )
QOut( "Logicals:" )
QOut( "=========" )
QOut( "" )
QOut( ' _parl() and _retl() with Logical1( .T. ) =>', Logical1( .T. ) )
QOut( ' _parl() and _parl() with Logical2( { .T. } ) =>', Logical2( { .T. } ) )
? "Logicals:"
? "========="
?
? ' _parl() and _retl() with Logical1( .T. ) =>', Logical1( .T. )
? ' _parl() and _parl() with Logical2( { .T. } ) =>', Logical2( { .T. } )
uVar := .T.
QOut( ' uVar := .T.' )
? ' uVar := .T.'
Logical3( @uVar, .F. )
QOut( ' _storl() with Logical3( @uVar, .F. ) => ', uVar )
? ' _storl() with Logical3( @uVar, .F. ) => ', uVar
uVar := { .T. }
QOut( ' uVar := { .T. }' )
? ' uVar := { .T. }'
Logical4( uVar, .F. )
QOut( ' _storl() with Logical4( uVar, .F. ) => ', uVar[ 1 ] )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
? ' _storl() with Logical4( uVar, .F. ) => ', uVar[ 1 ]
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
__Accept( "Press return to continue..." )
QOut( "Dates: (SET CENTURY ON)" )
QOut( "=======================" )
QOut( "" )
QOut( ' _pards() and _retds() with Date1( CToD( "01/01/2000" ) ) =>', Date1( CToD( "01/01/2000" ) ) )
QOut( ' _pards() and retds() with Date2( { CToD( "01/01/2000" ) } ) =>', Date2( { CToD( "01/01/2000" ) } ) )
? "Dates: (SET CENTURY ON)"
? "======================="
?
? ' _pards() and _retds() with Date1( CToD( "01/01/2000" ) ) =>', Date1( CToD( "01/01/2000" ) )
? ' _pards() and retds() with Date2( { CToD( "01/01/2000" ) } ) =>', Date2( { CToD( "01/01/2000" ) } )
uVar := CToD( "01/01/2000" )
QOut( ' uVar := CToD( "01/01/2000" )' )
? ' uVar := CToD( "01/01/2000" )'
Date3( @uVar, CToD( "12/31/1999" ) )
QOut( ' _stords() with Date3( @uVar, CToD( "12/31/1999" ) ) => ', uVar )
? ' _stords() with Date3( @uVar, CToD( "12/31/1999" ) ) => ', uVar
uVar := { CToD( "01/01/2000" ) }
QOut( ' uVar := { CToD( "01/01/2000" ) }' )
? ' uVar := { CToD( "01/01/2000" ) }'
Date4( uVar, CToD( "12/31/1999" ) )
QOut( ' _stords() with Date4( uVar, CToD( "12/31/1999" ) ) => ', uVar[ 1 ] )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
? ' _stords() with Date4( uVar, CToD( "12/31/1999" ) ) => ', uVar[ 1 ]
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
__Accept( "Press return to continue..." )
QOut( "Numbers:" )
QOut( "========" )
QOut( "" )
QOut( ' _parni() and _retni() with Int1( 1 ) =>', Int1( 1 ) )
QOut( ' _parni() and _retni() with Int2( { 1 } ) =>', Int2( { 1 } ) )
QOut( ' _parnl() and _retnl() with Long1( 123456789 ) =>', Long1( 123456789 ) )
QOut( ' _parnl() and _retnl() with Long2( { 123456789 } ) =>', Long2( { 123456789 } ) )
QOut( ' _parnd() and _retnd() with Double1( 1234567.89 ) =>', Double1( 1234567.89 ) )
QOut( ' _parnd() and _retnd() with Double2( { 1234567.89 } ) =>', Double2( { 1234567.89 } ) )
? "Numbers:"
? "========"
?
? ' _parni() and _retni() with Int1( 1 ) =>', Int1( 1 )
? ' _parni() and _retni() with Int2( { 1 } ) =>', Int2( { 1 } )
? ' _parnl() and _retnl() with Long1( 123456789 ) =>', Long1( 123456789 )
? ' _parnl() and _retnl() with Long2( { 123456789 } ) =>', Long2( { 123456789 } )
? ' _parnd() and _retnd() with Double1( 1234567.89 ) =>', Double1( 1234567.89 )
? ' _parnd() and _retnd() with Double2( { 1234567.89 } ) =>', Double2( { 1234567.89 } )
uVar := 100
QOut( ' uVar := 100' )
? ' uVar := 100'
Int3( @uVar, 200 )
QOut( ' _storni() with Int3( @uVar, 200 ) => ', uVar )
? ' _storni() with Int3( @uVar, 200 ) => ', uVar
uVar := { 100 }
QOut( ' uVar := { 100 }' )
? ' uVar := { 100 }'
Int4( uVar, 200 )
QOut( ' _storni() with Int4( uVar, 200 ) => ', uVar[ 1 ] )
? ' _storni() with Int4( uVar, 200 ) => ', uVar[ 1 ]
uVar := 123456789
QOut( ' uVar := 123456789' )
? ' uVar := 123456789'
Long3( @uVar, 987654321 )
QOut( ' _stornl() with Long3( @uVar, 987654321 ) => ', uVar )
? ' _stornl() with Long3( @uVar, 987654321 ) => ', uVar
uVar := { 123456789 }
QOut( ' uVar := { 123456789 }' )
? ' uVar := { 123456789 }'
Long4( uVar, 987654321 )
QOut( ' _stornl() with Long4( uVar, 987654321 ) => ', uVar[ 1 ] )
? ' _stornl() with Long4( uVar, 987654321 ) => ', uVar[ 1 ]
uVar := 1234567.89
QOut( ' uVar := 1234567.89' )
? ' uVar := 1234567.89'
Double3( @uVar, 9876543.21 )
QOut( ' _stornd() with Double3( @uVar, 9876543.21 ) => ', uVar )
? ' _stornd() with Double3( @uVar, 9876543.21 ) => ', uVar
uVar := { 1234567.89 }
QOut( ' uVar := { 1234567.89 }' )
? ' uVar := { 1234567.89 }'
Double4( uVar, 9876543.21 )
QOut( ' _stornl() with Double4( uVar, 9876543.21 ) => ', uVar[ 1 ] )
QOut( "" )
QOut( "" )
QOut( "" )
? ' _stornl() with Double4( uVar, 9876543.21 ) => ', uVar[ 1 ]
?
?
?
__Accept( "Press return to continue..." )
QOut( "Nil:" )
QOut( "====" )
QOut( "" )
QOut( ' _ret() with Nil1() =>', Nil1() )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
? "Nil:"
? "===="
?
? ' _ret() with Nil1() =>', Nil1()
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
__Accept( "Press return to continue..." )
QOut( "Arrays:" )
QOut( "=======" )
QOut( "" )
QOut( ' _reta() with Len( Arrays1( 100 ) ) =>', Len( Arrays1( 100 ) ) )
QOut( ' _parinfa() with Arrays2( { 1, "a", .T. }, 0 ) =>', Arrays2( { 1, "a", .T. }, 0 ) )
QOut( ' _parinfa() with Arrays2( { 1, "a", .T. }, 2 ) =>', Arrays2( { 1, "a", .T. }, 2 ), "( IT_STRING )" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
? "Arrays:"
? "======="
?
? ' _reta() with Len( Arrays1( 100 ) ) =>', Len( Arrays1( 100 ) )
? ' _parinfa() with Arrays2( { 1, "a", .T. }, 0 ) =>', Arrays2( { 1, "a", .T. }, 0 )
? ' _parinfa() with Arrays2( { 1, "a", .T. }, 2 ) =>', Arrays2( { 1, "a", .T. }, 2 ), "( IT_STRING )"
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
__Accept( "Press return to continue..." )
QOut( "Parameters info:" )
QOut( "================" )
QOut( "" )
QOut( ' _pcount() with Params1( 1, "a", .T., 10 ) =>', Params1( 1, "a", .T. , 10 ) )
QOut( ' _parinfo() with Params2( 1, "a", .T., 0 ) =>', Params2( 1, "a", .T. , 0 ) )
QOut( ' _parinfo() with Params2( 1, "a", .T., 3 ) =>', Params2( 1, "a", .T. , 3 ), "( IT_LOGICAL )" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
? "Parameters info:"
? "================"
?
? ' _pcount() with Params1( 1, "a", .T., 10 ) =>', Params1( 1, "a", .T. , 10 )
? ' _parinfo() with Params2( 1, "a", .T., 0 ) =>', Params2( 1, "a", .T. , 0 )
? ' _parinfo() with Params2( 1, "a", .T., 3 ) =>', Params2( 1, "a", .T. , 3 ), "( IT_LOGICAL )"
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
__Accept( "Press return to continue..." )
QOut( "Undocumented features:" )
QOut( "======================" )
QOut( "" )
QOut( ' _parc( -1, ...) with Undoc2() =>', Undoc2() )
QOut( ' _parclen( -1, ...) with Undoc3() =>', Undoc3() )
QOut( ' _pards( -1, ...) with Undoc4( CToD( "01/01/2000" ) ) =>', Undoc4( CToD( "01/01/2000" ) ) )
QOut( ' _parl( -1, ...) with Undoc5( .T. ) =>', Undoc5( .T. ) )
QOut( ' _parnd( -1, ...) with Undoc6( 1234567.89 ) =>', Undoc6( 1234567.89 ) )
QOut( ' _parni( -1, ...) with Undoc7( 1234 ) =>', Undoc7( 1234 ) )
QOut( ' _parnl( -1, ...) with Undoc8( 123456789 ) =>', Undoc8( 123456789 ) )
QOut( ' _parinfa( -1, ...) with Undoc9( 10 ) =>', Undoc9( 10 ) )
QOut( ' _parinfo( -1 ) with Undoc10() =>', Undoc10(), "( IT_STRING )" )
QOut( ' _storc( szText, -1, ... ) with Undoc11( "Hello word" ) =>', Undoc11( "Hello word" ) )
QOut( ' _storclen( szText, -1, ... ) with Undoc12( "Hello word", 7 ) =>', Undoc12( "Hello word", 7 ) )
QOut( ' _stords( szDate, -1, ... ) with Undoc13( CToD( "01/01/2000" ) ) =>', Undoc13( CToD( "01/01/2000" ) ) )
QOut( ' _storl( iLogical, -1 ) with Undoc14( .T. ) =>', Undoc14( .T. ) )
QOut( ' _storni( iValue, -1 ) with Undoc15( 1234 ) =>', Undoc15( 1234 ) )
QOut( ' _stornl( lValue, -1 ) with Undoc16( 123456789 ) =>', Undoc16( 123456789 ) )
QOut( ' _stornd( dValue, -1 ) with Undoc17( 1234567.89 ) =>', Undoc17( 1234567.89 ) )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
QOut( "" )
? "Undocumented features:"
? "======================"
?
? ' _parc( -1, ...) with Undoc2() =>', Undoc2()
? ' _parclen( -1, ...) with Undoc3() =>', Undoc3()
? ' _pards( -1, ...) with Undoc4( CToD( "01/01/2000" ) ) =>', Undoc4( CToD( "01/01/2000" ) )
? ' _parl( -1, ...) with Undoc5( .T. ) =>', Undoc5( .T. )
? ' _parnd( -1, ...) with Undoc6( 1234567.89 ) =>', Undoc6( 1234567.89 )
? ' _parni( -1, ...) with Undoc7( 1234 ) =>', Undoc7( 1234 )
? ' _parnl( -1, ...) with Undoc8( 123456789 ) =>', Undoc8( 123456789 )
? ' _parinfa( -1, ...) with Undoc9( 10 ) =>', Undoc9( 10 )
? ' _parinfo( -1 ) with Undoc10() =>', Undoc10(), "( IT_STRING )"
? ' _storc( szText, -1, ... ) with Undoc11( "Hello word" ) =>', Undoc11( "Hello word" )
? ' _storclen( szText, -1, ... ) with Undoc12( "Hello word", 7 ) =>', Undoc12( "Hello word", 7 )
? ' _stords( szDate, -1, ... ) with Undoc13( CToD( "01/01/2000" ) ) =>', Undoc13( CToD( "01/01/2000" ) )
? ' _storl( iLogical, -1 ) with Undoc14( .T. ) =>', Undoc14( .T. )
? ' _storni( iValue, -1 ) with Undoc15( 1234 ) =>', Undoc15( 1234 )
? ' _stornl( lValue, -1 ) with Undoc16( 123456789 ) =>', Undoc16( 123456789 )
? ' _stornd( dValue, -1 ) with Undoc17( 1234567.89 ) =>', Undoc17( 1234567.89 )
?
?
?
?
?
RETURN

View File

@@ -7,8 +7,8 @@ PROCEDURE Main()
LOCAL n
FOR n := 1 TO 20
QOut( FibR( n ) )
QOut( FibI( n ) )
? FibR( n )
? FibI( n )
NEXT
RETURN

View File

@@ -14,30 +14,30 @@ PROCEDURE Main()
LOCAL n
QOut( "Testing Harbour For Next loops. Going up quick" )
? "Testing Harbour For Next loops. Going up quick"
FOR n := 1 TO 10 STEP 4
QOut( n )
NEXT n
? n
NEXT
QOut( "Going down" )
? "Going down"
FOR n := 10 TO 1 STEP -1
QOut( n )
NEXT n
? n
NEXT
QOut( "No step" )
? "No step"
FOR n := 1 TO 10
QOut( n )
NEXT n
? n
NEXT
QOut( "No production" )
? "No production"
FOR n := 1 TO 10 STEP -1
QOut( n )
NEXT n
? n
NEXT
QOut( "Ok!" )
? "Ok!"
RETURN

View File

@@ -9,10 +9,6 @@
// TODO: add test for "step 0"
#ifndef __HARBOUR__
#xtranslate hb_eol() => ( Chr( 13 ) + Chr( 10 ) )
#endif
STATIC snFrom
STATIC snTo
STATIC snStep
@@ -22,7 +18,7 @@ PROCEDURE Main()
LOCAL array
LOCAL tmp, n
QOut( "Testing Harbour For Next loops." )
? "Testing Harbour For Next loops."
array := { ;
{ 1, 10, 1 }, ;
@@ -40,14 +36,13 @@ PROCEDURE Main()
snTo := array[ tmp ][ 2 ]
snStep := array[ tmp ][ 3 ]
OutStd( " From: " ) ; OutStd( snFrom )
OutStd( " To: " ) ; OutStd( snTo )
OutStd( " Step: " ) ; OutStd( snStep )
OutStd( hb_eol() )
? " From:", snFrom,;
" To:", snTo,;
" Step:", snStep
FOR n := Eval( {|| ValFrom() } ) TO Eval( {|| ValTo() } ) STEP Eval( {|| ValStep() } )
OutStd( "Exec " ) ; OutStd( n ) ; OutStd( hb_eol() )
NEXT n
? "Exec", n
NEXT
NEXT
@@ -55,18 +50,18 @@ PROCEDURE Main()
STATIC FUNCTION ValFrom()
OutStd( "From" ) ; OutStd( hb_eol() )
? "From"
RETURN snFrom
STATIC FUNCTION ValTo()
OutStd( "To" ) ; OutStd( hb_eol() )
? "To"
RETURN snTo
STATIC FUNCTION ValStep()
OutStd( "Step" ) ; OutStd( hb_eol() )
? "Step"
RETURN snStep

View File

@@ -15,43 +15,43 @@ PROCEDURE Main()
LOCAL a
QOut( "Direct reference : ", aFunc()[ 1 ] )
? "Direct reference : ", aFunc()[ 1 ]
a := aFunc()
QOut( "Ref via array : ", a[ 1 ] )
? "Ref via array : ", a[ 1 ]
aFunc()[ 1 ] := "Something different"
QOut( "Assign new text : ", aFunc()[ 1 ] )
? "Assign new text : ", aFunc()[ 1 ]
aFunc()[ 1 ] := 4
QOut( "Assign 4 : ", aFunc()[ 1 ] )
? "Assign 4 : ", aFunc()[ 1 ]
QOut( "Post increment : ", aFunc()[ 1 ]++ )
QOut( "After : ", aFunc()[ 1 ] )
QOut( "Pre decrement : ", --aFunc()[ 1 ] )
QOut( "After : ", aFunc()[ 1 ] )
? "Post increment : ", aFunc()[ 1 ]++
? "After : ", aFunc()[ 1 ]
? "Pre decrement : ", --aFunc()[ 1 ]
? "After : ", aFunc()[ 1 ]
aFunc()[ 1 ] += 2
QOut( "Plus 2 : ", aFunc()[ 1 ] )
? "Plus 2 : ", aFunc()[ 1 ]
aFunc()[ 1 ] -= 3
QOut( "Minus 3 : ", aFunc()[ 1 ] )
? "Minus 3 : ", aFunc()[ 1 ]
aFunc()[ 1 ] *= 3
QOut( "Times 3 : ", aFunc()[ 1 ] )
? "Times 3 : ", aFunc()[ 1 ]
aFunc()[ 1 ] /= 1.5
QOut( "Divide by 1.5 : ", aFunc()[ 1 ] )
? "Divide by 1.5 : ", aFunc()[ 1 ]
aFunc()[ 1 ] %= 4
QOut( "Modulus 4 : ", aFunc()[ 1 ] )
? "Modulus 4 : ", aFunc()[ 1 ]
aFunc()[ 1 ] ^= 3
QOut( "To the power 3 : ", aFunc()[ 1 ] )
? "To the power 3 : ", aFunc()[ 1 ]
QOut( "Global stack" )
? "Global stack"
Debug( __dbgVMStkGList() ) // Please note a is a reference to aArray !
QOut( "Statics" )
? "Statics"
Debug( __dbgVMVarSList() )
RETURN
@@ -61,3 +61,6 @@ FUNCTION aFunc()
STATIC aArray := { [Test] }
RETURN aArray
STATIC PROCEDURE Debug()
RETURN

View File

@@ -11,6 +11,7 @@
*/
#include "directry.ch"
#include "simpleio.ch"
PROCEDURE Main( cRoot )
LOCAL aEntry
@@ -39,7 +40,7 @@ PROCEDURE Main( cRoot )
cDir := hb_DirSepAdd( cDir )
ENDIF
OutStd( "Root: " + cRoot + hb_eol() )
? "Root: " + cRoot
aDir := { cRoot }
@@ -69,11 +70,11 @@ PROCEDURE Main( cRoot )
or .pdf */
FOR EACH tmp IN aErrMsg
OutStd( tmp + hb_eol() )
? tmp
NEXT
IF ! Empty( aEntry )
OutStd( __hbdoc_savehbd( cName, aEntry ), cName, Len( aEntry ), hb_eol() )
? __hbdoc_savehbd( cName, aEntry ), cName, Len( aEntry )
ENDIF
NEXT

View File

@@ -16,33 +16,35 @@
//REQUEST RMDBFCDX
PROCEDURE Main()
FIELD FIRST, LAST, STREET, CITY
LOCAL n, hs
if ascan( rddList(1), "RMDBFCDX" ) != 0
IF AScan( rddList( 1 ), "RMDBFCDX" ) != 0
rddSetDefault( "RMDBFCDX" )
endif
ENDIF
use test shared
hs := HS_INDEX( "test", "FIRST+LAST+STREET+CITY", 2, 0, , .T., 3 )
USE test shared
hs := hs_Index( "test", "FIRST+LAST+STREET+CITY", 2, 0, , .T., 3 )
/* Look for all records which have 'SHERMAN' string inside */
HS_SET( hs, "SHERMAN" )
while ( n := HS_NEXT( hs ) ) > 0
dbgoto( n )
if HS_VERIFY( hs ) > 0
? rtrim( FIRST+LAST+STREET+CITY )
endif
enddo
wait
hs_Set( hs, "SHERMAN" )
WHILE ( n := hs_Next( hs ) ) > 0
dbGoto( n )
IF hs_Verify( hs ) > 0
? RTrim( FIRST + LAST + STREET + CITY )
ENDIF
ENDDO
WAIT
/* Does RDD support Record Map Filters? */
if dbinfo( DBI_RM_SUPPORTED )
IF dbInfo( DBI_RM_SUPPORTED )
/* if yest then let set filter for all records with 'SHERMAN'
word and look at them in browser */
HS_FILTER( hs, "SHERMAN" )
dbgotop()
browse()
endif
HS_CLOSE( hs )
RETURN
hs_Filter( hs, "SHERMAN" )
dbGoTop()
Browse()
ENDIF
hs_Close( hs )
RETURN

View File

@@ -2,37 +2,37 @@
* $Id$
*/
// Testing Harbour If elseif else endif
// Testing Harbour IF ELSEIF ELSE ENDIF
PROCEDURE Main()
LOCAL i
QOut( "Testing Harbour If elseif else endif" )
? "Testing Harbour IF ELSEIF ELSE ENDIF"
FOR i := 1 TO 5
TestValue( i )
NEXT
RETURN
FUNCTION TestValue( x )
PROCEDURE TestValue( x )
IF x = 1
QOut( "x is 1" )
IF x == 1
? "x is 1"
ELSEIF x = 2
QOut( "x is 2" )
ELSEIF x == 2
? "x is 2"
ELSEIF x = 3
QOut( "x is 3" )
ELSEIF x == 3
? "x is 3"
ELSEIF x = 4
QOut( "x is 4" )
ELSEIF x == 4
? "x is 4"
ELSE
QOut( "x is not 1 or 2 or 3 or 4" )
? "x is not 1 or 2 or 3 or 4"
ENDIF
QOut( "Ok!" )
? "Ok!"
RETURN NIL
RETURN

View File

@@ -7,19 +7,19 @@ PROCEDURE Main( cFilename, cSection )
LOCAL oIni := TIniFile():New( Default( cFilename, "harbour.ini" ) )
LOCAL s, n := Val( Default( cSection, "1" ) )
QOut( "" )
QOut( "Sections:" )
?
? "Sections:"
s := oIni:ReadSections()
AEval( s, {| x | QOut( "[" + x + "]" ) } )
QOut( "" )
QOut( "[" + s[ n ] + "]" )
?
? "[" + s[ n ] + "]"
s := oIni:ReadSection( s[ n ] )
AEval( s, {| x | QOut( x ) } )
oIni:WriteDate( "Date Test", "Today", Date() )
oIni:WriteBool( "Bool Test", "True", .T. )
QOut( oIni:ReadBool( "Bool Test", "True", .F. ) )
? oIni:ReadBool( "Bool Test", "True", .F. )
oIni:UpdateFile()

View File

@@ -12,48 +12,48 @@ PROCEDURE Main()
STATIC static_var := "MAIN()"
QOut( "Hello from:", static_var )
static_var_accessed_in_INIT_function ++
QOut( "global static=", static_var_accessed_in_INIT_function )
? "Hello from:", static_var
static_var_accessed_in_INIT_function++
? "global static=", static_var_accessed_in_INIT_function
// Use PUBLIC variable created in INIT PROCEDURE
QOut( "PUBLIC variable created in INIT PROCEDURE=", _initStatics )
? "PUBLIC variable created in INIT PROCEDURE=", _initStatics
RETURN
INIT FUNCTION SecondOne()
STATIC static_var := "SECOND()"
QOut( "Hello from:", static_var )
static_var_accessed_in_INIT_function ++
QOut( "global static=", static_var_accessed_in_INIT_function )
? "Hello from:", static_var
static_var_accessed_in_INIT_function++
? "global static=", static_var_accessed_in_INIT_function
RETURN NIL
INIT FUNCTION Third()
STATIC static_var := "THIRD()"
QOut( "Hello from:", static_var )
static_var_accessed_in_INIT_function ++
QOut( "global static=", static_var_accessed_in_INIT_function )
? "Hello from:", static_var
static_var_accessed_in_INIT_function++
? "global static=", static_var_accessed_in_INIT_function
RETURN NIL
EXIT FUNCTION Fifth()
STATIC static_var := "FIFTH()"
QOut( "Hello from:", static_var )
static_var_accessed_in_INIT_function --
QOut( "global static=", static_var_accessed_in_INIT_function )
? "Hello from:", static_var
static_var_accessed_in_INIT_function--
? "global static=", static_var_accessed_in_INIT_function
RETURN NIL
EXIT FUNCTION Sixth()
STATIC static_var := "SIXTH()"
QOut( "Hello from:", static_var )
static_var_accessed_in_INIT_function --
QOut( "global static=", static_var_accessed_in_INIT_function )
? "Hello from:", static_var
static_var_accessed_in_INIT_function--
? "global static=", static_var_accessed_in_INIT_function
RETURN NIL

View File

@@ -42,7 +42,8 @@ PROCEDURE Main( cSkip, cRaw )
TEST7( cSkip, cRaw )
?
QUIT
RETURN
PROCEDURE Results()

View File

@@ -10,7 +10,7 @@ PROCEDURE Main()
LOCAL oForm := TForm():New()
QOut( oForm:ClassName() )
? oForm:ClassName()
oForm:cText := "Let's show a form here :-)"
oForm:Show()

View File

@@ -4,9 +4,9 @@
PROCEDURE Main()
QOut( C_FUNC() )
? C_FUNC()
QOut( EndDumpTest() )
? EndDumpTest()
RETURN

View File

@@ -11,23 +11,23 @@ PROCEDURE Main()
LOCAL ntmp := 1
h := FCreate( "test.txt" )
QOut( "create handle", h )
? "create handle", h
FWrite( h, "This test worked if you can see this" )
FClose( h )
h := FOpen( "test.txt" )
QOut( "open handle", h )
QOut()
? "open handle", h
?
/* try to read what is there */
DO WHILE ntmp != 0
ntmp := FRead( h, @cstr, 1 )
IF ntmp > 0
QQOut( cstr )
?? cstr
ENDIF
ENDDO
QOut()
?
FClose( h )

View File

@@ -11,19 +11,19 @@ PROCEDURE Main()
LOCAL cstr := " "
h := FCreate( "test.txt" )
QOut( "create handle", h )
? "create handle", h
FWrite( h, "This test worked if you can see this" )
FClose( h )
h := FOpen( "test.txt" )
QOut( "open handle", h )
QOut()
? "open handle", h
?
/* try to read what is there */
DO WHILE Asc( cstr ) != 0
cstr := FReadStr( h, 1 )
QQOut( cstr )
?? cstr
ENDDO
FClose( h )

View File

@@ -8,7 +8,7 @@
#define ADDRESS "127.0.0.1"
#define PORT 10000
#define EOT ( Chr( 4 ) )
#define EOT hb_BChar( 4 )
PROCEDURE Main()
@@ -21,10 +21,10 @@ PROCEDURE Main()
? "socket connect error " + hb_ntos( hb_socketGetError() )
ENDIF
? hb_socketSend( hSocket, "hi" + EOT )
? hb_socketSend( hSocket, "how" + EOT )
? hb_socketSend( hSocket, "you doing?" + EOT )
? hb_socketSend( hSocket, "quit" + EOT )
? hb_socketSend( hSocket, "hi" + EOT )
? hb_socketSend( hSocket, "how" + EOT )
? hb_socketSend( hSocket, "you doing?" + EOT )
? hb_socketSend( hSocket, "quit" + EOT )
hb_socketShutdown( hSocket )
hb_socketClose( hSocket )

View File

@@ -8,10 +8,12 @@
#define ADDRESS "0.0.0.0"
#define PORT 10000
#define EOT ( Chr( 4 ) )
#define TIMEOUT 3000 // 3s
#define EOT hb_BChar( 4 )
#define TIMEOUT 3000 // 3 seconds
#ifndef __HBSCRIPT__HBSHELL
REQUEST HB_MT
#endif
PROCEDURE Main()
@@ -66,10 +68,10 @@ PROCEDURE process( hSocket )
DO WHILE .T.
cRequest := ""
nLen := 1
DO WHILE At( EOT, cRequest ) == 0 .AND. nLen > 0
DO WHILE hb_BAt( EOT, cRequest ) == 0 .AND. nLen > 0
cBuf := Space( 4096 )
IF ( nLen := hb_socketRecv( hSocket, @cBuf,,, 10000 ) ) > 0 /* Timeout */
cRequest += Left( cBuf, nLen )
cRequest += hb_BLeft( cBuf, nLen )
ELSE
IF nLen == -1 .AND. hb_socketGetError() == HB_SOCKET_ERR_TIMEOUT
nLen := 0
@@ -77,7 +79,7 @@ PROCEDURE process( hSocket )
ENDIF
ENDDO
IF nLen == - 1
IF nLen == -1
? "recv() error:", hb_socketGetError()
ELSEIF nLen == 0
? "connection closed"

View File

@@ -7,10 +7,12 @@
//
// Placed in the public domain
#include "simpleio.ch"
PROCEDURE Main()
LOCAL c := "This is a very long string. This may seem silly however strings like this are still used. Not by good programmers though, but I've seen stuff like this used for Copyright messages and other long text. What is the point to all of this you'd say. Well I am coming to the point right now, the constant string is limited to 256 characters and this string is a lot bigger. Do you get my drift ? If there is somebody who has read this line upto the very end: Esto es un sombrero grande ridiculo." + Chr( 13 ) + Chr( 10 ) + "/" + Chr( 13 ) + Chr( 10 ) + "[;-)" + Chr( 13 ) + Chr( 10 ) + "\"
OutStd( c )
? c
RETURN

View File

@@ -9,58 +9,58 @@ PROCEDURE Main()
LOCAL nOldMathErrMode
LOCAL bOldMathErr
QOut( "Testing math function: EXP(), LOG() and SQRT():" )
QOut( "" )
QOut( " I) Test with correct arguments:" )
QOut( " exp(0.0) == 1.00 ? ", Exp( 0.0 ) )
QOut( " exp(1.0) == 2.71(8)... ? ", Exp( 1.0 ) )
QOut( " exp(-1.0) == 0.36(7)... ? ", Exp( - 1.0 ) )
QOut( "" )
QOut( " log(1.0) == 0.00 ? ", Log( 1.0 ) )
QOut( " log(2.7) == 0.99(3)... ? ", Log( 2.7 ) )
QOut( " log(0.36) == -1.02(1)... ? ", Log( 0.36 ) )
QOut( "" )
QOut( " sqrt(1.0) == 1.00 ? ", Sqrt( 1.0 ) )
QOut( " sqrt(4.0) == 2.00 ? ", Sqrt( 4.0 ) )
QOut( " sqrt(2.0) == 1.41(4).. ? ", Sqrt( 2.0 ) )
QOut( "" )
QOut( " II) Test with numeric but incorrect arguments:" )
QOut( "" )
QOut( " IIa) default error handling(by the functions themselves)" )
QOut( " exp(-1000) == 0.00 ?", Exp( - 1000 ) )
QOut( " exp(1000) == ****... ?", Exp( 1000 ) )
QOut( "" )
QOut( " log(0) == ****... ?", Log( 0 ) )
QOut( " log(-10) == *****... ?", Log( - 10 ) )
QOut( "" )
QOut( " sqrt(-4) == 0.00 ?", Sqrt( - 4 ) )
QOut( "" )
? "Testing math function: EXP(), LOG() and SQRT():"
?
? " I) Test with correct arguments:"
? " exp(0.0) == 1.00 ? ", Exp( 0.0 )
? " exp(1.0) == 2.71(8)... ? ", Exp( 1.0 )
? " exp(-1.0) == 0.36(7)... ? ", Exp( - 1.0 )
?
? " log(1.0) == 0.00 ? ", Log( 1.0 )
? " log(2.7) == 0.99(3)... ? ", Log( 2.7 )
? " log(0.36) == -1.02(1)... ? ", Log( 0.36 )
?
? " sqrt(1.0) == 1.00 ? ", Sqrt( 1.0 )
? " sqrt(4.0) == 2.00 ? ", Sqrt( 4.0 )
? " sqrt(2.0) == 1.41(4).. ? ", Sqrt( 2.0 )
?
? " II) Test with numeric but incorrect arguments:"
?
? " IIa) default error handling(by the functions themselves)"
? " exp(-1000) == 0.00 ?", Exp( -1000 )
? " exp(1000) == ****... ?", Exp( 1000 )
?
? " log(0) == ****... ?", Log( 0 )
? " log(-10) == *****... ?", Log( -10 )
?
? " sqrt(-4) == 0.00 ?", Sqrt( -4 )
?
nOldMathErrMode := hb_matherMode( HB_MATH_ERRMODE_USERDEFAULT )
QOut( " IIb) error handling by error(hb_MathErMode() == HB_MATH_ERRMODE_USERDEFAULT)" )
QOut( " exp(-1000) == 0.00 ?", Exp( - 1000 ) )
QOut( " exp(1000) == ****... ?", Exp( 1000 ) )
QOut( "" )
QOut( " log(0) == ****... ?", Log( 0 ) )
QOut( " log(-10) == *****... ?", Log( - 10 ) )
QOut( "" )
QOut( " sqrt(-4) == 0.00 ?", Sqrt( - 4 ) )
QOut( "" )
? " IIb) error handling by error(hb_MathErMode() == HB_MATH_ERRMODE_USERDEFAULT)"
? " exp(-1000) == 0.00 ?", Exp( -1000 )
? " exp(1000) == ****... ?", Exp( 1000 )
?
? " log(0) == ****... ?", Log( 0 )
? " log(-10) == *****... ?", Log( -10 )
?
? " sqrt(-4) == 0.00 ?", Sqrt( -4 )
?
hb_matherMode( nOldMathErrMode )
bOldMathErr := hb_matherBlock( {| nType, cFuncname, cError, nArg1, nArg2, aInfo |;
localmatherr( nType, cFuncname, cError, nArg1, nArg2, aInfo ) } )
QOut( " IIc) error handling by callback block(hb_MathErBlock())" )
QOut( " exp(-1000) == ?", Exp( - 1000 ) )
QOut( " exp(1000) == ?", Exp( 1000 ) )
QOut( "" )
QOut( " log(0) == ?", Log( 0 ) )
QOut( " log(-10) == ?", Log( - 10 ) )
QOut( "" )
QOut( " sqrt(-4) == ?", Sqrt( - 4 ) )
? " IIc) error handling by callback block(hb_MathErBlock())"
? " exp(-1000) == ?", Exp( -1000 )
? " exp(1000) == ?", Exp( 1000 )
?
? " log(0) == ?", Log( 0 )
? " log(-10) == ?", Log( -10 )
?
? " sqrt(-4) == ?", Sqrt( -4 )
hb_matherBlock( bOldMathErr )
@@ -70,24 +70,24 @@ FUNCTION localmatherr( nType, cFuncname, cError, nArg1, nArg2, aInfo )
LOCAL cStr := "!! Local handling of math error MATH/"
cStr += AllTrim( Str( nType ) ) + " in " + cFuncname + "("
cStr += hb_ntos( nType ) + " in " + cFuncname + "("
IF ValType( nArg1 ) == "N"
cStr += AllTrim( Str( nArg1 ) )
cStr += hb_ntos( nArg1 )
ENDIF
IF ValType( nArg2 ) == "N"
cStr += "," + AllTrim( Str( nArg2 ) )
cStr += "," + hb_ntos( nArg2 )
ENDIF
cStr += "):"
QOut( cStr )
QOut( "!! " + cError )
? cStr
? "!! " + cError
IF aInfo[HB_MATHERRORBLOCK_HANDLED]
QOut( "!! --> already handled with return value: " + ;
AllTrim( Str( aInfo[HB_MATHERRORBLOCK_RETVAL] ) ) )
? "!! --> already handled with return value: " + ;
hb_ntos( aInfo[HB_MATHERRORBLOCK_RETVAL] )
RETURN 1
ENDIF
QOut( "!! setting return value to --> 5.0" )
? "!! setting return value to --> 5.0"
aInfo[ HB_MATHERRORBLOCK_RETVAL ] := 5.0
aInfo[ HB_MATHERRORBLOCK_HANDLED ] := .T.

View File

@@ -62,13 +62,13 @@ PROCEDURE Test1()
// PUBLIC overrided by PRIVATE overrided by uninitialized PUBLIC
PUBL memvar1
QOut( "==Test 1==PUBLIC -> PRIVATE -> PUBLIC" )
QOut( memvar1 )
? "==Test 1==PUBLIC -> PRIVATE -> PUBLIC"
? memvar1
memvar1 := "main"
QOut( "in MAIN=", memvar1 )
? "in MAIN=", memvar1
Scope( memvar1 )
QOut( "back in MAIN=", memvar1 )
QOut( "" )
? "back in MAIN=", memvar1
?
RETURN
@@ -77,7 +77,7 @@ FUNCTION Scope( value )
PRIVA memvar1 := "scope"
Scope2()
QOut( "in SCOPE=", memvar1 )
? "in SCOPE=", memvar1
RETURN value
@@ -85,7 +85,7 @@ PROCEDURE Scope2()
PUBLIC memvar1
QOut( "in SCOPE2=", memvar1 )
? "in SCOPE2=", memvar1
RETURN
@@ -96,13 +96,13 @@ PROCEDURE Test2()
// PUBLIC overrided by PUBLIC overrided by uninitialized PUBLIC
PUBLIC memvar2
QOut( "==Test 2==PUBLIC -> PUBLIC -> PUBLIC" )
QOut( memvar2 )
? "==Test 2==PUBLIC -> PUBLIC -> PUBLIC"
? memvar2
memvar2 := "main"
QOut( "in MAIN=", memvar2 )
? "in MAIN=", memvar2
Scope3( memvar2 )
QOut( "back in MAIN=", memvar2 )
QOut( "" )
? "back in MAIN=", memvar2
?
RETURN
@@ -111,7 +111,7 @@ FUNCTION Scope3( value )
PUBLIC memvar2 := "scope"
Scope4()
QOut( "in SCOPE=", memvar2 )
? "in SCOPE=", memvar2
RETURN value
@@ -119,7 +119,7 @@ PROCEDURE Scope4()
PUBLIC memvar2
QOut( "in SCOPE2=", memvar2 )
? "in SCOPE2=", memvar2
RETURN
@@ -130,13 +130,13 @@ PROCEDURE Test3()
// PUBLIC overrided by PRIVATE overrided by initialized PUBLIC
PUBLIC memvar3
QOut( "==Test 3==PUBLIC -> PRIVATE -> PUBLIC:=" )
QOut( memvar3 )
? "==Test 3==PUBLIC -> PRIVATE -> PUBLIC:="
? memvar3
memvar3 := "main"
QOut( "in MAIN=", memvar3 )
? "in MAIN=", memvar3
Scope5( memvar3 )
QOut( "back in MAIN=", memvar3 )
QOut( "" )
? "back in MAIN=", memvar3
?
RETURN
@@ -145,7 +145,7 @@ FUNCTION Scope5( value )
PRIVATE memvar3 := "scope"
Scope6()
QOut( "in SCOPE=", memvar3 )
? "in SCOPE=", memvar3
RETURN value
@@ -153,7 +153,7 @@ PROCEDURE Scope6()
PUBLIC memvar3 := "scope2"
QOut( "in SCOPE2=", memvar3 )
? "in SCOPE2=", memvar3
RETURN
@@ -170,7 +170,7 @@ PROCEDURE Test4()
QOut( "in MAIN=", memvar4 )
Scope7( memvar4 )
QOut( "back in MAIN=", memvar4 )
QOut( "" )
?
RETURN
@@ -179,7 +179,7 @@ FUNCTION Scope7( value )
PUBLIC memvar4 := "scope"
Scope8()
QOut( "in SCOPE=", memvar4 )
? "in SCOPE=", memvar4
RETURN value
@@ -187,7 +187,7 @@ PROCEDURE Scope8()
PUBLIC memvar4 := "scope2"
QOut( "in SCOPE2=", memvar4 )
? "in SCOPE2=", memvar4
RETURN
@@ -201,32 +201,32 @@ PROCEDURE TEST5()
PRIVATE memprivate
PARAMETERS memparam
QOut( "==Test for memvars passed by reference and __PUBLIC/__PRIVATE " )
QOut( " uninitialized PUBLIC= ", mempublic )
// QOut( "uninitialized PUBLIC array (first item)=", public2[ 1 ] )
QOut( "initialized PUBLIC= ", public3 )
QOut( " uninitialized PRIVATE= ", memprivate )
QOut( "uninitialized PARAMETER= ", memparam )
// QOut( memnone )
? "==Test for memvars passed by reference and __PUBLIC/__PRIVATE "
? " uninitialized PUBLIC= ", mempublic
// ? "uninitialized PUBLIC array (first item)=", public2[ 1 ]
? "initialized PUBLIC= ", public3
? " uninitialized PRIVATE= ", memprivate
? "uninitialized PARAMETER= ", memparam
// ? memnone
mempublic := "PUBLIC"
QOut( " PUBLIC with new value= ", mempublic )
? " PUBLIC with new value= ", mempublic
memprivate := "PRIVATE"
QOut( " PRIVATE with new value= ", memprivate )
? " PRIVATE with new value= ", memprivate
memparam := "PARAMETER"
QOut( "PARAMETER with new value= ", memparam )
// memnone =4
// Qout( memnone )
? "PARAMETER with new value= ", memparam
// memnone := 4
// ? memnone
QOut( " PUBLIC after passing by reference= ", UseVar( @mempublic ) )
QOut( " PRIVATE after passing by reference= ", UseVar( @memprivate ) )
QOut( "PARAMETER after passing by reference= ", UseVar( @memparam ) )
// Qout( Use( @memnone ) )
? " PUBLIC after passing by reference= ", UseVar( @mempublic )
? " PRIVATE after passing by reference= ", UseVar( @memprivate )
? "PARAMETER after passing by reference= ", UseVar( @memparam )
// QOut( Use( @memnone ) )
#ifdef __HARBOUR__
QOut( "PUBLIC created by __PUBLIC function=", public1 )
? "PUBLIC created by __PUBLIC function=", public1
#endif
QOut( "" )
?
RETURN
@@ -236,16 +236,16 @@ FUNCTION UseVar( value )
#ifdef __HARBOUR__
__mvPublic( "public1" ) //, "public21" )
// __mvPRIVATE( "private1", "private2", "private3" )
// __mvPRIVATE( "private1", "private2", "private3" )
__mvPrivate( { "private1", "private2", "private3" } )
QOut( "undeclared PUBLIC created by __PUBLIC function=", public1 )
QOut( "undeclared PRIVATE created by __PRIVATE function=", private1 )
QOut( "undeclared PRIVATE created by __PRIVATE function=", private2 )
QOut( "undeclared PRIVATE created by __PRIVATE function=", private3 )
? "undeclared PUBLIC created by __PUBLIC function=", public1
? "undeclared PRIVATE created by __PRIVATE function=", private1
? "undeclared PRIVATE created by __PRIVATE function=", private2
? "undeclared PRIVATE created by __PRIVATE function=", private3
public1 := "public created by __PUBLIC"
#endif
QOut( "" )
?
RETURN value
@@ -262,9 +262,9 @@ PROCEDURE Test6()
PUBLIC publCB
PRIVATE privVar := " (PRIVATE in MAIN) "
QOut( "== Test for detached PRIVATE variables" )
? "== Test for detached PRIVATE variables"
DetachMemvar( "detached memvar" )
QOut( Eval( publCB, "in Main: " ) )
? Eval( publCB, "in Main: " )
RETURN
@@ -273,7 +273,7 @@ PROCEDURE DetachMemvar( cValue )
PRIVATE privVar := " (PRIVATE in DetachMemvar) "
publCB := {| x | x + privVar + cValue }
QOut( Eval( publCB, "in DetachMemvar: " ) )
? Eval( publCB, "in DetachMemvar: " )
RETURN
@@ -284,10 +284,10 @@ PROCEDURE Test7( )
PARAMETERS para1, para2, para3
PARAM parameter1again
QOut( "Parameter 1 =", para1 )
QOut( "Parameter 2 =", para2 )
QOut( "Parameter 3 =", para3 )
QOut( "Parameter 4 =", parameter1again )
? "Parameter 1 =", para1
? "Parameter 2 =", para2
? "Parameter 3 =", para3
? "Parameter 4 =", parameter1again
RETURN
@@ -297,19 +297,19 @@ PROCEDURE Test8()
PRIVATE private1 := "PRIVATE1"
QOut( "In Test8 before UsePriv" )
QOut( "Private1 = ", private1 )
? "In Test8 before UsePriv"
? "Private1 = ", private1
UsePriv( private1 )
QOut( "In Test8 after UsePriv" )
QOut( "Private1 = ", private1 )
? "In Test8 after UsePriv"
? "Private1 = ", private1
__Accept( "press Enter..." )
QOut( "In Test8 before UsePriv with reference" )
QOut( "Private1 = ", private1 )
? "In Test8 before UsePriv with reference"
? "Private1 = ", private1
UsePriv( @private1 )
QOut( "In Test8 after UsePriv with reference" )
QOut( "Private1 = ", private1 )
? "In Test8 after UsePriv with reference"
? "Private1 = ", private1
RETURN
@@ -317,13 +317,13 @@ PROCEDURE UsePriv()
PARAMETERS param1
QOut( "In UsePriv before UseParam" )
QOut( "Private1 = ", private1 )
QOut( "Param1 = ", param1 )
? "In UsePriv before UseParam"
? "Private1 = ", private1
? "Param1 = ", param1
UseParam()
QOut( "In UsePriv after UseParam" )
QOut( "Private1 = ", private1 )
QOut( "Param1 = ", param1 )
? "In UsePriv after UseParam"
? "Private1 = ", private1
? "Param1 = ", param1
RETURN
@@ -331,16 +331,16 @@ PROCEDURE UseParam()
PARAMETER param2
QOut( "In UseParam before assignment" )
QOut( "Private1 = ", private1 )
QOut( "Param1 = ", param1 )
QOut( "Param2 = ", param2 )
? "In UseParam before assignment"
? "Private1 = ", private1
? "Param1 = ", param1
? "Param2 = ", param2
param2 := "PARAM2"
param1 := "new value"
QOut( "In UseParam after assignment" )
QOut( "Private1 = ", private1 )
QOut( "Param1 = ", param1 )
QOut( "Param2 = ", param2 )
? "In UseParam after assignment"
? "Private1 = ", private1
? "Param1 = ", param1
? "Param2 = ", param2
RETURN
@@ -353,13 +353,13 @@ PROCEDURE TEST9()
memvar := 19
QOut( "Variable with the name of module (memvar)=", memvar )
? "Variable with the name of module (memvar)=", memvar
memfunc := 33
QOut( "Variable with the name of function =", memfunc )
QOut( "Return value from a function=", memfunc( 9 ) )
? "Variable with the name of function =", memfunc
? "Return value from a function=", memfunc( 9 )
// mem()
// mem()
RETURN
@@ -370,10 +370,10 @@ STATIC FUNCTION memfunc( memfunc )
INIT PROCEDURE initmem()
PARA MEMVAR
PARA initmem
QOut( "Tests for PARAMETERS, PRIVATE nad PUBLIC variables" )
QOut( "" )
QOut( "in INIT function - Passed parameter = ", memvar )
QOut( "in INIT function - Passed parameter with different name = ", initmem )
QOut( "" )
? "Tests for PARAMETERS, PRIVATE nad PUBLIC variables"
?
? "in INIT function - Passed parameter = ", memvar
? "in INIT function - Passed parameter with different name = ", initmem
?
RETURN

View File

@@ -33,6 +33,6 @@ FUNCTION ShoutArg( nArg, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10 )
HB_SYMBOL_UNUSED( x9 )
HB_SYMBOL_UNUSED( x10 )
QOut( nArg, "==", hb_PValue( nArg ) )
? nArg, "==", hb_PValue( nArg )
RETURN NIL

View File

@@ -13,11 +13,11 @@ PROCEDURE Main()
LOCAL e := 0xABAB // Automatic support for hexadecimal numbers
LOCAL f := .12
QOut( a )
QOut( b )
QOut( c )
QOut( d )
QOut( e )
QOut( f )
? a
? b
? c
? d
? e
? f
RETURN

View File

@@ -15,48 +15,48 @@ PROCEDURE Main()
LOCAL o := TNumber():New()
QOut( "Direct reference : ", ToChar( o:x ) )
? "Direct reference : ", hb_ValToStr( o:x )
o:x[ 1 ] := "I am a data"
o:Get()[ 2 ] := "I am a method"
QOut( "Assign text : ", ToChar( o:x ) )
? "Assign text : ", hb_ValToStr( o:x )
o:x[ 1 ] := 4
o:Get()[ 2 ] := 4
QOut( "Assign 4 : ", ToChar( o:x ) )
? "Assign 4 : ", hb_ValToStr( 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 ] )
? "Post increment : ", o:x[ 1 ]++ , o:Get()[ 2 ]++
? "After : ", o:x[ 1 ] , o:Get()[ 2 ]
? "Pre decrement : ", --o:x[ 1 ] , --o:Get()[ 2 ]
? "After : ", o:x[ 1 ] , o:Get()[ 2 ]
o:x[ 1 ] += 2
o:Get()[ 2 ] += 2
QOut( "Plus 2 : ", ToChar( o:x ) )
? "Plus 2 : ", hb_ValToStr( o:x )
o:x[ 1 ] -= 3
o:Get()[ 2 ] -= 3
QOut( "Minus 3 : ", ToChar( o:x ) )
? "Minus 3 : ", hb_ValToStr( o:x )
o:x[ 1 ] *= 3
o:Get()[ 2 ] *= 3
QOut( "Times 3 : ", ToChar( o:x ) )
? "Times 3 : ", hb_ValToStr( o:x )
o:x[ 1 ] /= 1.5
o:Get()[ 2 ] /= 1.5
QOut( "Divide by 1.5 : ", ToChar( o:x ) )
? "Divide by 1.5 : ", hb_ValToStr( o:x )
o:x[ 1 ] %= 4
o:Get()[ 2 ] %= 4
QOut( "Modulus 4 : ", ToChar( o:x ) )
? "Modulus 4 : ", hb_ValToStr( o:x )
o:x[ 1 ] ^= 3
o:Get()[ 2 ] ^= 3
QOut( "To the power 3 : ", ToChar( o:x ) )
? "To the power 3 : ", hb_ValToStr( o:x )
QOut( "Global stack" )
? "Global stack"
Debug( __dbgVMStkGList() )
QOut( "Statics" )
? "Statics"
Debug( __dbgVMVarSList() )
RETURN
@@ -88,4 +88,7 @@ STATIC FUNCTION Get()
LOCAL self := QSelf()
return ::x
RETURN ::x
STATIC PROCEDURE Debug()
RETURN

View File

@@ -15,40 +15,40 @@ PROCEDURE Main()
LOCAL o := TNumber():New()
QOut( "Direct reference : ", o:x )
? "Direct reference : ", o:x
o:x := "I am a data"
QOut( "Assign text : ", o:x )
? "Assign text : ", o:x
o:x := 4
QOut( "Assign 4 : ", o:x )
? "Assign 4 : ", o:x
QOut( "Post increment : ", o:x++ )
QOut( "After : ", o:x )
QOut( "Pre decrement : ", --o:x )
QOut( "After : ", o:x )
? "Post increment : ", o:x++
? "After : ", o:x
? "Pre decrement : ", --o:x
? "After : ", o:x
o:x += 2
QOut( "Plus 2 : ", o:x )
? "Plus 2 : ", o:x
o:x -= 3
QOut( "Minus 3 : ", o:x )
? "Minus 3 : ", o:x
o:x *= 3
QOut( "Times 3 : ", o:x )
? "Times 3 : ", o:x
o:x /= 1.5
QOut( "Divide by 1.5 : ", o:x )
? "Divide by 1.5 : ", o:x
o:x %= 4
QOut( "Modulus 4 : ", o:x )
? "Modulus 4 : ", o:x
o:x ^= 3
QOut( "To the power 3 : ", o:x )
? "To the power 3 : ", o:x
QOut( "Global stack" )
? "Global stack"
Debug( __dbgVMStkGList() )
QOut( "Statics" )
? "Statics"
Debug( __dbgVMVarSList() )
RETURN
@@ -74,3 +74,6 @@ STATIC FUNCTION New()
::x := 1
RETURN self
STATIC PROCEDURE Debug()
RETURN

View File

@@ -11,15 +11,15 @@ PROCEDURE Main()
LOCAL oObject := TAny():New()
QOut( ValType( oObject ) )
QOut( Len( oObject ) ) // 3 datas !
QOut( oObject:ClassH() ) // retrieves the handle of its class
? ValType( oObject )
? Len( oObject ) // 3 datas !
? oObject:ClassH() // retrieves the handle of its class
QOut( oObject:ClassName() ) // retrieves its class name
? oObject:ClassName() // retrieves its class name
oObject:Test() // This invokes the below defined Test function
// See QSelf() and :: use
QOut( oObject:cName )
? oObject:cName
oObject:DoNothing() // a virtual method does nothing,
// but it is very usefull for Classes building logic
@@ -47,8 +47,8 @@ STATIC FUNCTION New()
LOCAL Self := QSelf()
QOut( ValType( Self ) )
QOut( "Inside New()" )
? ValType( Self )
? "Inside New()"
::cName := "Harbour OOP"
@@ -58,8 +58,8 @@ STATIC FUNCTION Test()
LOCAL Self := QSelf() // We access Self for this method
QOut( "Test method invoked!" )
? "Test method invoked!"
QOut( ::ClassName() ) // :: means Self: It is a Harbour built-in operator
? ::ClassName() // :: means Self: It is a Harbour built-in operator
RETURN NIL

View File

@@ -6,6 +6,6 @@
PROCEDURE Main()
QOut( OS() )
? OS()
RETURN

View File

@@ -17,31 +17,31 @@ PROCEDURE Main()
LOCAL oString := TString():New( "Hello" )
QOut( "Testing TString with Operator Overloading" )
QOut( oString:cValue )
QOut( "---" )
? "Testing TString with Operator Overloading"
? oString:cValue
? "---"
? ValType( oString )
QOut( "Equal........:", oString = "Hello" )
QOut( "Exactly Equal:", oString == "Hello" )
QOut( "Not Equal != :", oString != "Hello" )
QOut( "Not Equal <> :", oString <> "Hello" )
QOut( "Not Equal # :", oString # "Hello" )
QOut( "Substring $ :", oString $ "Hello" )
QOut( "Less than :", oString < "Hello" )
QOut( "Less than or Equal:", oString <= "Hello" )
QOut( "Greater than :", oString > "Hello" )
QOut( "Greater than or Equal:", oString >= "Hello" )
QOut( "Concatenation + :", oString + "Hello" )
QOut( "Concatenation - :", oString - "Hello" )
QOut( "Array index[2] :", oString[ 2 ] )
QOut( "Array index[3] := 'X' :", oString[ 3 ] := 'X' )
QOut( oString:cValue )
? "Equal........:", oString = "Hello"
? "Exactly Equal:", oString == "Hello"
? "Not Equal != :", oString != "Hello"
? "Not Equal <> :", oString <> "Hello"
? "Not Equal # :", oString # "Hello"
? "Substring $ :", oString $ "Hello"
? "Less than :", oString < "Hello"
? "Less than or Equal:", oString <= "Hello"
? "Greater than :", oString > "Hello"
? "Greater than or Equal:", oString >= "Hello"
? "Concatenation + :", oString + "Hello"
? "Concatenation - :", oString - "Hello"
? "Array index[2] :", oString[ 2 ]
? "Array index[3] := 'X' :", oString[ 3 ] := 'X'
? oString:cValue
RETURN
CREATE CLASS tString
CREATE CLASS TString
VAR cValue
@@ -62,43 +62,3 @@ CREATE CLASS tString
SubStr( ::cValue, nIndex, 1 ) )
ENDCLASS
/*
FUNCTION TString()
STATIC oClass
IF oClass == NIL
oClass = HBClass():New( "TSTRING" ) // starts a new class definition
oClass:AddData( "cValue" ) // define this class objects datas
oClass:AddMethod( "New", @New() )
oClass:AddInline( "==", {| self, cTest | ::cValue == cTest } )
oClass:AddInline( "!=", {| self, cTest | ::cValue != cTest } )
oClass:AddInline( "<" , {| self, cTest | ::cValue < cTest } )
oClass:AddInline( "<=", {| self, cTest | ::cValue <= cTest } )
oClass:AddInline( ">" , {| self, cTest | ::cValue > cTest } )
oClass:AddInline( ">=", {| self, cTest | ::cValue >= cTest } )
oClass:AddInline( "+" , {| self, cTest | ::cValue + cTest } )
oClass:AddInline( "-" , {| self, cTest | ::cValue - cTest } )
oClass:AddInline( "$" , {| self, cTest | ::cValue $ cTest } )
oClass:AddInline( "HasMsg", {| self, cMsg | __objHasMsg( QSelf(), cMsg ) } )
oClass:Create() // builds this class
ENDIF
RETURN oClass:Instance() // builds an object of this class
STATIC FUNCTION New( cText )
LOCAL Self := QSelf()
::cValue := cText
RETURN Self
*/

View File

@@ -14,8 +14,8 @@
#endif
PROCEDURE Main()
Local x
Local y
LOCAL x
LOCAL y
// Simple one to start with.
x := ( 1 )
@@ -47,23 +47,23 @@ PROCEDURE Main()
// Now mix with statements and functions
? ( 1, 2, 3 )
If ( y := .t. )
IF ( y := .t. )
? "Working"
Else
ELSE
? "Borken"
EndIf
ENDIF
If ( x := 10, y := ( x == 10 ) )
IF ( x := 10, y := ( x == 10 ) )
? "Working"
Else
ELSE
? "Broken"
EndIf
ENDIF
If ( Something( 1, 2, 3 ), .T. )
IF ( Something( 1, 2, 3 ), .T. )
? "Working"
Else
ELSE
? "Broken"
EndIf
ENDIF
?
@@ -79,15 +79,15 @@ PROCEDURE Main()
* because IF token followed by any three expressions is interpreted
* as IIF inline
*/
// IF( .T., .F., .T. )
// ? "Working"
// ELSE
// ? "Broken"
// ENDIF
// IF( .T., .F., .T. )
// ? "Working"
// ELSE
// ? "Broken"
// ENDIF
Return
RETURN
Static Function Something( x, y, z )
STATIC FUNCTION Something( x, y, z )
// This does something and it does it well/

View File

@@ -9,12 +9,12 @@ PROCEDURE Main()
LOCAL a := 10
LOCAL b := "X"
QOut( 'a := 10', a )
QOut( 'b := "X"', b )
? 'a := 10', a
? 'b := "X"', b
testfun( @a, @b )
QOut( 'return of "a" should = 20', a, iif( a == 20,"worked","failed" ) )
QOut( 'return of "b" should = A', b, iif( b == "A","worked","failed" ) )
? 'return of "a" should = 20', a, iif( a == 20, "worked", "failed" )
? 'return of "b" should = A', b, iif( b == "A", "worked", "failed" )
RETURN
@@ -22,7 +22,7 @@ FUNCTION testfun( b, c )
b := b + 10
c := "A"
QOut( 'a pointer+10 =', b )
QOut( 'b pointer := "A" =', c )
? 'a pointer + 10 =', b
? 'b pointer := "A" =', c
RETURN NIL

View File

@@ -33,7 +33,7 @@ FUNCTION Five()
LOCAL n := 0
WHILE ! Empty( ProcName( n ) )
QQOut( "Called from: ", ProcName( n ), ProcLine( n++ ), hb_eol() )
?? "Called from: ", ProcName( n ), ProcLine( n++ ), hb_eol()
ENDDO
RETURN NIL

View File

@@ -6,11 +6,12 @@
PROCEDURE Main()
QOut( "Testing recursive calls" + hb_eol() )
? "Testing recursive calls"
?
QOut( f( 10 ) )
? f( 10 )
QOut( 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1 )
? 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1
RETURN

View File

@@ -6,15 +6,15 @@
PROCEDURE Main()
QOut( "From Main()" )
? "From Main()"
Two( 1 )
QOut( "back to Main()" )
? "back to Main()"
Two( 2 )
QOut( "back to Main()" )
? "back to Main()"
RETURN
@@ -22,14 +22,14 @@ FUNCTION Two( n )
DO CASE
CASE n == 1
QOut( "n == 1" )
? "n == 1"
RETURN NIL
CASE n == 2
QOut( "n == 2" )
? "n == 2"
RETURN NIL
ENDCASE
QOut( "This message should not been seen" )
? "This message should not been seen"
RETURN NIL

View File

@@ -13,12 +13,11 @@ PROCEDURE Main()
LOCAL n, value := - 5
FOR n := 1 TO 100
OutStd( hb_eol() )
OutStd( value )
OutStd( Round( value, 3 ) )
OutStd( Round( value, 2 ) )
OutStd( Round( value, 1 ) )
OutStd( Round( value, 0 ) )
? value,;
Round( value, 3 ) ,;
Round( value, 2 ) ,;
Round( value, 1 ) ,;
Round( value, 0 )
value += 0.001
NEXT

View File

@@ -29,25 +29,26 @@ PROCEDURE Main()
// Try to copy 10 records, starting 5 records from EOF, using WHILE
GO BOTTOM
skip -4
SKIP -4
COPY WHILE ncount++ < 9 TO test4a SDF
// Copy the last 10 records.
GO BOTTOM
skip -9
SKIP -9
COPY REST TO test5 SDF
// Copy the last 10 records again.
GO BOTTOM
skip -9
SKIP -9
COPY TO test6 SDF WHILE !EOF()
// Copy only some of the last 10 records.
GO BOTTOM
skip -9
SKIP -9
COPY REST TO test7 SDF for _field->married
// Try to append from a file that we know does not exist.
DELETE file test8.txt
APPEND FROM test8 SDF
QUIT
RETURN

View File

@@ -12,19 +12,18 @@ PROCEDURE Main( cParam )
LOCAL n, limit := 10
CLS
IF ! Empty( cParam )
limit := Val( cParam )
ENDIF
OutStd( hb_eol() )
OutStd( Seconds() )
? Seconds()
FOR n := 1 TO limit
IF Empty( cParam )
OutStd( hb_eol() )
OutStd( "Pause: " )
? "Pause:"
Inkey( 0 )
ENDIF
OutStd( hb_eol() )
OutStd( Seconds() )
? Seconds()
NEXT
RETURN

View File

@@ -11,8 +11,7 @@ PROCEDURE Main()
LOCAL n
FOR n := 1 TO _SET_COUNT
OutStd( hb_eol() )
OutStd( Set( n ) )
? Set( n )
NEXT
RETURN

View File

@@ -86,10 +86,8 @@ PROCEDURE Main()
PROCEDURE testline( c, n )
OutStd( hb_eol() )
OutStd( Str( n, 3 ) )
OutStd( " " )
OutStd( PadR( c, 20 ) )
OutStd( Set( n ) )
? Str( n, 3 ) ,;
PadR( c, 20 ) ,;
Set( n )
RETURN

View File

@@ -6,12 +6,12 @@ PROCEDURE Main()
LOCAL start := Seconds(), stop
QOut( "start ", start )
? "start ", start
Tone( 440, 9.1 )
Tone( 880, 9.1 )
Tone( 440, 9.1 )
stop := Seconds()
QOut( "stop ", stop )
QOut( "duration", ( stop - start ), "(should be close to 1.5)" )
? "stop ", stop
? "duration", ( stop - start ), "(should be close to 1.5)"
RETURN

View File

@@ -6,16 +6,16 @@
PROCEDURE Main()
QOut( "From Main()" )
? "From Main()"
SecondOne()
QOut( "From Main() again" )
? "From Main() again"
RETURN
STATIC FUNCTION SecondOne()
QOut( "From Second()" )
? "From Second()"
RETURN NIL

View File

@@ -12,12 +12,12 @@ PROCEDURE Main()
STATIC a := "Hello", b := { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
QOut( a )
QOut( b[ 2 ] )
? a
? b[ 2 ]
Two()
QOut( "Ok!" )
? "Ok!"
FOR i := 1 TO 10
NumStat()
@@ -25,7 +25,7 @@ PROCEDURE Main()
cb := DetachVar( 10 )
FOR i := 1 TO 10
QOut( Eval( cb, b[ i ] ) )
? Eval( cb, b[ i ] )
NEXT
RETURN
@@ -34,13 +34,13 @@ FUNCTION Two()
STATIC a := "Test"
QOut( a )
? a
RETURN NIL
FUNCTION THREE( p )
QOut( p )
? p
RETURN p
@@ -56,8 +56,8 @@ PROCEDURE NumStat( a )
HB_SYMBOL_UNUSED( a )
cb := {| x | s_z + Str( x ) }
QOut( ++s_n )
QOut( Eval( cb, s_n ) )
? ++s_n
? Eval( cb, s_n )
RETURN

View File

@@ -10,22 +10,22 @@ STATIC uOne, uTwo
PROCEDURE Main()
QOut( "Statics overlapped!" )
QOut( "===================" )
QOut( "" )
QOut( "INSIDE statics1.prg" )
QOut( " static uOne, uTwo" )
QOut( "" )
QOut( " uOne, uTwo =>", uOne, ",", uTwo )
? "Statics overlapped!"
? "==================="
?
? "INSIDE statics1.prg"
? " static uOne, uTwo"
?
? " uOne, uTwo =>", uOne, ",", uTwo
uOne := 1
uTwo := 2
QOut( " uOne := 1" )
QOut( " uOne := 2" )
QOut( " uOne, uTwo =>", uOne, ",", uTwo )
QOut( "" )
? " uOne := 1"
? " uOne := 2"
? " uOne, uTwo =>", uOne, ",", uTwo
?
Test()
QOut( "INSIDE statics1.prg" )
QOut( " uOne, uTwo =>", uOne, ",", uTwo )
QOut( "" )
? "INSIDE statics1.prg"
? " uOne, uTwo =>", uOne, ",", uTwo
?
RETURN

View File

@@ -10,16 +10,16 @@ STATIC uA, uB
PROCEDURE Test()
QOut( "INSIDE statics2.prg" )
QOut( " static uA, uB" )
QOut( "" )
QOut( " ValType( uA ), ValType( uB ) =>", ValType( uA ), ",", ValType( uB ) )
QOut( " uA, uB =>", uA, ",", uB )
? "INSIDE statics2.prg"
? " static uA, uB"
?
? " ValType( uA ), ValType( uB ) =>", ValType( uA ), ",", ValType( uB )
? " uA, uB =>", uA, ",", uB
uA := "a"
uB := "b"
QOut( ' uA := "a"' )
QOut( ' uB := "b"' )
QOut( " uA, uB =>", uA, ",", uB )
QOut( "" )
? ' uA := "a"'
? ' uB := "b"'
? " uA, uB =>", uA, ",", uB
?
RETURN

View File

@@ -8,12 +8,12 @@ PROCEDURE Main()
aArray[ 1 /*first*/ ][ 1 /* second */ ] := [Hello]
QOut( aArray[ 1 ][ 1 ] )
? aArray[ 1 ][ 1 ]
QOut( 'World "Peace[!]"' )
? 'World "Peace[!]"'
QOut( "Harbour 'Power[!]'" )
? "Harbour 'Power[!]'"
QOut( [King 'Clipper "!"'] )
? [King 'Clipper "!"']
RETURN

View File

@@ -34,10 +34,10 @@ PROCEDURE Main( cFrom, cTo )
cTo := Default( cTo, "strip.out" )
oFrom := TTextFile()
// Debug( __objGetMethodList( oFrom ) )
// Debug( __objGetMethodList( oFrom ) )
oFrom:New( cFrom, "R" )
oTo := TTextFile()
// Debug( __objGetMethodList( oTo ) )
// Debug( __objGetMethodList( oTo ) )
oTo:New( cTo , "W" )
DO WHILE !oFrom:EOF()
@@ -46,7 +46,7 @@ PROCEDURE Main( cFrom, cTo )
oTo:Run( cOut )
ENDIF
ENDDO
QOut( "Number of lines", oTo:nLine )
? "Number of lines", oTo:nLine
oFrom:Dispose()
oTo:Dispose()
@@ -113,13 +113,13 @@ FUNCTION New( cFileName, cMode, nBlock )
ELSEIF ::cMode == "W"
::hFile := FCreate( cFileName )
ELSE
QOut( "DosFile Init: Unknown file mode:", ::cMode )
? "DosFile Init: Unknown file mode:", ::cMode
ENDIF
::nError := FError()
IF ::nError != 0
::lEoF := .T.
QOut( "Error ", ::nError )
? "Error ", ::nError
ENDIF
::nBlockSize := Default( nBlock, 4096 )
@@ -140,7 +140,7 @@ FUNCTION Dispose()
ENDIF
IF !FClose( ::hFile )
::nError := FError()
QOut( "Dos Error closing ", ::cFileName, " Code ", ::nError )
? "Dos Error closing ", ::cFileName, " Code ", ::nError
ENDIF
ENDIF
@@ -159,9 +159,9 @@ FUNCTION READ()
LOCAL nEoFPos
IF ::hFile == - 1
QOut( "DosFile:Read : No file open" )
? "DosFile:Read : No file open"
ELSEIF ::cMode != "R"
QOut( "File ", ::cFileName, " not open for reading" )
? "File ", ::cFileName, " not open for reading"
ELSEIF !::lEoF
IF Len( ::cBlock ) == 0 // Read new block
@@ -213,9 +213,9 @@ FUNCTION WriteLn( xTxt, lCRLF )
LOCAL cBlock
IF ::hFile == - 1
QOut( "DosFile:Write : No file open" )
? "DosFile:Write : No file open"
ELSEIF !( ::cMode == "W" )
QOut( "File ", ::cFileName, " not opened for writing" )
? "File ", ::cFileName, " not opened for writing"
ELSE
cBlock := ToChar( xTxt ) // Convert to string
IF DEFAULT( lCRLF, .T. )
@@ -240,9 +240,9 @@ FUNCTION GOTO( nLine )
LOCAL nWhere := 1
IF Empty( ::hFile )
QOut( "DosFile:Goto : No file open" )
? "DosFile:Goto : No file open"
ELSEIF !( ::cMode == "R" )
QOut( "File ", ::cFileName, " not open for reading" )
? "File ", ::cFileName, " not open for reading"
ELSE
::lEoF := .F. // Clear (old) End of file
::nLine := 0 // Start at beginning

View File

@@ -10,7 +10,7 @@ PROCEDURE Main()
LOCAL cb := {|| QOut( "test" ) }
WHILE i < 1000
QOut( i )
? i
Eval( cb )
i++
END

View File

@@ -7,17 +7,17 @@ PROCEDURE Main()
LOCAL s := " " + Chr( 0 ) + " mab " + Chr( 0 ) + " "
StrDump( s )
QOut( s )
? s
QOut( '"' + LTrim( s ) + '"' )
QOut( '"' + RTrim( s ) + '"' )
QOut( '"' + AllTrim( s ) + '"' )
? '"' + LTrim( s ) + '"'
? '"' + RTrim( s ) + '"'
? '"' + AllTrim( s ) + '"'
RETURN
STATIC PROCEDURE StrDump( s )
LOCAL tmp
FOR EACH tmp IN s
QOut( Asc( tmp ) )
? Asc( tmp )
NEXT
RETURN

View File

@@ -8,7 +8,7 @@ PROCEDURE Main()
LOCAL n
QOut( "We are running and now an error will raise" )
? "We are running and now an error will raise"
n++ // an error should raise here

View File

@@ -8,13 +8,13 @@ PROCEDURE Main()
FOR i := 1 TO 10
QOut( i )
? i
IF i == 4 .AND. .T.
__Accept( "" )
QOut( i )
? i
i := 9
QOut( i )
? i
__Accept( "" )
ENDIF

View File

@@ -16,7 +16,7 @@ PROCEDURE Main()
@ 12, 10 SAY "cMacro[1] :" GET &cMacro[ 1 ]
@ 14, 10 SAY "cMacro.2[1] :" GET &cMacro.2[ 1 ]
@ 16, 10 SAY "cEarly[1] :" GET cEarly[ 1 ]
// @ 14,10 SAY "cMacro :" GET &(cMacro)[ 1 ]
// @ 14,10 SAY "cMacro :" GET &( cMacro )[ 1 ]
nIndex := 2
@ 18, 10 SAY "aVar :" GET aVar[ nIndex ]
@ 20, 10 SAY "Picture of GET-1:" GET GetList[ 1 ]:Picture
@@ -26,12 +26,12 @@ PROCEDURE Main()
CLS
/* Clipper Error "Get contains complex macro"
/* Clipper Error "Get contains complex macro"
? "This GET should say 'Late!'."
cMacro := "cEarly"
@ 10,10 SAY "cMacro :" GET &(cMacro)
@ 10, 10 SAY "cMacro :" GET &( cMacro )
cMacro := "cLate"
READ
*/
*/
RETURN

View File

@@ -35,8 +35,6 @@ PROCEDURE Main()
RETURN
/*---------------------------------------------------------------------------*/
FUNCTION THTML()
STATIC oClass

View File

@@ -12,33 +12,33 @@
PROCEDURE Main()
QOut( "testing Harbour /d compiler flag" )
? "testing Harbour /d compiler flag"
#ifdef TEST
QOut( "Fine, you have just tested the /d compiler flag" )
? "Fine, you have just tested the /d compiler flag"
#else
QOut( "Please use /dTEST compiler flag" )
QOut( "Or run 'set HB_USER_PRGFLAGS=/dTEST' if you are using the GNU Make System" )
? "Please use /dTEST compiler flag"
? "Or run 'set HB_USER_PRGFLAGS=/dTEST' if you are using the GNU Make System"
#endif
#ifdef FIRST
QOut( "FIRST is defined" )
? "FIRST is defined"
#ifdef SECOND
QOut( "FIRST and SECOND are defined" )
? "FIRST and SECOND are defined"
#ifdef THIRD
QOut( "FIRST, SECOND and THIRD are defined" )
? "FIRST, SECOND and THIRD are defined"
#else
QOut( "THIRD is not defined" )
? "THIRD is not defined"
#endif
#else
QOut( "SECOND is not defined" )
? "SECOND is not defined"
#endif
#else
QOut( "FIRST is not defined" )
? "FIRST is not defined"
#endif
RETURN

View File

@@ -57,7 +57,7 @@
// of them.
//----------------------------------------------------------------------------//
//
PROCEDURE Main()
@@ -70,7 +70,7 @@ PROCEDURE Main()
RETURN
//----------------------------------------------------------------------------//
//
CREATE CLASS TCar
@@ -84,7 +84,7 @@ CREATE CLASS TCar
ENDCLASS
//----------------------------------------------------------------------------//
//
METHOD New( cColor, nDoors ) CLASS TCar
@@ -100,7 +100,7 @@ METHOD New( cColor, nDoors ) CLASS TCar
RETURN Self
//----------------------------------------------------------------------------//
//
METHOD SUM( oObject ) CLASS TCar
@@ -111,4 +111,4 @@ METHOD SUM( oObject ) CLASS TCar
RETURN NIL
//----------------------------------------------------------------------------//
//

View File

@@ -4,14 +4,12 @@
PROCEDURE Main()
OutStd( hb_eol() )
OutStd( "Running with SET FIXED OFF (the default setting): " )
OutStd( hb_eol() )
? "Running with SET FIXED OFF (the default setting):"
?
test()
__ACCEPT( "Pause before running again with SET FIXED ON: " )
OutStd( hb_eol() )
OutStd( "Running with SET FIXED ON: " )
OutStd( hb_eol() )
? "Running with SET FIXED ON:"
?
Set( _SET_FIXED, "ON" )
test()
@@ -23,96 +21,100 @@ PROCEDURE test()
LOCAL b := 10.0002575
LOCAL nI, c, d
OutStd( "1: " )
OutStd( 10 )
OutStd( a )
OutStd( - a )
OutStd( b )
OutStd( - b )
OutStd( hb_eol() )
OutStd( "2: " )
OutStd( a + b )
OutStd( a - b )
OutStd( a * b )
OutStd( a / b )
OutStd( hb_eol() )
OutStd( "3: " )
OutStd( a % b )
OutStd( a ** b )
OutStd( hb_eol() )
?? "1: "
?? 10
?? a
?? -a
?? b
?? -b
?
?? "2: "
?? a + b
?? a - b
?? a * b
?? a / b
?
?? "3: "
?? a % b
?? a ** b
?
c := a * b
d := b * a
OutStd( hb_eol() )
OutStd( "4: " )
OutStd( Str( c ) )
OutStd( Str( d ) )
OutStd( hb_eol() )
OutStd( "5: " )
OutStd( Str( c + d ) )
OutStd( Str( c - d ) )
OutStd( Str( c * d ) )
OutStd( Str( c / d ) )
OutStd( hb_eol() )
?
OutStd( hb_eol() )
OutStd( "6: " )
OutStd( a + b + c )
OutStd( c - b - a )
OutStd( b * a * c )
OutStd( b * a * c * d )
?? "4: "
?? Str( c )
?? Str( d )
?
?? "5: "
?? Str( c + d )
?? Str( c - d )
?? Str( c * d )
?? Str( c / d )
?
?
?? "6: "
?? a + b + c
?? c - b - a
?? b * a * c
?? b * a * c * d
b := 1.000213
OutStd( b * b * b * b * b * b * b )
OutStd( hb_eol() )
?? b * b * b * b * b * b * b
?
FOR nI := 1 TO 20
OutStd( hb_eol() )
OutStd( LTrim( Str( 6 + nI ) ) + ": " )
OutStd( 10 ** nI + ( 1.02 * 1.02 ) )
?
?? LTrim( Str( 6 + nI ) ) + ": "
?? 10 ** nI + ( 1.02 * 1.02 )
NEXT
OutStd( hb_eol() )
?
OutStd( hb_eol() )
OutStd( "27: " )
OutStd( Str( a ), a )
OutStd( hb_eol() )
?
?? "27: "
?? Str( a ), a
?
OutStd( "28: " )
OutStd( Str( b ), b )
OutStd( hb_eol() )
?? "28: "
?? Str( b ), b
?
OutStd( "29: " )
OutStd( Str( b, 15 ) )
OutStd( hb_eol() )
?? "29: "
?? Str( b, 15 )
?
OutStd( "30: " )
OutStd( Str( b, 20, 5 ) )
OutStd( hb_eol() )
?? "30: "
?? Str( b, 20, 5 )
?
OutStd( "31: " )
OutStd( Str( b, 20, 10 ) )
OutStd( hb_eol() )
?? "31: "
?? Str( b, 20, 10 )
?
OutStd( "32: " )
OutStd( Str( b, 5, 10 ) )
OutStd( hb_eol() )
?? "32: "
?? Str( b, 5, 10 )
?
OutStd( "33: " )
OutStd( Str( b, 20, - 10 ) )
OutStd( hb_eol() )
?? "33: "
?? Str( b, 20, - 10 )
?
OutStd( "34: " )
OutStd( Str( b, - 12, 7 ) )
OutStd( hb_eol() )
?? "34: "
?? Str( b, - 12, 7 )
?
OutStd( "35: " )
OutStd( Str( b, 0 ) )
OutStd( hb_eol() )
?? "35: "
?? Str( b, 0 )
?
OutStd( hb_eol() )
?
a := 15.1004
OutStd( "36: " )
OutStd( Str( a ), a )
OutStd( hb_eol() )
?? "36: "
?? Str( a ), a
?
RETURN

View File

@@ -13,7 +13,7 @@ PROCEDURE Main()
a := strtoarray( "this is a great big test of strtoken" )
FOR i := 1 TO Len( a )
QOut( a[ i ] )
? a[ i ] )
NEXT
RETURN
@@ -28,7 +28,7 @@ FUNCTION strtoarray( s )
AAdd( aResult, t )
s := SubStr( s, l + 2 ) /* skip the delimiter */
QOut( t, Str( l ), s )
? t, Str( l ), s )
ENDDO
RETURN aResult

View File

@@ -13,7 +13,7 @@ PROCEDURE Main( Param1 )
Sub( @j )
QOut( j )
? j
HB_SYMBOL_UNUSED( Param1 )
HB_SYMBOL_UNUSED( k )

View File

@@ -7,10 +7,6 @@
#include "fileio.ch"
#include "inkey.ch"
#define READ_ACCESS 0
#define WRITE_ACCESS 1
#define READ_WRITE_ACCESS 2
#define FLX_EXCLUSIVE 0x0000 /* Exclusive lock */
#define FLX_SHARED 0x0100 /* Shared lock */
#define FLX_NO_WAIT 0x0000 /* Immediate return */
@@ -31,55 +27,61 @@ PROCEDURE Main()
LOCAL nKeyHit
LOCAL nLockType
QOut( "Opening lock file" )
IF ( hLockFile := FOpen( "emphasis.6lo", READ_WRITE_ACCESS ) ) == F_ERROR
QOut( "ERROR: Cannot open Lock File" )
CLS
IF ! hb_FileExists( "emphasis.6lo" )
hb_MemoWrit( "emphasis.6lo", "" )
ENDIF
? "Opening lock file"
IF ( hLockFile := FOpen( "emphasis.6lo", FO_READWRITE ) ) == F_ERROR
? "ERROR: Cannot open Lock File"
RETURN
ENDIF
QOut( "Lock file opened - handle is", hb_ntos( hLockFile ) )
QOut()
? "Lock file opened - handle is", hb_ntos( hLockFile )
?
s_lLocked := .F.
s_lExclusive := .T.
s_lBlocking := .F.
nExclusivity := FLX_EXCLUSIVE
nBlocking := FLX_NO_WAIT
ShowStatus()
QOut( "[+] to get a lock, [-] to release it, [Esc] to exit, [E] for exclusive, [S] for shared, [B] for blocking, [N] for non-blocking" )
? "[+] to get a lock, [-] to release it, [Esc] to exit, [E] for exclusive, [S] for shared, [B] for blocking, [N] for non-blocking"
DO WHILE .T.
nKeyHit := Inkey( 0 )
SWITCH nKeyHit
CASE hb_keyCode( "+" )
IF s_lLocked
QOut( "Already locked" )
? "Already locked"
ELSE
nLockType := nExclusivity + nBlocking
QOut( "Requesting Lock" )
? "Requesting Lock"
lSuccess := hb_FLock( hLockFile, 0, 1, nLockType )
IF lSuccess
QOut( "Lock has been obtained" )
? "Lock has been obtained"
s_lLocked := .T.
ELSE
QOut( "Lock Request Failed - Error Code:", FError() )
? "Lock Request Failed - Error Code:", FError()
ENDIF
ENDIF
EXIT
CASE hb_keyCode( "-" )
IF ! s_lLocked
QOut( "Lock not currently held" )
? "Lock not currently held"
ELSE
lSuccess := hb_FUnlock( hLockFile, 0, 1 )
IF lSuccess
QOut( "Lock has been released" )
? "Lock has been released"
s_lLocked := .F.
ELSE
QOut( "Unlock Request Failed - Error Code:", FError() )
? "Unlock Request Failed - Error Code:", FError()
ENDIF
ENDIF
EXIT
CASE hb_keyCode( "E" )
CASE hb_keyCode( "e" )
IF s_lLocked
QOut( "Release Lock before changing lock type" )
? "Release Lock before changing lock type"
ELSE
s_lExclusive := .T.
nExclusivity := FLX_EXCLUSIVE
@@ -89,7 +91,7 @@ PROCEDURE Main()
CASE hb_keyCode( "S" )
CASE hb_keyCode( "s" )
IF s_lLocked
QOut( "Release Lock before changing lock type" )
? "Release Lock before changing lock type"
ELSE
s_lExclusive := .F.
nExclusivity := FLX_SHARED
@@ -99,7 +101,7 @@ PROCEDURE Main()
CASE hb_keyCode( "B" )
CASE hb_keyCode( "b" )
IF s_lLocked
QOut( "Release Lock before changing function mode" )
? "Release Lock before changing function mode"
ELSE
s_lBlocking := .T.
nExclusivity := FLX_WAIT
@@ -109,7 +111,7 @@ PROCEDURE Main()
CASE hb_keyCode( "N" )
CASE hb_keyCode( "n" )
IF s_lLocked
QOut( "Release Lock before changing function mode" )
? "Release Lock before changing function mode"
ELSE
s_lBlocking := .F.
nExclusivity := FLX_NO_WAIT
@@ -117,12 +119,12 @@ PROCEDURE Main()
ENDIF
EXIT
CASE K_ESC
QOut()
?
FClose( hLockFile )
QOut( "Exiting" )
? "Exiting"
RETURN
OTHERWISE
QOut( "Key not supported", nKeyHit )
? "Key not supported", nKeyHit
ENDSWITCH
ENDDO
@@ -130,8 +132,8 @@ PROCEDURE Main()
PROCEDURE ShowStatus()
QOut( "Lock: " + iif( s_lLocked, "Held", "Released" ) +;
? "Lock: " + iif( s_lLocked, "Held", "Released" ) +;
" Type: " + iif( s_lExclusive, "Exclusive", "Shared" ) +;
" Request is: " + iif( s_lBlocking, "Blocking", "Non-Blocking" ) )
" Request is: " + iif( s_lBlocking, "Blocking", "Non-Blocking" )
RETURN

View File

@@ -9,11 +9,11 @@ PROCEDURE Main()
REPLACE Age WITH 1
? FIELD->Age
//REPLACE 1->Age WITH 2 // Todo: complete support in harbour.y - AliasAddInt()
//? FIELD->Age
// REPLACE 1->Age WITH 2 // Todo: complete support in harbour.y - AliasAddInt()
// ? FIELD->Age
//REPLACE 1.5->Age WITH 3 // Will produce "Invalid alias expression"
//? FIELD->Age
// REPLACE 1.5->Age WITH 3 // Will produce "Invalid alias expression"
// ? FIELD->Age
REPLACE TEST->Age WITH 4
? FIELD->Age
@@ -30,7 +30,7 @@ PROCEDURE Main()
USE test
// ? ("0")->FIRST
// ? ( "0" )->FIRST
? ( "B" )->FIRST
? ( "2" )->FIRST
? 2->FIRST
@@ -38,7 +38,7 @@ PROCEDURE Main()
Inkey( 0 )
// ? ("0")->FIRST
// ? ( "0" )->FIRST
? Select()
? Select( 1 )
? Select( 2 )

View File

@@ -11,8 +11,8 @@
PROCEDURE Main()
OutStd( Chr( 34 ) + Version() + Chr( 34 ) + hb_eol() )
OutStd( Chr( 34 ) + hb_compiler() + Chr( 34 ) + hb_eol() )
OutStd( Chr( 34 ) + OS() + Chr( 34 ) + hb_eol() )
? Chr( 34 ) + Version() + Chr( 34 )
? Chr( 34 ) + hb_compiler() + Chr( 34 )
? Chr( 34 ) + OS() + Chr( 34 )
RETURN

View File

@@ -53,8 +53,6 @@ PROCEDURE Main()
ENDDO
QUIT
RETURN
//*************************

View File

@@ -9,7 +9,7 @@ PROCEDURE Main()
LOCAL x := 0
DO WHILE x++ < 1000
QOut( x )
? x
ENDDO
RETURN

View File

@@ -2,17 +2,8 @@
* $Id$
*/
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//
// Harbour Extended Features Demo
// .
// Pritpal Bedi <pritpal@vouchcac.com>
//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
// Harbour Extended Features Demo
// Pritpal Bedi <pritpal@vouchcac.com>
#include "hbgtinfo.ch"
#include "inkey.ch"
@@ -20,13 +11,13 @@
#define RGB( r, g, b ) ( r + ( g * 256 ) + ( b * 256 * 256 ) )
//----------------------------------------------------------------------//
//
STATIC s_nRows := 20
STATIC s_nCols := 60
STATIC s_nColorIndex := 1
//----------------------------------------------------------------------//
//
PROCEDURE Main()
@@ -290,7 +281,7 @@ PROCEDURE Main()
RETURN
//-------------------------------------------------------------------//
//
STATIC PROCEDURE DispScreen()
@@ -337,7 +328,7 @@ STATIC PROCEDURE DispScreen()
RETURN
//-------------------------------------------------------------------//
//
PROCEDURE HB_GTSYS()
@@ -346,7 +337,7 @@ PROCEDURE HB_GTSYS()
RETURN
//-------------------------------------------------------------------//
//
FUNCTION SetPalette( nMode )
@@ -369,7 +360,7 @@ FUNCTION SetPalette( nMode )
RETURN NIL
//-------------------------------------------------------------------//
//
FUNCTION SetPaletteIndex()
@@ -378,7 +369,7 @@ FUNCTION SetPaletteIndex()
RETURN NIL
//-------------------------------------------------------------------//
//
PROCEDURE thFunc()
@@ -471,7 +462,7 @@ PROCEDURE thFunc()
RETURN
//-------------------------------------------------------------------//
//
STATIC FUNCTION DbSkipBlock( n, oTbr )
@@ -492,7 +483,7 @@ STATIC FUNCTION DbSkipBlock( n, oTbr )
RETURN nSkipped
//-------------------------------------------------------------------//
//
STATIC FUNCTION TBNext( oTbr )
@@ -513,7 +504,7 @@ STATIC FUNCTION TBNext( oTbr )
RETURN lMoved
//-------------------------------------------------------------------//
//
STATIC FUNCTION TBPrev( oTbr )
@@ -531,13 +522,13 @@ STATIC FUNCTION TBPrev( oTbr )
RETURN lMoved
//-------------------------------------------------------------------//
//
STATIC FUNCTION BlockField( i )
RETURN {|| FieldGet( i ) }
//-------------------------------------------------------------------//
//
STATIC FUNCTION BrwHandleKey( oBrowse, nKey, lEnd )
@@ -567,7 +558,7 @@ STATIC FUNCTION BrwHandleKey( oBrowse, nKey, lEnd )
RETURN lRet
//-------------------------------------------------------------------//
//
FUNCTION ChgPalette( lFocus )