mirror of
https://github.com/ganelson/inform.git
synced 2024-07-16 14:04:24 +03:00
164 lines
32 KiB
HTML
164 lines
32 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<title>The Pragma Construct</title>
|
|
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
|
<meta name="viewport" content="width=device-width initial-scale=1">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<meta http-equiv="Content-Language" content="en-gb">
|
|
|
|
<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
|
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
|
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
|
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
|
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
|
<script>
|
|
function togglePopup(material_id) {
|
|
var popup = document.getElementById(material_id);
|
|
popup.classList.toggle("show");
|
|
}
|
|
</script>
|
|
|
|
<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
|
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
|
|
|
</head>
|
|
<body class="commentary-font">
|
|
<nav role="navigation">
|
|
<h1><a href="../index.html">
|
|
<img src="../docs-assets/Inform.png" height=72">
|
|
</a></h1>
|
|
<ul><li><a href="../index.html">home</a></li>
|
|
</ul><h2>Compiler</h2><ul>
|
|
<li><a href="../structure.html">structure</a></li>
|
|
<li><a href="../inbuildn.html">inbuild</a></li>
|
|
<li><a href="../inform7n.html">inform7</a></li>
|
|
<li><a href="../intern.html">inter</a></li>
|
|
<li><a href="../services.html">services</a></li>
|
|
<li><a href="../secrets.html">secrets</a></li>
|
|
</ul><h2>Other Tools</h2><ul>
|
|
<li><a href="../inblorbn.html">inblorb</a></li>
|
|
<li><a href="../indocn.html">indoc</a></li>
|
|
<li><a href="../inform6.html">inform6</a></li>
|
|
<li><a href="../inpolicyn.html">inpolicy</a></li>
|
|
<li><a href="../inrtpsn.html">inrtps</a></li>
|
|
</ul><h2>Resources</h2><ul>
|
|
<li><a href="../extensions.html">extensions</a></li>
|
|
<li><a href="../kits.html">kits</a></li>
|
|
</ul><h2>Repository</h2><ul>
|
|
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=18> github</a></li>
|
|
</ul><h2>Related Projects</h2><ul>
|
|
<li><a href="../../../inweb/index.html">inweb</a></li>
|
|
<li><a href="../../../intest/index.html">intest</a></li>
|
|
|
|
</ul>
|
|
</nav>
|
|
<main role="main">
|
|
<!--Weave of 'The Pragma Construct' generated by Inweb-->
|
|
<div class="breadcrumbs">
|
|
<ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../intern.html">Inter Modules</a></li><li><a href="index.html">bytecode</a></li><li><a href="index.html#4">Chapter 4: Void Constructs</a></li><li><b>The Pragma Construct</b></li></ul></div>
|
|
<p class="purpose">Defining the pragma construct.</p>
|
|
|
|
<ul class="toc"><li><a href="4-tpc4.html#SP1">§1. Definition</a></li><li><a href="4-tpc4.html#SP2">§2. Instructions</a></li><li><a href="4-tpc4.html#SP4">§4. Creating from textual Inter syntax</a></li><li><a href="4-tpc4.html#SP5">§5. Writing to textual Inter syntax</a></li><li><a href="4-tpc4.html#SP6">§6. Access functions</a></li></ul><hr class="tocbar">
|
|
|
|
<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>§1. Definition. </b>For what this does and why it is used, see <a href="../inter/M-ti.html" class="internal">Textual Inter (in inter)</a>.
|
|
</p>
|
|
|
|
<pre class="displayed-code all-displayed-code code-font">
|
|
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PragmaInstruction::define_construct</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">PragmaInstruction::define_construct</span></span>:<br/>Inter Constructs - <a href="3-ic.html#SP15">§15</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
|
|
<span class="plain-syntax"> </span><span class="reserved-syntax">inter_construct</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IC</span><span class="plain-syntax"> = </span><a href="3-ic.html#SP1" class="function-link"><span class="function-syntax">InterInstruction::create_construct</span></a><span class="plain-syntax">(</span><span class="constant-syntax">PRAGMA_IST</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"pragma"</span><span class="plain-syntax">);</span>
|
|
<span class="plain-syntax"> </span><a href="3-ic.html#SP8" class="function-link"><span class="function-syntax">InterInstruction::specify_syntax</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"pragma IDENTIFIER TEXT"</span><span class="plain-syntax">);</span>
|
|
<span class="plain-syntax"> </span><a href="3-ic.html#SP4" class="function-link"><span class="function-syntax">InterInstruction::data_extent_always</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">);</span>
|
|
<span class="plain-syntax"> </span><a href="3-ic.html#SP3" class="function-link"><span class="function-syntax">InterInstruction::permit</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">OUTSIDE_OF_PACKAGES_ICUP</span><span class="plain-syntax">);</span>
|
|
<span class="plain-syntax"> </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTRUCT_READ_MTID</span><span class="plain-syntax">, </span><a href="4-tpc4.html#SP4" class="function-link"><span class="function-syntax">PragmaInstruction::read</span></a><span class="plain-syntax">);</span>
|
|
<span class="plain-syntax"> </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTRUCT_TRANSPOSE_MTID</span><span class="plain-syntax">, </span><a href="4-tpc4.html#SP2" class="function-link"><span class="function-syntax">PragmaInstruction::transpose</span></a><span class="plain-syntax">);</span>
|
|
<span class="plain-syntax"> </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTRUCT_VERIFY_MTID</span><span class="plain-syntax">, </span><a href="4-tpc4.html#SP3" class="function-link"><span class="function-syntax">PragmaInstruction::verify</span></a><span class="plain-syntax">);</span>
|
|
<span class="plain-syntax"> </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTRUCT_WRITE_MTID</span><span class="plain-syntax">, </span><a href="4-tpc4.html#SP5" class="function-link"><span class="function-syntax">PragmaInstruction::write</span></a><span class="plain-syntax">);</span>
|
|
<span class="plain-syntax">}</span>
|
|
</pre>
|
|
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>§2. Instructions. </b>In bytecode, the frame of a <span class="extract"><span class="extract-syntax">pragma</span></span> instruction is laid out with the
|
|
compulsory words — see <a href="2-in.html" class="internal">Inter Nodes</a> — followed by:
|
|
</p>
|
|
|
|
<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">TARGET_PRAGMA_IFLD</span><span class="plain-syntax"> (</span><span class="constant-syntax">DATA_IFLD</span><span class="plain-syntax"> + </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
|
|
<span class="definition-keyword">define</span> <span class="constant-syntax">TEXT_PRAGMA_IFLD</span><span class="plain-syntax"> (</span><span class="constant-syntax">DATA_IFLD</span><span class="plain-syntax"> + </span><span class="constant-syntax">1</span><span class="plain-syntax">)</span>
|
|
</pre>
|
|
<pre class="displayed-code all-displayed-code code-font">
|
|
<span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="function-syntax">PragmaInstruction::new</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">PragmaInstruction::new</span></span>:<br/><a href="4-tpc4.html#SP4">§4</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_bookmark</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">target_name</span><span class="plain-syntax">,</span>
|
|
<span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">content</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">level</span><span class="plain-syntax">, </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">) {</span>
|
|
<span class="plain-syntax"> </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><a href="2-in.html#SP5" class="function-link"><span class="function-syntax">Inode::new_with_2_data_fields</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="constant-syntax">PRAGMA_IST</span><span class="plain-syntax">,</span>
|
|
<span class="plain-syntax"> /* </span><span class="identifier-syntax">TARGET_PRAGMA_IFLD:</span><span class="plain-syntax"> */ </span><a href="2-tw.html#SP7" class="function-link"><span class="function-syntax">InterWarehouse::create_text_at</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">target_name</span><span class="plain-syntax">),</span>
|
|
<span class="plain-syntax"> /* </span><span class="identifier-syntax">TEXT_PRAGMA_IFLD:</span><span class="plain-syntax"> */ </span><a href="2-tw.html#SP7" class="function-link"><span class="function-syntax">InterWarehouse::create_text_at</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">content</span><span class="plain-syntax">),</span>
|
|
<span class="plain-syntax"> </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="identifier-syntax">level</span><span class="plain-syntax">);</span>
|
|
<span class="plain-syntax"> </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-vi.html#SP1" class="function-link"><span class="function-syntax">VerifyingInter::instruction</span></a><span class="plain-syntax">(</span><a href="2-bkm.html#SP6" class="function-link"><span class="function-syntax">InterBookmark::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">), </span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
|
|
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">E</span><span class="plain-syntax">;</span>
|
|
<span class="plain-syntax"> </span><a href="2-np.html#SP3" class="function-link"><span class="function-syntax">NodePlacement::move_to_moving_bookmark</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">IBM</span><span class="plain-syntax">);</span>
|
|
<span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
|
|
<span class="plain-syntax">}</span>
|
|
|
|
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PragmaInstruction::transpose</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">PragmaInstruction::transpose</span></span>:<br/><a href="4-tpc4.html#SP1">§1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_construct</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> *</span><span class="identifier-syntax">grid</span><span class="plain-syntax">,</span>
|
|
<span class="plain-syntax"> </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">grid_extent</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> **</span><span class="identifier-syntax">E</span><span class="plain-syntax">) {</span>
|
|
<span class="plain-syntax"> </span><span class="identifier-syntax">P</span><span class="plain-syntax">-></span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">TARGET_PRAGMA_IFLD</span><span class="plain-syntax">] = </span><span class="identifier-syntax">grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">P</span><span class="plain-syntax">-></span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">TARGET_PRAGMA_IFLD</span><span class="plain-syntax">]];</span>
|
|
<span class="plain-syntax"> </span><span class="identifier-syntax">P</span><span class="plain-syntax">-></span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">TEXT_PRAGMA_IFLD</span><span class="plain-syntax">] = </span><span class="identifier-syntax">grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">P</span><span class="plain-syntax">-></span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">TEXT_PRAGMA_IFLD</span><span class="plain-syntax">]];</span>
|
|
<span class="plain-syntax">}</span>
|
|
</pre>
|
|
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>§3. </b>Verification consists only of sanity checks.
|
|
</p>
|
|
|
|
<pre class="displayed-code all-displayed-code code-font">
|
|
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PragmaInstruction::verify</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">PragmaInstruction::verify</span></span>:<br/><a href="4-tpc4.html#SP1">§1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_construct</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">,</span>
|
|
<span class="plain-syntax"> </span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">owner</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> **</span><span class="identifier-syntax">E</span><span class="plain-syntax">) {</span>
|
|
<span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-vi.html#SP7" class="function-link"><span class="function-syntax">VerifyingInter::text_field</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">owner</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">TARGET_PRAGMA_IFLD</span><span class="plain-syntax">);</span>
|
|
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
|
|
<span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-vi.html#SP7" class="function-link"><span class="function-syntax">VerifyingInter::text_field</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">owner</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">TEXT_PRAGMA_IFLD</span><span class="plain-syntax">);</span>
|
|
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
|
|
<span class="plain-syntax">}</span>
|
|
</pre>
|
|
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>§4. Creating from textual Inter syntax. </b>Note that the target name should be an identifier-like name, without quotes;
|
|
whereas the content is parsed as a double-quoted literal.
|
|
</p>
|
|
|
|
<pre class="displayed-code all-displayed-code code-font">
|
|
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PragmaInstruction::read</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">PragmaInstruction::read</span></span>:<br/><a href="4-tpc4.html#SP1">§1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_construct</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_bookmark</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_line_parse</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">,</span>
|
|
<span class="plain-syntax"> </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> **</span><span class="identifier-syntax">E</span><span class="plain-syntax">) {</span>
|
|
<span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">target_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ilp</span><span class="plain-syntax">-></span><span class="element-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0];</span>
|
|
<span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">content_token</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ilp</span><span class="plain-syntax">-></span><span class="element-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[1];</span>
|
|
<span class="plain-syntax"> </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">raw</span><span class="plain-syntax">)</span>
|
|
<span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-iitf.html#SP11" class="function-link"><span class="function-syntax">TextualInter::parse_literal_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">raw</span><span class="plain-syntax">, </span><span class="identifier-syntax">content_token</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">content_token</span><span class="plain-syntax">), </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
|
|
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
|
|
<span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="4-tpc4.html#SP2" class="function-link"><span class="function-syntax">PragmaInstruction::new</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">target_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">raw</span><span class="plain-syntax">, (</span><span class="constant-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">ilp</span><span class="plain-syntax">-></span><span class="element-syntax">indent_level</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
|
|
<span class="plain-syntax"> </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">raw</span><span class="plain-syntax">)</span>
|
|
<span class="plain-syntax">}</span>
|
|
</pre>
|
|
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>§5. Writing to textual Inter syntax. </b></p>
|
|
|
|
<pre class="displayed-code all-displayed-code code-font">
|
|
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">PragmaInstruction::write</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">PragmaInstruction::write</span></span>:<br/><a href="4-tpc4.html#SP1">§1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_construct</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
|
|
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"pragma %S "</span><span class="plain-syntax">, </span><a href="4-tpc4.html#SP6" class="function-link"><span class="function-syntax">PragmaInstruction::target</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">));</span>
|
|
<span class="plain-syntax"> </span><a href="3-iitf.html#SP11" class="function-link"><span class="function-syntax">TextualInter::write_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><a href="4-tpc4.html#SP6" class="function-link"><span class="function-syntax">PragmaInstruction::content</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">));</span>
|
|
<span class="plain-syntax">}</span>
|
|
</pre>
|
|
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>§6. Access functions. </b></p>
|
|
|
|
<pre class="displayed-code all-displayed-code code-font">
|
|
<span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="function-syntax">PragmaInstruction::target</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">PragmaInstruction::target</span></span>:<br/><a href="4-tpc4.html#SP5">§5</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
|
|
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">P</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
|
|
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::isnt</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">PRAGMA_IST</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
|
|
<span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-in.html#SP14" class="function-link"><span class="function-syntax">Inode::ID_to_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">-></span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">TARGET_PRAGMA_IFLD</span><span class="plain-syntax">]);</span>
|
|
<span class="plain-syntax">}</span>
|
|
|
|
<span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="function-syntax">PragmaInstruction::content</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">PragmaInstruction::content</span></span>:<br/><a href="4-tpc4.html#SP5">§5</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
|
|
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">P</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
|
|
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::isnt</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">PRAGMA_IST</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
|
|
<span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-in.html#SP14" class="function-link"><span class="function-syntax">Inode::ID_to_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">-></span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">TEXT_PRAGMA_IFLD</span><span class="plain-syntax">]);</span>
|
|
<span class="plain-syntax">}</span>
|
|
</pre>
|
|
<nav role="progress"><div class="progresscontainer">
|
|
<ul class="progressbar"><li class="progressprev"><a href="4-tpc3.html">❮</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-bm.html">1</a></li><li class="progresschapter"><a href="2-it.html">2</a></li><li class="progresschapter"><a href="3-ic.html">3</a></li><li class="progresscurrentchapter">4</li><li class="progresssection"><a href="4-tcc.html">tcc</a></li><li class="progresssection"><a href="4-tcc2.html">tcc2</a></li><li class="progresssection"><a href="4-tic.html">tic</a></li><li class="progresssection"><a href="4-tic2.html">tic2</a></li><li class="progresssection"><a href="4-tnc.html">tnc</a></li><li class="progresssection"><a href="4-tpc.html">tpc</a></li><li class="progresssection"><a href="4-tpc2.html">tpc2</a></li><li class="progresssection"><a href="4-tpc3.html">tpc3</a></li><li class="progresscurrent">tpc4</li><li class="progresssection"><a href="4-tpc5.html">tpc5</a></li><li class="progresssection"><a href="4-tpc6.html">tpc6</a></li><li class="progresssection"><a href="4-tpc7.html">tpc7</a></li><li class="progresssection"><a href="4-ttc.html">ttc</a></li><li class="progresssection"><a href="4-tvc.html">tvc</a></li><li class="progresschapter"><a href="5-tac.html">5</a></li><li class="progresschapter"><a href="6-tpc.html">6</a></li><li class="progressnext"><a href="4-tpc5.html">❯</a></li></ul></div>
|
|
</nav><!--End of weave-->
|
|
|
|
</main>
|
|
</body>
|
|
</html>
|
|
|