mirror of
https://github.com/boostorg/build.git
synced 2026-02-12 12:02:24 +00:00
Make list_new take one argument. Rename the two argument form to list_push_back.
[SVN r77522]
This commit is contained in:
@@ -463,7 +463,7 @@ LIST * builtin_calc( FRAME * frame, int flags )
|
||||
}
|
||||
|
||||
sprintf( buffer, "%ld", result_value );
|
||||
result = list_new( result, object_new( buffer ) );
|
||||
result = list_push_back( result, object_new( buffer ) );
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -660,7 +660,7 @@ static void builtin_glob_back
|
||||
{
|
||||
if ( !glob( object_str( list_item( iter ) ), buf->value ) )
|
||||
{
|
||||
globbing->results = list_new( globbing->results, object_copy( file ) );
|
||||
globbing->results = list_push_back( globbing->results, object_copy( file ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -683,7 +683,7 @@ static LIST * downcase_list( LIST * in )
|
||||
{
|
||||
string_append( s, object_str( list_item( iter ) ) );
|
||||
downcase_inplace( s->value );
|
||||
result = list_append( result, list_new( L0, object_new( s->value ) ) );
|
||||
result = list_push_back( result, object_new( s->value ) );
|
||||
string_truncate( s, 0 );
|
||||
}
|
||||
|
||||
@@ -740,14 +740,14 @@ static LIST * append_if_exists( LIST * list, OBJECT * file )
|
||||
time_t time;
|
||||
timestamp( file, &time );
|
||||
return time > 0
|
||||
? list_new( list, object_copy( file ) )
|
||||
? list_push_back( list, object_copy( file ) )
|
||||
: list;
|
||||
}
|
||||
|
||||
|
||||
LIST * glob1( OBJECT * dirname, OBJECT * pattern )
|
||||
{
|
||||
LIST * plist = list_new( L0, object_copy(pattern) );
|
||||
LIST * plist = list_new( object_copy(pattern) );
|
||||
struct globbing globbing;
|
||||
|
||||
globbing.results = L0;
|
||||
@@ -811,7 +811,7 @@ LIST * glob_recursive( const char * pattern )
|
||||
|
||||
dirs = has_wildcards( dirname->value )
|
||||
? glob_recursive( dirname->value )
|
||||
: list_new( dirs, object_new( dirname->value ) );
|
||||
: list_push_back( dirs, object_new( dirname->value ) );
|
||||
|
||||
if ( has_wildcards( basename->value ) )
|
||||
{
|
||||
@@ -920,7 +920,7 @@ LIST * builtin_match( FRAME * frame, int flags )
|
||||
for ( i = 1; i <= top; ++i )
|
||||
{
|
||||
string_append_range( buf, re->startp[ i ], re->endp[ i ] );
|
||||
result = list_new( result, object_new( buf->value ) );
|
||||
result = list_push_back( result, object_new( buf->value ) );
|
||||
string_truncate( buf, 0 );
|
||||
}
|
||||
}
|
||||
@@ -948,7 +948,7 @@ LIST * builtin_split_by_characters( FRAME * frame, int flags )
|
||||
t = strtok( buf->value, delimiters) ;
|
||||
while ( t )
|
||||
{
|
||||
result = list_new( result, object_new( t ) );
|
||||
result = list_push_back( result, object_new( t ) );
|
||||
t = strtok( NULL, delimiters );
|
||||
}
|
||||
|
||||
@@ -990,7 +990,7 @@ static void add_rule_name( void * r_, void * result_ )
|
||||
RULE * r = (RULE *)r_;
|
||||
LIST * * result = (LIST * *)result_;
|
||||
if ( r->exported )
|
||||
*result = list_new( *result, object_copy( r->name ) );
|
||||
*result = list_push_back( *result, object_copy( r->name ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -1019,7 +1019,7 @@ LIST * builtin_rulenames( FRAME * frame, int flags )
|
||||
static void add_hash_key( void * np, void * result_ )
|
||||
{
|
||||
LIST * * result = (LIST * *)result_;
|
||||
*result = list_new( *result, object_copy( *(OBJECT * *)np ) );
|
||||
*result = list_push_back( *result, object_copy( *(OBJECT * *)np ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -1272,10 +1272,10 @@ LIST * builtin_backtrace( FRAME * frame, int flags )
|
||||
string_append( module_name, object_str( frame->module->name ) );
|
||||
string_append( module_name, "." );
|
||||
}
|
||||
result = list_new( result, object_new( file ) );
|
||||
result = list_new( result, object_new( buf ) );
|
||||
result = list_new( result, object_new( module_name->value ) );
|
||||
result = list_new( result, object_new( frame->rulename ) );
|
||||
result = list_push_back( result, object_new( file ) );
|
||||
result = list_push_back( result, object_new( buf ) );
|
||||
result = list_push_back( result, object_new( module_name->value ) );
|
||||
result = list_push_back( result, object_new( frame->rulename ) );
|
||||
string_free( module_name );
|
||||
}
|
||||
return result;
|
||||
@@ -1306,7 +1306,7 @@ LIST * builtin_caller_module( FRAME * frame, int flags )
|
||||
if ( frame->module == root_module() )
|
||||
return L0;
|
||||
else
|
||||
return list_new( L0, object_copy( frame->module->name ) );
|
||||
return list_new( object_copy( frame->module->name ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -1412,7 +1412,7 @@ LIST * builtin_update_now( FRAME * frame, int flags )
|
||||
last_update_now_status = status;
|
||||
|
||||
if ( status == 0 )
|
||||
return list_new( L0, object_copy( constant_ok ) );
|
||||
return list_new( object_copy( constant_ok ) );
|
||||
else
|
||||
return L0;
|
||||
}
|
||||
@@ -1578,7 +1578,7 @@ LIST * builtin_normalize_path( FRAME * frame, int flags )
|
||||
string_free( out );
|
||||
string_free( in );
|
||||
|
||||
return list_new( L0, result );
|
||||
return list_new( result );
|
||||
}
|
||||
|
||||
|
||||
@@ -1619,7 +1619,7 @@ LIST * builtin_has_native_rule( FRAME * frame, int flags )
|
||||
{
|
||||
int expected_version = atoi( object_str( list_front( version ) ) );
|
||||
if ( np->version == expected_version )
|
||||
return list_new( L0, object_copy( constant_true ) );
|
||||
return list_new( object_copy( constant_true ) );
|
||||
}
|
||||
return L0;
|
||||
}
|
||||
@@ -1653,8 +1653,8 @@ LIST * builtin_nearest_user_location( FRAME * frame, int flags )
|
||||
|
||||
get_source_line( nearest_user_frame, &file, &line );
|
||||
sprintf( buf, "%d", line );
|
||||
result = list_new( result, object_new( file ) );
|
||||
result = list_new( result, object_new( buf ) );
|
||||
result = list_push_back( result, object_new( file ) );
|
||||
result = list_push_back( result, object_new( buf ) );
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1664,7 +1664,7 @@ LIST * builtin_check_if_file( FRAME * frame, int flags )
|
||||
{
|
||||
LIST * name = lol_get( frame->args, 0 );
|
||||
return file_is_file( list_front( name ) ) == 1
|
||||
? list_new( L0, object_copy( constant_true ) )
|
||||
? list_new( object_copy( constant_true ) )
|
||||
: L0 ;
|
||||
}
|
||||
|
||||
@@ -1687,7 +1687,7 @@ LIST * builtin_md5( FRAME * frame, int flags )
|
||||
for (di = 0; di < 16; ++di)
|
||||
sprintf( hex_output + di * 2, "%02x", digest[di] );
|
||||
|
||||
return list_new( L0, object_new( hex_output ) );
|
||||
return list_new( object_new( hex_output ) );
|
||||
}
|
||||
|
||||
LIST *builtin_file_open( FRAME * frame, int flags )
|
||||
@@ -1709,7 +1709,7 @@ LIST *builtin_file_open( FRAME * frame, int flags )
|
||||
if (fd != -1)
|
||||
{
|
||||
sprintf( buffer, "%d", fd );
|
||||
return list_new( L0, object_new( buffer ) );
|
||||
return list_new( object_new( buffer ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1725,7 +1725,7 @@ LIST *builtin_pad( FRAME * frame, int flags )
|
||||
int current = strlen( object_str( string ) );
|
||||
int desired = atoi( width_s );
|
||||
if (current >= desired)
|
||||
return list_new (L0, object_copy( string ) );
|
||||
return list_new( object_copy( string ) );
|
||||
else
|
||||
{
|
||||
char * buffer = BJAM_MALLOC( desired + 1 );
|
||||
@@ -1736,7 +1736,7 @@ LIST *builtin_pad( FRAME * frame, int flags )
|
||||
for ( i = current; i < desired; ++i )
|
||||
buffer[i] = ' ';
|
||||
buffer[desired] = '\0';
|
||||
result = list_new( L0, object_new( buffer ) );
|
||||
result = list_new( object_new( buffer ) );
|
||||
BJAM_FREE( buffer );
|
||||
return result;
|
||||
}
|
||||
@@ -1762,7 +1762,7 @@ LIST *builtin_self_path( FRAME * frame, int flags )
|
||||
char * p = executable_path( saved_argv0 );
|
||||
if ( p )
|
||||
{
|
||||
LIST* result = list_new( L0, object_new( p ) );
|
||||
LIST* result = list_new( object_new( p ) );
|
||||
free( p );
|
||||
return result;
|
||||
}
|
||||
@@ -1778,7 +1778,7 @@ LIST *builtin_makedir( FRAME * frame, int flags )
|
||||
|
||||
if ( file_mkdir( object_str( list_front( path ) ) ) == 0 )
|
||||
{
|
||||
LIST * result = list_new ( L0, object_copy( list_front( path ) ) );
|
||||
LIST * result = list_new( object_copy( list_front( path ) ) );
|
||||
return result;
|
||||
}
|
||||
else
|
||||
@@ -1875,7 +1875,7 @@ void lol_build( LOL * lol, const char * * elements )
|
||||
}
|
||||
else
|
||||
{
|
||||
l = list_new( l, object_new( *elements ) );
|
||||
l = list_push_back( l, object_new( *elements ) );
|
||||
}
|
||||
++elements;
|
||||
}
|
||||
@@ -1918,7 +1918,7 @@ PyObject* bjam_call( PyObject * self, PyObject * args )
|
||||
PyObject * a = PyTuple_GetItem( args, i );
|
||||
if ( PyString_Check( a ) )
|
||||
{
|
||||
lol_add( inner->args, list_new( 0, object_new(
|
||||
lol_add( inner->args, list_new( object_new(
|
||||
PyString_AsString( a ) ) ) );
|
||||
}
|
||||
else if ( PySequence_Check( a ) )
|
||||
@@ -1936,7 +1936,7 @@ PyObject* bjam_call( PyObject * self, PyObject * args )
|
||||
printf( "Invalid parameter type passed from Python\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
l = list_new( l, object_new( s ) );
|
||||
l = list_push_back( l, object_new( s ) );
|
||||
Py_DECREF( e );
|
||||
}
|
||||
lol_add( inner->args, l );
|
||||
@@ -2048,7 +2048,7 @@ PyObject * bjam_define_action( PyObject * self, PyObject * args )
|
||||
"bind list has non-string type" );
|
||||
return NULL;
|
||||
}
|
||||
bindlist = list_new( bindlist, object_new( PyString_AsString( next ) ) );
|
||||
bindlist = list_push_back( bindlist, object_new( PyString_AsString( next ) ) );
|
||||
}
|
||||
|
||||
name_str = object_new( name );
|
||||
@@ -2285,7 +2285,7 @@ LIST * builtin_shell( FRAME * frame, int flags )
|
||||
exit_status = pclose( p );
|
||||
|
||||
/* The command output is returned first. */
|
||||
result = list_new( L0, object_new( s.value ) );
|
||||
result = list_new( object_new( s.value ) );
|
||||
string_free( &s );
|
||||
|
||||
/* The command exit result next. */
|
||||
@@ -2296,7 +2296,7 @@ LIST * builtin_shell( FRAME * frame, int flags )
|
||||
else
|
||||
exit_status = -1;
|
||||
sprintf( buffer, "%d", exit_status );
|
||||
result = list_new( result, object_new( buffer ) );
|
||||
result = list_push_back( result, object_new( buffer ) );
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -136,7 +136,7 @@ void file_dirscan( OBJECT * dir, scanback func, void * closure )
|
||||
string_truncate( filename, 0 );
|
||||
path_build( &f, filename );
|
||||
|
||||
files = list_new( files, object_new(filename->value) );
|
||||
files = list_push_back( files, object_new(filename->value) );
|
||||
ff = file_info( filename->value );
|
||||
ff->is_file = finfo->ff_attrib & FA_DIREC ? 0 : 1;
|
||||
ff->is_dir = finfo->ff_attrib & FA_DIREC ? 1 : 0;
|
||||
@@ -170,7 +170,7 @@ void file_dirscan( OBJECT * dir, scanback func, void * closure )
|
||||
|
||||
filename_obj = object_new( filename->value );
|
||||
path_add_key( filename_obj );
|
||||
files = list_new( files, filename_obj );
|
||||
files = list_push_back( files, filename_obj );
|
||||
ff = file_info( filename_obj );
|
||||
ff->is_file = finfo->attrib & _A_SUBDIR ? 0 : 1;
|
||||
ff->is_dir = finfo->attrib & _A_SUBDIR ? 1 : 0;
|
||||
|
||||
@@ -95,5 +95,5 @@ void file_done()
|
||||
|
||||
void file_remove_atexit( OBJECT * path )
|
||||
{
|
||||
files_to_remove = list_new( files_to_remove, object_copy( path ) );
|
||||
files_to_remove = list_push_back( files_to_remove, object_copy( path ) );
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ void file_dirscan( OBJECT * dir, scanback func, void * closure )
|
||||
path_build( &f, filename, 0 );
|
||||
|
||||
filename_obj = object_new( filename->value );
|
||||
files = list_new( files, filename_obj );
|
||||
files = list_push_back( files, filename_obj );
|
||||
file_query( filename_obj );
|
||||
}
|
||||
string_free( filename );
|
||||
|
||||
@@ -795,7 +795,7 @@ static LIST * apply_subscript( STACK * s )
|
||||
get_iters( subscript, &iter, &end, length );
|
||||
for ( ; iter != end; iter = list_next( iter ) )
|
||||
{
|
||||
result = list_new( result, object_copy( list_item( iter ) ) );
|
||||
result = list_push_back( result, object_copy( list_item( iter ) ) );
|
||||
}
|
||||
}
|
||||
string_free( buf );
|
||||
@@ -868,7 +868,7 @@ static LIST * apply_modifiers_empty( LIST * result, string * buf, VAR_EDITS * ed
|
||||
/** FIXME: is empty.ptr always null-terminated? */
|
||||
var_edit_file( edits[i].empty.ptr, buf, edits + i );
|
||||
var_edit_shift( buf, 0, edits + i );
|
||||
result = list_new( result, object_new( buf->value ) );
|
||||
result = list_push_back( result, object_new( buf->value ) );
|
||||
string_truncate( buf, 0 );
|
||||
}
|
||||
}
|
||||
@@ -893,7 +893,7 @@ static LIST * apply_modifiers_non_empty( LIST * result, string * buf, VAR_EDITS
|
||||
var_edit_file( object_str( list_item( iter ) ), buf, edits + i );
|
||||
var_edit_shift( buf, size, edits + i );
|
||||
}
|
||||
result = list_new( result, object_new( buf->value ) );
|
||||
result = list_push_back( result, object_new( buf->value ) );
|
||||
string_truncate( buf, 0 );
|
||||
}
|
||||
else
|
||||
@@ -902,7 +902,7 @@ static LIST * apply_modifiers_non_empty( LIST * result, string * buf, VAR_EDITS
|
||||
{
|
||||
var_edit_file( object_str( list_item( iter ) ), buf, edits + i );
|
||||
var_edit_shift( buf, 0, edits + i );
|
||||
result = list_new( result, object_new( buf->value ) );
|
||||
result = list_push_back( result, object_new( buf->value ) );
|
||||
string_truncate( buf, 0 );
|
||||
}
|
||||
}
|
||||
@@ -980,7 +980,7 @@ static LIST * expand( expansion_item * elem, int length )
|
||||
elem[i].size = buf->size;
|
||||
string_append( buf, object_str( list_item( elem[i].elem ) ) );
|
||||
}
|
||||
result = list_new( result, object_new( buf->value ) );
|
||||
result = list_push_back( result, object_new( buf->value ) );
|
||||
while ( --i >= 0 )
|
||||
{
|
||||
if( list_next( elem[i].elem ) != list_end( elem[i].saved ) )
|
||||
@@ -2664,7 +2664,7 @@ static void type_check_range
|
||||
frame->prev_user = caller->module->user_module ? caller : caller->prev_user;
|
||||
|
||||
/* Prepare the argument list */
|
||||
lol_add( frame->args, list_new( L0, object_copy( list_item( iter ) ) ) );
|
||||
lol_add( frame->args, list_new( object_copy( list_item( iter ) ) ) );
|
||||
error = evaluate_rule( type_name, frame );
|
||||
|
||||
if ( !list_empty( error ) )
|
||||
@@ -2782,7 +2782,7 @@ void argument_list_push( struct arg_list * formal, int formal_count, FUNCTION *
|
||||
case ARG_ONE:
|
||||
if ( actual_iter == actual_end )
|
||||
argument_error( "missing argument", function, frame, formal_arg->arg_name );
|
||||
value = list_new( L0, object_copy( list_item( actual_iter ) ) );
|
||||
value = list_new( object_copy( list_item( actual_iter ) ) );
|
||||
actual_iter = list_next( actual_iter );
|
||||
break;
|
||||
case ARG_OPTIONAL:
|
||||
@@ -2790,7 +2790,7 @@ void argument_list_push( struct arg_list * formal, int formal_count, FUNCTION *
|
||||
value = L0;
|
||||
else
|
||||
{
|
||||
value = list_new( L0, object_copy( list_item( actual_iter ) ) );
|
||||
value = list_new( object_copy( list_item( actual_iter ) ) );
|
||||
actual_iter = list_next( actual_iter );
|
||||
}
|
||||
break;
|
||||
@@ -3413,7 +3413,7 @@ LIST * function_run( FUNCTION * function_, FRAME * frame, STACK * s )
|
||||
case INSTR_PUSH_CONSTANT:
|
||||
{
|
||||
OBJECT * value = function_get_constant( function, code->arg );
|
||||
stack_push( s, list_new( L0, object_copy( value ) ) );
|
||||
stack_push( s, list_new( object_copy( value ) ) );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3602,7 +3602,7 @@ LIST * function_run( FUNCTION * function_, FRAME * frame, STACK * s )
|
||||
}
|
||||
else
|
||||
{
|
||||
r = list_new( L0, object_copy( list_item( iter ) ) );
|
||||
r = list_new( object_copy( list_item( iter ) ) );
|
||||
iter = list_next( iter );
|
||||
*(LISTITER *)stack_allocate( s, sizeof( LISTITER ) ) = iter;
|
||||
stack_push( s, r );
|
||||
@@ -4170,7 +4170,7 @@ LIST * function_run( FUNCTION * function_, FRAME * frame, STACK * s )
|
||||
string buf[1];
|
||||
string_new( buf );
|
||||
combine_strings( s, code->arg, buf );
|
||||
stack_push( s, list_new( L0, object_new( buf->value ) ) );
|
||||
stack_push( s, list_new( object_new( buf->value ) ) );
|
||||
string_free( buf );
|
||||
break;
|
||||
}
|
||||
@@ -4209,7 +4209,7 @@ LIST * function_run( FUNCTION * function_, FRAME * frame, STACK * s )
|
||||
|
||||
/* Replace STDXXX with the temporary file. */
|
||||
list_free( stack_pop( s ) );
|
||||
stack_push( s, list_new( L0, object_new( result->value ) ) );
|
||||
stack_push( s, list_new( object_new( result->value ) ) );
|
||||
out = object_str( tmp_filename );
|
||||
|
||||
string_free( result );
|
||||
@@ -4498,7 +4498,7 @@ static LIST * call_python_function( PYTHON_FUNCTION * function, FRAME * frame )
|
||||
if ( !s ) {
|
||||
fprintf( stderr, "Non-string object returned by Python call.\n" );
|
||||
} else {
|
||||
result = list_new( result, s );
|
||||
result = list_push_back( result, s );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4510,7 +4510,7 @@ static LIST * call_python_function( PYTHON_FUNCTION * function, FRAME * frame )
|
||||
{
|
||||
OBJECT *s = python_to_string( py_result );
|
||||
if (s)
|
||||
result = list_new( L0, s );
|
||||
result = list_new( s );
|
||||
else
|
||||
/* We have tried all we could. Return empty list. There are
|
||||
cases, e.g. feature.feature function that should return
|
||||
|
||||
@@ -248,7 +248,7 @@ void hcache_init()
|
||||
fprintf( stderr, "invalid %s\n", hcachename );
|
||||
goto bail;
|
||||
}
|
||||
l = list_new( l, s );
|
||||
l = list_push_back( l, s );
|
||||
}
|
||||
cachedata.includes = l;
|
||||
|
||||
@@ -269,7 +269,7 @@ void hcache_init()
|
||||
fprintf( stderr, "invalid %s\n", hcachename );
|
||||
goto bail;
|
||||
}
|
||||
l = list_new( l, s );
|
||||
l = list_push_back( l, s );
|
||||
}
|
||||
cachedata.hdrscan = l;
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ headers( TARGET * t )
|
||||
{
|
||||
FRAME frame[1];
|
||||
frame_init( frame );
|
||||
lol_add( frame->args, list_new( L0, object_copy( t->name ) ) );
|
||||
lol_add( frame->args, list_new( object_copy( t->name ) ) );
|
||||
#ifdef OPT_HEADER_CACHE_EXT
|
||||
lol_add( frame->args, hcache( t, rec, re, hdrscan ) );
|
||||
#else
|
||||
@@ -102,7 +102,7 @@ headers( TARGET * t )
|
||||
{
|
||||
/* The third argument to HDRRULE is the bound name of
|
||||
* $(<) */
|
||||
lol_add( frame->args, list_new( L0, object_copy( t->boundname ) ) );
|
||||
lol_add( frame->args, list_new( object_copy( t->boundname ) ) );
|
||||
|
||||
list_free( evaluate_rule( list_front( hdrrule ), frame ) );
|
||||
}
|
||||
@@ -173,7 +173,7 @@ headers1(
|
||||
if ( DEBUG_HEADER )
|
||||
printf( "header found: %s\n", re[i]->startp[1] );
|
||||
|
||||
l = list_new( l, object_new( re[i]->startp[1] ) );
|
||||
l = list_push_back( l, object_new( re[i]->startp[1] ) );
|
||||
}
|
||||
|
||||
/* special treatment for #include MACRO */
|
||||
@@ -194,7 +194,7 @@ headers1(
|
||||
{
|
||||
if ( DEBUG_HEADER )
|
||||
printf( " resolved to '%s'\n", object_str( header_filename ) );
|
||||
l = list_new( l, object_copy( header_filename ) );
|
||||
l = list_push_back( l, object_copy( header_filename ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -434,11 +434,11 @@ int main( int argc, char * * argv, char * * arg_environ )
|
||||
#endif
|
||||
|
||||
/* Set JAMDATE. */
|
||||
var_set( root_module(), constant_JAMDATE, list_new( L0, outf_time(time(0)) ), VAR_SET );
|
||||
var_set( root_module(), constant_JAMDATE, list_new( outf_time(time(0)) ), VAR_SET );
|
||||
|
||||
/* Set JAM_VERSION. */
|
||||
var_set( root_module(), constant_JAM_VERSION,
|
||||
list_new( list_new( list_new( L0,
|
||||
list_push_back( list_push_back( list_new(
|
||||
object_new( VERSION_MAJOR_SYM ) ),
|
||||
object_new( VERSION_MINOR_SYM ) ),
|
||||
object_new( VERSION_PATCH_SYM ) ),
|
||||
@@ -452,11 +452,11 @@ int main( int argc, char * * argv, char * * arg_environ )
|
||||
if ( uname( &u ) >= 0 )
|
||||
{
|
||||
var_set( root_module(), constant_JAMUNAME,
|
||||
list_new(
|
||||
list_new(
|
||||
list_new(
|
||||
list_new(
|
||||
list_new( L0,
|
||||
list_push_back(
|
||||
list_push_back(
|
||||
list_push_back(
|
||||
list_push_back(
|
||||
list_new(
|
||||
object_new( u.sysname ) ),
|
||||
object_new( u.nodename ) ),
|
||||
object_new( u.release ) ),
|
||||
@@ -498,7 +498,7 @@ int main( int argc, char * * argv, char * * arg_environ )
|
||||
*/
|
||||
for ( n = 0; n < arg_c; ++n )
|
||||
{
|
||||
var_set( root_module(), constant_ARGV, list_new( L0, object_new( arg_v[n] ) ), VAR_APPEND );
|
||||
var_set( root_module(), constant_ARGV, list_new( object_new( arg_v[n] ) ), VAR_APPEND );
|
||||
}
|
||||
|
||||
/* Initialize built-in rules. */
|
||||
|
||||
@@ -122,11 +122,31 @@ LISTITER list_end( LIST * l )
|
||||
return 0;
|
||||
}
|
||||
|
||||
LIST * list_new( OBJECT * value )
|
||||
{
|
||||
LIST * head;
|
||||
if ( freelist[ 0 ] )
|
||||
{
|
||||
struct freelist_node * result = freelist[ 0 ];
|
||||
freelist[ 0 ] = result->next;
|
||||
head = (LIST *)result;
|
||||
}
|
||||
else
|
||||
{
|
||||
head = BJAM_MALLOC( sizeof( LIST * ) + sizeof( OBJECT * ) );
|
||||
}
|
||||
|
||||
head->impl.size = 1;
|
||||
list_begin( head )[ 0 ] = value;
|
||||
|
||||
return head;
|
||||
}
|
||||
|
||||
/*
|
||||
* list_new() - tack a string onto the end of a list of strings
|
||||
* list_push_back() - tack a string onto the end of a list of strings
|
||||
*/
|
||||
|
||||
LIST * list_new( LIST * head, OBJECT * value )
|
||||
LIST * list_push_back( LIST * head, OBJECT * value )
|
||||
{
|
||||
unsigned int size = list_length( head );
|
||||
unsigned int i;
|
||||
@@ -385,7 +405,7 @@ LIST * list_unique( LIST * sorted_list )
|
||||
{
|
||||
if ( !last_added || !object_equal( list_item( iter ), last_added ) )
|
||||
{
|
||||
result = list_new( result, object_copy( list_item( iter ) ) );
|
||||
result = list_push_back( result, object_copy( list_item( iter ) ) );
|
||||
last_added = list_item( iter );
|
||||
}
|
||||
}
|
||||
@@ -496,7 +516,7 @@ LIST *list_from_python(PyObject *l)
|
||||
for (i = 0; i < n; ++i)
|
||||
{
|
||||
PyObject *v = PySequence_GetItem(l, i);
|
||||
result = list_new (result, object_new (PyString_AsString(v)));
|
||||
result = list_push_back(result, object_new (PyString_AsString(v)));
|
||||
Py_DECREF(v);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,11 +79,12 @@ struct _lol {
|
||||
LIST *list[ LOL_MAX ];
|
||||
};
|
||||
|
||||
LIST * list_new( OBJECT * value );
|
||||
LIST * list_append( LIST *l, LIST *nl );
|
||||
LIST * list_copy( LIST *l );
|
||||
LIST * list_copy_range( LIST *l, LISTITER first, LISTITER last );
|
||||
void list_free( LIST *head );
|
||||
LIST * list_new( LIST *head, OBJECT *string );
|
||||
LIST * list_push_back( LIST *head, OBJECT *string );
|
||||
void list_print( LIST *l );
|
||||
int list_length( LIST *l );
|
||||
LIST * list_sublist( LIST *l, int start, int count );
|
||||
|
||||
@@ -802,7 +802,7 @@ static LIST * targets_to_update_ = L0;
|
||||
|
||||
void mark_target_for_updating( OBJECT * target )
|
||||
{
|
||||
targets_to_update_ = list_new( targets_to_update_, object_copy( target ) );
|
||||
targets_to_update_ = list_push_back( targets_to_update_, object_copy( target ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -708,10 +708,10 @@ static void call_timing_rule( TARGET * target, timing_info * time )
|
||||
lol_add( frame->args, list_copy_range( timing_rule, list_next( list_begin( timing_rule ) ), list_end( timing_rule ) ) );
|
||||
|
||||
/* target :: the name of the target */
|
||||
lol_add( frame->args, list_new( L0, object_copy( target->name ) ) );
|
||||
lol_add( frame->args, list_new( object_copy( target->name ) ) );
|
||||
|
||||
/* start end user system :: info about the action command */
|
||||
lol_add( frame->args, list_new( list_new( list_new( list_new( L0,
|
||||
lol_add( frame->args, list_push_back( list_push_back( list_push_back( list_new(
|
||||
outf_time ( time->start ) ),
|
||||
outf_time ( time->end ) ),
|
||||
outf_double( time->user ) ),
|
||||
@@ -763,11 +763,11 @@ static void call_action_rule
|
||||
lol_add( frame->args, list_copy_range( action_rule, list_next( list_begin( action_rule ) ), list_end( action_rule ) ) );
|
||||
|
||||
/* target :: the name of the target */
|
||||
lol_add( frame->args, list_new( L0, object_copy( target->name ) ) );
|
||||
lol_add( frame->args, list_new( object_copy( target->name ) ) );
|
||||
|
||||
/* command status start end user system :: info about the action command */
|
||||
lol_add( frame->args,
|
||||
list_new( list_new( list_new( list_new( list_new( list_new( L0,
|
||||
list_push_back( list_push_back( list_push_back( list_push_back( list_push_back( list_new(
|
||||
object_new( executed_command ) ),
|
||||
outf_int( status ) ),
|
||||
outf_time( time->start ) ),
|
||||
@@ -777,7 +777,7 @@ static void call_action_rule
|
||||
|
||||
/* output ? :: the output of the action command */
|
||||
if ( command_output )
|
||||
lol_add( frame->args, list_new( L0, object_new( command_output ) ) );
|
||||
lol_add( frame->args, list_new( object_new( command_output ) ) );
|
||||
else
|
||||
lol_add( frame->args, L0 );
|
||||
|
||||
@@ -1046,7 +1046,7 @@ static CMD * make1cmds( TARGET * t )
|
||||
/* Tell the user what didn't fit. */
|
||||
cmd = cmd_new( rule, list_copy( nt ),
|
||||
list_sublist( ns, start, chunk ),
|
||||
list_new( L0, object_copy( constant_percent ) ) );
|
||||
list_new( object_copy( constant_percent ) ) );
|
||||
fputs( cmd->buf->value, stdout );
|
||||
exit( EXITBAD );
|
||||
}
|
||||
@@ -1108,7 +1108,7 @@ static LIST * make1list( LIST * l, TARGETS * targets, int flags )
|
||||
}
|
||||
|
||||
/* Build new list. */
|
||||
l = list_new( l, object_copy( t->boundname ) );
|
||||
l = list_push_back( l, object_copy( t->boundname ) );
|
||||
}
|
||||
|
||||
return l;
|
||||
@@ -1139,7 +1139,7 @@ static SETTINGS * make1settings( struct module_t * module, LIST * vars )
|
||||
make1bind( t );
|
||||
|
||||
/* Build a new list. */
|
||||
nl = list_new( nl, object_copy( t->boundname ) );
|
||||
nl = list_push_back( nl, object_copy( t->boundname ) );
|
||||
}
|
||||
|
||||
/* Add to settings chain. */
|
||||
|
||||
@@ -193,7 +193,7 @@ static void add_module_name( void * r_, void * result_ )
|
||||
OBJECT * * r = (OBJECT * *)r_;
|
||||
LIST * * result = (LIST * *)result_;
|
||||
|
||||
*result = list_new( *result, object_copy( *r ) );
|
||||
*result = list_push_back( *result, object_copy( *r ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ LIST *order( FRAME *frame, int flags )
|
||||
int i;
|
||||
iter = list_begin(arg), end = list_end(arg);
|
||||
for (i = 0; i < order[index]; ++i, iter = list_next(iter));
|
||||
result = list_new(result, object_copy(list_item(iter)));
|
||||
result = list_push_back(result, object_copy(list_item(iter)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ LIST *path_exists( FRAME *frame, int flags )
|
||||
timestamp(list_front(l), &time);
|
||||
if (time != 0)
|
||||
{
|
||||
return list_new(L0, object_new("true"));
|
||||
return list_new(object_new("true"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ LIST* get_grist(char* f)
|
||||
string_new(s);
|
||||
|
||||
string_append_range(s, f, end+1);
|
||||
result = list_new(0, object_new(s->value));
|
||||
result = list_new(object_new(s->value));
|
||||
|
||||
string_free(s);
|
||||
return result;
|
||||
@@ -88,7 +88,7 @@ LIST *property_set_create( FRAME *frame, int flags )
|
||||
{
|
||||
OBJECT* rulename = object_new("new");
|
||||
val = call_rule(rulename, frame,
|
||||
list_append(list_new(L0, object_new("property-set")), unique), 0);
|
||||
list_append(list_new(object_new("property-set")), unique), 0);
|
||||
object_free(rulename);
|
||||
|
||||
var_set(frame->module, name, list_copy(val), VAR_SET);
|
||||
|
||||
@@ -75,7 +75,7 @@ LIST *regex_transform( FRAME *frame, int flags )
|
||||
if (re->startp[index] != re->endp[index])
|
||||
{
|
||||
string_append_range( buf, re->startp[index], re->endp[index] );
|
||||
result = list_new( result, object_new( buf->value ) );
|
||||
result = list_push_back( result, object_new( buf->value ) );
|
||||
string_truncate( buf, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ LIST *sequence_select_highest_ranked( FRAME *frame, int flags )
|
||||
elements_iter = list_begin(elements), elements_end = list_end(elements);
|
||||
for (; iter != end; iter = list_next(iter), elements_iter = list_next(elements_iter))
|
||||
if (atoi(object_str(list_item(iter))) == highest_rank)
|
||||
result = list_new(result, object_copy(list_item(elements_iter)));
|
||||
result = list_push_back(result, object_copy(list_item(elements_iter)));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ LIST *set_difference( FRAME *frame, int flags )
|
||||
for( ; iter != end; iter = list_next( iter ) )
|
||||
{
|
||||
if (!list_in(a, list_item(iter)))
|
||||
result = list_new(result, object_copy(list_item(iter)));
|
||||
result = list_push_back(result, object_copy(list_item(iter)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ pwd(void)
|
||||
return L0;
|
||||
}
|
||||
}
|
||||
return list_new(L0, object_copy( pwd_result ) );
|
||||
return list_new( object_copy( pwd_result ) );
|
||||
}
|
||||
|
||||
void pwd_done( void )
|
||||
|
||||
@@ -51,9 +51,9 @@ void call_bind_rule
|
||||
frame_init( frame );
|
||||
|
||||
/* First argument is the target name. */
|
||||
lol_add( frame->args, list_new( L0, target ) );
|
||||
lol_add( frame->args, list_new( target ) );
|
||||
|
||||
lol_add( frame->args, list_new( L0, boundname ) );
|
||||
lol_add( frame->args, list_new( boundname ) );
|
||||
if ( lol_get( frame->args, 1 ) )
|
||||
list_free( evaluate_rule( list_front( bind_rule ), frame ) );
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ LIST * builtin_subst( FRAME * frame, int flags )
|
||||
}
|
||||
*out = 0;
|
||||
|
||||
result = list_new( result, object_new( buf ) );
|
||||
result = list_push_back( result, object_new( buf ) );
|
||||
#undef BUFLEN
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ void var_defines( struct module_t * module, char * const * e, int preprocess )
|
||||
if ( quoted && preprocess )
|
||||
{
|
||||
string_append_range( buf, val + 2, val + len );
|
||||
l = list_new( l, object_new( buf->value ) );
|
||||
l = list_push_back( l, object_new( buf->value ) );
|
||||
string_truncate( buf, 0 );
|
||||
}
|
||||
else
|
||||
@@ -141,11 +141,11 @@ void var_defines( struct module_t * module, char * const * e, int preprocess )
|
||||
)
|
||||
{
|
||||
string_append_range( buf, pp, p );
|
||||
l = list_new( l, object_new( buf->value ) );
|
||||
l = list_push_back( l, object_new( buf->value ) );
|
||||
string_truncate( buf, 0 );
|
||||
}
|
||||
|
||||
l = list_new( l, object_new( pp ) );
|
||||
l = list_push_back( l, object_new( pp ) );
|
||||
}
|
||||
|
||||
/* Get name. */
|
||||
@@ -176,27 +176,27 @@ LIST * var_get( struct module_t * module, OBJECT * symbol )
|
||||
if ( object_equal( symbol, constant_TMPDIR ) )
|
||||
{
|
||||
list_free( saved_var );
|
||||
result = saved_var = list_new( L0, object_new( path_tmpdir() ) );
|
||||
result = saved_var = list_new( object_new( path_tmpdir() ) );
|
||||
}
|
||||
else if ( object_equal( symbol, constant_TMPNAME ) )
|
||||
{
|
||||
list_free( saved_var );
|
||||
result = saved_var = list_new( L0, path_tmpnam() );
|
||||
result = saved_var = list_new( path_tmpnam() );
|
||||
}
|
||||
else if ( object_equal( symbol, constant_TMPFILE ) )
|
||||
{
|
||||
list_free( saved_var );
|
||||
result = saved_var = list_new( L0, path_tmpfile() );
|
||||
result = saved_var = list_new( path_tmpfile() );
|
||||
}
|
||||
else if ( object_equal( symbol, constant_STDOUT ) )
|
||||
{
|
||||
list_free( saved_var );
|
||||
result = saved_var = list_new( L0, object_copy( constant_STDOUT ) );
|
||||
result = saved_var = list_new( object_copy( constant_STDOUT ) );
|
||||
}
|
||||
else if ( object_equal( symbol, constant_STDERR ) )
|
||||
{
|
||||
list_free( saved_var );
|
||||
result = saved_var = list_new( L0, object_copy( constant_STDERR ) );
|
||||
result = saved_var = list_new( object_copy( constant_STDERR ) );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
@@ -94,7 +94,7 @@ LIST * builtin_system_registry( FRAME * frame, int flags )
|
||||
|
||||
expanded->size = len - 1;
|
||||
|
||||
result = list_new( result, object_new(expanded->value) );
|
||||
result = list_push_back( result, object_new(expanded->value) );
|
||||
string_free( expanded );
|
||||
}
|
||||
break;
|
||||
@@ -104,7 +104,7 @@ LIST * builtin_system_registry( FRAME * frame, int flags )
|
||||
char* s;
|
||||
|
||||
for (s = (char*)data; *s; s += strlen(s) + 1)
|
||||
result = list_new( result, object_new(s) );
|
||||
result = list_push_back( result, object_new(s) );
|
||||
|
||||
}
|
||||
break;
|
||||
@@ -113,12 +113,12 @@ LIST * builtin_system_registry( FRAME * frame, int flags )
|
||||
{
|
||||
char buf[100];
|
||||
sprintf( buf, "%u", *(PDWORD)data );
|
||||
result = list_new( result, object_new(buf) );
|
||||
result = list_push_back( result, object_new(buf) );
|
||||
}
|
||||
break;
|
||||
|
||||
case REG_SZ:
|
||||
result = list_new( result, object_new( (const char *)data ) );
|
||||
result = list_push_back( result, object_new( (const char *)data ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,7 @@ static LIST* get_subkey_names(HKEY key, char const* path)
|
||||
)
|
||||
{
|
||||
name[name_size] = 0;
|
||||
result = list_append(result, list_new(0, object_new(name)));
|
||||
result = list_append(result, list_new(object_new(name)));
|
||||
}
|
||||
|
||||
RegCloseKey(key);
|
||||
@@ -175,7 +175,7 @@ static LIST* get_value_names(HKEY key, char const* path)
|
||||
)
|
||||
{
|
||||
name[name_size] = 0;
|
||||
result = list_append(result, list_new(0, object_new(name)));
|
||||
result = list_append(result, list_new(object_new(name)));
|
||||
}
|
||||
|
||||
RegCloseKey(key);
|
||||
|
||||
Reference in New Issue
Block a user