From d2a2b542ead53bc7483816bb899a77a64858b8b0 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 1 May 2000 15:48:24 +0000 Subject: [PATCH] 20000501-17:42 GMT+1 Victor Szakats --- harbour/ChangeLog | 19 ++++ harbour/include/hbcomp.h | 1 + harbour/makefile.bc | 6 +- harbour/source/common/hbver.c | 140 +++++++++++++++++++++++++++++ harbour/source/compiler/cmdcheck.c | 39 +++++--- harbour/source/compiler/harbour.c | 20 +++++ harbour/source/compiler/hbgenerr.c | 8 +- harbour/source/vm/cmdarg.c | 121 +------------------------ 8 files changed, 213 insertions(+), 141 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 110b0ce20e..af66aaf5b7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,22 @@ +20000501-17:42 GMT+1 Victor Szakats + + * source/vm/cmdarg.c + * source/common/hbver.c + * include/hbcomp.h + * source/compiler/harbour.c + * source/compiler/cmdcheck.c + + Added /BUILD option for the compiler. + This option will now also print the platform and Harbour versions. + ! Fixed check for /CREDIT switch. + + * source/compiler/hbgenerr.c + * Some small cleanups on the error texts. + + * makefile.bc + - Removed duplicated and Borland only default language selection. + This feature is already built in to HBSETUP.H, so there's no + point to duplicate it. Or I'm missing something obvious. + 20000501-16:08 GMT+1 Victor Szakats * include/hbpcode.h diff --git a/harbour/include/hbcomp.h b/harbour/include/hbcomp.h index fe65bee5a6..35ff0a2136 100644 --- a/harbour/include/hbcomp.h +++ b/harbour/include/hbcomp.h @@ -339,6 +339,7 @@ extern char * hb_comp_szAnnounce; extern PHB_FNAME hb_comp_pOutPath; extern BOOL hb_comp_bCredits; +extern BOOL hb_comp_bBuildInfo; extern BOOL hb_comp_bLogo; extern BOOL hb_comp_bSyntaxCheckOnly; extern int hb_comp_iLanguage; diff --git a/harbour/makefile.bc b/harbour/makefile.bc index f27d3390ec..0c9572e5be 100644 --- a/harbour/makefile.bc +++ b/harbour/makefile.bc @@ -59,9 +59,7 @@ ARFLAGS = /P32 !if !$d(BCC_NOOPTIM) CFLAGS = -O2 $(CFLAGS) !endif -!if !$d(HB_LANG_DEFAULT) -HB_LANG_DEFAULT=EN -!endif + # # Directory macros. These should never have to change. # @@ -85,7 +83,7 @@ HBPP_DIR = utils\hbpp # C compiler definition and C flags. These should never have to change. # -CFLAGS = -I$(INCLUDE_DIR) -d $(C_USR) $(CFLAGS) -DHB_LANG_DEFAULT=$(HB_LANG_DEFAULT) +CFLAGS = -I$(INCLUDE_DIR) -d $(C_USR) $(CFLAGS) CLIBFLAGS = -c $(CFLAGS) $(CLIBFLAGS) CLIBFLAGSDEBUG = -v $(CLIBFLAGS) HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w -es2 -gc0 $(PRG_USR) $(HARBOURFLAGS) diff --git a/harbour/source/common/hbver.c b/harbour/source/common/hbver.c index f478866274..f4644a7b8d 100644 --- a/harbour/source/common/hbver.c +++ b/harbour/source/common/hbver.c @@ -395,3 +395,143 @@ char * hb_verHarbour( void ) return pszVersion; } +void hb_verBuildInfo( void ) +{ + hb_conOutErr( "Harbour Build Info", 0 ); + hb_conOutErr( hb_conNewLine(), 0 ); + hb_conOutErr( "---------------------------", 0 ); + hb_conOutErr( hb_conNewLine(), 0 ); + + { + char * pszVersion = hb_verHarbour(); + hb_conOutErr( "Version: ", 0 ); + hb_conOutErr( pszVersion, 0 ); + hb_conOutErr( hb_conNewLine(), 0 ); + hb_xfree( pszVersion ); + } + + { + char * pszVersion = hb_verPlatform(); + hb_conOutErr( "Platform: ", 0 ); + hb_conOutErr( pszVersion, 0 ); + hb_conOutErr( hb_conNewLine(), 0 ); + hb_xfree( pszVersion ); + } + + { + char * pszVersion = hb_verCompiler(); + hb_conOutErr( "Compiler: ", 0 ); + hb_conOutErr( pszVersion, 0 ); + hb_conOutErr( hb_conNewLine(), 0 ); + hb_xfree( pszVersion ); + } + + hb_conOutErr( hb_conNewLine(), 0 ); + + hb_conOutErr( "Harbour extensions: ", 0 ); +#if defined( HB_EXTENSION ) + hb_conOutErr( "Yes", 0 ); +#else + hb_conOutErr( "No", 0 ); +#endif + hb_conOutErr( hb_conNewLine(), 0 ); + + hb_conOutErr( "CA-Clipper 5.2e undocumented: ", 0 ); +#if defined( HB_C52_UNDOC ) + hb_conOutErr( "Yes", 0 ); +#else + hb_conOutErr( "No", 0 ); +#endif + hb_conOutErr( hb_conNewLine(), 0 ); + + hb_conOutErr( "CA-Clipper 5.2e strict compatibility: ", 0 ); +#if defined( HB_C52_STRICT ) + hb_conOutErr( "Yes", 0 ); +#else + hb_conOutErr( "No", 0 ); +#endif + hb_conOutErr( hb_conNewLine(), 0 ); + + hb_conOutErr( "CA-Clipper 5.3x compatible extensions: ", 0 ); +#if defined( HB_COMPAT_C53 ) + hb_conOutErr( "Yes", 0 ); +#else + hb_conOutErr( "No", 0 ); +#endif + hb_conOutErr( hb_conNewLine(), 0 ); + + hb_conOutErr( "Alaska Xbase++ compatible extensions: ", 0 ); +#if defined( HB_COMPAT_XPP ) + hb_conOutErr( "Yes", 0 ); +#else + hb_conOutErr( "No", 0 ); +#endif + hb_conOutErr( hb_conNewLine(), 0 ); + + hb_conOutErr( "CA-Visual Objects compatible extensions: ", 0 ); +#if defined( HB_COMPAT_VO ) + hb_conOutErr( "Yes", 0 ); +#else + hb_conOutErr( "No", 0 ); +#endif + hb_conOutErr( hb_conNewLine(), 0 ); + + hb_conOutErr( "Multisoft Flagship compatible extensions: ", 0 ); +#if defined( HB_FLAGSHIP_VO ) + hb_conOutErr( "Yes", 0 ); +#else + hb_conOutErr( "No", 0 ); +#endif + hb_conOutErr( hb_conNewLine(), 0 ); + + hb_conOutErr( "Microsoft FoxPro compatible extensions: ", 0 ); +#if defined( HB_FOXPRO_VO ) + hb_conOutErr( "Yes", 0 ); +#else + hb_conOutErr( "No", 0 ); +#endif + hb_conOutErr( hb_conNewLine(), 0 ); + + hb_conOutErr( "dBase compatible extensions: ", 0 ); +#if defined( HB_DBASE_VO ) + hb_conOutErr( "Yes", 0 ); +#else + hb_conOutErr( "No", 0 ); +#endif + hb_conOutErr( hb_conNewLine(), 0 ); + + hb_conOutErr( "Object file generation support: ", 0 ); +#if defined( HARBOUR_OBJ_GENERATION ) + hb_conOutErr( "Yes", 0 ); +#else + hb_conOutErr( "No", 0 ); +#endif + hb_conOutErr( hb_conNewLine(), 0 ); + + hb_conOutErr( "ANSI C usage: ", 0 ); +#if defined( HARBOUR_STRICT_ANSI_C ) + hb_conOutErr( "Strict", 0 ); +#else + hb_conOutErr( "Non strict", 0 ); +#endif + hb_conOutErr( hb_conNewLine(), 0 ); + + hb_conOutErr( "Compiler YACC debug mode: ", 0 ); +#if defined( HARBOUR_YYDEBUG ) + hb_conOutErr( "On", 0 ); +#else + hb_conOutErr( "Off", 0 ); +#endif + hb_conOutErr( hb_conNewLine(), 0 ); + + { + char buffer[ 64 ]; + sprintf( buffer, "Maximum symbol name length: %i", HB_SYMBOL_NAME_LEN ); + hb_conOutErr( buffer, 0 ); + hb_conOutErr( hb_conNewLine(), 0 ); + } + + hb_conOutErr( "---------------------------", 0 ); + hb_conOutErr( hb_conNewLine(), 0 ); +} + diff --git a/harbour/source/compiler/cmdcheck.c b/harbour/source/compiler/cmdcheck.c index ffda517051..afa2722dd2 100644 --- a/harbour/source/compiler/cmdcheck.c +++ b/harbour/source/compiler/cmdcheck.c @@ -194,30 +194,43 @@ void hb_compChkEnvironVar( char * szSwitch ) case 'b': case 'B': - hb_comp_bDebugInfo = TRUE; - hb_comp_bLineNumbers = TRUE; + { + unsigned int i = 0; + char * szOption = hb_strupr( hb_strdup( s ) ); + while( i < strlen( szOption ) && !HB_ISOPTSEP( szOption[ i ] ) ) + i++; + szOption[ i ] = '\0'; + + if( strcmp( szOption, "BUILD" ) == 0 ) + hb_comp_bBuildInfo = TRUE; + else + { + hb_comp_bDebugInfo = TRUE; + hb_comp_bLineNumbers = TRUE; + } + + free( szOption ); + } break; case 'c': case 'C': { unsigned int i = 0; - char * szCredits = hb_strupr( hb_strdup( s ) ); - while( i < strlen( szCredits ) && !HB_ISOPTSEP( szCredits[ i ] ) ) + char * szOption = hb_strupr( hb_strdup( s ) ); + while( i < strlen( szOption ) && !HB_ISOPTSEP( szOption[ i ] ) ) i++; - szCredits[ i ] = '\0'; + szOption[ i ] = '\0'; - if( strcmp( szCredits, "CREDITS" ) || - strcmp( szCredits, "CREDIT" ) || - strcmp( szCredits, "CREDI" ) || - strcmp( szCredits, "CRED" ) ) - { + if( strcmp( szOption, "CREDITS" ) == 0 || + strcmp( szOption, "CREDIT" ) == 0 || + strcmp( szOption, "CREDI" ) == 0 || + strcmp( szOption, "CRED" ) == 0 ) hb_comp_bCredits = TRUE; - } else - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, szCredits, NULL ); + hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, szOption, NULL ); - free( szCredits ); + free( szOption ); } break; diff --git a/harbour/source/compiler/harbour.c b/harbour/source/compiler/harbour.c index 32f452887d..e2e379ab66 100644 --- a/harbour/source/compiler/harbour.c +++ b/harbour/source/compiler/harbour.c @@ -111,6 +111,7 @@ int hb_comp_iStaticCnt; /* number of defined stat int hb_comp_iVarScope; /* holds the scope for next variables to be defined */ PHB_FNAME hb_comp_pOutPath = NULL; BOOL hb_comp_bCredits = FALSE; /* print credits */ +BOOL hb_comp_bBuildInfo = FALSE; /* print build info */ BOOL hb_comp_bLogo = TRUE; /* print logo */ BOOL hb_comp_bSyntaxCheckOnly = FALSE; /* syntax check only */ int hb_comp_iLanguage = LANG_C; /* default Harbour generated output language */ @@ -153,6 +154,13 @@ int main( int argc, char * argv[] ) if( hb_comp_bLogo ) hb_compPrintLogo(); + if( hb_comp_bBuildInfo ) + { + printf( "\n" ); + hb_verBuildInfo(); + return iStatus; + } + if( hb_comp_bCredits ) { hb_compPrintCredits(); @@ -374,6 +382,18 @@ void hb_xfree( void * pMem ) /* frees fixed memory */ hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_MEMFREE, NULL, NULL ); } +void hb_conOutErr( char * pStr, ULONG ulLen ) +{ + HB_SYMBOL_UNUSED( ulLen ); + + printf( pStr ); +} + +char * hb_conNewLine( void ) +{ + return "\n"; +} + /* ------------------------------------------------------------------------- */ /** ACTIONS **/ /* ------------------------------------------------------------------------- */ diff --git a/harbour/source/compiler/hbgenerr.c b/harbour/source/compiler/hbgenerr.c index a745e0db8e..b08e60ef26 100644 --- a/harbour/source/compiler/hbgenerr.c +++ b/harbour/source/compiler/hbgenerr.c @@ -64,8 +64,8 @@ char * hb_comp_szErrors[] = "Formal parameters already declared", "Invalid %s from within of SEQUENCE code", "Unterminated array index", - "Could not allocate [%s] bytes", - "Could not re-allocate [%s] bytes", + "Could not allocate %s byte(s)", + "Could not reallocate %s byte(s)", "Freeing a NULL memory pointer", "Syntax error: \"%s at \'%s\'\"", "Jump offset too long", @@ -102,8 +102,8 @@ char * hb_comp_szWarnings[] = "3Incompatible operand type: \'%s\' expected: \'%s\'", "3Incompatible operand types: \'%s\' and: \'%s\'", "3Suspicious type in assignment to: \'%s\' expected: \'%s\'", - "3Suspicious operand type: \'UnKnown\' expected: \'%s\'", - "3Can\'t use array index with NON Array", + "3Suspicious operand type: \'unknown\' expected: \'%s\'", + "3Can\'t use array index with non-array", "3Incompatible return value: \'%s\' expected: \'%s\'", "3Invalid number of parameters: \'%s\' expected: \'%s\'", "3Incompatible parameter # %s expected: \'%s\'", diff --git a/harbour/source/vm/cmdarg.c b/harbour/source/vm/cmdarg.c index 20178e22fd..b570a9a1e6 100644 --- a/harbour/source/vm/cmdarg.c +++ b/harbour/source/vm/cmdarg.c @@ -282,125 +282,6 @@ void hb_cmdargProcessVM( void ) } if( hb_cmdargCheck( "BUILD" ) ) - { - hb_conOutErr( "Harbour Compiler Build Info", 0 ); - hb_conOutErr( hb_conNewLine(), 0 ); - hb_conOutErr( "---------------------------", 0 ); - hb_conOutErr( hb_conNewLine(), 0 ); - - { - char * pszVersion = hb_verCompiler(); - hb_conOutErr( "Compiler: ", 0 ); - hb_conOutErr( pszVersion, 0 ); - hb_conOutErr( hb_conNewLine(), 0 ); - hb_xfree( pszVersion ); - } - - hb_conOutErr( "Harbour extensions: ", 0 ); -#if defined( HB_EXTENSION ) - hb_conOutErr( "Yes", 0 ); -#else - hb_conOutErr( "No", 0 ); -#endif - hb_conOutErr( hb_conNewLine(), 0 ); - - hb_conOutErr( "CA-Clipper 5.2e undocumented: ", 0 ); -#if defined( HB_C52_UNDOC ) - hb_conOutErr( "Yes", 0 ); -#else - hb_conOutErr( "No", 0 ); -#endif - hb_conOutErr( hb_conNewLine(), 0 ); - - hb_conOutErr( "CA-Clipper 5.2e strict compatibility: ", 0 ); -#if defined( HB_C52_STRICT ) - hb_conOutErr( "Yes", 0 ); -#else - hb_conOutErr( "No", 0 ); -#endif - hb_conOutErr( hb_conNewLine(), 0 ); - - hb_conOutErr( "CA-Clipper 5.3x compatible extensions: ", 0 ); -#if defined( HB_COMPAT_C53 ) - hb_conOutErr( "Yes", 0 ); -#else - hb_conOutErr( "No", 0 ); -#endif - hb_conOutErr( hb_conNewLine(), 0 ); - - hb_conOutErr( "Alaska Xbase++ compatible extensions: ", 0 ); -#if defined( HB_COMPAT_XPP ) - hb_conOutErr( "Yes", 0 ); -#else - hb_conOutErr( "No", 0 ); -#endif - hb_conOutErr( hb_conNewLine(), 0 ); - - hb_conOutErr( "CA-Visual Objects compatible extensions: ", 0 ); -#if defined( HB_COMPAT_VO ) - hb_conOutErr( "Yes", 0 ); -#else - hb_conOutErr( "No", 0 ); -#endif - hb_conOutErr( hb_conNewLine(), 0 ); - - hb_conOutErr( "Multisoft Flagship compatible extensions: ", 0 ); -#if defined( HB_FLAGSHIP_VO ) - hb_conOutErr( "Yes", 0 ); -#else - hb_conOutErr( "No", 0 ); -#endif - hb_conOutErr( hb_conNewLine(), 0 ); - - hb_conOutErr( "Microsoft FoxPro compatible extensions: ", 0 ); -#if defined( HB_FOXPRO_VO ) - hb_conOutErr( "Yes", 0 ); -#else - hb_conOutErr( "No", 0 ); -#endif - hb_conOutErr( hb_conNewLine(), 0 ); - - hb_conOutErr( "dBase compatible extensions: ", 0 ); -#if defined( HB_DBASE_VO ) - hb_conOutErr( "Yes", 0 ); -#else - hb_conOutErr( "No", 0 ); -#endif - hb_conOutErr( hb_conNewLine(), 0 ); - - hb_conOutErr( "Object file generation support: ", 0 ); -#if defined( HARBOUR_OBJ_GENERATION ) - hb_conOutErr( "Yes", 0 ); -#else - hb_conOutErr( "No", 0 ); -#endif - hb_conOutErr( hb_conNewLine(), 0 ); - - hb_conOutErr( "ANSI C usage: ", 0 ); -#if defined( HARBOUR_STRICT_ANSI_C ) - hb_conOutErr( "Strict", 0 ); -#else - hb_conOutErr( "Non strict", 0 ); -#endif - hb_conOutErr( hb_conNewLine(), 0 ); - - hb_conOutErr( "Compiler YACC debug mode: ", 0 ); -#if defined( HARBOUR_YYDEBUG ) - hb_conOutErr( "On", 0 ); -#else - hb_conOutErr( "Off", 0 ); -#endif - hb_conOutErr( hb_conNewLine(), 0 ); - - { - char buffer[ 64 ]; - sprintf( buffer, "Maximum symbol name length: %i", HB_SYMBOL_NAME_LEN ); - hb_conOutErr( buffer, 0 ); - hb_conOutErr( hb_conNewLine(), 0 ); - } - - hb_conOutErr( "---------------------------", 0 ); - hb_conOutErr( hb_conNewLine(), 0 ); - } + hb_verBuildInfo(); }