- uiout = old_catcher->saved_uiout;
-
- xfree (old_catcher);
-}
-
-/* Catcher state machine. Returns non-zero if the m/c should be run
- again, zero if it should abort. */
-
-int
-catcher_state_machine (enum catcher_action action)
-{
- switch (current_catcher->state)
- {
- case CATCHER_CREATED:
- switch (action)
- {
- case CATCH_ITER:
- /* Allow the code to run the catcher. */
- current_catcher->state = CATCHER_RUNNING;
- return 1;
- default:
- internal_error (__FILE__, __LINE__, "bad state");
- }
- case CATCHER_RUNNING:
- switch (action)
- {
- case CATCH_ITER:
- /* No error/quit has occured. Just clean up. */
- catcher_pop ();
- return 0;
- case CATCH_ITER_1:
- current_catcher->state = CATCHER_RUNNING_1;
- return 1;
- case CATCH_THROWING:
- current_catcher->state = CATCHER_ABORTING;
- /* See also throw_exception. */
- return 1;
- default:
- internal_error (__FILE__, __LINE__, "bad switch");
- }
- case CATCHER_RUNNING_1:
- switch (action)
- {
- case CATCH_ITER:
- /* The did a "break" from the inner while loop. */
- catcher_pop ();
- return 0;
- case CATCH_ITER_1:
- current_catcher->state = CATCHER_RUNNING;
- return 0;
- case CATCH_THROWING:
- current_catcher->state = CATCHER_ABORTING;
- /* See also throw_exception. */
- return 1;
- default:
- internal_error (__FILE__, __LINE__, "bad switch");
- }
- case CATCHER_ABORTING:
- switch (action)
- {
- case CATCH_ITER:
- {
- struct exception exception = *current_catcher->exception;
- if (current_catcher->mask & RETURN_MASK (exception.reason))
- {
- /* Exit normally if this catcher can handle this
- exception. The caller analyses the func return
- values. */
- catcher_pop ();
- return 0;
- }
- /* The caller didn't request that the event be caught,
- relay the event to the next containing
- catch_errors(). */
- catcher_pop ();
- throw_exception (exception);
- }
- default:
- internal_error (__FILE__, __LINE__, "bad state");
- }
- default:
- internal_error (__FILE__, __LINE__, "bad switch");
- }
-}
-
-/* Return EXCEPTION to the nearest containing catch_errors(). */