1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-08 18:14:21 +03:00
inform7/docs/inbuild-module/3-bs.html

77 lines
8 KiB
HTML
Raw Normal View History

2020-02-27 13:18:25 +02:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>3/bm</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="en-gb">
<link href="inweb.css" rel="stylesheet" rev="stylesheet" type="text/css">
</head>
<body>
<!--Weave of '3/bs' generated by 7-->
<ul class="crumbs"><li><a href="../webs.html">&#9733;</a></li><li><a href="index.html">inbuild</a></li><li><a href="index.html#3">Chapter 3: Incremental Builds</a></li><li><b>Build Scripts</b></li></ul><p class="purpose">Scripts are nothing more than list of build steps.</p>
<ul class="toc"><li><a href="#SP1">&#167;1. Build scripts</a></li></ul><hr class="tocbar">
<p class="inwebparagraph"><a id="SP1"></a><b>&#167;1. Build scripts. </b>Simple lists of steps: nothing to see here...
</p>
<pre class="display">
<span class="reserved">typedef</span><span class="plain"> </span><span class="reserved">struct</span><span class="plain"> </span><span class="reserved">build_script</span><span class="plain"> {</span>
<span class="reserved">struct</span><span class="plain"> </span><span class="identifier">linked_list</span><span class="plain"> *</span><span class="identifier">steps</span><span class="plain">; </span> <span class="comment">of <code class="display"><span class="extract">build_step</span></code></span>
<span class="identifier">MEMORY_MANAGEMENT</span>
<span class="plain">} </span><span class="reserved">build_script</span><span class="plain">;</span>
<span class="reserved">build_script</span><span class="plain"> *</span><span class="functiontext">BuildScripts::new</span><span class="plain">(</span><span class="reserved">void</span><span class="plain">) {</span>
<span class="reserved">build_script</span><span class="plain"> *</span><span class="identifier">BS</span><span class="plain"> = </span><span class="identifier">CREATE</span><span class="plain">(</span><span class="reserved">build_script</span><span class="plain">);</span>
<span class="identifier">BS</span><span class="plain">-</span><span class="element">&gt;steps</span><span class="plain"> = </span><span class="identifier">NEW_LINKED_LIST</span><span class="plain">(</span><span class="reserved">build_step</span><span class="plain">);</span>
<span class="reserved">return</span><span class="plain"> </span><span class="identifier">BS</span><span class="plain">;</span>
<span class="plain">}</span>
2020-03-11 02:21:09 +02:00
<span class="reserved">int</span><span class="plain"> </span><span class="functiontext">BuildScripts::script_length</span><span class="plain">(</span><span class="reserved">build_script</span><span class="plain"> *</span><span class="identifier">BS</span><span class="plain">) {</span>
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">BS</span><span class="plain"> == </span><span class="identifier">NULL</span><span class="plain">) </span><span class="reserved">return</span><span class="plain"> 0;</span>
<span class="reserved">return</span><span class="plain"> </span><span class="identifier">LinkedLists::len</span><span class="plain">(</span><span class="identifier">BS</span><span class="plain">-</span><span class="element">&gt;steps</span><span class="plain">);</span>
<span class="plain">}</span>
2020-02-27 13:18:25 +02:00
<span class="reserved">void</span><span class="plain"> </span><span class="functiontext">BuildScripts::add_step</span><span class="plain">(</span><span class="reserved">build_script</span><span class="plain"> *</span><span class="identifier">BS</span><span class="plain">, </span><span class="reserved">build_step</span><span class="plain"> *</span><span class="identifier">S</span><span class="plain">) {</span>
<span class="identifier">ADD_TO_LINKED_LIST</span><span class="plain">(</span><span class="identifier">S</span><span class="plain">, </span><span class="reserved">build_step</span><span class="plain">, </span><span class="identifier">BS</span><span class="plain">-</span><span class="element">&gt;steps</span><span class="plain">);</span>
<span class="plain">}</span>
<span class="reserved">void</span><span class="plain"> </span><span class="functiontext">BuildScripts::concatenate</span><span class="plain">(</span><span class="reserved">build_script</span><span class="plain"> *</span><span class="identifier">BT</span><span class="plain">, </span><span class="reserved">build_script</span><span class="plain"> *</span><span class="identifier">BF</span><span class="plain">) {</span>
<span class="reserved">build_step</span><span class="plain"> *</span><span class="identifier">S</span><span class="plain">;</span>
<span class="identifier">LOOP_OVER_LINKED_LIST</span><span class="plain">(</span><span class="identifier">S</span><span class="plain">, </span><span class="reserved">build_step</span><span class="plain">, </span><span class="identifier">BF</span><span class="plain">-</span><span class="element">&gt;steps</span><span class="plain">)</span>
<span class="functiontext">BuildScripts::add_step</span><span class="plain">(</span><span class="identifier">BT</span><span class="plain">, </span><span class="identifier">S</span><span class="plain">);</span>
<span class="plain">}</span>
<span class="reserved">int</span><span class="plain"> </span><span class="functiontext">BuildScripts::execute</span><span class="plain">(</span><span class="reserved">build_vertex</span><span class="plain"> *</span><span class="identifier">V</span><span class="plain">, </span><span class="reserved">build_script</span><span class="plain"> *</span><span class="identifier">BS</span><span class="plain">, </span><span class="reserved">build_methodology</span><span class="plain"> *</span><span class="identifier">meth</span><span class="plain">) {</span>
<span class="reserved">int</span><span class="plain"> </span><span class="identifier">rv</span><span class="plain"> = </span><span class="identifier">TRUE</span><span class="plain">;</span>
<span class="reserved">build_step</span><span class="plain"> *</span><span class="identifier">S</span><span class="plain">;</span>
<span class="identifier">LOOP_OVER_LINKED_LIST</span><span class="plain">(</span><span class="identifier">S</span><span class="plain">, </span><span class="reserved">build_step</span><span class="plain">, </span><span class="identifier">BS</span><span class="plain">-</span><span class="element">&gt;steps</span><span class="plain">)</span>
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">rv</span><span class="plain">)</span>
<span class="identifier">rv</span><span class="plain"> = </span><span class="functiontext">BuildSteps::execute</span><span class="plain">(</span><span class="identifier">V</span><span class="plain">, </span><span class="identifier">S</span><span class="plain">, </span><span class="identifier">meth</span><span class="plain">);</span>
<span class="reserved">return</span><span class="plain"> </span><span class="identifier">rv</span><span class="plain">;</span>
<span class="plain">}</span>
</pre>
<p class="inwebparagraph"></p>
<p class="endnote">The function BuildScripts::new is used in 3/bg (<a href="3-bg.html#SP1">&#167;1</a>).</p>
2020-03-11 02:21:09 +02:00
<p class="endnote">The function BuildScripts::script_length is used in 3/bg (<a href="3-bg.html#SP2">&#167;2</a>).</p>
2020-02-27 13:18:25 +02:00
<p class="endnote">The function BuildScripts::add_step is used in 3/bs2 (<a href="3-bs2.html#SP4">&#167;4</a>).</p>
<p class="endnote">The function BuildScripts::concatenate appears nowhere else.</p>
<p class="endnote">The function BuildScripts::execute is used in 3/bg (<a href="3-bg.html#SP2">&#167;2</a>).</p>
<p class="endnote">The structure build_script is private to this section.</p>
<hr class="tocbar">
<ul class="toc"><li><a href="3-bm.html">Back to 'Build Methodology'</a></li><li><a href="3-bs2.html">Continue with 'Build Steps'</a></li></ul><hr class="tocbar">
<!--End of weave-->
</body>
</html>