Up: Strategies for using scripts

Axes Demo Source Code

#! /usr/bin/perl

require "/u/www/root/admin/bin/cgi.pl";
require "axes.pl";


#make sure to include paths to programs invoked

$ENV{"PATH"} .= ":/usr/local/bin:/u/share/bin";

print &mime_header();
%data = &get_data();

$x = $data{"x"};
$y = $data{"y"};
$xmax = $data{"xmax"};
$ymax = $data{"ymax"};

&gifsize(20, 380, 280, 20, $x, $y);
&pssize( 20, 380,  20, 280);
&sizetofit($xmax, $ymax);

$file = "tmp/$$";
$psfile = $file.".eps";
$giffile = $file.".gif";

open(TMP,">> $psfile");	# $$ returns PID in Perl

print TMP
"%%BoundingBox: 0 0 450 450
newpath
.1 setlinewidth
0 0 moveto 400 0 lineto 400 300 lineto 0 300 lineto closepath stroke
1 setlinewidth
";

($amin_x, $amin_y) = &u2p($umin_x, $umin_y);
($amax_x, $amax_y) = &u2p($umax_x, $umax_y);
($ax,$ay) = &g2p($x,$y);


print TMP
"newpath
$amin_x $ay moveto $amax_x $ay lineto stroke
newpath
$ax $amin_y moveto $ax $amax_y lineto stroke";

&xticks();
&yticks();

close(TMP);			#important

system("convert $psfile $giffile");

print "
<HTML><HEAD><TITLE>Axes Demo</TITLE></HEAD>
<BODY>
<FORM ACTION=\"axesdemo.cgi\">
<INPUT TYPE=image SRC=$giffile><P>

x max: <INPUT SIZE=3 NAME=xmax value=$xmax><BR>
y max: <INPUT SIZE=3 NAME=ymax value=$ymax>
</FORM>

<HR>
</BODY>
</HTML>";


Up: Strategies for using scripts

[HOME] The Geometry Center Home Page

Comments to: webmaster@www.geom.uiuc.edu
Created: May 09 1996 --- Last modified: Tue Jun 4 22:10:22 1996