2010-09-28 08:32 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbcom.ch
    * updated few comments

  * harbour/include/hbapicom.h
  * harbour/src/rtl/hbcom.c
    + added new C function:
         HB_FHANDLE hb_comGetDeviceHandle( int iPort );
    * small cleanup in OS2 flow control setting

  * harbour/src/rtl/hbcomhb.c
    + added new PRG function
         HB_COMGETDEVICEHANDLE( nPort )  --> nHandle | F_ERROR
    * modified HB_COMFLOWCONTROL() to not change existing flow control
      when 3-rd parameter is missing:
         HB_COMFLOWCONTROL( nPort, @nOldFlow [, nNewFlow] ) --> lSuccess

  * harbour/contrib/hbmzip/hbmzip.c
    ! fixed date setting in HB_ZIPFILECREATE()
This commit is contained in:
Przemyslaw Czerpak
2010-09-28 06:32:51 +00:00
parent f43e6c2d40
commit 61854e0dda
6 changed files with 65 additions and 19 deletions

View File

@@ -16,6 +16,26 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-09-28 08:32 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbcom.ch
* updated few comments
* harbour/include/hbapicom.h
* harbour/src/rtl/hbcom.c
+ added new C function:
HB_FHANDLE hb_comGetDeviceHandle( int iPort );
* small cleanup in OS2 flow control setting
* harbour/src/rtl/hbcomhb.c
+ added new PRG function
HB_COMGETDEVICEHANDLE( nPort ) --> nHandle | F_ERROR
* modified HB_COMFLOWCONTROL() to not change existing flow control
when 3-rd parameter is missing:
HB_COMFLOWCONTROL( nPort, @nOldFlow [, nNewFlow] ) --> lSuccess
* harbour/contrib/hbmzip/hbmzip.c
! fixed date setting in HB_ZIPFILECREATE()
2010-09-28 03:53 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbmk2/hbmk2.prg
* config/global.mk

View File

@@ -205,7 +205,7 @@ HB_FUNC( HB_ZIPFILECREATE )
int iMethod = hb_parnidef( 7, Z_DEFLATED );
int iLevel = hb_parnidef( 8, Z_DEFAULT_COMPRESSION );
long lJulian, lMillisec;
int iY, iM, iD;
int iYear, iMonth, iDay, iHour, iMinute, iSecond;
zip_fileinfo zfi;
@@ -214,22 +214,22 @@ HB_FUNC( HB_ZIPFILECREATE )
if( HB_ISTIMESTAMP( 3 ) )
{
hb_partdt( &lJulian, &lMillisec, 3 );
hb_dateDecode( lJulian, &iY, &iM, &iD );
hb_timeDecode( lMillisec, &iY, &iM, &iD, NULL );
hb_dateDecode( lJulian, &iYear, &iMonth, &iDay );
hb_timeDecode( lMillisec, &iHour, &iMinute, &iSecond, NULL );
}
else
{
hb_dateDecode( hb_pardl( 3 ), &iY, &iM, &iD );
hb_timeStrGet( hb_parc( 4 ), &iY, &iM, &iD, NULL );
hb_dateDecode( hb_pardl( 3 ), &iYear, &iMonth, &iDay );
hb_timeStrGet( hb_parc( 4 ), &iHour, &iMinute, &iSecond, NULL );
}
zfi.tmz_date.tm_hour = iY;
zfi.tmz_date.tm_min = iM;
zfi.tmz_date.tm_sec = iD;
zfi.tmz_date.tm_hour = iHour;
zfi.tmz_date.tm_min = iMinute;
zfi.tmz_date.tm_sec = iSecond;
zfi.tmz_date.tm_year = iY;
zfi.tmz_date.tm_mon = iM - 1;
zfi.tmz_date.tm_mday = iD;
zfi.tmz_date.tm_year = iYear;
zfi.tmz_date.tm_mon = iMonth - 1;
zfi.tmz_date.tm_mday = iDay;
zfi.internal_fa = hb_parnl( 5 );
zfi.external_fa = hb_parnl( 6 );

View File

@@ -92,6 +92,7 @@ extern HB_EXPORT int hb_comOutputState( int iPort );
extern HB_EXPORT int hb_comInputState( int iPort );
extern HB_EXPORT int hb_comSetDevice( int iPort, const char * szDevName );
extern HB_EXPORT const char * hb_comGetDevice( int iPort, char * buffer, int size );
extern HB_EXPORT HB_FHANDLE hb_comGetDeviceHandle( int iPort );
HB_EXTERN_END

View File

