mirror of
https://github.com/boostorg/build.git
synced 2026-02-21 15:02:19 +00:00
Replace all direct pointers in rules with typedef.
Moving towards true C++ type safety by retyping all raw pointers. The typedefs will eventually be replaced with managed pointers.
This commit is contained in:
@@ -4,6 +4,12 @@
|
||||
* This file is part of Jam - see jam.c for Copyright information.
|
||||
*/
|
||||
|
||||
/* This file is ALSO:
|
||||
* Copyright 2022 René Ferdinand Rivera Morell
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
|
||||
*/
|
||||
|
||||
/*
|
||||
* command.h - the CMD structure and routines to manipulate them
|
||||
*
|
||||
@@ -79,8 +85,8 @@ struct _cmd
|
||||
string buf[ 1 ]; /* actual commands */
|
||||
int noop; /* no-op commands should be faked instead of executed */
|
||||
int asynccnt; /* number of outstanding dependencies */
|
||||
TARGETS * lock; /* semaphores that are required by this cmd. */
|
||||
TARGETS * unlock; /* semaphores that are released when this cmd finishes. */
|
||||
targets_ptr lock; /* semaphores that are required by this cmd. */
|
||||
targets_ptr unlock; /* semaphores that are released when this cmd finishes. */
|
||||
char status; /* the command status */
|
||||
};
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
/* This file is ALSO:
|
||||
* Copyright 2022 René Ferdinand Rivera Morell
|
||||
* Copyright 2001-2004 David Abrahams.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
|
||||
@@ -106,15 +107,15 @@ LIST * evaluate_rule( RULE * rule, OBJECT * rulename, FRAME * frame )
|
||||
*/
|
||||
if ( rule->actions )
|
||||
{
|
||||
TARGETS * t;
|
||||
targets_ptr t;
|
||||
|
||||
/* The action is associated with this instance of this rule. */
|
||||
ACTION * const action = (ACTION *)BJAM_MALLOC( sizeof( ACTION ) );
|
||||
memset( (char *)action, '\0', sizeof( *action ) );
|
||||
|
||||
action->rule = rule;
|
||||
action->targets = targetlist( (TARGETS *)0, lol_get( frame->args, 0 ) );
|
||||
action->sources = targetlist( (TARGETS *)0, lol_get( frame->args, 1 ) );
|
||||
action->targets = targetlist( (targets_ptr)0, lol_get( frame->args, 0 ) );
|
||||
action->sources = targetlist( (targets_ptr)0, lol_get( frame->args, 1 ) );
|
||||
action->refs = 1;
|
||||
|
||||
/* If we have a group of targets all being built using the same action
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 René Ferdinand Rivera Morell
|
||||
* Copyright 2011 Steven Watanabe
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
|
||||
@@ -17,6 +18,9 @@
|
||||
typedef struct _function FUNCTION;
|
||||
typedef struct _stack STACK;
|
||||
|
||||
typedef FUNCTION* function_ptr;
|
||||
typedef STACK* stack_ptr;
|
||||
|
||||
STACK * stack_global( void );
|
||||
void stack_push( STACK * s, LIST * l );
|
||||
LIST * stack_pop( STACK * s );
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
* This file is part of Jam - see jam.c for Copyright information.
|
||||
*/
|
||||
|
||||
/* This file is ALSO:
|
||||
* Copyright 2022 René Ferdinand Rivera Morell
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
|
||||
*/
|
||||
|
||||
/*
|
||||
* hash.h - simple in-memory hashing routines
|
||||
*/
|
||||
@@ -36,12 +42,25 @@ struct hash * hashinit( int32_t datalen, char const * name );
|
||||
void hash_free( struct hash * );
|
||||
void hashdone( struct hash * );
|
||||
|
||||
typedef void (* hashenumerate_f)( void *, void * );
|
||||
|
||||
/*
|
||||
* hashenumerate() - call f(i, data) on each item, i in the hash table. The
|
||||
* enumeration order is unspecified.
|
||||
*/
|
||||
void hashenumerate( struct hash *, void (* f)( void *, void * ), void * data );
|
||||
|
||||
template <typename T, typename D>
|
||||
void hash_enumerate( struct hash * h, void (* f)(T *, D *), D * data)
|
||||
{
|
||||
hashenumerate(h, reinterpret_cast<hashenumerate_f>(f), data);
|
||||
}
|
||||
template <typename T, typename D>
|
||||
void hash_enumerate( struct hash * h, void (* f)(T *, D *))
|
||||
{
|
||||
hashenumerate(h, reinterpret_cast<hashenumerate_f>(f), nullptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* hash_insert() - insert a new item in a hash table, or return an existing one.
|
||||
*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/* A Bison parser, made by GNU Bison 3.7.6. */
|
||||
/* A Bison parser, made by GNU Bison 3.8.2. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
@@ -169,6 +169,8 @@ typedef int YYSTYPE;
|
||||
|
||||
extern YYSTYPE yylval;
|
||||
|
||||
|
||||
int yyparse (void);
|
||||
|
||||
|
||||
#endif /* !YY_YY_SRC_ENGINE_JAMGRAM_HPP_INCLUDED */
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
/* This file is ALSO:
|
||||
* Copyright 2022 René Ferdinand Rivera Morell
|
||||
* Copyright 2001-2004 David Abrahams.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
|
||||
@@ -52,14 +53,15 @@
|
||||
* LIST - list of strings
|
||||
*/
|
||||
|
||||
typedef struct _list {
|
||||
struct LIST {
|
||||
union {
|
||||
int32_t size;
|
||||
struct _list * next;
|
||||
struct LIST * next;
|
||||
OBJECT * align;
|
||||
} impl;
|
||||
} LIST;
|
||||
};
|
||||
|
||||
typedef LIST * list_ptr;
|
||||
typedef OBJECT * * LISTITER;
|
||||
|
||||
/*
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
/* This file is ALSO:
|
||||
* Copyright 2022 René Ferdinand Rivera Morell
|
||||
* Copyright 2001-2004 David Abrahams.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
|
||||
@@ -53,7 +54,7 @@
|
||||
# define max(a,b) ((a)>(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
static TARGETS * make0sort( TARGETS * c );
|
||||
static targets_ptr make0sort( targets_ptr c );
|
||||
|
||||
#ifdef OPT_GRAPH_DEBUG_EXT
|
||||
static void dependGraphOutput( TARGET * t, int32_t depth );
|
||||
@@ -171,7 +172,7 @@ static void force_rebuilds( TARGET * t );
|
||||
|
||||
static void update_dependants( TARGET * t )
|
||||
{
|
||||
TARGETS * q;
|
||||
targets_ptr q;
|
||||
|
||||
for ( q = t->dependants; q; q = q->next )
|
||||
{
|
||||
@@ -209,7 +210,7 @@ static void update_dependants( TARGET * t )
|
||||
|
||||
static void force_rebuilds( TARGET * t )
|
||||
{
|
||||
TARGETS * d;
|
||||
targets_ptr d;
|
||||
for ( d = t->rebuilds; d; d = d->next )
|
||||
{
|
||||
TARGET * r = d->target;
|
||||
@@ -234,7 +235,7 @@ static void force_rebuilds( TARGET * t )
|
||||
int32_t make0rescan( TARGET * t, TARGET * rescanning )
|
||||
{
|
||||
int32_t result = 0;
|
||||
TARGETS * c;
|
||||
targets_ptr c;
|
||||
|
||||
/* Check whether we have already found a cycle. */
|
||||
if ( target_scc( t ) == rescanning )
|
||||
@@ -287,7 +288,7 @@ void make0
|
||||
TARGET * rescanning
|
||||
) /* forcibly touch all (real) targets */
|
||||
{
|
||||
TARGETS * c;
|
||||
targets_ptr c;
|
||||
TARGET * ptime = t;
|
||||
TARGET * located_target = 0;
|
||||
timestamp last;
|
||||
@@ -441,7 +442,7 @@ void make0
|
||||
|
||||
/* Step 3c: Add dependencies' includes to our direct dependencies. */
|
||||
{
|
||||
TARGETS * incs = 0;
|
||||
targets_ptr incs = 0;
|
||||
for ( c = t->depends; c; c = c->next )
|
||||
if ( c->target->includes )
|
||||
incs = targetentry( incs, c->target->includes );
|
||||
@@ -696,7 +697,7 @@ void make0
|
||||
if ( ( fate >= T_FATE_BUILD ) && ( fate < T_FATE_BROKEN ) )
|
||||
{
|
||||
ACTIONS * a;
|
||||
TARGETS * c;
|
||||
targets_ptr c;
|
||||
for ( a = t->actions; a; a = a->next )
|
||||
{
|
||||
for ( c = a->action->targets; c; c = c->next )
|
||||
@@ -785,7 +786,7 @@ static char const * target_name( TARGET * t )
|
||||
|
||||
static void dependGraphOutput( TARGET * t, int32_t depth )
|
||||
{
|
||||
TARGETS * c;
|
||||
targets_ptr c;
|
||||
|
||||
if ( ( t->flags & T_FLAG_VISITED ) || !t->name || !t->boundname )
|
||||
return;
|
||||
@@ -886,17 +887,17 @@ static void dependGraphOutput( TARGET * t, int32_t depth )
|
||||
* that while tail is a loop, next ends at the end of the chain.
|
||||
*/
|
||||
|
||||
static TARGETS * make0sort( TARGETS * chain )
|
||||
static targets_ptr make0sort( targets_ptr chain )
|
||||
{
|
||||
PROFILE_ENTER( MAKE_MAKE0SORT );
|
||||
|
||||
TARGETS * result = 0;
|
||||
targets_ptr result = 0;
|
||||
|
||||
/* Walk the current target list. */
|
||||
while ( chain )
|
||||
{
|
||||
TARGETS * c = chain;
|
||||
TARGETS * s = result;
|
||||
targets_ptr c = chain;
|
||||
targets_ptr s = result;
|
||||
|
||||
chain = chain->next;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
/* This file is ALSO:
|
||||
* Copyright 2022 René Ferdinand Rivera Morell
|
||||
* Copyright 2001-2004 David Abrahams.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
|
||||
@@ -59,15 +60,15 @@
|
||||
#endif
|
||||
|
||||
static CMD * make1cmds ( TARGET * );
|
||||
static LIST * make1list ( LIST *, TARGETS *, int32_t flags );
|
||||
static LIST * make1list ( LIST *, targets_ptr, int32_t flags );
|
||||
static SETTINGS * make1settings ( struct module_t *, LIST * vars );
|
||||
static void make1bind ( TARGET * );
|
||||
static void push_cmds( CMDLIST * cmds, int32_t status );
|
||||
static int32_t cmd_sem_lock( TARGET * t );
|
||||
static void cmd_sem_unlock( TARGET * t );
|
||||
|
||||
static int32_t targets_contains( TARGETS * l, TARGET * t );
|
||||
static int32_t targets_equal( TARGETS * l1, TARGETS * l2 );
|
||||
static int32_t targets_contains( targets_ptr l, TARGET * t );
|
||||
static int32_t targets_equal( targets_ptr l1, targets_ptr l2 );
|
||||
|
||||
/* Ugly static - it is too hard to carry it through the callbacks. */
|
||||
|
||||
@@ -343,7 +344,7 @@ static void make1a( state * const pState )
|
||||
/* Push dependency build requests (to be executed in the natural order). */
|
||||
{
|
||||
stack temp_stack = { NULL };
|
||||
TARGETS * c;
|
||||
targets_ptr c;
|
||||
for ( c = t->depends; c && !quit; c = c->next )
|
||||
push_state( &temp_stack, c->target, t, T_STATE_MAKE1A );
|
||||
push_stack_on_stack( &state_stack, &temp_stack );
|
||||
@@ -396,7 +397,7 @@ static void make1b( state * const pState )
|
||||
*/
|
||||
if ( !globs.noexec )
|
||||
{
|
||||
TARGETS * c;
|
||||
targets_ptr c;
|
||||
for ( c = t->depends; c; c = c->next )
|
||||
if ( c->target->status > t->status && !( c->target->flags &
|
||||
T_FLAG_NOCARE ) )
|
||||
@@ -637,7 +638,7 @@ static void make1c( state const * const pState )
|
||||
|
||||
/* Tell parents their dependency has been built. */
|
||||
{
|
||||
TARGETS * c;
|
||||
targets_ptr c;
|
||||
stack temp_stack = { NULL };
|
||||
TARGET * additional_includes = NULL;
|
||||
|
||||
@@ -1077,7 +1078,7 @@ static CMD * make1cmds( TARGET * t )
|
||||
for ( a0 = t->actions; a0; a0 = a0->next )
|
||||
{
|
||||
RULE * rule = a0->action->rule;
|
||||
rule_actions * actions = rule->actions;
|
||||
rule_actions_ptr actions = rule->actions;
|
||||
SETTINGS * boundvars;
|
||||
LIST * nt;
|
||||
LIST * ns;
|
||||
@@ -1172,8 +1173,8 @@ static CMD * make1cmds( TARGET * t )
|
||||
int32_t start = 0;
|
||||
int32_t chunk = length;
|
||||
int32_t cmd_count = 0;
|
||||
TARGETS * semaphores = NULL;
|
||||
TARGETS * targets_iter;
|
||||
targets_ptr semaphores = NULL;
|
||||
targets_ptr targets_iter;
|
||||
int32_t unique_targets;
|
||||
do
|
||||
{
|
||||
@@ -1315,7 +1316,7 @@ static CMD * make1cmds( TARGET * t )
|
||||
* make1list() - turn a list of targets into a LIST, for $(<) and $(>)
|
||||
*/
|
||||
|
||||
static LIST * make1list( LIST * l, TARGETS * targets, int32_t flags )
|
||||
static LIST * make1list( LIST * l, targets_ptr targets, int32_t flags )
|
||||
{
|
||||
for ( ; targets; targets = targets->next )
|
||||
{
|
||||
@@ -1418,7 +1419,7 @@ static void make1bind( TARGET * t )
|
||||
}
|
||||
|
||||
|
||||
static int32_t targets_contains( TARGETS * l, TARGET * t )
|
||||
static int32_t targets_contains( targets_ptr l, TARGET * t )
|
||||
{
|
||||
for ( ; l; l = l->next )
|
||||
{
|
||||
@@ -1430,7 +1431,7 @@ static int32_t targets_contains( TARGETS * l, TARGET * t )
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t targets_equal( TARGETS * l1, TARGETS * l2 )
|
||||
static int32_t targets_equal( targets_ptr l1, targets_ptr l2 )
|
||||
{
|
||||
for ( ; l1 && l2; l1 = l1->next, l2 = l2->next )
|
||||
{
|
||||
@@ -1446,7 +1447,7 @@ static int32_t targets_equal( TARGETS * l1, TARGETS * l2 )
|
||||
static int32_t cmd_sem_lock( TARGET * t )
|
||||
{
|
||||
CMD * cmd = (CMD *)t->cmds;
|
||||
TARGETS * iter;
|
||||
targets_ptr iter;
|
||||
/* Check whether all the semaphores required for updating
|
||||
* this target are free.
|
||||
*/
|
||||
@@ -1480,7 +1481,7 @@ static int32_t cmd_sem_lock( TARGET * t )
|
||||
static void cmd_sem_unlock( TARGET * t )
|
||||
{
|
||||
CMD * cmd = ( CMD * )t->cmds;
|
||||
TARGETS * iter;
|
||||
targets_ptr iter;
|
||||
/* Release the semaphores. */
|
||||
for ( iter = cmd->unlock; iter; iter = iter->next )
|
||||
{
|
||||
@@ -1495,7 +1496,7 @@ static void cmd_sem_unlock( TARGET * t )
|
||||
/* Find a waiting target that's ready */
|
||||
while ( iter->target->parents )
|
||||
{
|
||||
TARGETS * first = iter->target->parents;
|
||||
targets_ptr first = iter->target->parents;
|
||||
TARGET * t1 = first->target;
|
||||
|
||||
/* Pop the first waiting CMD */
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 René Ferdinand Rivera Morell
|
||||
* Copyright 2001-2004 David Abrahams.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
|
||||
@@ -11,6 +12,9 @@
|
||||
#include "object.h"
|
||||
|
||||
typedef struct module_t module_t ;
|
||||
|
||||
typedef module_t * module_ptr;
|
||||
|
||||
struct module_t
|
||||
{
|
||||
OBJECT * name;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 René Ferdinand Rivera Morell
|
||||
* Copyright 2011 Steven Watanabe
|
||||
*
|
||||
* This file is part of Jam - see jam.c for Copyright information.
|
||||
@@ -17,6 +18,8 @@
|
||||
|
||||
typedef struct _object OBJECT;
|
||||
|
||||
typedef OBJECT * object_ptr;
|
||||
|
||||
OBJECT * object_new( char const * const );
|
||||
OBJECT * object_new_range( char const * const, int32_t size );
|
||||
void object_done( void );
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
/* This file is ALSO:
|
||||
* Copyright 2022 René Ferdinand Rivera Morell
|
||||
* Copyright 2001-2004 David Abrahams.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
|
||||
@@ -39,8 +40,8 @@
|
||||
#include "variable.h"
|
||||
|
||||
|
||||
static void set_rule_actions( RULE *, rule_actions * );
|
||||
static void set_rule_body ( RULE *, FUNCTION * );
|
||||
static void set_rule_actions( rule_ptr, rule_actions_ptr );
|
||||
static void set_rule_body ( rule_ptr, function_ptr );
|
||||
|
||||
static struct hash * targethash = 0;
|
||||
|
||||
@@ -54,11 +55,11 @@ static struct hash * targethash = 0;
|
||||
* then read the internal includes node from there.
|
||||
*/
|
||||
|
||||
static TARGET * get_target_includes( TARGET * const t )
|
||||
static target_ptr get_target_includes( target_ptr const t )
|
||||
{
|
||||
if ( !t->includes )
|
||||
{
|
||||
TARGET * const i = (TARGET *)BJAM_MALLOC( sizeof( *t ) );
|
||||
target_ptr const i = (target_ptr)BJAM_MALLOC( sizeof( *t ) );
|
||||
memset( (char *)i, '\0', sizeof( *i ) );
|
||||
i->name = object_copy( t->name );
|
||||
i->boundname = object_copy( i->name );
|
||||
@@ -77,16 +78,16 @@ static TARGET * get_target_includes( TARGET * const t )
|
||||
* internal include node.
|
||||
*/
|
||||
|
||||
void target_include( TARGET * const including, TARGET * const included )
|
||||
void target_include( target_ptr const including, target_ptr const included )
|
||||
{
|
||||
TARGET * const internal = get_target_includes( including );
|
||||
target_ptr const internal = get_target_includes( including );
|
||||
internal->depends = targetentry( internal->depends, included );
|
||||
}
|
||||
|
||||
void target_include_many( TARGET * const including, LIST * const included_names
|
||||
void target_include_many( target_ptr const including, list_ptr const included_names
|
||||
)
|
||||
{
|
||||
TARGET * const internal = get_target_includes( including );
|
||||
target_ptr const internal = get_target_includes( including );
|
||||
internal->depends = targetlist( internal->depends, included_names );
|
||||
}
|
||||
|
||||
@@ -96,10 +97,10 @@ void target_include_many( TARGET * const including, LIST * const included_names
|
||||
* target_module.
|
||||
*/
|
||||
|
||||
static RULE * enter_rule( OBJECT * rulename, module_t * target_module )
|
||||
static rule_ptr enter_rule( object_ptr rulename, module_ptr target_module )
|
||||
{
|
||||
int found;
|
||||
RULE * const r = (RULE *)hash_insert( demand_rules( target_module ),
|
||||
rule_ptr const r = (rule_ptr)hash_insert( demand_rules( target_module ),
|
||||
rulename, &found );
|
||||
if ( !found )
|
||||
{
|
||||
@@ -120,10 +121,10 @@ static RULE * enter_rule( OBJECT * rulename, module_t * target_module )
|
||||
* src_module.
|
||||
*/
|
||||
|
||||
static RULE * define_rule( module_t * src_module, OBJECT * rulename,
|
||||
module_t * target_module )
|
||||
static rule_ptr define_rule( module_ptr src_module, object_ptr rulename,
|
||||
module_ptr target_module )
|
||||
{
|
||||
RULE * const r = enter_rule( rulename, target_module );
|
||||
rule_ptr const r = enter_rule( rulename, target_module );
|
||||
if ( r->module != src_module )
|
||||
{
|
||||
/* If the rule was imported from elsewhere, clear it now. */
|
||||
@@ -136,7 +137,7 @@ static RULE * define_rule( module_t * src_module, OBJECT * rulename,
|
||||
}
|
||||
|
||||
|
||||
void rule_free( RULE * r )
|
||||
void rule_free( rule_ptr r )
|
||||
{
|
||||
object_free( r->name );
|
||||
r->name = 0;
|
||||
@@ -153,15 +154,15 @@ void rule_free( RULE * r )
|
||||
* bindtarget() - return pointer to TARGET, creating it if necessary.
|
||||
*/
|
||||
|
||||
TARGET * bindtarget( OBJECT * const target_name )
|
||||
target_ptr bindtarget( object_ptr const target_name )
|
||||
{
|
||||
int found;
|
||||
TARGET * t;
|
||||
target_ptr t;
|
||||
|
||||
if ( !targethash )
|
||||
targethash = hashinit( sizeof( TARGET ), "targets" );
|
||||
|
||||
t = (TARGET *)hash_insert( targethash, target_name, &found );
|
||||
t = (target_ptr)hash_insert( targethash, target_name, &found );
|
||||
if ( !found )
|
||||
{
|
||||
memset( (char *)t, '\0', sizeof( *t ) );
|
||||
@@ -173,13 +174,12 @@ TARGET * bindtarget( OBJECT * const target_name )
|
||||
}
|
||||
|
||||
|
||||
static void bind_explicitly_located_target( void * xtarget, void * data )
|
||||
static void bind_explicitly_located_target( target_ptr t, void * )
|
||||
{
|
||||
TARGET * t = (TARGET *)xtarget;
|
||||
if ( !( t->flags & T_FLAG_NOTFILE ) )
|
||||
{
|
||||
/* Check if there is a setting for LOCATE. */
|
||||
SETTINGS * s = t->settings;
|
||||
settings_ptr s = t->settings;
|
||||
for ( ; s ; s = s->next )
|
||||
{
|
||||
if ( object_equal( s->symbol, constant_LOCATE ) && ! list_empty( s->value ) )
|
||||
@@ -195,7 +195,7 @@ static void bind_explicitly_located_target( void * xtarget, void * data )
|
||||
void bind_explicitly_located_targets()
|
||||
{
|
||||
if ( targethash )
|
||||
hashenumerate( targethash, bind_explicitly_located_target, (void *)0 );
|
||||
hash_enumerate( targethash, bind_explicitly_located_target );
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ void bind_explicitly_located_targets()
|
||||
* touch_target() - mark a target to simulate being new.
|
||||
*/
|
||||
|
||||
void touch_target( OBJECT * const t )
|
||||
void touch_target( object_ptr const t )
|
||||
{
|
||||
bindtarget( t )->flags |= T_FLAG_TOUCHED;
|
||||
}
|
||||
@@ -214,14 +214,14 @@ void touch_target( OBJECT * const t )
|
||||
* target is a part of.
|
||||
*/
|
||||
|
||||
TARGET * target_scc( TARGET * t )
|
||||
target_ptr target_scc( target_ptr t )
|
||||
{
|
||||
TARGET * result = t;
|
||||
target_ptr result = t;
|
||||
while ( result->scc_root )
|
||||
result = result->scc_root;
|
||||
while ( t->scc_root )
|
||||
{
|
||||
TARGET * const tmp = t->scc_root;
|
||||
target_ptr const tmp = t->scc_root;
|
||||
t->scc_root = result;
|
||||
t = tmp;
|
||||
}
|
||||
@@ -237,7 +237,7 @@ TARGET * target_scc( TARGET * t )
|
||||
* targets list of target names
|
||||
*/
|
||||
|
||||
TARGETS * targetlist( TARGETS * chain, LIST * target_names )
|
||||
targets_ptr targetlist( targets_ptr chain, list_ptr target_names )
|
||||
{
|
||||
LISTITER iter = list_begin( target_names );
|
||||
LISTITER const end = list_end( target_names );
|
||||
@@ -255,9 +255,9 @@ TARGETS * targetlist( TARGETS * chain, LIST * target_names )
|
||||
* target new target to append
|
||||
*/
|
||||
|
||||
TARGETS * targetentry( TARGETS * chain, TARGET * target )
|
||||
targets_ptr targetentry( targets_ptr chain, target_ptr target )
|
||||
{
|
||||
TARGETS * const c = (TARGETS *)BJAM_MALLOC( sizeof( TARGETS ) );
|
||||
targets_ptr const c = (targets_ptr)BJAM_MALLOC( sizeof( TARGETS ) );
|
||||
c->target = target;
|
||||
|
||||
if ( !chain ) chain = c;
|
||||
@@ -277,7 +277,7 @@ TARGETS * targetentry( TARGETS * chain, TARGET * target )
|
||||
* target new target to append
|
||||
*/
|
||||
|
||||
TARGETS * targetchain( TARGETS * chain, TARGETS * targets )
|
||||
targets_ptr targetchain( targets_ptr chain, targets_ptr targets )
|
||||
{
|
||||
if ( !targets ) return chain;
|
||||
if ( !chain ) return targets;
|
||||
@@ -291,7 +291,7 @@ TARGETS * targetchain( TARGETS * chain, TARGETS * targets )
|
||||
* action_free - decrement the ACTIONs reference count and (maybe) free it.
|
||||
*/
|
||||
|
||||
void action_free( ACTION * action )
|
||||
void action_free( action_ptr action )
|
||||
{
|
||||
if ( --action->refs == 0 )
|
||||
{
|
||||
@@ -306,9 +306,9 @@ void action_free( ACTION * action )
|
||||
* actionlist() - append to an ACTION chain.
|
||||
*/
|
||||
|
||||
ACTIONS * actionlist( ACTIONS * chain, ACTION * action )
|
||||
actions_ptr actionlist( actions_ptr chain, action_ptr action )
|
||||
{
|
||||
ACTIONS * const actions = (ACTIONS *)BJAM_MALLOC( sizeof( ACTIONS ) );
|
||||
actions_ptr const actions = (actions_ptr)BJAM_MALLOC( sizeof( ACTIONS ) );
|
||||
actions->action = action;
|
||||
++action->refs;
|
||||
if ( !chain ) chain = actions;
|
||||
@@ -318,7 +318,7 @@ ACTIONS * actionlist( ACTIONS * chain, ACTION * action )
|
||||
return chain;
|
||||
}
|
||||
|
||||
static SETTINGS * settings_freelist;
|
||||
static settings_ptr settings_freelist;
|
||||
|
||||
|
||||
/*
|
||||
@@ -330,10 +330,10 @@ static SETTINGS * settings_freelist;
|
||||
* head of the settings chain.
|
||||
*/
|
||||
|
||||
SETTINGS * addsettings( SETTINGS * head, int flag, OBJECT * symbol,
|
||||
LIST * value )
|
||||
settings_ptr addsettings( settings_ptr head, int flag, object_ptr symbol,
|
||||
list_ptr value )
|
||||
{
|
||||
SETTINGS * v;
|
||||
settings_ptr v;
|
||||
|
||||
/* Look for previous settings. */
|
||||
for ( v = head; v; v = v->next )
|
||||
@@ -349,7 +349,7 @@ SETTINGS * addsettings( SETTINGS * head, int flag, OBJECT * symbol,
|
||||
if ( v )
|
||||
settings_freelist = v->next;
|
||||
else
|
||||
v = (SETTINGS *)BJAM_MALLOC( sizeof( *v ) );
|
||||
v = (settings_ptr)BJAM_MALLOC( sizeof( *v ) );
|
||||
|
||||
v->symbol = object_copy( symbol );
|
||||
v->value = value;
|
||||
@@ -377,7 +377,7 @@ SETTINGS * addsettings( SETTINGS * head, int flag, OBJECT * symbol,
|
||||
* pushsettings() - set all target specific variables.
|
||||
*/
|
||||
|
||||
void pushsettings( struct module_t * module, SETTINGS * v )
|
||||
void pushsettings( module_ptr module, settings_ptr v )
|
||||
{
|
||||
for ( ; v; v = v->next )
|
||||
v->value = var_swap( module, v->symbol, v->value );
|
||||
@@ -388,7 +388,7 @@ void pushsettings( struct module_t * module, SETTINGS * v )
|
||||
* popsettings() - reset target specific variables to their pre-push values.
|
||||
*/
|
||||
|
||||
void popsettings( struct module_t * module, SETTINGS * v )
|
||||
void popsettings( module_ptr module, settings_ptr v )
|
||||
{
|
||||
pushsettings( module, v ); /* just swap again */
|
||||
}
|
||||
@@ -398,10 +398,10 @@ void popsettings( struct module_t * module, SETTINGS * v )
|
||||
* copysettings() - duplicate a settings list, returning the new copy.
|
||||
*/
|
||||
|
||||
SETTINGS * copysettings( SETTINGS * head )
|
||||
settings_ptr copysettings( settings_ptr head )
|
||||
{
|
||||
SETTINGS * copy = 0;
|
||||
SETTINGS * v;
|
||||
settings_ptr copy = 0;
|
||||
settings_ptr v;
|
||||
for ( v = head; v; v = v->next )
|
||||
copy = addsettings( copy, VAR_SET, v->symbol, list_copy( v->value ) );
|
||||
return copy;
|
||||
@@ -412,11 +412,11 @@ SETTINGS * copysettings( SETTINGS * head )
|
||||
* freetargets() - delete a targets list.
|
||||
*/
|
||||
|
||||
void freetargets( TARGETS * chain )
|
||||
void freetargets( targets_ptr chain )
|
||||
{
|
||||
while ( chain )
|
||||
{
|
||||
TARGETS * const n = chain->next;
|
||||
targets_ptr const n = chain->next;
|
||||
BJAM_FREE( chain );
|
||||
chain = n;
|
||||
}
|
||||
@@ -427,11 +427,11 @@ void freetargets( TARGETS * chain )
|
||||
* freeactions() - delete an action list.
|
||||
*/
|
||||
|
||||
void freeactions( ACTIONS * chain )
|
||||
void freeactions( actions_ptr chain )
|
||||
{
|
||||
while ( chain )
|
||||
{
|
||||
ACTIONS * const n = chain->next;
|
||||
actions_ptr const n = chain->next;
|
||||
action_free( chain->action );
|
||||
BJAM_FREE( chain );
|
||||
chain = n;
|
||||
@@ -443,11 +443,11 @@ void freeactions( ACTIONS * chain )
|
||||
* freesettings() - delete a settings list.
|
||||
*/
|
||||
|
||||
void freesettings( SETTINGS * v )
|
||||
void freesettings( settings_ptr v )
|
||||
{
|
||||
while ( v )
|
||||
{
|
||||
SETTINGS * const n = v->next;
|
||||
settings_ptr const n = v->next;
|
||||
object_free( v->symbol );
|
||||
list_free( v->value );
|
||||
v->next = settings_freelist;
|
||||
@@ -457,9 +457,8 @@ void freesettings( SETTINGS * v )
|
||||
}
|
||||
|
||||
|
||||
static void freetarget( void * xt, void * data )
|
||||
static void freetarget( target_ptr const t, void * )
|
||||
{
|
||||
TARGET * const t = (TARGET *)xt;
|
||||
if ( t->name ) object_free ( t->name );
|
||||
if ( t->boundname ) object_free ( t->boundname );
|
||||
if ( t->settings ) freesettings( t->settings );
|
||||
@@ -483,12 +482,12 @@ void rules_done()
|
||||
{
|
||||
if ( targethash )
|
||||
{
|
||||
hashenumerate( targethash, freetarget, 0 );
|
||||
hash_enumerate( targethash, freetarget );
|
||||
hashdone( targethash );
|
||||
}
|
||||
while ( settings_freelist )
|
||||
{
|
||||
SETTINGS * const n = settings_freelist->next;
|
||||
settings_ptr const n = settings_freelist->next;
|
||||
BJAM_FREE( settings_freelist );
|
||||
settings_freelist = n;
|
||||
}
|
||||
@@ -499,7 +498,7 @@ void rules_done()
|
||||
* actions_refer() - add a new reference to the given actions.
|
||||
*/
|
||||
|
||||
void actions_refer( rule_actions * a )
|
||||
void actions_refer( rule_actions_ptr a )
|
||||
{
|
||||
++a->reference_count;
|
||||
}
|
||||
@@ -509,7 +508,7 @@ void actions_refer( rule_actions * a )
|
||||
* actions_free() - release a reference to given actions.
|
||||
*/
|
||||
|
||||
void actions_free( rule_actions * a )
|
||||
void actions_free( rule_actions_ptr a )
|
||||
{
|
||||
if ( --a->reference_count <= 0 )
|
||||
{
|
||||
@@ -524,7 +523,7 @@ void actions_free( rule_actions * a )
|
||||
* set_rule_body() - set the argument list and procedure of the given rule.
|
||||
*/
|
||||
|
||||
static void set_rule_body( RULE * rule, FUNCTION * procedure )
|
||||
static void set_rule_body( rule_ptr rule, function_ptr procedure )
|
||||
{
|
||||
if ( procedure )
|
||||
function_refer( procedure );
|
||||
@@ -539,7 +538,7 @@ static void set_rule_body( RULE * rule, FUNCTION * procedure )
|
||||
* global module.
|
||||
*/
|
||||
|
||||
static OBJECT * global_rule_name( RULE * r )
|
||||
static object_ptr global_rule_name( rule_ptr r )
|
||||
{
|
||||
if ( r->module == root_module() )
|
||||
return object_copy( r->name );
|
||||
@@ -562,14 +561,14 @@ static OBJECT * global_rule_name( RULE * r )
|
||||
* module.
|
||||
*/
|
||||
|
||||
static RULE * global_rule( RULE * r )
|
||||
static rule_ptr global_rule( rule_ptr r )
|
||||
{
|
||||
if ( r->module == root_module() )
|
||||
return r;
|
||||
|
||||
{
|
||||
OBJECT * const name = global_rule_name( r );
|
||||
RULE * const result = define_rule( r->module, name, root_module() );
|
||||
object_ptr const name = global_rule_name( r );
|
||||
rule_ptr const result = define_rule( r->module, name, root_module() );
|
||||
object_free( name );
|
||||
return result;
|
||||
}
|
||||
@@ -582,10 +581,10 @@ static RULE * global_rule( RULE * r )
|
||||
* exported to the global module as modulename.rulename.
|
||||
*/
|
||||
|
||||
RULE * new_rule_body( module_t * m, OBJECT * rulename, FUNCTION * procedure,
|
||||
rule_ptr new_rule_body( module_ptr m, object_ptr rulename, function_ptr procedure,
|
||||
int exported )
|
||||
{
|
||||
RULE * const local = define_rule( m, rulename, m );
|
||||
rule_ptr const local = define_rule( m, rulename, m );
|
||||
local->exported = exported;
|
||||
set_rule_body( local, procedure );
|
||||
|
||||
@@ -601,7 +600,7 @@ RULE * new_rule_body( module_t * m, OBJECT * rulename, FUNCTION * procedure,
|
||||
}
|
||||
|
||||
|
||||
static void set_rule_actions( RULE * rule, rule_actions * actions )
|
||||
static void set_rule_actions( rule_ptr rule, rule_actions_ptr actions )
|
||||
{
|
||||
if ( actions )
|
||||
actions_refer( actions );
|
||||
@@ -611,10 +610,10 @@ static void set_rule_actions( RULE * rule, rule_actions * actions )
|
||||
}
|
||||
|
||||
|
||||
static rule_actions * actions_new( FUNCTION * command, LIST * bindlist,
|
||||
static rule_actions_ptr actions_new( function_ptr command, list_ptr bindlist,
|
||||
int flags )
|
||||
{
|
||||
rule_actions * const result = (rule_actions *)BJAM_MALLOC( sizeof(
|
||||
rule_actions_ptr const result = (rule_actions_ptr)BJAM_MALLOC( sizeof(
|
||||
rule_actions ) );
|
||||
function_refer( command );
|
||||
result->command = command;
|
||||
@@ -625,11 +624,11 @@ static rule_actions * actions_new( FUNCTION * command, LIST * bindlist,
|
||||
}
|
||||
|
||||
|
||||
RULE * new_rule_actions( module_t * m, OBJECT * rulename, FUNCTION * command,
|
||||
LIST * bindlist, int flags )
|
||||
rule_ptr new_rule_actions( module_ptr m, object_ptr rulename, function_ptr command,
|
||||
list_ptr bindlist, int flags )
|
||||
{
|
||||
RULE * const local = define_rule( m, rulename, m );
|
||||
RULE * const global = global_rule( local );
|
||||
rule_ptr const local = define_rule( m, rulename, m );
|
||||
rule_ptr const global = global_rule( local );
|
||||
set_rule_actions( local, actions_new( command, bindlist, flags ) );
|
||||
set_rule_actions( global, local->actions );
|
||||
return local;
|
||||
@@ -643,16 +642,16 @@ RULE * new_rule_actions( module_t * m, OBJECT * rulename, FUNCTION * command,
|
||||
* modules, look in module 'name1' for rule 'name2'.
|
||||
*/
|
||||
|
||||
RULE * lookup_rule( OBJECT * rulename, module_t * m, int local_only )
|
||||
rule_ptr lookup_rule( object_ptr rulename, module_ptr m, int local_only )
|
||||
{
|
||||
RULE * r;
|
||||
RULE * result = 0;
|
||||
module_t * original_module = m;
|
||||
rule_ptr r;
|
||||
rule_ptr result = 0;
|
||||
module_ptr original_module = m;
|
||||
|
||||
if ( m->class_module )
|
||||
m = m->class_module;
|
||||
|
||||
if ( m->rules && ( r = (RULE *)hash_find( m->rules, rulename ) ) )
|
||||
if ( m->rules && ( r = (rule_ptr)hash_find( m->rules, rulename ) ) )
|
||||
result = r;
|
||||
else if ( !local_only && m->imported_modules )
|
||||
{
|
||||
@@ -663,8 +662,8 @@ RULE * lookup_rule( OBJECT * rulename, module_t * m, int local_only )
|
||||
/* Now, r->name keeps the module name, and p + 1 keeps the rule
|
||||
* name.
|
||||
*/
|
||||
OBJECT * rule_part = object_new( p + 1 );
|
||||
OBJECT * module_part;
|
||||
object_ptr rule_part = object_new( p + 1 );
|
||||
object_ptr module_part;
|
||||
{
|
||||
string buf[ 1 ];
|
||||
string_new( buf );
|
||||
@@ -702,9 +701,9 @@ RULE * lookup_rule( OBJECT * rulename, module_t * m, int local_only )
|
||||
}
|
||||
|
||||
|
||||
RULE * bindrule( OBJECT * rulename, module_t * m )
|
||||
rule_ptr bindrule( object_ptr rulename, module_ptr m )
|
||||
{
|
||||
RULE * result = lookup_rule( rulename, m, 0 );
|
||||
rule_ptr result = lookup_rule( rulename, m, 0 );
|
||||
if ( !result )
|
||||
result = lookup_rule( rulename, root_module(), 0 );
|
||||
/* We have only one caller, 'evaluate_rule', which will complain about
|
||||
@@ -717,21 +716,21 @@ RULE * bindrule( OBJECT * rulename, module_t * m )
|
||||
}
|
||||
|
||||
|
||||
RULE * import_rule( RULE * source, module_t * m, OBJECT * name )
|
||||
rule_ptr import_rule( rule_ptr source, module_ptr m, object_ptr name )
|
||||
{
|
||||
RULE * const dest = define_rule( source->module, name, m );
|
||||
rule_ptr const dest = define_rule( source->module, name, m );
|
||||
set_rule_body( dest, source->procedure );
|
||||
set_rule_actions( dest, source->actions );
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
void rule_localize( RULE * rule, module_t * m )
|
||||
void rule_localize( rule_ptr rule, module_ptr m )
|
||||
{
|
||||
rule->module = m;
|
||||
if ( rule->procedure )
|
||||
{
|
||||
FUNCTION * procedure = function_unbind_variables( rule->procedure );
|
||||
function_ptr procedure = function_unbind_variables( rule->procedure );
|
||||
function_refer( procedure );
|
||||
function_free( rule->procedure );
|
||||
rule->procedure = procedure;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
/* This file is ALSO:
|
||||
* Copyright 2022 René Ferdinand Rivera Morell
|
||||
* Copyright 2001-2004 David Abrahams.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
|
||||
@@ -34,239 +35,236 @@
|
||||
#include "modules.h"
|
||||
#include "timestamp.h"
|
||||
|
||||
|
||||
typedef struct _rule RULE;
|
||||
typedef struct _target TARGET;
|
||||
typedef struct _targets TARGETS;
|
||||
typedef struct _action ACTION;
|
||||
typedef struct _actions ACTIONS;
|
||||
typedef struct _settings SETTINGS ;
|
||||
typedef struct _settings SETTINGS;
|
||||
|
||||
typedef RULE* rule_ptr;
|
||||
typedef TARGET* target_ptr;
|
||||
typedef TARGETS* targets_ptr;
|
||||
typedef ACTION* action_ptr;
|
||||
typedef ACTIONS* actions_ptr;
|
||||
typedef SETTINGS* settings_ptr;
|
||||
|
||||
/* RULE - a generic jam rule, the product of RULE and ACTIONS. */
|
||||
|
||||
/* Build actions corresponding to a rule. */
|
||||
struct rule_actions
|
||||
{
|
||||
int reference_count;
|
||||
FUNCTION * command; /* command string from ACTIONS */
|
||||
LIST * bindlist;
|
||||
int flags; /* modifiers on ACTIONS */
|
||||
|
||||
#define RULE_NEWSRCS 0x01 /* $(>) is updated sources only */
|
||||
#define RULE_TOGETHER 0x02 /* combine actions on single target */
|
||||
#define RULE_IGNORE 0x04 /* ignore return status of executes */
|
||||
#define RULE_QUIETLY 0x08 /* do not mention it unless verbose */
|
||||
#define RULE_PIECEMEAL 0x10 /* split exec so each $(>) is small */
|
||||
#define RULE_EXISTING 0x20 /* $(>) is pre-exisitng sources only */
|
||||
struct rule_actions {
|
||||
int reference_count;
|
||||
function_ptr command; /* command string from ACTIONS */
|
||||
list_ptr bindlist;
|
||||
int flags; /* modifiers on ACTIONS */
|
||||
};
|
||||
|
||||
typedef struct rule_actions rule_actions;
|
||||
typedef struct argument_list argument_list;
|
||||
#define RULE_NEWSRCS 0x01 /* $(>) is updated sources only */
|
||||
#define RULE_TOGETHER 0x02 /* combine actions on single target */
|
||||
#define RULE_IGNORE 0x04 /* ignore return status of executes */
|
||||
#define RULE_QUIETLY 0x08 /* do not mention it unless verbose */
|
||||
#define RULE_PIECEMEAL 0x10 /* split exec so each $(>) is small */
|
||||
#define RULE_EXISTING 0x20 /* $(>) is pre-existing sources only */
|
||||
|
||||
struct _rule
|
||||
{
|
||||
OBJECT * name;
|
||||
FUNCTION * procedure;
|
||||
rule_actions * actions; /* build actions, or NULL for no actions */
|
||||
module_t * module; /* module in which this rule is executed */
|
||||
int exported; /* nonzero if this rule is supposed to appear in
|
||||
* the global module and be automatically
|
||||
* imported into other modules
|
||||
*/
|
||||
typedef struct rule_actions* rule_actions_ptr;
|
||||
|
||||
struct _rule {
|
||||
object_ptr name;
|
||||
function_ptr procedure;
|
||||
rule_actions_ptr actions; /* build actions, or NULL for no actions */
|
||||
module_ptr module; /* module in which this rule is executed */
|
||||
int exported; /* nonzero if this rule is supposed to appear in
|
||||
* the global module and be automatically
|
||||
* imported into other modules
|
||||
*/
|
||||
};
|
||||
|
||||
/* ACTIONS - a chain of ACTIONs. */
|
||||
struct _actions
|
||||
{
|
||||
ACTIONS * next;
|
||||
ACTIONS * tail; /* valid only for head */
|
||||
ACTION * action;
|
||||
struct _actions {
|
||||
actions_ptr next;
|
||||
actions_ptr tail; /* valid only for head */
|
||||
action_ptr action;
|
||||
};
|
||||
|
||||
/* ACTION - a RULE instance with targets and sources. */
|
||||
struct _action
|
||||
{
|
||||
RULE * rule;
|
||||
TARGETS * targets;
|
||||
TARGETS * sources; /* aka $(>) */
|
||||
char running; /* has been started */
|
||||
#define A_INIT 0
|
||||
struct _action {
|
||||
rule_ptr rule;
|
||||
targets_ptr targets;
|
||||
targets_ptr sources; /* aka $(>) */
|
||||
char running; /* has been started */
|
||||
#define A_INIT 0
|
||||
#define A_RUNNING_NOEXEC 1
|
||||
#define A_RUNNING 2
|
||||
int refs;
|
||||
#define A_RUNNING 2
|
||||
int refs;
|
||||
|
||||
/* WARNING: These variables are used to pass state required by make1cmds and
|
||||
* are not valid anywhere else.
|
||||
*/
|
||||
void * first_cmd; /* Pointer to the first CMD created by this action */
|
||||
void * last_cmd; /* Pointer to the last CMD created by this action */
|
||||
void* first_cmd; /* Pointer to the first CMD created by this action */
|
||||
void* last_cmd; /* Pointer to the last CMD created by this action */
|
||||
};
|
||||
|
||||
/* SETTINGS - variables to set when executing a TARGET's ACTIONS. */
|
||||
struct _settings
|
||||
{
|
||||
SETTINGS * next;
|
||||
OBJECT * symbol; /* symbol name for var_set() */
|
||||
LIST * value; /* symbol value for var_set() */
|
||||
struct _settings {
|
||||
settings_ptr next;
|
||||
object_ptr symbol; /* symbol name for var_set() */
|
||||
list_ptr value; /* symbol value for var_set() */
|
||||
};
|
||||
|
||||
/* TARGETS - a chain of TARGETs. */
|
||||
struct _targets
|
||||
{
|
||||
TARGETS * next;
|
||||
TARGETS * tail; /* valid only for head */
|
||||
TARGET * target;
|
||||
struct _targets {
|
||||
targets_ptr next;
|
||||
targets_ptr tail; /* valid only for head */
|
||||
target_ptr target;
|
||||
};
|
||||
|
||||
/* TARGET - an entity (e.g. a file) that can be built. */
|
||||
struct _target
|
||||
{
|
||||
OBJECT * name;
|
||||
OBJECT * boundname; /* if search() relocates target */
|
||||
ACTIONS * actions; /* rules to execute, if any */
|
||||
SETTINGS * settings; /* variables to define */
|
||||
struct _target {
|
||||
object_ptr name;
|
||||
object_ptr boundname; /* if search() relocates target */
|
||||
actions_ptr actions; /* rules to execute, if any */
|
||||
settings_ptr settings; /* variables to define */
|
||||
|
||||
TARGETS * depends; /* dependencies */
|
||||
TARGETS * dependants; /* the inverse of dependencies */
|
||||
TARGETS * rebuilds; /* targets that should be force-rebuilt
|
||||
* whenever this one is
|
||||
*/
|
||||
TARGET * includes; /* internal includes node */
|
||||
targets_ptr depends; /* dependencies */
|
||||
targets_ptr dependants; /* the inverse of dependencies */
|
||||
targets_ptr rebuilds; /* targets that should be force-rebuilt
|
||||
* whenever this one is
|
||||
*/
|
||||
target_ptr includes; /* internal includes node */
|
||||
|
||||
timestamp time; /* update time */
|
||||
timestamp leaf; /* update time of leaf sources */
|
||||
timestamp time; /* update time */
|
||||
timestamp leaf; /* update time of leaf sources */
|
||||
|
||||
short flags; /* status info */
|
||||
short flags; /* status info */
|
||||
|
||||
#define T_FLAG_TEMP 0x0001 /* TEMPORARY applied */
|
||||
#define T_FLAG_NOCARE 0x0002 /* NOCARE applied */
|
||||
#define T_FLAG_NOTFILE 0x0004 /* NOTFILE applied */
|
||||
#define T_FLAG_TOUCHED 0x0008 /* ALWAYS applied or -t target */
|
||||
#define T_FLAG_LEAVES 0x0010 /* LEAVES applied */
|
||||
#define T_FLAG_NOUPDATE 0x0020 /* NOUPDATE applied */
|
||||
#define T_FLAG_VISITED 0x0040 /* CWM: Used in debugging */
|
||||
#define T_FLAG_TEMP 0x0001 /* TEMPORARY applied */
|
||||
#define T_FLAG_NOCARE 0x0002 /* NOCARE applied */
|
||||
#define T_FLAG_NOTFILE 0x0004 /* NOTFILE applied */
|
||||
#define T_FLAG_TOUCHED 0x0008 /* ALWAYS applied or -t target */
|
||||
#define T_FLAG_LEAVES 0x0010 /* LEAVES applied */
|
||||
#define T_FLAG_NOUPDATE 0x0020 /* NOUPDATE applied */
|
||||
#define T_FLAG_VISITED 0x0040 /* CWM: Used in debugging */
|
||||
|
||||
/* This flag has been added to support a new built-in rule named "RMBAD". It is
|
||||
* used to force removal of outdated targets whose dependencies fail to build.
|
||||
*/
|
||||
#define T_FLAG_RMOLD 0x0080 /* RMBAD applied */
|
||||
#define T_FLAG_RMOLD 0x0080 /* RMBAD applied */
|
||||
|
||||
/* This flag was added to support a new built-in rule named "FAIL_EXPECTED" used
|
||||
* to indicate that the result of running a given action should be inverted,
|
||||
* i.e. ok <=> fail. Useful for launching certain test runs from a Jamfile.
|
||||
*/
|
||||
#define T_FLAG_FAIL_EXPECTED 0x0100 /* FAIL_EXPECTED applied */
|
||||
#define T_FLAG_FAIL_EXPECTED 0x0100 /* FAIL_EXPECTED applied */
|
||||
|
||||
#define T_FLAG_INTERNAL 0x0200 /* internal INCLUDES node */
|
||||
#define T_FLAG_INTERNAL 0x0200 /* internal INCLUDES node */
|
||||
|
||||
/* Indicates that the target must be a file. Prevents matching non-files, like
|
||||
* directories, when a target is searched.
|
||||
*/
|
||||
#define T_FLAG_ISFILE 0x0400
|
||||
#define T_FLAG_ISFILE 0x0400
|
||||
|
||||
#define T_FLAG_PRECIOUS 0x0800
|
||||
#define T_FLAG_PRECIOUS 0x0800
|
||||
|
||||
char binding; /* how target relates to a real file or
|
||||
* folder
|
||||
*/
|
||||
char binding; /* how target relates to a real file or
|
||||
* folder
|
||||
*/
|
||||
|
||||
#define T_BIND_UNBOUND 0 /* a disembodied name */
|
||||
#define T_BIND_MISSING 1 /* could not find real file */
|
||||
#define T_BIND_PARENTS 2 /* using parent's timestamp */
|
||||
#define T_BIND_EXISTS 3 /* real file, timestamp valid */
|
||||
#define T_BIND_UNBOUND 0 /* a disembodied name */
|
||||
#define T_BIND_MISSING 1 /* could not find real file */
|
||||
#define T_BIND_PARENTS 2 /* using parent's timestamp */
|
||||
#define T_BIND_EXISTS 3 /* real file, timestamp valid */
|
||||
|
||||
char fate; /* make0()'s diagnosis */
|
||||
char fate; /* make0()'s diagnosis */
|
||||
|
||||
#define T_FATE_INIT 0 /* nothing done to target */
|
||||
#define T_FATE_MAKING 1 /* make0(target) on stack */
|
||||
#define T_FATE_INIT 0 /* nothing done to target */
|
||||
#define T_FATE_MAKING 1 /* make0(target) on stack */
|
||||
|
||||
#define T_FATE_STABLE 2 /* target did not need updating */
|
||||
#define T_FATE_NEWER 3 /* target newer than parent */
|
||||
#define T_FATE_STABLE 2 /* target did not need updating */
|
||||
#define T_FATE_NEWER 3 /* target newer than parent */
|
||||
|
||||
#define T_FATE_SPOIL 4 /* >= SPOIL rebuilds parents */
|
||||
#define T_FATE_ISTMP 4 /* unneeded temp target oddly present */
|
||||
#define T_FATE_SPOIL 4 /* >= SPOIL rebuilds parents */
|
||||
#define T_FATE_ISTMP 4 /* unneeded temp target oddly present */
|
||||
|
||||
#define T_FATE_BUILD 5 /* >= BUILD rebuilds target */
|
||||
#define T_FATE_TOUCHED 5 /* manually touched with -t */
|
||||
#define T_FATE_REBUILD 6
|
||||
#define T_FATE_MISSING 7 /* is missing, needs updating */
|
||||
#define T_FATE_NEEDTMP 8 /* missing temp that must be rebuild */
|
||||
#define T_FATE_OUTDATED 9 /* is out of date, needs updating */
|
||||
#define T_FATE_UPDATE 10 /* deps updated, needs updating */
|
||||
#define T_FATE_BUILD 5 /* >= BUILD rebuilds target */
|
||||
#define T_FATE_TOUCHED 5 /* manually touched with -t */
|
||||
#define T_FATE_REBUILD 6
|
||||
#define T_FATE_MISSING 7 /* is missing, needs updating */
|
||||
#define T_FATE_NEEDTMP 8 /* missing temp that must be rebuild */
|
||||
#define T_FATE_OUTDATED 9 /* is out of date, needs updating */
|
||||
#define T_FATE_UPDATE 10 /* deps updated, needs updating */
|
||||
|
||||
#define T_FATE_BROKEN 11 /* >= BROKEN ruins parents */
|
||||
#define T_FATE_CANTFIND 11 /* no rules to make missing target */
|
||||
#define T_FATE_CANTMAKE 12 /* can not find dependencies */
|
||||
#define T_FATE_BROKEN 11 /* >= BROKEN ruins parents */
|
||||
#define T_FATE_CANTFIND 11 /* no rules to make missing target */
|
||||
#define T_FATE_CANTMAKE 12 /* can not find dependencies */
|
||||
|
||||
char progress; /* tracks make1() progress */
|
||||
char progress; /* tracks make1() progress */
|
||||
|
||||
#define T_MAKE_INIT 0 /* make1(target) not yet called */
|
||||
#define T_MAKE_ONSTACK 1 /* make1(target) on stack */
|
||||
#define T_MAKE_ACTIVE 2 /* make1(target) in make1b() */
|
||||
#define T_MAKE_RUNNING 3 /* make1(target) running commands */
|
||||
#define T_MAKE_DONE 4 /* make1(target) done */
|
||||
#define T_MAKE_NOEXEC_DONE 5 /* make1(target) done with -n in effect */
|
||||
#define T_MAKE_INIT 0 /* make1(target) not yet called */
|
||||
#define T_MAKE_ONSTACK 1 /* make1(target) on stack */
|
||||
#define T_MAKE_ACTIVE 2 /* make1(target) in make1b() */
|
||||
#define T_MAKE_RUNNING 3 /* make1(target) running commands */
|
||||
#define T_MAKE_DONE 4 /* make1(target) done */
|
||||
#define T_MAKE_NOEXEC_DONE 5 /* make1(target) done with -n in effect */
|
||||
|
||||
#ifdef OPT_SEMAPHORE
|
||||
#define T_MAKE_SEMAPHORE 5 /* Special target type for semaphores */
|
||||
#define T_MAKE_SEMAPHORE 5 /* Special target type for semaphores */
|
||||
#endif
|
||||
|
||||
char status; /* exec_cmd() result */
|
||||
char status; /* exec_cmd() result */
|
||||
|
||||
#ifdef OPT_SEMAPHORE
|
||||
TARGET * semaphore; /* used in serialization */
|
||||
target_ptr semaphore; /* used in serialization */
|
||||
#endif
|
||||
|
||||
int asynccnt; /* child deps outstanding */
|
||||
TARGETS * parents; /* used by make1() for completion */
|
||||
TARGET * scc_root; /* used by make to resolve cyclic includes
|
||||
*/
|
||||
TARGET * rescanning; /* used by make0 to mark visited targets
|
||||
* when rescanning
|
||||
*/
|
||||
int depth; /* The depth of the target in the make0
|
||||
* stack.
|
||||
*/
|
||||
char * cmds; /* type-punned command list */
|
||||
int asynccnt; /* child deps outstanding */
|
||||
targets_ptr parents; /* used by make1() for completion */
|
||||
target_ptr scc_root; /* used by make to resolve cyclic includes
|
||||
*/
|
||||
target_ptr rescanning; /* used by make0 to mark visited targets
|
||||
* when rescanning
|
||||
*/
|
||||
int depth; /* The depth of the target in the make0
|
||||
* stack.
|
||||
*/
|
||||
char* cmds; /* type-punned command list */
|
||||
|
||||
char const * failed;
|
||||
char const* failed;
|
||||
};
|
||||
|
||||
|
||||
/* Action related functions. */
|
||||
void action_free ( ACTION * );
|
||||
ACTIONS * actionlist ( ACTIONS *, ACTION * );
|
||||
void freeactions ( ACTIONS * );
|
||||
SETTINGS * addsettings ( SETTINGS *, int flag, OBJECT * symbol, LIST * value );
|
||||
void pushsettings ( module_t *, SETTINGS * );
|
||||
void popsettings ( module_t *, SETTINGS * );
|
||||
SETTINGS * copysettings ( SETTINGS * );
|
||||
void freesettings ( SETTINGS * );
|
||||
void actions_refer( rule_actions * );
|
||||
void actions_free ( rule_actions * );
|
||||
void action_free(action_ptr);
|
||||
actions_ptr actionlist(actions_ptr, action_ptr);
|
||||
void freeactions(actions_ptr);
|
||||
settings_ptr addsettings(settings_ptr, int flag, object_ptr symbol, list_ptr value);
|
||||
void pushsettings(module_ptr, settings_ptr);
|
||||
void popsettings(module_ptr, settings_ptr);
|
||||
settings_ptr copysettings(settings_ptr);
|
||||
void freesettings(settings_ptr);
|
||||
void actions_refer(rule_actions_ptr);
|
||||
void actions_free(rule_actions_ptr);
|
||||
|
||||
/* Rule related functions. */
|
||||
RULE * bindrule ( OBJECT * rulename, module_t * );
|
||||
RULE * import_rule ( RULE * source, module_t *, OBJECT * name );
|
||||
void rule_localize ( RULE * rule, module_t * module );
|
||||
RULE * new_rule_body ( module_t *, OBJECT * rulename, FUNCTION * func, int exprt );
|
||||
RULE * new_rule_actions( module_t *, OBJECT * rulename, FUNCTION * command, LIST * bindlist, int flags );
|
||||
void rule_free ( RULE * );
|
||||
rule_ptr bindrule(object_ptr rulename, module_ptr);
|
||||
rule_ptr import_rule(rule_ptr source, module_ptr, object_ptr name);
|
||||
void rule_localize(rule_ptr rule, module_ptr module);
|
||||
rule_ptr new_rule_body(module_ptr, object_ptr rulename, function_ptr func, int exprt);
|
||||
rule_ptr new_rule_actions(module_ptr, object_ptr rulename, function_ptr command, list_ptr bindlist, int flags);
|
||||
void rule_free(rule_ptr);
|
||||
|
||||
/* Target related functions. */
|
||||
void bind_explicitly_located_targets();
|
||||
TARGET * bindtarget ( OBJECT * const );
|
||||
void freetargets ( TARGETS * );
|
||||
TARGETS * targetchain ( TARGETS *, TARGETS * );
|
||||
TARGETS * targetentry ( TARGETS *, TARGET * );
|
||||
void target_include ( TARGET * const including,
|
||||
TARGET * const included );
|
||||
void target_include_many ( TARGET * const including,
|
||||
LIST * const included_names );
|
||||
TARGETS * targetlist ( TARGETS *, LIST * target_names );
|
||||
void touch_target ( OBJECT * const );
|
||||
void clear_includes ( TARGET * );
|
||||
TARGET * target_scc ( TARGET * );
|
||||
void bind_explicitly_located_targets();
|
||||
target_ptr bindtarget(object_ptr const);
|
||||
void freetargets(targets_ptr);
|
||||
targets_ptr targetchain(targets_ptr, targets_ptr);
|
||||
targets_ptr targetentry(targets_ptr, target_ptr);
|
||||
void target_include(target_ptr const including,
|
||||
target_ptr const included);
|
||||
void target_include_many(target_ptr const including,
|
||||
list_ptr const included_names);
|
||||
targets_ptr targetlist(targets_ptr, list_ptr target_names);
|
||||
void touch_target(object_ptr const);
|
||||
void clear_includes(target_ptr);
|
||||
target_ptr target_scc(target_ptr);
|
||||
|
||||
/* Final module cleanup. */
|
||||
void rules_done();
|
||||
|
||||
Reference in New Issue
Block a user