Listing of program /html/rsp/rsptest2.rsp
<?rexx
/*-- RSP ---------------------------------------------------------------------*/
/* */
/* Module: rsptest2.rsp */
/* */
/* Version: 1.1.2 */
/* */
/* Author: W. David Ashley */
/* Modified : Henri Henault June 2003 */
/* */
/* Description: Test RSP page. REXX calculator. */
/* */
/* Copyright (C) International Business Machines Corporation and others. */
/* All Rights Reserved. */
/* */
/* This software is subject to the terms of the Common Public License. You */
/* must accept the terms of this license to use this software. Refer to */
/* the file CPLv1.0.htm included in this package for more information. */
/* */
/* The program is provided "as is" without any warranty express or implied, */
/* including the warranty of non-infringement and the implied warranties of */
/* merchantibility and fitness for a particular purpose. IBM will not be */
/* liable for any damages suffered by you as a result of using the Program. */
/* In no event will IBM be liable for any special, indirect or consequential */
/* damages or lost profits even if IBM has been advised of the possibility of */
/* their occurrence. IBM will not be liable for any third party claims */
/* against you. */
/* */
/* Modifications: */
/* */
/* Date Author Description */
/* ---------- ----------- --------------------------------------------------- */
/* 2002/06/01 WD Ashley v1.1.0 Initial Public Release */
/* 2002/06/30 WD Ashley v1.1.1 Changed the license reference only. */
/* 2003/06/11 H. Henault v1.1.1 Add hhns math package */
/* */
/*----------------------------------------------------------------------------*/
signal on syntax name syntax_err
call WWWGetArgs arg(1)
?>
<html>
<head>
<title>RSP Test Page</title>
<link rel="stylesheet" type="text/css" href="/styles/hhstyle.css">
<link rel="SHORTCUT ICON" href="/imglib/sigles/favicon.ico">
</head>
<body style="margin:12px">
<center><img border=0 src=/imglib/sigles/powrexx2.gif></center>
<center><h1>RSP Test Page</h1></center>
<p>This page acts as a little REXX calulator. You enter a math expression
to be solved and REXX will print the answer.</p>
<?rexx
/*call setdll*/ /* this will load the HHNS' math Rexx package */
exp = ''
expresult = ''
numdigits = 9
do i = 1 to WWWARGS.0
select
when WWWARGS.i.!NAME = 'expression' then do
exp = WWWARGS.i.!VALUE
end
when WWWARGS.i.!NAME = 'numdigits' then do
numdigits = WWWARGS.i.!VALUE
end
otherwise nop
end
end
if exp <> '' then do
numeric digits numdigits
interpret 'expresult='exp
numeric digits
end
if expresult <> "" then do
say "<p> <b>Result of previous expression:</b>"
say "<br>"exp"="expresult
say "<p>"
end
?>
<form method="post" action="./rsptest2.rsp">
<p>Digits of precision
<select name="numdigits">
<?rexx
do i = 2 to 50
if numdigits = i then say '<option selected>'i'</option>'
else say '<option>'i'</option>'
end
?>
</select>
<p>Enter a legal REXX math expression :
<p>(You may use any valid builtin rexx function, + sin(a), cos(a), atan(a), sqrt(a), log(a), exp(a), pow(a, b),
which are part of the HHNS 'Common Rexx interface' package).
<p>
<?rexx
exp = strip(exp)
if exp == "" then exp = '1 + 4 * 10 / (3 + 7)'
say 'Expression : <input type="text" name="expression" size="50" maxlength="150" value="' exp '">'
?>
<p>
<input type="submit">
</form>
<p><a href="/cgi-bin/showprog.cri?/html/rsp/rsptest2.rsp">See the RSP page</a>
<p><a href=/rsp/>back to R.S.P. index</a>
</body>
</html>
<?rexx
syntax_err:
parse source os func pgm
say '<pre>'
say 'REXX syntax error:'
say format(sigl, 6) '*-*' sourceline(sigl)
say 'Error' rc 'running' pgm 'line' sigl': ' errortext(rc)
say '</pre>'
say '</body>'
say '</html>'
exit 0
?>