From bbde354d0076f606a8c32505ff4f99bf7421484a Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 8 Apr 2013 12:41:52 +0200 Subject: [PATCH] 2013-04-08 12:41 UTC+0200 Viktor Szakats (harbour syenar.net) * bin/check.hb ! fixed --fixup-case when used with single file + deleted few more exceptions (contribs in particular) * tests/clipper.ch + added few items + tests/bldtest/bldtext.hbp + added hbmk2 build file * tests/hbpptest/compare.bat -> tests/hbpptest/compare.hb * tests/hbpptest/pp_test.prg -> tests/hbpptest/_pp_test.prg * converted batch file to Harbour script * updated comments - contrib/hbhpdf/tests/files/cp932.txt - contrib/hbhpdf/tests/files/cp936.txt - contrib/hbhpdf/tests/files/elic_jp.txt - contrib/hbhpdf/tests/files/euc.txt - contrib/hbhpdf/tests/files/sjis.txt - turns out these were not used. deleted. * contrib/hbnetio/tests/netiomt1.prg * contrib/hbnetio/tests/netiot02.prg * contrib/hbnetio/tests/netiot03.prg * contrib/hbnetio/tests/netiotst.prg * hbformat, fix case, manual corrections (I like the former style better, because it's much easier to type and looks much less antique than std code format, but for now consistency won) * contrib/xhb/thtm.prg * code slightly altered to avoid embedded JS code to be case fixed --- ChangeLog.txt | 39 ++- bin/check.hb | 74 +++--- contrib/hbhpdf/tests/files/cp932.txt | 10 - contrib/hbhpdf/tests/files/cp936.txt | 10 - contrib/hbhpdf/tests/files/elic_jp.txt | 10 - contrib/hbhpdf/tests/files/euc.txt | 1 - contrib/hbhpdf/tests/files/sjis.txt | 1 - contrib/hbnetio/tests/netiomt1.prg | 12 +- contrib/hbnetio/tests/netiot02.prg | 47 ++-- contrib/hbnetio/tests/netiot03.prg | 251 ++++++++++--------- contrib/hbnetio/tests/netiotst.prg | 140 ++++++----- contrib/xhb/thtm.prg | 6 +- tests/bldtest/bldtext.hbp | 3 + tests/clipper.ch | 2 + tests/hbpptest/{pp_test.prg => _pp_test.prg} | 13 +- tests/hbpptest/compare.bat | 15 -- tests/hbpptest/compare.hb | 14 ++ 17 files changed, 344 insertions(+), 304 deletions(-) delete mode 100644 contrib/hbhpdf/tests/files/cp932.txt delete mode 100644 contrib/hbhpdf/tests/files/cp936.txt delete mode 100644 contrib/hbhpdf/tests/files/elic_jp.txt delete mode 100644 contrib/hbhpdf/tests/files/euc.txt delete mode 100644 contrib/hbhpdf/tests/files/sjis.txt create mode 100644 tests/bldtest/bldtext.hbp rename tests/hbpptest/{pp_test.prg => _pp_test.prg} (98%) delete mode 100644 tests/hbpptest/compare.bat create mode 100644 tests/hbpptest/compare.hb diff --git a/ChangeLog.txt b/ChangeLog.txt index b894284a40..6974877220 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,42 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2013-04-08 12:41 UTC+0200 Viktor Szakats (harbour syenar.net) + * bin/check.hb + ! fixed --fixup-case when used with single file + + deleted few more exceptions (contribs in particular) + + * tests/clipper.ch + + added few items + + + tests/bldtest/bldtext.hbp + + added hbmk2 build file + + * tests/hbpptest/compare.bat -> tests/hbpptest/compare.hb + * tests/hbpptest/pp_test.prg -> tests/hbpptest/_pp_test.prg + * converted batch file to Harbour script + * updated comments + + - contrib/hbhpdf/tests/files/cp932.txt + - contrib/hbhpdf/tests/files/cp936.txt + - contrib/hbhpdf/tests/files/elic_jp.txt + - contrib/hbhpdf/tests/files/euc.txt + - contrib/hbhpdf/tests/files/sjis.txt + - turns out these were not used. deleted. + + * contrib/hbnetio/tests/netiomt1.prg + * contrib/hbnetio/tests/netiot02.prg + * contrib/hbnetio/tests/netiot03.prg + * contrib/hbnetio/tests/netiotst.prg + * hbformat, fix case, manual corrections + (I like the former style better, because it's much + easier to type and looks much less antique than + std code format, but for now consistency won) + + * contrib/xhb/thtm.prg + * code slightly altered to avoid embedded JS code to be + case fixed + 2013-04-08 02:12 UTC+0200 Viktor Szakats (harbour syenar.net) * config/postinst.hb * minor @@ -72,10 +108,9 @@ 2013-04-07 22:41 UTC+0200 Viktor Szakats (harbour syenar.net) * bin/commit.hb + do not add new empty entry template if one already - exist, replace existing one instead + exists, replace existing one instead + put last changelog entry to clipboard on pre-commit - * bin/check.hb * refined and sorted exceptions for case checking diff --git a/bin/check.hb b/bin/check.hb index a4b20f0463..baa0451d1b 100644 --- a/bin/check.hb +++ b/bin/check.hb @@ -43,9 +43,17 @@ FUNCTION CheckFileList( xName ) LOCAL file LOCAL lApplyFixes := "--fixup" $ hb_CmdLine() + LOCAL lRebase := .T. + + IF HB_ISSTRING( xName ) .AND. Left( xName, 2 ) == "--" + xName := NIL + ENDIF IF HB_ISSTRING( xName ) - xName := iif( Left( xName, 2 ) == "--", NIL, { xName } ) + xName := { xName } + IF "--fixup-case" $ hb_CmdLine() + lRebase := .F. + ENDIF ENDIF IF Empty( xName ) .OR. HB_ISARRAY( xName ) @@ -58,7 +66,7 @@ FUNCTION CheckFileList( xName ) IF "--fixup-case" $ hb_CmdLine() FOR EACH file IN xName IF "|" + hb_FNameExt( file ) + "|" $ "|.c|.cpp|.h|.api|.ch|.hb|.po|.prg|.md|.txt|" - FixFuncCase( file, .T. ) + FixFuncCase( file, .T., lRebase ) ENDIF NEXT ELSE @@ -134,8 +142,7 @@ STATIC FUNCTION CheckFile( cName, /* @ */ aErr, lApplyFixes ) LOCAL aCanHaveAnyEncoding := { ; "*.dif", ; - "contrib/hbmisc/tests/sample.txt", ; /* TOFIX: Not Unicode compatible component */ - "contrib/hbhpdf/tests/files/*.txt" } + "contrib/hbmisc/tests/sample.txt" } /* TOFIX: Not Unicode compatible component */ LOCAL aForcedCRLF := { ; "*.bat" } @@ -712,7 +719,7 @@ STATIC FUNCTION my_DirScanWorker( cMask, aList ) /* ---- */ -STATIC FUNCTION FixFuncCase( cFileName, lVerbose ) +STATIC FUNCTION FixFuncCase( cFileName, lVerbose, lRebase ) STATIC sc_hInCommentOnly := { ; ".c" =>, ; @@ -722,35 +729,31 @@ STATIC FUNCTION FixFuncCase( cFileName, lVerbose ) STATIC sc_hFileExceptions := { ; "ChangeLog.txt" =>, ; - "std.ch" =>, ; - "big5_gen.prg" =>, ; - "clsccast.prg" =>, ; - "clsicast.prg" =>, ; - "clsscast.prg" =>, ; - "clsscope.prg" =>, ; - "cpinfo.prg" =>, ; - "foreach2.prg" =>, ; - "keywords.prg" =>, ; - "speedstr.prg" =>, ; - "speedtst.prg" =>, ; - "uc16_gen.prg" =>, ; - "wcecon.prg" =>, ; - "c_std.txt" =>, ; - "locks.txt" =>, ; - "pcode.txt" =>, ; - "tracing.txt" =>, ; + "std.ch" =>, ; /* compatibility */ + "big5_gen.prg" =>, ; /* new style code */ + "clsccast.prg" =>, ; /* new style code */ + "clsicast.prg" =>, ; /* new style code */ + "clsscast.prg" =>, ; /* new style code */ + "clsscope.prg" =>, ; /* new style code */ + "cpinfo.prg" =>, ; /* new style code */ + "foreach2.prg" =>, ; /* new style code */ + "keywords.prg" =>, ; /* new style code */ + "speedstr.prg" =>, ; /* new style code */ + "speedtst.prg" =>, ; /* new style code */ + "uc16_gen.prg" =>, ; /* new style code */ + "wcecon.prg" =>, ; /* new style code */ + "c_std.txt" =>, ; /* C level doc */ + "locks.txt" =>, ; /* C level doc */ + "pcode.txt" =>, ; /* C level doc */ + "tracing.txt" =>, ; /* C level doc */ "xhb-diff.txt" => } STATIC sc_aMaskExceptions := { ; - "src/3rd/*" , ; - "contrib/3rd/*" , ; - "contrib/*/3rd/*" , ; - "contrib/hbnetio/tests/*" , ; - "contrib/xhb/thtm.prg" , ; - "tests/hbpptest/*" , ; - "tests/mt/*" , ; - "tests/multifnc/*" , ; - "tests/rddtest/*" } + "*/3rd/*" , ; /* foreign code */ + "tests/hbpptest/*" , ; /* test code, must be kept as is */ + "tests/mt/*" , ; /* new style code */ + "tests/multifnc/*" , ; + "tests/rddtest/*" } LOCAL hAll LOCAL cFile @@ -764,15 +767,16 @@ STATIC FUNCTION FixFuncCase( cFileName, lVerbose ) LOCAL nChanged := 0 hb_default( @lVerbose, .F. ) + hb_default( @lRebase, .T. ) IF Empty( hb_FNameExt( cFileName ) ) .OR. ; hb_FNameNameExt( cFileName ) $ sc_hFileExceptions .OR. ; - AScan( sc_aMaskExceptions, {| tmp | hb_FileMatch( StrTran( cFileName, "\", "/" ), tmp ) } ) != 0 + AScan( sc_aMaskExceptions, {| tmp | hb_FileMatch( cFileName, hb_DirSepToOS( tmp ) ) } ) != 0 RETURN .F. ENDIF hAll := __hbformat_BuildListOfFunctions() - cFile := MemoRead( _HBROOT_ + cFileName ) + cFile := MemoRead( iif( lRebase, _HBROOT_, "" ) + cFileName ) lInCommentOnly := hb_FNameExt( cFileName ) $ sc_hInCommentOnly cFileStripped := iif( lInCommentOnly, GetCComments( cFile ), cFile ) @@ -800,7 +804,7 @@ STATIC FUNCTION FixFuncCase( cFileName, lVerbose ) ENDIF NEXT - IF !( "hbclass.ch" $ cFileName ) .AND. ! lInCommentOnly + IF ! lInCommentOnly FOR EACH match IN hb_regexAll( "(?:REQUEST|EXTERNAL|EXTERNA|EXTERN)[ \t]+([A-Za-z_][A-Za-z0-9_]+)", cFile,,,,, .F. ) cProper := ProperCase( hAll, match[ 2 ][ _MATCH_cStr ] ) IF !( cProper == match[ 2 ][ _MATCH_cStr ] ) @@ -815,7 +819,7 @@ STATIC FUNCTION FixFuncCase( cFileName, lVerbose ) IF nChanged > 0 OutStd( cFileName + ": Harbour function casings fixed: " + hb_ntos( nChanged ) + hb_eol() ) - hb_MemoWrit( _HBROOT_ + cFileName, cFile ) + hb_MemoWrit( iif( lRebase, _HBROOT_, "" ) + cFileName, cFile ) ENDIF RETURN .T. diff --git a/contrib/hbhpdf/tests/files/cp932.txt b/contrib/hbhpdf/tests/files/cp932.txt deleted file mode 100644 index aeff76e6c7..0000000000 --- a/contrib/hbhpdf/tests/files/cp932.txt +++ /dev/null @@ -1,10 +0,0 @@ -(こんにちは。) -(おはようございます。) -(こんばんは。) -(はじめまして、どうぞよろしく。) -(お帰りなさい。) -(おやすみなさい。) -(さようなら。) -(お元気ですか。) -(お久しぶり。) -(お邪魔します。) diff --git a/contrib/hbhpdf/tests/files/cp936.txt b/contrib/hbhpdf/tests/files/cp936.txt deleted file mode 100644 index b31a4b8834..0000000000 --- a/contrib/hbhpdf/tests/files/cp936.txt +++ /dev/null @@ -1,10 +0,0 @@ -ト羲テ」。 -ヤ酲マコテ」。 -ヘノマコテ」。 -ト羲テ」ャヌカ犹リユユ。」 -サリタエチヒ。」 -ヘーイ。」 -ヤルシ」。 -ノフ蠎テツ」ソ -コテセテイサシ」。 -エネナチヒ。」 diff --git a/contrib/hbhpdf/tests/files/elic_jp.txt b/contrib/hbhpdf/tests/files/elic_jp.txt deleted file mode 100644 index cdda43a0a0..0000000000 --- a/contrib/hbhpdf/tests/files/elic_jp.txt +++ /dev/null @@ -1,10 +0,0 @@ -。ハ、ウ、、ヒ、チ、マ。」。ヒ -。ハ、ェ、マ、隍ヲ、エ、カ、、、゙、ケ。」。ヒ -。ハ、ウ、、ミ、、マ。」。ヒ -。ハ、マ、ク、皃゙、キ、ニ。「、ノ、ヲ、セ、隍、キ、ッ。」。ヒ -。ハ、ェオ「、熙ハ、オ、、。」。ヒ -。ハ、ェ、荀ケ、゚、ハ、オ、、。」。ヒ -。ハ、オ、隍ヲ、ハ、鬘」。ヒ -。ハ、ェクオオ、、ヌ、ケ、ォ。」。ヒ -。ハ、ェオラ、キ、ヨ、遙」。ヒ -。ハ、ェシルヒ筅キ、゙、ケ。」。ヒ diff --git a/contrib/hbhpdf/tests/files/euc.txt b/contrib/hbhpdf/tests/files/euc.txt deleted file mode 100644 index 4e0fd0c8b5..0000000000 --- a/contrib/hbhpdf/tests/files/euc.txt +++ /dev/null @@ -1 +0,0 @@ -・「・皈・ワタヨ、、、ハ、「、、、ヲ、ィ、ェ。」ノ筅ュチ、ヒセョ・ィ・モ、筅ェ、隍、、ヌ、。」 \ No newline at end of file diff --git a/contrib/hbhpdf/tests/files/sjis.txt b/contrib/hbhpdf/tests/files/sjis.txt deleted file mode 100644 index a76ec3b9bf..0000000000 --- a/contrib/hbhpdf/tests/files/sjis.txt +++ /dev/null @@ -1 +0,0 @@ -アメンボ赤いなあいうえお。浮き藻に小エビもおよいでる。 \ No newline at end of file diff --git a/contrib/hbnetio/tests/netiomt1.prg b/contrib/hbnetio/tests/netiomt1.prg index 5d0359fc12..a2452c96df 100644 --- a/contrib/hbnetio/tests/netiomt1.prg +++ b/contrib/hbnetio/tests/netiomt1.prg @@ -14,18 +14,18 @@ #define NETPASSWD "toptopsecret" -proc main() +PROCEDURE Main() /* connect to the server */ ? "CONNECTING..." - ? "NETIO_CONNECT():", netio_connect( NETSERVER, NETPORT,, NETPASSWD ) + ? "netio_Connect():", netio_Connect( NETSERVER, NETPORT,, NETPASSWD ) ? /* check if some function are available on server side */ - ? "Number of connected clients:", Len( netio_funcexec( "netio_conninfo" ) ) - ? "SHUTDOWN server:", netio_funcexec( "netio_shutdown" ) + ? "Number of connected clients:", Len( netio_FuncExec( "netio_conninfo" ) ) + ? "SHUTDOWN server:", netio_FuncExec( "netio_shutdown" ) ? /* close the connection to the server */ - ? "NETIO_DISCONNECT():", netio_disconnect( NETSERVER, NETPORT ) + ? "netio_Disconnect():", netio_Disconnect( NETSERVER, NETPORT ) -return + RETURN diff --git a/contrib/hbnetio/tests/netiot02.prg b/contrib/hbnetio/tests/netiot02.prg index 0db4345745..ce49f06042 100644 --- a/contrib/hbnetio/tests/netiot02.prg +++ b/contrib/hbnetio/tests/netiot02.prg @@ -24,20 +24,20 @@ /* few PP rules which allow to execute RPC function using * pseudo object 'net', i.e. ? net:date() */ -#xtranslate net:([]) => ; - netio_funcexec( # [,] ) -#xtranslate net:[]:([]) => ; - netio_funcexec( [ # + ] ":" + # [,] ) -#xtranslate net:[]::([]) => ; - netio_funcexec( [ # + ] ":" + # + ":" + # ; +#xtranslate net:( [] ) => ; + netio_FuncExec( # [,] ) +#xtranslate net:[]:( [] ) => ; + netio_FuncExec( [ # + ] ":" + # [,] ) +#xtranslate net:[]::( [] ) => ; + netio_FuncExec( [ # + ] ":" + # + ":" + # ; [,] ) #xtranslate net:exists: => ; - netio_procexists( # ) + netio_ProcExists( # ) #xtranslate net:exists:[]: => ; - netio_procexists( [ # + ] ":" + # ) + netio_ProcExists( [ # + ] ":" + # ) #xtranslate net:exists:[]:: => ; - netio_procexists( [ # + ] ":" + # + ":" + # ) + netio_ProcExists( [ # + ] ":" + # + ":" + # ) /* address of computer executing netiosrv, @@ -48,31 +48,32 @@ #define NETPASSWD "topsecret" -proc main() +PROCEDURE Main() Set( _SET_DATEFORMAT, "yyyy-mm-dd" ) /* connect to the server */ ? "CONNECTING..." - ? "NETIO_CONNECT():", netio_connect( NETSERVER, NETPORT,, NETPASSWD ) + ? "netio_Connect():", netio_Connect( NETSERVER, NETPORT,, NETPASSWD ) ? /* check if some function are available on server side */ - ? "DATE() function is supported:", net:exists:DATE - ? "QOUT() function is supported:", net:exists:QOUT - ? "HB_DATETIME() function is supported:", net:exists:HB_DATETIME + ? "Date() function is supported:", net:exists:DATE + ? "QOut() function is supported:", net:exists:QOUT + ? "hb_DateTime() function is supported:", net:exists:HB_DATETIME ? /* display text on server console */ - net:QOUT( replicate( "=", 70 ) ) - net:QOUT( "This is RPC TEST", hb_datetime(), version() ) - net:QOUT( replicate( "=", 70 ) ) + net:QOut( Replicate( "=", 70 ) ) + net:QOut( "This is RPC TEST", hb_DateTime(), Version() ) + net:QOut( Replicate( "=", 70 ) ) /* execute some functions on the server side and display the results */ - ? "SERVER DATE:", net:DATE() - ? "SERVER TIME:", net:TIME() - ? "SERVER DATETIME:", net:HB_DATETIME() - ? net:upper( "hello world !!!" ) + ? "SERVER DATE:", net:Date() + ? "SERVER TIME:", net:Time() + ? "SERVER DATETIME:", net:hb_DateTime() + ? net:Upper( "hello world !!!" ) ? /* close the connection to the server */ - ? "NETIO_DISCONNECT():", netio_disconnect( NETSERVER, NETPORT ) -return + ? "netio_Disconnect():", netio_Disconnect( NETSERVER, NETPORT ) + + RETURN diff --git a/contrib/hbnetio/tests/netiot03.prg b/contrib/hbnetio/tests/netiot03.prg index d567f60067..52bbe96eda 100644 --- a/contrib/hbnetio/tests/netiot03.prg +++ b/contrib/hbnetio/tests/netiot03.prg @@ -19,179 +19,196 @@ #define DBFILE "_tst_" #define DBNAME "net:" + DBSERVER + ":" + hb_ntos( DBPORT ) + ":" + ; - DBPASSWD + ":" + DBDIR + "/" + DBFILE + DBPASSWD + ":" + DBDIR + "/" + DBFILE -request DBFCDX +REQUEST DBFCDX -request HB_DIREXISTS -request HB_DIRCREATE -request HB_DATETIME +REQUEST hb_DirExists +REQUEST hb_DirCreate +REQUEST hb_DateTime -proc main() - local pSockSrv, lExists, nStream1, nStream2, nSec, xData +PROCEDURE Main() - set exclusive off + LOCAL pSockSrv, lExists, nStream1, nStream2, nSec, xData + + SET EXCLUSIVE OFF rddSetDefault( "DBFCDX" ) - pSockSrv := netio_mtserver( DBPORT,,, /* RPC */ .T., DBPASSWD ) - if empty( pSockSrv ) + pSockSrv := netio_MTServer( DBPORT,,, /* RPC */ .T., DBPASSWD ) + IF Empty( pSockSrv ) ? "Cannot start NETIO server !!!" - wait "Press any key to exit..." - quit - endif + WAIT "Press any key to exit..." + QUIT + ENDIF ? "NETIO server activated." hb_idleSleep( 0.1 ) - wait + WAIT ? - ? "NETIO_CONNECT():", netio_connect( DBSERVER, DBPORT, , DBPASSWD ) + ? "netio_Connect():", netio_Connect( DBSERVER, DBPORT, , DBPASSWD ) ? - netio_procexec( "QOut", "PROCEXEC", "P2", "P3", "P4" ) - netio_funcexec( "QOut", "FUNCEXEC", "P2", "P3", "P4" ) - ? "SERVER TIME:", netio_funcexec( "hb_dateTime" ) + netio_ProcExec( "QOut", "PROCEXEC", "P2", "P3", "P4" ) + netio_FuncExec( "QOut", "FUNCEXEC", "P2", "P3", "P4" ) + ? "SERVER TIME:", netio_FuncExec( "hb_dateTime" ) ? - wait + WAIT - nStream1 := NETIO_OPENITEMSTREAM( "reg_stream" ) + nStream1 := netio_OpenItemStream( "reg_stream" ) ? "NETIO_OPENITEMSTREAM:", nStream1 - nStream2 := NETIO_OPENDATASTREAM( "reg_charstream" ) + nStream2 := netio_OpenDataStream( "reg_charstream" ) ? "NETIO_OPENDATASTREAM:", nStream2 hb_idleSleep( 3 ) - ? "NETIO_GETDATA 1:", hb_valToExp( NETIO_GETDATA( nStream1 ) ) - ? "NETIO_GETDATA 2:", hb_valToExp( NETIO_GETDATA( nStream2 ) ) - nSec := seconds() + 3 - while seconds() < nSec - xData := NETIO_GETDATA( nStream1 ) - if ! empty( xData ) - ? hb_valToExp( xData ) - endif - xData := NETIO_GETDATA( nStream2 ) - if ! empty( xData ) - ?? "", hb_valToExp( xData ) - endif - enddo - wait - ? "NETIO_GETDATA 1:", hb_valToExp( NETIO_GETDATA( nStream1 ) ) - ? "NETIO_GETDATA 2:", hb_valToExp( NETIO_GETDATA( nStream2 ) ) - wait + ? "NETIO_GETDATA 1:", hb_ValToExp( netio_GetData( nStream1 ) ) + ? "NETIO_GETDATA 2:", hb_ValToExp( netio_GetData( nStream2 ) ) + nSec := Seconds() + 3 + WHILE Seconds() < nSec + xData := netio_GetData( nStream1 ) + IF ! Empty( xData ) + ? hb_ValToExp( xData ) + ENDIF + xData := netio_GetData( nStream2 ) + IF ! Empty( xData ) + ?? "", hb_ValToExp( xData ) + ENDIF + ENDDO + WAIT + ? "NETIO_GETDATA 1:", hb_ValToExp( netio_GetData( nStream1 ) ) + ? "NETIO_GETDATA 2:", hb_ValToExp( netio_GetData( nStream2 ) ) + WAIT - lExists := netio_funcexec( "HB_DirExists", "./data" ) - ? "Directory './data'", iif( ! lExists, "not exists", "exists" ) - if ! lExists + lExists := netio_FuncExec( "hb_DirExists", "./data" ) + ? "Directory './data'", iif( lExists, "exists", "not exists" ) + IF ! lExists ? "Creating directory './data' ->", ; - iif( netio_funcexec( "hb_DirCreate", "./data" ) == -1, "error", "OK" ) - endif + iif( netio_FuncExec( "hb_DirCreate", "./data" ) == -1, "error", "OK" ) + ENDIF createdb( DBNAME ) testdb( DBNAME ) - wait + WAIT ? ? "table exists:", dbExists( DBNAME ) - wait + WAIT ? ? "delete table with indexes:", dbDrop( DBNAME ) ? "table exists:", dbExists( DBNAME ) - wait + WAIT - ? "NETIO_GETDATA 1:", hb_valToExp( NETIO_GETDATA( nStream1 ) ) - ? "NETIO_GETDATA 2:", hb_valToExp( NETIO_GETDATA( nStream2 ) ) - ? "NETIO_DISCONNECT():", netio_disconnect( DBSERVER, DBPORT ) - ? "NETIO_CLOSESTREAM 1:", NETIO_CLOSESTREAM( nStream1 ) - ? "NETIO_CLOSESTREAM 2:", NETIO_CLOSESTREAM( nStream2 ) + ? "NETIO_GETDATA 1:", hb_ValToExp( netio_GetData( nStream1 ) ) + ? "NETIO_GETDATA 2:", hb_ValToExp( netio_GetData( nStream2 ) ) + ? "netio_Disconnect():", netio_Disconnect( DBSERVER, DBPORT ) + ? "NETIO_CLOSESTREAM 1:", netio_CloseStream( nStream1 ) + ? "NETIO_CLOSESTREAM 2:", netio_CloseStream( nStream2 ) hb_idleSleep( 2 ) ? ? "stopping the server..." - netio_serverstop( pSockSrv, .t. ) -return + netio_ServerStop( pSockSrv, .T. ) -proc createdb( cName ) - local n + RETURN - dbCreate( cName, {{"F1", "C", 20, 0},; - {"F2", "M", 4, 0},; - {"F3", "N", 10, 2},; - {"F4", "T", 8, 0}} ) - ? "create neterr:", neterr(), hb_osError() - use (cName) - ? "use neterr:", neterr(), hb_osError() - while lastrec() < 100 +PROCEDURE createdb( cName ) + + LOCAL n + + dbCreate( cName, { ; + { "F1", "C", 20, 0 }, ; + { "F2", "M", 4, 0 }, ; + { "F3", "N", 10, 2 }, ; + { "F4", "T", 8, 0 } } ) + ? "create neterr:", NetErr(), hb_osError() + USE ( cName ) + ? "use neterr:", NetErr(), hb_osError() + WHILE LastRec() < 100 dbAppend() - n := recno() - 1 - field->F1 := chr( n % 26 + asc( "A" ) ) + " " + time() + n := RecNo() - 1 + field->F1 := Chr( n % 26 + Asc( "A" ) ) + " " + Time() field->F2 := field->F1 field->F3 := n / 100 - field->F4 := hb_dateTime() - enddo - index on field->F1 tag T1 - index on field->F3 tag T3 - index on field->F4 tag T4 - close + field->F4 := hb_DateTime() + ENDDO + INDEX ON field->F1 TAG T1 + INDEX ON field->F3 TAG T3 + INDEX ON field->F4 TAG T4 + CLOSE ? -return -proc testdb( cName ) - local i, j - use (cName) - ? "used:", used() - ? "nterr:", neterr() - ? "alias:", alias() - ? "lastrec:", lastrec() + RETURN + +PROCEDURE testdb( cName ) + + LOCAL i, j + + USE ( cName ) + ? "used:", Used() + ? "nterr:", NetErr() + ? "alias:", Alias() + ? "lastrec:", LastRec() ? "ordCount:", ordCount() - for i:=1 to ordCount() + FOR i := 1 TO ordCount() ordSetFocus( i ) ? i, "name:", ordName(), "key:", ordKey(), "keycount:", ordKeyCount() - next + NEXT ordSetFocus( 1 ) - dbgotop() - while ! eof() - if ! field->F1 == field->F2 - ? "error at record:", recno() + dbGoTop() + WHILE ! Eof() + IF ! field->F1 == field->F2 + ? "error at record:", RecNo() ? " ! '" + field->F1 + "' == '" + field->F2 + "'" - endif + ENDIF dbSkip() - enddo - wait - i := row() - j := col() - dbgotop() - browse() - setpos( i, j ) - close -return + ENDDO + WAIT + i := Row() + j := Col() + dbGoTop() + Browse() + SetPos( i, j ) + CLOSE -func reg_stream( pConnSock, nStream ) - ? PROCNAME(), nStream + RETURN + +FUNCTION reg_stream( pConnSock, nStream ) + + ? ProcName(), nStream hb_threadDetach( hb_threadStart( @rpc_timer(), pConnSock, nStream ) ) -return nStream -func reg_charstream( pConnSock, nStream ) - ? PROCNAME(), nStream + RETURN nStream + +FUNCTION reg_charstream( pConnSock, nStream ) + + ? ProcName(), nStream hb_threadDetach( hb_threadStart( @rpc_charstream(), pConnSock, nStream ) ) -return nStream -static func rpc_timer( pConnSock, nStream ) - while .t. - if ! netio_srvSendItem( pConnSock, nStream, time() ) + RETURN nStream + +STATIC FUNCTION rpc_timer( pConnSock, nStream ) + + WHILE .T. + IF ! netio_SrvSendItem( pConnSock, nStream, Time() ) ? "CLOSED STREAM:", nStream - exit - endif + EXIT + ENDIF hb_idleSleep( 1 ) - enddo -return nil + ENDDO -static func rpc_charstream( pConnSock, nStream ) - local n := 0 - while .t. - if ! netio_srvSendData( pConnSock, nStream, chr( asc( "A" ) + n ) ) + RETURN NIL + +STATIC FUNCTION rpc_charstream( pConnSock, nStream ) + + LOCAL n := 0 + + WHILE .T. + IF ! netio_SrvSendData( pConnSock, nStream, Chr( Asc( "A" ) + n ) ) ? "CLOSED STREAM:", nStream - exit - endif - n := int( ( n + 1 ) % 26 ) + EXIT + ENDIF + n := Int( ( n + 1 ) % 26 ) hb_idleSleep( 0.1 ) - enddo -return nil + ENDDO + + RETURN NIL diff --git a/contrib/hbnetio/tests/netiotst.prg b/contrib/hbnetio/tests/netiotst.prg index e4e9cedd88..bc1bf450a5 100644 --- a/contrib/hbnetio/tests/netiotst.prg +++ b/contrib/hbnetio/tests/netiotst.prg @@ -19,113 +19,121 @@ #define DBFILE "_tst_" #define DBNAME "net:" + DBSERVER + ":" + hb_ntos( DBPORT ) + ":" + ; - DBPASSWD + ":" + DBDIR + "/" + DBFILE + DBPASSWD + ":" + DBDIR + "/" + DBFILE -request DBFCDX +REQUEST DBFCDX -request HB_DIREXISTS -request HB_DIRCREATE +REQUEST hb_DirExists +REQUEST hb_DirCreate -proc main() - local pSockSrv, lExists +PROCEDURE Main() - set exclusive off + LOCAL pSockSrv, lExists + + SET EXCLUSIVE OFF rddSetDefault( "DBFCDX" ) - pSockSrv := netio_mtserver( DBPORT,,, /* RPC */ .T., DBPASSWD ) - if empty( pSockSrv ) + pSockSrv := netio_MTServer( DBPORT,,, /* RPC */ .T., DBPASSWD ) + IF Empty( pSockSrv ) ? "Cannot start NETIO server !!!" - wait "Press any key to exit..." - quit - endif + WAIT "Press any key to exit..." + QUIT + ENDIF ? "NETIO server activated." hb_idleSleep( 0.1 ) - wait + WAIT ? - ? "NETIO_CONNECT():", netio_connect( DBSERVER, DBPORT, , DBPASSWD ) + ? "netio_Connect():", netio_Connect( DBSERVER, DBPORT, , DBPASSWD ) ? - lExists := netio_funcexec( "HB_DirExists", "./data" ) + lExists := netio_FuncExec( "HB_DirExists", "./data" ) ? "Directory './data'", iif( ! lExists, "not exists", "exists" ) - if ! lExists + IF ! lExists ? "Creating directory './data' ->", ; - iif( netio_funcexec( "hb_DirCreate", "./data" ) == -1, "error", "OK" ) - endif + iif( netio_FuncExec( "hb_DirCreate", "./data" ) == -1, "error", "OK" ) + ENDIF ? "'" + DBNAME + "'" createdb( DBNAME ) testdb( DBNAME ) - wait + WAIT ? ? "table exists:", dbExists( DBNAME ) - wait + WAIT ? ? "delete table with indexes:", dbDrop( DBNAME ) ? "table exists:", dbExists( DBNAME ) - wait + WAIT - ? "NETIO_DISCONNECT():", netio_disconnect( DBSERVER, DBPORT ) + ? "netio_Disconnect():", netio_Disconnect( DBSERVER, DBPORT ) ? ? "stopping the server..." - netio_serverstop( pSockSrv, .t. ) -return + netio_ServerStop( pSockSrv, .T. ) -proc createdb( cName ) - local n + RETURN - dbCreate( cName, {{"F1", "C", 20, 0},; - {"F2", "M", 4, 0},; - {"F3", "N", 10, 2},; - {"F4", "T", 8, 0}} ) - ? "create neterr:", neterr(), hb_osError() - use (cName) - ? "use neterr:", neterr(), hb_osError() - while lastrec() < 100 +PROCEDURE createdb( cName ) + + LOCAL n + + dbCreate( cName, { ; + { "F1", "C", 20, 0 }, ; + { "F2", "M", 4, 0 }, ; + { "F3", "N", 10, 2 }, ; + { "F4", "T", 8, 0 } } ) + ? "create neterr:", NetErr(), hb_osError() + USE ( cName ) + ? "use neterr:", NetErr(), hb_osError() + WHILE LastRec() < 100 dbAppend() - n := recno() - 1 - field->F1 := chr( n % 26 + asc( "A" ) ) + " " + time() + n := RecNo() - 1 + field->F1 := Chr( n % 26 + Asc( "A" ) ) + " " + Time() field->F2 := field->F1 field->F3 := n / 100 - field->F4 := hb_dateTime() - enddo - index on field->F1 tag T1 - index on field->F3 tag T3 - index on field->F4 tag T4 - close + field->F4 := hb_DateTime() + ENDDO + INDEX ON field->F1 TAG T1 + INDEX ON field->F3 TAG T3 + INDEX ON field->F4 TAG T4 + CLOSE ? -return -proc testdb( cName ) - local i, j - use (cName) - ? "used:", used() - ? "nterr:", neterr() - ? "alias:", alias() - ? "lastrec:", lastrec() + RETURN + +PROCEDURE testdb( cName ) + + LOCAL i, j + + USE ( cName ) + ? "used:", Used() + ? "nterr:", NetErr() + ? "alias:", Alias() + ? "lastrec:", LastRec() ? "ordCount:", ordCount() - for i:=1 to ordCount() + FOR i := 1 TO ordCount() ordSetFocus( i ) ? i, "name:", ordName(), "key:", ordKey(), "keycount:", ordKeyCount() - next + NEXT ordSetFocus( 1 ) - dbgotop() - while ! eof() - if ! field->F1 == field->F2 - ? "error at record:", recno() + dbGoTop() + WHILE ! Eof() + IF ! field->F1 == field->F2 + ? "error at record:", RecNo() ? " ! '" + field->F1 + "' == '" + field->F2 + "'" - endif + ENDIF dbSkip() - enddo - wait - i := row() - j := col() - dbgotop() - browse() - setpos( i, j ) - close -return + ENDDO + WAIT + i := Row() + j := Col() + dbGoTop() + Browse() + SetPos( i, j ) + CLOSE + + RETURN diff --git a/contrib/xhb/thtm.prg b/contrib/xhb/thtm.prg index 11e628d03e..e32eeb96eb 100644 --- a/contrib/xhb/thtm.prg +++ b/contrib/xhb/thtm.prg @@ -424,7 +424,7 @@ METHOD New( cTitle, cLinkTitle, cCharSet, aScriptSRC, ; ::cStr += Space( 5 ) + "// Function to 'activate' images." + CRLF() ::cStr += Space( 5 ) + "function imageOn(imgName) {" + CRLF() ::cStr += Space( 5 ) + " if (document.images) {" + CRLF() - ::cStr += Space( 5 ) + ' imgOn=eval(imgName + "on.src");' + CRLF() + ::cStr += Space( 5 ) + ' imgOn=eval' + '(imgName + "on.src");' + CRLF() ::cStr += Space( 5 ) + ' document[imgName].src = imgOn;' + CRLF() ::cStr += Space( 5 ) + " }" + CRLF() ::cStr += Space( 5 ) + "}" + CRLF() @@ -432,7 +432,7 @@ METHOD New( cTitle, cLinkTitle, cCharSet, aScriptSRC, ; ::cStr += Space( 5 ) + "// Function to 'deactivate' images." + CRLF() ::cStr += Space( 5 ) + "function imageOff(imgName) {" + CRLF() ::cStr += Space( 5 ) + " if (document.images) {" + CRLF() - ::cStr += Space( 5 ) + ' imgOff = eval(imgName + "off.src");' + CRLF() + ::cStr += Space( 5 ) + ' imgOff=eval' + '(imgName + "off.src");' + CRLF() ::cStr += Space( 5 ) + ' document[imgName].src = imgOff;' + CRLF() ::cStr += Space( 5 ) + " }" + CRLF() ::cStr += Space( 5 ) + "}" + CRLF() @@ -440,7 +440,7 @@ METHOD New( cTitle, cLinkTitle, cCharSet, aScriptSRC, ; ::cStr += Space( 5 ) + "// Function for 'pressed' images." + CRLF() ::cStr += Space( 5 ) + "function imagePress(imgName) {" + CRLF() ::cStr += Space( 5 ) + " if (document.images) {" + CRLF() - ::cStr += Space( 5 ) + ' imgPress = eval(imgName + "press.src");' + CRLF() + ::cStr += Space( 5 ) + ' imgPress=eval' + '(imgName + "press.src");' + CRLF() ::cStr += Space( 5 ) + ' document[imgName].src = imgPress;' + CRLF() ::cStr += Space( 5 ) + " }" + CRLF() ::cStr += Space( 5 ) + "}" + CRLF() diff --git a/tests/bldtest/bldtext.hbp b/tests/bldtest/bldtext.hbp new file mode 100644 index 0000000000..782b1cddfe --- /dev/null +++ b/tests/bldtest/bldtext.hbp @@ -0,0 +1,3 @@ +bldtest.c + +-nohblib diff --git a/tests/clipper.ch b/tests/clipper.ch index c200256f57..c8e1b2f340 100644 --- a/tests/clipper.ch +++ b/tests/clipper.ch @@ -36,6 +36,8 @@ #xtranslate HB_ISLOGICAL( ) => ( ValType( ) == "L" ) #xtranslate HB_ISARRAY( ) => ( ValType( ) == "A" ) #xtranslate HB_ISOBJECT( ) => ( ValType( ) == "O" ) +#xtranslate HB_ISBLOCK( ) => ( ValType( ) == "B" ) +#xtranslate HB_ISEVALITEM( ) => ( ValType( ) == "B" ) #xtranslate hb_keyCode( ) => Asc( ) #xtranslate hb_keyChar( ) => Chr( ) diff --git a/tests/hbpptest/pp_test.prg b/tests/hbpptest/_pp_test.prg similarity index 98% rename from tests/hbpptest/pp_test.prg rename to tests/hbpptest/_pp_test.prg index d87e84c3d2..06a508d824 100644 --- a/tests/hbpptest/pp_test.prg +++ b/tests/hbpptest/_pp_test.prg @@ -1,15 +1,18 @@ -/* Test file to check the preprocessor. +/* + * Test file to check the preprocessor. * * Usage: - * 1) Run compare.bat for a comparison between Harbour and CA-Cl*pper. - * 2) Results will be stored in pp_test.diff + * 1) Execute compare.hb script for a comparison between Harbour and CA-Cl*pper: + * 'hbrun compare' + * 2) Results will be stored in pp_test.dif * * Notes: - * - clipper.exe and diff.exe needs to be in the path. + * - clipper.exe (5.x) and diff executable need to be in the path. + * - requires 32-bit Windows OS * * Ignore most of errors reported during compilation. * -*/ + */ PROCEDURE Main() diff --git a/tests/hbpptest/compare.bat b/tests/hbpptest/compare.bat deleted file mode 100644 index 460eb841fd..0000000000 --- a/tests/hbpptest/compare.bat +++ /dev/null @@ -1,15 +0,0 @@ -@echo off - -copy pp_test.prg _pp_hb.prg -copy pp_test.prg _pp_c5x.prg - -..\..\bin\harbour -p -s -n _pp_hb.prg -clipper.exe _pp_c5x.prg /p /s /n - -del _pp_hb.prg -del _pp_c5x.prg - -diff -u -w _pp_hb.ppo _pp_c5x.ppo > pp_test.dif - -del _pp_hb.ppo -del _pp_c5x.ppo diff --git a/tests/hbpptest/compare.hb b/tests/hbpptest/compare.hb new file mode 100644 index 0000000000..13a91ee23a --- /dev/null +++ b/tests/hbpptest/compare.hb @@ -0,0 +1,14 @@ + +hb_FCopy( "_pp_test.prg", "_pp_hb.prg" ) +hb_FCopy( "_pp_test.prg", "_pp_cl.prg" ) + +hb_run( "harbour -p -s -n _pp_hb.prg" ) +hb_run( "clipper.exe _pp_cl.prg /p /s /n" ) + +FErase( "_pp_hb.prg" ) +FErase( "_pp_cl.prg" ) + +hb_run( "diff -u -w _pp_hb.ppo _pp_cl.ppo > pp_test.dif" ) + +FErase( "_pp_hb.ppo" ) +FErase( "_pp_cl.ppo" )