2009-03-17 12:22 UTC+0100 Viktor Szakats (harbour.01 syenar hu)

+ tests/server.prg
  * tests/Makefile
    + Added inet example from xhb.

  * source/vm/thread.c
    ! Fixed nested comment.

  * contrib/xhb/hbcompat.ch
  * contrib/xhb/xhb.ch
    ! Moved xhb.lib dependent translation to xhb.ch.

  * contrib/examples/hbdoc/examples/core_es/Makefile
  * contrib/examples/hbdoc/examples/core_en/genhtm.bat
  - contrib/examples/hbdoc/examples/core_en/genhtm.sh
    * Cleanup.
This commit is contained in:
Viktor Szakats
2009-03-17 11:23:27 +00:00
parent f745af7218
commit 52410317a6
9 changed files with 166 additions and 20 deletions

View File

@@ -8,6 +8,23 @@
2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2009-03-17 12:22 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
+ tests/server.prg
* tests/Makefile
+ Added inet example from xhb.
* source/vm/thread.c
! Fixed nested comment.
* contrib/xhb/hbcompat.ch
* contrib/xhb/xhb.ch
! Moved xhb.lib dependent translation to xhb.ch.
* contrib/examples/hbdoc/examples/core_es/Makefile
* contrib/examples/hbdoc/examples/core_en/genhtm.bat
- contrib/examples/hbdoc/examples/core_en/genhtm.sh
* Cleanup.
2009-03-17 10:00 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* debian/rules
* harbour-win-spec

View File

@@ -3,6 +3,6 @@ rem
rem $Id$
rem
..\..\bin\hbdoc -htm genhtm.lnk genhtm.rsp
..\..\hbdoc -htm genhtm.lnk genhtm.rsp
cd htm
ren harbour.htm index.htm

View File

@@ -1,12 +0,0 @@
#!/bin/sh
#
# $Id$
#
../../bin/hbdoc -htm genhtm.lnk genhtm.rsp
cd htm
#
echo "renaming harbour.htm to index.htm"
mv harbour.htm index.htm
rm -f genwww.lnk
mv genwww.old genwww.lnk

View File

@@ -2,7 +2,7 @@
# $Id$
#
ROOT = ../../
ROOT = ../../../../../
DOC_SUBDIR=/es

View File

@@ -227,9 +227,6 @@
#xtranslate hb_MutexTimeOutLock( <x>, <n> ) => hb_MutexLock( <x>, <n> / 1000 )
#xtranslate Notify( <x,...> ) => hb_mutexNotify( <x> )
#xtranslate NotifyAll( <x,...> ) => hb_mutexNotifyAll( <x> )
#xtranslate Subscribe( <x,...> ) => xhb_mutexSubscribe( <x> )
#xtranslate SubscribeNow( <x,...> ) => xhb_mutexSubscribeNow( <x> )
#xtranslate StartThread( <x,...> ) => xhb_StartThread( <x> )
/* not possible to well replicate xHarbour behavior because its buggy
these function results are different on different platform, chosen

View File

@@ -61,8 +61,12 @@
#pragma -ks+
REQUEST XHB_LIB
#xtranslate __Keyboard([<x,...>]) => xhb__Keyboard(<x>)
#xtranslate __CopyFile([<x,...>]) => xhb_CopyFile(<x>)
#xtranslate __Keyboard([<x,...>]) => xhb__Keyboard(<x>)
#xtranslate __CopyFile([<x,...>]) => xhb_CopyFile(<x>)
#xtranslate Subscribe( <x,...> ) => xhb_mutexSubscribe( <x> )
#xtranslate SubscribeNow( <x,...> ) => xhb_mutexSubscribeNow( <x> )
#xtranslate StartThread( <x,...> ) => xhb_StartThread( <x> )
#endif
#endif /* __HARBOUR__ */

View File

@@ -58,7 +58,7 @@
hb_threadId( [ <pThID> ] ) -> <nThNo>
hb_threadJoin( <pThID> [, @<xRetCode> ] ) -> <lOK>
hb_threadDetach( <pThID> ) -> <lOK>
* hb_threadQuitRequest( <pThID> ) -> <lOK> /* may be ignored !!! */
* hb_threadQuitRequest( <pThID> ) -> <lOK>
hb_threadTerminateAll() -> NIL
hb_threadWaitForAll() -> NIL
hb_threadWait( <pThID> | <apThID>, [ <nTimeOut> ] [, <lAll> ] ) => <nThInd> | <nThCount> | 0

