From 12339bd1734687e5ed8ed3e081692c7fbfcdc96d Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 2 Jan 2010 17:44:43 +0000 Subject: [PATCH] 2010-01-02 18:40 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * config/global.mk % Applied little optimization from Tamas Tevesz. * contrib/hbide/idemisc.prg + hbide_PathProc() This function can combine relative paths together so it's the key to avoid macros dealing with placing paths to their intended location. It can replace current method of = hb_dirBase(). F.e.: hbide_PathProc( "src/mysource_in_project.prg", "projects_dir/" ) -> "projects_dir/src/mysource_in_project.prg" hbide_PathProc( "projects/myproject.hbi", hb_dirBase() ) -> "C:/harbour/contrib/hbide/projects/myproject.hbi" Please use it. ; TOFIX: Since hbide seems to intend to support a hbrun-like command prompt, maybe it's a good idea to prefix all public functions with hbide_, otherwise there will be problems when name collision occurs with user code. If this is not the goal, we can leave it. --- harbour/ChangeLog | 22 +++++++++++++++++ harbour/config/global.mk | 4 +-- harbour/contrib/hbide/idemisc.prg | 41 ++++++++++++++++++++++++++++--- 3 files changed, 61 insertions(+), 6 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f0320673e5..7f59adb9dc 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,28 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-01-02 18:40 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * config/global.mk + % Applied little optimization from Tamas Tevesz. + + * contrib/hbide/idemisc.prg + + hbide_PathProc() + This function can combine relative paths together so it's + the key to avoid macros dealing with placing paths to their + intended location. It can replace current method of + = hb_dirBase(). F.e.: + hbide_PathProc( "src/mysource_in_project.prg", "projects_dir/" ) -> + "projects_dir/src/mysource_in_project.prg" + hbide_PathProc( "projects/myproject.hbi", hb_dirBase() ) -> + "C:/harbour/contrib/hbide/projects/myproject.hbi" + Please use it. + + ; TOFIX: Since hbide seems to intend to support a hbrun-like + command prompt, maybe it's a good idea to prefix all + public functions with hbide_, otherwise there will + be problems when name collision occurs with user code. + If this is not the goal, we can leave it. + 2010-01-02 08:28 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/projects/hbide.hbi + Added missing files. A little formatting. diff --git a/harbour/config/global.mk b/harbour/config/global.mk index 3699d0ea0f..bf79bd2a87 100644 --- a/harbour/config/global.mk +++ b/harbour/config/global.mk @@ -507,10 +507,10 @@ ifeq ($(HB_COMPILER),) # try to detect MinGW cross-compiler location using some default platform settings ifeq ($(HB_CCPATH)$(HB_CCPREFIX),) - ifneq ($(call find_in_path_raw,debian_version,/etc),) + ifneq ($(wildcard /etc/debian_version),) HB_CCPREFIX := i586-mingw32msvc- else - ifneq ($(call find_in_path_raw,gentoo-release,/etc),) + ifneq ($(wildcard /etc/gentoo-release),) ifneq ($(call find_in_path_par,i386-mingw32msvc-gcc,/opt/xmingw/bin),) HB_CCPATH := /opt/xmingw/ HB_CCPREFIX := i386-mingw32msvc- diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index 529f7eb214..904d777322 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -48,6 +48,18 @@ * If you do not wish that, delete this exception notice. * */ + +/* + * The following parts are Copyright of the individual authors. + * www - http://www.harbour-project.org + * + * Copyright 2010 Viktor Szakats (harbour.01 syenar.hu) + * hbide_PathProc() + * + * See COPYING for licensing terms. + * + */ + /*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/ @@ -442,7 +454,7 @@ FUNCTION IsValidText( cSourceFile ) hb_fNameSplit( cSourceFile, , , @cExt ) cExt := lower( cExt ) - RETURN ( cExt $ ".c,.cpp,.prg,.h,.ch,.txt,.log,.ini,.env,.ppo" ) + RETURN cExt $ ".c,.cpp,.prg,.h,.ch,.txt,.log,.ini,.env,.ppo" /*----------------------------------------------------------------------*/ @@ -452,7 +464,7 @@ FUNCTION IsValidSource( cSourceFile ) hb_fNameSplit( cSourceFile, , , @cExt ) cExt := lower( cExt ) - RETURN ( cExt $ ".c,.cpp,.prg,.res,.rc" ) + RETURN cExt $ ".c,.cpp,.prg,.res,.rc" /*----------------------------------------------------------------------*/ @@ -463,7 +475,7 @@ FUNCTION PathNormalized( cPath, lLower ) s := strtran( cPath, "\", "/" ) - RETURN IF( lLower, lower( s ), s ) + RETURN IIF( lLower, lower( s ), s ) /*----------------------------------------------------------------------*/ /* @@ -653,7 +665,28 @@ FUNCTION ParseKeyValPair( s, cKey, cVal ) lYes := ( !empty( cKey ) .and. !empty( cVal ) ) ENDIF - RETURN ( lYes ) + RETURN lYes /*----------------------------------------------------------------------*/ +FUNCTION hbide_PathProc( cPathR, cPathA ) + LOCAL cDirA + LOCAL cDirR, cDriveR, cNameR, cExtR + + IF Empty( cPathA ) + RETURN cPathR + ENDIF + + hb_FNameSplit( cPathR, @cDirR, @cNameR, @cExtR, @cDriveR ) + + IF ! Empty( cDriveR ) .OR. ( ! Empty( cDirR ) .AND. Left( cDirR, 1 ) $ hb_osPathDelimiters() ) + RETURN cPathR + ENDIF + + hb_FNameSplit( cPathA, @cDirA ) + + IF Empty( cDirA ) + RETURN cPathR + ENDIF + + RETURN hb_FNameMerge( cDirA + cDirR, cNameR, cExtR )