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
This commit is contained in:
Viktor Szakats
2013-04-08 12:41:52 +02:00
parent fe9b84e2c2
commit bbde354d00
17 changed files with 344 additions and 304 deletions

View File

@@ -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

View File

@@ -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.

View File

@@ -1,10 +0,0 @@
(こんにちは。)
(おはようございます。)
(こんばんは。)
(はじめまして、どうぞよろしく。)
(お帰りなさい。)
(おやすみなさい。)
(さようなら。)
(お元気ですか。)
(お久しぶり。)
(お邪魔します。)

View File

@@ -1,10 +0,0 @@
你好!
早上好!
晚上好!
你好,请多关照。
回来了。
晚安。
再见!
身体好吗?
好久不见!
打扰了。<EFBFBD>

View File

@@ -1,10 +0,0 @@
(こんにちは。)
(おはようございます。)
(こんばんは。)
(はじめまして、どうぞよろしく。)
(お帰りなさい。)
(おやすみなさい。)
(さようなら。)
(お元気ですか。)
(お久しぶり。)
(お邪魔します。)

View File

@@ -1 +0,0 @@
アメンボ赤いなあいうえお。浮き藻に小エビもおよいでる。

View File

@@ -1 +0,0 @@
アメンボ赤いなあいうえお。浮き藻に小エビもおよいでる。

View File

@@ -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

View File

@@ -24,20 +24,20 @@
/* few PP rules which allow to execute RPC function using
* pseudo object 'net', i.e. ? net:date()
*/
#xtranslate net:<!func!>([<params,...>]) => ;
netio_funcexec( #<func> [,<params>] )
#xtranslate net:[<server>]:<!func!>([<params,...>]) => ;
netio_funcexec( [ #<server> + ] ":" + #<func> [,<params>] )
#xtranslate net:[<server>]:<port>:<!func!>([<params,...>]) => ;
netio_funcexec( [ #<server> + ] ":" + #<port> + ":" + #<func> ;
#xtranslate net:<!func!>( [<params,...>] ) => ;
netio_FuncExec( #<func> [,<params>] )
#xtranslate net:[<server>]:<!func!>( [<params,...>] ) => ;
netio_FuncExec( [ #<server> + ] ":" + #<func> [,<params>] )
#xtranslate net:[<server>]:<port>:<!func!>( [<params,...>] ) => ;
netio_FuncExec( [ #<server> + ] ":" + #<port> + ":" + #<func> ;
[,<params>] )
#xtranslate net:exists:<!func!> => ;
netio_procexists( #<func> )
netio_ProcExists( #<func> )
#xtranslate net:exists:[<server>]:<!func!> => ;
netio_procexists( [ #<server> + ] ":" + #<func> )
netio_ProcExists( [ #<server> + ] ":" + #<func> )
#xtranslate net:exists:[<server>]:<port>:<!func!> => ;
netio_procexists( [ #<server> + ] ":" + #<port> + ":" + #<func> )
netio_ProcExists( [ #<server> + ] ":" + #<port> + ":" + #<func> )
/* 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

View File

@@ -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

View File

@@ -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

View File

@@ -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()

View File

@@ -0,0 +1,3 @@
bldtest.c
-nohblib

View File

@@ -36,6 +36,8 @@
#xtranslate HB_ISLOGICAL( <v> ) => ( ValType( <v> ) == "L" )
#xtranslate HB_ISARRAY( <v> ) => ( ValType( <v> ) == "A" )
#xtranslate HB_ISOBJECT( <v> ) => ( ValType( <v> ) == "O" )
#xtranslate HB_ISBLOCK( <v> ) => ( ValType( <v> ) == "B" )
#xtranslate HB_ISEVALITEM( <v> ) => ( ValType( <v> ) == "B" )
#xtranslate hb_keyCode( <n> ) => Asc( <n> )
#xtranslate hb_keyChar( <c> ) => Chr( <c> )

View File

@@ -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()

View File

@@ -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

14
tests/hbpptest/compare.hb Normal file
View File

@@ -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" )