/usr/share/mozart/doc/demo/node24.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: Bounce.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="bounce.html">- Up -</A></TD></TR></TABLE><DIV class="unnumbered" id="code.bounce"><H3><A name="code.bounce">Root functor: <CODE>Bounce.oz</CODE></A></H3><P class="margin"><A href="Bounce.oz">Source File</A></P><P> </P><BLOCKQUOTE><PRE><SPAN class="keyword">functor</SPAN> <BR> <BR><SPAN class="keyword">import</SPAN> <BR> Tk<BR> Application(exit)<BR> <BR><SPAN class="keyword">define</SPAN> <BR> <BR> CanvasWidth = 400<SPAN class="keyword">.</SPAN>0<BR> CanvasHeight = 400<SPAN class="keyword">.</SPAN>0<BR> BallRadius = 50<SPAN class="keyword">.</SPAN>0<BR> XDelta = 5<SPAN class="keyword">.</SPAN>0<BR> YDelta = 5<SPAN class="keyword">.</SPAN>0<BR> Gravity = 3<SPAN class="keyword">.</SPAN>0<BR> Fraction = 0<SPAN class="keyword">.</SPAN>9<BR> RepeatTime = 100<BR> Mouth = 30<BR> MouthDelta = 5<BR> <BR> BackColor = <SPAN class="string">'#fffff0'</SPAN> <BR> BallColors = <SPAN class="keyword">if</SPAN> Tk<SPAN class="keyword">.</SPAN>isColor <SPAN class="keyword">then</SPAN> <BR> red <SPAN class="keyword">|</SPAN> blue <SPAN class="keyword">|</SPAN> yellow <SPAN class="keyword">|</SPAN> green <SPAN class="keyword">|</SPAN> <BR> plum <SPAN class="keyword">|</SPAN> cyan <SPAN class="keyword">|</SPAN> tan <SPAN class="keyword">|</SPAN> bisque <SPAN class="keyword">|</SPAN> BallColors<BR> <SPAN class="keyword">else</SPAN> <BR> black <SPAN class="keyword">|</SPAN> BallColors<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">class</SPAN> <SPAN class="type">Ball</SPAN> <BR> <SPAN class="keyword">from</SPAN><SPAN class="type"> Time.repeat Tk.canvasTag</SPAN> <BR> <SPAN class="keyword">prop</SPAN> final<BR> <BR> <SPAN class="keyword">attr</SPAN> <BR> x: 0<SPAN class="keyword">.</SPAN>0<BR> xd: XDelta<BR> y: 0<SPAN class="keyword">.</SPAN>0<BR> yd: YDelta<BR> mouth: Mouth<BR> d: <SPAN class="keyword">~</SPAN>MouthDelta<BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">init</SPAN>(X Y Canvas Color)<BR> Tk<SPAN class="keyword">.</SPAN>canvasTag<SPAN class="keyword">,</SPAN>tkInit(parent:Canvas)<BR> {Canvas tk(crea arc X Y X<SPAN class="keyword">+</SPAN>BallRadius Y<SPAN class="keyword">+</SPAN>BallRadius<BR> fill:Color start:30 extent:300 tag:<SPAN class="keyword">self</SPAN>)}<BR> x <SPAN class="keyword"><-</SPAN> X<BR> y <SPAN class="keyword"><-</SPAN> Y<BR> Time<SPAN class="keyword">.</SPAN>repeat<SPAN class="keyword">,</SPAN> setRepAll(action:bounce delay:RepeatTime)<BR> <BR> <SPAN class="keyword">thread</SPAN> <BR> <SPAN class="keyword">try</SPAN> {<SPAN class="keyword">self</SPAN> go}<BR> <SPAN class="keyword">catch</SPAN> _ <SPAN class="keyword">then</SPAN> <SPAN class="keyword">skip</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">bounce</SPAN> <BR> %% <SPAN class="comment">increment @x and @d<BR></SPAN> x <SPAN class="keyword"><-</SPAN> <SPAN class="keyword">@</SPAN>x <SPAN class="keyword">+</SPAN> <SPAN class="keyword">@</SPAN>xd<BR> <SPAN class="keyword">if</SPAN> <SPAN class="keyword">@</SPAN>x <SPAN class="keyword">=<</SPAN> 0<SPAN class="keyword">.</SPAN>0 <SPAN class="keyword">then</SPAN> <BR> x <SPAN class="keyword"><-</SPAN> 0<SPAN class="keyword">.</SPAN>0<BR> xd <SPAN class="keyword"><-</SPAN> <SPAN class="keyword">~@</SPAN>xd<BR> <SPAN class="keyword">elseif</SPAN> <SPAN class="keyword">@</SPAN>x<SPAN class="keyword">>=</SPAN>CanvasWidth<SPAN class="keyword">-</SPAN>BallRadius <SPAN class="keyword">then</SPAN> <BR> x <SPAN class="keyword"><-</SPAN> CanvasWidth<SPAN class="keyword">-</SPAN>BallRadius<BR> xd <SPAN class="keyword"><-</SPAN> <SPAN class="keyword">~@</SPAN>xd<BR> <SPAN class="keyword">end</SPAN> <BR> %% <SPAN class="comment">increment @y and @yd<BR></SPAN> y <SPAN class="keyword"><-</SPAN> <SPAN class="keyword">@</SPAN>y <SPAN class="keyword">-</SPAN> <SPAN class="keyword">@</SPAN>yd<BR> yd <SPAN class="keyword"><-</SPAN> <SPAN class="keyword">@</SPAN>yd <SPAN class="keyword">-</SPAN> Gravity<BR> <SPAN class="keyword">if</SPAN> <SPAN class="keyword">@</SPAN>y<SPAN class="keyword">>=</SPAN>CanvasHeight<SPAN class="keyword">-</SPAN>BallRadius <SPAN class="keyword">then</SPAN> <BR> y <SPAN class="keyword"><-</SPAN> CanvasHeight<SPAN class="keyword">-</SPAN>BallRadius<BR> yd <SPAN class="keyword"><-</SPAN> Fraction <SPAN class="keyword">*</SPAN> <SPAN class="keyword">~@</SPAN>yd<BR> <SPAN class="keyword">end</SPAN> <BR> Tk<SPAN class="keyword">.</SPAN>canvasTag<SPAN class="keyword">,</SPAN>tk(coords <SPAN class="keyword">@</SPAN>x <SPAN class="keyword">@</SPAN>y <SPAN class="keyword">@</SPAN>x<SPAN class="keyword">+</SPAN>BallRadius <SPAN class="keyword">@</SPAN>y<SPAN class="keyword">+</SPAN>BallRadius)<BR> %% <SPAN class="comment">set the new mouth<BR></SPAN> mouth <SPAN class="keyword"><-</SPAN> <SPAN class="keyword">@</SPAN>mouth<SPAN class="keyword">+@</SPAN>d<BR> <SPAN class="keyword">if</SPAN> <SPAN class="keyword">@</SPAN>mouth<SPAN class="keyword">>=</SPAN>Mouth <SPAN class="keyword">then</SPAN> mouth <SPAN class="keyword"><-</SPAN> Mouth d <SPAN class="keyword"><-</SPAN> <SPAN class="keyword">~@</SPAN>d<BR> <SPAN class="keyword">elseif</SPAN> <SPAN class="keyword">@</SPAN>mouth<SPAN class="keyword">=<</SPAN>MouthDelta <SPAN class="keyword">then</SPAN> mouth <SPAN class="keyword"><-</SPAN> MouthDelta d <SPAN class="keyword"><-</SPAN> <SPAN class="keyword">~@</SPAN>d<BR> <SPAN class="keyword">end</SPAN> <BR> Tk<SPAN class="keyword">.</SPAN>canvasTag<SPAN class="keyword">,</SPAN>tk(itemconfigure start:<SPAN class="keyword">@</SPAN>mouth extent:360<SPAN class="keyword">-</SPAN>2<SPAN class="keyword">*@</SPAN>mouth)<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> <SPAN class="keyword">class</SPAN> <SPAN class="type">Manager</SPAN> <BR> <SPAN class="keyword">from</SPAN><SPAN class="type"> Tk.canvas</SPAN> <BR> <SPAN class="keyword">prop</SPAN> final locking<BR> <SPAN class="keyword">attr</SPAN> <BR> Balls: nil<BR> Colors: BallColors<BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">init</SPAN>(parent:P)<BR> {<SPAN class="keyword">self</SPAN> tkInit(parent:P bg:BackColor bd:3 relief:sunken<BR> width:CanvasWidth height:CanvasHeight)}<BR> {<SPAN class="keyword">self</SPAN> tkBind(action: <SPAN class="keyword">self</SPAN> <SPAN class="keyword">#</SPAN> NewBall<BR> event: <SPAN class="string">'<1>'</SPAN> <BR> args: [float(x) float(y)])}<BR> {<SPAN class="keyword">self</SPAN> tkBind(action: <SPAN class="keyword">self</SPAN> <SPAN class="keyword">#</SPAN> KillBall<BR> event: <SPAN class="string">'<3>'</SPAN>)}<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">NewBall</SPAN>(X Y)<BR> <SPAN class="keyword">lock</SPAN> <BR> C<SPAN class="keyword">|</SPAN>Cr = <SPAN class="keyword">@</SPAN>Colors<BR> <SPAN class="keyword">in</SPAN> <BR> Balls <SPAN class="keyword"><-</SPAN> {New Ball init(X Y <SPAN class="keyword">self</SPAN> C)}<SPAN class="keyword">|@</SPAN>Balls<BR> Colors <SPAN class="keyword"><-</SPAN> Cr<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">KillBall</SPAN> <BR> <SPAN class="keyword">lock</SPAN> <BR> <SPAN class="keyword">case</SPAN> <SPAN class="keyword">@</SPAN>Balls <SPAN class="keyword">of</SPAN> nil <SPAN class="keyword">then</SPAN> <SPAN class="keyword">skip</SPAN> <BR> <SPAN class="keyword">[]</SPAN> B<SPAN class="keyword">|</SPAN>Br <SPAN class="keyword">then</SPAN> {B close} Balls <SPAN class="keyword"><-</SPAN> Br<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <BR> Top = {New Tk<SPAN class="keyword">.</SPAN>toplevel tkInit(title: <SPAN class="string">'Oz Bouncer'</SPAN> <BR> delete: Application<SPAN class="keyword">.</SPAN>exit <SPAN class="keyword">#</SPAN> 0)}<BR> <BR> {Tk<SPAN class="keyword">.</SPAN>send pack({New Manager init(parent:Top)})}<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="bounce.html">- Up -</A></TD></TR></TABLE><HR><ADDRESS><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
|