From 09df7c33da17e8c6adcda5939e575d4d0d01b4bf Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 17 Jun 2010 20:08:23 +0000 Subject: [PATCH] 2010-06-17 22:07 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * src/common/hbfsapi.c ! hb_fsFName*(): Fixed to not GPF when called with NULL parameters. (this also fixes 'hbpp -c' GPF) * config/global.mk + Will now force HB_BUILD_UNICODE=no on Win9x hosts (and if HB_BIN_COMPILE is not set to point to a non-UNICODE Harbour tools to be used. Building UNICODE Harbour on Win9x is a cross-build situation) * config/win/bcc.mk + Added small trick to make the build work on Win9x host. ; Win9x is able to build properly using win/bcc. --- harbour/ChangeLog | 44 +++---- harbour/config/global.mk | 9 ++ harbour/config/win/bcc.mk | 7 +- harbour/src/common/hbfsapi.c | 215 ++++++++++++++++++----------------- 4 files changed, 137 insertions(+), 138 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 352a797861..cd2acba7cb 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,37 +16,21 @@ The license applies to all entries newer than 2009-04-28. */ -2010-06-17 21:34 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) - * harbour/src/vm/harbinit.prg - * harbour/src/vm/runner.c - * harbour/src/vm/hvm.c - ! fixed the order in which HVM calls __SetHelpK() PRG function. - It should be called after all INIT proc and before main application - entry. - * removed __SetHelpK() from thread initialization code. - ! fixed the order in which INIT procedures are executed in single - module - CA-Cl*pper calls INIT PROCEDUREs in the reverted order - (from last to first) - + added support for undocumented Clipper extension: two execution - levels of INIT PROCEDUREs. When application starts CA-Cl*pper - executes INIT PROCEDUREs called CLIPINIT from all linked PRG - modules. Then it repeats this operation for all modules executing - all other PROCEDUREs. +2010-06-17 22:07 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * src/common/hbfsapi.c + ! hb_fsFName*(): Fixed to not GPF when called with NULL parameters. + (this also fixes 'hbpp -c' GPF) - Now Harbour and Clipper gives the same results for this code: - proc main() - ? PROCNAME() - proc errorsys() - ? PROCNAME() - init proc INITPROC1() - ? PROCNAME() - init proc clipinit() - ? PROCNAME() - init proc INITPROC2() - ? PROCNAME() - proc __SetHelpK() - ? PROCNAME() - proc HELP() + * config/global.mk + + Will now force HB_BUILD_UNICODE=no on Win9x hosts + (and if HB_BIN_COMPILE is not set to point to a non-UNICODE + Harbour tools to be used. Building UNICODE Harbour on Win9x + is a cross-build situation) + + * config/win/bcc.mk + + Added small trick to make the build work on Win9x host. + + ; Win9x is able to build properly using win/bcc. 2010-06-17 19:28 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * config/global.mk diff --git a/harbour/config/global.mk b/harbour/config/global.mk index 5b8405ad02..1989e30882 100644 --- a/harbour/config/global.mk +++ b/harbour/config/global.mk @@ -416,6 +416,15 @@ ifeq ($(HB_HOST_PLAT),) else ifneq ($(windir)$(WINDIR),) HB_HOST_PLAT := win + ifeq ($(OS),) + HB_HOST_PLAT_WIN9X := yes + ifeq ($(HB_BIN_COMPILE),) + ifneq ($(HB_BUILD_UNICODE),no) + export HB_BUILD_UNICODE := no + $(info ! Win9x/ME host detected: HB_BUILD_UNICODE forced to 'no') + endif + endif + endif else ifeq ($(HB_SHELL),dos) HB_HOST_PLAT := dos diff --git a/harbour/config/win/bcc.mk b/harbour/config/win/bcc.mk index de311ea5a7..63655fa465 100644 --- a/harbour/config/win/bcc.mk +++ b/harbour/config/win/bcc.mk @@ -104,9 +104,8 @@ endif DY := ilink32.exe DFLAGS += -q -Gn -C -aa -Tpd -Gi -x DY_OUT := -DLIBS := $(foreach lib,$(HB_USER_LIBS),$(lib)$(LIB_EXT)) -DLIBS += $(foreach lib,$(LIBS),$(LIB_DIR)/$(lib)$(LIB_EXT)) -DLIBS += $(foreach lib,$(SYSLIBS),$(lib)$(LIB_EXT)) +# NOTE: .lib extension not added to keep line short enough to work on Win9x/ME +DLIBS := $(HB_USER_LIBS) $(LIBS) $(SYSLIBS) cw32mt import32 # NOTE: The empty line directly before 'endef' HAVE TO exist! define dynlib_object @@ -116,7 +115,7 @@ endef define create_dynlib $(if $(wildcard __dyn__.tmp),@$(RM) __dyn__.tmp,) $(foreach file,$^,$(dynlib_object)) - @$(ECHO) $(ECHOQUOTE), $(subst /,$(ECHOBACKSLASH),$(DYN_DIR)/$@),, $(subst /,$(ECHOBACKSLASH),$(DLIBS)) cw32mt.lib import32.lib$(ECHOQUOTE) >> __dyn__.tmp + @$(ECHO) $(ECHOQUOTE), $(subst /,$(ECHOBACKSLASH),$(DYN_DIR)/$@),, $(subst /,$(ECHOBACKSLASH),$(DLIBS))$(ECHOQUOTE) >> __dyn__.tmp $(DY) $(DFLAGS) $(HB_USER_DFLAGS) c0d32.obj @__dyn__.tmp @$(CP) $(subst /,$(DIRSEP),$(DYN_DIR)/$(basename $@)$(LIB_EXT)) $(subst /,$(DIRSEP),$(IMP_FILE)) @$(RM) $(subst /,$(DIRSEP),$(DYN_DIR)/$(basename $@)$(LIB_EXT)) diff --git a/harbour/src/common/hbfsapi.c b/harbour/src/common/hbfsapi.c index 4a81a22316..ce9ad07603 100644 --- a/harbour/src/common/hbfsapi.c +++ b/harbour/src/common/hbfsapi.c @@ -132,78 +132,82 @@ void hb_fsFreeSearchPath( HB_PATHNAMES * pSearchList ) PHB_FNAME hb_fsFNameSplit( const char * pszFileName ) { PHB_FNAME pFileName; - char * pszPos, cDirSep; - int iSize, iPos; HB_TRACE(HB_TR_DEBUG, ("hb_fsFNameSplit(%s)", pszFileName)); HB_TRACE(HB_TR_INFO, ("hb_fsFNameSplit: Filename: |%s|\n", pszFileName)); - iPos = iSize = hb_strnlen( pszFileName, HB_PATH_MAX - 1 ); - cDirSep = ( char ) hb_setGetDirSeparator(); - /* Grab memory, set defaults */ pFileName = ( PHB_FNAME ) hb_xgrab( sizeof( HB_FNAME ) ); - pszPos = pFileName->szBuffer; - pFileName->szPath = pFileName->szName = pFileName->szExtension = pFileName->szDrive = NULL; - /* Find the end of the path part, and find out where the - name+ext starts */ - - while( --iPos >= 0 ) + if( pszFileName ) { - if( pszFileName[ iPos ] == cDirSep || - strchr( HB_OS_PATH_DELIM_CHR_LIST, pszFileName[ iPos ] ) ) + char * pszPos, cDirSep; + int iSize, iPos; + + iPos = iSize = hb_strnlen( pszFileName, HB_PATH_MAX - 1 ); + cDirSep = ( char ) hb_setGetDirSeparator(); + + pszPos = pFileName->szBuffer; + + /* Find the end of the path part, and find out where the + name+ext starts */ + + while( --iPos >= 0 ) { - pFileName->szPath = pszPos; - hb_strncpy( pszPos, pszFileName, iPos + 1 ); - pszPos += iPos + 2; - pszFileName += iPos + 1; - iSize -= iPos + 1; - break; - } - } - - /* From this point pszFileName will point to the name+ext part of the path */ - /* Split the filename part to name and extension */ - iPos = iSize; - while( --iPos > 0 ) - { - if( pszFileName[ iPos ] == '.' ) - { - pFileName->szExtension = pszPos; - hb_strncpy( pszPos, pszFileName + iPos, iSize - iPos ); - pszPos += iSize - iPos + 1; - iSize = iPos; - break; - } - } - if( iSize ) - { - pFileName->szName = pszPos; - hb_strncpy( pszPos, pszFileName, iSize ); - pszPos += iSize + 1; - } - - /* Duplicate the drive letter from the path for easy access on - platforms where applicable. Note that the drive info is always - present also in the path itself. */ - - if( pFileName->szPath ) - { - iPos = 0; - while( iPos < HB_MAX_DRIVE_LENGTH && pFileName->szPath[ iPos ] != '\0' ) - { - if( pFileName->szPath[ iPos ] == ':' ) + if( pszFileName[ iPos ] == cDirSep || + strchr( HB_OS_PATH_DELIM_CHR_LIST, pszFileName[ iPos ] ) ) { - pFileName->szDrive = pszPos; - hb_strncpy( pszPos, pFileName->szPath, iPos ); + pFileName->szPath = pszPos; + hb_strncpy( pszPos, pszFileName, iPos + 1 ); + pszPos += iPos + 2; + pszFileName += iPos + 1; + iSize -= iPos + 1; break; } - ++iPos; + } + + /* From this point pszFileName will point to the name+ext part of the path */ + /* Split the filename part to name and extension */ + iPos = iSize; + while( --iPos > 0 ) + { + if( pszFileName[ iPos ] == '.' ) + { + pFileName->szExtension = pszPos; + hb_strncpy( pszPos, pszFileName + iPos, iSize - iPos ); + pszPos += iSize - iPos + 1; + iSize = iPos; + break; + } + } + if( iSize ) + { + pFileName->szName = pszPos; + hb_strncpy( pszPos, pszFileName, iSize ); + pszPos += iSize + 1; + } + + /* Duplicate the drive letter from the path for easy access on + platforms where applicable. Note that the drive info is always + present also in the path itself. */ + + if( pFileName->szPath ) + { + iPos = 0; + while( iPos < HB_MAX_DRIVE_LENGTH && pFileName->szPath[ iPos ] != '\0' ) + { + if( pFileName->szPath[ iPos ] == ':' ) + { + pFileName->szDrive = pszPos; + hb_strncpy( pszPos, pFileName->szPath, iPos ); + break; + } + ++iPos; + } } } @@ -224,62 +228,65 @@ PHB_FNAME hb_fsFNameSplit( const char * pszFileName ) /* This function joins path, name and extension into a string with a filename */ char * hb_fsFNameMerge( char * pszFileName, PHB_FNAME pFileName ) { - const char * pszName; - char cDirSep; - HB_TRACE(HB_TR_DEBUG, ("hb_fsFNameMerge(%p, %p)", pszFileName, pFileName)); - /* dir separator set by user */ - cDirSep = ( char ) hb_setGetDirSeparator(); - - /* Set the result to an empty string */ - pszFileName[ 0 ] = '\0'; - - /* Strip preceding path separators from the filename */ - pszName = pFileName->szName; - if( pszName && pszName[ 0 ] != '\0' && ( pszName[ 0 ] == cDirSep || - strchr( HB_OS_PATH_DELIM_CHR_LIST, pszName[ 0 ] ) != NULL ) ) - pszName++; - - /* Add path if specified */ - if( pFileName->szPath ) - hb_strncat( pszFileName, pFileName->szPath, HB_PATH_MAX - 1 - 1 ); - - /* If we have a path, append a path separator to the path if there - was none. */ - if( pszFileName[ 0 ] != '\0' && ( pszName || pFileName->szExtension ) ) + if( pszFileName && pFileName ) { - int iLen = ( int ) strlen( pszFileName ) - 1; + const char * pszName; + char cDirSep; - if( iLen < HB_PATH_MAX - 1 - 2 && pszFileName[ iLen ] != cDirSep && - strchr( HB_OS_PATH_DELIM_CHR_LIST, pszFileName[ iLen ] ) == NULL ) + /* dir separator set by user */ + cDirSep = ( char ) hb_setGetDirSeparator(); + + /* Set the result to an empty string */ + pszFileName[ 0 ] = '\0'; + + /* Strip preceding path separators from the filename */ + pszName = pFileName->szName; + if( pszName && pszName[ 0 ] != '\0' && ( pszName[ 0 ] == cDirSep || + strchr( HB_OS_PATH_DELIM_CHR_LIST, pszName[ 0 ] ) != NULL ) ) + pszName++; + + /* Add path if specified */ + if( pFileName->szPath ) + hb_strncat( pszFileName, pFileName->szPath, HB_PATH_MAX - 1 - 1 ); + + /* If we have a path, append a path separator to the path if there + was none. */ + if( pszFileName[ 0 ] != '\0' && ( pszName || pFileName->szExtension ) ) { - pszFileName[ iLen + 1 ] = HB_OS_PATH_DELIM_CHR; - pszFileName[ iLen + 2 ] = '\0'; + int iLen = ( int ) strlen( pszFileName ) - 1; + + if( iLen < HB_PATH_MAX - 1 - 2 && pszFileName[ iLen ] != cDirSep && + strchr( HB_OS_PATH_DELIM_CHR_LIST, pszFileName[ iLen ] ) == NULL ) + { + pszFileName[ iLen + 1 ] = HB_OS_PATH_DELIM_CHR; + pszFileName[ iLen + 2 ] = '\0'; + } } + + /* Add filename (without extension) if specified */ + if( pszName ) + hb_strncat( pszFileName, pszName, HB_PATH_MAX - 1 - 1 ); + + /* Add extension if specified */ + if( pFileName->szExtension ) + { + /* Add a dot if the extension doesn't have it */ + if( pFileName->szExtension[ 0 ] != '\0' && + pFileName->szExtension[ 0 ] != '.' ) + hb_strncat( pszFileName, ".", HB_PATH_MAX - 1 - 1 ); + + hb_strncat( pszFileName, pFileName->szExtension, HB_PATH_MAX - 1 - 1 ); + } + + HB_TRACE(HB_TR_INFO, ("hb_fsFNameMerge: szPath: |%s|\n", pFileName->szPath)); + HB_TRACE(HB_TR_INFO, ("hb_fsFNameMerge: szName: |%s|\n", pFileName->szName)); + HB_TRACE(HB_TR_INFO, ("hb_fsFNameMerge: szExt: |%s|\n", pFileName->szExtension)); + HB_TRACE(HB_TR_INFO, ("hb_fsFNameMerge: szDrive: |%s|\n", pFileName->szDrive)); + HB_TRACE(HB_TR_INFO, ("hb_fsFNameMerge: Filename: |%s|\n", pszFileName)); } - /* Add filename (without extension) if specified */ - if( pszName ) - hb_strncat( pszFileName, pszName, HB_PATH_MAX - 1 - 1 ); - - /* Add extension if specified */ - if( pFileName->szExtension ) - { - /* Add a dot if the extension doesn't have it */ - if( pFileName->szExtension[ 0 ] != '\0' && - pFileName->szExtension[ 0 ] != '.' ) - hb_strncat( pszFileName, ".", HB_PATH_MAX - 1 - 1 ); - - hb_strncat( pszFileName, pFileName->szExtension, HB_PATH_MAX - 1 - 1 ); - } - - HB_TRACE(HB_TR_INFO, ("hb_fsFNameMerge: szPath: |%s|\n", pFileName->szPath)); - HB_TRACE(HB_TR_INFO, ("hb_fsFNameMerge: szName: |%s|\n", pFileName->szName)); - HB_TRACE(HB_TR_INFO, ("hb_fsFNameMerge: szExt: |%s|\n", pFileName->szExtension)); - HB_TRACE(HB_TR_INFO, ("hb_fsFNameMerge: szDrive: |%s|\n", pFileName->szDrive)); - HB_TRACE(HB_TR_INFO, ("hb_fsFNameMerge: Filename: |%s|\n", pszFileName)); - return pszFileName; }