From 7c110952dac272dac15a2df8783d0fdb20ff8917 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Wed, 13 Jan 2010 19:15:05 +0000 Subject: [PATCH] 2010-01-13 20:14 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/vm/hashes.c ! fixed missing HB_STACK_TLS_PRELOAD - thanks to Xavi * harbour/contrib/hbnetio/netiosrv.c ! fixed wrong declaration and casting of rpcFilter - thanks to Xavi + harbour/contrib/hbnetio/readme.txt + added small description of NETIO functions - now only client parts * harbour/contrib/hbwin/win_tprn.prg * updated class name in comments * harbour/contrib/hbwin/win_prn1.c * minor formatting * harbour/contrib/hbwin/win_prn3.c % removed unnecessary rest of buffer clearing in hb_tstrncat() --- harbour/ChangeLog | 19 ++++++ harbour/contrib/hbnetio/netiosrv.c | 4 +- harbour/contrib/hbnetio/readme.txt | 103 +++++++++++++++++++++++++++++ harbour/contrib/hbwin/win_prn1.c | 4 +- harbour/contrib/hbwin/win_prn3.c | 3 - harbour/contrib/hbwin/win_tprn.prg | 6 +- harbour/src/vm/hashes.c | 1 + 7 files changed, 130 insertions(+), 10 deletions(-) create mode 100644 harbour/contrib/hbnetio/readme.txt diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e09ea0e56c..f1de937d56 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,25 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-01-13 20:14 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/vm/hashes.c + ! fixed missing HB_STACK_TLS_PRELOAD - thanks to Xavi + + * harbour/contrib/hbnetio/netiosrv.c + ! fixed wrong declaration and casting of rpcFilter - thanks to Xavi + + + harbour/contrib/hbnetio/readme.txt + + added small description of NETIO functions - now only client parts + + * harbour/contrib/hbwin/win_tprn.prg + * updated class name in comments + + * harbour/contrib/hbwin/win_prn1.c + * minor formatting + + * harbour/contrib/hbwin/win_prn3.c + % removed unnecessary rest of buffer clearing in hb_tstrncat() + 2010-01-13 18:11 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/tget.prg ! Fixed cursor positioning bug, when @S picture length is diff --git a/harbour/contrib/hbnetio/netiosrv.c b/harbour/contrib/hbnetio/netiosrv.c index a21ea5f03d..42bcdf7e63 100644 --- a/harbour/contrib/hbnetio/netiosrv.c +++ b/harbour/contrib/hbnetio/netiosrv.c @@ -97,7 +97,7 @@ typedef struct _HB_CONSRV BOOL rpc; BOOL login; PHB_SYMB rpcFunc; - PHB_SYMB rpcFilter; + PHB_ITEM rpcFilter; int rootPathLen; char rootPath[ HB_PATH_MAX ]; } @@ -491,7 +491,7 @@ HB_FUNC( NETIO_RPCFILTER ) PHB_ITEM pHash = hb_param( 2, HB_IT_HASH ); if( pHash ) { - conn->rpcFilter = hb_itemNew( pHash ); + conn->rpcFilter = ( PHB_ITEM ) hb_itemNew( pHash ); hb_gcUnlock( conn->rpcFilter ); } } diff --git a/harbour/contrib/hbnetio/readme.txt b/harbour/contrib/hbnetio/readme.txt new file mode 100644 index 0000000000..8dc14a00ff --- /dev/null +++ b/harbour/contrib/hbnetio/readme.txt @@ -0,0 +1,103 @@ +/* + * $Id$ + * + * Copyright 2010 Przemyslaw Czerpak + * www - http://www.harbour-project.org + */ + +HBNETIO is implementation of alternative RDD IO API for Harbour with +additional RPC support. It contains either client and server code. +It supports connection stream compression using ZLIB compression and +encryption using blowfish algorithm. +After registering on the client side all files used by Harbour native +RDDs with name starting with "net:" are redirected to the hbnetio server. + +Client side functions: +====================== + NETIO_CONNECT( [], [], [], ; + [], [], [] ) + -> + Register HBNETIO as alternative RDD IO API redirecting all files + with name starting with "net:" to HBNETIO server, set default + server address, port and connection parameters and tries to set + the connection to this server. + When executed 1-st time it sets default connection parameters + for all threads. Each thread can overwrite these default settings + with its own local ones calling NETIO_CONNECT() function. + Each successful call to NETIO_CONNECT() increase the reference + counter for given connection. NETIO_DISCONNECT() decrease the + reference. Connection is closed when the counter reach 0. It + means that each NETIO_CONNECT() call needs corresponding call + to NETIO_DISCONNECT(). The connections are recognized by IP server + address and port number and they are shared between threads. So when + more then one thread call NETIO_CONNECT() then only one connection + is created. It also means that NETIO_DISCONNECT() does not have to + be called by the same thread which called NETIO_CONNECT(). + On application exist all connections are automatically closed. + It possible to open many different connections and keep them open. + In RDD IO operations and RPC calls it's possible to specify server + address as part of file or procedure/function name, i.e. + USE net:192.168.0.2:2942:path/to/file + NETIO_PROCEXEC( "192.168.0.2:2942:procname" ) + or using UNC paths: + USE net://192.168.0.2:2942/path/to/file + NETIO_PROCEXEC( "//192.168.0.2:2942/procname" ) + It's also possible to specify the password. The connection string + is in format: + [:[:]]: + or: + //::: + or: + //[:]/ + Backslashes '\' are also supported and can be used instead of '/'. + Password is always terminated by ":" and whole connection string + is terminated by CHR(0) so it's not possible to use these two + characters as part of password. Anyhow when passwords are required + then it's recommended to open the connection by NETIO_CONNECT() + and then specify only server and port is server is not unique + enough to chose from existing connections. If server is not + given then default connection is chosen. + + + NETIO_DISCONNECT( [], [] ) -> + Close the connection created by NETIO_CONNECT() + + + NETIO_PROCEXISTS( ) -> + Check if function or procedure exists on the server side. + + + NETIO_PROCEXEC( [, ] ) -> + Execute function or procedure on server the side do not wait for + confirmation from the server. + + + NETIO_PROCEXECW( [, ] ) -> + Execute function or procedure on the server side and wait for + confirmation from the server. + + + NETIO_FUNCEXEC( [, ] ) -> + Execute function on the server side and wait for function return + value sent by the server. + + + +Server side functions: +====================== + NETIO_LISTEN( [], [], [], [] ) + -> | NIL + NETIO_ACCEPT( , [], + [], [], [] ) + -> | NIL + NETIO_COMPRESS( , + [], [], [] ) -> NIL + NETIO_SERVER( ) -> NIL + NETIO_RPC( | [, ] ) -> + NETIO_RPCFILTER( , + | | NIL ) -> NIL + NETIO_SERVERSTOP( | [, ] ) -> NIL + NETIO_MTSERVER( [], [], [], + [ | | ], + [], [], [] ) + -> diff --git a/harbour/contrib/hbwin/win_prn1.c b/harbour/contrib/hbwin/win_prn1.c index 08f3b5e068..b61ea780e3 100644 --- a/harbour/contrib/hbwin/win_prn1.c +++ b/harbour/contrib/hbwin/win_prn1.c @@ -323,8 +323,8 @@ HB_FUNC( WIN_GETTEXTSIZE ) { SIZE sSize; - GetTextExtentPoint32( hDC, lpData, ( int ) nLen, &sSize ); /* Get the length of the text in device size */ - + GetTextExtentPoint32( hDC, lpData, ( int ) nLen, &sSize ); /* Get the length of the text in device size */ + if( ! hb_parldef( 4, 1 ) ) lResult = ( long ) sSize.cy; /* return the height */ else diff --git a/harbour/contrib/hbwin/win_prn3.c b/harbour/contrib/hbwin/win_prn3.c index 8df3d9b6b7..feeeb52ec5 100644 --- a/harbour/contrib/hbwin/win_prn3.c +++ b/harbour/contrib/hbwin/win_prn3.c @@ -81,9 +81,6 @@ static TCHAR * hb_tstrncat( TCHAR * pDest, const TCHAR * pSource, ULONG ulLen ) ulLen--; } - while( ulLen && ( *pDest++ = *pSource++ ) != '\0' ) - ulLen--; - return pBuf; } diff --git a/harbour/contrib/hbwin/win_tprn.prg b/harbour/contrib/hbwin/win_tprn.prg index 7e9857a4b0..85d4077fbc 100644 --- a/harbour/contrib/hbwin/win_tprn.prg +++ b/harbour/contrib/hbwin/win_tprn.prg @@ -51,9 +51,9 @@ */ /* - TPRINT() was designed to make it easy to emulate Clipper Dot Matrix printing. + WIN_PRN() was designed to make it easy to emulate Clipper Dot Matrix printing. Dot Matrix printing was in CPI ( Characters per inch & Lines per inch ). - Even though "Mapping Mode" for TPRINT() is MM_TEXT, ::SetFont() accepts the + Even though "Mapping Mode" for WIN_PRN() is MM_TEXT, ::SetFont() accepts the nWidth parameter in CPI not Pixels. Also the default ::LineHeight is for 6 lines per inch so ::NewLine() works as per "LineFeed" on Dot Matrix printers. If you do not like this then inherit from the class and override anything you want @@ -661,7 +661,7 @@ METHOD Create() CLASS WIN_BMP // Compatibility function for Alaska Xbase++ METHOD Destroy() CLASS WIN_BMP // Compatibility function for Alaska Xbase++ RETURN NIL -METHOD Draw( oPrn, aRectangle ) CLASS WIN_BMP // Pass a TPRINT class reference & Rectangle array +METHOD Draw( oPrn, aRectangle ) CLASS WIN_BMP // Pass a WIN_PRN object reference & Rectangle array ::Rect := aRectangle RETURN oPrn:DrawBitMap( Self ) diff --git a/harbour/src/vm/hashes.c b/harbour/src/vm/hashes.c index 5e6f1872ed..9e273929cf 100644 --- a/harbour/src/vm/hashes.c +++ b/harbour/src/vm/hashes.c @@ -481,6 +481,7 @@ PHB_ITEM hb_hashGetCItemPtr( PHB_ITEM pHash, const char * pszKey ) if( HB_IS_HASH( pHash ) ) { + HB_STACK_TLS_PRELOAD /* we will not make any copy of pKey (autoadd is disabled) so it's * safe to use hb_itemPutCConst() */