Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bd5c3d824c3db63ffd9226c15941e6ad > files > 291

mozart-1.4.0-1mdv2010.0.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>3 Standard Applications</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node2.html#chapter.directives">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node4.html#chapter.api">Next &gt;&gt;</A></TD></TR></TABLE><DIV id="chapter.applications"><H1><A name="chapter.applications">3 Standard Applications</A></H1><P> This chapter defines the standard applications of the compiler available with the Mozart system: the batch compiler, the compiler panel, and its relation to the OPI. </P><H2><A name="label3">3.1 The Batch Compiler</A></H2><P> The batch compiler <CODE>ozc</CODE> provides a command line interface to the compiler for batch compilation. Batch compilation means that expressions (typically functor definitions) are compiled and evaluated, and the resulting value is pickled. </P><DIV class="apropos"><P class="margin">Parameterization</P><P> The command line options of <CODE>ozc</CODE> allow to customize the state of the compiler to use for compilation. Options allow for configuration of the set of defined macro names, to set all compiler switches, and to configure the compilation environment. Pickling can be parameterized to using compression or headers that make the resulting pickle executable. Further options influence the compilation mode: The default, evaluating an expression and pickling the result, can be replaced by evaluation of a statement, or intermediate results of compilation can be dumped. Finally, a special mode allows to compute dependencies (in the form of included source files). </P></DIV><DIV class="apropos"><P class="margin">Reference</P><P> The exact specification of command line options can be found in <A href="../tools/node2.html#chapter.compiler">Chapter&nbsp;2 of ``Oz Shell Utilities''</A>. </P></DIV><H2><A name="label4">3.2 The Compiler Panel</A></H2><P> The Compiler Panel is another application of the compiler. The compiler defines the notion of a <EM>compiler interface</EM> to communicate with the outside world. The compiler panel is one such interface. </P><DIV class="apropos"><P class="margin">Interfaces</P><P> A compiler interface received notification about the state of the compiler. This includes its compilation state, but also its state of execution (how it manages its query queue, what errors it reports, and whether a compilation succeeds). <A href="node4.html#chapter.api">Chapter&nbsp;4</A> describes how the API allows to define interfaces. </P></DIV><DIV class="apropos"><P class="margin">The Panel</P><P> The compiler panel is a compiler interface that provides a graphical display of the compiler's state. Its toplevel window has a menu that allows to enqueue further compilation tasks and to configure how the the compiler's state is displayed. Furthermore, it features a set of notebook tabs for the different parts of its state. </P></DIV><DIV class="apropos"><P class="margin">Tabs</P><P> The <CODE>Messages</CODE> tab provides access to a text display of compilation phase tracking, and the warnings and errors reported. The <CODE>Environment</CODE> tab displays all variables in the compilation environment. Each identifier can be clicked to execute an action on its value; for instance, values can be shown or inspected. The set of actions is configurable. The <CODE>Switches</CODE> tab displays the settings of every compiler switch and option. Finally, the <CODE>Query Queue</CODE> tab displays the list of queries the compiler currently executes. </P></DIV><DIV class="unnumbered"><H3><A name="label5">The Compiler Panel API</A></H3><P> Like all tools, the compiler panel has an API to enable applications to control it. The module <CODE>CompilerPanel</CODE>, located at <CODE>x-oz://system/CompilerPanel</CODE>, exports a class <CODE>CompilerPanel<SPAN class="keyword">.</SPAN><SPAN class="string">'class'</SPAN></CODE> implementing the <CODE>Listener</CODE> interface, with the following methods. </P><DL><DT><CODE>init</CODE> <A name="label7"></A> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>init(</CODE><CODE>+<I>CompilerObject</I></CODE><CODE>&nbsp;</CODE><CODE>+<I>IconifiedB</I></CODE><CODE>&nbsp;<SPAN class="keyword">&lt;=</SPAN>&nbsp;<SPAN class="keyword">false</SPAN>)</CODE> </P></BLOCKQUOTE></DD><DD><P>initializes a new instance of a compiler panel, associated with the compiler <CODE><I>CompilerObject</I></CODE>. If <CODE><I>IconifiedB</I></CODE> is <CODE><SPAN class="keyword">true</SPAN></CODE>, it is started with its toplevel window retracted. </P></DD><DT><CODE>close</CODE> <A name="label9"></A> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>close()</CODE> </P></BLOCKQUOTE></DD><DD><P>closes a compiler panel instance, also closing its window. </P></DD><DT><CODE>enqueue</CODE> <A name="label11"></A> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>enqueue(</CODE><CODE>+<I>Message</I></CODE><CODE>)</CODE> </P></BLOCKQUOTE></DD><DD><P>enqueues a query to the compiler associated with the compiler panel instance. See <A href="node4.html#chapter.api">Chapter&nbsp;4</A> for a specification of the values <CODE><I>Message</I></CODE> can take. </P></DD><DT><CODE>addAction</CODE> <A name="label13"></A> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>addAction(</CODE><CODE>+<I>NameV</I></CODE><CODE>&nbsp;</CODE><CODE>+<I>ActionP</I></CODE><CODE>)</CODE> </P></BLOCKQUOTE></DD><DD><P>adds an action to the menu of actions that can be performed on values in the environment. <CODE><I>NameV</I></CODE> is the name of the action as displayed in the menu while <CODE><I>ActionP</I></CODE> is a unary procedure which will be passed the value when invoked. </P></DD></DL><P> </P></DIV><H2><A name="label14">3.3 The Oz Programming Interface</A></H2><P> The OPI (see <A href="../opi/index.html">``The Oz Programming Interface''</A>) runs a dedicated compiler instance which receives all queries generated by feeding code in the OPI by default. It is available as <CODE>OPI<SPAN class="keyword">.</SPAN>compiler</CODE>.</P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node2.html#chapter.directives">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node4.html#chapter.api">Next &gt;&gt;</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~kornstae/">Leif&nbsp;Kornstaedt</A><BR><SPAN class="version">Version 1.4.0 (20090610)</SPAN></ADDRESS></BODY></HTML>