Discussion:
BlackBox interactivity issues
(too old to reply)
Xcriber51
2007-03-31 01:25:51 UTC
Permalink
Hi

A BlackBox question. I have this piece of code (from Wirth's "Programming
In Oberon") adapted to BlackBox's IDE:

MODULE Oscillation;

IMPORT StdLog, Math;

PROCEDURE Do*(n: INTEGER; r: REAL);
CONST dx = 0.196349375; (*pi/16*)
VAR i: INTEGER;
x, y: REAL;
BEGIN
i := 0; x := 0.0;

REPEAT
x := x + dx; i := i+1;
y := Math.Exp(-r*x) * Math.Cos(x);
StdLog.Real(x); StdLog.Real(y); StdLog.Ln()
UNTIL i >= n;

END Do;

END Oscillation.

However, when I try to call this as

! Oscillation.Do 2 7

(or "Oscillation.Do 2,7", "Oscillation.Do(2,7)", etc., the way the
parameters are passed is irrelevant; I tried all combinations), I keep
getting this error:

command error: incompatible parameter list in Oscillation.Do

(As you've probably guessed, I get the same error with some other trials
where I try to call a module procedure again with parameters.)

Why*

Also, what is the easiest way to create interactive programs in BlackBox
where I can just enter a few parameters to a program and call any
procedure in the module I like, pass arguments to it, and get results
using, say, the Log area?

Thanks


-- Ken
Chris Burrows
2007-03-31 03:43:36 UTC
Permalink
Post by Xcriber51
However, when I try to call this as
! Oscillation.Do 2 7
(or "Oscillation.Do 2,7", "Oscillation.Do(2,7)", etc., the way the
parameters are passed is irrelevant; I tried all combinations), I keep
command error: incompatible parameter list in Oscillation.Do
(As you've probably guessed, I get the same error with some other trials
where I try to call a module procedure again with parameters.)
Why*
There are limited number of parameter combinations allowed in BlackBox when
you execute an exported procedure in this way. Additionally the parameters
can only be strings and integers. For further information see:

BlackBox > Help > Contents > User Manuals > Dev Subsystem > Executing
commands

Click on the link "The allowed parameter lists for commands are documented
with module StdInterpreter" to see the list of allowed combinations.

One solution for your particular example is to call Oscillation.Do
indirectly, with an additional procedure 'DoInteractive' that does have an
allowable sequence of parameters. e.g.


MODULE Oscillation;

IMPORT StdLog, Math, Strings;
...
...
...

PROCEDURE DoInteractive*(realStr: ARRAY OF CHAR; n: INTEGER);
VAR
r: REAL; res: INTEGER;
BEGIN
Strings.StringToReal(realStr, r, res);
Do(n, r)
END DoInteractive;

END Oscillation.

! "Oscillation.DoInteractive('7.0', 2)"


I'll attempt to answer your second question "what is the easiest way to
create interactive programs in BlackBox" later, unless somebody else does so
in the meantime.

--
Chris Burrows
CFB Software
http://www.cfbsoftware.com/gpcp
Hvl
2007-03-31 16:42:07 UTC
Permalink
Hi
for allowed parameter lists have a look at DEFINITION StdInterpreter.

Another possible way of entering the parameters is the following

MODULE Oscillation;

IMPORT In, StdLog, Math;

PROCEDURE Do*;
CONST dx =3D 0.196349375; (*pi/16*)
VAR i, n: INTEGER;
r, x, y: REAL;
BEGIN
In.Open; In.Int(n); In.Real(r);
IF In.Done THEN
i :=3D 0; x :=3D 0.0;

REPEAT
x :=3D x + dx; i :=3D i+1;
y :=3D Math.Exp(-r*x) * Math.Cos(x);
StdLog.Real(x); StdLog.Real(y); StdLog.Ln()
UNTIL i >=3D n;
END;

END Do;

END Oscillation.

Good Luck

Harro von Lavergne

www.lahini.de
Hi
A BlackBox question. I have this piece of code (from Wirth's "Programm=
ing
MODULE Oscillation;
IMPORT StdLog, Math;
PROCEDURE Do*(n: INTEGER; r: REAL);
CONST dx =3D 0.196349375; (*pi/16*)
VAR i: INTEGER;
x, y: REAL;
BEGIN
i :=3D 0; x :=3D 0.0;
REPEAT
x :=3D x + dx; i :=3D i+1;
y :=3D Math.Exp(-r*x) * Math.Cos(x);
StdLog.Real(x); StdLog.Real(y); StdLog.Ln()
UNTIL i >=3D n;
END Do;
END Oscillation.
However, when I try to call this as
! Oscillation.Do 2 7
(or "Oscillation.Do 2,7", "Oscillation.Do(2,7)", etc., the way the
parameters are passed is irrelevant; I tried all combinations), I keep=
command error: incompatible parameter list in Oscillation.Do
(As you've probably guessed, I get the same error with some other tria=
ls
where I try to call a module procedure again with parameters.)
Why*
Also, what is the easiest way to create interactive programs in BlackB=
ox
where I can just enter a few parameters to a program and call any
procedure in the module I like, pass arguments to it, and get results
using, say, the Log area?
Thanks
-- Ken
-- =

Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Loading...