Skip to content

Commit

Permalink
Add a callback to FuncJUMP_TO_CATCH
Browse files Browse the repository at this point in the history
This is another bit of the GAP dynamic library code. Again without tests
and without a guarantee that this will work in HPC-GAP
  • Loading branch information
markuspf authored and Markus Pfeiffer committed Feb 13, 2018
1 parent e755b88 commit 2186e56
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions src/gapstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2186e56

Please sign in to comment.