Jeroen Demeyer on Sun, 01 Sep 2013 10:57:52 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: pari_err(): callback function instead of longjmp()

On 2013-09-01 10:51, Karim Belabas wrote:
0) build a t_ERROR object ( to be returned by pari_err_last() )
1) return if we are catching errors ( within pari_CATCH / pari_ENDCATCH blocks )
2) flush stdout / stderr
3) print \n if needed, e.g. after print1()
4) notify: "error..." (+ call stack trace) or "user interrupt"
5) call cb_pari_handle_exception
6) restore PARI to a sane state (err_recover)
7) exit ( default cb_pari_err_recover is pari_exit() )

Since pari_err_last() allows to inspect (and use!) the t_ERROR object
containing everything we know about the error context, it is possible to
have step 5) occur before 4): the callback would print the message itself
if needed. But the current behaviour is more convenient if we want to
let PARI print that message.

Another "raw" callback that would be triggered between 1) and 2) ?
Yes, that's essentially my proposal.