slang-users mailing list

[2005 Date Index] [2005 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [slang-users] debug: points where left on the stack


Joerg Sommer wrote:
> Marko Mahnic <marko.mahnic@xxxxxxxx> 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

_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html


[2005 date index] [2005 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]