/usr/share/mozart/doc/cpitut/node18.html is in mozart-doc 1.4.0-8ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Extending OZ_Expect</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="node17.html#ct.casestudy.impl.rivar"><< Prev</A></TD><TD><A href="node13.html">- Up -</A></TD><TD><A href="node19.html#ct.casestudy.impl.propagator">Next >></A></TD></TR></TABLE><DIV id="ct.casestudy.impl.expect"><H4><A name="ct.casestudy.impl.expect">Extending <CODE>OZ_Expect</CODE></A></H4><P>Propagators are imposed on their parameters by foreign functions which are invoked by the Oz runtime system. Such foreign functions use the C<SPAN class="allcaps">PI</SPAN> class <CODE>OZ_Expect</CODE> to check that the parameters are appropriately kinded (resp. constrained) or represent compatible values. The class <CODE>OZ_Expect</CODE> provides the member function </P><BLOCKQUOTE class="code"><CODE><SPAN class="type">OZ_expect_t</SPAN> <SPAN class="reference">OZ_Expect</SPAN>::<SPAN class="functionname">expectGenCtVar</SPAN>(<SPAN class="type">OZ_Term</SPAN> <SPAN class="variablename">t</SPAN>, <BR> <SPAN class="type">OZ_CtDefinition</SPAN> * <SPAN class="variablename">d</SPAN>,<BR> <SPAN class="type">OZ_CtWakeUp</SPAN> <SPAN class="variablename">w</SPAN>); </CODE></BLOCKQUOTE><P> to define appropriate expect-functions, e.g., for real-interval constraints. The customized class defines member functions that check for real-intervals and determine the wake-up event. To do that, the static members functions of <CODE>RIWakeUp</CODE> (see <A href="node15.html#ct.casestudy.impl.profilewakeup">Section ``Determining Wake-up Events for Real-Interval Constraints''</A>) are used and the global variable <CODE><SPAN class="type">RIDefinition</SPAN> <SPAN class="variablename">ri_definition</SPAN></CODE> is assumed. </P><BLOCKQUOTE class="linenumbers"><PRE><SPAN class="keyword">class</SPAN> <SPAN class="type">RIExpect</SPAN> : <SPAN class="keyword">public</SPAN> <SPAN class="type">OZ_Expect</SPAN> {<BR><SPAN class="keyword">public</SPAN>:<BR> <SPAN class="type">OZ_expect_t</SPAN> <SPAN class="functionname">expectRIVarMin</SPAN>(<SPAN class="type">OZ_Term</SPAN> <SPAN class="variablename">t</SPAN>) { <BR> <SPAN class="keyword">return</SPAN> expectGenCtVar(t, ri_definition, <BR> <SPAN class="reference">RIWakeUp</SPAN>::wakeupMin()); <BR> }<BR> <SPAN class="type">OZ_expect_t</SPAN> <SPAN class="functionname">expectRIVarMax</SPAN>(<SPAN class="type">OZ_Term</SPAN> <SPAN class="variablename">t</SPAN>) { <BR> <SPAN class="keyword">return</SPAN> expectGenCtVar(t, ri_definition, <BR> <SPAN class="reference">RIWakeUp</SPAN>::wakeupMax()); <BR> }<BR> <SPAN class="type">OZ_expect_t</SPAN> <SPAN class="functionname">expectRIVarMinMax</SPAN>(<SPAN class="type">OZ_Term</SPAN> <SPAN class="variablename">t</SPAN>) { <BR> <SPAN class="keyword">return</SPAN> expectGenCtVar(t, ri_definition, <BR> <SPAN class="reference">RIWakeUp</SPAN>::wakeupMinMax()); <BR> }<BR> ...<BR>};<BR></PRE></BLOCKQUOTE><P> The class <CODE>RIEexpect</CODE> can now be used to define foreign functions that impose propagators on their parameters. </P><BLOCKQUOTE class="code"><CODE><SPAN class="functionname">OZ_BI_define</SPAN>(ri_lessEq, 2, 0)<BR>{<BR> OZ_EXPECTED_TYPE(<SPAN class="string">"real interval, real interval"</SPAN>);<BR> <BR> <SPAN class="type">RIExpect</SPAN> <SPAN class="variablename">pe</SPAN>;<BR> <BR> OZ_EXPECT(pe, 0, expectRIVarMinMax);<BR> OZ_EXPECT(pe, 1, expectRIVarMinMax);<BR> <BR> <SPAN class="keyword">return</SPAN> pe.impose(<SPAN class="keyword">new</SPAN> <SPAN class="type">RILessEq</SPAN>(OZ_args[0], <BR> OZ_args[1]));<BR>}<BR>OZ_BI_end</CODE></BLOCKQUOTE><P> The propagator class <CODE>RILessEq</CODE> is partly defined next. </P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node17.html#ct.casestudy.impl.rivar"><< Prev</A></TD><TD><A href="node13.html">- Up -</A></TD><TD><A href="node19.html#ct.casestudy.impl.propagator">Next >></A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~tmueller/">Tobias Müller</A><BR><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
|