diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f5f1fbedf5..bb4037c2aa 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,35 @@ The license applies to all entries newer than 2009-04-28. */ +2010-09-22 16:52 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbapicom.h + * harbour/src/rtl/hbcom.c + + added public C function: void hb_comSetError( int iPort, int iError ) + + * harbour/src/rtl/hbcomhb.c + + added PRG function: HB_COMSETERROR( nPort, nError ) --> NIL + + * harbour/src/rtl/hbsocket.c + * minor formatting + + * harbour/config/doc.mk + * harbour/config/postinst.hbs + * harbour/contrib/make.hbs + * do not install documentation files when HB_INSTALL_DOC=no + + * harbour/config/postinst.hbs + ! do not install .hbl files for core utils when HB_BUILD_PARTS=lib + + added support for HB_INSTALL_SCRIPT executed after install step. + It allows to extract some variables set by our GNU make system, + i.e. it's used to retrieve HB_CCPREFIX in win/wince .spec files. + + * harbour/package/harbour-win.spec.in + * use HB_INSTALL_DOC=no to disable DOC file installation + * generate hb{w|ce}mk2 scripts as wrappers to hbmk2 with cross + build settings so it can be easy used used by users to create + Windows/WindowsCE binaries. + Temporary solution until we will not have something more general. + 2010-09-21 12:37 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtwebkit/g/hbqtwebkit.h + Added SVN properties. diff --git a/harbour/config/doc.mk b/harbour/config/doc.mk index dcdf20c6c0..05a4c900dd 100644 --- a/harbour/config/doc.mk +++ b/harbour/config/doc.mk @@ -9,6 +9,10 @@ ifneq ($(HB_COMPILER),) first:: +ifeq ($(HB_INSTALL_DOC),no) +install:: + +else ifeq ($(HB_INSTALL_DOC),) install:: @@ -26,3 +30,4 @@ endif endif endif endif +endif diff --git a/harbour/config/postinst.hbs b/harbour/config/postinst.hbs index f7f6507ec1..6ddc0b191f 100644 --- a/harbour/config/postinst.hbs +++ b/harbour/config/postinst.hbs @@ -69,31 +69,32 @@ PROCEDURE Main( ... ) IF AScan( hb_AParams(), {| tmp | Lower( tmp ) == "install" } ) > 0 /* Installing some misc files */ + tmp := GetEnv( "HB_INSTALL_DOC" ) + IF ! tmp == "no" + IF GetEnv( "HB_PLATFORM" ) $ "win|wce|os2|dos" + tmp := GetEnv( "HB_INSTALL_PREFIX" ) + ENDIF + IF ! Empty( tmp ) - IF GetEnv( "HB_PLATFORM" ) $ "win|wce|os2|dos" - tmp := GetEnv( "HB_INSTALL_PREFIX" ) - ELSE - tmp := GetEnv( "HB_INSTALL_DOC" ) - ENDIF - IF ! Empty( tmp ) + OutStd( "! Copying root documents..." + hb_eol() ) - OutStd( "! Copying root documents..." + hb_eol() ) + IF DirBuild( tmp ) + FOR EACH aFile IN Directory( "Change*" ) + mk_hb_FCopy( aFile[ F_NAME ], tmp + hb_ps() + iif( GetEnv( "HB_PLATFORM" ) == "dos", "CHANGES", "" ) ) + NEXT - IF DirBuild( tmp ) - FOR EACH aFile IN Directory( "Change*" ) - mk_hb_FCopy( aFile[ F_NAME ], tmp + hb_ps() + iif( GetEnv( "HB_PLATFORM" ) == "dos", "CHANGES", "" ) ) - NEXT - - mk_hb_FCopy( "COPYING", tmp + hb_ps() ) - mk_hb_FCopy( "INSTALL", tmp + hb_ps() ) - mk_hb_FCopy( "NEWS" , tmp + hb_ps() ) - mk_hb_FCopy( "TODO" , tmp + hb_ps() ) - ELSE - OutStd( hb_StrFormat( "! Error: Cannot create directory '%1$s'", tmp ) + hb_eol() ) + mk_hb_FCopy( "COPYING", tmp + hb_ps() ) + mk_hb_FCopy( "INSTALL", tmp + hb_ps() ) + mk_hb_FCopy( "NEWS" , tmp + hb_ps() ) + mk_hb_FCopy( "TODO" , tmp + hb_ps() ) + ELSE + OutStd( hb_StrFormat( "! Error: Cannot create directory '%1$s'", tmp ) + hb_eol() ) + ENDIF ENDIF ENDIF - IF ! Empty( GetEnv( "HB_INSTALL_BIN" ) ) + IF ! Empty( GetEnv( "HB_INSTALL_BIN" ) ) .AND. ; + ! GetEnv( "HB_BUILD_PARTS" ) == "lib" OutStd( "! Copying Harbour script (.hbs) files..." + hb_eol() ) @@ -188,7 +189,8 @@ PROCEDURE Main( ... ) /* Creating language files */ - IF ! Empty( GetEnv( "HB_INSTALL_BIN" ) ) + IF ! Empty( GetEnv( "HB_INSTALL_BIN" ) ) .AND. ; + ! GetEnv( "HB_BUILD_PARTS" ) == "lib" OutStd( "! Making core translation (.hbl) files..." + hb_eol() ) @@ -204,11 +206,11 @@ PROCEDURE Main( ... ) /* Creating docs for core */ - IF ! Empty( GetEnv( "HB_INSTALL_DOC" ) ) + IF ! Empty( tmp := GetEnv( "HB_INSTALL_DOC" ) ) .AND. ! tmp == "no" OutStd( "! Compiling core documentation (.hbd)..." + hb_eol() ) - mk_hbd_core( "." + hb_ps(), GetEnv( "HB_INSTALL_DOC" ) ) + mk_hbd_core( "." + hb_ps(), tmp ) ENDIF /* Creating install packages */ @@ -329,6 +331,14 @@ PROCEDURE Main( ... ) ENDIF ENDIF ENDIF + + /* Executing user postinst configuration script */ + + IF ! Empty( tmp := GetEnv( "HB_INSTALL_SCRIPT" ) ) + + mk_hb_processRun( tmp ) + ENDIF + ELSE /* Regenerating extern headers */ diff --git a/harbour/contrib/make.hbs b/harbour/contrib/make.hbs index 2f749614f8..604d8a3671 100755 --- a/harbour/contrib/make.hbs +++ b/harbour/contrib/make.hbs @@ -590,12 +590,13 @@ STATIC FUNCTION mk_extern_lib( cInputName, cOutputName ) STATIC FUNCTION mk_hbd( cDir ) LOCAL cName + LOCAL cDocDir LOCAL tmp LOCAL aErrMsg LOCAL aEntry - IF ! Empty( GetEnv( "HB_INSTALL_DOC" ) ) + IF ! Empty( cDocDir := GetEnv( "HB_INSTALL_DOC" ) ) .AND. ! cDocDir == "no" cName := DirGetName( cDir ) IF Empty( cName ) @@ -610,7 +611,7 @@ STATIC FUNCTION mk_hbd( cDir ) NEXT IF ! Empty( aEntry ) - cName := PathSepToSelf( GetEnv( "HB_INSTALL_DOC" ) ) + hb_ps() + cName + ".hbd" + cName := PathSepToSelf( cDocDir ) + hb_ps() + cName + ".hbd" IF __hbdoc_SaveHBD( cName, aEntry ) OutStd( "! Compiled documentation: " + cName + " <= " + cDir + hb_eol() ) RETURN .T. diff --git a/harbour/include/hbapicom.h b/harbour/include/hbapicom.h index 5625982d8d..3df6206e32 100644 --- a/harbour/include/hbapicom.h +++ b/harbour/include/hbapicom.h @@ -73,6 +73,7 @@ extern HB_EXPORT int hb_comClose( int iPort ); extern HB_EXPORT int hb_comInit( int iPort, int iBaud, int iParity, int iSize, int iStop ); extern HB_EXPORT long hb_comSend( int iPort, const void * data, long len, HB_MAXINT timeout ); extern HB_EXPORT long hb_comRecv( int iPort, void * data, long len, HB_MAXINT timeout ); +extern HB_EXPORT void hb_comSetError( int iPort, int iError ); extern HB_EXPORT int hb_comGetError( int iPort ); extern HB_EXPORT int hb_comGetOsError( int iPort ); extern HB_EXPORT int hb_comInputCount( int iPort ); diff --git a/harbour/package/harbour-wce.spec.in b/harbour/package/harbour-wce.spec.in index a0ac48ce0a..8db13607b4 100644 --- a/harbour/package/harbour-wce.spec.in +++ b/harbour/package/harbour-wce.spec.in @@ -16,7 +16,6 @@ %define name harbour-wce %define version 2.1.0 %define releasen beta2 -%define hb_pref hbce # Workaround for the problem of /usr/bin/strip not handling PE binaries. %define hb_ccpath /opt/mingw32ce/bin @@ -106,14 +105,25 @@ export HB_INSTALL_BIN=${RPM_BUILD_ROOT}/%{_bindir} export HB_INSTALL_INC=${RPM_BUILD_ROOT}/%{_includedir}/%{name} export HB_INSTALL_LIB=${RPM_BUILD_ROOT}/%{_libdir}/%{name} export HB_INSTALL_DYN=${HB_INSTALL_LIB} +export HB_INSTALL_DOC=no export HB_BUILD_STRIP=lib mkdir -p $HB_INSTALL_BIN +export HB_MK2WRAP=$HB_INSTALL_BIN/hbcemk2 +export HB_INSTALL_SCRIPT=$HB_MK2WRAP.tmp + +echo "#!/bin/sh" > $HB_INSTALL_SCRIPT +echo "echo export HB_CCPREFIX=\$HB_CCPREFIX >> $HB_MK2WRAP" > $HB_INSTALL_SCRIPT +chmod +x $HB_INSTALL_SCRIPT + +echo "#!/bin/sh" > $HB_MK2WRAP +echo "export HB_INSTALL_LIB=%{_libdir}/%{name}" >> $HB_MK2WRAP +echo "export HB_INSTALL_INC=%{_includedir}/%{name}" >> $HB_MK2WRAP make install %{?_smp_mflags} -# remove unused files -rm -fR ${HB_INSTALL_BIN}/{harbour,hbpp,hbmk2,hbrun,hbi18n,hbtest}.exe +echo "hbmk2 -plat=wce \"\$@\"" >> $HB_MK2WRAP +rm -fR $HB_INSTALL_SCRIPT ###################################################################### ## Post install @@ -139,9 +149,8 @@ rm -fR $RPM_BUILD_ROOT ###################################################################### %files -%defattr(-,root,root,755) - -%{_bindir}/hbmk2 +%defattr(755,root,root,755) +%{_bindir}/* %defattr(644,root,root,755) %dir %{_includedir}/%{name} diff --git a/harbour/package/harbour-win.spec.in b/harbour/package/harbour-win.spec.in index 2c32f46e8d..4cd0117601 100644 --- a/harbour/package/harbour-win.spec.in +++ b/harbour/package/harbour-win.spec.in @@ -16,7 +16,6 @@ %define name harbour-win %define version 2.1.0 %define releasen beta2 -%define hb_pref hbw # Workaround for the problem of /usr/bin/strip not handling PE binaries. %define hb_ccpath /opt/xmingw/bin @@ -106,14 +105,25 @@ export HB_INSTALL_BIN=${RPM_BUILD_ROOT}/%{_bindir} export HB_INSTALL_INC=${RPM_BUILD_ROOT}/%{_includedir}/%{name} export HB_INSTALL_LIB=${RPM_BUILD_ROOT}/%{_libdir}/%{name} export HB_INSTALL_DYN=${HB_INSTALL_LIB} +export HB_INSTALL_DOC=no export HB_BUILD_STRIP=lib mkdir -p $HB_INSTALL_BIN +export HB_MK2WRAP=$HB_INSTALL_BIN/hbwmk2 +export HB_INSTALL_SCRIPT=$HB_MK2WRAP.tmp + +echo "#!/bin/sh" > $HB_INSTALL_SCRIPT +echo "echo export HB_CCPREFIX=\$HB_CCPREFIX >> $HB_MK2WRAP" > $HB_INSTALL_SCRIPT +chmod +x $HB_INSTALL_SCRIPT + +echo "#!/bin/sh" > $HB_MK2WRAP +echo "export HB_INSTALL_LIB=%{_libdir}/%{name}" >> $HB_MK2WRAP +echo "export HB_INSTALL_INC=%{_includedir}/%{name}" >> $HB_MK2WRAP make install %{?_smp_mflags} -# remove unused files -rm -fR ${HB_INSTALL_BIN}/{harbour,hbpp,hbmk2,hbrun,hbi18n,hbtest}.exe +echo "hbmk2 -plat=win -comp=mingw \"\$@\"" >> $HB_MK2WRAP +rm -fR $HB_INSTALL_SCRIPT ###################################################################### ## Post install @@ -139,9 +149,8 @@ rm -fR $RPM_BUILD_ROOT ###################################################################### %files -%defattr(-,root,root,755) - -%{_bindir}/hbmk2 +%defattr(755,root,root,755) +%{_bindir}/* %defattr(644,root,root,755) %dir %{_includedir}/%{name} diff --git a/harbour/src/rtl/hbcom.c b/harbour/src/rtl/hbcom.c index 187990b29d..4973f2a67f 100644 --- a/harbour/src/rtl/hbcom.c +++ b/harbour/src/rtl/hbcom.c @@ -147,7 +147,7 @@ static void hb_comCloseAll( void ) } } -static void hb_comSetError( PHB_COM pCom, int iError ) +static void hb_comSetComError( PHB_COM pCom, int iError ) { pCom->error = iError; pCom->oserr = 0; @@ -161,9 +161,9 @@ static PHB_COM hb_comGetPort( int iPort, int iStatus ) if( iStatus == HB_COM_ANY || ( iStatus & pCom->status ) != 0 ) return pCom; if( iStatus & HB_COM_ENABLED ) - hb_comSetError( pCom, HB_COM_ERR_WRONGPORT ); + hb_comSetComError( pCom, HB_COM_ERR_WRONGPORT ); else - hb_comSetError( pCom, HB_COM_ERR_CLOSED ); + hb_comSetComError( pCom, HB_COM_ERR_CLOSED ); } return NULL; } @@ -233,6 +233,13 @@ int hb_comSetDevice( int iPort, const char * szDevName ) return pCom ? 0 : -1; } +void hb_comSetError( int iPort, int iError ) +{ + PHB_COM pCom = hb_comGetPort( iPort, HB_COM_ANY ); + if( pCom ) + pCom->error = iError; +} + int hb_comGetError( int iPort ) { PHB_COM pCom = hb_comGetPort( iPort, HB_COM_ANY ); @@ -390,7 +397,7 @@ int hb_comInputCount( int iPort ) hb_comSetOsError( pCom, iResult == -1 ); #else int TODO_TIOCINQ; - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); #endif } else @@ -413,7 +420,7 @@ int hb_comOutputCount( int iPort ) hb_comSetOsError( pCom, iResult == -1 ); #else int TODO_TIOCOUTQ; - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); #endif } else @@ -445,7 +452,7 @@ int hb_comFlush( int iPort, int iType ) break; default: iResult = -1; - hb_comSetError( pCom, HB_COM_ERR_PARAMVALUE ); + hb_comSetComError( pCom, HB_COM_ERR_PARAMVALUE ); break; } } @@ -553,7 +560,7 @@ int hb_comMCR( int iPort, int * piValue, int iClr, int iSet ) int TODO_TIOCMGET_MCR; HB_SYMBOL_UNUSED( iClr ); HB_SYMBOL_UNUSED( iSet ); - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); #endif } @@ -588,7 +595,7 @@ int hb_comMSR( int iPort, int * piValue ) } #else int TODO_TIOCMGET_MSR; - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); #endif } @@ -612,7 +619,7 @@ int hb_comLSR( int iPort, int * piValue ) /* NOTE: most of systems do not give access to the * Line Status Register (LSR) */ - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); #endif } @@ -870,7 +877,7 @@ int hb_comDiscardChar( int iPort, int iChar ) #else int TODO_VDISCARD; HB_SYMBOL_UNUSED( iChar ); - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); #endif } @@ -888,7 +895,7 @@ int hb_comErrorChar( int iPort, int iChar ) */ HB_SYMBOL_UNUSED( iChar ); - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); } return iResult; @@ -915,7 +922,7 @@ int hb_comInputState( int iPort ) if( pCom ) { /* NOTE: checking HB_COM_RX_* input flow states is unsupported */ - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); } return iResult; @@ -936,7 +943,7 @@ long hb_comSend( int iPort, const void * data, long len, HB_MAXINT timeout ) lSent = hb_comCanWrite( pCom, timeout ); if( lSent == 0 ) { - hb_comSetError( pCom, HB_COM_ERR_TIMEOUT ); + hb_comSetComError( pCom, HB_COM_ERR_TIMEOUT ); lSent = -1; } } @@ -978,7 +985,7 @@ long hb_comRecv( int iPort, void * data, long len, HB_MAXINT timeout ) lReceived = hb_comCanRead( pCom, timeout ); if( lReceived == 0 ) { - hb_comSetError( pCom, HB_COM_ERR_TIMEOUT ); + hb_comSetComError( pCom, HB_COM_ERR_TIMEOUT ); lReceived = -1; } } @@ -1153,7 +1160,7 @@ int hb_comInit( int iPort, int iBaud, int iParity, int iSize, int iStop ) hb_comSetOsError( pCom, iResult == -1 ); } else - hb_comSetError( pCom, HB_COM_ERR_PARAMVALUE ); + hb_comSetComError( pCom, HB_COM_ERR_PARAMVALUE ); } } @@ -1196,7 +1203,7 @@ int hb_comOpen( int iPort ) { if( pCom->status & HB_COM_OPEN ) { - hb_comSetError( pCom, HB_COM_ERR_ALREADYOPEN ); + hb_comSetComError( pCom, HB_COM_ERR_ALREADYOPEN ); } else { @@ -1212,7 +1219,7 @@ int hb_comOpen( int iPort ) { close( pCom->fd ); pCom->fd = -1; - hb_comSetError( pCom, HB_COM_ERR_BUSY ); + hb_comSetComError( pCom, HB_COM_ERR_BUSY ); } else #else @@ -1305,7 +1312,7 @@ int hb_comFlush( int iPort, int iType ) hb_comSetOsError( pCom, !fResult ); break; default: - hb_comSetError( pCom, HB_COM_ERR_PARAMVALUE ); + hb_comSetComError( pCom, HB_COM_ERR_PARAMVALUE ); break; } } @@ -1528,7 +1535,7 @@ int hb_comFlowSet( int iPort, int iFlow ) fNotSup = TRUE; if( fNotSup ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); else hb_comSetOsError( pCom, !fResult ); } @@ -1575,7 +1582,7 @@ int hb_comDiscardChar( int iPort, int iChar ) * discarding input buffer */ HB_SYMBOL_UNUSED( iChar ); - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); } return iResult; @@ -1849,7 +1856,7 @@ int hb_comInit( int iPort, int iBaud, int iParity, int iSize, int iStop ) hb_comSetOsError( pCom, !fResult ); } else - hb_comSetError( pCom, HB_COM_ERR_PARAMVALUE ); + hb_comSetComError( pCom, HB_COM_ERR_PARAMVALUE ); } else hb_comSetOsError( pCom, !fResult ); @@ -1884,7 +1891,7 @@ int hb_comOpen( int iPort ) { if( pCom->status & HB_COM_OPEN ) { - hb_comSetError( pCom, HB_COM_ERR_ALREADYOPEN ); + hb_comSetComError( pCom, HB_COM_ERR_ALREADYOPEN ); } else { @@ -2290,7 +2297,7 @@ int hb_comFlowSet( int iPort, int iFlow ) fNotSup = TRUE; if( fNotSup ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); else hb_comSetOsError( pCom, rc ); } @@ -2338,7 +2345,7 @@ int hb_comDiscardChar( int iPort, int iChar ) * discarding input buffer */ HB_SYMBOL_UNUSED( iChar ); - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); } return iResult; @@ -2415,7 +2422,7 @@ int hb_comInputState( int iPort ) if( pCom ) { /* TODO: checking HB_COM_RX_* input flow states is unsupported */ - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); } return iResult; @@ -2670,7 +2677,7 @@ int hb_comOpen( int iPort ) { if( pCom->status & HB_COM_OPEN ) { - hb_comSetError( pCom, HB_COM_ERR_ALREADYOPEN ); + hb_comSetComError( pCom, HB_COM_ERR_ALREADYOPEN ); } else { @@ -2705,7 +2712,7 @@ int hb_comInputCount( int iPort ) PHB_COM pCom = hb_comGetPort( iPort, HB_COM_OPEN ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2715,7 +2722,7 @@ int hb_comOutputCount( int iPort ) PHB_COM pCom = hb_comGetPort( iPort, HB_COM_OPEN ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2727,7 +2734,7 @@ int hb_comFlush( int iPort, int iType ) HB_SYMBOL_UNUSED( iType ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2741,7 +2748,7 @@ int hb_comMCR( int iPort, int * piValue, int iClr, int iSet ) HB_SYMBOL_UNUSED( iSet ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2753,7 +2760,7 @@ int hb_comMSR( int iPort, int * piValue ) HB_SYMBOL_UNUSED( piValue ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2765,7 +2772,7 @@ int hb_comLSR( int iPort, int * piValue ) HB_SYMBOL_UNUSED( piValue ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2777,7 +2784,7 @@ int hb_comSendBreak( int iPort, int iDurationInMilliSecs ) HB_SYMBOL_UNUSED( iDurationInMilliSecs ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2790,7 +2797,7 @@ int hb_comFlowControl( int iPort, int *piFlow, int iFlow ) HB_SYMBOL_UNUSED( iFlow ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2802,7 +2809,7 @@ int hb_comFlowSet( int iPort, int iFlow ) HB_SYMBOL_UNUSED( iFlow ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2815,7 +2822,7 @@ int hb_comFlowChars( int iPort, int iXONchar, int iXOFFchar ) HB_SYMBOL_UNUSED( iXOFFchar ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2827,7 +2834,7 @@ int hb_comDiscardChar( int iPort, int iChar ) HB_SYMBOL_UNUSED( iChar ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2839,7 +2846,7 @@ int hb_comErrorChar( int iPort, int iChar ) HB_SYMBOL_UNUSED( iChar ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2849,7 +2856,7 @@ int hb_comOutputState( int iPort ) PHB_COM pCom = hb_comGetPort( iPort, HB_COM_OPEN ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2859,7 +2866,7 @@ int hb_comInputState( int iPort ) PHB_COM pCom = hb_comGetPort( iPort, HB_COM_OPEN ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2873,7 +2880,7 @@ long hb_comSend( int iPort, const void * data, long len, HB_MAXINT timeout ) HB_SYMBOL_UNUSED( timeout ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2887,7 +2894,7 @@ long hb_comRecv( int iPort, void * data, long len, HB_MAXINT timeout ) HB_SYMBOL_UNUSED( timeout ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2902,7 +2909,7 @@ int hb_comInit( int iPort, int iBaud, int iParity, int iSize, int iStop ) HB_SYMBOL_UNUSED( iStop ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2912,7 +2919,7 @@ int hb_comClose( int iPort ) PHB_COM pCom = hb_comGetPort( iPort, HB_COM_OPEN ); if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } @@ -2923,7 +2930,7 @@ int hb_comOpen( int iPort ) int iTODO_serial_port_support; if( pCom ) - hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT ); + hb_comSetComError( pCom, HB_COM_ERR_NOSUPPORT ); return -1; } diff --git a/harbour/src/rtl/hbcomhb.c b/harbour/src/rtl/hbcomhb.c index 39336ec3a3..0ccbfc1ee8 100644 --- a/harbour/src/rtl/hbcomhb.c +++ b/harbour/src/rtl/hbcomhb.c @@ -73,6 +73,7 @@ * HB_COMOUTPUTSTATE( nPort ) --> nState * HB_COMSENDBREAK( nPort, [ nDuration = 50 ] ) --> lSuccess * HB_COMSETDEVICE( nPort, cDeviceName ) --> lSuccess + * HB_COMSETERROR( nPort, nError ) --> NIL * HB_COMRECV( nPort, @cBuffer, [ nLen = LEN( cBuffer ) ], [ nTimeout = 0 ] ) --> nBytesRecv * HB_COMSEND( nPort, cBuffer, [ nLen = LEN( cBuffer ) ], [ nTimeout = 0 ] ) --> nBytesSent */ @@ -206,6 +207,11 @@ HB_FUNC( HB_COMSETDEVICE ) hb_retl( hb_comSetDevice( hb_parni( 1 ), hb_parc( 2 ) ) == 0 ); } +HB_FUNC( HB_COMSETERROR ) +{ + hb_comSetError( hb_parni( 1 ), hb_parni( 2 ) ); +} + HB_FUNC( HB_COMRECV ) { PHB_ITEM pItem = hb_param( 2, HB_IT_STRING ); diff --git a/harbour/src/rtl/hbsocket.c b/harbour/src/rtl/hbsocket.c index 3238306130..2729a507e1 100644 --- a/harbour/src/rtl/hbsocket.c +++ b/harbour/src/rtl/hbsocket.c @@ -1845,7 +1845,7 @@ HB_BOOL hb_socketAddrFromItem( void ** pSockAddr, unsigned * puiLen, PHB_ITEM pA if( pAddrItm && HB_IS_ARRAY( pAddrItm ) ) { if( hb_arrayLen( pAddrItm ) >= 2 && - ( hb_arrayGetType( pAddrItm, 1 ) & HB_IT_NUMERIC ) != 0 ) + ( hb_arrayGetType( pAddrItm, 1 ) & HB_IT_NUMERIC ) != 0 ) { switch( hb_arrayGetNI( pAddrItm, 1 ) ) {