[slang-users] debug: points where left on the stack
Marko Mahnic
marko.mahnic at email.si
Tue Aug 23 12:02:22 EDT 2005
Joerg Sommer wrote:
> Marko Mahnic <marko.mahnic at email.si> wrote:
>
>>Such byte-compiled functions would look like this
>> A = stack_pointer
>> .... compiled body ....
>> if (stack_pointer - A != _NRESULTS) do_error(...)
>
>
> This can be done with slang? Is it possible for an eos handler to get
> the number of arguments of return?
No. I was just suggesting a solution (that is why _strict_return and
_NRESULTS are not defined).
The SLang byte-compiler (C code) would have to be modified to implement
such a feature. The first (A=...) and the last line (if ...) would
be genrated by the compiler when _strict_return=1 but not
when _strict_return=0.
AFAIK this is similar to what _boseos_info does when you enable_stack_check().
I just rememberd another thing. The upper code does not take into account
the passed parameters. The first line should probably be
A = stack_pointer - _NARGS
If _NRESULTS is not explicitly set within the function it would be calculated
from the return statement(s). Also, all return statements would have to
return the same number of results. Would SLang loose too much?
Marko
More information about the slang-users-l
mailing list