1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-03 07:24:58 +03:00
inform7/inbuild/supervisor-module/Chapter 3/Build Scripts.w

45 lines
1.2 KiB
OpenEdge ABL
Raw Normal View History

[BuildScripts::] Build Scripts.
2020-03-30 14:23:06 +03:00
Scripts are nothing more than lists of build steps.
@h Build scripts.
2020-03-30 14:23:06 +03:00
Suppose the incremental build algorithm has decided it wants to build node
|V| in the graph: it does so by calling |BuildScripts::execute| on the script
attached to |V|. This is only a list of steps:
=
typedef struct build_script {
struct linked_list *steps; /* of |build_step| */
2020-05-09 15:07:39 +03:00
CLASS_DEFINITION
} build_script;
build_script *BuildScripts::new(void) {
build_script *BS = CREATE(build_script);
BS->steps = NEW_LINKED_LIST(build_step);
return BS;
}
void BuildScripts::add_step(build_script *BS, build_step *S) {
ADD_TO_LINKED_LIST(S, build_step, BS->steps);
}
2020-03-30 14:23:06 +03:00
int BuildScripts::script_length(build_script *BS) {
if (BS == NULL) return 0;
return LinkedLists::len(BS->steps);
}
2020-03-30 14:23:06 +03:00
@ We execute the steps in sequence, of course. As soon as any step fails,
returning |FALSE|, the script halts and returns |FALSE|. An empty script
always succeeds and returns |TRUE|.
=
int BuildScripts::execute(build_vertex *V, build_script *BS, build_methodology *BM,
linked_list *search_list) {
int rv = TRUE;
build_step *S;
LOOP_OVER_LINKED_LIST(S, build_step, BS->steps)
if (rv)
rv = BuildSteps::execute(V, S, BM, search_list);
return rv;
}