int _pSLcall_eos_handler (void) { int err, status = 0; if ((EOS_Callback_Handler == NULL) || (Handler_Active)) return 0; if ((0 != (err = _pSLang_Error)) && (-1 == _pSLang_push_error_context ())) return -1; Handler_Active++; if ((-1 == SLang_start_arg_list ()) || (-1 == SLang_end_arg_list ()) || (-1 == SLexecute_function (EOS_Callback_Handler))) { status = -1; set_bos_eos_handlers (NULL, NULL); } Handler_Active--; if (err) _pSLang_pop_error_context (status != 0); return status; }
/* int _pSLcall_debug_hook (char *file, int line, char *funct) */ int _pSLcall_debug_hook (SLFUTURE_CONST char *file, int line) { int status = 0, err; if (Debug_Hook == NULL) return 0; if (Debug_Handler_Active) return 0; if ((0 != (err = _pSLang_Error)) && (-1 == _pSLang_push_error_context ())) return -1; Debug_Handler_Active++; if ((-1 == SLang_start_arg_list ()) || (-1 == SLang_push_string (file)) || (-1 == SLclass_push_int_obj (SLANG_INT_TYPE, line)) || (-1 == SLang_end_arg_list ()) || (-1 == SLexecute_function (Debug_Hook))) { status = -1; set_debug_hook (NULL); } Debug_Handler_Active--; if (err) (void) _pSLang_pop_error_context (status != 0); return status; }
int _pSLcall_bos_handler (SLFUTURE_CONST char *file, int line) { int status = 0; int err; if (BOS_Callback_Handler == NULL) return 0; if (Handler_Active) return 0; if ((0 != (err = _pSLang_Error)) && (-1 == _pSLang_push_error_context ())) return -1; Handler_Active++; if ((-1 == SLang_start_arg_list ()) || (-1 == SLang_push_string (file)) || (-1 == SLclass_push_int_obj (SLANG_INT_TYPE, line)) || (-1 == SLang_end_arg_list ()) || (-1 == SLexecute_function (BOS_Callback_Handler))) { set_bos_eos_handlers (NULL, NULL); status = -1; } Handler_Active--; if (err) _pSLang_pop_error_context (status != 0); return status; }
int _pSLcall_bof_handler (SLFUTURE_CONST char *fun, SLFUTURE_CONST char *file) { int status = 0, err; if (BOF_Callback_Handler == NULL) return 0; if (Handler_Active) return 0; if ((0 != (err = _pSLang_Error)) && (-1 == _pSLang_push_error_context ())) return -1; Handler_Active++; if ((-1 == SLang_start_arg_list ()) || (-1 == SLang_push_string (fun)) || (-1 == SLang_push_string (file)) || (-1 == SLang_end_arg_list ()) || (-1 == SLexecute_function (BOF_Callback_Handler))) { set_bof_eof_handlers (NULL, NULL); status = -1; } Handler_Active--; if (err) _pSLang_pop_error_context (status != 0); return status; }
int _pSLang_push_error_context (void) { Error_Context_Type *c; if (NULL == (c = (Error_Context_Type *)SLmalloc (sizeof (Error_Context_Type)))) return -1; c->next = Error_Context; c->err = _pSLang_Error; c->err_cleared = 0; c->rethrow = 0; c->file = File_With_Error; c->function = Function_With_Error; /* steal pointers */ c->linenum = Linenum_With_Error; c->err_queue = Error_Message_Queue; File_With_Error = NULL; Function_With_Error = NULL; Linenum_With_Error = -1; if (NULL == (Error_Message_Queue = _pSLerr_new_error_queue (1))) { Error_Message_Queue = c->err_queue; SLfree ((char *) c); return -1; } Error_Context = c; SLKeyBoard_Quit = 0; c->object_was_thrown = (Object_Thrownp != NULL); if (c->object_was_thrown) { c->object_thrown = Object_Thrown; Object_Thrownp = NULL; } if (-1 == SLang_set_error (0)) { _pSLang_pop_error_context (1); return -1; } return 0; }