/usr/share/mozart/doc/demo/node12.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>Controlling the operation: Controller.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="node11.html#code.college.common"><< Prev</A></TD><TD><A href="college.html">- Up -</A></TD><TD><A href="node13.html#code.college.scheduler">Next >></A></TD></TR></TABLE><DIV class="unnumbered" id="code.college.controller"><H3><A name="code.college.controller">Controlling the operation: <CODE>Controller.oz</CODE></A></H3><P class="margin"><A href="College/Controller.oz">Source File</A></P><P> </P><BLOCKQUOTE><PRE><SPAN class="keyword">functor</SPAN> <BR> <BR><SPAN class="keyword">require</SPAN> <BR> <BR> DemoUrls(image) <SPAN class="keyword">at</SPAN> <SPAN class="string">'../DemoUrls.ozf'</SPAN> <BR> <BR><SPAN class="keyword">prepare</SPAN> <BR> ImageNames = [DemoUrls<SPAN class="keyword">.</SPAN>image<SPAN class="keyword">#</SPAN><SPAN class="string">'college/title.xbm'</SPAN>]<BR> <BR><SPAN class="keyword">import</SPAN> <BR> <BR> Tk<BR> TkTools<BR> Application<BR> <BR> Scheduler(timeTable: TimeTable)<BR> <BR><SPAN class="keyword">export</SPAN> <BR> <BR> Controller<BR> <BR> TopWindow<BR> <BR><SPAN class="keyword">define</SPAN> <BR> <BR> TopWindow = {New Tk<SPAN class="keyword">.</SPAN>toplevel tkInit(title:<SPAN class="string">'College Time-Tabling'</SPAN> <BR> delete: <SPAN class="keyword">proc</SPAN>{<SPAN class="functionname">$</SPAN>}<BR> {TopWindow tkClose}<BR> {Application<SPAN class="keyword">.</SPAN>exit 0}<BR> <SPAN class="keyword">end</SPAN>)}<BR> <BR> <BR> Images = {TkTools<SPAN class="keyword">.</SPAN>images ImageNames}<BR> <BR> <SPAN class="keyword">fun</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">Controller</SPAN>}<BR> <BR> Menu = {New Tk<SPAN class="keyword">.</SPAN>frame<BR> tkInit(parent:TopWindow relief:raised borderwidth:2)}<BR> ControllerLabel = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent: Menu text: <SPAN class="string">""</SPAN>)}<BR> <BR> {Tk<SPAN class="keyword">.</SPAN>send pack(Menu side:top fill:x)}<BR> <BR> MB1 MB2 MB3<BR> M1 M2 M3<BR> AAbout AExit<BR> <BR> ALoadSolution<BR> <BR><SPAN class="reference">\ifndef ALONEDEMO</SPAN> <BR> ASaveSolution <BR> AEditProblem<BR> ALoadProblem<BR><SPAN class="reference">\endif</SPAN> <BR> <BR> AFirstSol AOptimize<BR> AIntrOpt ADispGraphical ADispInspecting<BR> ADispTextual<BR> <BR> <SPAN class="keyword">fun</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">TkAction</SPAN> What Parent P1 P2}<BR> {New Tk<SPAN class="keyword">.</SPAN>action tkInit(parent: Parent<BR> action: <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN>}<BR> <SPAN class="keyword">if</SPAN> P2 <SPAN class="keyword">==</SPAN> none <SPAN class="keyword">then</SPAN> <BR> {What P1}<BR> <SPAN class="keyword">else</SPAN> <BR> {What P1 P2}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN>)}<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">DoFileOp</SPAN> MessageName Flag}<BR> File<BR> <SPAN class="keyword">in</SPAN> <BR> <SPAN class="keyword">if</SPAN> Flag <SPAN class="keyword">==</SPAN> read <SPAN class="keyword">then</SPAN> <BR> {Tk<SPAN class="keyword">.</SPAN>return tk_getOpenFile(title: <SPAN class="string">'Select file'</SPAN> <BR> filetypes: q(q(<SPAN class="string">'Data files'</SPAN> q(<SPAN class="string">'.ozt'</SPAN>))<BR> q(<SPAN class="string">'Oz Files '</SPAN> q(<SPAN class="string">'.oz'</SPAN>))))<BR> File}<BR> <SPAN class="keyword">else</SPAN> <BR> {Tk<SPAN class="keyword">.</SPAN>return tk_getSaveFile(title: <SPAN class="string">'Select file'</SPAN> <BR> filetypes: q(q(<SPAN class="string">'Data files'</SPAN> q(<SPAN class="string">'.ozt'</SPAN>))<BR> q(<SPAN class="string">'Oz Files '</SPAN> q(<SPAN class="string">'.oz'</SPAN>))))<BR> File}<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> {Wait File}<BR> <BR> <SPAN class="keyword">if</SPAN> File <SPAN class="keyword">==</SPAN> nil <SPAN class="keyword">then</SPAN> <SPAN class="keyword">skip</SPAN> <BR> <SPAN class="keyword">else</SPAN> <BR> {ControllerLabel tk(configure text:<SPAN class="string">"File "</SPAN><SPAN class="keyword">#</SPAN>Flag)}<BR> {TimeTable MessageName(File)}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR><SPAN class="reference">\ifdef ALONEDEMO </SPAN> <BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">DoFileOpAlone</SPAN> MessageName Flag}<BR> {TimeTable MessageName(_)}<BR> <SPAN class="keyword">end</SPAN> <BR><SPAN class="reference">\endif</SPAN> <BR> <BR> % <SPAN class="comment">-------------------------------------------------<BR></SPAN> <BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">About</SPAN>}<BR> AboutWindow = {New Tk<SPAN class="keyword">.</SPAN>toplevel tkInit(parent:TopWindow)}<BR> OK = {New Tk<SPAN class="keyword">.</SPAN>button<BR> tkInit(parent:AboutWindow text:<SPAN class="string">'OK'</SPAN> relief:raised<BR> borderwidth:2<BR> action: AboutWindow <SPAN class="keyword">#</SPAN> tkClose)}<BR> Message = {New Tk<SPAN class="keyword">.</SPAN>message<BR> tkInit(parent:AboutWindow<BR> aspect:300 <BR> relief:raised<BR> borderwidth:1<BR> font:<SPAN class="string">'-misc-fixed-bold-*-*-*-*-*-*-*-*-*-*'</SPAN> <BR> text:<BR> <SPAN class="string">"This propgram allows to solve a time tabling problem. When started, a problem is already read in. Hence, just start solving. The search may be interrupted (if a solution was already computed) and resumed.\n"</SPAN>)}<BR> <SPAN class="keyword">in</SPAN> <BR> {Tk<SPAN class="keyword">.</SPAN>batch [wm(title AboutWindow <SPAN class="string">"What is it?"</SPAN>)<BR> wm(iconname AboutWindow <SPAN class="string">"About"</SPAN>)<BR> pack(Message side:top)<BR> pack(OK side:bottom fill:x)]}<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> % <SPAN class="comment">-------------------------------------------------<BR></SPAN> <BR> {Tk<SPAN class="keyword">.</SPAN>send pack(ControllerLabel side: right)}<BR> <BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">Compute</SPAN> Message Display}<BR> {ControllerLabel tk(configure text: <SPAN class="string">"Computing..."</SPAN>)}<BR> {TimeTable Message} <BR> <SPAN class="keyword">thread</SPAN> <BR> {Wait {TimeTable get($)}}<BR> {ControllerLabel tk(configure text: <SPAN class="string">"done"</SPAN>)}<BR> {TimeTable Display}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> % <SPAN class="comment">-------------------------------------------------<BR></SPAN> <BR> TitleCanvas = {New Tk<SPAN class="keyword">.</SPAN>canvas tkInit(parent: TopWindow<BR> height: 130 width: 340)}<BR> {TitleCanvas tk(crea image 0 0<BR> image: Images<SPAN class="keyword">.</SPAN><SPAN class="string">'title'</SPAN> <BR> anchor:nw)}<BR> {TitleCanvas tk(crea text 240 40<BR> text:<SPAN class="string">"TimeTable"</SPAN> anchor:nw<BR> font:<SPAN class="string">'-adobe-helvetica-bold-o-*-*-18-*'</SPAN>)}<BR> {TitleCanvas tk(crea text 240 65<BR> text:<SPAN class="string">"Manager"</SPAN> anchor:nw<BR> font:<SPAN class="string">'-adobe-helvetica-bold-o-*-*-18-*'</SPAN>)}<BR> <BR> {Tk<SPAN class="keyword">.</SPAN>send pack(TitleCanvas side:top)}<BR> <BR> <SPAN class="keyword">in</SPAN> <BR> <BR> {ForAll [ [MB1 <SPAN class="string">" File"</SPAN>] [MB2 <SPAN class="string">" Compute"</SPAN>] [MB3 <SPAN class="string">" Output"</SPAN>] ]<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> MB}<BR> MB<SPAN class="keyword">.</SPAN>1 = {New Tk<SPAN class="keyword">.</SPAN>menubutton tkInit(parent:Menu text:MB<SPAN class="keyword">.</SPAN>2<SPAN class="keyword">.</SPAN>1)}<BR> <SPAN class="keyword">end</SPAN>}<BR> <BR> {ForAll [ [M1 MB1] [M2 MB2] [M3 MB3] ]<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> M} M<SPAN class="keyword">.</SPAN>1 = {New Tk<SPAN class="keyword">.</SPAN>menu tkInit(parent:M<SPAN class="keyword">.</SPAN>2<SPAN class="keyword">.</SPAN>1)} <SPAN class="keyword">end</SPAN>}<BR> <BR> AAbout = {New Tk<SPAN class="keyword">.</SPAN>action tkInit(parent: Menu action: About)}<BR> AExit = {New Tk<SPAN class="keyword">.</SPAN>action tkInit(parent: Menu<BR> action: <SPAN class="keyword">proc</SPAN>{<SPAN class="functionname">$</SPAN>}<BR> {TopWindow tkClose}<BR> {Application<SPAN class="keyword">.</SPAN>exit 0}<BR> <SPAN class="keyword">end</SPAN>)}<BR> <BR> {ForAll [<BR><SPAN class="reference">\ifndef ALONEDEMO</SPAN> <BR> [ALoadProblem DoFileOp readProblem read]<BR> [AEditProblem DoFileOp edit read]<BR> [ALoadSolution DoFileOp read read]<BR> [ASaveSolution DoFileOp save written]<BR><SPAN class="reference">\else</SPAN> <BR> [_ DoFileOp readProblem read]<BR> [_ DoFileOp edit read]<BR> [ALoadSolution DoFileOpAlone read read]<BR><SPAN class="reference">\endif</SPAN> <BR> [AFirstSol Compute solveProblem graphic]<BR> [AOptimize TimeTable optimizeProblem none]<BR> [AIntrOpt TimeTable anyTime none]<BR> [ADispGraphical TimeTable graphic none]<BR> [ADispInspecting TimeTable inspect none]<BR> [ADispTextual TimeTable text none]<BR> ]<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> Action}<BR> Action<SPAN class="keyword">.</SPAN>1 = {TkAction Action<SPAN class="keyword">.</SPAN>2<SPAN class="keyword">.</SPAN>1 Menu Action<SPAN class="keyword">.</SPAN>2<SPAN class="keyword">.</SPAN>2<SPAN class="keyword">.</SPAN>1 Action<SPAN class="keyword">.</SPAN>2<SPAN class="keyword">.</SPAN>2<SPAN class="keyword">.</SPAN>2<SPAN class="keyword">.</SPAN>1}<BR> <SPAN class="keyword">end</SPAN>}<BR> <BR><SPAN class="reference">\ifndef ALONEDEMO</SPAN> <BR> {ForAll [ [<SPAN class="string">" Load problem "</SPAN> ALoadProblem]<BR> [<SPAN class="string">" Edit problem "</SPAN> AEditProblem]<BR> [<SPAN class="string">"--------------"</SPAN>]<BR> [<SPAN class="string">" Load solution "</SPAN> ALoadSolution]<BR> [<SPAN class="string">" Save Solution "</SPAN> ASaveSolution]<BR> [<SPAN class="string">"--------------"</SPAN>]<BR> [<SPAN class="string">" Exit "</SPAN> AExit] ]<BR><SPAN class="reference">\else</SPAN> <BR> {ForAll [ [<SPAN class="string">" Load solution "</SPAN> ALoadSolution]<BR> [<SPAN class="string">"--------------"</SPAN>]<BR> [<SPAN class="string">" About this program "</SPAN> AAbout]<BR> [<SPAN class="string">"--------------"</SPAN>]<BR> [<SPAN class="string">" Exit "</SPAN> AExit] ]<BR><SPAN class="reference">\endif </SPAN> <BR> <SPAN class="keyword">proc</SPAN>{<SPAN class="functionname">$</SPAN> C}<BR> <SPAN class="keyword">case</SPAN> C<SPAN class="keyword">.</SPAN>1<BR> <SPAN class="keyword">of</SPAN> <SPAN class="string">"--------------"</SPAN> <SPAN class="keyword">then</SPAN> {M1 tk(add sep)}<BR> <SPAN class="keyword">else</SPAN> {M1 tk(add command label: C<SPAN class="keyword">.</SPAN>1 command: C<SPAN class="keyword">.</SPAN>2<SPAN class="keyword">.</SPAN>1)}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN>}<BR> {ForAll [ [<SPAN class="string">" First Solution "</SPAN> AFirstSol]<BR> [<SPAN class="string">" Optimize Current Solution "</SPAN> AOptimize]<BR> [<SPAN class="string">"--------------"</SPAN>]<BR> [<SPAN class="string">" Interrupt Solving "</SPAN> AIntrOpt] ]<BR> <SPAN class="keyword">proc</SPAN>{<SPAN class="functionname">$</SPAN> C}<BR> <SPAN class="keyword">case</SPAN> C<SPAN class="keyword">.</SPAN>1<BR> <SPAN class="keyword">of</SPAN> <SPAN class="string">"--------------"</SPAN> <SPAN class="keyword">then</SPAN> {M2 tk(add(sep))}<BR> <SPAN class="keyword">else</SPAN> {M2 tk(add(command(label: C<SPAN class="keyword">.</SPAN>1 command: C<SPAN class="keyword">.</SPAN>2<SPAN class="keyword">.</SPAN>1)))}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN>}<BR> {ForAll [ [<SPAN class="string">" Display graphically "</SPAN> ADispGraphical]<BR> [<SPAN class="string">" Display with Inspector "</SPAN> ADispInspecting]<BR> [<SPAN class="string">" Display textually "</SPAN> ADispTextual]<BR> ]<BR> <SPAN class="keyword">proc</SPAN>{<SPAN class="functionname">$</SPAN> C}<BR> <SPAN class="keyword">case</SPAN> C<SPAN class="keyword">.</SPAN>1<BR> <SPAN class="keyword">of</SPAN> <SPAN class="string">"--------------"</SPAN> <SPAN class="keyword">then</SPAN> {M3 tk(add(sep))}<BR> <SPAN class="keyword">else</SPAN> {M3 tk(add command label: C<SPAN class="keyword">.</SPAN>1 command: C<SPAN class="keyword">.</SPAN>2<SPAN class="keyword">.</SPAN>1)}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN>}<BR> <BR> {MB1 tk(conf menu: M1)}<BR> {MB2 tk(conf menu: M2)}<BR> {MB3 tk(conf menu: M3)}<BR> <BR> {Tk<SPAN class="keyword">.</SPAN>send pack(MB1 MB2 MB3 side: left)}<BR> {Tk<SPAN class="keyword">.</SPAN>send tk_menuBar(Menu MB1 MB2 MB3)}<BR> <BR> ControllerLabel <BR> <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="node11.html#code.college.common"><< Prev</A></TD><TD><A href="college.html">- Up -</A></TD><TD><A href="node13.html#code.college.scheduler">Next >></A></TD></TR></TABLE><HR><ADDRESS><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
|