/* Note that if desired, one can also catch all errors by adding by adding a global variable, IntrCatching, and within UNIX_Catch(): Uint intrCatching = IntrCatching; ... IntrCatching = intrCatching; Then upon entering src/gap.c:ErrorMode(), do UNIX_Throw() In this case, the slave wouldn't need to set BreakOnError = 0 */ Obj UNIX_Catch( Obj self, Obj fnc, Obj arg2 ) { Obj result; /* gcc -Wall complains if result is initialized to Fail here */ Bag currLVars = STATE(CurrLVars); jmp_buf readJmpError; SYS_SIG_T (*savedSignal)(int); OLD_BRK_CURR_STAT /* old executing statement */ REM_BRK_CURR_STAT(); result = Fail; if ( ! MPI_READ_ERROR() ) result = CallFuncList( fnc, arg2 ); else { while ( STATE(CurrLVars) != currLVars && STATE(CurrLVars) != STATE(BottomLVars) ) SWITCH_TO_OLD_LVARS( BRK_CALL_FROM() ); assert( STATE(CurrLVars) == currLVars ); ClearError(); SyIsIntr(); /* clear the interrupt, too */ } MPI_READ_DONE(); RES_BRK_CURR_STAT(); return result; }
Obj GAP_CallFuncList(Obj func, Obj args) { return CallFuncList(func, args); }