forth/gforth.cgi_

58 lines
1.5 KiB
Perl
Executable File

#!/usr/pkg/bin/perl
use CGI;
$GFORTH = '/usr/pkg/bin/gforth';
$CORA = '/meta/p/papa/html/cgi-bin/cora.fs';
$query = CGI->new;
$command = $query->param('command');
print <<END1 ;
Content-type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Gforth Calculator</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<!-- <link rel="stylesheet" type="text/css" href="../tir/tir.css"> -->
<style type="text/css">
</style>
</head>
<body>
<h1>Gforth Calculator</h1>
<form action="gforth.cgi" method="post">
Command <input type="text" name="command" size=80 />
<input type="submit" value="Submit" />
</form>
<hr />
END1
if ($command) {
open(RESULT, '-|', "$GFORTH $CORA -e '$command CR S\" D:\" TYPE .S S\" F:\" TYPE F.S CR BYE'") or die "Can't start gforth: $!";
print "<table><tr><td>$command</td><td>==></td><td>";
while (<RESULT>) {
chop $_;
print "$_<br />";
}
print "</td></tr></table>\n";
}
print <<END3 ;
<a href="http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/">Gforth Manual</a><br />
<a href="http://www.forth.com/starting-forth/">Starting Forth</a><br />
<a href="http://prdownloads.sourceforge.net/thinking-forth/thinking-forth-color.pdf?download">Thinking Forth</a><br />
<a href="http://www.complang.tuwien.ac.at/projects/forth.html">Forth Research</a><br />
<a href="http://www.forth.org/">Forth Interest Group</a><br />
<a href="http://www.colorforth.com/">Chuck Moore</a><br />
</body>
</html>
END3