Sophie

Sophie

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

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

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>2 Invoking the OPI</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="node1.html#chapter.intro">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node3.html#chapter.editing">Next &gt;&gt;</A></TD></TR></TABLE><DIV id="chapter.start"><H1><A name="chapter.start">2 Invoking the OPI</A></H1><P> This chapter describes how to invoke the OPI, i.&nbsp;e., how to access its functionality. </P><H2><A name="label7">2.1 Invoking the OPI in the Unix Environment</A></H2><P> <A name="label8"></A> <A name="label9"></A> The easiest way to start the OPI is to type the following command at the shell prompt<A href="node2.html#label57"><SUP>1</SUP></A>: </P><BLOCKQUOTE class="code"><CODE>%&nbsp;oz&nbsp;</CODE>&lt;<I>emacs args</I>&gt;</BLOCKQUOTE><P> After setting up the necessary environment variables, this starts up an Emacs process, passing to it all arguments given on the command line, creates a new buffer named <SPAN class="buffer">Oz</SPAN>, and starts a Mozart sub-process. </P><DIV class="apropos"><P class="margin">Which Emacs to Use</P><P> <A name="label10"></A><A name="label11"></A> <A name="label12"></A><A name="label13"></A> The command used to invoke Emacs is determined through the following steps: </P><OL type="1"><LI><P>If the environment variable <A name="label14"></A><A name="label15"></A><CODE>OZEMACS</CODE> is set, its contents is used. </P></LI><LI><P>Else, if a command named <CODE>emacs</CODE> is found in the <A name="label16"></A><A name="label17"></A><CODE>PATH</CODE>, this is used. </P></LI><LI><P>Else, if a command named <CODE>xemacs</CODE> is found in the <A name="label18"></A><A name="label19"></A><CODE>PATH</CODE>, this is used. </P></LI><LI><P>Else, if a command named <CODE>lemacs</CODE> is found in the <A name="label20"></A><A name="label21"></A><CODE>PATH</CODE>, this is used. </P></LI></OL><P> </P></DIV><H2><A name="label22">2.2 Invoking the OPI Under Windows</A></H2><P> <A name="label23"></A> The installation procedure will have created a <A name="label24"></A><SPAN class="index">program group</SPAN> for the Mozart system. The OPI is started by launching the <SPAN class="program">Mozart</SPAN> item. This item is a shortcut to the <CODE>oz.exe</CODE> program within the <CODE>bin</CODE> subfolder of the installation folder; as under Unix, any arguments given to it are passed on to the invoked Emacs. </P><DIV class="apropos"><P class="margin">Which Emacs to Use</P><P> <A name="label25"></A><A name="label26"></A> <A name="label27"></A><A name="label28"></A> The command used to invoke Emacs is determined through the following steps: </P><OL type="1"><LI><P>If the environment variable <A name="label29"></A><A name="label30"></A><CODE>OZEMACS</CODE> is set, its contents is used. </P></LI><LI><P>Else, if the registry indicates where GNU Emacs is installed, this is used. </P></LI><LI><P>Else, if the registry indicates where XEmacs is installed, this is used. </P></LI></OL><P> </P></DIV><H2><A name="label31">2.3 Invoking the OPI From Within Emacs</A></H2><P> You can also configure your Emacs so that you can use all of the OPI's functionality without using the <CODE>oz</CODE> script. Here's what you would typically add to your <A name="label32"></A>Emacs startup file (usually called <CODE>~/.emacs</CODE> under Unix and <CODE>C:\_emacs</CODE> under <A name="label33"></A><SPAN class="index">Windows</SPAN>&nbsp;95; under Windows&nbsp;NT, it is located in your home directory): </P><BLOCKQUOTE><PRE>(or&nbsp;(getenv&nbsp;<SPAN class="string">&quot;OZHOME&quot;</SPAN>)<BR>&nbsp;&nbsp;&nbsp;&nbsp;(setenv&nbsp;<SPAN class="string">&quot;OZHOME&quot;</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="string">&quot;/usr/local/oz&quot;</SPAN>))&nbsp;&nbsp;&nbsp;;&nbsp;<SPAN class="comment">or&nbsp;wherever&nbsp;Mozart&nbsp;is&nbsp;installed<BR></SPAN>(setenv&nbsp;<SPAN class="string">&quot;PATH&quot;</SPAN>&nbsp;(concat&nbsp;(getenv&nbsp;<SPAN class="string">&quot;OZHOME&quot;</SPAN>)&nbsp;<SPAN class="string">&quot;/bin:&quot;</SPAN>&nbsp;(getenv&nbsp;<SPAN class="string">&quot;PATH&quot;</SPAN>)))<BR>&nbsp;<BR>(<SPAN class="keyword">setq</SPAN>&nbsp;<SPAN class="variablename">load-path</SPAN>&nbsp;(cons&nbsp;(concat&nbsp;(getenv&nbsp;<SPAN class="string">&quot;OZHOME&quot;</SPAN>)&nbsp;<SPAN class="string">&quot;/share/elisp&quot;</SPAN>)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;load-path))<BR>&nbsp;<BR>(<SPAN class="keyword">setq</SPAN>&nbsp;<SPAN class="variablename">auto-mode-alist</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(append&nbsp;'((<SPAN class="string">&quot;\\.oz\\'&quot;</SPAN>&nbsp;.&nbsp;oz-mode)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<SPAN class="string">&quot;\\.ozg\\'&quot;</SPAN>&nbsp;.&nbsp;oz-gump-mode))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;auto-mode-alist))<BR>&nbsp;<BR>(autoload&nbsp;'run-oz&nbsp;<SPAN class="string">&quot;oz&quot;</SPAN>&nbsp;&quot;&quot;&nbsp;t)<BR>(autoload&nbsp;'oz-mode&nbsp;<SPAN class="string">&quot;oz&quot;</SPAN>&nbsp;&quot;&quot;&nbsp;t)<BR>(autoload&nbsp;'oz-gump-mode&nbsp;<SPAN class="string">&quot;oz&quot;</SPAN>&nbsp;&quot;&quot;&nbsp;t)<BR>(autoload&nbsp;'oz-new-buffer&nbsp;<SPAN class="string">&quot;oz&quot;</SPAN>&nbsp;&quot;&quot;&nbsp;t)<BR></PRE></BLOCKQUOTE><P> Don't worry if you don't understand all of this (yet). </P><H2><A name="label34">2.4 The Oz Major Modes</A></H2><P> All of the OPI's functions are accessible in the following two major modes: </P><DL><DT class="command"><A name="label35"></A><SPAN class="index"><CODE>oz-mode</CODE></SPAN> <SPAN class="entrycategory"><SPAN class="entrycategorybracket">&nbsp;[</SPAN><I>command</I><SPAN class="entrycategorybracket">]</SPAN></SPAN></DT><DD><P>This is the major mode for editing Oz code. Loading a file with extension <CODE>.oz</CODE> automatically puts a buffer into Oz mode. You can tell a buffer is in Oz mode by the string <CODE>Oz</CODE> in its <A name="label36"></A><SPAN class="index">mode line</SPAN>. </P></DD><DT class="command"><A name="label37"></A><SPAN class="index"><CODE>oz-gump-mode</CODE></SPAN> <SPAN class="entrycategory"><SPAN class="entrycategorybracket">&nbsp;[</SPAN><I>command</I><SPAN class="entrycategorybracket">]</SPAN></SPAN></DT><DD><P>This is the major mode for editing Oz code with embedded Gump specifications (see <A href="../gump/index.html">``Gump - A Front-End Generator for Oz''</A>). Loading a file with extension <CODE>.ozg</CODE> automatically puts a buffer in Oz-Gump mode. You can tell a buffer is in Oz-Gump mode by the string <CODE>Oz-Gump</CODE> in its mode line. </P></DD></DL><P> </P><DIV class="apropos"><P class="margin">Oz Mode Hook</P><P> To both of these, the following <A name="label38"></A><SPAN class="index">hook</SPAN> applies. </P><DL><DT class="useroption"><A name="label39"></A><SPAN class="index"><CODE>oz-mode-hook</CODE></SPAN> <SPAN class="entrycategory"><SPAN class="entrycategorybracket">&nbsp;[</SPAN><I>user option</I><SPAN class="entrycategorybracket">]</SPAN></SPAN></DT><DD><P>A list of functions to be run when one of the Oz modes is activated. These functions are applied without arguments. Change using Emacs functions <A name="label40"></A><SPAN class="index"><CODE>add-hook</CODE></SPAN> and <A name="label41"></A><SPAN class="index"><CODE>remove-hook</CODE></SPAN>. </P></DD></DL><P> </P></DIV><H2><A name="label42">2.5 Inspecting the OPI's Commands and User Options</A></H2><DIV class="apropos"><P class="margin">The Oz Menu</P><P> The Oz major modes add a <A name="label43"></A><SPAN class="index">menu</SPAN> called <CODE>Oz</CODE> to the menu bar (see <A href="node2.html#figure.menu">Figure&nbsp;2.1</A>); this <A name="label44"></A>menu is also accessible by pressing the right mouse button in an Oz buffer. Many of the commands described in the next chapters are accessible through this menu.  </P></DIV><DIV class="apropos"><P class="margin">Emacs Conventions</P><P> <A name="label45"></A> The Oz modes conform to the following Emacs conventions: </P><UL><LI><P>Nearly all functions and variables start with <CODE>oz-</CODE>... </P></LI><LI><P>If the <A name="label46"></A><SPAN class="index">documentation string</SPAN> of a variable starts with an asterisk, then its value is meant for the user to modify at will (a so-called <A name="label47"></A><EM>user option</EM>). The documentation string of a variable can be inspected with <A name="label48"></A><SPAN class="key">M-x describe-variable</SPAN> (<SPAN class="key">C-h v</SPAN>). </P></LI><LI><P>If a function has a documentation string, then it is meant for the user to use directly if she so wishes. Inspect the documentation string of a function with <A name="label49"></A><SPAN class="key">M-x describe-function</SPAN> (<SPAN class="key">C-h f</SPAN>); if a command is bound to a key, you can examine its documentation string with <A name="label50"></A><A name="label51"></A><SPAN class="key">M-x describe-key</SPAN> (<SPAN class="key">C-h k</SPAN>). </P></LI><LI><P>The OPI provides the feature <SPAN class="ignore"><CODE>(<SPAN class="keyword">provide</SPAN>&nbsp;'</CODE></SPAN><CODE><SPAN class="reference">oz</SPAN></CODE><SPAN class="ignore"><CODE>)</CODE></SPAN>. See Emacs' <SPAN class="ignore"><CODE>(</CODE></SPAN><CODE><SPAN class="keyword">require</SPAN></CODE> function for more details. </P></LI></UL><P> </P></DIV><DIV class="apropos"><P class="margin">Customization</P><P> New Emacsen offer a feature called <A name="label52"></A><EM>customization</EM>, which serves the purpose of setting the user options pertaining to a mode in a structured way. You can access this feature by <SPAN class="key">M-x customize</SPAN>; look at the group <SPAN class="buffer">Programming</SPAN>/<SPAN class="buffer">Languages</SPAN>/<SPAN class="buffer">Oz</SPAN>. You can also access this group directly via <SPAN class="key">M-x customize-group RET oz</SPAN>. </P></DIV><DIV class="apropos"><P class="margin">Key Bindings</P><P> A short description of the current major mode and its <A name="label53"></A>key bindings can be obtained through Emacs' <A name="label54"></A><SPAN class="key">M-x describe-mode</SPAN> (<SPAN class="key">C-h m</SPAN>). In this manual, the key sequences a command is bound to by default will always be shown in parenthesis following the command name. </P><DL><DT class="useroption"><A name="label55"></A><SPAN class="index"><CODE>oz-mode-map</CODE></SPAN> <SPAN class="entrycategory"><SPAN class="entrycategorybracket">&nbsp;[</SPAN><I>user option</I><SPAN class="entrycategorybracket">]</SPAN></SPAN></DT><DD><P><A name="label56"></A>Keymap used in the Oz modes. </P></DD></DL><P> Generally, Oz-specific commands are made available both with <SPAN class="key">C-.</SPAN> and <SPAN class="key">C-c .</SPAN> as prefix. This manual always lists only the first of these. However, some terminals may not be able to generate <SPAN class="key">C-.</SPAN>; this is why the second one is provided. </P></DIV></DIV><DIV class="maxi" id="figure.menu"><TABLE width="100%"><TR><TD><HR><P><A name="figure.menu"></A></P><P> </P><DIV align="center"><IMG alt="" src="menu.gif" id="menu.gif"></DIV><P> </P><P class="caption"><STRONG>Figure&nbsp;2.1:</STRONG> The Oz Menu.</P><HR></TD></TR></TABLE></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node1.html#chapter.intro">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node3.html#chapter.editing">Next &gt;&gt;</A></TD></TR></TABLE><HR align="left" width="30%"><DIV class="footnote"><A name="label57">1. </A>The percent sign (<CODE>%</CODE>) represents the shell prompt; it is not part of the command.</DIV><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~kornstae/">Leif&nbsp;Kornstaedt</A> and&nbsp;<A href="http://www.ps.uni-sb.de/~duchier/">Denys&nbsp;Duchier</A><BR><SPAN class="version">Version 1.4.0 (20090610)</SPAN></ADDRESS></BODY></HTML>