go-vise

Constrained Size Output Virtual Machine
Info | Log | Files | Refs | README | LICENSE

commit 318a579199102a50ed436bbcbf4db14d2fea0bc2
parent 76408a894a49bd9276cdda443fef42a86d79ee12
Author: lash <dev@holbrook.no>
Date:   Tue,  2 May 2023 07:49:01 +0100

Add introductory example

Signed-off-by: lash <dev@holbrook.no>

Diffstat:
MMakefile | 5++++-
Mdoc/build/cache.html | 14+++++++-------
Mdoc/build/cookbook.html | 20++++++++++----------
Mdoc/build/dev.html | 54+++++++++++++++++++++++++++---------------------------
Mdoc/build/index.html | 229+++++++++++++++++++++++++++++++++++++++++++------------------------------------
Mdoc/build/instructions.html | 52++++++++++++++++++++++++++--------------------------
Mdoc/build/language.html | 4++--
Mdoc/build/navigation.html | 14+++++++-------
Mdoc/build/nomenclature.html | 10+++++-----
Mdoc/build/overview.html | 40+++++++++++++++++++++++++++++++---------
Mdoc/build/render.html | 24++++++++++++------------
Mdoc/build/signals.html | 8++++----
Mdoc/texinfo/index.texi | 1+
Mdoc/texinfo/overview.texi | 17+++++++++++++----
Adoc/texinfo/sim.texi | 212+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aexamples/intro/Makefile | 10++++++++++
Aexamples/intro/bar | 2++
Aexamples/intro/bar.vis | 4++++
Aexamples/intro/foo | 2++
Aexamples/intro/foo.vis | 3+++
Aexamples/intro/main.go | 96+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aexamples/intro/ouch | 2++
Aexamples/intro/ouch.vis | 2++
Aexamples/intro/root | 2++
Aexamples/intro/root.vis | 9+++++++++
Mvm/runner.go | 7+++++++
26 files changed, 626 insertions(+), 217 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,6 +1,6 @@ all: bin examples doc -examples: profile session helloworld validate +examples: profile session helloworld validate intro bin: mkdir -p build @@ -24,5 +24,8 @@ validate: longmenu: make -C examples/longmenu +intro: + make -C examples/intro + doc: make -C doc diff --git a/doc/build/cache.html b/doc/build/cache.html @@ -34,7 +34,7 @@ ul.mark-bullet {list-style-type: disc} Next: <a href="render.html" accesskey="n" rel="next">Rendering</a>, Previous: <a href="navigation.html" accesskey="p" rel="prev">Navigation</a>, Up: <a href="index.html" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> </div> <hr> -<h2 class="chapter" id="External-data">6 External data</h2> +<h2 class="chapter" id="External-data">7 External data</h2> <p>The <code class="code">LOAD</code> instruction enables the client implementer to define external data retrieval and processing code. </p> @@ -54,7 +54,7 @@ Next: <a href="render.html" accesskey="n" rel="next">Rendering</a>, Previous: <a <li><a href="#Refreshing-cache-contents" accesskey="4">Refreshing cache contents</a></li> </ul> <div class="section-level-extent" id="The-LOAD-handler"> -<h3 class="section">6.1 The <code class="code">LOAD</code> handler</h3> +<h3 class="section">7.1 The <code class="code">LOAD</code> handler</h3> <p>In the <em class="emph">golang</em> code, the handler of the <code class="code">LOAD</code> instruction is an implementation of the <code class="code">resource.Resource</code> interface. </p> @@ -72,7 +72,7 @@ Next: <a href="render.html" accesskey="n" rel="next">Rendering</a>, Previous: <a </div> <div class="section-level-extent" id="Size-limits"> -<h3 class="section">6.2 Size limits</h3> +<h3 class="section">7.2 Size limits</h3> <p><code class="code">LOAD</code> instructions include a size parameter. </p> @@ -85,7 +85,7 @@ Next: <a href="render.html" accesskey="n" rel="next">Rendering</a>, Previous: <a <li><a href="#g_t_0022Sink_0022-symbols" accesskey="1">&quot;Sink&quot; symbols</a></li> </ul> <div class="subsection-level-extent" id="g_t_0022Sink_0022-symbols"> -<h4 class="subsection">6.2.1 &quot;Sink&quot; symbols</h4> +<h4 class="subsection">7.2.1 &quot;Sink&quot; symbols</h4> <p>A sink is a symbol loaded with <code class="code">size</code> parameter <code class="code">0</code>. </p> @@ -95,7 +95,7 @@ Next: <a href="render.html" accesskey="n" rel="next">Rendering</a>, Previous: <a </div> </div> <div class="section-level-extent" id="Scope"> -<h3 class="section">6.3 Scope</h3> +<h3 class="section">7.3 Scope</h3> <p>The result data payload is stored under the symbol key for which it was loaded. It is kept in the cache until execution ascends from the execution stack level in which it was loaded. </p> @@ -106,7 +106,7 @@ Next: <a href="render.html" accesskey="n" rel="next">Rendering</a>, Previous: <a <li><a href="#Duplicate-LOAD" accesskey="1">Duplicate <code class="code">LOAD</code></a></li> </ul> <div class="subsection-level-extent" id="Duplicate-LOAD"> -<h4 class="subsection">6.3.1 Duplicate <code class="code">LOAD</code></h4> +<h4 class="subsection">7.3.1 Duplicate <code class="code">LOAD</code></h4> <p>If a <code class="code">LOAD</code> statement with the same symbol is issued twice within the same <em class="emph">scope</em>, it will fail and execution will terminate. </p> @@ -120,7 +120,7 @@ Next: <a href="render.html" accesskey="n" rel="next">Rendering</a>, Previous: <a </div> </div> <div class="section-level-extent" id="Refreshing-cache-contents"> -<h3 class="section">6.4 Refreshing cache contents</h3> +<h3 class="section">7.4 Refreshing cache contents</h3> <p>The <code class="code">RELOAD</code> instruction will trigger the <code class="code">LOAD</code> handler again. The <code class="code">RELOAD</code> instruction is bound to the same size constraint as the initial <code class="code">LOAD</code>. </p> diff --git a/doc/build/cookbook.html b/doc/build/cookbook.html @@ -35,7 +35,7 @@ ul.mark-bullet {list-style-type: disc} Next: <a href="dev.html" accesskey="n" rel="next">Developing with vise</a>, Previous: <a href="language.html" accesskey="p" rel="prev">Handling languages</a>, Up: <a href="index.html" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> </div> <hr> -<h2 class="chapter" id="Common-patterns">9 Common patterns</h2> +<h2 class="chapter" id="Common-patterns">10 Common patterns</h2> <ul class="mini-toc"> @@ -47,7 +47,7 @@ Next: <a href="dev.html" accesskey="n" rel="next">Developing with vise</a>, Prev <li><a href="#Default-input-handler" accesskey="6">Default input handler</a></li> </ul> <div class="section-level-extent" id="Hello-world"> -<h3 class="section">9.1 Hello world</h3> +<h3 class="section">10.1 Hello world</h3> <div class="example"> <pre class="example-preformatted">HALT @@ -58,7 +58,7 @@ Next: <a href="dev.html" accesskey="n" rel="next">Developing with vise</a>, Prev <a class="anchor" id="handling_005fmenus"></a></div> <div class="section-level-extent" id="Handling-menus-and-inputs"> -<h3 class="section">9.2 Handling menus and inputs</h3> +<h3 class="section">10.2 Handling menus and inputs</h3> <div class="example"> <pre class="example-preformatted">MOUT to_foo 0 @@ -85,7 +85,7 @@ INCMP _ 2 <li><a href="#Menu-batch-version" accesskey="1">Menu batch version</a></li> </ul> <div class="subsection-level-extent" id="Menu-batch-version"> -<h4 class="subsection">9.2.1 Menu batch version</h4> +<h4 class="subsection">10.2.1 Menu batch version</h4> <div class="example"> <pre class="example-preformatted">DOWN foo 0 to_foo @@ -99,7 +99,7 @@ UP 2 upup </div> </div> <div class="section-level-extent" id="Signal-flow-control"> -<h3 class="section">9.3 Signal flow control</h3> +<h3 class="section">10.3 Signal flow control</h3> <div class="example"> <pre class="example-preformatted">LOAD foo 1 @@ -114,7 +114,7 @@ MOVE baz <a class="anchor" id="multiple_005fpages"></a></div> <div class="section-level-extent" id="Multiple-pages"> -<h3 class="section">9.4 Multiple pages</h3> +<h3 class="section">10.4 Multiple pages</h3> <div class="example"> <pre class="example-preformatted">LOAD foo 0 @@ -135,7 +135,7 @@ INCMP &lt; 22 <li><a href="#Menu-batch-version-1" accesskey="1">Menu batch version</a></li> </ul> <div class="subsection-level-extent" id="Menu-batch-version-1"> -<h4 class="subsection">9.4.1 Menu batch version</h4> +<h4 class="subsection">10.4.1 Menu batch version</h4> <div class="example"> <pre class="example-preformatted">LOAD foo 0 @@ -149,7 +149,7 @@ PREVIOUS 22 to_back <a class="anchor" id="multiple_005fmenus"></a></div> </div> <div class="section-level-extent" id="Multi_002dpage-menus"> -<h3 class="section">9.5 Multi-page menus</h3> +<h3 class="section">10.5 Multi-page menus</h3> <div class="example"> <pre class="example-preformatted">MSINK @@ -181,7 +181,7 @@ INCMP bar 7 <li><a href="#Menu-batch-version-2" accesskey="1">Menu batch version</a></li> </ul> <div class="subsection-level-extent" id="Menu-batch-version-2"> -<h4 class="subsection">9.5.1 Menu batch version</h4> +<h4 class="subsection">10.5.1 Menu batch version</h4> <div class="example"> <pre class="example-preformatted">MSINK @@ -203,7 +203,7 @@ DOWN bar 7 pu </div> </div> <div class="section-level-extent" id="Default-input-handler"> -<h3 class="section">9.6 Default input handler</h3> +<h3 class="section">10.6 Default input handler</h3> <div class="example"> <pre class="example-preformatted">MOUT to_foo 0 diff --git a/doc/build/dev.html b/doc/build/dev.html @@ -34,7 +34,7 @@ ul.mark-bullet {list-style-type: disc} Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, Up: <a href="index.html" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> </div> <hr> -<h2 class="chapter" id="Developing-with-vise">10 Developing with vise</h2> +<h2 class="chapter" id="Developing-with-vise">11 Developing with vise</h2> <ul class="mini-toc"> @@ -47,7 +47,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, <li><a href="#Bytecode-example" accesskey="7">Bytecode example</a></li> </ul> <div class="section-level-extent" id="Code-repository-structure"> -<h3 class="section">10.1 Code repository structure</h3> +<h3 class="section">11.1 Code repository structure</h3> <dl class="table"> <dt><code class="code">asm</code></dt> @@ -85,7 +85,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, </div> <div class="section-level-extent" id="Interacting-with-vise"> -<h3 class="section">10.2 Interacting with <code class="code">vise</code></h3> +<h3 class="section">11.2 Interacting with <code class="code">vise</code></h3> <p>Implementers of <code class="code">vise</code> should interface with the system using the <code class="code">engine</code> module. </p> @@ -99,7 +99,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, <li><a href="#Execution-context" accesskey="4">Execution context</a></li> </ul> <div class="subsection-level-extent" id="Modes-of-operation"> -<h4 class="subsection">10.2.1 Modes of operation</h4> +<h4 class="subsection">11.2.1 Modes of operation</h4> <p>The <code class="code">engine</code> module provides three different modes of operation for the engine implementations. </p> @@ -110,7 +110,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, <li><a href="#Asynchronous-one_002dshot" accesskey="3">Asynchronous one-shot</a></li> </ul> <div class="subsubsection-level-extent" id="Manual-operation"> -<h4 class="subsubsection">10.2.1.1 Manual operation</h4> +<h4 class="subsubsection">11.2.1.1 Manual operation</h4> <p>Directly interaction with an <code class="code">engine.Engine</code> instance. </p> @@ -123,7 +123,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, </div> <div class="subsubsection-level-extent" id="Synchronous-loop"> -<h4 class="subsubsection">10.2.1.2 Synchronous loop</h4> +<h4 class="subsubsection">11.2.1.2 Synchronous loop</h4> <p>Receives input from a reader and writes into to a writer, and executes the underlying <code class="code">engine.Engine</code> with given inputs until execution is terminated. </p> @@ -134,7 +134,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, </div> <div class="subsubsection-level-extent" id="Asynchronous-one_002dshot"> -<h4 class="subsubsection">10.2.1.3 Asynchronous one-shot</h4> +<h4 class="subsubsection">11.2.1.3 Asynchronous one-shot</h4> <p>Compatible with e.g. a network socket or HTTP frontend. The <code class="code">engine.RunPersisted</code> method restores a persisted state and runs one single input until VM yield after which the new state is persisted. </p> @@ -144,7 +144,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, </div> </div> <div class="subsection-level-extent" id="Configuration"> -<h4 class="subsection">10.2.2 Configuration</h4> +<h4 class="subsection">11.2.2 Configuration</h4> <p>The engine configuration defines the top-level parameters for the execution environment, including maximum output size, default language, execution entry point and more. </p> @@ -153,7 +153,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, </div> <div class="subsection-level-extent" id="Sessions"> -<h4 class="subsection">10.2.3 Sessions</h4> +<h4 class="subsection">11.2.3 Sessions</h4> <p>The <code class="code">engine.Config.SessionId</code> is used to disambiguate the end-user that is interacting with the engine. </p> @@ -162,7 +162,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, <a class="anchor" id="execution_005fcontext"></a></div> <div class="subsection-level-extent" id="Execution-context"> -<h4 class="subsection">10.2.4 Execution context</h4> +<h4 class="subsection">11.2.4 Execution context</h4> <p>The engine stores the <code class="code">SessionId</code> aswell as the current chosen <code class="code">lang.Language</code> in the execution context. This is passed through to the VM operation, and is available for client code, specifically: </p> @@ -176,7 +176,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, </div> </div> <div class="section-level-extent" id="Resolving-resources"> -<h3 class="section">10.3 Resolving resources</h3> +<h3 class="section">11.3 Resolving resources</h3> <p>The core of implementation code is defined by implementing the <code class="code">resource.Resource</code> interface. This is also described in the <a class="ref" href="cache.html#load_005fhandler">LOAD handler</a> section. </p> @@ -187,7 +187,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, <li><a href="#Filesystem-resource-implementation" accesskey="2">Filesystem resource implementation</a></li> </ul> <div class="subsection-level-extent" id="Memory-resource-implementation"> -<h4 class="subsection">10.3.1 Memory resource implementation</h4> +<h4 class="subsection">11.3.1 Memory resource implementation</h4> <p>One of two reference implementations of <code class="code">resource.Resource</code> is the <code class="code">resource.MemResource</code> class. It enables the client to register all node and symbol resolutions at runtime, using its functions prefixed with <code class="code">Add...</code>. </p> @@ -196,7 +196,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, </div> <div class="subsection-level-extent" id="Filesystem-resource-implementation"> -<h4 class="subsection">10.3.2 Filesystem resource implementation</h4> +<h4 class="subsection">11.3.2 Filesystem resource implementation</h4> <p>The Filesystem based resource implemementation is used by the <code class="code">dev/interactive</code> tool, aswell as the executable examples in <samp class="file">examples/</samp> directory. </p> @@ -210,14 +210,14 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, <li><a href="#External-symbols-_0028resource_002eResource_002eFuncFor_0029" accesskey="4">External symbols (<code class="code">resource.Resource.FuncFor</code>)</a></li> </ul> <div class="subsubsection-level-extent" id="Bytecode-_0028resource_002eResource_002eGetCode_0029"> -<h4 class="subsubsection">10.3.2.1 Bytecode (<code class="code">resource.Resource.GetCode</code>)</h4> +<h4 class="subsubsection">11.3.2.1 Bytecode (<code class="code">resource.Resource.GetCode</code>)</h4> <p>Read from <samp class="file">basedir/&lt;node&gt;.bin</samp>. </p> </div> <div class="subsubsection-level-extent" id="Templates-_0028resource_002eResource_002eGetTemplate_0029"> -<h4 class="subsubsection">10.3.2.2 Templates (<code class="code">resource.Resource.GetTemplate</code>)</h4> +<h4 class="subsubsection">11.3.2.2 Templates (<code class="code">resource.Resource.GetTemplate</code>)</h4> <p>If language has been set, the template will be read from <samp class="file">basedir/&lt;node&gt;_&lt;lang&gt;</samp>. For example, the <em class="emph">norwegian</em> template for the node <code class="code">root</code> will be read from <samp class="file">basedir/root_nor</samp>. </p> @@ -228,7 +228,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, </div> <div class="subsubsection-level-extent" id="Menus-_0028resource_002eResource_002eGetMenu_0029"> -<h4 class="subsubsection">10.3.2.3 Menus (<code class="code">resource.Resource.GetMenu</code>)</h4> +<h4 class="subsubsection">11.3.2.3 Menus (<code class="code">resource.Resource.GetMenu</code>)</h4> <p>If language has been set, the template will be read from <samp class="file">basedir/&lt;label&gt;_&lt;lang&gt;_menu</samp>. For example, the <em class="emph">norwegian</em> template for the menu label <code class="code">foo</code> will be read from <samp class="file">basedir/foo_nor_menu</samp>. </p> @@ -239,7 +239,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, </div> <div class="subsubsection-level-extent" id="External-symbols-_0028resource_002eResource_002eFuncFor_0029"> -<h4 class="subsubsection">10.3.2.4 External symbols (<code class="code">resource.Resource.FuncFor</code>)</h4> +<h4 class="subsubsection">11.3.2.4 External symbols (<code class="code">resource.Resource.FuncFor</code>)</h4> <p>The implementation allows setting resolver functions for symbols at runtime, using the <code class="code">resource.FsResource.AddLocalFunc</code> method. This registers an <code class="code">resource.FsResource.EntryFunc</code> with the lookup symbol as key. Note that the <code class="code">EntryFunc</code> receives the language setting through the execution context. </p> @@ -256,7 +256,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, </div> </div> <div class="section-level-extent" id="Logging"> -<h3 class="section">10.4 Logging</h3> +<h3 class="section">11.4 Logging</h3> <p>Loglevels are set at compile-time using the following build tags: </p> @@ -278,7 +278,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, </div> <div class="section-level-extent" id="Tools"> -<h3 class="section">10.5 Tools</h3> +<h3 class="section">11.5 Tools</h3> <p>Located in the <samp class="file">dev/</samp> directory of the source code repository. </p> @@ -291,7 +291,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, <li><a href="#Interactive-case-examples" accesskey="5">Interactive case examples</a></li> </ul> <div class="subsection-level-extent" id="Test-data-generation"> -<h4 class="subsection">10.5.1 Test data generation</h4> +<h4 class="subsection">11.5.1 Test data generation</h4> <div class="example"> <pre class="example-preformatted">go run ./dev/gendata/ &lt;directory&gt; @@ -302,7 +302,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, </div> <div class="subsection-level-extent" id="Interactive-runner"> -<h4 class="subsection">10.5.2 Interactive runner</h4> +<h4 class="subsection">11.5.2 Interactive runner</h4> <div class="example"> <pre class="example-preformatted">go run ./dev/interactive [-d &lt;data_directory&gt;] [--root &lt;root_symbol&gt;] [--session-id &lt;session_id&gt;] [--persist] @@ -323,7 +323,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, </div> <div class="subsection-level-extent" id="Assembler"> -<h4 class="subsection">10.5.3 Assembler</h4> +<h4 class="subsection">11.5.3 Assembler</h4> <div class="example"> <pre class="example-preformatted">go run ./dev/asm &lt;assembly_file&gt; @@ -334,7 +334,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, </div> <div class="subsection-level-extent" id="Disassembler"> -<h4 class="subsection">10.5.4 Disassembler</h4> +<h4 class="subsection">11.5.4 Disassembler</h4> <div class="example"> <pre class="example-preformatted">go run ./dev/disasm/ &lt;binary_file&gt; @@ -345,7 +345,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, </div> <div class="subsection-level-extent" id="Interactive-case-examples"> -<h4 class="subsection">10.5.5 Interactive case examples</h4> +<h4 class="subsection">11.5.5 Interactive case examples</h4> <p>Found in <samp class="file">examples/</samp>. </p> @@ -386,14 +386,14 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, </div> </div> <div class="section-level-extent" id="Assembly-examples"> -<h3 class="section">10.6 Assembly examples</h3> +<h3 class="section">11.6 Assembly examples</h3> <p>See <samp class="file">testdata/*.vis</samp> </p> </div> <div class="section-level-extent" id="Bytecode-example"> -<h3 class="section">10.7 Bytecode example</h3> +<h3 class="section">11.7 Bytecode example</h3> <p>Currently the following rules apply for encoding in version <code class="code">0</code>: </p> @@ -409,7 +409,7 @@ Previous: <a href="cookbook.html" accesskey="p" rel="prev">Common patterns</a>, <li><a href="#Example" accesskey="1">Example</a></li> </ul> <div class="subsection-level-extent" id="Example"> -<h4 class="subsection">10.7.1 Example</h4> +<h4 class="subsection">11.7.1 Example</h4> <p>(Minimal, WIP) </p> diff --git a/doc/build/index.html b/doc/build/index.html @@ -46,164 +46,187 @@ Next: <a href="overview.html" accesskey="n" rel="next">Overview</a> &nbsp; [<a h <ul class="toc-numbered-mark"> <li><a id="toc-Overview" href="overview.html">1 Overview</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Synopsis" href="overview.html#Synopsis">1.1 Synopsis</a></li> + <li><a id="toc-Features" href="overview.html#Features">1.1 Features</a></li> + <li><a id="toc-Contents" href="overview.html#Contents">1.2 Contents</a> + <ul class="toc-numbered-mark"> + <li><a id="toc-Virtual-machine" href="overview.html#Virtual-machine">1.2.1 Virtual machine</a></li> + </ul></li> + </ul></li> + <li><a id="toc-An-example-vise-implementation" href="sim.html">2 An example vise implementation</a> + <ul class="toc-numbered-mark"> + <li><a id="toc-Templates" href="sim.html#Templates">2.1 Templates</a> + <ul class="toc-numbered-mark"> + <li><a id="toc-root" href="sim.html#root">2.1.1 root</a></li> + <li><a id="toc-foo" href="sim.html#foo">2.1.2 foo</a></li> + <li><a id="toc-bar" href="sim.html#bar">2.1.3 bar</a></li> + <li><a id="toc-ouch" href="sim.html#ouch">2.1.4 ouch</a></li> + </ul></li> + <li><a id="toc-Scripts" href="sim.html#Scripts">2.2 Scripts</a> + <ul class="toc-numbered-mark"> + <li><a id="toc-root-1" href="sim.html#root-1">2.2.1 root</a></li> + <li><a id="toc-foo-1" href="sim.html#foo-1">2.2.2 foo</a></li> + <li><a id="toc-bar-1" href="sim.html#bar-1">2.2.3 bar</a></li> + <li><a id="toc-ouch-1" href="sim.html#ouch-1">2.2.4 ouch</a></li> + </ul></li> + <li><a id="toc-External-code-handlers" href="sim.html#External-code-handlers">2.3 External code handlers</a></li> + <li><a id="toc-Working-example" href="sim.html#Working-example">2.4 Working example</a></li> </ul></li> - <li><a id="toc-Nomenclature" href="nomenclature.html">2 Nomenclature</a> + <li><a id="toc-Nomenclature" href="nomenclature.html">3 Nomenclature</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Common" href="nomenclature.html#Common">2.1 Common</a></li> - <li><a id="toc-Instructions-and-navigation" href="nomenclature.html#Instructions-and-navigation">2.2 Instructions and navigation</a></li> + <li><a id="toc-Common" href="nomenclature.html#Common">3.1 Common</a></li> + <li><a id="toc-Instructions-and-navigation" href="nomenclature.html#Instructions-and-navigation">3.2 Instructions and navigation</a></li> </ul></li> - <li><a id="toc-Signal-flags" href="signals.html">3 Signal flags</a> + <li><a id="toc-Signal-flags" href="signals.html">4 Signal flags</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Client_002ddefined-signal-flags" href="signals.html#Client_002ddefined-signal-flags">3.1 Client-defined signal flags</a> + <li><a id="toc-Client_002ddefined-signal-flags" href="signals.html#Client_002ddefined-signal-flags">4.1 Client-defined signal flags</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Flow-control" href="signals.html#Flow-control">3.1.1 Flow control</a></li> + <li><a id="toc-Flow-control" href="signals.html#Flow-control">4.1.1 Flow control</a></li> </ul></li> - <li><a id="toc-Built_002din-signal-flags" href="signals.html#Built_002din-signal-flags">3.2 Built-in signal flags</a></li> + <li><a id="toc-Built_002din-signal-flags" href="signals.html#Built_002din-signal-flags">4.2 Built-in signal flags</a></li> </ul></li> - <li><a id="toc-Instructions" href="instructions.html">4 Instructions</a> + <li><a id="toc-Instructions" href="instructions.html">5 Instructions</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Data-types" href="instructions.html#Data-types">4.1 Data types</a> + <li><a id="toc-Data-types" href="instructions.html#Data-types">5.1 Data types</a> <ul class="toc-numbered-mark"> - <li><a id="toc-node" href="instructions.html#node">4.1.1 node</a> + <li><a id="toc-node" href="instructions.html#node">5.1.1 node</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Regular-node" href="instructions.html#Regular-node">4.1.1.1 Regular node</a></li> - <li><a id="toc-Special-node" href="instructions.html#Special-node">4.1.1.2 Special node</a></li> + <li><a id="toc-Regular-node" href="instructions.html#Regular-node">5.1.1.1 Regular node</a></li> + <li><a id="toc-Special-node" href="instructions.html#Special-node">5.1.1.2 Special node</a></li> </ul></li> - <li><a id="toc-label" href="instructions.html#label">4.1.2 label</a></li> - <li><a id="toc-size" href="instructions.html#size">4.1.3 size</a></li> - <li><a id="toc-selector" href="instructions.html#selector">4.1.4 selector</a></li> - <li><a id="toc-symbol" href="instructions.html#symbol">4.1.5 symbol</a></li> - <li><a id="toc-signal" href="instructions.html#signal">4.1.6 signal</a></li> - <li><a id="toc-matchmode" href="instructions.html#matchmode">4.1.7 matchmode</a></li> - </ul></li> - <li><a id="toc-Instruction-list" href="instructions.html#Instruction-list">4.2 Instruction list</a> - <ul class="toc-numbered-mark"> - <li><a id="toc-CATCH-_003cnode_003e-_003csignal_003e-_003cmatchmode_003e" href="instructions.html#CATCH-_003cnode_003e-_003csignal_003e-_003cmatchmode_003e">4.2.1 CATCH &lt;node&gt; &lt;signal&gt; &lt;matchmode&gt;</a></li> - <li><a id="toc-CROAK-_003csignal_003e-_003cmatchmode_003e" href="instructions.html#CROAK-_003csignal_003e-_003cmatchmode_003e">4.2.2 CROAK &lt;signal&gt; &lt;matchmode&gt;</a></li> - <li><a id="toc-HALT" href="instructions.html#HALT">4.2.3 HALT</a></li> - <li><a id="toc-INCMP-_003cnode_003e-_003cselector_003e" href="instructions.html#INCMP-_003cnode_003e-_003cselector_003e">4.2.4 INCMP &lt;node&gt; &lt;selector&gt;</a></li> - <li><a id="toc-LOAD-_003csymbol_003e-_003csize_003e" href="instructions.html#LOAD-_003csymbol_003e-_003csize_003e">4.2.5 LOAD &lt;symbol&gt; &lt;size&gt;</a></li> - <li><a id="toc-MAP-_003csymbol_003e" href="instructions.html#MAP-_003csymbol_003e">4.2.6 MAP &lt;symbol&gt;</a></li> - <li><a id="toc-MNEXT-_003clabel_003e-_003cselector_003e" href="instructions.html#MNEXT-_003clabel_003e-_003cselector_003e">4.2.7 MNEXT &lt;label&gt; &lt;selector&gt;</a></li> - <li><a id="toc-MOUT-_003clabel_003e-_003cselector_003e" href="instructions.html#MOUT-_003clabel_003e-_003cselector_003e">4.2.8 MOUT &lt;label&gt; &lt;selector&gt;</a></li> - <li><a id="toc-MOVE-_003cnode_003e" href="instructions.html#MOVE-_003cnode_003e">4.2.9 MOVE &lt;node&gt;</a></li> - <li><a id="toc-MPREV-_003clabel_003e-_003cselector_003e" href="instructions.html#MPREV-_003clabel_003e-_003cselector_003e">4.2.10 MPREV &lt;label&gt; &lt;selector&gt;</a></li> - <li><a id="toc-MSINK" href="instructions.html#MSINK">4.2.11 MSINK</a></li> - <li><a id="toc-RELOAD-_003csymbol_003e" href="instructions.html#RELOAD-_003csymbol_003e">4.2.12 RELOAD &lt;symbol&gt;</a></li> - </ul></li> - <li><a id="toc-Batch-instructions" href="instructions.html#Batch-instructions">4.3 Batch instructions</a> - <ul class="toc-numbered-mark"> - <li><a id="toc-Batch-menu-expansion" href="instructions.html#Batch-menu-expansion">4.3.1 Batch menu expansion</a></li> + <li><a id="toc-label" href="instructions.html#label">5.1.2 label</a></li> + <li><a id="toc-size" href="instructions.html#size">5.1.3 size</a></li> + <li><a id="toc-selector" href="instructions.html#selector">5.1.4 selector</a></li> + <li><a id="toc-symbol" href="instructions.html#symbol">5.1.5 symbol</a></li> + <li><a id="toc-signal" href="instructions.html#signal">5.1.6 signal</a></li> + <li><a id="toc-matchmode" href="instructions.html#matchmode">5.1.7 matchmode</a></li> + </ul></li> + <li><a id="toc-Instruction-list" href="instructions.html#Instruction-list">5.2 Instruction list</a> + <ul class="toc-numbered-mark"> + <li><a id="toc-CATCH-_003cnode_003e-_003csignal_003e-_003cmatchmode_003e" href="instructions.html#CATCH-_003cnode_003e-_003csignal_003e-_003cmatchmode_003e">5.2.1 CATCH &lt;node&gt; &lt;signal&gt; &lt;matchmode&gt;</a></li> + <li><a id="toc-CROAK-_003csignal_003e-_003cmatchmode_003e" href="instructions.html#CROAK-_003csignal_003e-_003cmatchmode_003e">5.2.2 CROAK &lt;signal&gt; &lt;matchmode&gt;</a></li> + <li><a id="toc-HALT" href="instructions.html#HALT">5.2.3 HALT</a></li> + <li><a id="toc-INCMP-_003cnode_003e-_003cselector_003e" href="instructions.html#INCMP-_003cnode_003e-_003cselector_003e">5.2.4 INCMP &lt;node&gt; &lt;selector&gt;</a></li> + <li><a id="toc-LOAD-_003csymbol_003e-_003csize_003e" href="instructions.html#LOAD-_003csymbol_003e-_003csize_003e">5.2.5 LOAD &lt;symbol&gt; &lt;size&gt;</a></li> + <li><a id="toc-MAP-_003csymbol_003e" href="instructions.html#MAP-_003csymbol_003e">5.2.6 MAP &lt;symbol&gt;</a></li> + <li><a id="toc-MNEXT-_003clabel_003e-_003cselector_003e" href="instructions.html#MNEXT-_003clabel_003e-_003cselector_003e">5.2.7 MNEXT &lt;label&gt; &lt;selector&gt;</a></li> + <li><a id="toc-MOUT-_003clabel_003e-_003cselector_003e" href="instructions.html#MOUT-_003clabel_003e-_003cselector_003e">5.2.8 MOUT &lt;label&gt; &lt;selector&gt;</a></li> + <li><a id="toc-MOVE-_003cnode_003e" href="instructions.html#MOVE-_003cnode_003e">5.2.9 MOVE &lt;node&gt;</a></li> + <li><a id="toc-MPREV-_003clabel_003e-_003cselector_003e" href="instructions.html#MPREV-_003clabel_003e-_003cselector_003e">5.2.10 MPREV &lt;label&gt; &lt;selector&gt;</a></li> + <li><a id="toc-MSINK" href="instructions.html#MSINK">5.2.11 MSINK</a></li> + <li><a id="toc-RELOAD-_003csymbol_003e" href="instructions.html#RELOAD-_003csymbol_003e">5.2.12 RELOAD &lt;symbol&gt;</a></li> + </ul></li> + <li><a id="toc-Batch-instructions" href="instructions.html#Batch-instructions">5.3 Batch instructions</a> + <ul class="toc-numbered-mark"> + <li><a id="toc-Batch-menu-expansion" href="instructions.html#Batch-menu-expansion">5.3.1 Batch menu expansion</a></li> </ul></li> </ul></li> - <li><a id="toc-Navigation" href="navigation.html">5 Navigation</a> + <li><a id="toc-Navigation" href="navigation.html">6 Navigation</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Entry-point" href="navigation.html#Entry-point">5.1 Entry point</a></li> - <li><a id="toc-Lateral-navigation" href="navigation.html#Lateral-navigation">5.2 Lateral navigation</a></li> - <li><a id="toc-Node-names" href="navigation.html#Node-names">5.3 Node names</a> + <li><a id="toc-Entry-point" href="navigation.html#Entry-point">6.1 Entry point</a></li> + <li><a id="toc-Lateral-navigation" href="navigation.html#Lateral-navigation">6.2 Lateral navigation</a></li> + <li><a id="toc-Node-names" href="navigation.html#Node-names">6.3 Node names</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Special-node-names" href="navigation.html#Special-node-names">5.3.1 Special node names</a></li> - <li><a id="toc-Builtin-node-names" href="navigation.html#Builtin-node-names">5.3.2 Builtin node names</a></li> + <li><a id="toc-Special-node-names" href="navigation.html#Special-node-names">6.3.1 Special node names</a></li> + <li><a id="toc-Builtin-node-names" href="navigation.html#Builtin-node-names">6.3.2 Builtin node names</a></li> </ul></li> - <li><a id="toc-Navigation-stack" href="navigation.html#Navigation-stack">5.4 Navigation stack</a></li> + <li><a id="toc-Navigation-stack" href="navigation.html#Navigation-stack">6.4 Navigation stack</a></li> </ul></li> - <li><a id="toc-External-data" href="cache.html">6 External data</a> + <li><a id="toc-External-data" href="cache.html">7 External data</a> <ul class="toc-numbered-mark"> - <li><a id="toc-The-LOAD-handler" href="cache.html#The-LOAD-handler">6.1 The <code class="code">LOAD</code> handler</a></li> - <li><a id="toc-Size-limits" href="cache.html#Size-limits">6.2 Size limits</a> + <li><a id="toc-The-LOAD-handler" href="cache.html#The-LOAD-handler">7.1 The <code class="code">LOAD</code> handler</a></li> + <li><a id="toc-Size-limits" href="cache.html#Size-limits">7.2 Size limits</a> <ul class="toc-numbered-mark"> - <li><a id="toc-_0022Sink_0022-symbols" href="cache.html#g_t_0022Sink_0022-symbols">6.2.1 &quot;Sink&quot; symbols</a></li> + <li><a id="toc-_0022Sink_0022-symbols" href="cache.html#g_t_0022Sink_0022-symbols">7.2.1 &quot;Sink&quot; symbols</a></li> </ul></li> - <li><a id="toc-Scope" href="cache.html#Scope">6.3 Scope</a> + <li><a id="toc-Scope" href="cache.html#Scope">7.3 Scope</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Duplicate-LOAD" href="cache.html#Duplicate-LOAD">6.3.1 Duplicate <code class="code">LOAD</code></a></li> + <li><a id="toc-Duplicate-LOAD" href="cache.html#Duplicate-LOAD">7.3.1 Duplicate <code class="code">LOAD</code></a></li> </ul></li> - <li><a id="toc-Refreshing-cache-contents" href="cache.html#Refreshing-cache-contents">6.4 Refreshing cache contents</a></li> + <li><a id="toc-Refreshing-cache-contents" href="cache.html#Refreshing-cache-contents">7.4 Refreshing cache contents</a></li> </ul></li> - <li><a id="toc-Rendering" href="render.html">7 Rendering</a> + <li><a id="toc-Rendering" href="render.html">8 Rendering</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Dynamic-templates" href="render.html#Dynamic-templates">7.1 Dynamic templates</a> + <li><a id="toc-Dynamic-templates" href="render.html#Dynamic-templates">8.1 Dynamic templates</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Examples" href="render.html#Examples">7.1.1 Examples</a></li> + <li><a id="toc-Examples" href="render.html#Examples">8.1.1 Examples</a></li> </ul></li> - <li><a id="toc-Rendering-pipeline" href="render.html#Rendering-pipeline">7.2 Rendering pipeline</a> + <li><a id="toc-Rendering-pipeline" href="render.html#Rendering-pipeline">8.2 Rendering pipeline</a> <ul class="toc-numbered-mark"> - <li><a id="toc-No-sink" href="render.html#No-sink">7.2.1 No sink</a></li> - <li><a id="toc-MAP-sink" href="render.html#MAP-sink">7.2.2 MAP sink</a></li> - <li><a id="toc-Menu-sink" href="render.html#Menu-sink">7.2.3 Menu sink</a></li> + <li><a id="toc-No-sink" href="render.html#No-sink">8.2.1 No sink</a></li> + <li><a id="toc-MAP-sink" href="render.html#MAP-sink">8.2.2 MAP sink</a></li> + <li><a id="toc-Menu-sink" href="render.html#Menu-sink">8.2.3 Menu sink</a></li> </ul></li> - <li><a id="toc-Multiple_002dpage-rendering" href="render.html#Multiple_002dpage-rendering">7.3 Multiple-page rendering</a> + <li><a id="toc-Multiple_002dpage-rendering" href="render.html#Multiple_002dpage-rendering">8.3 Multiple-page rendering</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Missing-navigation" href="render.html#Missing-navigation">7.3.1 Missing navigation</a></li> - <li><a id="toc-Multi_002dpage-example" href="render.html#Multi_002dpage-example">7.3.2 Multi-page example</a> + <li><a id="toc-Missing-navigation" href="render.html#Missing-navigation">8.3.1 Missing navigation</a></li> + <li><a id="toc-Multi_002dpage-example" href="render.html#Multi_002dpage-example">8.3.2 Multi-page example</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Data-accounting" href="render.html#Data-accounting">7.3.2.1 Data accounting</a></li> - <li><a id="toc-Rendering-logic" href="render.html#Rendering-logic">7.3.2.2 Rendering logic</a></li> + <li><a id="toc-Data-accounting" href="render.html#Data-accounting">8.3.2.1 Data accounting</a></li> + <li><a id="toc-Rendering-logic" href="render.html#Rendering-logic">8.3.2.2 Rendering logic</a></li> </ul></li> </ul></li> </ul></li> - <li><a id="toc-Handling-languages" href="language.html">8 Handling languages</a> + <li><a id="toc-Handling-languages" href="language.html">9 Handling languages</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Defining-language" href="language.html#Defining-language">8.1 Defining language</a></li> + <li><a id="toc-Defining-language" href="language.html#Defining-language">9.1 Defining language</a></li> </ul></li> - <li><a id="toc-Common-patterns" href="cookbook.html">9 Common patterns</a> + <li><a id="toc-Common-patterns" href="cookbook.html">10 Common patterns</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Hello-world" href="cookbook.html#Hello-world">9.1 Hello world</a></li> - <li><a id="toc-Handling-menus-and-inputs" href="cookbook.html#Handling-menus-and-inputs">9.2 Handling menus and inputs</a> + <li><a id="toc-Hello-world" href="cookbook.html#Hello-world">10.1 Hello world</a></li> + <li><a id="toc-Handling-menus-and-inputs" href="cookbook.html#Handling-menus-and-inputs">10.2 Handling menus and inputs</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Menu-batch-version" href="cookbook.html#Menu-batch-version">9.2.1 Menu batch version</a></li> + <li><a id="toc-Menu-batch-version" href="cookbook.html#Menu-batch-version">10.2.1 Menu batch version</a></li> </ul></li> - <li><a id="toc-Signal-flow-control" href="cookbook.html#Signal-flow-control">9.3 Signal flow control</a></li> - <li><a id="toc-Multiple-pages" href="cookbook.html#Multiple-pages">9.4 Multiple pages</a> + <li><a id="toc-Signal-flow-control" href="cookbook.html#Signal-flow-control">10.3 Signal flow control</a></li> + <li><a id="toc-Multiple-pages" href="cookbook.html#Multiple-pages">10.4 Multiple pages</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Menu-batch-version-1" href="cookbook.html#Menu-batch-version-1">9.4.1 Menu batch version</a></li> + <li><a id="toc-Menu-batch-version-1" href="cookbook.html#Menu-batch-version-1">10.4.1 Menu batch version</a></li> </ul></li> - <li><a id="toc-Multi_002dpage-menus" href="cookbook.html#Multi_002dpage-menus">9.5 Multi-page menus</a> + <li><a id="toc-Multi_002dpage-menus" href="cookbook.html#Multi_002dpage-menus">10.5 Multi-page menus</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Menu-batch-version-2" href="cookbook.html#Menu-batch-version-2">9.5.1 Menu batch version</a></li> + <li><a id="toc-Menu-batch-version-2" href="cookbook.html#Menu-batch-version-2">10.5.1 Menu batch version</a></li> </ul></li> - <li><a id="toc-Default-input-handler" href="cookbook.html#Default-input-handler">9.6 Default input handler</a></li> + <li><a id="toc-Default-input-handler" href="cookbook.html#Default-input-handler">10.6 Default input handler</a></li> </ul></li> - <li><a id="toc-Developing-with-vise" href="dev.html">10 Developing with vise</a> + <li><a id="toc-Developing-with-vise" href="dev.html">11 Developing with vise</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Code-repository-structure" href="dev.html#Code-repository-structure">10.1 Code repository structure</a></li> - <li><a id="toc-Interacting-with-vise" href="dev.html#Interacting-with-vise">10.2 Interacting with <code class="code">vise</code></a> + <li><a id="toc-Code-repository-structure" href="dev.html#Code-repository-structure">11.1 Code repository structure</a></li> + <li><a id="toc-Interacting-with-vise" href="dev.html#Interacting-with-vise">11.2 Interacting with <code class="code">vise</code></a> <ul class="toc-numbered-mark"> - <li><a id="toc-Modes-of-operation" href="dev.html#Modes-of-operation">10.2.1 Modes of operation</a> + <li><a id="toc-Modes-of-operation" href="dev.html#Modes-of-operation">11.2.1 Modes of operation</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Manual-operation" href="dev.html#Manual-operation">10.2.1.1 Manual operation</a></li> - <li><a id="toc-Synchronous-loop" href="dev.html#Synchronous-loop">10.2.1.2 Synchronous loop</a></li> - <li><a id="toc-Asynchronous-one_002dshot" href="dev.html#Asynchronous-one_002dshot">10.2.1.3 Asynchronous one-shot</a></li> + <li><a id="toc-Manual-operation" href="dev.html#Manual-operation">11.2.1.1 Manual operation</a></li> + <li><a id="toc-Synchronous-loop" href="dev.html#Synchronous-loop">11.2.1.2 Synchronous loop</a></li> + <li><a id="toc-Asynchronous-one_002dshot" href="dev.html#Asynchronous-one_002dshot">11.2.1.3 Asynchronous one-shot</a></li> </ul></li> - <li><a id="toc-Configuration" href="dev.html#Configuration">10.2.2 Configuration</a></li> - <li><a id="toc-Sessions" href="dev.html#Sessions">10.2.3 Sessions</a></li> - <li><a id="toc-Execution-context" href="dev.html#Execution-context">10.2.4 Execution context</a></li> + <li><a id="toc-Configuration" href="dev.html#Configuration">11.2.2 Configuration</a></li> + <li><a id="toc-Sessions" href="dev.html#Sessions">11.2.3 Sessions</a></li> + <li><a id="toc-Execution-context" href="dev.html#Execution-context">11.2.4 Execution context</a></li> </ul></li> - <li><a id="toc-Resolving-resources" href="dev.html#Resolving-resources">10.3 Resolving resources</a> + <li><a id="toc-Resolving-resources" href="dev.html#Resolving-resources">11.3 Resolving resources</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Memory-resource-implementation" href="dev.html#Memory-resource-implementation">10.3.1 Memory resource implementation</a></li> - <li><a id="toc-Filesystem-resource-implementation" href="dev.html#Filesystem-resource-implementation">10.3.2 Filesystem resource implementation</a> + <li><a id="toc-Memory-resource-implementation" href="dev.html#Memory-resource-implementation">11.3.1 Memory resource implementation</a></li> + <li><a id="toc-Filesystem-resource-implementation" href="dev.html#Filesystem-resource-implementation">11.3.2 Filesystem resource implementation</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Bytecode-_0028resource_002eResource_002eGetCode_0029" href="dev.html#Bytecode-_0028resource_002eResource_002eGetCode_0029">10.3.2.1 Bytecode (<code class="code">resource.Resource.GetCode</code>)</a></li> - <li><a id="toc-Templates-_0028resource_002eResource_002eGetTemplate_0029" href="dev.html#Templates-_0028resource_002eResource_002eGetTemplate_0029">10.3.2.2 Templates (<code class="code">resource.Resource.GetTemplate</code>)</a></li> - <li><a id="toc-Menus-_0028resource_002eResource_002eGetMenu_0029" href="dev.html#Menus-_0028resource_002eResource_002eGetMenu_0029">10.3.2.3 Menus (<code class="code">resource.Resource.GetMenu</code>)</a></li> - <li><a id="toc-External-symbols-_0028resource_002eResource_002eFuncFor_0029" href="dev.html#External-symbols-_0028resource_002eResource_002eFuncFor_0029">10.3.2.4 External symbols (<code class="code">resource.Resource.FuncFor</code>)</a></li> + <li><a id="toc-Bytecode-_0028resource_002eResource_002eGetCode_0029" href="dev.html#Bytecode-_0028resource_002eResource_002eGetCode_0029">11.3.2.1 Bytecode (<code class="code">resource.Resource.GetCode</code>)</a></li> + <li><a id="toc-Templates-_0028resource_002eResource_002eGetTemplate_0029" href="dev.html#Templates-_0028resource_002eResource_002eGetTemplate_0029">11.3.2.2 Templates (<code class="code">resource.Resource.GetTemplate</code>)</a></li> + <li><a id="toc-Menus-_0028resource_002eResource_002eGetMenu_0029" href="dev.html#Menus-_0028resource_002eResource_002eGetMenu_0029">11.3.2.3 Menus (<code class="code">resource.Resource.GetMenu</code>)</a></li> + <li><a id="toc-External-symbols-_0028resource_002eResource_002eFuncFor_0029" href="dev.html#External-symbols-_0028resource_002eResource_002eFuncFor_0029">11.3.2.4 External symbols (<code class="code">resource.Resource.FuncFor</code>)</a></li> </ul></li> </ul></li> - <li><a id="toc-Logging" href="dev.html#Logging">10.4 Logging</a></li> - <li><a id="toc-Tools" href="dev.html#Tools">10.5 Tools</a> + <li><a id="toc-Logging" href="dev.html#Logging">11.4 Logging</a></li> + <li><a id="toc-Tools" href="dev.html#Tools">11.5 Tools</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Test-data-generation" href="dev.html#Test-data-generation">10.5.1 Test data generation</a></li> - <li><a id="toc-Interactive-runner" href="dev.html#Interactive-runner">10.5.2 Interactive runner</a></li> - <li><a id="toc-Assembler" href="dev.html#Assembler">10.5.3 Assembler</a></li> - <li><a id="toc-Disassembler" href="dev.html#Disassembler">10.5.4 Disassembler</a></li> - <li><a id="toc-Interactive-case-examples" href="dev.html#Interactive-case-examples">10.5.5 Interactive case examples</a></li> + <li><a id="toc-Test-data-generation" href="dev.html#Test-data-generation">11.5.1 Test data generation</a></li> + <li><a id="toc-Interactive-runner" href="dev.html#Interactive-runner">11.5.2 Interactive runner</a></li> + <li><a id="toc-Assembler" href="dev.html#Assembler">11.5.3 Assembler</a></li> + <li><a id="toc-Disassembler" href="dev.html#Disassembler">11.5.4 Disassembler</a></li> + <li><a id="toc-Interactive-case-examples" href="dev.html#Interactive-case-examples">11.5.5 Interactive case examples</a></li> </ul></li> - <li><a id="toc-Assembly-examples" href="dev.html#Assembly-examples">10.6 Assembly examples</a></li> - <li><a id="toc-Bytecode-example" href="dev.html#Bytecode-example">10.7 Bytecode example</a> + <li><a id="toc-Assembly-examples" href="dev.html#Assembly-examples">11.6 Assembly examples</a></li> + <li><a id="toc-Bytecode-example" href="dev.html#Bytecode-example">11.7 Bytecode example</a> <ul class="toc-numbered-mark"> - <li><a id="toc-Example" href="dev.html#Example">10.7.1 Example</a></li> + <li><a id="toc-Example" href="dev.html#Example">11.7.1 Example</a></li> </ul></li> </ul></li> </ul> diff --git a/doc/build/instructions.html b/doc/build/instructions.html @@ -34,7 +34,7 @@ div.example {margin-left: 3.2em} Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previous: <a href="signals.html" accesskey="p" rel="prev">Signal flags</a>, Up: <a href="index.html" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> </div> <hr> -<h2 class="chapter" id="Instructions">4 Instructions</h2> +<h2 class="chapter" id="Instructions">5 Instructions</h2> <ul class="mini-toc"> @@ -43,7 +43,7 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou <li><a href="#Batch-instructions" accesskey="3">Batch instructions</a></li> </ul> <div class="section-level-extent" id="Data-types"> -<h3 class="section">4.1 Data types</h3> +<h3 class="section">5.1 Data types</h3> <a class="anchor" id="node_005ftype"></a><ul class="mini-toc"> @@ -56,7 +56,7 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou <li><a href="#matchmode" accesskey="7">matchmode</a></li> </ul> <div class="subsection-level-extent" id="node"> -<h4 class="subsection">4.1.1 node</h4> +<h4 class="subsection">5.1.1 node</h4> <p>A node name is a string. </p> @@ -67,7 +67,7 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou <li><a href="#Special-node" accesskey="2">Special node</a></li> </ul> <div class="subsubsection-level-extent" id="Regular-node"> -<h4 class="subsubsection">4.1.1.1 Regular node</h4> +<h4 class="subsubsection">5.1.1.1 Regular node</h4> <p>Must be one or more characters long. </p> @@ -78,7 +78,7 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou </div> <div class="subsubsection-level-extent" id="Special-node"> -<h4 class="subsubsection">4.1.1.2 Special node</h4> +<h4 class="subsubsection">5.1.1.2 Special node</h4> <p>Special node names are a single character. </p> @@ -88,21 +88,21 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou </div> </div> <div class="subsection-level-extent" id="label"> -<h4 class="subsection">4.1.2 label</h4> +<h4 class="subsection">5.1.2 label</h4> <p>Same rules as for <a class="ref" href="#symbol_005ftype">symbol</a>. </p> </div> <div class="subsection-level-extent" id="size"> -<h4 class="subsection">4.1.3 size</h4> +<h4 class="subsection">5.1.3 size</h4> <p>Numerical value of any size. </p> </div> <div class="subsection-level-extent" id="selector"> -<h4 class="subsection">4.1.4 selector</h4> +<h4 class="subsection">5.1.4 selector</h4> <p>The selector <code class="code">*</code> is used to catch any input. </p> @@ -111,21 +111,21 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou <a class="anchor" id="symbol_005ftype"></a></div> <div class="subsection-level-extent" id="symbol"> -<h4 class="subsection">4.1.5 symbol</h4> +<h4 class="subsection">5.1.5 symbol</h4> <p>Same rules as for <a class="ref" href="#node_005ftype">regular node names</a>. </p> </div> <div class="subsection-level-extent" id="signal"> -<h4 class="subsection">4.1.6 signal</h4> +<h4 class="subsection">5.1.6 signal</h4> <p>Numerical value of any size. </p> </div> <div class="subsection-level-extent" id="matchmode"> -<h4 class="subsection">4.1.7 matchmode</h4> +<h4 class="subsection">5.1.7 matchmode</h4> <p>Binary numeric value, 0 or 1. </p> @@ -133,7 +133,7 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou </div> </div> <div class="section-level-extent" id="Instruction-list"> -<h3 class="section">4.2 Instruction list</h3> +<h3 class="section">5.2 Instruction list</h3> <ul class="mini-toc"> <li><a href="#CATCH-_003cnode_003e-_003csignal_003e-_003cmatchmode_003e" accesskey="1">CATCH &lt;node&gt; &lt;signal&gt; &lt;matchmode&gt;</a></li> @@ -150,7 +150,7 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou <li><a href="#RELOAD-_003csymbol_003e">RELOAD &lt;symbol&gt;</a></li> </ul> <div class="subsection-level-extent" id="CATCH-_003cnode_003e-_003csignal_003e-_003cmatchmode_003e"> -<h4 class="subsection">4.2.1 CATCH &lt;node&gt; &lt;signal&gt; &lt;matchmode&gt;</h4> +<h4 class="subsection">5.2.1 CATCH &lt;node&gt; &lt;signal&gt; &lt;matchmode&gt;</h4> <p>Control flow using signal checking. </p> @@ -163,7 +163,7 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou </div> <div class="subsection-level-extent" id="CROAK-_003csignal_003e-_003cmatchmode_003e"> -<h4 class="subsection">4.2.2 CROAK &lt;signal&gt; &lt;matchmode&gt;</h4> +<h4 class="subsection">5.2.2 CROAK &lt;signal&gt; &lt;matchmode&gt;</h4> <p>Clear state and restart execution from top if signal is matched. </p> @@ -171,7 +171,7 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou </p> </div> <div class="subsection-level-extent" id="HALT"> -<h4 class="subsection">4.2.3 HALT</h4> +<h4 class="subsection">5.2.3 HALT</h4> <p>Halt execution and yield control to client. </p> @@ -180,7 +180,7 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou </div> <div class="subsection-level-extent" id="INCMP-_003cnode_003e-_003cselector_003e"> -<h4 class="subsection">4.2.4 INCMP &lt;node&gt; &lt;selector&gt;</h4> +<h4 class="subsection">5.2.4 INCMP &lt;node&gt; &lt;selector&gt;</h4> <p>Compare registered input to <code class="code">selector</code>. </p> @@ -191,7 +191,7 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou </div> <div class="subsection-level-extent" id="LOAD-_003csymbol_003e-_003csize_003e"> -<h4 class="subsection">4.2.5 LOAD &lt;symbol&gt; &lt;size&gt;</h4> +<h4 class="subsection">5.2.5 LOAD &lt;symbol&gt; &lt;size&gt;</h4> <p>Execute the code symbol <code class="code">symbol</code> and cache the result. </p> @@ -200,14 +200,14 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou </div> <div class="subsection-level-extent" id="MAP-_003csymbol_003e"> -<h4 class="subsection">4.2.6 MAP &lt;symbol&gt;</h4> +<h4 class="subsection">5.2.6 MAP &lt;symbol&gt;</h4> <p>Expose result from <code class="code">symbol</code> previously loaded by <code class="code">LOAD</code> to the renderer. </p> </div> <div class="subsection-level-extent" id="MNEXT-_003clabel_003e-_003cselector_003e"> -<h4 class="subsection">4.2.7 MNEXT &lt;label&gt; &lt;selector&gt;</h4> +<h4 class="subsection">5.2.7 MNEXT &lt;label&gt; &lt;selector&gt;</h4> <p>Activate the &quot;next&quot; part of lateral navigation. </p> @@ -216,7 +216,7 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou </div> <div class="subsection-level-extent" id="MOUT-_003clabel_003e-_003cselector_003e"> -<h4 class="subsection">4.2.8 MOUT &lt;label&gt; &lt;selector&gt;</h4> +<h4 class="subsection">5.2.8 MOUT &lt;label&gt; &lt;selector&gt;</h4> <p>Add menu entry. </p> @@ -227,7 +227,7 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou </div> <div class="subsection-level-extent" id="MOVE-_003cnode_003e"> -<h4 class="subsection">4.2.9 MOVE &lt;node&gt;</h4> +<h4 class="subsection">5.2.9 MOVE &lt;node&gt;</h4> <p>Load bytecode and template corresponding to <code class="code">node</code>. </p> @@ -238,7 +238,7 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou </div> <div class="subsection-level-extent" id="MPREV-_003clabel_003e-_003cselector_003e"> -<h4 class="subsection">4.2.10 MPREV &lt;label&gt; &lt;selector&gt;</h4> +<h4 class="subsection">5.2.10 MPREV &lt;label&gt; &lt;selector&gt;</h4> <p>Activate the &quot;previous&quot; part of lateral navigation. </p> @@ -247,7 +247,7 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou </div> <div class="subsection-level-extent" id="MSINK"> -<h4 class="subsection">4.2.11 MSINK</h4> +<h4 class="subsection">5.2.11 MSINK</h4> <p>If set, the menu is defined as the multi-page content sink. </p> @@ -256,7 +256,7 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou </div> <div class="subsection-level-extent" id="RELOAD-_003csymbol_003e"> -<h4 class="subsection">4.2.12 RELOAD &lt;symbol&gt;</h4> +<h4 class="subsection">5.2.12 RELOAD &lt;symbol&gt;</h4> <p>Execute a code symbol already loaded by <code class="code">LOAD</code> and overwrite the existing cache with the new results. </p> @@ -267,7 +267,7 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou </div> </div> <div class="section-level-extent" id="Batch-instructions"> -<h3 class="section">4.3 Batch instructions</h3> +<h3 class="section">5.3 Batch instructions</h3> <p>Some convenience instructions are made available for defining menus. </p> @@ -293,7 +293,7 @@ Next: <a href="navigation.html" accesskey="n" rel="next">Navigation</a>, Previou <li><a href="#Batch-menu-expansion" accesskey="1">Batch menu expansion</a></li> </ul> <div class="subsection-level-extent" id="Batch-menu-expansion"> -<h4 class="subsection">4.3.1 Batch menu expansion</h4> +<h4 class="subsection">5.3.1 Batch menu expansion</h4> <table class="multitable"> <thead><tr><th>Batch instruction</th><th>Expanded instruction</th></tr></thead> diff --git a/doc/build/language.html b/doc/build/language.html @@ -29,7 +29,7 @@ Next: <a href="cookbook.html" accesskey="n" rel="next">Common patterns</a>, Previous: <a href="render.html" accesskey="p" rel="prev">Rendering</a>, Up: <a href="index.html" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> </div> <hr> -<h2 class="chapter" id="Handling-languages">8 Handling languages</h2> +<h2 class="chapter" id="Handling-languages">9 Handling languages</h2> <p>Templates, external code symbols and menu labels can be resolved differently depending on language. @@ -43,7 +43,7 @@ Next: <a href="cookbook.html" accesskey="n" rel="next">Common patterns</a>, Prev <li><a href="#Defining-language" accesskey="1">Defining language</a></li> </ul> <div class="section-level-extent" id="Defining-language"> -<h3 class="section">8.1 Defining language</h3> +<h3 class="section">9.1 Defining language</h3> <p>The default language can be set in <code class="code">engine.Config.Language</code>. </p> diff --git a/doc/build/navigation.html b/doc/build/navigation.html @@ -34,7 +34,7 @@ ul.mark-bullet {list-style-type: disc} Next: <a href="cache.html" accesskey="n" rel="next">External data</a>, Previous: <a href="instructions.html" accesskey="p" rel="prev">Instructions</a>, Up: <a href="index.html" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> </div> <hr> -<h2 class="chapter" id="Navigation">5 Navigation</h2> +<h2 class="chapter" id="Navigation">6 Navigation</h2> <p>Nodes are navigated by name, using a navigation stack. @@ -51,7 +51,7 @@ Next: <a href="cache.html" accesskey="n" rel="next">External data</a>, Previous: <li><a href="#Navigation-stack" accesskey="4">Navigation stack</a></li> </ul> <div class="section-level-extent" id="Entry-point"> -<h3 class="section">5.1 Entry point</h3> +<h3 class="section">6.1 Entry point</h3> <p>All VM executions require an <em class="emph">entry point</em>. </p> @@ -62,7 +62,7 @@ Next: <a href="cache.html" accesskey="n" rel="next">External data</a>, Previous: <a class="anchor" id="lateral_005fnavigation"></a></div> <div class="section-level-extent" id="Lateral-navigation"> -<h3 class="section">5.2 Lateral navigation</h3> +<h3 class="section">6.2 Lateral navigation</h3> <p>Lateral navigation is only available for node output spanning multiple pages. See <a class="ref" href="render.html#render_005fmulti">Multi-page rendering</a> for details. </p> @@ -77,7 +77,7 @@ Next: <a href="cache.html" accesskey="n" rel="next">External data</a>, Previous: <a class="anchor" id="node_005fnames"></a></div> <div class="section-level-extent" id="Node-names"> -<h3 class="section">5.3 Node names</h3> +<h3 class="section">6.3 Node names</h3> <p>Regular node names <em class="emph">must</em> start with an alphabetical character. The rest of the string may contain alphanumeric characters and underscore. </p> @@ -86,7 +86,7 @@ Next: <a href="cache.html" accesskey="n" rel="next">External data</a>, Previous: <li><a href="#Builtin-node-names" accesskey="2">Builtin node names</a></li> </ul> <div class="subsection-level-extent" id="Special-node-names"> -<h4 class="subsection">5.3.1 Special node names</h4> +<h4 class="subsection">6.3.1 Special node names</h4> <p>A selection of special node names are available for relative navigation. They are single-character tokens, listed below with their respective ASCII codes. </p> @@ -111,7 +111,7 @@ Next: <a href="cache.html" accesskey="n" rel="next">External data</a>, Previous: </div> <div class="subsection-level-extent" id="Builtin-node-names"> -<h4 class="subsection">5.3.2 Builtin node names</h4> +<h4 class="subsection">6.3.2 Builtin node names</h4> <p>Uncaught exceptions in the code flow that should not halt execution are routed to a builtin node named <code class="code">_catch</code>. </p> @@ -119,7 +119,7 @@ Next: <a href="cache.html" accesskey="n" rel="next">External data</a>, Previous: </div> </div> <div class="section-level-extent" id="Navigation-stack"> -<h3 class="section">5.4 Navigation stack</h3> +<h3 class="section">6.4 Navigation stack</h3> <p>Consider the following navigation example, illustrating the state of the stack for each step after execution. </p> diff --git a/doc/build/nomenclature.html b/doc/build/nomenclature.html @@ -17,7 +17,7 @@ <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> <link href="index.html" rel="up" title="Top"> <link href="signals.html" rel="next" title="signals"> -<link href="overview.html" rel="prev" title="overview"> +<link href="sim.html" rel="prev" title="sim"> </head> @@ -26,17 +26,17 @@ <div class="chapter-level-extent" id="nomenclature"> <div class="nav-panel"> <p> -Next: <a href="signals.html" accesskey="n" rel="next">Signal flags</a>, Previous: <a href="overview.html" accesskey="p" rel="prev">Overview</a>, Up: <a href="index.html" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> +Next: <a href="signals.html" accesskey="n" rel="next">Signal flags</a>, Previous: <a href="sim.html" accesskey="p" rel="prev">An example vise implementation</a>, Up: <a href="index.html" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> </div> <hr> -<h2 class="chapter" id="Nomenclature">2 Nomenclature</h2> +<h2 class="chapter" id="Nomenclature">3 Nomenclature</h2> <ul class="mini-toc"> <li><a href="#Common" accesskey="1">Common</a></li> <li><a href="#Instructions-and-navigation" accesskey="2">Instructions and navigation</a></li> </ul> <div class="section-level-extent" id="Common"> -<h3 class="section">2.1 Common</h3> +<h3 class="section">3.1 Common</h3> <dl class="table"> <dt>&lsquo;<samp class="samp">client</samp>&rsquo;</dt> @@ -47,7 +47,7 @@ Next: <a href="signals.html" accesskey="n" rel="next">Signal flags</a>, Previous </div> <div class="section-level-extent" id="Instructions-and-navigation"> -<h3 class="section">2.2 Instructions and navigation</h3> +<h3 class="section">3.2 Instructions and navigation</h3> <dl class="table"> <dt>&lsquo;<samp class="samp">node</samp>&rsquo;</dt> diff --git a/doc/build/overview.html b/doc/build/overview.html @@ -16,8 +16,13 @@ <link href="index.html" rel="start" title="Top"> <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> <link href="index.html" rel="up" title="Top"> -<link href="nomenclature.html" rel="next" title="nomenclature"> +<link href="sim.html" rel="next" title="sim"> <link href="index.html" rel="prev" title="Top"> +<style type="text/css"> +<!-- +ul.mark-bullet {list-style-type: disc} +--> +</style> </head> @@ -26,24 +31,41 @@ <div class="chapter-level-extent" id="overview"> <div class="nav-panel"> <p> -Next: <a href="nomenclature.html" accesskey="n" rel="next">Nomenclature</a>, Previous: <a href="index.html" accesskey="p" rel="prev">Introduction</a>, Up: <a href="index.html" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> +Next: <a href="sim.html" accesskey="n" rel="next">An example vise implementation</a>, Previous: <a href="index.html" accesskey="p" rel="prev">Introduction</a>, Up: <a href="index.html" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> </div> <hr> <h2 class="chapter" id="Overview">1 Overview</h2> -<p>An attempt at defining a small VM to handle menu interaction for size-constrained clients and servers. +<p><code class="code">vise</code> is a virtual machine specialized for generating output for clients that have strict output size constaints. </p> -<p>Original motivation was to create a simple templating renderer for USSD clients, combined with an agnostic data-retrieval reference that may conceal any level of complexity. +<p>Specifically, the original target enviromnent was USSD menu navigation and session handling. </p> +<ul class="mini-toc"> +<li><a href="#Features" accesskey="1">Features</a></li> +<li><a href="#Contents" accesskey="2">Contents</a></li> +</ul> +<div class="section-level-extent" id="Features"> +<h3 class="section">1.1 Features</h3> + +</div> +<div class="section-level-extent" id="Contents"> +<h3 class="section">1.2 Contents</h3> <ul class="mini-toc"> -<li><a href="#Synopsis" accesskey="1">Synopsis</a></li> +<li><a href="#Virtual-machine" accesskey="1">Virtual machine</a></li> </ul> -<div class="section-level-extent" id="Synopsis"> -<h3 class="section">1.1 Synopsis</h3> +<div class="subsection-level-extent" id="Virtual-machine"> +<h4 class="subsection">1.2.1 Virtual machine</h4> -<p>TODO -</p></div> +<p>This component processes menu navigation from client input, and executes +</p> +<ul class="itemize mark-bullet"> +<li>Virtual machine to handle menu navigation. +</li><li>Assembly mini-language to script for the virtual machine. +</li><li>Code interface for external calls. +</li></ul> +</div> +</div> </div> diff --git a/doc/build/render.html b/doc/build/render.html @@ -34,7 +34,7 @@ div.example {margin-left: 3.2em} Next: <a href="language.html" accesskey="n" rel="next">Handling languages</a>, Previous: <a href="cache.html" accesskey="p" rel="prev">External data</a>, Up: <a href="index.html" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> </div> <hr> -<h2 class="chapter" id="Rendering">7 Rendering</h2> +<h2 class="chapter" id="Rendering">8 Rendering</h2> <p>Every node whose bytecode includes a <code class="code">HALT</code> statement <strong class="strong">MUST</strong> define a rendering template. </p> @@ -47,7 +47,7 @@ Next: <a href="language.html" accesskey="n" rel="next">Handling languages</a>, P <li><a href="#Multiple_002dpage-rendering" accesskey="3">Multiple-page rendering</a></li> </ul> <div class="section-level-extent" id="Dynamic-templates"> -<h3 class="section">7.1 Dynamic templates</h3> +<h3 class="section">8.1 Dynamic templates</h3> <p>Using placeholders, the content behind <code class="code">MAP</code> calls in the current executing node may be embedded in the template. </p> @@ -61,7 +61,7 @@ Next: <a href="language.html" accesskey="n" rel="next">Handling languages</a>, P <li><a href="#Examples" accesskey="1">Examples</a></li> </ul> <div class="subsection-level-extent" id="Examples"> -<h4 class="subsection">7.1.1 Examples</h4> +<h4 class="subsection">8.1.1 Examples</h4> <p>Consider the following instruction sequence: </p> @@ -113,7 +113,7 @@ HALT </div> </div> <div class="section-level-extent" id="Rendering-pipeline"> -<h3 class="section">7.2 Rendering pipeline</h3> +<h3 class="section">8.2 Rendering pipeline</h3> <p>The pipeline starts with the loading of the template corresponding to the current execution node. </p> @@ -134,7 +134,7 @@ HALT <li><a href="#Menu-sink" accesskey="3">Menu sink</a></li> </ul> <div class="subsection-level-extent" id="No-sink"> -<h4 class="subsection">7.2.1 No sink</h4> +<h4 class="subsection">8.2.1 No sink</h4> <ol class="enumerate"> <li> Expand all placeholders in the template. @@ -144,7 +144,7 @@ HALT <a class="anchor" id="map_005fsink"></a></div> <div class="subsection-level-extent" id="MAP-sink"> -<h4 class="subsection">7.2.2 MAP sink</h4> +<h4 class="subsection">8.2.2 MAP sink</h4> <ol class="enumerate"> <li> Expand all non-sink placeholders in the template. @@ -161,7 +161,7 @@ HALT </div> <div class="subsection-level-extent" id="Menu-sink"> -<h4 class="subsection">7.2.3 Menu sink</h4> +<h4 class="subsection">8.2.3 Menu sink</h4> <ol class="enumerate"> <li> Remove all menu items (any following menu expansion will only contain lateral navigation items, when and if they apply). @@ -173,7 +173,7 @@ HALT <a class="anchor" id="render_005fmulti"></a></div> </div> <div class="section-level-extent" id="Multiple_002dpage-rendering"> -<h3 class="section">7.3 Multiple-page rendering</h3> +<h3 class="section">8.3 Multiple-page rendering</h3> <p>As indicated above, multiple-page rendering is activated when a <code class="code">MAP</code> is issued to a symbol that is loaded with <code class="code">0</code> size. (<code class="code">LOAD &lt;symbol&gt; 0</code>). </p> @@ -185,7 +185,7 @@ HALT <li><a href="#Multi_002dpage-example" accesskey="2">Multi-page example</a></li> </ul> <div class="subsection-level-extent" id="Missing-navigation"> -<h4 class="subsection">7.3.1 Missing navigation</h4> +<h4 class="subsection">8.3.1 Missing navigation</h4> <p>If no <em class="emph">lateral navigation</em> has been activated, any sinks will still be processed. </p> @@ -194,7 +194,7 @@ HALT </div> <div class="subsection-level-extent" id="Multi_002dpage-example"> -<h4 class="subsection">7.3.2 Multi-page example</h4> +<h4 class="subsection">8.3.2 Multi-page example</h4> <p>Consider the following instruction sequence: </p> @@ -227,7 +227,7 @@ INCMP &lt; 22 <li><a href="#Rendering-logic" accesskey="2">Rendering logic</a></li> </ul> <div class="subsubsection-level-extent" id="Data-accounting"> -<h4 class="subsubsection">7.3.2.1 Data accounting</h4> +<h4 class="subsubsection">8.3.2.1 Data accounting</h4> <p>Then consider that the symbols resolve as follows: </p> @@ -265,7 +265,7 @@ CLYDE 4444 </div> <div class="subsubsection-level-extent" id="Rendering-logic"> -<h4 class="subsubsection">7.3.2.2 Rendering logic</h4> +<h4 class="subsubsection">8.3.2.2 Rendering logic</h4> <p>The total sink byte count is 72, whereas the maximum available sink capacity is 39. At least one extra page is needed. </p> diff --git a/doc/build/signals.html b/doc/build/signals.html @@ -29,7 +29,7 @@ Next: <a href="instructions.html" accesskey="n" rel="next">Instructions</a>, Previous: <a href="nomenclature.html" accesskey="p" rel="prev">Nomenclature</a>, Up: <a href="index.html" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> </div> <hr> -<h2 class="chapter" id="Signal-flags">3 Signal flags</h2> +<h2 class="chapter" id="Signal-flags">4 Signal flags</h2> <ul class="mini-toc"> @@ -37,7 +37,7 @@ Next: <a href="instructions.html" accesskey="n" rel="next">Instructions</a>, Pre <li><a href="#Built_002din-signal-flags" accesskey="2">Built-in signal flags</a></li> </ul> <div class="section-level-extent" id="Client_002ddefined-signal-flags"> -<h3 class="section">3.1 Client-defined signal flags</h3> +<h3 class="section">4.1 Client-defined signal flags</h3> <p>The client can define any number of signal flags to use. The number of signals <strong class="strong">MUST</strong> be declared explicitly in the client code, and <strong class="strong">MUST NOT</strong> change in stateful or asynchronous execution environments. </p> @@ -48,7 +48,7 @@ Next: <a href="instructions.html" accesskey="n" rel="next">Instructions</a>, Pre <li><a href="#Flow-control" accesskey="1">Flow control</a></li> </ul> <div class="subsection-level-extent" id="Flow-control"> -<h4 class="subsection">3.1.1 Flow control</h4> +<h4 class="subsection">4.1.1 Flow control</h4> <p>Signal flags enables the client to control the execution flow as a side-effect of the execution of external code symbols. </p> @@ -60,7 +60,7 @@ Next: <a href="instructions.html" accesskey="n" rel="next">Instructions</a>, Pre <a class="anchor" id="builtin_005fflags"></a></div> </div> <div class="section-level-extent" id="Built_002din-signal-flags"> -<h3 class="section">3.2 Built-in signal flags</h3> +<h3 class="section">4.2 Built-in signal flags</h3> <p>For the numeric values of the signals, please refer to the signals appendix. </p> diff --git a/doc/texinfo/index.texi b/doc/texinfo/index.texi @@ -24,6 +24,7 @@ Released 2023 under AGPL3 @end menu @include overview.texi +@include sim.texi @include nomenclature.texi @include signals.texi @include instructions.texi diff --git a/doc/texinfo/overview.texi b/doc/texinfo/overview.texi @@ -1,11 +1,20 @@ @node overview @chapter Overview -An attempt at defining a small VM to handle menu interaction for size-constrained clients and servers. +@code{vise} is a virtual machine specialized for generating output for clients that have strict output size constaints. -Original motivation was to create a simple templating renderer for USSD clients, combined with an agnostic data-retrieval reference that may conceal any level of complexity. +Specifically, the original target enviromnent was USSD menu navigation and session handling. +@section Features -@section Synopsis +@section Contents -TODO +@subsection Virtual machine + +This component processes menu navigation from client input, and executes + +@itemize +@item Virtual machine to handle menu navigation. +@item Assembly mini-language to script for the virtual machine. +@item Code interface for external calls. +@end itemize diff --git a/doc/texinfo/sim.texi b/doc/texinfo/sim.texi @@ -0,0 +1,212 @@ +@node sim +@chapter An example vise implementation + + +Consider the following interaction: + +@example +This is the root page +You have visited 1 time. +0:foo +1:bar + +$ 1 +Please visit foo first. +Any input to return. + +$ x +This is the root page. +You have visited 2 times. +0:foo +1:bar + +$ 0 +Welcome to page foo. +Please write seomthing. + +$ blah blah blah +This is the root page. +You have visited 3 times. +0:foo +1:bar + +$ 1 +Thanks for visiting foo and bar. +You wrote "blah blah blah" in foo. +@end example + +The simple interface above involves four different menu nodes. + +In order to engineer these using vise, three types of components are involved: + +@itemize +@item An assembly-like menu handling script. +@item A display template. +@item External code handlers for the counter and the "something" input. +@end itemize + + + +The nodes are: + +@table @code +@item root +The first page. +@item foo +The "foo" page. +@item bar +The "bar" page after "foo" has been visited. +@item ouch +The "bar" page before "foo" has been visited. +@end table + + +@section Templates + +Each page has a template that may or may not contain dynamic elements. + +In this example the @code{root} and @code{bar} nodes contains dynamic content. + +@subsection root + +@verbatim +This is the root page +You have visited {{.count}}. +@end verbatim + +@subsection foo + +@verbatim +Welcome to page foo. +Please write something. +@end verbatim + +@subsection bar + +@verbatim +Thanks for visiting foo and bar. +You wrote "{{.something}}" in foo. +@end verbatim + +@subsection ouch + +@verbatim +Please visit foo first. +Any input to return. +@end verbatim + + +@section Scripts + +The scripts are responsible for defining menus, handling navigation flow control, and triggering external code handlers. + +@subsection root + +@verbatim +LOAD count 8 # trigger external code handler "count" +LOAD something 0 # trigger external code handler "something" +RELOAD count # explicitly trigger "count" every time this code is executed. +MAP count # make the result from "count" available to the template renderer +MOUT foo 0 # menu item +MOUT bar 1 # menu item +HALT # render template and wait for input +INCMP foo 0 # match menu selection 0, move to node "foo" on match +INCMP bar 1 # match menu selection 1, move to node "bar" on match +@end verbatim + +@subsection foo + +@verbatim +HALT # render template and wait for input +RELOAD something # pass input to the "something" external code handler. The "HAVESOMETHING" flag (8) will be set +MOVE _ # move up one level +@end verbatim + + +@subsection bar + +@verbatim +CATCH ouch 8 0 # if the "HAVESOMETHING" (8) flag has NOT (0) been set, move to "ouch" +MAP something # make the result from "something" available to the template renderer +HALT # render template and wait for input +INCMP ^ * # move to the root node on any input +@end verbatim + + +@subsection ouch + +@verbatim +HALT # render template and wait for input +INCMP ^ * # move to the root node on any input +@end verbatim + + +@section External code handlers + +The script code contains @code{LOAD} instructions for two different methods. + +@verbatim +import ( + testdataloader "github.com/peteole/testdata-loader" + + "git.defalsify.org/vise.git/state" + "git.defalsify.org/vise.git/resource" +) + +const ( + USERFLAG_HAVESOMETHING = iota + state.FLAG_USERSTART +) + +var ( + baseDir = testdataloader.GetBasePath() + scriptDir = path.Join(baseDir, "examples", "intro") +) + +type Counter struct { + *resource.FsResource + c int64 + v string +} + +func newCounter() Counter { + fs := resource.NewFsResource(scriptDir) + return Counter{fs, 0, ""} +} + +func(c *Counter) count(ctx context.Context, sym string, input []byte) (resource.Result, error) { + s := "%v time" + if c.c != 1 { + s += "s" + } + r := resource.Result{ + Content: fmt.Sprintf(s, c.c), + } + c.c += 1 + return r, nil +} + +func(c *Counter) something(ctx context.Context, sym string, input []byte) (resource.Result, error) { + c.v = string(input) + r := resource.Result{ + Content: c.v, + } + if len(input) > 0 { + r.FlagSet = []uint32{USERFLAG_HAVESOMETHING} + } + return r, nil +} +@end verbatim + + +@section Working example + +In the source code repository, a full working example of this menu can be found in @file{examples/intro}. + +To run it: + +@example +make -B intro +go run ./examples/intro +@end example + +Use @code{go run -tags logtrace ...} to peek at what is going on under the hood. diff --git a/examples/intro/Makefile b/examples/intro/Makefile @@ -0,0 +1,10 @@ +INPUTS = $(wildcard ./*.vis) +TXTS = $(wildcard ./*.txt.orig) + +%.vis: + go run ../../dev/asm $(basename $@).vis > $(basename $@).bin + +all: $(INPUTS) $(TXTS) + +%.txt.orig: + cp -v $(basename $@).orig $(basename $@) diff --git a/examples/intro/bar b/examples/intro/bar @@ -0,0 +1,2 @@ +Thanks for visiting foo and bar. +You wrote "{{.something}}" in foo. diff --git a/examples/intro/bar.vis b/examples/intro/bar.vis @@ -0,0 +1,4 @@ +CATCH ouch 8 0 +MAP something +HALT +INCMP ^ * diff --git a/examples/intro/foo b/examples/intro/foo @@ -0,0 +1,2 @@ +Welcome to page foo. +Please write something. diff --git a/examples/intro/foo.vis b/examples/intro/foo.vis @@ -0,0 +1,3 @@ +HALT +RELOAD something +MOVE _ diff --git a/examples/intro/main.go b/examples/intro/main.go @@ -0,0 +1,96 @@ +package main + +import ( + "context" + "flag" + "fmt" + "os" + "path" + + testdataloader "github.com/peteole/testdata-loader" + + "git.defalsify.org/vise.git/cache" + "git.defalsify.org/vise.git/engine" + "git.defalsify.org/vise.git/resource" + "git.defalsify.org/vise.git/state" +) + +const ( + USERFLAG_HAVESOMETHING = iota + state.FLAG_USERSTART +) + +var ( + baseDir = testdataloader.GetBasePath() + scriptDir = path.Join(baseDir, "examples", "intro") +) + +type Counter struct { + *resource.FsResource + c int64 + v string +} + +func newCounter() Counter { + fs := resource.NewFsResource(scriptDir) + return Counter{fs, 0, ""} +} + +func(c *Counter) count(ctx context.Context, sym string, input []byte) (resource.Result, error) { + s := "%v time" + if c.c != 1 { + s += "s" + } + r := resource.Result{ + Content: fmt.Sprintf(s, c.c), + } + c.c += 1 + return r, nil +} + +func(c *Counter) something(ctx context.Context, sym string, input []byte) (resource.Result, error) { + c.v = string(input) + r := resource.Result{ + Content: c.v, + } + if len(input) > 0 { + r.FlagSet = []uint32{USERFLAG_HAVESOMETHING} + } + return r, nil +} + +func main() { + var dir string + var root string + var size uint + var sessionId string + flag.UintVar(&size, "s", 0, "max size of output") + flag.StringVar(&root, "root", "root", "entry point symbol") + flag.StringVar(&sessionId, "session-id", "default", "session id") + flag.Parse() + fmt.Fprintf(os.Stderr, "starting session at symbol '%s' using resource dir: %s\n", root, dir) + + st := state.NewState(3) + rs := newCounter() + rs.AddLocalFunc("count", rs.count) + rs.AddLocalFunc("something", rs.something) + ca := cache.NewCache() + cfg := engine.Config{ + Root: "root", + SessionId: sessionId, + OutputSize: uint32(size), + } + ctx := context.Background() + en := engine.NewEngine(ctx, cfg, &st, rs, ca) + var err error + _, err = en.Init(ctx) + if err != nil { + fmt.Fprintf(os.Stderr, "engine init fail: %v\n", err) + os.Exit(1) + } + + err = engine.Loop(ctx, &en, os.Stdin, os.Stdout) + if err != nil { + fmt.Fprintf(os.Stderr, "loop exited with error: %v\n", err) + os.Exit(1) + } +} diff --git a/examples/intro/ouch b/examples/intro/ouch @@ -0,0 +1,2 @@ +Please visit foo first. +Any input to return. diff --git a/examples/intro/ouch.vis b/examples/intro/ouch.vis @@ -0,0 +1,2 @@ +HALT +INCMP ^ * diff --git a/examples/intro/root b/examples/intro/root @@ -0,0 +1,2 @@ +This is the root page +You have visited {{.count}}. diff --git a/examples/intro/root.vis b/examples/intro/root.vis @@ -0,0 +1,9 @@ +LOAD count 8 +LOAD something 0 +RELOAD count +MAP count +MOUT foo 0 +MOUT bar 1 +HALT +INCMP foo 0 +INCMP bar 1 diff --git a/vm/runner.go b/vm/runner.go @@ -280,6 +280,11 @@ func(vm *Vm) runLoad(ctx context.Context, b []byte) ([]byte, error) { if err != nil { return b, err } + _, err = vm.ca.Get(sym) + if err == nil { + Logg.DebugCtxf(ctx, "skip already loaded symbol", "symbol", sym) + return b, nil + } r, err := vm.refresh(sym, vm.rs, ctx) if err != nil { return b, err @@ -475,6 +480,8 @@ func(vm *Vm) Render(ctx context.Context) (string, error) { // retrieve and cache data for key func(vm *Vm) refresh(key string, rs resource.Resource, ctx context.Context) (string, error) { + var err error + fn, err := rs.FuncFor(key) if err != nil { return "", err