View File

@@ -112,6 +112,7 @@ PRG_SOURCES=\
scroll.prg \
sdf_test.prg \
seconds.prg \
server.prg \
setkeys.prg \
set_num.prg \
set_test.prg \

139
harbour/tests/server.prg Normal file
View File

@@ -0,0 +1,139 @@
/*
* $Id$
*/
***************************************************
* X harbour Inet demo server program
*
* Giancarlo Niccolai
*
* In this program, the server uses just one thread
* to demonstrate how to use timeout sockets.
*
Procedure Main( cPort )
LOCAL Socket, s
LOCAL nResponse, cResponse
LOCAL nTurn := 0, nTurn1 := 0
LOCAL CRLF := hb_InetCRLF()
LOCAL bCont := .T.
CLS
IF Empty( cPort )
cPort := "2000"
ENDIF
hb_InetInit()
@ 1, 15 SAY "X H A R B O U R - Inet Api Server Demo"
@ 2, 5 SAY "Contact this server using telnet or the xHarbour Inet Client demo"
@ 3, 5 SAY "Press a [KEY] to terminate the program"
@ 5, 5 SAY "Server listening on port " + cPort + "..."
Socket := hb_InetServer( Val( cPort ) )
hb_InetTimeout( Socket, 500 )
DO WHILE bCont
@ 6, 5 SAY Space( 70 )
@ 7, 5 SAY Space( 70 )
@ 8, 5 SAY Space( 70 )
@ 9, 5 SAY Space( 70 )
@ 6, 5
* Accepting a connection
DO WHILE bCont
Progress( @nTurn, 5, 39 )
s := hb_InetAccept( Socket )
IF hb_InetErrorCode( Socket ) == 0
EXIT
ENDIF
IF Inkey() != 0
bCont := .f.
ENDIF
ENDDO
IF .not. bCont
EXIT
ENDIF
hb_InetTimeout( s, 500 )
@ 6, 5 SAY "Connection from: " + hb_InetAddress( s ) + ":" + Str( hb_InetPort( s ), 5 )
@ 7, 5 SAY "Receiving: "
@ 8, 5
nResponse := hb_InetSend( s, "Welcome to my server!" + CRLF )
DO WHILE bCont
// This timeout ...
hb_InetTimeout( s, 250 )
// ... will trigger this periodic callback,
hb_InetPeriodCallback( s, { @Progress(), @nTurn, 6, 39 } )
// that will be called each TIMEOUT Milliseconds.
cResponse := hb_InetRecvLine( s, @nResponse )
// hb_InetRecvLine won't return until the periodic callback returns .F.,
// or the Timelimit has been reached. Timelimit is currently -1, so
// hb_InetRecvLine will wait forever.
DO CASE
CASE hb_InetErrorCode( s ) == 0
IF Lower( cResponse ) == "quit"
bCont := .F.
ENDIF
@ 8, 5 SAY space(70)
@ 8, 5 SAY cResponse
cResponse := "Count: " + Str( nResponse ) + " characters" + CRLF
hb_InetSend( s, cResponse )
CASE hb_InetErrorCode( s ) == -1
* idle (timed out)
Progress( @nTurn1, 7, 17 )
OTHERWISE
@7, 5 SAY "Received Error " + Str( hb_InetErrorCode( s ) ) + ": " + hb_InetErrorDesc( s )
@ 8, 5 SAY space(70)
@ 9, 5 SAY space(70)
@ 9, 5 SAY "Press a key to continue"
Inkey( 0 )
EXIT
END CASE
IF Inkey() != 0
bCont := .f.
ENDIF
ENDDO
ENDDO
hb_InetCleanup()
RETURN
PROCEDURE Progress( nProgress, nDrow, nDcol )
LOCAL nRow := Row(), nCol := Col()
@ nDrow, nDcol SAY "[ ]"
DO CASE
CASE nProgress = 0
@ nDrow, nDcol + 1 SAY "-"
CASE nProgress = 1
@ nDrow, nDcol + 1 SAY "\"
CASE nProgress = 2
@ nDrow, nDcol + 1 SAY "|"
CASE nProgress = 3
@ nDrow, nDcol + 1 SAY "/"
ENDCASE
nProgress++
IF nProgress == 4
nProgress := 0
ENDIF
@ nRow, nCol
RETURN