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/2-edt.html

87 lines
10 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>2/wrk</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 '2/edt' 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#2">Chapter 2: Conceptual Framework</a></li><li><b>Editions</b></li></ul><p class="purpose">An edition is numbered version of a work.</p>
<ul class="toc"><li><a href="#SP1">&#167;1. Editions</a></li></ul><hr class="tocbar">
<p class="inwebparagraph"><a id="SP1"></a><b>&#167;1. Editions. </b>An "edition" of a work is a particular version numbered form of it. For
example, release 7 of Bronze by Emily Short would be an edition of Bronze.
</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">inbuild_edition</span><span class="plain"> {</span>
<span class="reserved">struct</span><span class="plain"> </span><span class="reserved">inbuild_work</span><span class="plain"> *</span><span class="identifier">work</span><span class="plain">;</span>
<span class="reserved">struct</span><span class="plain"> </span><span class="identifier">semantic_version_number</span><span class="plain"> </span><span class="identifier">version</span><span class="plain">;</span>
<span class="reserved">struct</span><span class="plain"> </span><span class="identifier">compatibility_specification</span><span class="plain"> *</span><span class="identifier">compatibility</span><span class="plain">;</span>
<span class="identifier">MEMORY_MANAGEMENT</span>
<span class="plain">} </span><span class="reserved">inbuild_edition</span><span class="plain">;</span>
<span class="reserved">inbuild_edition</span><span class="plain"> *</span><span class="functiontext">Editions::new</span><span class="plain">(</span><span class="reserved">inbuild_work</span><span class="plain"> *</span><span class="identifier">work</span><span class="plain">, </span><span class="identifier">semantic_version_number</span><span class="plain"> </span><span class="identifier">version</span><span class="plain">) {</span>
<span class="reserved">inbuild_edition</span><span class="plain"> *</span><span class="identifier">edition</span><span class="plain"> = </span><span class="identifier">CREATE</span><span class="plain">(</span><span class="reserved">inbuild_edition</span><span class="plain">);</span>
<span class="identifier">edition</span><span class="plain">-</span><span class="element">&gt;work</span><span class="plain"> = </span><span class="identifier">work</span><span class="plain">;</span>
<span class="identifier">edition</span><span class="plain">-</span><span class="element">&gt;version</span><span class="plain"> = </span><span class="identifier">version</span><span class="plain">;</span>
<span class="identifier">edition</span><span class="plain">-</span><span class="element">&gt;compatibility</span><span class="plain"> = </span><span class="identifier">Compatibility::all</span><span class="plain">();</span>
<span class="reserved">return</span><span class="plain"> </span><span class="identifier">edition</span><span class="plain">;</span>
<span class="plain">}</span>
<span class="reserved">void</span><span class="plain"> </span><span class="functiontext">Editions::write</span><span class="plain">(</span><span class="identifier">OUTPUT_STREAM</span><span class="plain">, </span><span class="reserved">inbuild_edition</span><span class="plain"> *</span><span class="identifier">E</span><span class="plain">) {</span>
<span class="functiontext">Works::write</span><span class="plain">(</span><span class="identifier">OUT</span><span class="plain">, </span><span class="identifier">E</span><span class="plain">-</span><span class="element">&gt;work</span><span class="plain">);</span>
<span class="identifier">semantic_version_number</span><span class="plain"> </span><span class="identifier">V</span><span class="plain"> = </span><span class="identifier">E</span><span class="plain">-</span><span class="element">&gt;version</span><span class="plain">;</span>
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">VersionNumbers::is_null</span><span class="plain">(</span><span class="identifier">V</span><span class="plain">) == </span><span class="identifier">FALSE</span><span class="plain">) {</span>
<span class="identifier">WRITE</span><span class="plain">(</span><span class="string">" v%v"</span><span class="plain">, &amp;</span><span class="identifier">V</span><span class="plain">);</span>
<span class="plain">}</span>
<span class="plain">}</span>
2020-03-11 02:21:09 +02:00
<span class="reserved">void</span><span class="plain"> </span><span class="functiontext">Editions::write_canonical_leaf</span><span class="plain">(</span><span class="identifier">OUTPUT_STREAM</span><span class="plain">, </span><span class="reserved">inbuild_edition</span><span class="plain"> *</span><span class="identifier">E</span><span class="plain">) {</span>
<span class="identifier">WRITE</span><span class="plain">(</span><span class="string">"%S"</span><span class="plain">, </span><span class="identifier">E</span><span class="plain">-</span><span class="element">&gt;work</span><span class="plain">-</span><span class="element">&gt;title</span><span class="plain">);</span>
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">VersionNumbers::is_null</span><span class="plain">(</span><span class="identifier">E</span><span class="plain">-</span><span class="element">&gt;version</span><span class="plain">) == </span><span class="identifier">FALSE</span><span class="plain">) {</span>
<span class="identifier">TEMPORARY_TEXT</span><span class="plain">(</span><span class="identifier">vn</span><span class="plain">);</span>
<span class="identifier">WRITE_TO</span><span class="plain">(</span><span class="identifier">vn</span><span class="plain">, </span><span class="string">"-v%v"</span><span class="plain">, &amp;(</span><span class="identifier">E</span><span class="plain">-</span><span class="element">&gt;version</span><span class="plain">));</span>
<span class="identifier">LOOP_THROUGH_TEXT</span><span class="plain">(</span><span class="identifier">pos</span><span class="plain">, </span><span class="identifier">vn</span><span class="plain">)</span>
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">Str::get</span><span class="plain">(</span><span class="identifier">pos</span><span class="plain">) == </span><span class="character">'.'</span><span class="plain">)</span>
<span class="identifier">PUT</span><span class="plain">(</span><span class="character">'_'</span><span class="plain">);</span>
<span class="reserved">else</span>
<span class="identifier">PUT</span><span class="plain">(</span><span class="identifier">Str::get</span><span class="plain">(</span><span class="identifier">pos</span><span class="plain">));</span>
<span class="identifier">DISCARD_TEXT</span><span class="plain">(</span><span class="identifier">vn</span><span class="plain">);</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">Editions::inspect</span><span class="plain">(</span><span class="identifier">OUTPUT_STREAM</span><span class="plain">, </span><span class="reserved">inbuild_edition</span><span class="plain"> *</span><span class="identifier">E</span><span class="plain">) {</span>
<span class="functiontext">Editions::write</span><span class="plain">(</span><span class="identifier">OUT</span><span class="plain">, </span><span class="identifier">E</span><span class="plain">);</span>
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">Compatibility::universal</span><span class="plain">(</span><span class="identifier">E</span><span class="plain">-</span><span class="element">&gt;compatibility</span><span class="plain">) == </span><span class="identifier">FALSE</span><span class="plain">) {</span>
<span class="identifier">WRITE</span><span class="plain">(</span><span class="string">" ("</span><span class="plain">);</span>
<span class="identifier">Compatibility::write</span><span class="plain">(</span><span class="identifier">OUT</span><span class="plain">, </span><span class="identifier">E</span><span class="plain">-</span><span class="element">&gt;compatibility</span><span class="plain">);</span>
<span class="identifier">WRITE</span><span class="plain">(</span><span class="string">")"</span><span class="plain">);</span>
<span class="plain">}</span>
<span class="plain">}</span>
</pre>
<p class="inwebparagraph"></p>
<p class="endnote">The function Editions::new is used in 4/km (<a href="4-km.html#SP3">&#167;3</a>), 4/em (<a href="4-em.html#SP5">&#167;5</a>), 4/lm (<a href="4-lm.html#SP4">&#167;4</a>), 4/pbm (<a href="4-pbm.html#SP2">&#167;2</a>), 4/pfm (<a href="4-pfm.html#SP2">&#167;2</a>), 4/tm (<a href="4-tm.html#SP3">&#167;3</a>), 4/pm (<a href="4-pm.html#SP5">&#167;5</a>), 5/es (<a href="5-es.html#SP1">&#167;1</a>).</p>
<p class="endnote">The function Editions::write is used in 2/cps (<a href="2-cps.html#SP1">&#167;1</a>).</p>
2020-03-11 02:21:09 +02:00
<p class="endnote">The function Editions::write_canonical_leaf is used in 4/km (<a href="4-km.html#SP6">&#167;6</a>), 4/em (<a href="4-em.html#SP8">&#167;8</a>), 4/lm (<a href="4-lm.html#SP7">&#167;7</a>), 4/tm (<a href="4-tm.html#SP6">&#167;6</a>), 4/pm (<a href="4-pm.html#SP7">&#167;7</a>).</p>
2020-02-27 13:18:25 +02:00
<p class="endnote">The function Editions::inspect is used in 2/cps (<a href="2-cps.html#SP1">&#167;1</a>).</p>
2020-03-11 02:21:09 +02:00
<p class="endnote">The structure inbuild_edition is accessed in 2/wrk, 2/cps, 2/rqr, 2/nst, 3/bg, 3/is2, 4/km, 4/em, 4/lm, 4/pbm, 4/pfm, 4/tm, 4/pm, 5/kts, 5/es, 5/ed, 5/ed2, 5/ec, 5/ts, 5/ps, 5/ls, 5/ps2, 6/hdn, 6/inc, 6/vmg and here.</p>
2020-02-27 13:18:25 +02:00
<hr class="tocbar">
<ul class="toc"><li><a href="2-wrk.html">Back to 'Works'</a></li><li><a href="2-cps.html">Continue with 'Copies'</a></li></ul><hr class="tocbar">
<!--End of weave-->
</body>
</html>