2009-08-09 00:14 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbwin/win_tprt.prg
  * contrib/hbwin/win_prt.c
    + ::Recv() got a new second parameter to return result code.
    + WIN_PORTFCN() now requires port number to be passed as 1st param.
    + WIN_PORTERROR() now requires port number to be passed as 1st param.
    * Renamed function WIN_PORTFCN() to WIN_PORTFUNCLAST()
    + Fixed last port operation and last error to be stored per port
      rather than in global vars. This makes it possible to use multiple
      ports in parallel.
    - Deleted WIN_PORTBUFFERS() which wasn't MT friendly.
    + WIN_PORTOPEN() function got enabled 6th and 7th inbuffer/outbuffer
      parameters. This replaces WIN_PORTBUFFERS() function.
    + Added WIN_PORTRECV() function which is similar to WIN_PORTREAD()
      but returns the result directly rather than putting it in a var
      passed by reference. It accepts lenght parameter and return result
      code by reference. It's a little bit more effient than WIN_PORTREAD().
    % Some if/else branches swapped to make code a little smoother.

  * contrib/hbwin/olecore.c
    + Attempt to add vars by reference support. Commented until
      there is no test code to try it.
    * Minor formatting.

  * contrib/xhb/hbserv.h
  * contrib/xhb/htmlform.ch
  * contrib/xhb/inet.h
  * contrib/xhb/hblognet.prg
  * contrib/xhb/tfile.prg
  * contrib/xhb/html.ch
  * contrib/xhb/tedit.prg
  * contrib/xhb/tframe.prg
  * contrib/xhb/htjlist.prg
  * contrib/xhb/xdbmodst.prg
  * contrib/xhb/htmlclrs.ch
  * contrib/xhb/thtm.prg
  * contrib/xhb/hterrsys.prg
  * contrib/xhb/tcgi.prg
  * contrib/xhb/regexrpl.prg
  * contrib/xhb/hbserv.ch
  * contrib/xhb/ttable.prg
  * contrib/xhb/hjwindow.prg
  * contrib/xhb/hbserv.c
  * contrib/xhb/htmutil.prg
    * Header formatting.
    ; NOTE: I noticed some xhb components have pure GPL license (recently
            added CGI parts), plus some other use some sort of xhb specific
            modification of original Harbour + exception license. This
            contains some sentence which doesn't seem to make much sense:
            "This exception applies only to the code released with this xHarbour explicit exception."
            FYI.

  * contrib/hbtpathy/telepath.prg
  * utils/hbmk2/hbmk2.prg
    * Minor formatting, comments.
This commit is contained in:
Viktor Szakats
2009-08-08 22:30:49 +00:00
parent 172bd79b2c
commit b6863fd064
26 changed files with 555 additions and 446 deletions

View File

@@ -17,6 +17,62 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-08-09 00:14 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbwin/win_tprt.prg
* contrib/hbwin/win_prt.c
+ ::Recv() got a new second parameter to return result code.
+ WIN_PORTFCN() now requires port number to be passed as 1st param.
+ WIN_PORTERROR() now requires port number to be passed as 1st param.
* Renamed function WIN_PORTFCN() to WIN_PORTFUNCLAST()
+ Fixed last port operation and last error to be stored per port
rather than in global vars. This makes it possible to use multiple
ports in parallel.
- Deleted WIN_PORTBUFFERS() which wasn't MT friendly.
+ WIN_PORTOPEN() function got enabled 6th and 7th inbuffer/outbuffer
parameters. This replaces WIN_PORTBUFFERS() function.
+ Added WIN_PORTRECV() function which is similar to WIN_PORTREAD()
but returns the result directly rather than putting it in a var
passed by reference. It accepts lenght parameter and return result
code by reference. It's a little bit more effient than WIN_PORTREAD().
% Some if/else branches swapped to make code a little smoother.
* contrib/hbwin/olecore.c
+ Attempt to add vars by reference support. Commented until
there is no test code to try it.
* Minor formatting.
* contrib/xhb/hbserv.h
* contrib/xhb/htmlform.ch
* contrib/xhb/inet.h
* contrib/xhb/hblognet.prg
* contrib/xhb/tfile.prg
* contrib/xhb/html.ch
* contrib/xhb/tedit.prg
* contrib/xhb/tframe.prg
* contrib/xhb/htjlist.prg
* contrib/xhb/xdbmodst.prg
* contrib/xhb/htmlclrs.ch
* contrib/xhb/thtm.prg
* contrib/xhb/hterrsys.prg
* contrib/xhb/tcgi.prg
* contrib/xhb/regexrpl.prg
* contrib/xhb/hbserv.ch
* contrib/xhb/ttable.prg
* contrib/xhb/hjwindow.prg
* contrib/xhb/hbserv.c
* contrib/xhb/htmutil.prg
* Header formatting.
; NOTE: I noticed some xhb components have pure GPL license (recently
added CGI parts), plus some other use some sort of xhb specific
modification of original Harbour + exception license. This
contains some sentence which doesn't seem to make much sense:
"This exception applies only to the code released with this xHarbour explicit exception."
FYI.
* contrib/hbtpathy/telepath.prg
* utils/hbmk2/hbmk2.prg
* Minor formatting, comments.
2009-08-08 16:31 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbwin/win_tprt.prg
% Simplified ::read() and ::recv().
@@ -157,7 +213,7 @@
+ contrib/hbtip/smtpcli.prg
- contrib/hbtip/ftpcln.prg
+ contrib/hbtip/ftpcli.prg
* Rename 'cln' postfix to 'cli' which much better resembles
* Renamed 'cln' postfix to 'cli' which much better resembles
to 'client' than old one which rather means 'clean'.
2009-08-07 11:55 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
@@ -268,9 +324,10 @@
2009-08-05 15:12 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbmk2/hbmk2.prg
! Deleted -MTd win/msvc compiler switch in -debug mode to not
! Deleted -MTd win/msvc compiler switch in -debug mode to
leave it to the default settings and give users full control
of this.
of this setting.
; QUESTION: Does debug mode still works in MSVC after above change?
2009-08-05 10:05 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* bin/postinst.sh
@@ -302,7 +359,7 @@
for DOS and OS/2 shells. Also a proper copy cmd is needed
for DOS. Maybe we should simple write these simple utilities
using a public domain license and include the binaries of these.
Couldn't find the source of the OS/2 tools' binary releases.
Couldn't find the source code for the OS/2 tools' binary releases.
* config/mingw32-make.exe
* config/dj-rm.exe
@@ -353,9 +410,9 @@
+ WIN_PORTOPEN() returns -1 if the port number was out of
range, so MAXSERIAL constant could be elminiated.
% INVALID_HANDLE_VALUE constant is in reality an explicit
-1 used by low-level lib layer, so I've elminiated it,
-1 used by low-level lib layer, so I've eliminated it,
and high-level lib layer also uses plain -1 now.
Could be replaces by some macros, but it shouldn't
Could be replaced by some macros, but it shouldn't
use a Windows specific name.
- Deleted FORMATMESSAGE().
* Using WAPI_FORMATMESSAGE() instead of local FORMATMESSAGE().

