[To reply replace "Aaron.Sloman.XX" with "A.Sloman"]
A delayed comment:
Adam C Knowles <ug55ack@cs.bham.ac.uk> writes:
> Date: Tue, 21 Mar 2000 20:06:47 +0000
>
> I don't know if this will help, but I've been getting the same error
> message sometimes, when I try to compile a procedure from the menu.
> However, each time I compile the procedure from the keyboard using the
> lcp or lmr commands, the procedure works perfectly.
That's a sure sign that one of your procedures is leaving something
on the stack which you did not intend. Don't just live with it: find
out why (e.g. using "trace" and "untrace: on your procedures to
narrow it down) and fix it. Otherwise it might cause a serious
problem in an extended version of the program, e.g. if you try to
run it from a button on a control panel.
You can also make procedures run stacklength(), save the result,
then later run it again to see if something has been left on or
removed from the stack in between.
lvars oldlen = stacklength();
.... suspect code ....
if stacklength() /== oldlen then mishap(.....) endif;
Instead of /== you could do separate tests for > and <.
Do not write
if oldlen /== stacklength() oldlen then mishap(.....) endif;
Why not? (Read TEACH STACK - section on infix operations.)
Revised Birmingham version accessible from
http://www.cs.bham.ac.uk/research/poplog/teach/stack
Aaron
|