>
> > > Currently when an error occurs in PARI the PARI C library calls sigint 
> > > and Sage
>
> > Actually it does not: The SAGE version is patched so that it calls abort
> > which report a SIGABRT (instead of exit()).
>
> Sorry, I certainly meant "SIGABRT" rather than SIGINT.  Otherwise it's as I 
> say.
>
>  -- William

By the way I put my sources on sourceforge (http://pari-
python.cvs.sourceforge.net/pari-python/pari-python/)
The error handlers are in errors.cpp and errors.h
I use slightly modified version of the pari exception handling which
is implemented using setjmp/longjmp and you use it like this:
CATCH(CATCH_ALL) {
    // if error occures
} TRY {
    // do something
} ENDCATCH
I made similar macros, but I catch exceptions not when they arise in
PARI, but after PARI prints error message and calls
default_exception_handler, which I set as follows:
default_exception_handler = exception_handler,
where exception_handler simply should return 0 if there is a handler
installed. And the actual handler must be installed in GP_DATA->env
using setjmp(GP_DATA->env) (don't forget to store the old handler
somewhere and put it back afterwards)

I've recently worked on it so that it catches SIGINT (Ctrl-C).

First I turned off PARI's own signal handling. Instead of pari_init I
use this:

pari_init_opts(64000000, 500000, INIT_DFTm);

Then I install my own signal handler which simply raises pari
exception. I install the handler at the first CATCH and uninstall it
and return the Python's one on the last ENDCATCH.

Anton
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-forum
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to