From fed84016659edacdc340b1f08e8f09d50e06d763 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 23 Jan 2013 00:05:19 +0000 Subject: [PATCH] 2013-01-23 00:59 UTC+0100 Viktor Szakats (harbour syenar.net) * utils/hbmk2/hbmk2.prg ! FindInPath(): fixed for filenames with an empty extension on *nix systems when opening hbrun scripts. [slight chance of regression.] ! fixed to use ".\" also on non-*nix systems when using -run option and the target doesn't have a directory. Previously the wrong executable might have been executed if another one with the same name existed in path. + detect another variant of "multiple definitions" linker option + detect "multiple definitions" linker message for another C compiler + tests/testcom1.prg + added com sample code posted by Przemek earlier * contrib/hbsms/tests/send.prg + added Linux device name * src/rtl/cdpdet.prg * cleanup to local function name --- harbour/ChangeLog.txt | 22 +++++++++++++ harbour/contrib/hbsms/tests/send.prg | 2 ++ harbour/src/rtl/cdpdet.prg | 4 +-- harbour/tests/testcom1.prg | 49 ++++++++++++++++++++++++++++ harbour/utils/hbmk2/hbmk2.prg | 23 ++++++++----- 5 files changed, 90 insertions(+), 10 deletions(-) create mode 100644 harbour/tests/testcom1.prg diff --git a/harbour/ChangeLog.txt b/harbour/ChangeLog.txt index 971dfa200d..c8876de807 100644 --- a/harbour/ChangeLog.txt +++ b/harbour/ChangeLog.txt @@ -10,6 +10,27 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2013-01-23 00:59 UTC+0100 Viktor Szakats (harbour syenar.net) + * utils/hbmk2/hbmk2.prg + ! FindInPath(): fixed for filenames with an empty + extension on *nix systems when opening hbrun scripts. + [slight chance of regression.] + ! fixed to use ".\" also on non-*nix systems when using + -run option and the target doesn't have a directory. + Previously the wrong executable might have been executed + if another one with the same name existed in path. + + detect another variant of "multiple definitions" linker option + + detect "multiple definitions" linker message for another C compiler + + + tests/testcom1.prg + + added com sample code posted by Przemek earlier + + * contrib/hbsms/tests/send.prg + + added Linux device name + + * src/rtl/cdpdet.prg + * cleanup to local function name + 2013-01-22 02:53 UTC+0100 Viktor Szakats (harbour syenar.net) * src/rtl/teditor.prg ! fixed current color being used instead of editor's own @@ -331,6 +352,7 @@ to create scripts starting with line: #!/usr/bin/hbrun which do not have .hb or .prg file name extension + [UPDATE: which has no extension] [DONE] 2012-12-27 01:52 UTC+0100 Viktor Szakats (harbour syenar.net) * package/winuni/mpkg_win_uni.nsi diff --git a/harbour/contrib/hbsms/tests/send.prg b/harbour/contrib/hbsms/tests/send.prg index b177f413ed..946db992e4 100644 --- a/harbour/contrib/hbsms/tests/send.prg +++ b/harbour/contrib/hbsms/tests/send.prg @@ -13,6 +13,8 @@ PROCEDURE Main( cPort ) #if defined( __PLATFORM__WINDOWS ) hb_default( @cPort, "\\.\COM22" ) +#elif defined( __PLATFORM__LINUX ) + hb_default( @cPort, "/dev/ttyS1" ) #elif defined( __PLATFORM__DARWIN ) hb_default( @cPort, "/dev/cu.myport-COM1-1" ) #endif diff --git a/harbour/src/rtl/cdpdet.prg b/harbour/src/rtl/cdpdet.prg index d95a3d0827..9a1d1c604c 100644 --- a/harbour/src/rtl/cdpdet.prg +++ b/harbour/src/rtl/cdpdet.prg @@ -234,7 +234,7 @@ STATIC FUNCTION __CPStdToHarbour( cCPStd, cCtryStd ) ELSEIF Lower( cCPStd ) == "utf16" cCP := "UTF16LE" ELSE - IF ! Empty( cCtryHb := __CtryStdToCtry( cCtryStd ) ) + IF ! Empty( cCtryHb := __LangStdToCPCtryHb( cCtryStd ) ) FOR EACH cdp IN hb_cdpList() IF Left( cdp, 2 ) == cCtryHb IF Lower( cCPStd ) == hb_cdpUniID( cdp ) @@ -257,7 +257,7 @@ STATIC FUNCTION __CPStdToHarbour( cCPStd, cCtryStd ) RETURN cCP -STATIC FUNCTION __CtryStdToCtry( cCtryStd ) +STATIC FUNCTION __LangStdToCPCtryHb( cCtryStd ) LOCAL cCtryHb := Left( hb_cdpSelect(), 2 ) diff --git a/harbour/tests/testcom1.prg b/harbour/tests/testcom1.prg new file mode 100644 index 0000000000..42b6b0bdef --- /dev/null +++ b/harbour/tests/testcom1.prg @@ -0,0 +1,49 @@ +/* + * $Id$ + */ + +#include "hbcom.ch" + +PROCEDURE Main( cPortName ) + + LOCAL cString := "ATE0" + Chr( 13 ) + "ATI3" + Chr( 13 ) + LOCAL nTimeOut := 3000 // 3000 miliseconds = 3 sec. + LOCAL nResult + LOCAL nPort := 1 + + IF ! Empty( cPortName ) + hb_comSetDevice( nPort, cPortName ) + ENDIF + IF ! hb_comOpen( nPort ) + ? "Cannot open port:", nPort, hb_comGetDevice( nPort ), ; + "error: " + hb_ntos( hb_comGetError( nPort ) ) + ELSE + ? "port:", hb_comGetDevice( nPort ), "opened" + IF ! hb_comInit( nPort, 9600, "N", 8, 1 ) + ? "Cannot initialize port to: 9600:N:8:1", ; + "error: " + hb_ntos( hb_comGetError( nPort ) ) + ELSE + nResult := hb_comSend( nPort, cString, Len( cString ), nTimeOut ) + IF nResult != Len( cString ) + ? "SEND() failed,", nResult, "bytes sent in", nTimeOut / 1000, ; + "sec., expected:", Len( cString ), "bytes." + ? "error: " + hb_ntos( hb_comGetError( nPort ) ) + ELSE + ? "SEND() succeeded." + ENDIF + + WAIT "Press any key to begin reading..." + cString := Space( 32 ) + nTimeOut := 500 // 500 milliseconds = 0.5 sec. + nResult := hb_comRecv( nPort, @cString, Len( cString ), nTimeOut ) + IF nResult == -1 + ? "RECV() failed,", ; + "error: " + hb_ntos( hb_comGetError( nPort ) ) + ELSE + ? nResult, "bytes read in", nTimeOut / 1000, "sec." + ENDIF + ENDIF + ? "CLOSE:", hb_comClose( nPort ) + ENDIF + + RETURN diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 81a564e2a0..a8d532be03 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -7167,11 +7167,9 @@ FUNCTION hbmk( aArgs, nArgTarget, /* @ */ lPause, nLevel ) ! hbmk[ _HBMK_lCreateLib ] .AND. ! hbmk[ _HBMK_lCreateDyn ] .AND. ; hbmk[ _HBMK_nErrorLevel ] == _ERRLEV_OK .AND. ! hbmk[ _HBMK_lCLEAN ] .AND. hbmk[ _HBMK_lRUN ] cCommand := hbmk[ _HBMK_cPROGNAME ] - #if defined( __PLATFORM__UNIX ) - IF Empty( hb_FNameDir( hbmk[ _HBMK_cPROGNAME ] ) ) - cCommand := "." + hb_ps() + hbmk[ _HBMK_cPROGNAME ] - ENDIF - #endif + IF Empty( hb_FNameDir( hbmk[ _HBMK_cPROGNAME ] ) ) + cCommand := "." + hb_ps() + hbmk[ _HBMK_cPROGNAME ] + ENDIF #if defined( __PLATFORM__WINDOWS ) IF hbmk[ _HBMK_lGUI ] IF hb_osIsWinNT() @@ -7237,7 +7235,8 @@ STATIC PROCEDURE AAddWithWarning( hbmk, aArray, cOption, aParam, lNew ) STATIC sc_aWarning := { ; "-Wl,--allow-multiple-definition", ; /* gcc */ - "force:multiple", ; /* msvc */ + "muldefs", ; /* ld '-z muldefs' */ + "force:multiple", ; /* msvc, pocc, watcom */ "w-dpl" } /* bcc */ IF AScan( sc_aWarning, {| tmp | Lower( tmp ) $ Lower( cOption ) } ) > 0 @@ -9312,7 +9311,14 @@ STATIC FUNCTION FindInPath( cFileName, xPath, aExtDef ) #else hb_default( @aExtDef, { cExt } ) #endif - aExt := iif( Empty( cExt ), aExtDef, { cExt } ) + aExt := { cExt } + IF Empty( cExt ) + FOR EACH cExt IN aExtDef + IF AScan( aExt, {| tmp | hb_FileMatch( tmp, cExt ) } ) == 0 + AAdd( aExt, cExt ) + ENDIF + NEXT + ENDIF FOR EACH cExt IN aExt /* Check original filename (in supplied path or current dir) */ @@ -12539,7 +12545,8 @@ STATIC FUNCTION ExtractHarbourSymbols( cString ) "multiple definition", ; /* gcc */ "duplicate symbol", ; /* clang */ "already defined", ; /* msvc */ - "defined in both" } /* bcc */ + "defined in both", ; /* bcc */ + "previous definition different" } /* dmc */ LOCAL aList := {}