[fpc-pascal] get_caller_frame

2019-11-19 Thread Ryan Joseph via fpc-pascal
I came across get_caller_frame  in some unrelated code and I was just curious 
about this so I wanted to ask.

What does get_caller_frame return exactly? Is this a pointer to a stack frame 
that could be copied to the heap? I'm still interested in how we could add some 
form of coroutine like behaviors to pascal and so I was wondering if we could 
copy/restore the current stack pointer so that SetJmp and LongJmp would not 
blow things up.

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] get_caller_frame

2019-11-19 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal  schrieb am
Mi., 20. Nov. 2019, 04:36:

> I came across get_caller_frame  in some unrelated code and I was just
> curious about this so I wanted to ask.
>
> What does get_caller_frame return exactly? Is this a pointer to a stack
> frame that could be copied to the heap? I'm still interested in how we
> could add some form of coroutine like behaviors to pascal and so I was
> wondering if we could copy/restore the current stack pointer so that SetJmp
> and LongJmp would not blow things up.
>

It returns the address of the caller's frame pointer. See also
https://www.freepascal.org/docs-html/rtl/system/get_caller_frame.html

It's mainly used in context of raising exceptions with the help of a second
function. See here:
https://freepascal.org/docs-html/current/ref/refse112.html#x227-24900017.1

Regards,
Sven

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal