From 6aff42223320252c7a2f1cb862b189de04cb68c2 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sun, 31 Oct 2004 00:00:39 +0000 Subject: [PATCH] 2004-10-31 01:55 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/compiler/cmdcheck.c * replaced some free by hb_xfree * harbour/source/compiler/genc.c * replace non ID characters in name of local symbol table by '_' * harbour/bin/hb-func.sh * set proper X11 path for mixed (32/64bit) systems --- harbour/ChangeLog | 10 ++++++++++ harbour/bin/hb-func.sh | 1 + harbour/source/compiler/cmdcheck.c | 19 +++++------------- harbour/source/compiler/genc.c | 32 +++++++++++++++++++++++------- 4 files changed, 41 insertions(+), 21 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 495011166c..bf40085348 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,16 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2004-10-31 01:55 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/compiler/cmdcheck.c + * replaced some free by hb_xfree + + * harbour/source/compiler/genc.c + * replace non ID characters in name of local symbol table by '_' + + * harbour/bin/hb-func.sh + * set proper X11 path for mixed (32/64bit) systems + 2004-10-24 20:10 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/config/bsd/global.cf + added suppot for HB_COMMERCE and HB_WITHOUT_GTSLN env vars diff --git a/harbour/bin/hb-func.sh b/harbour/bin/hb-func.sh index d2f198ef7e..36b4fc85b0 100644 --- a/harbour/bin/hb-func.sh +++ b/harbour/bin/hb-func.sh @@ -262,6 +262,7 @@ if [ -f "\${HB_LIB_INSTALL}/libgtcrs.a" ]; then fi if [ "\${HB_WITHOUT_X11}" != "yes" ]; then if [ -f "\${HB_LIB_INSTALL}/libgtxvt.a" ] || [ -f "\${HB_LIB_INSTALL}/libgtxwc.a" ]; then + [ -d "/usr/X11R6/lib64" ] && SYSTEM_LIBS="\${SYSTEM_LIBS} -L/usr/X11R6/lib64" SYSTEM_LIBS="\${SYSTEM_LIBS} -L/usr/X11R6/lib -lX11" fi fi diff --git a/harbour/source/compiler/cmdcheck.c b/harbour/source/compiler/cmdcheck.c index 977f72971a..bcdb946de4 100644 --- a/harbour/source/compiler/cmdcheck.c +++ b/harbour/source/compiler/cmdcheck.c @@ -501,7 +501,7 @@ void hb_compChkEnvironVar( char * szSwitch ) } } - free( szOption ); + hb_xfree( szOption ); } break; @@ -522,7 +522,7 @@ void hb_compChkEnvironVar( char * szSwitch ) else hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, szOption, NULL ); - free( szOption ); + hb_xfree( szOption ); } break; @@ -734,14 +734,10 @@ void hb_compChkEnvironVar( char * szSwitch ) case 'o': case 'O': { - unsigned int i = 0; char * szPath = hb_strdup( s + 1 ); - while( i < strlen( szPath ) ) - i++; - szPath[ i ] = '\0'; hb_comp_pOutPath = hb_fsFNameSplit( szPath ); - free( szPath ); + hb_xfree( szPath ); } break; @@ -752,14 +748,9 @@ void hb_compChkEnvironVar( char * szSwitch ) hb_comp_bPPO = 0; else { - unsigned int i = 0; char * szPath = hb_strdup( s + 1 ); - while( i < strlen( szPath ) ) - i++; - szPath[ i ] = '\0'; - hb_comp_pPpoPath = hb_fsFNameSplit( szPath ); - free( szPath ); + hb_xfree( szPath ); hb_comp_bPPO = 1; } @@ -833,7 +824,7 @@ void hb_compChkEnvironVar( char * szSwitch ) hb_comp_szPrefix[ 16 ] = '\0'; strcat( hb_comp_szPrefix, "_" ); - free( szPrefix ); + hb_xfree( szPrefix ); } break; diff --git a/harbour/source/compiler/genc.c b/harbour/source/compiler/genc.c index fe361b08be..7007060507 100644 --- a/harbour/source/compiler/genc.c +++ b/harbour/source/compiler/genc.c @@ -47,7 +47,8 @@ typedef HB_GENC_FUNC_ * HB_GENC_FUNC_PTR; void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language output */ { - char szFileName[ _POSIX_PATH_MAX ]; + char szFileName[ _POSIX_PATH_MAX + 1 ]; + char szModulname[ _POSIX_PATH_MAX + 1 ]; PFUNCTION pFunc = hb_comp_functions.pFirst; PCOMSYMBOL pSym = hb_comp_symbols.pFirst; PCOMDECLARED pDeclared; @@ -140,8 +141,25 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou /* writes the symbol table */ /* Generate the wrapper that will initialize local symbol table */ - hb_strupr( pFileName->szName ); - fprintf( yyc, "\n\nHB_INIT_SYMBOLS_BEGIN( hb_vm_SymbolInit_%s%s )\n", hb_comp_szPrefix, pFileName->szName ); + hb_strncpyUpper( szModulname, pFileName->szName, _POSIX_PATH_MAX ); + /* replace non ID characters in name of local symbol table by '_' */ + { + int iLen = strlen( szModulname ), i; + + for ( i = 0; i < iLen; i++ ) + { + char c = szModulname[ i ]; + + if ( ! ( c >= 'A' && c <= 'Z' ) && + ! ( c >= 'a' && c <= 'z' ) && + ! ( c >= '0' && c <= '9' ) && + ! c == '_' ) + { + szModulname[ i ] = '_'; + } + } + } + fprintf( yyc, "\n\nHB_INIT_SYMBOLS_BEGIN( hb_vm_SymbolInit_%s%s )\n", hb_comp_szPrefix, szModulname ); while( pSym ) { @@ -214,10 +232,10 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou "#elif ! defined(__GNUC__)\n" " #pragma startup hb_vm_SymbolInit_%s%s\n" "#endif\n\n", - hb_comp_szPrefix, pFileName->szName, - hb_comp_szPrefix, pFileName->szName, - hb_comp_szPrefix, pFileName->szName, - hb_comp_szPrefix, pFileName->szName ); + hb_comp_szPrefix, szModulname, + hb_comp_szPrefix, szModulname, + hb_comp_szPrefix, szModulname, + hb_comp_szPrefix, szModulname ); /* Generate functions data */