From b8bd30f54242798ef91bb796a96a6b5244cc17e7 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 13 Feb 2009 09:53:13 +0000 Subject: [PATCH] 2009-02-13 10:51 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * include/hbdefs.h * contrib/gtwvg/gtwvg.h * contrib/gtwvg/wvggui.h * contrib/examples/terminal/trm_client.prg + Added HB_EXTERN_START/END. * include/hbdefs.h + Added some comments from the original mail from Przemek. --- harbour/ChangeLog | 69 +++++++++++-------- .../contrib/examples/terminal/trm_client.prg | 5 +- harbour/contrib/gtwvg/gtwvg.h | 4 ++ harbour/contrib/gtwvg/wvggui.h | 5 ++ harbour/include/hbdefs.h | 16 +++++ 5 files changed, 68 insertions(+), 31 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 3a619cef1b..3319984747 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,16 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-02-13 10:51 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * include/hbdefs.h + * contrib/gtwvg/gtwvg.h + * contrib/gtwvg/wvggui.h + * contrib/examples/terminal/trm_client.prg + + Added HB_EXTERN_START/END. + + * include/hbdefs.h + + Added some comments from the original mail from Przemek. + 2009-02-13 00:29 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/gtwvg/wvgcore.c ! Fixed hb_wvt_Get|SetStringAttrib()s to respect return errcode. @@ -23,13 +33,13 @@ Welcome in the world of Harbour Terminal Protocol ================================================= - + Harbour Terminal Protocol is build on three components: - + 1) Terminal Server 2) Terminal Client 3) The Harbour Application - + Terminal Server =============== Source => trm_server.prg @@ -37,12 +47,12 @@ Run => trm_server.exe 2011 Parameter => MT ( Multi Threaded ) - + Terminal Server will reside on the same machine or network ( as of now ) where Harbour Application resides. Harbour Application must be able to be run by ShellExecute() WINAPI function issued by the Terminal Server. - - + + Terminal Client =============== Source => trm_client.prg @@ -53,22 +63,22 @@ [Parameters - Norammly Supplied to Appln - Separated by SPACE ] [InitDirectory - Harbour Application's Startup Folder ] Mode => ST ( Single Threaded ) - + Terminal Client can be distributed anywhere there is ACCESS TO designated TCP/IP port, be it a network clinet or any computer having internet avalable. Parameters supplied TO Harbour Client can be on command line or as an .ini file. .Ini file may contain these entries: - + ServerIP = 127.0.0.1 | vouch.dynalias.com ServerPort = 2011 Application = c:\harbour\contrib\examples\terminal\trm_appn.exe Parameters = any number of parameters separated by a space InitDirectory = Complete Folder path from where Harbour Appln will be invoked. - + IF parameters are supplied as .ini file, then .ini filename ( without path ) will be the only parameter - note - only one parameter passed on the command line. - - + + Harbour Application =================== Source(s) => trm_appn.prg | Your program sources + @@ -77,49 +87,49 @@ Link => GTWVG Run => No Mode => ST ( Single Thread ) - + Main() FUNCTION in Harbour Application will have TO be modified TO accept one additional parameter at the END of the usual parameters your application is accepting as ususal. And make sure that you send the same number of parameter either on the command line or through .ini file. parameter is supplied by Harbour Terminal Server. - + At just start of the Harbour Application, immediately after variable definitions in main() add these lines: - + FUNCTION Main( [p1] [, p2] [, p3], cServerInfo ) LOCAL x, y - + // Required it initialize the GTWVG window SetColor( 'N/W,W/B,W+/N' ) CLS ? ' ' - + #ifdef __REMOTE__ // cServerInfo will be supplied by the Remote Server // RmtSvrSetInfo( cServerInfo ) - + IF ( nServerPort := RmtSvrSetInfo( 1 ) ) <> NIL .and. nServerPort > 0 IF !RmtSvrInitialize( NTRIM( nServerPort ), 60/*nTimeoutClient*/, 0.5 /*nTimeRefresh*/ ) Quit ENDIF ENDIF #endif - + ... ... - + RETURN - - + + Must remember to issue - ANNOUNCE HB_NOSTARTUPWINDOW - somewhere in your sources Please note that we do not want to show up the Harbour console on the server so HB_NOSTARTUPWINDOW symbol must be defined. - + And this is the only requirement for your appln to be NET ready. - - + + Technical Overview ================== Client connects to Server. @@ -136,22 +146,21 @@ Client responds TO received buffer according TO instruction it contains. Client retrieves buffer per command basis. Events are not serialized. - - + + The Bottom Line =============== The protocol above works as expected but is not as sophisticated as it should be. GTNET as Przemek has been talking about will be the perfect solution though this can be the basis FOR future enhancements. A lot can be improved, i.e., remote printing, etc., which I hope you Gurus can implement in no times. - + It is my humble contribution TO the Harbour world. - - + + Regards Pritpal Bedi a student of software analysis & design - 2009-02-13 09:25 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * contrib/rddads/rddads.h diff --git a/harbour/contrib/examples/terminal/trm_client.prg b/harbour/contrib/examples/terminal/trm_client.prg index 8db9f5527e..b89ff84b07 100644 --- a/harbour/contrib/examples/terminal/trm_client.prg +++ b/harbour/contrib/examples/terminal/trm_client.prg @@ -108,9 +108,13 @@ static aDat := { {'',''} } #include "hbapi.h" #include "hbapigt.h" +HB_EXTERN_BEGIN + extern void hb_wvt_GetStringAttrib( USHORT top, USHORT left, USHORT bottom, USHORT right, BYTE * sBuffer, BYTE * sAttrib ); extern void hb_wvt_PutStringAttrib( USHORT top, USHORT left, USHORT bottom, USHORT right, BYTE * sBuffer, BYTE * sAttrib ); +HB_EXTERN_END + #include HB_FUNC( OUTPUTDEBUGSTRING ) { @@ -853,4 +857,3 @@ Static Function dbgTraceLog( cString, cFile ) Return lRet //----------------------------------------------------------------------// - diff --git a/harbour/contrib/gtwvg/gtwvg.h b/harbour/contrib/gtwvg/gtwvg.h index aaa45a54ef..fa55950672 100644 --- a/harbour/contrib/gtwvg/gtwvg.h +++ b/harbour/contrib/gtwvg/gtwvg.h @@ -95,6 +95,8 @@ #include "hbgtwvg.ch" +HB_EXTERN_BEGIN + //----------------------------------------------------------------------// #define WVT_CHAR_QUEUE_SIZE 128 @@ -537,4 +539,6 @@ extern void wvt_Rect2ArrayEx( RECT *rc ,PHB_ITEM aRect ); extern void wvt_Point2ArrayEx( POINT *pt , PHB_ITEM aPoint); extern void wvt_Size2ArrayEx( SIZE *siz ,PHB_ITEM aSize ); +HB_EXTERN_END + #endif /* HB_WVT_H_ */ diff --git a/harbour/contrib/gtwvg/wvggui.h b/harbour/contrib/gtwvg/wvggui.h index 1a6036cdb3..57b68eeff8 100644 --- a/harbour/contrib/gtwvg/wvggui.h +++ b/harbour/contrib/gtwvg/wvggui.h @@ -95,6 +95,8 @@ #include "hbgtwvg.ch" +HB_EXTERN_BEGIN + //----------------------------------------------------------------------// #define WVT_CHAR_QUEUE_SIZE 128 @@ -437,4 +439,7 @@ extern void wvt_Rect2ArrayEx( RECT *rc ,PHB_ITEM aRect ); extern void wvt_Point2ArrayEx( POINT *pt , PHB_ITEM aPoint); extern void wvt_Size2ArrayEx( SIZE *siz ,PHB_ITEM aSize ); #endif + +HB_EXTERN_END + #endif /* HB_WVT_H_ */ diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index 02aa959634..5ab43b6a6f 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -447,8 +447,16 @@ /* New Harbour types (Planning stage, don't use these yet) */ +/* + ANSI C types: + void, + [ [un]signed ] char, [ [un]signed ] short, [ [un]signed ] int, + [ [un]signed ] long, double +*/ + /* TODO: Remove dependence on old types */ +/* Harbour overloaded types: */ typedef char hbChar; /* TOFIX */ typedef SCHAR hbSChar; typedef UCHAR hbUChar; @@ -470,6 +478,7 @@ typedef void * hbPtrVal; /* TOFIX */ typedef hbPointer; /* TOFIX */ typedef hbWChar; /* TOFIX */ +/* Harbour strict bit types: */ typedef char hbI8; /* TOFIX */ typedef UCHAR hbU8; /* TOFIX */ typedef INT16 hbI16; @@ -479,6 +488,13 @@ typedef UINT32 hbU32; typedef INT64 hbI64; typedef UINT64 hbI64; +/* Types which depends on internal HVM/compilation settings: */ +/* NOTE: hbMaxVMInt - maximal integer which can be storred in HVM item + (HB_IT_LONG). It's current HB_LONG, usually will be + the same as hbMaxInt unless for some reasons it will + not be reduced, f.e. compiler may support 128bit + integers as hbMaxInt but we may don't use it for + HB_IT_LONG due to performance reduction. */ typedef long hbMaxVMInt; /* TOFIX */ #endif