* contrib/gtwvg/class.prg
* contrib/hbct/tests/attoken.prg
* contrib/hbct/tests/charnot.prg
* contrib/hbct/tests/charrll.prg
* contrib/hbct/tests/charrlr.prg
* contrib/hbct/tests/charshl.prg
* contrib/hbct/tests/charshr.prg
* contrib/hbct/tests/csetarge.prg
* contrib/hbct/tests/datetime.prg
* contrib/hbct/tests/finan.prg
* contrib/hbct/tests/token.prg
* contrib/hbct/tests/tokensep.prg
* contrib/hbct/tests/trig.prg
* contrib/hbgd/gdbarcod.prg
* contrib/hbnf/doc/en/fttext.txt
* contrib/hbnf/doc/en/nwsem.txt
* contrib/hbnf/popadder.prg
* contrib/hbnf/tests/mouse1.prg
* contrib/hbsqlit3/tests/hdbctest.prg
* contrib/hbtip/httpcli.prg
* contrib/hbtpathy/telepath.prg
* contrib/xhb/stream.prg
* contrib/xhb/tedit.prg
* contrib/xhb/thtm.prg
* contrib/xhb/ttable.prg
* contrib/xhb/xcstr.prg
* contrib/xhb/xhbmemo.prg
* contrib/xhb/xhbtedit.prg
* extras/gtwvw/tests/ebtest7.prg
* extras/hbxlsxml/xlsxml.prg
* extras/rddado/adordd.prg
* src/debug/debugger.prg
* src/rtl/memoedit.prg
* tests/sdf_test.prg
* tests/tstasort.prg
* tests/videotst.prg
* tests/vmasort.prg
% minor cleanups, fixes, optimizations and formatting
(f.e. using hb_ntos(), avoiding '== .F./.T.' expressions, etc)
; NOTE: hbformat couldn't reformat adordd.prg, and even
after removing parts that caused and error and
finished error free, it failed to format the file
after a certain line.
69 lines
1.5 KiB
Plaintext
69 lines
1.5 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
#ifndef __HARBOUR__
|
|
#define hb_ntos( n ) LTrim( Str( n ) )
|
|
#endif
|
|
|
|
PROCEDURE Main()
|
|
|
|
LOCAL oError := ErrorNew()
|
|
|
|
LOCAL a := { 3, 2, 1 }
|
|
LOCAL b := { 10 }
|
|
LOCAL c := { 2, .T., "B", NIL, { 1 }, {|| b }, oError, Date(), 1, .F., "A", NIL, Date() - 1, { 0 }, {|| a }, oError }
|
|
|
|
?
|
|
?
|
|
? "Original.....:", aDump( a )
|
|
? "Asort.c......:", aDump( ASort( AClone( a ) ) )
|
|
? "Asort.c.block:", aDump( ASort( AClone( a ), , , {| x, y | x < y } ) )
|
|
?
|
|
? "Original.....:", aDump( b )
|
|
? "Asort.c......:", aDump( ASort( AClone( b ) ) )
|
|
? "Asort.c.block:", aDump( ASort( AClone( b ), , , {| x, y | x < y } ) )
|
|
?
|
|
? "Original.....:", aDump( c )
|
|
? "Asort.c......:", aDump( ASort( AClone( c ) ) )
|
|
? "Asort.c.block:", aDump( ASort( AClone( c ), , , {| x, y | xToStr( x ) < xToStr( y ) } ) )
|
|
|
|
RETURN
|
|
|
|
FUNCTION aDump( a )
|
|
|
|
LOCAL cStr := ""
|
|
LOCAL n := Len( a )
|
|
LOCAL i
|
|
|
|
FOR i := 1 TO n
|
|
cStr += AllTrim( xToStr( a[ i ] ) ) + " "
|
|
NEXT
|
|
|
|
RETURN cStr
|
|
|
|
FUNCTION xToStr( xValue )
|
|
|
|
LOCAL cType := ValType( xValue )
|
|
|
|
DO CASE
|
|
CASE cType == "C" .OR. cType == "M"
|
|
RETURN xValue
|
|
CASE cType == "N"
|
|
RETURN hb_ntos( xValue )
|
|
CASE cType == "D"
|
|
RETURN DToC( xValue )
|
|
CASE cType == "L"
|
|
RETURN iif( xValue, ".T.", ".F." )
|
|
CASE cType == "U"
|
|
RETURN "NIL"
|
|
CASE cType == "A"
|
|
RETURN "{.}"
|
|
CASE cType == "B"
|
|
RETURN "{|| }"
|
|
CASE cType == "O"
|
|
RETURN "[O]"
|
|
ENDCASE
|
|
|
|
RETURN xValue
|