View File

@@ -162,7 +162,7 @@ FUNCTION tp_reopen( nPort, nInSize, nOutSize )
nBaud := t_aPorts[ nPort, TPFP_BAUD ]
nData := t_aPorts[ nPort, TPFP_DBITS ]
cParity := t_aPorts[ nPort, TPFP_PARITY ]
nStop := t_aPorts[ nPort, TPFP_SBITS ]
nStop := t_aPorts[ nPort, TPFP_SBITS ]
RETURN tp_open( nPort, nInSize, nOutSize, nBaud, nData, cParity, nStop, cPortName )

View File

@@ -448,6 +448,24 @@ static void GetParams( DISPPARAMS * dispparam )
dispparam->cNamedArgs = 0;
}
#ifdef _PUTPARAMS_
static void PutParams( DISPPARAMS * dispparam )
{
UINT uiArg;
for( uiArg = 0; uiArg < dispparam->cArgs; uiArg++ )
{
if( HB_ISBYREF( uiArg + 1 ) )
{
PHB_ITEM pItem = hb_itemNew( NULL );
hb_oleVariantToItem( pItem, & dispparam->rgvarg[ uiArg ] );
hb_itemParamStoreForward( ( USHORT ) uiArg + 1, pItem );
}
}
}
#endif
static void FreeParams( DISPPARAMS * dispparam )
{
@@ -529,18 +547,18 @@ HB_FUNC( __OLEGETACTIVEOBJECT ) /* ( cOleName | cCLSID [, cIID ] ) */
if( cOleName )
{
wCLSID = (BSTR) AnsiToWide( (LPSTR) cOleName );
wCLSID = ( BSTR ) AnsiToWide( ( LPSTR ) cOleName );
if( cOleName[ 0 ] == '{' )
lOleError = CLSIDFromString( wCLSID, (LPCLSID) &ClassID );
lOleError = CLSIDFromString( wCLSID, ( LPCLSID ) &ClassID );
else
lOleError = CLSIDFromProgID( wCLSID, (LPCLSID) &ClassID );
lOleError = CLSIDFromProgID( wCLSID, ( LPCLSID ) &ClassID );
hb_xfree( wCLSID );
if( cID )
{
if( cID[ 0 ] == '{' )
{
wCLSID = (BSTR) AnsiToWide( (LPSTR) cID );
wCLSID = ( BSTR ) AnsiToWide( ( LPSTR ) cID );
lOleError = CLSIDFromString( wCLSID, &iid );
hb_xfree( wCLSID );
}
@@ -773,9 +791,13 @@ HB_FUNC( WIN_OLEAUTO___ONERROR )
GetParams( &dispparam );
lOleError = HB_VTBL( pDisp )->Invoke( HB_THIS_( pDisp ) dispid, HB_ID_REF( IID_NULL ),
LOCALE_USER_DEFAULT,
DISPATCH_PROPERTYGET | DISPATCH_METHOD,
&dispparam, &variant, &excep, &uiArgErr );
LOCALE_USER_DEFAULT,
DISPATCH_PROPERTYGET | DISPATCH_METHOD,
&dispparam, &variant, &excep, &uiArgErr );
#ifdef _PUTPARAMS_
PutParams( &dispparam );
#endif
FreeParams( &dispparam );
hb_oleVariantToItem( hb_stackReturnItem(), &variant );

View File

@@ -61,40 +61,42 @@ static struct
{
HANDLE Port;
LPCTSTR Name;
int iFunction;
DWORD dwError;
} s_PortData[] =
{
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM1" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM2" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM3" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM4" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM5" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM6" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM7" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM8" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM9" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM10" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM11" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM12" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM13" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM14" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM15" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM16" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM17" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM18" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM19" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM20" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM21" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM22" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM23" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM24" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM25" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM26" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM27" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM28" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM29" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM30" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM31" ) },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM32" ) }
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM1" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM2" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM3" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM4" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM5" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM6" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM7" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM8" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM9" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM10" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM11" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM12" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM13" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM14" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM15" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM16" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM17" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM18" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM19" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM20" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM21" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM22" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM23" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM24" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM25" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM26" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM27" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM28" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM29" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM30" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM31" ), 0, 0 },
{ INVALID_HANDLE_VALUE, TEXT( "\\\\.\\COM32" ), 0, 0 }
};
static struct
@@ -103,23 +105,14 @@ static struct
COMMTIMEOUTS OldTimeouts;
} s_PortData2[ 32 ];
static int s_iWinFcn = 0;
static DWORD s_dwWinError = 0;
static int s_iReadIntervalTimeout = -1; /* -1 says use default calculation */
static int s_iReadTotalTimeoutMultiplier = -1;
static int s_iReadTotalTimeoutConstant = -1;
static int s_iWriteTotalTimeoutMultiplier = -1;
static int s_iWriteTotalTimeoutConstant = -1;
static int s_iInQueue = -1;
static int s_iOutQueue = -1;
HB_FUNC( WIN_PORTOPEN )
{
int Port = hb_parni( 1 );
int iPort = hb_parni( 1 );
if( iPort >= 0 && iPort < ( int ) HB_SIZEOFARRAY( s_PortData ) )
@@ -128,15 +121,13 @@ HB_FUNC( WIN_PORTOPEN )
int iParity = hb_parni( 3 );
int iByteSize = hb_parni( 4 );
int iStopBits = hb_parni( 5 );
/*LONG s_iInQueue = hb_parnl( 6 ); */
/*LONG s_iOutQueue = hb_parnl( 7 ); */
HANDLE hCommPort;
COMMTIMEOUTS NewTimeouts;
DCB NewDCB;
s_iWinFcn = FCNCREATEFILE;
s_dwWinError = 0;
s_PortData[ iPort ].iFunction = FCNCREATEFILE;
s_PortData[ iPort ].dwError = 0;
if( ( hCommPort = CreateFile( s_PortData[ iPort ].Name,
GENERIC_READ | GENERIC_WRITE,
0,
@@ -144,19 +135,19 @@ HB_FUNC( WIN_PORTOPEN )
OPEN_EXISTING,
FILE_FLAG_NO_BUFFERING, 0 ) ) == INVALID_HANDLE_VALUE )
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
hb_retnl( -1 );
return;
}
s_iWinFcn = FCNGETCOMMSTATE;
s_dwWinError = 0;
s_PortData[ iPort ].iFunction = FCNGETCOMMSTATE;
s_PortData[ iPort ].dwError = 0;
/* We'll put everything back */
s_PortData2[ Port ].OldDCB.DCBlength = sizeof( DCB );
if( ! GetCommState( hCommPort, &( s_PortData2[ Port ].OldDCB ) ) )
s_PortData2[ iPort ].OldDCB.DCBlength = sizeof( DCB );
if( ! GetCommState( hCommPort, &( s_PortData2[ iPort ].OldDCB ) ) )
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
CloseHandle( hCommPort );
hb_retnl( -1 );
return;
@@ -165,7 +156,7 @@ HB_FUNC( WIN_PORTOPEN )
NewDCB.DCBlength = sizeof( DCB );
if( ! GetCommState( hCommPort, &NewDCB ) )
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
CloseHandle( hCommPort );
hb_retnl( -1 );
return;
@@ -198,24 +189,27 @@ HB_FUNC( WIN_PORTOPEN )
/*NewDCB.EvtChar*/
/* function reinitializes all hardware and control settings, but it does not empty output or input queues */
s_iWinFcn = FCNSETCOMMSTATE;
s_dwWinError = 0;
s_PortData[ iPort ].iFunction = FCNSETCOMMSTATE;
s_PortData[ iPort ].dwError = 0;
if( ! SetCommState( hCommPort, &NewDCB ) )
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
CloseHandle( hCommPort );
hb_retnl( -1 );
return;
}
/* We'll leave this to Windows, unless you really want it changed! */
if( s_iInQueue != -1 )
if( HB_ISNUM( 6 ) &&
HB_ISNUM( 7 ) )
{
s_iWinFcn = FCNSETUPCOMM;
s_dwWinError = 0;
if( ! SetupComm( hCommPort, s_iInQueue, s_iOutQueue ) )
s_PortData[ iPort ].iFunction = FCNSETUPCOMM;
s_PortData[ iPort ].dwError = 0;
if( ! SetupComm( hCommPort,
( DWORD ) hb_parnl( 6 ) /* dwInQueue */,
( DWORD ) hb_parnl( 7 ) /* dwOutQueue */ ) )
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
CloseHandle( hCommPort );
hb_retnl( -1 );
return;
@@ -223,11 +217,11 @@ HB_FUNC( WIN_PORTOPEN )
}
/* We'll put everything back */
s_iWinFcn = FCNGETCOMMTIMEOUTS;
s_dwWinError = 0;
if( ! GetCommTimeouts( hCommPort, &( s_PortData2[ Port ].OldTimeouts ) ) )
s_PortData[ iPort ].iFunction = FCNGETCOMMTIMEOUTS;
s_PortData[ iPort ].dwError = 0;
if( ! GetCommTimeouts( hCommPort, &( s_PortData2[ iPort ].OldTimeouts ) ) )
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
CloseHandle( hCommPort );
hb_retnl( -1 );
return;
@@ -279,22 +273,22 @@ HB_FUNC( WIN_PORTOPEN )
and if flow control is enabled the program will "hang" or if it is not enabled the data will
be lost (potentially), so we set a minimum of 1ms (baud rates higher than 4800) */
s_iWinFcn = FCNSETCOMMTIMEOUTS;
s_dwWinError = 0;
s_PortData[ iPort ].iFunction = FCNSETCOMMTIMEOUTS;
s_PortData[ iPort ].dwError = 0;
if( ! SetCommTimeouts( hCommPort, &NewTimeouts ) )
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
CloseHandle( hCommPort );
hb_retnl( -1 );
}
else
{
s_PortData[ Port ].Port = hCommPort;
s_PortData[ iPort ].Port = hCommPort;
hb_retnl( hCommPort == INVALID_HANDLE_VALUE ? -1 : 0 );
}
}
else
hb_retnl( -1 );
hb_retnl( -2 );
}
HB_FUNC( WIN_PORTCLOSE )
@@ -306,21 +300,21 @@ HB_FUNC( WIN_PORTCLOSE )
HANDLE hCommPort = s_PortData[ iPort ].Port;
long lDrain = hb_parnl( 2 );
s_iWinFcn = FCNSETCOMMSTATE;
s_dwWinError = 0;
s_PortData[ iPort ].iFunction = FCNSETCOMMSTATE;
s_PortData[ iPort ].dwError = 0;
if( ! SetCommState( hCommPort, &( s_PortData2[ iPort ].OldDCB ) ) )
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
CloseHandle( hCommPort );
hb_retl( FALSE );
return;
}
s_iWinFcn = FCNSETCOMMTIMEOUTS;
s_dwWinError = 0;
s_PortData[ iPort ].iFunction = FCNSETCOMMTIMEOUTS;
s_PortData[ iPort ].dwError = 0;
if( ! SetCommTimeouts( hCommPort, &( s_PortData2[ iPort ].OldTimeouts ) ) )
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
CloseHandle( hCommPort );
hb_retl( FALSE );
return;
@@ -328,15 +322,15 @@ HB_FUNC( WIN_PORTCLOSE )
s_PortData[ iPort ].Port = INVALID_HANDLE_VALUE;
s_iWinFcn = FCNCLOSEHANDLE;
s_dwWinError = 0;
s_PortData[ iPort ].iFunction = FCNCLOSEHANDLE;
s_PortData[ iPort ].dwError = 0;
/* I honestly don't know if this helps */
if( lDrain > 0 )
Sleep( lDrain * 1000 );
hb_retl( CloseHandle( hCommPort ) != 0 );
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
}
else
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
@@ -353,15 +347,15 @@ HB_FUNC( WIN_PORTWRITE )
DWORD dwNumberofBytesToWrite = ( DWORD ) hb_parclen( 2 );
DWORD dwNumberofBytesWritten;
s_iWinFcn = FCNWRITEFILE;
s_dwWinError = 0;
if( ! WriteFile( hCommPort, lpBuffer, dwNumberofBytesToWrite, &dwNumberofBytesWritten, NULL ) )
s_PortData[ iPort ].iFunction = FCNWRITEFILE;
s_PortData[ iPort ].dwError = 0;
if( WriteFile( hCommPort, lpBuffer, dwNumberofBytesToWrite, &dwNumberofBytesWritten, NULL ) )
hb_retnl( dwNumberofBytesWritten );
else
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
hb_retnl( -1 );
}
else
hb_retnl( dwNumberofBytesWritten );
}
else
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
@@ -379,21 +373,52 @@ HB_FUNC( WIN_PORTREAD )
DWORD dwNumberOfBytesRead;
lpBuffer = ( char * ) hb_xgrab( dwNumberOfBytesToRead + 1 );
s_iWinFcn = FCNREADFILE;
s_dwWinError = 0;
if( ! ReadFile( hCommPort, lpBuffer, dwNumberOfBytesToRead, &dwNumberOfBytesRead, NULL ) )
{
hb_storc( NULL, 2 );
hb_xfree( lpBuffer );
s_dwWinError = GetLastError();
hb_retnl( -1 );
}
else
s_PortData[ iPort ].iFunction = FCNREADFILE;
s_PortData[ iPort ].dwError = 0;
if( ReadFile( hCommPort, lpBuffer, dwNumberOfBytesToRead, &dwNumberOfBytesRead, NULL ) )
{
if( ! hb_storclen_buffer( lpBuffer, dwNumberOfBytesRead, 2 ) )
hb_xfree( lpBuffer );
hb_retnl( dwNumberOfBytesRead );
}
else
{
hb_storc( NULL, 2 );
hb_xfree( lpBuffer );
s_PortData[ iPort ].dwError = GetLastError();
hb_retnl( -1 );
}
}
else
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
HB_FUNC( WIN_PORTRECV )
{
int iPort = hb_parni( 1 );
if( iPort >= 0 && iPort < ( int ) HB_SIZEOFARRAY( s_PortData ) )
{
HANDLE hCommPort = s_PortData[ iPort ].Port;
char * lpBuffer;
DWORD dwNumberOfBytesToRead = ( DWORD ) hb_parnl( 2 );
DWORD dwNumberOfBytesRead;
lpBuffer = ( char * ) hb_xgrab( dwNumberOfBytesToRead + 1 );
s_PortData[ iPort ].iFunction = FCNREADFILE;
s_PortData[ iPort ].dwError = 0;
if( ReadFile( hCommPort, lpBuffer, dwNumberOfBytesToRead, &dwNumberOfBytesRead, NULL ) )
{
hb_retclen_buffer( lpBuffer, dwNumberOfBytesRead );
hb_stornl( dwNumberOfBytesRead, 3 );
}
else
{
hb_retc_null();
hb_xfree( lpBuffer );
s_PortData[ iPort ].dwError = GetLastError();
hb_stornl( -1, 3 );
}
}
else
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
@@ -408,20 +433,9 @@ HB_FUNC( WIN_PORTSTATUS )
HANDLE hCommPort = s_PortData[ iPort ].Port;
DWORD dwModemStat;
s_iWinFcn = FCNGETCOMMMODEMSTATUS;
s_dwWinError = 0;
if( ! GetCommModemStatus( hCommPort, &dwModemStat ) )
{
s_dwWinError = GetLastError();
hb_storl( FALSE, 2 );
hb_storl( FALSE, 3 );
hb_storl( FALSE, 4 );
hb_storl( FALSE, 5 );
hb_retl( FALSE );
}
else
s_PortData[ iPort ].iFunction = FCNGETCOMMMODEMSTATUS;
s_PortData[ iPort ].dwError = 0;
if( GetCommModemStatus( hCommPort, &dwModemStat ) )
{
hb_storl( ( dwModemStat & MS_CTS_ON ) != 0, 2 ); /* The CTS (clear-to-send) signal is on. */
hb_storl( ( dwModemStat & MS_DSR_ON ) != 0, 3 ); /* The DSR (data-set-ready) signal is on. */
@@ -430,6 +444,17 @@ HB_FUNC( WIN_PORTSTATUS )
hb_retl( TRUE );
}
else
{
s_PortData[ iPort ].dwError = GetLastError();
hb_storl( FALSE, 2 );
hb_storl( FALSE, 3 );
hb_storl( FALSE, 4 );
hb_storl( FALSE, 5 );
hb_retl( FALSE );
}
}
else
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
@@ -445,15 +470,15 @@ HB_FUNC( WIN_PORTPURGE )
DWORD dwFlags;
dwFlags = ( hb_parl( 2 ) ? PURGE_RXCLEAR : 0 ) | ( hb_parl( 3 ) ? PURGE_TXCLEAR : 0 );
s_iWinFcn = FCNPURGECOMM;
s_dwWinError = 0;
if( ! PurgeComm( hCommPort, dwFlags ) )
s_PortData[ iPort ].iFunction = FCNPURGECOMM;
s_PortData[ iPort ].dwError = 0;
if( PurgeComm( hCommPort, dwFlags ) )
hb_retl( TRUE );
else
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
hb_retl( FALSE );
}
else
hb_retl( TRUE );
}
else
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
@@ -469,23 +494,9 @@ HB_FUNC( WIN_PORTQUEUESTATUS )
DWORD dwErrors;
COMSTAT ComStat;
s_iWinFcn = FCNCLEARCOMMERROR;
s_dwWinError = 0;
if( ! ClearCommError( hCommPort, &dwErrors, &ComStat ) )
{
s_dwWinError = GetLastError();
hb_storl( FALSE, 2 );
hb_storl( FALSE, 3 );
hb_storl( FALSE, 4 );
hb_storl( FALSE, 5 );
hb_storl( FALSE, 6 );
hb_stornl( 0, 7 );
hb_stornl( 0, 8 );
hb_retl( FALSE );
}
else
s_PortData[ iPort ].iFunction = FCNCLEARCOMMERROR;
s_PortData[ iPort ].dwError = 0;
if( ClearCommError( hCommPort, &dwErrors, &ComStat ) )
{
hb_storl( ComStat.fCtsHold, 2 );
hb_storl( ComStat.fDsrHold, 3 );
@@ -497,6 +508,20 @@ HB_FUNC( WIN_PORTQUEUESTATUS )
hb_retl( TRUE );
}
else
{
s_PortData[ iPort ].dwError = GetLastError();
hb_storl( FALSE, 2 );
hb_storl( FALSE, 3 );
hb_storl( FALSE, 4 );
hb_storl( FALSE, 5 );
hb_storl( FALSE, 6 );
hb_stornl( 0, 7 );
hb_stornl( 0, 8 );
hb_retl( FALSE );
}
}
else
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
@@ -514,15 +539,15 @@ HB_FUNC( WIN_PORTSETRTS )
HANDLE hCommPort = s_PortData[ iPort ].Port;
DWORD dwFunc = hb_parl( 2 ) ? SETRTS : CLRRTS;
s_iWinFcn = ESCAPECOMMFUNCTION;
s_dwWinError = 0;
if( ! EscapeCommFunction( hCommPort, dwFunc ) )
s_PortData[ iPort ].iFunction = ESCAPECOMMFUNCTION;
s_PortData[ iPort ].dwError = 0;
if( EscapeCommFunction( hCommPort, dwFunc ) )
hb_retl( TRUE );
else
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
hb_retl( FALSE );
}
else
hb_retl( TRUE );
}
else
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
@@ -540,15 +565,15 @@ HB_FUNC( WIN_PORTSETDTR )
HANDLE hCommPort = s_PortData[ iPort ].Port;
DWORD dwFunc = hb_parl( 2 ) ? SETDTR : CLRDTR;
s_iWinFcn = ESCAPECOMMFUNCTION;
s_dwWinError = 0;
if( ! EscapeCommFunction( hCommPort, dwFunc ) )
s_PortData[ iPort ].iFunction = ESCAPECOMMFUNCTION;
s_PortData[ iPort ].dwError = 0;
if( EscapeCommFunction( hCommPort, dwFunc ) )
hb_retl( TRUE );
else
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
hb_retl( FALSE );
}
else
hb_retl( TRUE );
}
else
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
@@ -564,12 +589,12 @@ HB_FUNC( WIN_PORTRTSFLOW )
DCB CurDCB;
int iRtsControl = hb_parni( 2 );
s_iWinFcn = FCNGETCOMMSTATE;
s_dwWinError = 0;
s_PortData[ iPort ].iFunction = FCNGETCOMMSTATE;
s_PortData[ iPort ].dwError = 0;
CurDCB.DCBlength = sizeof( DCB );
if( ! GetCommState( hCommPort, &CurDCB ) )
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
hb_retl( FALSE );
return;
}
@@ -595,11 +620,11 @@ HB_FUNC( WIN_PORTRTSFLOW )
return;
}
s_iWinFcn = FCNSETCOMMSTATE;
s_dwWinError = 0;
s_PortData[ iPort ].iFunction = FCNSETCOMMSTATE;
s_PortData[ iPort ].dwError = 0;
if( ! SetCommState( hCommPort, &CurDCB ) )
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
hb_retl( FALSE );
}
else
@@ -619,12 +644,12 @@ HB_FUNC( WIN_PORTDTRFLOW )
DCB CurDCB;
int DtrControl = hb_parni( 2 );
s_iWinFcn = FCNGETCOMMSTATE;
s_dwWinError = 0;
s_PortData[ iPort ].iFunction = FCNGETCOMMSTATE;
s_PortData[ iPort ].dwError = 0;
CurDCB.DCBlength = sizeof( DCB );
if( ! GetCommState( hCommPort, &CurDCB ) )
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
hb_retl( FALSE );
return;
}
@@ -650,11 +675,11 @@ HB_FUNC( WIN_PORTDTRFLOW )
return;
}
s_iWinFcn = FCNSETCOMMSTATE;
s_dwWinError = 0;
s_PortData[ iPort ].iFunction = FCNSETCOMMSTATE;
s_PortData[ iPort ].dwError = 0;
if( ! SetCommState( hCommPort, &CurDCB ) )
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
hb_retl( FALSE );
}
else
@@ -673,12 +698,12 @@ HB_FUNC( WIN_PORTXONXOFFFLOW )
HANDLE hCommPort = s_PortData[ iPort ].Port;
DCB CurDCB;
s_iWinFcn = FCNGETCOMMSTATE;
s_dwWinError = 0;
s_PortData[ iPort ].iFunction = FCNGETCOMMSTATE;
s_PortData[ iPort ].dwError = 0;
CurDCB.DCBlength = sizeof( DCB );
if( ! GetCommState( hCommPort, &CurDCB ) )
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
hb_retl( FALSE );
return;
}
@@ -694,11 +719,11 @@ HB_FUNC( WIN_PORTXONXOFFFLOW )
CurDCB.fOutX = 0;
}
s_iWinFcn = FCNSETCOMMSTATE;
s_dwWinError = 0;
s_PortData[ iPort ].iFunction = FCNSETCOMMSTATE;
s_PortData[ iPort ].dwError = 0;
if( ! SetCommState( hCommPort, &CurDCB ) )
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
hb_retl( FALSE );
}
else
@@ -760,23 +785,27 @@ HB_FUNC( WIN_PORTTIMEOUTS )
s_iWriteTotalTimeoutConstant = -1;
}
/* You must set both! */
HB_FUNC( WIN_PORTBUFFERS )
{
s_iInQueue = hb_parni( 1 );
s_iOutQueue = hb_parni( 2 );
}
HB_FUNC( WIN_PORTERROR )
{
hb_retnl( s_dwWinError );
s_dwWinError = 0; /* NOTE: reset */
int iPort = hb_parni( 1 );
if( iPort >= 0 && iPort < ( int ) HB_SIZEOFARRAY( s_PortData ) )
{
hb_retnl( s_PortData[ iPort ].dwError );
s_PortData[ iPort ].dwError = 0; /* NOTE: reset */
}
else
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
HB_FUNC( WIN_PORTFCN )
HB_FUNC( WIN_PORTFUNCLAST )
{
hb_retni( s_iWinFcn );
int iPort = hb_parni( 1 );
if( iPort >= 0 && iPort < ( int ) HB_SIZEOFARRAY( s_PortData ) )
hb_retni( s_PortData[ iPort ].iFunction );
else
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
HB_FUNC( WIN_PORTDEBUGDCB )
@@ -793,8 +822,8 @@ HB_FUNC( WIN_PORTDEBUGDCB )
char szDebugString[ 1024 ] = "";
char buffer[ 80 ];
s_iWinFcn = FCNGETCOMMSTATE;
s_dwWinError = 0;
s_PortData[ iPort ].iFunction = FCNGETCOMMSTATE;
s_PortData[ iPort ].dwError = 0;
CurDCB.DCBlength = sizeof( DCB );
if( GetCommState( hCommPort, &CurDCB ) )
{
@@ -853,15 +882,15 @@ HB_FUNC( WIN_PORTDEBUGDCB )
}
else
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
hb_retc_null();
return;
}
if( iDebugLevel & WPDBGTIMEOUTS )
{
s_iWinFcn = FCNGETCOMMTIMEOUTS;
s_dwWinError = 0;
s_PortData[ iPort ].iFunction = FCNGETCOMMTIMEOUTS;
s_PortData[ iPort ].dwError = 0;
if( GetCommTimeouts( hCommPort, &CurCOMMTIMEOUTS ) )
{
hb_snprintf( buffer, sizeof( buffer ), "ReadIntervalTimeout : %lu\n" , CurCOMMTIMEOUTS.ReadIntervalTimeout ) ; hb_strncat( szDebugString, buffer, sizeof( szDebugString ) - 1 );
@@ -872,7 +901,7 @@ HB_FUNC( WIN_PORTDEBUGDCB )
}
else
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
hb_retc_null();
return;
}
@@ -880,8 +909,8 @@ HB_FUNC( WIN_PORTDEBUGDCB )
if( iDebugLevel & WPDBGQUEUE )
{
s_iWinFcn = FCNGETCOMMPROPERTIES;
s_dwWinError = 0;
s_PortData[ iPort ].iFunction = FCNGETCOMMPROPERTIES;
s_PortData[ iPort ].dwError = 0;
if( GetCommProperties( hCommPort, &CurCOMMPROP ) )
{
hb_snprintf( buffer, sizeof( buffer ), "dwCurrentTxQueue : %lu\n", CurCOMMPROP.dwCurrentTxQueue ) ; hb_strncat( szDebugString, buffer, sizeof( szDebugString ) - 1 );
@@ -889,7 +918,7 @@ HB_FUNC( WIN_PORTDEBUGDCB )
}
else
{
s_dwWinError = GetLastError();
s_PortData[ iPort ].dwError = GetLastError();
hb_retc_null();
return;
}

View File

@@ -67,7 +67,7 @@
//
// Really Windows comms should be done with threads and/or OVERLAPPED I/O - and I haven't.
CREATE CLASS Win_Port
CREATE CLASS win_Port
ACCESS Open() INLINE ::lOpen /* if this is not true something didn't work! */
ACCESS PortName() INLINE ::cPortName
@@ -78,58 +78,50 @@ CREATE CLASS Win_Port
METHOD Init( cPortName, nBaudRate, nParity, nByteSize, nStopBits )
METHOD Read( cString, nLength )
METHOD Recv( nLength )
METHOD Recv( nLength, nResult ) INLINE win_PortRecv( ::nPort, nLength, @nResult )
METHOD RecvTo( cDelim, nMaxlen )
METHOD Write( cString ) INLINE Win_PortWrite( ::nPort, cString )
METHOD Status( lCTS, lDSR, lRing, lDCD ) INLINE Win_PortStatus( ::nPort, @lCTS, @lDSR, @lRing, @lDCD )
METHOD Write( cString ) INLINE win_PortWrite( ::nPort, cString )
METHOD Status( lCTS, lDSR, lRing, lDCD ) INLINE win_PortStatus( ::nPort, @lCTS, @lDSR, @lRing, @lDCD )
METHOD QueueStatus( lCTSHold, lDSRHold, lDCDHold, lXoffHold, lXoffSent, nInQueue, nOutQueue ) ;
INLINE Win_PortQueueStatus( ::nPort, @lCTSHold, @lDSRHold, @lDCDHold, @lXoffHold, @lXoffSent, @nInQueue, @nOutQueue )
INLINE win_PortQueueStatus( ::nPort, @lCTSHold, @lDSRHold, @lDCDHold, @lXoffHold, @lXoffSent, @nInQueue, @nOutQueue )
METHOD SetRTS( lCTS ) INLINE Win_PortSetRTS( ::nPort, lCTS ) /* boolean return is the status of the call not the line! */
METHOD SetDTR( lDTR ) INLINE Win_PortSetDTR( ::nPort, lDTR ) /* boolean return is the status of the call not the line! */
METHOD RTSFlow( nRTS ) INLINE Win_PortRTSFlow( ::nPort, nRTS )
METHOD DTRFlow( nDTR ) INLINE Win_PortDTRFlow( ::nPort, nDTR )
METHOD XonXoffFlow( lXonXoff ) INLINE Win_PortXonXoffFlow( ::nPort, lXonXoff )
METHOD Purge( lRXBuffer, lTXBuffer ) INLINE Win_PortPurge( ::nPort, lRXBuffer, lTXBuffer )
METHOD PurgeRX() INLINE Win_PortPurge( ::nPort, .T., .F. )
METHOD PurgeTX() INLINE Win_PortPurge( ::nPort, .F., .T. )
METHOD Close( nDrain ) INLINE Win_PortClose( ::nPort, iif( Empty( nDrain ), 0, nDrain ) )
METHOD DebugDCB( nDebug ) INLINE Win_PortDebugDCB(::nPort, nDebug )
METHOD SetRTS( lCTS ) INLINE win_PortSetRTS( ::nPort, lCTS ) /* boolean return is the status of the call not the line! */
METHOD SetDTR( lDTR ) INLINE win_PortSetDTR( ::nPort, lDTR ) /* boolean return is the status of the call not the line! */
METHOD RTSFlow( nRTS ) INLINE win_PortRTSFlow( ::nPort, nRTS )
METHOD DTRFlow( nDTR ) INLINE win_PortDTRFlow( ::nPort, nDTR )
METHOD XonXoffFlow( lXonXoff ) INLINE win_PortXonXoffFlow( ::nPort, lXonXoff )
METHOD Purge( lRXBuffer, lTXBuffer ) INLINE win_PortPurge( ::nPort, lRXBuffer, lTXBuffer )
METHOD PurgeRX() INLINE win_PortPurge( ::nPort, .T., .F. )
METHOD PurgeTX() INLINE win_PortPurge( ::nPort, .F., .T. )
METHOD Close( nDrain ) INLINE win_PortClose( ::nPort, iif( Empty( nDrain ), 0, nDrain ) )
METHOD DebugDCB( nDebug ) INLINE win_PortDebugDCB(::nPort, nDebug )
METHOD TimeOuts( nReadInterval, nReadMultiplier, nReadConstant, nWriteMultiplier, nWriteConstant ) ;
INLINE Win_PortTimeOuts( nReadInterval, nReadMultiplier, nReadConstant, nWriteMultiplier, nWriteConstant )
METHOD Buffers( nInQueue, nOutQueue ) INLINE Win_PortBuffers( nInQueue, nOutQueue )
INLINE win_PortTimeOuts( nReadInterval, nReadMultiplier, nReadConstant, nWriteMultiplier, nWriteConstant )
METHOD Buffers( nInQueue, nOutQueue ) INLINE win_PortBuffers( nInQueue, nOutQueue )
METHOD Error()
ENDCLASS
METHOD Init( cPortName, nBaudRate, nParity, nByteSize, nStopBits ) CLASS Win_Port
METHOD Init( cPortName, nBaudRate, nParity, nByteSize, nStopBits ) CLASS win_Port
::cPortName := Upper( cPortName )
IF Left( ::cPortName, 3 ) == "COM"
::nPort := Val( SubStr( ::cPortName, 4 ) ) - 1
IF Win_PortOpen( ::nPort, nBaudRate, nParity, nByteSize, nStopBits ) != -1
IF win_PortOpen( ::nPort, nBaudRate, nParity, nByteSize, nStopBits ) != -1
::lOpen := .T.
ENDIF
ENDIF
RETURN self
METHOD Read( /* @ */ cString, nLength ) CLASS Win_Port
METHOD Read( /* @ */ cString, nLength ) CLASS win_Port
cString := Space( nlength )
RETURN Win_PortRead( ::nPort, @cString )
RETURN win_PortRead( ::nPort, @cString )
METHOD Recv( nLength ) CLASS Win_Port
LOCAL cString := Space( nlength )
Win_PortRead( ::nPort, @cString )
RETURN cString
METHOD RecvTo( cDelim, nMaxlen ) CLASS Win_Port
METHOD RecvTo( cDelim, nMaxlen ) CLASS win_Port
LOCAL nResult
LOCAL cRecv := ""
@@ -137,7 +129,7 @@ METHOD RecvTo( cDelim, nMaxlen ) CLASS Win_Port
DO WHILE .T.
cString := Space( 1 )
IF ( nResult := Win_PortRead( ::nPort, @cString ) ) != -1
IF ( nResult := win_PortRead( ::nPort, @cString ) ) != -1
IF nResult == 0
EXIT
ELSE
@@ -156,11 +148,11 @@ METHOD RecvTo( cDelim, nMaxlen ) CLASS Win_Port
RETURN cRecv
/* Since the Win_Port functions are an amalgamation of Win functions this allows
/* Since the win_Port functions are an amalgamation of Win functions this allows
you to see what call did the deed when things go wrong. */
METHOD Error() CLASS Win_Port
LOCAL nFcn := Win_PortFcn()
METHOD Error() CLASS win_Port
LOCAL nFcn := win_PortFuncLast( ::nPort )
LOCAL cString
LOCAL nError
LOCAL cMsg
@@ -188,6 +180,6 @@ METHOD Error() CLASS Win_Port
/* WinPortError clears the error - don't call it twice */
cMsg := Space( 256 )
wapi_FormatMessage( NIL, NIL, nError := Win_PortError(), NIL, @cMsg )
wapi_FormatMessage( NIL, NIL, nError := win_PortError( ::nPort ), NIL, @cMsg )
RETURN cString + "error (" + hb_ntos( nError ) + ") : " + cMsg

View File

@@ -1,6 +1,6 @@
/*
* $Id$
*/
* $Id$
*/
/*
* xHarbour Project source code:

View File

@@ -1,54 +1,54 @@
/*
* $Id$
*/
* $Id$
*/
/*
* xHarbour Project source code:
* The Service/Daemon support
* (Includes also signal/low level error management)
*
* Copyright 2003 Giancarlo Niccolai [gian@niccolai.ws]
* www - http://www.xharbour.org
*
* this program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* this program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the
* GNU General public License for more details.
*
* You should have received a copy of the GNU General public License
* along with this software; see the file COPYING. if not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, xHarbour license gives permission for
* additional uses of the text contained in its release of xHarbour.
*
* The exception is that, if you link the xHarbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General public License.
* Your use of that executable is in no way restricted on account of
* linking the xHarbour library code into it.
*
* this exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General public License.
*
* this exception applies only to the code released with this xHarbour
* explicit exception. if you add/copy code from other sources,
* as the General public License permits, the above exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for xHarbour, it is your choice
* whether to permit this exception to apply to your modifications.
* if you do not wish that, delete this exception notice.
*
*/
* xHarbour Project source code:
* The Service/Daemon support
* (Includes also signal/low level error management)
*
* Copyright 2003 Giancarlo Niccolai [gian@niccolai.ws]
* www - http://www.xharbour.org
*
* this program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* this program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the
* GNU General public License for more details.
*
* You should have received a copy of the GNU General public License
* along with this software; see the file COPYING. if not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, xHarbour license gives permission for
* additional uses of the text contained in its release of xHarbour.
*
* The exception is that, if you link the xHarbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General public License.
* Your use of that executable is in no way restricted on account of
* linking the xHarbour library code into it.
*
* this exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General public License.
*
* this exception applies only to the code released with this xHarbour
* explicit exception. if you add/copy code from other sources,
* as the General public License permits, the above exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for xHarbour, it is your choice
* whether to permit this exception to apply to your modifications.
* if you do not wish that, delete this exception notice.
*
*/
#define HB_OS_WIN_USED

View File

@@ -1,54 +1,54 @@
/*
* $Id$
*/
* $Id$
*/
/*
* xHarbour Project source code:
* The Service/Daemon support
* (Includes also signal/low level error management)
*
* Copyright 2003 Giancarlo Niccolai [gian@niccolai.ws]
* www - http://www.xharbour.org
*
* this program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* this program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the
* GNU General public License for more details.
*
* You should have received a copy of the GNU General public License
* along with this software; see the file COPYING. if not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, xHarbour license gives permission for
* additional uses of the text contained in its release of xHarbour.
*
* The exception is that, if you link the xHarbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General public License.
* Your use of that executable is in no way restricted on account of
* linking the xHarbour library code into it.
*
* this exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General public License.
*
* this exception applies only to the code released with this xHarbour
* explicit exception. if you add/copy code from other sources,
* as the General public License permits, the above exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for xHarbour, it is your choice
* whether to permit this exception to apply to your modifications.
* if you do not wish that, delete this exception notice.
*
*/
* xHarbour Project source code:
* The Service/Daemon support
* (Includes also signal/low level error management)
*
* Copyright 2003 Giancarlo Niccolai [gian@niccolai.ws]
* www - http://www.xharbour.org
*
* this program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* this program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the
* GNU General public License for more details.
*
* You should have received a copy of the GNU General public License
* along with this software; see the file COPYING. if not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, xHarbour license gives permission for
* additional uses of the text contained in its release of xHarbour.
*
* The exception is that, if you link the xHarbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General public License.
* Your use of that executable is in no way restricted on account of
* linking the xHarbour library code into it.
*
* this exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General public License.
*
* this exception applies only to the code released with this xHarbour
* explicit exception. if you add/copy code from other sources,
* as the General public License permits, the above exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for xHarbour, it is your choice
* whether to permit this exception to apply to your modifications.
* if you do not wish that, delete this exception notice.
*
*/
#ifndef HB_SERVICE_CH
#define HB_SERVICE_CH

View File

@@ -1,53 +1,53 @@
/*
* $Id$
*/
* $Id$
*/
/*
* xHarbour Project source code:
* The Service/Daemon support
*
* Copyright 2003 Giancarlo Niccolai [gian@niccolai.ws]
* www - http://www.xharbour.org
*
* this program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* this program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the
* GNU General public License for more details.
*
* You should have received a copy of the GNU General public License
* along with this software; see the file COPYING. if not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, xHarbour license gives permission for
* additional uses of the text contained in its release of xHarbour.
*
* The exception is that, if you link the xHarbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General public License.
* Your use of that executable is in no way restricted on account of
* linking the xHarbour library code into it.
*
* this exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General public License.
*
* this exception applies only to the code released with this xHarbour
* explicit exception. if you add/copy code from other sources,
* as the General public License permits, the above exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for xHarbour, it is your choice
* whether to permit this exception to apply to your modifications.
* if you do not wish that, delete this exception notice.
*
*/
* xHarbour Project source code:
* The Service/Daemon support
*
* Copyright 2003 Giancarlo Niccolai [gian@niccolai.ws]
* www - http://www.xharbour.org
*
* this program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* this program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the
* GNU General public License for more details.
*
* You should have received a copy of the GNU General public License
* along with this software; see the file COPYING. if not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, xHarbour license gives permission for
* additional uses of the text contained in its release of xHarbour.
*
* The exception is that, if you link the xHarbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General public License.
* Your use of that executable is in no way restricted on account of
* linking the xHarbour library code into it.
*
* this exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General public License.
*
* this exception applies only to the code released with this xHarbour
* explicit exception. if you add/copy code from other sources,
* as the General public License permits, the above exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for xHarbour, it is your choice
* whether to permit this exception to apply to your modifications.
* if you do not wish that, delete this exception notice.
*
*/
#ifndef HB_SERVICE_H
#define HB_SERVICE_H

View File

@@ -32,6 +32,7 @@
* their web site at http://www.gnu.org/).
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://www.harbour-project.org

View File

@@ -32,6 +32,7 @@
* their web site at http://www.gnu.org/).
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://www.harbour-project.org

View File

@@ -10,7 +10,6 @@
* Uses list.js and resize.js (heavily modified) found at
* developer.Netscape.com
*
*
* Copyright 2000 Manos Aspradakis <maspr@otenet.gr>
* www - http://www.harbour-project.org
*
@@ -37,6 +36,7 @@
* their web site at http://www.gnu.org/).
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://www.harbour-project.org

View File

@@ -32,6 +32,7 @@
* their web site at http://www.gnu.org/).
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://www.harbour-project.org
@@ -634,7 +635,7 @@
#xCommand Comment <text> ;
OF <oHtm> ;
=> ;
<oHtm>:Comment(<text>)
<oHtm>:Comment(<text>)
#xCommand LINKNAME <cName> ;
OF <oHtm> ;
@@ -743,8 +744,7 @@
#xtranslate __HTML_FTYPE__ <ftype:BOLD> => "<B>"
#xtranslate __HTML_FTYPE__ <ftype:ULINE> => "<U>"
#xtranslate __HTML_FTYPE__ <ftype:UNDERLINE> => "<U>"
#define _HTML_CH
#endif

View File

@@ -32,6 +32,7 @@
* their web site at http://www.gnu.org/).
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://www.harbour-project.org

View File

@@ -32,6 +32,7 @@
* their web site at http://www.gnu.org/).
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://www.harbour-project.org
@@ -286,5 +287,3 @@
#define _FORMS_CH
#endif

View File

@@ -32,6 +32,7 @@
* their web site at http://www.gnu.org/).
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://www.harbour-project.org

View File

@@ -1,53 +1,54 @@
/*
* $Id$
*/
* $Id$
*/
/*
* xHarbour Project source code:
* The Internet Protocol / TCP support
*
* Copyright 2002 Giancarlo Niccolai [gian@niccolai.ws]
* www - http://www.xharbour.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, xHarbour license gives permission for
* additional uses of the text contained in its release of xHarbour.
*
* The exception is that, if you link the xHarbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the xHarbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released with this xHarbour
* explicit exception. If you add/copy code from other sources,
* as the General Public License permits, the above exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for xHarbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
* Harbour Project source code:
* The Internet Protocol / TCP support (xhb compatibility header)
*
* Copyright 2009 Viktor Szakats (harbour.01 syenar.hu)
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#ifndef HB_INET_H_
#define HB_INET_H_

View File

@@ -13,20 +13,20 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
* <text>
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* </text>
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
* <text>
*
* As a special exception, xHarbour license gives permission for
* additional uses of the text contained in its release of xHarbour.
* </text>
*
* The exception is that, if you link the xHarbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.

View File

@@ -1,4 +1,3 @@
/*
* $Id$
*/
@@ -33,6 +32,7 @@
* their web site at http://www.gnu.org/).
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://www.harbour-project.org

View File

@@ -32,6 +32,7 @@
* their web site at http://www.gnu.org/).
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://www.harbour-project.org

View File

@@ -32,6 +32,7 @@
* their web site at http://www.gnu.org/).
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://www.harbour-project.org

View File

@@ -32,6 +32,7 @@
* their web site at http://www.gnu.org/).
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://www.harbour-project.org
@@ -69,7 +70,7 @@ CLASS THtmlFrameSet
ENDCLASS
METHOD New( cFName, cTitle ) CLASS THtmlFrameSet
LOCAL cStr := ""
@@ -93,7 +94,7 @@ METHOD New( cFName, cTitle ) CLASS THtmlFrameSet
" <TITLE>" + ::Title + "</TITLE>" + CRLF() + ;
" </HEAD>" + CRLF()
::cStr += cStr
::cStr += cStr
RETURN Self
@@ -148,21 +149,21 @@ METHOD StartSet( aRows, aCols, onLoad, onUnload ) CLASS THtmlFrameSet
cStr += " >" + CRLF()
::cStr += cStr
::cStr += cStr
RETURN Self
METHOD Endset() CLASS THtmlFrameSet
::cStr += " </FRAMESET>" + CRLF()
::cStr += " </FRAMESET>" + CRLF()
RETURN Self
METHOD END () CLASS THtmlFrameSet
::cStr += "</HTML>" + CRLF()
::cStr += "</HTML>" + CRLF()
FWrite( ::nH, ::cStr )
IF ::FName != NIL
@@ -181,7 +182,7 @@ METHOD Frame( cName, cURL, lBorder, lResize, lScrolling, ;
DEFAULT lResize TO .T.
DEFAULT lScrolling TO .F.
DEFAULT cScrolling TO "AUTO"
DEFAULT cTarget TO "_self"
DEFAULT cTarget TO "_self"
cStr := " <FRAME "
@@ -220,7 +221,7 @@ METHOD Frame( cName, cURL, lBorder, lResize, lScrolling, ;
ENDIF
IF marginwidth != NIL
cStr += " MARGINWIDTH= " + NTRIM( marginwidth )
cStr += " MARGINWIDTH= " + NTRIM( marginwidth )
ENDIF
IF marginheight != NIL
@@ -229,6 +230,6 @@ METHOD Frame( cName, cURL, lBorder, lResize, lScrolling, ;
cStr += ">" + CRLF()
::cStr += cStr
::cStr += cStr
RETURN Self

View File

@@ -32,6 +32,7 @@
* their web site at http://www.gnu.org/).
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://www.harbour-project.org

View File

@@ -50,7 +50,7 @@
*
*/
/*
/*
* The following parts are Copyright of the individual authors.
* www - http://www.harbour-project.org
*
@@ -61,7 +61,6 @@
*
*/
#include "hbclass.ch"
#include "ttable.ch"
@@ -71,9 +70,9 @@
#include "inkey.ch"
#include "dbinfo.ch"
#include "error.ch"
#define COMPILE(c) &("{||" + c + "}")
//request DBFCDX
STATIC saTables := {}
/* NetWork Functions */
STATIC snNetDelay := 30

View File

@@ -5,7 +5,7 @@
/*
* Harbour Project source code:
* dbModifyStructure( <cFile> ) -> lSuccess
*
*
* Copyright 2009 Ron Pinkas <Ron.Pinkas at xHarbour.com>
* www - http://www.harbour-project.org
*

View File

@@ -3212,6 +3212,7 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 )
ENDIF
/* Build C stub */
/* Use the same EOL for all platforms to avoid unnecessary rebuilds. */
cFile := '/* This temp source file was generated by hbmk tool. */' + Chr( 10 ) +;
'/* You can safely delete it. */' + Chr( 10 ) +;
'' + Chr( 10 ) +;
@@ -3403,6 +3404,7 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 )
IF ! l_lCLEAN
/* Build .rc stub */
/* Use the same EOL for all platforms to avoid unnecessary rebuilds. */
cFile := '/* This temp source file was generated by hbmk tool. */' + Chr( 10 ) +;
'/* You can safely delete it. */' + Chr( 10 ) +;
'' + Chr( 10 )