Sophie

Sophie

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

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

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>5 API Reference</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="node4.html#chapter.gui">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD></TR></TABLE><DIV id="chapter.configure"><H1><A name="chapter.configure">5 API Reference</A></H1><P> The Inspector functor is available for import at the URI <CODE><SPAN class="string">'x-oz://system/Inspector'</SPAN></CODE>. It exports the following application programmer's interface: </P><DL><DT><CODE>inspect</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Inspector<SPAN class="keyword">.</SPAN>inspect&nbsp;</CODE><CODE><I>X</I></CODE><CODE>}</CODE> </P></BLOCKQUOTE></DD><DD><P>opens a new Inspector window if none exists, then displays <CODE><I>X</I></CODE> in the active widget. </P></DD><DT><CODE>inspectN</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Inspector<SPAN class="keyword">.</SPAN>inspectN&nbsp;</CODE><CODE>+<I>I</I></CODE><CODE>&nbsp;</CODE><CODE><I>X</I></CODE><CODE>}</CODE> </P></BLOCKQUOTE></DD><DD><P>opens a new Inspector window if none exists, then displays <CODE><I>X</I></CODE> in the widget with number&nbsp;<CODE><I>I</I></CODE>, counting from zero. Note that the chosen widget must have been created already. This is always the case for number zero. </P></DD><DT><CODE>configure</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Inspector<SPAN class="keyword">.</SPAN>configure&nbsp;</CODE><CODE>+<I>Key</I></CODE><CODE>&nbsp;</CODE><CODE>+<I>Value</I></CODE><CODE>}</CODE> </P></BLOCKQUOTE></DD><DD><P>sets the configuration option with key&nbsp;<CODE><I>Key</I></CODE> to value&nbsp;<CODE><I>Value</I></CODE>. The following sections starting with <A href="node5.html#section.configure.inspector">Section&nbsp;5.2</A> explain in detail which keys and values are valid parameters. </P></DD><DT><CODE>configureN</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Inspector<SPAN class="keyword">.</SPAN>configureN&nbsp;</CODE><CODE>+<I>I</I></CODE><CODE>&nbsp;</CODE><CODE>+<I>Key</I></CODE><CODE>&nbsp;</CODE><CODE><I>X</I></CODE><CODE>}</CODE> </P></BLOCKQUOTE></DD><DD><P>behaves like <CODE>configure</CODE> but directly addresses the widget number&nbsp;<CODE><I>I</I></CODE> which must be existing already. </P></DD><DT><CODE>close</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Inspector<SPAN class="keyword">.</SPAN>close}</CODE> </P></BLOCKQUOTE></DD><DD><P>closes the Inspector window, if any. </P></DD><DT><CODE><SPAN class="string">'class'</SPAN></CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>Inspector<SPAN class="keyword">.</SPAN>new&nbsp;</CODE><CODE>+<I>OptionRecord</I></CODE> </P></BLOCKQUOTE></DD><DD><P>creates are new Inspector instance. This function replaces the old class field for safety reasons. Extensions are still possible by using adapter construction. This object is concurrency safe and can be used in any space.&nbsp;<CODE>+<I>OptionRecord</I></CODE> denotes a record containing user options, with <CODE><SPAN class="keyword">unit</SPAN></CODE> the empty case. Of course, all features must denote a valid option. </P></DD><DT><CODE>object</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>Inspector<SPAN class="keyword">.</SPAN>object</CODE> </P></BLOCKQUOTE></DD><DD><P>is the default instance of the Inspector and is implicitly used by <CODE>Inspect</CODE>, <CODE>Inspector<SPAN class="keyword">.</SPAN>inspectN</CODE>, <CODE>Inspector<SPAN class="keyword">.</SPAN>configure</CODE>, <CODE>Inspector<SPAN class="keyword">.</SPAN>configureN</CODE> and <CODE>Inspector<SPAN class="keyword">.</SPAN>close</CODE>. This object is creating using the above <CODE>Inspector<SPAN class="keyword">.</SPAN>new</CODE> function. </P></DD><DT><CODE>reflect</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>Inspector<SPAN class="keyword">.</SPAN>reflect</CODE> </P></BLOCKQUOTE></DD><DD><P>exports the reflection function used by the inspector to reflect deep space values. Use at your own risk. </P></DD><DT><CODE>reflect</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>Inspector<SPAN class="keyword">.</SPAN>unreflect</CODE> </P></BLOCKQUOTE></DD><DD><P>exports the unreflection function used by the inspector. Use at your own risk. </P></DD></DL><P> </P><DIV id="section.configure.methods"><H2><A name="section.configure.methods">5.1 Inspector object methods</A></H2><P> The inspector object provides the methods shown below. </P><DL><DT><CODE>inspect(</CODE><CODE><I>X</I></CODE><CODE>)</CODE> </DT><DD><P>inspects the value <CODE><I>X</I></CODE>. </P></DD><DT><CODE>inspectN(</CODE><CODE>+<I>N</I></CODE><CODE>&nbsp;</CODE><CODE><I>X</I></CODE><CODE>)</CODE> </DT><DD><P>inspects the value denoted by <CODE><I>X</I></CODE> using widget number <CODE><I>N</I></CODE>. Keep in mind then the corresponding widget must have been created already. </P></DD><DT><CODE>configureEntry(</CODE><CODE>+<I>Key</I></CODE><CODE>&nbsp;</CODE><CODE>+<I>Value</I></CODE><CODE>)</CODE> </DT><DD><P>tells the inspector to update the option denoted by <CODE><I>Key</I></CODE> with value <CODE><I>Value</I></CODE>. </P></DD><DT><CODE>close</CODE> </DT><DD><P>closes and unmaps the inspector object. </P></DD></DL><P> </P><P> </P></DIV><DIV id="section.configure.inspector"><H2><A name="section.configure.inspector">5.2 Inspector Options</A></H2><P> This section covers global Inspector options. </P><DL><DT><CODE>inspectorWidth</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Inspector<SPAN class="keyword">.</SPAN>configure&nbsp;inspectorWidth&nbsp;</CODE><CODE>+<I>I</I></CODE><CODE>}</CODE> </P></BLOCKQUOTE></DD><DD><P>adjusts the Inspector's horizontal window dimension to <CODE><I>I</I></CODE>&nbsp;pixels. Defaults to 600. </P></DD><DT><CODE>inspectorDepth</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Inspector<SPAN class="keyword">.</SPAN>configure&nbsp;inspectorDepth&nbsp;</CODE><CODE>+<I>I</I></CODE><CODE>}</CODE> </P></BLOCKQUOTE></DD><DD><P>adjusts the Inspector's vertical window dimension to <CODE><I>I</I></CODE>&nbsp;pixels. Defaults to 400. </P></DD><DT><CODE>inspectorOptionsRange</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Inspector<SPAN class="keyword">.</SPAN>configure&nbsp;inspectorOptionsRange&nbsp;</CODE><CODE>+<I>A</I></CODE><CODE>}</CODE> </P></BLOCKQUOTE></DD><DD><P>determines which widgets will be affected by reconfiguration. <CODE><I>A</I></CODE> can be either <CODE><SPAN class="string">'active'</SPAN></CODE> or <CODE><SPAN class="string">'all'</SPAN></CODE>, with the obvious meaning. </P></DD></DL><P> </P></DIV><DIV id="section.configure.representation"><H2><A name="section.configure.representation">5.3 Value Represenation</A></H2><P> This section explains how to configure the value representation using the API. </P><DL><DT><CODE>widgetTreeWidth</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Inspector<SPAN class="keyword">.</SPAN>configure&nbsp;widgetTreeWidth&nbsp;</CODE><CODE>+<I>I</I></CODE><CODE>}</CODE> </P></BLOCKQUOTE></DD><DD><P>adjusts the global width traversal limit to&nbsp;<CODE><I>I</I></CODE>. Defaults to 50. </P></DD><DT><CODE>widgetTreeDepth</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Inspector<SPAN class="keyword">.</SPAN>configure&nbsp;widgetTreeDepth&nbsp;</CODE><CODE>+<I>I</I></CODE><CODE>}</CODE> </P></BLOCKQUOTE></DD><DD><P>adjusts the global depth traversal limit to&nbsp;<CODE><I>I</I></CODE>. Defaults to 15. </P></DD><DT><CODE>widgetTreeDisplayMode</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Inspector<SPAN class="keyword">.</SPAN>configure&nbsp;widgetTreeDisplayMode&nbsp;</CODE><CODE>+<I>B</I></CODE><CODE>}</CODE> </P></BLOCKQUOTE></DD><DD><P>switches between tree and graph representation, depending on whether&nbsp;<CODE><I>B</I></CODE> denotes <CODE><SPAN class="keyword">true</SPAN></CODE> or <CODE><SPAN class="keyword">false</SPAN></CODE>, respectively. </P></DD><DT><CODE>widgetUseNodeSet</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Inspector<SPAN class="keyword">.</SPAN>configure&nbsp;widgetUseNodeSet&nbsp;</CODE><CODE>+<I>I</I></CODE><CODE>}</CODE> </P></BLOCKQUOTE></DD><DD><P>determines the subtree alignment. If <CODE><I>I</I></CODE> is&nbsp;<CODE>1</CODE>, the standard aligment is used. A value of&nbsp;<CODE>2</CODE> selects fixed width indentation. </P></DD><DT><CODE>widgetShowStrings</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Inspector<SPAN class="keyword">.</SPAN>configure&nbsp;widgetShowStrings&nbsp;</CODE><CODE>+<I>B</I></CODE><CODE>}</CODE> </P></BLOCKQUOTE></DD><DD><P>switches between normal and readable representation of strings. It defaults to <CODE><SPAN class="keyword">false</SPAN></CODE>. </P></DD></DL><P> </P></DIV><DIV id="section.configure.visual"><H2><A name="section.configure.visual">5.4 Visual Settings</A></H2><P> This section explains how to configure the visual aspects of node drawing using the API. </P><DL><DT><CODE>widgetTreeFont</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Inspector<SPAN class="keyword">.</SPAN>configure&nbsp;widgetTreeFont&nbsp;font(family:</CODE><CODE>+<I>F</I></CODE><CODE>&nbsp;size:</CODE><CODE>+<I>S</I></CODE><CODE>&nbsp;weight:</CODE><CODE>+<I>W</I></CODE><CODE>)}</CODE> </P></BLOCKQUOTE></DD><DD><P>selects the widget font as follows: </P><UL><LI><P><CODE>+<I>F</I></CODE> denotes either <CODE><SPAN class="string">'courier'</SPAN></CODE> or <CODE><SPAN class="string">'helvetica'</SPAN></CODE>. </P></LI><LI><P><CODE>+<I>S</I></CODE> denotes any integer out of <CODE>{10<SPAN class="keyword">,</SPAN>&nbsp;12<SPAN class="keyword">,</SPAN>&nbsp;14<SPAN class="keyword">,</SPAN>&nbsp;18<SPAN class="keyword">,</SPAN>&nbsp;24}</CODE>. </P></LI><LI><P><CODE>+<I>W</I></CODE> denotes either <CODE><SPAN class="string">'normal'</SPAN></CODE> or <CODE><SPAN class="string">'bold'</SPAN></CODE>. </P></LI></UL><P> The default is <CODE>font(family:<SPAN class="string">'courier'</SPAN>&nbsp;size:12&nbsp;weight:<SPAN class="string">'normal'</SPAN>)</CODE>. </P></DD><DT><CODE>widgetContextMenuFont</CODE> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Inspector<SPAN class="keyword">.</SPAN>configure&nbsp;widgetContextMenuFont&nbsp;</CODE><CODE>+<I>V</I></CODE><CODE>)}</CODE> </P></BLOCKQUOTE></DD><DD><P>selects the font used to draw the context menus. <CODE><I>V</I></CODE> denotes any valid X font description. It defaults to <CODE><SPAN class="string">'-adobe-helvetica-bold-r-*-*-*-100-*'</SPAN></CODE>. </P></DD></DL><P> </P><DIV id="section.configure.colors"><H3><A name="section.configure.colors">5.4.1 Color Assignment</A></H3><P> </P><DL><DT><CODE>{Inspector<SPAN class="keyword">.</SPAN>configure&nbsp;</CODE><CODE>+<I>A</I></CODE><CODE>&nbsp;</CODE><CODE>+<I>Color</I></CODE><CODE>)}</CODE> </DT><DD><P>assigns color&nbsp;<CODE><I>Color</I></CODE> to item type &nbsp;<CODE><I>A</I></CODE>. <CODE><I>Color</I></CODE> denotes an atom describing any valid hexadecimal RGB color code. <CODE><I>A</I></CODE> is composed of a type prefix and a 'Color' suffix. For example, </P><BLOCKQUOTE class="code"><CODE>{Inspector<SPAN class="keyword">.</SPAN>configure&nbsp;intColor&nbsp;<SPAN class="string">'#AAFF11'</SPAN>}</CODE></BLOCKQUOTE><P> </P><P> chooses to draw integer nodes with color <CODE><SPAN class="string">'#AAFF11'</SPAN></CODE>. The complete list of known types is shown in table <A href="node5.html#figure.types">Figure&nbsp;5.1</A>. </P><DIV id="figure.types"><HR><P><A name="figure.types"></A></P><TABLE align="center" bgcolor="#f0f0e0"><TR valign="top"><TD><P><CODE>int</CODE></P></TD><TD><P><CODE>float</CODE></P></TD><TD><P><CODE>atom</CODE></P></TD></TR><TR valign="top"><TD><P><CODE>bool</CODE></P></TD><TD><P><CODE><SPAN class="keyword">unit</SPAN></CODE></P></TD><TD><P><CODE>name</CODE></P></TD></TR><TR valign="top"><TD><P><CODE>bytestring</CODE></P></TD><TD><P><CODE>procedure</CODE></P></TD><TD><P><CODE>future</CODE></P></TD></TR><TR valign="top"><TD><P><CODE>free</CODE></P></TD><TD colspan="2"><P>Oz variables</P></TD></TR><TR valign="top"><TD><P><CODE>fdint</CODE></P></TD><TD colspan="2"><P>Oz finite domain variables</P></TD></TR><TR valign="top"><TD><P><CODE>label</CODE></P></TD><TD colspan="2"><P>record/tuple labels</P></TD></TR><TR valign="top"><TD><P><CODE>feature</CODE></P></TD><TD colspan="2"><P>record features</P></TD></TR><TR valign="top"><TD><P><CODE>background</CODE></P></TD><TD colspan="2"><P>widget backround</P></TD></TR><TR valign="top"><TD><P><CODE>variableref</CODE></P></TD><TD colspan="2"><P>using occurence of graph reference</P></TD></TR><TR valign="top"><TD><P><CODE>ref</CODE></P></TD><TD colspan="2"><P>defining occurence of graph reference</P></TD></TR><TR valign="top"><TD><P><CODE>generic</CODE></P></TD><TD colspan="2"><P>the generic value</P></TD></TR><TR valign="top"><TD><P><CODE>braces</CODE></P></TD><TD colspan="2"><P>parentheses around mixfix tuples</P></TD></TR><TR valign="top"><TD><P><CODE>colon</CODE></P></TD><TD colspan="2"><P>separator between feature and subtree</P></TD></TR><TR valign="top"><TD><P><CODE>widthbitmap</CODE></P></TD><TD colspan="2"><P>left arrow</P></TD></TR><TR valign="top"><TD><P><CODE>depthbitmap</CODE></P></TD><TD colspan="2"><P>down arrow</P></TD></TR><TR valign="top"><TD><P><CODE>separator</CODE></P></TD><TD colspan="2"><P>separators such as <CODE><SPAN class="keyword">#</SPAN></CODE> and <CODE><SPAN class="keyword">|</SPAN></CODE></P></TD></TR><TR valign="top"><TD><P><CODE>proxy</CODE></P></TD><TD colspan="2"><P>background color used for mappings</P></TD></TR><TR valign="top"><TD><P><CODE>selection</CODE></P></TD><TD colspan="2"><P>background color used for selections</P></TD></TR></TABLE><P class="caption"><STRONG>Figure&nbsp;5.1:</STRONG> Known atomic types</P><HR></DIV><P> </P></DD></DL><P> </P></DIV></DIV><DIV id="section.configure.menus"><H2><A name="section.configure.menus">5.5 Customizing Context Menus</A></H2><P> This sections explains how to create context menus. The current implementation only allows to attach entire context menus to a node. A context menu simply is a tuple <CODE>menu(WidthList&nbsp;DepthList&nbsp;MappingList&nbsp;ActionList)</CODE> as follows: </P><UL><LI><P><CODE>WidthList</CODE> and <CODE>DepthList</CODE> denote integer lists describing the possible limit changes. The integer zero serves as separator indicator. Both lists default to <CODE>[1&nbsp;5&nbsp;10&nbsp;0&nbsp;<SPAN class="keyword">~</SPAN>1&nbsp;<SPAN class="keyword">~</SPAN>5&nbsp;<SPAN class="keyword">~</SPAN>10]</CODE>. </P></LI><LI><P><CODE>MappingList</CODE> denotes a list of tuples following the pattern <CODE><SPAN class="string">'Shown&nbsp;Label'</SPAN>(MapFun)</CODE>. See <A href="node5.html#section.configure.mappings">Section&nbsp;5.5.2</A> for details about writing mappings. </P><P> If the function should be used for auto-mapping, use&nbsp;<CODE>auto(<SPAN class="string">'Shown&nbsp;Label'</SPAN>(MapFun))</CODE> instead. Each list must not contain more than one auto mapping entry. </P></LI><LI><P><CODE>ActionList</CODE> denotes a list of tuples following the pattern <CODE><SPAN class="string">'Shown&nbsp;Label'</SPAN>(ActionProc)</CODE>. See <A href="node5.html#section.configure.actions">Section&nbsp;5.5.3</A> for details about writing actions. </P></LI></UL><P> </P><DIV id="section.configure.register"><H3><A name="section.configure.register">5.5.1 Registering context menus</A></H3><P> Context menus are registered using the statement </P><BLOCKQUOTE class="code"><CODE>{Inspector<SPAN class="keyword">.</SPAN>configure&nbsp;</CODE><CODE>+<I>Type</I></CODE><CODE>&nbsp;</CODE><CODE>+<I>Menu</I></CODE><CODE>}</CODE></BLOCKQUOTE><P> </P><P> where <CODE><I>Type</I></CODE> denotes an atom composed of a valid type prefix as shown in <A href="node5.html#figure.prefixes">Figure&nbsp;5.2</A> and a <CODE>Menu</CODE> suffix. <CODE><I>Menu</I></CODE> denotes the menu as described in <A href="node5.html#section.configure.menus">Section&nbsp;5.5</A>. </P><DIV id="figure.prefixes"><HR><P><A name="figure.prefixes"></A></P><TABLE align="center" bgcolor="#f0f0e0"><TR valign="top"><TD><P><CODE>hashtuple</CODE></P></TD><TD><P>Tuples with label <CODE><SPAN class="keyword">#</SPAN></CODE></P></TD></TR><TR valign="top"><TD><P><CODE>pipetuple</CODE></P></TD><TD><P>Possible open lists such as streams</P></TD></TR><TR valign="top"><TD><P><CODE>list</CODE></P></TD><TD><P>Closed lists</P></TD></TR><TR valign="top"><TD><P>labeltuple</P></TD><TD><P>Tuple with any other label</P></TD></TR><TR valign="top"><TD><P>record</P></TD><TD><P>Oz Records (without kinded reocrds)</P></TD></TR><TR valign="top"><TD><P>kindedrecord</P></TD><TD><P>Feature constraints</P></TD></TR><TR valign="top"><TD><P>future</P></TD><TD><P>Futures</P></TD></TR><TR valign="top"><TD><P>free</P></TD><TD><P>Variables</P></TD></TR><TR valign="top"><TD><P>fdint</P></TD><TD><P>Finite domain variables</P></TD></TR><TR valign="top"><TD><P>fset</P></TD><TD><P>Finite set menus</P></TD></TR><TR valign="top"><TD><P>array</P></TD><TD><P>Oz arrays</P></TD></TR><TR valign="top"><TD><P>dictionary</P></TD><TD><P>Oz dictionaries</P></TD></TR><TR valign="top"><TD><P>class</P></TD><TD><P>Oz classes</P></TD></TR><TR valign="top"><TD><P>object</P></TD><TD><P>Oz objects</P></TD></TR><TR valign="top"><TD><P>chunk</P></TD><TD><P>Oz chunks</P></TD></TR><TR valign="top"><TD><P>cell</P></TD><TD><P>Oz cell</P></TD></TR></TABLE><P class="caption"><STRONG>Figure&nbsp;5.2:</STRONG> Menu types</P><HR></DIV><P> </P><P> For example, executing </P><BLOCKQUOTE class="code"><CODE>{Inspector<SPAN class="keyword">.</SPAN>configure&nbsp;recordMenu&nbsp;Menu}</CODE></BLOCKQUOTE><P> </P><P> assigns a new record context menu denoted by <CODE><I>Menu</I></CODE>. </P></DIV><DIV id="section.configure.mappings"><H3><A name="section.configure.mappings">5.5.2 Mapping Functions</A></H3><P> Writing mapping functions is easy: Every function follows the pattern below. </P><BLOCKQUOTE class="code"><CODE><SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">MyMapFunction</SPAN>&nbsp;Value&nbsp;MaxWidth&nbsp;MaxDepth}<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">if</SPAN>&nbsp;{WantToMap&nbsp;Value}&nbsp;<SPAN class="keyword">then</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE>...<CODE>&nbsp;/*&nbsp;<SPAN class="comment">computations&nbsp;*/</SPAN>&nbsp;</CODE>...<CODE>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">else</SPAN>&nbsp;Value<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR><SPAN class="keyword">end</SPAN></CODE></BLOCKQUOTE><P> </P><P> <CODE>MaxWidth</CODE> and <CODE>MaxDepth</CODE> are integers denoting the node's width and depth limits. This allows to handle cycles independently of whether they would have been recognized or not. Keep in mind that mapping functions should not have side-effects. </P></DIV><DIV id="section.configure.actions"><H3><A name="section.configure.actions">5.5.3 Action Procedures</A></H3><P> Action procedures follow the pattern below. </P><BLOCKQUOTE class="code"><CODE><SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">MyAction</SPAN>&nbsp;Value}<BR>&nbsp;&nbsp;&nbsp;</CODE>...<CODE>&nbsp;/*&nbsp;<SPAN class="comment">computations&nbsp;*/</SPAN>&nbsp;</CODE>...<CODE>&nbsp;<BR><SPAN class="keyword">end</SPAN></CODE></BLOCKQUOTE><P> </P></DIV></DIV><DIV id="section.configure.relations"><H2><A name="section.configure.relations">5.6 Equivalence Relations</A></H2><P> Equivalence relations are registered using the statement </P><BLOCKQUOTE class="code"><CODE>{Inspector<SPAN class="keyword">.</SPAN>configure&nbsp;widgetRelationList&nbsp;[<SPAN class="string">'RelationName'</SPAN>(RelFun)&nbsp;/*&nbsp;<SPAN class="comment">...&nbsp;more&nbsp;relations&nbsp;*/</SPAN>]}</CODE></BLOCKQUOTE><P> </P><P> Every <CODE><I>RelFun</I></CODE> is expected to compute the characteristic function of its relation and therefore follows the pattern </P><BLOCKQUOTE class="code"><CODE><SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">RelFun</SPAN>&nbsp;X&nbsp;Y}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;<SPAN class="comment">computations&nbsp;resulting&nbsp;true&nbsp;or&nbsp;false&nbsp;*/</SPAN>&nbsp;<BR><SPAN class="keyword">end</SPAN></CODE></BLOCKQUOTE><P> </P><P> These functions should not have side effects. Again, the implementation currently only supports the replacement of the all relations. </P></DIV><H2><A name="label14">5.7 Inspecting user-defined types</A></H2><P> Oz allows to add new types to the system. The Inspector is able to display such values without beeing rebuilt provided that they can be distinguished using <CODE>Value<SPAN class="keyword">.</SPAN>status</CODE> and transformed to a built-in type. In this case, it is sufficient to add a new mapping function attached to that type. In the default case, the inspector will use <CODE>Value<SPAN class="keyword">.</SPAN>toVirtualString</CODE> to obtain a useful representation of the unknown value. Depending on its type, the value will be monitored und updated, too. </P><P> For example, to introduce weak dictionaries to the inspector use the code shown below. </P><BLOCKQUOTE class="code"><CODE><SPAN class="keyword">local</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">ItemFun</SPAN>&nbsp;V&nbsp;W&nbsp;D}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{WeakDictionary<SPAN class="keyword">.</SPAN>items&nbsp;V}<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;Key&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;<SPAN class="keyword">case</SPAN>&nbsp;{Value<SPAN class="keyword">.</SPAN>status&nbsp;{WeakDictionary<SPAN class="keyword">.</SPAN>new&nbsp;_}}&nbsp;<SPAN class="keyword">of</SPAN>&nbsp;det(T)&nbsp;<SPAN class="keyword">then</SPAN>&nbsp;T&nbsp;<SPAN class="keyword">[]</SPAN>&nbsp;_&nbsp;<SPAN class="keyword">then</SPAN>&nbsp;generic&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;TypeKey&nbsp;=&nbsp;{VirtualString<SPAN class="keyword">.</SPAN>toAtom&nbsp;Key<SPAN class="keyword">#</SPAN><SPAN class="string">'Menu'</SPAN>}<BR><SPAN class="keyword">in</SPAN>&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;{Inspector<SPAN class="keyword">.</SPAN>configure&nbsp;TypeKey&nbsp;menu(nil&nbsp;nil&nbsp;[auto(<SPAN class="string">'Show&nbsp;Contents'</SPAN>(ItemFun))]&nbsp;nil)}<BR><SPAN class="keyword">end</SPAN></CODE></BLOCKQUOTE><P> </P><P> See <A href="node5.html#section.configure.mappings">Section&nbsp;5.5.2</A> for details about how <CODE>ItemFun</CODE> is built.</P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node4.html#chapter.gui">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~bruni/">Thorsten&nbsp;Brunklaus</A><BR><SPAN class="version">Version 1.4.0 (20090610)</SPAN></ADDRESS></BODY></HTML>