/usr/share/mozart/doc/demo/node23.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>Root functor: Trucks.oz</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="trucks.html">- Up -</A></TD></TR></TABLE><DIV class="unnumbered" id="code.trucks"><H3><A name="code.trucks">Root functor: <CODE>Trucks.oz</CODE></A></H3><P class="margin"><A href="Trucks.oz">Source File</A></P><P> </P><BLOCKQUOTE><PRE><SPAN class="keyword">functor</SPAN> <BR> <BR><SPAN class="keyword">require</SPAN> <BR> DemoUrls(image)<BR> <BR><SPAN class="keyword">prepare</SPAN> <BR> ImageNames = [DemoUrls<SPAN class="keyword">.</SPAN>image<SPAN class="keyword">#</SPAN><SPAN class="string">'trucks/truck-right.ppm'</SPAN> <BR> DemoUrls<SPAN class="keyword">.</SPAN>image<SPAN class="keyword">#</SPAN><SPAN class="string">'trucks/truck-left.ppm'</SPAN>]<BR> <BR> Width = 600<BR> Height = 165<BR> TruckHeight = 60<BR> Free = 25<BR> <BR><SPAN class="keyword">import</SPAN> <BR> Tk<BR> TkTools<BR> Application<BR> <BR><SPAN class="keyword">define</SPAN> <BR> Images = {TkTools<SPAN class="keyword">.</SPAN>images ImageNames}<BR> <BR> <SPAN class="keyword">class</SPAN> <SPAN class="type">Truck</SPAN> <BR> <SPAN class="keyword">prop</SPAN> <BR> final<BR> <BR> <SPAN class="keyword">from</SPAN> <BR> Time<SPAN class="keyword">.</SPAN>repeat Tk<SPAN class="keyword">.</SPAN>canvasTag<BR> <BR> <SPAN class="keyword">attr</SPAN> <BR> state:off<BR> step:1<BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">init</SPAN>(c:Canvas x:X<SPAN class="keyword"><=</SPAN>0 y:Y<SPAN class="keyword"><=</SPAN>0)<BR> Truck<SPAN class="keyword">,</SPAN> tkInit(parent:Canvas)<BR> <BR> {Canvas tk(crea image X Y image:Images<SPAN class="keyword">.</SPAN><SPAN class="string">'truck-right'</SPAN> tag:<SPAN class="keyword">self</SPAN>)}<BR> <BR> {<SPAN class="keyword">self</SPAN> setRepAll(delay: 100<BR> number: Width <SPAN class="keyword">div</SPAN> <SPAN class="keyword">@</SPAN>step<BR> action: moveTruck <BR> final: switch)}<BR> <BR> {<SPAN class="keyword">self</SPAN> tkBind(event:<SPAN class="string">'<1>'</SPAN> action:<SPAN class="keyword">self#</SPAN>toggle)}<BR> {<SPAN class="keyword">self</SPAN> tkBind(event:<SPAN class="string">'<2>'</SPAN> action:<SPAN class="keyword">self#</SPAN>change(<SPAN class="keyword">~</SPAN>1))}<BR> {<SPAN class="keyword">self</SPAN> tkBind(event:<SPAN class="string">'<3>'</SPAN> action:<SPAN class="keyword">self#</SPAN>change(1))}<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">moveTruck</SPAN> <BR> Truck<SPAN class="keyword">,</SPAN> tk(move <SPAN class="keyword">@</SPAN>step 0)<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">switch</SPAN> <BR> step <SPAN class="keyword"><-</SPAN> <SPAN class="keyword">~</SPAN>1 <SPAN class="keyword">*</SPAN> <SPAN class="keyword">@</SPAN>step<BR> <SPAN class="keyword">if</SPAN> <SPAN class="keyword">@</SPAN>step<SPAN class="keyword">></SPAN>0<BR> <SPAN class="keyword">then</SPAN> {<SPAN class="keyword">self</SPAN> tk(itemconf image:Images<SPAN class="keyword">.</SPAN><SPAN class="string">'truck-right'</SPAN>)}<BR> <SPAN class="keyword">else</SPAN> {<SPAN class="keyword">self</SPAN> tk(itemconf image:Images<SPAN class="keyword">.</SPAN><SPAN class="string">'truck-left'</SPAN>)} <BR> <SPAN class="keyword">end</SPAN> <BR> {<SPAN class="keyword">self</SPAN> go}<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">toggle</SPAN> <BR> <SPAN class="keyword">try</SPAN> <BR> <SPAN class="keyword">case</SPAN> <SPAN class="keyword">@</SPAN>state<BR> <SPAN class="keyword">of</SPAN> off <SPAN class="keyword">then</SPAN> state<SPAN class="keyword"><-</SPAN>on {<SPAN class="keyword">self</SPAN> go}<BR> <SPAN class="keyword">[]</SPAN> on <SPAN class="keyword">then</SPAN> state<SPAN class="keyword"><-</SPAN>off {<SPAN class="keyword">self</SPAN> stop}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">catch</SPAN> system(<SPAN class="keyword">...</SPAN>) <SPAN class="keyword">then</SPAN> <SPAN class="keyword">skip</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">change</SPAN>(S)<BR> N = {<SPAN class="keyword">self</SPAN> getRep(delay:$)}<BR> <SPAN class="keyword">in</SPAN> <BR> {<SPAN class="keyword">self</SPAN> setRepDelay({Max 2 N<SPAN class="keyword">+</SPAN>S<SPAN class="keyword">*</SPAN>(N <SPAN class="keyword">div</SPAN> 2)})}<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">close</SPAN> <BR> Time<SPAN class="keyword">.</SPAN>repeat<SPAN class="keyword">,</SPAN> stop<BR> Tk<SPAN class="keyword">.</SPAN>canvasTag<SPAN class="keyword">,</SPAN> tkClose<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> T = {New Tk<SPAN class="keyword">.</SPAN>toplevel tkInit(title: <SPAN class="string">'Truckrace'</SPAN> <BR> delete: Application<SPAN class="keyword">.</SPAN>exit <SPAN class="keyword">#</SPAN> 0)}<BR> <BR> C = {New Tk<SPAN class="keyword">.</SPAN>canvas tkInit(parent: T<BR> bg: white<BR> width: Width<BR> height: Height)}<BR> <BR> {Tk<SPAN class="keyword">.</SPAN>send pack(C fill:both)}<BR> <BR> <SPAN class="keyword">thread</SPAN> {New Truck init(c:C y:Free) _} <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">thread</SPAN> {New Truck init(c:C y:Free<SPAN class="keyword">+</SPAN>TruckHeight) _} <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">thread</SPAN> {New Truck init(c:C y:Free<SPAN class="keyword">+</SPAN>TruckHeight<SPAN class="keyword">*</SPAN>2) _} <SPAN class="keyword">end</SPAN> <BR> <BR><SPAN class="keyword">end</SPAN> <BR></PRE></BLOCKQUOTE><P></P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="trucks.html">- Up -</A></TD></TR></TABLE><HR><ADDRESS><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
|