2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-17 01:32:12 +00:00

Merge from head.

[SVN r34988]
This commit is contained in:
Rene Rivera
2006-08-28 19:33:41 +00:00
parent 58c841799f
commit 6ca25e2de5
2 changed files with 43 additions and 11 deletions

View File

@@ -937,6 +937,17 @@ static void add_hash_key( void* np, void* result_ )
*result = list_new( *result, copystr( *(char**)np ) );
}
static struct hash *get_running_module_vars()
{
struct hash *dummy, *vars = NULL;
/* Get the global variables pointer (that of the currently running module) */
var_hash_swap(&vars);
dummy = vars;
/* Put the global variables pointer in its right place */
var_hash_swap(&dummy);
return vars;
}
LIST *
builtin_varnames(
PARSE *parse,
@@ -946,8 +957,14 @@ builtin_varnames(
LIST *result = L0;
module_t* source_module = bindmodule( arg0 ? arg0->string : 0 );
if ( source_module->variables )
hashenumerate( source_module->variables, add_hash_key, &result );
/* The running module _always_ has its 'variables' member set to NULL
* due to the way enter_module and var_hash_swap work */
struct hash *vars =
source_module == frame->module ?
get_running_module_vars() : source_module->variables;
if ( vars )
hashenumerate( vars, add_hash_key, &result );
return result;
}

View File

@@ -291,8 +291,7 @@ var_string(
}
/* expand the file value into the file reference */
if ( !globs.noexec )
var_string_to_file( split+3, ine-split-4, file_name_s, lol );
var_string_to_file( split+3, ine-split-4, file_name_s, lol );
/* continue on with the expansion */
out += strlen(out);
@@ -352,7 +351,12 @@ void var_string_to_file( const char * in, int insize, const char * out, LOL * lo
{
const char * ine = in+insize;
FILE * out_file = 0;
if ( strcmp( out, "STDOUT" ) == 0 )
int out_debug = DEBUG_EXEC ? 1 : 0;
if ( globs.noexec )
{
out_debug = 1;
}
else if ( strcmp( out, "STDOUT" ) == 0 )
{
out_file = stdout;
}
@@ -382,6 +386,8 @@ void var_string_to_file( const char * in, int insize, const char * out, LOL * lo
string_free(&out_name);
}
if ( out_debug ) printf("\nfile %s\n",out);
while( *in && in < ine )
{
int dollar = 0;
@@ -396,7 +402,8 @@ void var_string_to_file( const char * in, int insize, const char * out, LOL * lo
}
if ( output_0 < output_1 )
{
fwrite(output_0,output_1-output_0,1,out_file);
if ( out_file ) fwrite(output_0,output_1-output_0,1,out_file);
if ( out_debug ) fwrite(output_0,output_1-output_0,1,stdout);
}
output_0 = output_1;
@@ -411,7 +418,7 @@ void var_string_to_file( const char * in, int insize, const char * out, LOL * lo
++output_1;
}
/* If a variable encountered, expand it and and embed the */
/* If a variable encountered, expand it and embed the */
/* space-separated members of the list in the output. */
if( dollar )
@@ -422,26 +429,34 @@ void var_string_to_file( const char * in, int insize, const char * out, LOL * lo
while ( l )
{
fputs( l->string, out_file );
if ( out_file ) fputs( l->string, out_file );
if ( out_debug ) puts( l->string );
l = list_next( l );
if ( l ) fputc( ' ', out_file );
if ( l )
{
if ( out_file ) fputc( ' ', out_file );
if ( out_debug ) fputc( ' ', stdout );
}
}
list_free( l );
}
else if ( output_0 < output_1 )
{
fwrite(output_0,output_1-output_0,1,out_file);
if ( out_file ) fwrite(output_0,output_1-output_0,1,out_file);
if ( out_debug ) fwrite(output_0,output_1-output_0,1,stdout);
}
in = output_1;
}
if ( out_file != stdout && out_file != stderr )
if ( out_file && out_file != stdout && out_file != stderr )
{
fflush( out_file );
fclose( out_file );
}
if ( out_debug ) fputc('\n',stdout);
}
/*