Repository navigation
Expand file tree
/
Copy pathLanguage-Copilot-Dispatch.html
More file actions
39 lines (39 loc) · 12.1 KB
/
Copy pathLanguage-Copilot-Dispatch.html
File metadata and controls
39 lines (39 loc) · 12.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Language.Copilot.Dispatch</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Language-Copilot-Dispatch.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="http://github.com/leepike/Copilot/Language.Copilot.Dispatch.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">copilot-1.0.2: A stream DSL for writing embedded C monitors.</p></div><div id="content"><div id="module-header"><p class="caption">Language.Copilot.Dispatch</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>The Dispatch module : does all the IO, and offers an unified interface to both
the interpreter and the compiler.
</p><p>Also communicates with GCC in order to compile the C code, and then transmits
the results of the execution of that C code. This functionnality is mostly
used to check automatically the equivalence between the interpreter and the
compiler. The Dispatch module only parses the command-line arguments before
calling that module.
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:dispatch">dispatch</a> :: <a href="Language-Copilot-Core.html#t:LangElems">LangElems</a> -> <a href="Language-Copilot-Core.html#t:Vars">Vars</a> -> <a href="Language-Copilot-Dispatch.html#t:BackEnd">BackEnd</a> -> <a href="Language-Copilot-Dispatch.html#t:Iterations">Iterations</a> -> <a href="Language-Copilot-Dispatch.html#t:Verbose">Verbose</a> -> <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/local/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:BackEnd">BackEnd</a> <ul class="subs"><li>= <a href="#v:Opts">Opts</a> <a href="Language-Copilot-Dispatch.html#t:AtomToC">AtomToC</a> </li><li>| <a href="#v:Interpreter">Interpreter</a> </li></ul></li><li class="src short"><span class="keyword">data</span> <a href="#t:AtomToC">AtomToC</a> = <a href="#v:AtomToC">AtomToC</a> {<ul class="subs"><li><a href="#v:cName">cName</a> :: <a href="Language-Copilot-Core.html#t:Name">Name</a></li><li><a href="#v:gccOpts">gccOpts</a> :: <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></li><li><a href="#v:getPeriod">getPeriod</a> :: <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Language-Copilot-Core.html#t:Period">Period</a></li><li><a href="#v:interpreted">interpreted</a> :: <a href="Language-Copilot-Dispatch.html#t:Interpreted">Interpreted</a></li><li><a href="#v:outputDir">outputDir</a> :: <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></li><li><a href="#v:compiler">compiler</a> :: <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></li><li><a href="#v:sim">sim</a> :: <a href="Language-Copilot-Language.html#t:Bool">Bool</a></li><li><a href="#v:prePostCode">prePostCode</a> :: (<a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>, <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>)</li><li><a href="#v:arrDecs">arrDecs</a> :: [(<a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>, <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a>)]</li><li><a href="#v:clock">clock</a> :: <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> Clock</li></ul>}</li><li class="src short"><span class="keyword">data</span> <a href="#t:Interpreted">Interpreted</a> <ul class="subs"><li>= <a href="#v:Interpreted">Interpreted</a> </li><li>| <a href="#v:NotInterpreted">NotInterpreted</a> </li></ul></li><li class="src short"><span class="keyword">type</span> <a href="#t:Iterations">Iterations</a> = <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:Verbose">Verbose</a> <ul class="subs"><li>= <a href="#v:OnlyErrors">OnlyErrors</a> </li><li>| <a href="#v:DefaultVerbose">DefaultVerbose</a> </li><li>| <a href="#v:Verbose">Verbose</a> </li></ul></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a name="v:dispatch" class="def">dispatch</a> :: <a href="Language-Copilot-Core.html#t:LangElems">LangElems</a> -> <a href="Language-Copilot-Core.html#t:Vars">Vars</a> -> <a href="Language-Copilot-Dispatch.html#t:BackEnd">BackEnd</a> -> <a href="Language-Copilot-Dispatch.html#t:Iterations">Iterations</a> -> <a href="Language-Copilot-Dispatch.html#t:Verbose">Verbose</a> -> <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/local/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></p><div class="doc"><p>This function is the core of <em>Copilot</em> :
it glues together analyser, interpreter and compiler, and does all the IO.
It can be called either from interface (which justs decodes the command-line argument)
or directly from the interactive prompt in ghci.
<code>streams</code> is a specification,
<code>inputExts</code> allows the user to give at runtime values for
the monitored variables. Useful for testing on randomly generated values and specifications,
or for the interpreted version.
<code>be</code> chooses between compilation or interpretation,
and if compilation is chosen (AtomToC) holds a few additionnal informations.
see description of <code><code><a href="Language-Copilot-Dispatch.html#t:BackEnd">BackEnd</a></code></code>
<code>iterations</code> just gives the number of periods the specification must be executed.
If you would rather execute it by hand, then just choose AtomToC for backEnd and 0 for iterations
<code>verbose</code> determines what is output.
</p></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:BackEnd" class="def">BackEnd</a> </p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:Opts" class="def">Opts</a> <a href="Language-Copilot-Dispatch.html#t:AtomToC">AtomToC</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a name="v:Interpreter" class="def">Interpreter</a></td><td class="doc empty"> </td></tr></table></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:AtomToC" class="def">AtomToC</a> </p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:AtomToC" class="def">AtomToC</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:cName" class="def">cName</a> :: <a href="Language-Copilot-Core.html#t:Name">Name</a></dt><dd class="doc"><p>Name of the C file to generate
</p></dd><dt class="src"><a name="v:gccOpts" class="def">gccOpts</a> :: <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></dt><dd class="doc"><p>Options to pass to the compiler
</p></dd><dt class="src"><a name="v:getPeriod" class="def">getPeriod</a> :: <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Language-Copilot-Core.html#t:Period">Period</a></dt><dd class="doc"><p>The optional period
</p></dd><dt class="src"><a name="v:interpreted" class="def">interpreted</a> :: <a href="Language-Copilot-Dispatch.html#t:Interpreted">Interpreted</a></dt><dd class="doc"><p>Interpret the program or not
</p></dd><dt class="src"><a name="v:outputDir" class="def">outputDir</a> :: <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></dt><dd class="doc"><p>Where to put the executable
</p></dd><dt class="src"><a name="v:compiler" class="def">compiler</a> :: <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a></dt><dd class="doc"><p>Which compiler to use
</p></dd><dt class="src"><a name="v:sim" class="def">sim</a> :: <a href="Language-Copilot-Language.html#t:Bool">Bool</a></dt><dd class="doc"><p>Are we running a C simulator?
</p></dd><dt class="src"><a name="v:prePostCode" class="def">prePostCode</a> :: (<a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>, <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>)</dt><dd class="doc"><p>Code to replace the default
initialization and main
</p></dd><dt class="src"><a name="v:arrDecs" class="def">arrDecs</a> :: [(<a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>, <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a>)]</dt><dd class="doc"><p>When generating C programs to test, we
don't know how large external arrays are, so
we cannot declare them. Passing in pairs
containing the name of the array and it's
size allows them to be declared.
</p></dd><dt class="src"><a name="v:clock" class="def">clock</a> :: <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> Clock</dt><dd class="doc empty"> </dd></dl><div class="clear"></div></div></td></tr></table></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Interpreted" class="def">Interpreted</a> </p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:Interpreted" class="def">Interpreted</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a name="v:NotInterpreted" class="def">NotInterpreted</a></td><td class="doc empty"> </td></tr></table></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:Iterations" class="def">Iterations</a> = <a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Verbose" class="def">Verbose</a> </p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:OnlyErrors" class="def">OnlyErrors</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a name="v:DefaultVerbose" class="def">DefaultVerbose</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a name="v:Verbose" class="def">Verbose</a></td><td class="doc empty"> </td></tr></table></div><div class="subs instances"><p id="control.i:Verbose" class="caption collapser" onclick="toggleSection('i:Verbose')">Instances</p><div id="section.i:Verbose" class="show"><table><tr><td class="src"><a href="/usr/local/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Eq.html#t:Eq">Eq</a> <a href="Language-Copilot-Dispatch.html#t:Verbose">Verbose</a></td><td class="doc empty"> </td></tr></table></div></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.2</p></div></body></html>