20000403-22:20 GMT+1 Victor Szakats <info@szelvesz.hu>

This commit is contained in:
Viktor Szakats
2000-04-03 20:18:59 +00:00
parent 463a7297b4
commit c58df7356f
5 changed files with 74 additions and 24 deletions

View File

@@ -1,3 +1,12 @@
20000403-22:20 GMT+1 Victor Szakats <info@szelvesz.hu>
* source/pp/stdalone/hbpp.c
* source/compiler/cmdcheck.c
* source/compiler/harbour.c
* include/hbcomp.h
! Fixed handling of the /D switch, it broke when introducing the
multiple filenames at the command line feature.
20000403-21:08 GMT+1 Victor Szakats <info@szelvesz.hu>
* source/rtl/readvar.prg

View File

@@ -291,7 +291,8 @@ extern HB_EXPR_PTR hb_compWarnMeaningless( HB_EXPR_PTR );
extern void hb_compChkCompilerSwitch( int, char * Args[] );
extern void hb_compChkEnvironVar( char * );
extern void hb_compCheckPaths( void );
extern void hb_compChkPaths( void );
extern void hb_compChkDefines( int iArg, char * Args[] );
extern void hb_compPrintUsage( char * );
extern void hb_compPrintCredits( void );

View File

@@ -39,7 +39,7 @@
*
* Copyright 1999 {list of individual authors and e-mail addresses}
* hb_compChkEnvironVar()
* hb_compCheckPaths()
* hb_compChkPaths()
* AddSearchPath()
*
* Copyright 1999 Victor Szakats <info@szelvesz.hu>
@@ -220,25 +220,9 @@ void hb_compChkEnvironVar( char * szSwitch )
}
break;
/* QUESTION:
Why not add support for multiple defines ?
-DONE;TWO=2;THREE
*/
case 'd':
case 'D': /* defines a Lex #define from the environment */
{
unsigned int i = 0;
char * szDefText = hb_strdup( s + 1 );
while( i < strlen( szDefText ) && !HB_ISOPTSEP( szDefText[ i ] ) )
i++;
szDefText[ i ] = '\0';
if( szDefText )
{
hb_pp_AddDefine( szDefText, 0 );
}
free( szDefText );
}
case 'D':
/* NOTE: Ignore these -d switches will be processed separately */
break;
case 'e':
@@ -469,7 +453,7 @@ void hb_compChkEnvironVar( char * szSwitch )
}
}
void hb_compCheckPaths( void )
void hb_compChkPaths( void )
{
char * szInclude = getenv( "INCLUDE" );
@@ -489,3 +473,56 @@ void hb_compCheckPaths( void )
}
}
static void hb_compChkDefineSwitch( char * pszSwitch )
{
if( pszSwitch && HB_ISOPTSEP( pszSwitch[ 0 ] ) &&
( pszSwitch[ 1 ] == 'd' || pszSwitch[ 1 ] == 'D' ) )
{
char * szDefText = hb_strdup( pszSwitch + 2 );
unsigned int i = 0;
while( i < strlen( szDefText ) && ! HB_ISOPTSEP( szDefText[ i ] ) )
i++;
szDefText[ i ] = '\0';
if( szDefText )
hb_pp_AddDefine( szDefText, 0 );
free( szDefText );
}
}
void hb_compChkDefines( int iArg, char * Args[] )
{
/* Chech the environment variables */
{
/* NOTE: CLIPPERCMD enviroment variable is overriden
if HARBOURCMD exists */
char * szStrEnv = getenv( "HARBOURCMD" );
if( ! szStrEnv )
szStrEnv = getenv( "CLIPPERCMD" );
if( szStrEnv )
{
char * szSwitch = strtok( szStrEnv, " " );
/* Check the environment var while it isn't empty. */
while( szSwitch != NULL )
{
hb_compChkDefineSwitch( szSwitch );
szSwitch = strtok( NULL, " " );
}
}
}
/* Check the command line options */
{
int i;
/* Check all switches in command line They start with an OS_OPT_DELIMITER
char */
for( i = 0; i < iArg; i++ )
hb_compChkDefineSwitch( Args[ i ] );
}
}

View File

@@ -151,7 +151,7 @@ int main( int argc, char * argv[] )
{
if( !bAnyFiles )
{
hb_compCheckPaths();
hb_compChkPaths();
bAnyFiles = TRUE;
}
@@ -184,6 +184,9 @@ int main( int argc, char * argv[] )
/* Initialization of preprocessor arrays */
hb_pp_Init();
/* Add /D command line or envvar defines */
hb_compChkDefines( argc, argv );
/* Initialize support variables */
hb_compInitVars();

View File

@@ -95,6 +95,8 @@ int main( int argc, char * argv[] )
HB_VER_MAJOR, HB_VER_MINOR, HB_VER_REVISION, HB_VER_BUILD, HB_VER_YEAR, HB_VER_MONTH, HB_VER_DAY );
printf( "Copyright 1999-2000, http://www.harbour-project.org\n" );
hb_pp_Init();
while( iArg < argc )
{
if( HB_ISOPTSEP(argv[ iArg ][ 0 ]))
@@ -210,8 +212,6 @@ int main( int argc, char * argv[] )
}
}
hb_pp_Init();
while( hb_pp_Parse( handl_o ) > 0 );
fclose( hb_comp_files.pLast->handle );
hb_xfree( hb_comp_files.pLast->pBuffer );