17 UCW::CGI::parse_args({
18 'src' => { 'var' => \$src, 'multiline' => 1 },
19 'example' => { 'var' => \$example, 'check' => '\w+' },
20 'trace' => { 'var' => \$trace, 'check' => '[0-2]', 'default' => 0 },
23 if ($example ne '' && open EX, "ex-$example") {
30 my $src_html = html_escape($src);
31 my @trsel = map { $trace == $_ ? "selected" : "" } 0..2;
34 Content-type: text/html; charset=utf-8
36 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html40/strict.dtd">
38 <title>Minsk-2 Emulator</title>
39 <link rel=stylesheet title=Default href="minsk.css" type="text/css" media=all>
41 <h1>Minsk-2 Emulator</h1>
43 <p id=top>(see <a href='readme.html'>instructions</a>)
48 print "<h2>Output</h2>\n\n<pre id=output><code>";
49 my $tmpf = new File::Temp();
50 print $tmpf $src, "\n";
52 my $in = $tmpf->filename;
53 open SIM, "./minsk --trace=$trace --cpu-quota=1000 --print-quota=100 <$in |" or die;
55 print html_escape($_);
58 print "</code></pre>\n\n";
64 <form action='?' method=POST accept-charset='US-ASCII UTF-8'>
65 <textarea name=src rows=20 cols=80>$src_html</textarea>
66 <p><button name=submit type=submit>Run</button>
68 <option $trsel[0] value=0>Tracing off</option>
69 <option $trsel[1] value=1>Brief tracing</option>
70 <option $trsel[2] value=2>Detailed tracing</option>
77 <p>Written by <a href='http://mj.ucw.cz/'>Martin Mareš</a>. Version 1.0 (2010-12-27).