diff --git a/src/gap.c b/src/gap.c index 9445ba563fb..929751a1d2a 100644 --- a/src/gap.c +++ b/src/gap.c @@ -1103,13 +1103,20 @@ Obj FuncCALL_WITH_CATCH( Obj self, Obj func, volatile Obj args ) return res; } -Obj FuncJUMP_TO_CATCH( Obj self, Obj payload) +Obj FuncJUMP_TO_CATCH(Obj self, Obj payload) { - STATE(ThrownObject) = payload; - syLongjmp(&(STATE(ReadJmpError)), 1); - return 0; + STATE(ThrownObject) = payload; + if (STATE(JumpToCatchFunc) != 0) { + (*STATE(JumpToCatchFunc))(); + } + syLongjmp(&(STATE(ReadJmpError)), 1); + return 0; } +/* TL: UInt UserHasQuit; */ +/* TL: UInt UserHasQUIT; */ +UInt SystemErrorCode; + Obj FuncSetUserHasQuit( Obj Self, Obj value) { STATE(UserHasQuit) = INT_INTOBJ(value); @@ -3047,10 +3054,12 @@ void InitializeGap ( STATE(ThrownObject) = 0; STATE(UserHasQUIT) = 0; STATE(UserHasQuit) = 0; + STATE(JumpToCatchFunc) = 0; NrImportedGVars = 0; NrImportedFuncs = 0; + sysenviron = environ; /* get info structures for the built in modules */ diff --git a/src/gapstate.h b/src/gapstate.h index a1b7fb1c36c..d25b20dc3bb 100644 --- a/src/gapstate.h +++ b/src/gapstate.h @@ -123,6 +123,7 @@ typedef struct GAPState { Obj BaseShellContext; Obj ErrorLVars; // ErrorLVars as modified by DownEnv / UpEnv Int ErrorLLevel; // record where on the stack ErrorLVars is relative to the top, i.e. BaseShellContext + void (*JumpToCatchFunc)(); // Error catching function for GAP shared library /* From objects.c */ Int PrintObjIndex;