@@ -87,11 +87,11 @@
#define HB_COM_LSR_TRANS_EMPTY 0x40 /* TX shift register empty */
/* hb_comFlowControl() parameters */
#define HB_COM_FLOW_IRTSCTS 0x01
#define HB_COM_FLOW_ORTSCTS 0x02
#define HB_COM_FLOW_IDTRDSR 0x04
#define HB_COM_FLOW_ODTRDSR 0x08
#define HB_COM_FLOW_DCD 0x10
#define HB_COM_FLOW_IRTSCTS 0x01 /* use RTS to stop input */
#define HB_COM_FLOW_ORTSCTS 0x02 /* check CTS on output */
#define HB_COM_FLOW_IDTRDSR 0x04 /* use DTR to stop input */
#define HB_COM_FLOW_ODTRDSR 0x08 /* check DSR on output */
#define HB_COM_FLOW_DCD 0x10 /* respect DCD */
#define HB_COM_FLOW_XOFF 0x20 /* XON/XOFF on input */
#define HB_COM_FLOW_XON 0x40 /* XON/XOFF on output */

View File

@@ -233,6 +233,25 @@ int hb_comSetDevice( int iPort, const char * szDevName )
return pCom ? 0 : -1;
}
HB_FHANDLE hb_comGetDeviceHandle( int iPort )
{
PHB_COM pCom = hb_comGetPort( iPort, HB_COM_ANY );
HB_FHANDLE hFile = FS_ERROR;
if( pCom )
{
#if defined( HB_HAS_TERMIOS )
hFile = pCom->fd;
#elif defined( HB_OS_WIN )
hFile = ( HB_FHANDLE ) pCom->hCom;
#elif defined( HB_OS_OS2 )
hFile = ( HB_FHANDLE ) pCom->hFile;
#endif
}
return hFile;
}
void hb_comSetError( int iPort, int iError )
{
PHB_COM pCom = hb_comGetPort( iPort, HB_COM_ANY );
@@ -2259,7 +2278,7 @@ int hb_comFlowControl( int iPort, int *piFlow, int iFlow )
else
dcb.fbFlowReplace &= ~MODE_AUTO_RECEIVE;
dcb.fbCtlHndShake &= ~( MODE_DSR_SENSITIVITY | MODE_DCD_HANDSHAKE );
dcb.fbCtlHndShake &= ~MODE_DSR_SENSITIVITY;
dcb.fbFlowReplace |= MODE_FULL_DUPLEX;
rc = DosDevIOCtl( pCom->hFile, IOCTL_ASYNC, ASYNC_SETDCBINFO,

View File

@@ -55,10 +55,11 @@
* HB_COMDISCARDCHAR( nPort, nChar | cChar ) --> lSuccess
* HB_COMERRORCHAR( nPort, nChar | cChar ) --> lSuccess
* HB_COMFLOWCHARS( nPort, nXONchar | cXONchar, nXOFFchar | cXOFFchar ) --> lSuccess
* HB_COMFLOWCONTROL( nPort, @nOldFlow, nFlow ) --> lSuccess
* HB_COMFLOWCONTROL( nPort, @nOldFlow [, nNewFlow] ) --> lSuccess
* HB_COMFLOWSET( nPort, nFlow ) --> lSuccess
* HB_COMFLUSH( nPort, [ nType = HB_COM_IOFLUSH ] ) --> lSuccess
* HB_COMGETDEVICE( nPort ) --> cDeviceName
* HB_COMGETDEVICEHANDLE( nPort ) --> nHandle | F_ERROR
* HB_COMGETERROR( nPort ) --> nError
* HB_COMGETOSERROR( nPort ) --> nError
* HB_COMINIT( nPort, nBaud, cParity, nSize, nStop ) --> lSuccess
@@ -108,7 +109,7 @@ HB_FUNC( HB_COMFLOWCHARS )
HB_FUNC( HB_COMFLOWCONTROL )
{
int iValue = 0;
hb_retl( hb_comFlowControl( hb_parni( 1 ), &iValue, hb_parni( 3 ) ) == 0 );
hb_retl( hb_comFlowControl( hb_parni( 1 ), &iValue, hb_parnidef( 3, -1 ) ) == 0 );
hb_storni( iValue, 2 );
}
@@ -129,6 +130,11 @@ HB_FUNC( HB_COMGETDEVICE )
hb_retc( name );
}
HB_FUNC( HB_COMGETDEVICEHANDLE )
{
hb_retnint( ( HB_NHANDLE ) hb_comGetDeviceHandle( hb_parni( 1 ) ) );
}
HB_FUNC( HB_COMGETERROR )
{
hb_retni( hb_comGetError( hb_parni( 1 ) ) );