note
	description: "[
		Exception manager. 
		The manager handles all common operations of exception mechanism and interaction with the ISE runtime.
	]"
	legal: "See notice at end of class."
	status: "See notice at end of class."
	date: "$Date: 2020-05-19 14:29:33 +0000 (Tue, 19 May 2020) $"
	revision: "$Revision: 104259 $"

class 
	ISE_EXCEPTION_MANAGER

create 
	default_create

feature {NONE} -- Initialization

	default_create
			-- Process instances of classes with no creation clause.
			-- (Default: do nothing.)
			-- (from ANY)
		do
		end
	
feature -- Access

	generating_type: TYPE [detachable ISE_EXCEPTION_MANAGER]
			-- Type of current object
			-- (type of which it is a direct instance)
			-- (from ANY)
		external
			"built_in"
		ensure -- from ANY
			generating_type_not_void: Result /= Void
		end

	generator: STRING_8
			-- Name of current object's generating class
			-- (base class of the type of which it is a direct instance)
			-- (from ANY)
		external
			"built_in"
		ensure -- from ANY
			generator_not_void: Result /= Void
			generator_not_empty: not Result.is_empty
		end

	last_exception: detachable EXCEPTION
			-- Last exception
		do
			Result := Last_exception_cell.item
		ensure -- from EXCEPTION_MANAGER
			instance_free: class
		end
	
feature {NONE} -- Access

	exception_data: detachable TUPLE [code: INTEGER_32; signal_code: INTEGER_32; error_code: INTEGER_32; tag: STRING_8; recipient: STRING_8; eclass: STRING_8; rf_routine: STRING_8; rf_class: STRING_8; trace: STRING_8; line_number: INTEGER_32; is_invariant_entry: BOOLEAN]
			-- Exception data
			-- Used to store temporary exception information,
			-- which is used to create exception object later.
		do
			Result := Exception_data_cell.item
		ensure
			instance_free: class
		end
	
feature -- Comparison

	frozen deep_equal (a: detachable ANY; b: like arg #1): BOOLEAN
			-- Are a and b either both void
			-- or attached to isomorphic object structures?
			-- (from ANY)
		do
			if a = Void then
				Result := b = Void
			else
				Result := b /= Void and then a.is_deep_equal (b)
			end
		ensure -- from ANY
			instance_free: class
			shallow_implies_deep: standard_equal (a, b) implies Result
			both_or_none_void: (a = Void) implies (Result = (b = Void))
			same_type: (Result and (a /= Void)) implies (b /= Void and then a.same_type (b))
			symmetric: Result implies deep_equal (b, a)
		end

	frozen equal (a: detachable ANY; b: like arg #1): BOOLEAN
			-- Are a and b either both void or attached
			-- to objects considered equal?
			-- (from ANY)
		do
			if a = Void then
				Result := b = Void
			else
				Result := b /= Void and then a.is_equal (b)
			end
		ensure -- from ANY
			instance_free: class
			definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.is_equal (b))
		end

	frozen is_deep_equal alias "≡≡≡" (other: ISE_EXCEPTION_MANAGER): BOOLEAN
			-- Are Current and other attached to isomorphic object structures?
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
		external
			"built_in"
		ensure -- from ANY
			shallow_implies_deep: standard_is_equal (other) implies Result
			same_type: Result implies same_type (other)
			symmetric: Result implies other.is_deep_equal (Current)
		end

	is_equal (other: ISE_EXCEPTION_MANAGER): BOOLEAN
			-- Is other attached to an object considered
			-- equal to current object?
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
		external
			"built_in"
		ensure -- from ANY
			symmetric: Result implies other ~ Current
			consistent: standard_is_equal (other) implies Result
		end

	frozen standard_equal (a: detachable ANY; b: like arg #1): BOOLEAN
			-- Are a and b either both void or attached to
			-- field-by-field identical objects of the same type?
			-- Always uses default object comparison criterion.
			-- (from ANY)
		do
			if a = Void then
				Result := b = Void
			else
				Result := b /= Void and then a.standard_is_equal (b)
			end
		ensure -- from ANY
			instance_free: class
			definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.standard_is_equal (b))
		end

	frozen standard_is_equal alias "" (other: ISE_EXCEPTION_MANAGER): BOOLEAN
			-- Is other attached to an object of the same type
			-- as current object, and field-by-field identical to it?
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
		external
			"built_in"
		ensure -- from ANY
			same_type: Result implies same_type (other)
			symmetric: Result implies other.standard_is_equal (Current)
		end
	
feature -- Status report

	conforms_to (other: ANY): BOOLEAN
			-- Does type of current object conform to type
			-- of other (as per Eiffel: The Language, chapter 13)?
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
		external
			"built_in"
		end

	is_caught (a_exception: TYPE [detachable EXCEPTION]): BOOLEAN
			-- If set, type of a_exception is raised.
		do
			Result := not Ignored_exceptions.has (a_exception.type_id)
		ensure -- from EXCEPTION_MANAGER
			instance_free: class
			not_is_ignored: Result = not is_ignored (a_exception)
		end

	is_ignorable (a_exception: TYPE [detachable EXCEPTION]): BOOLEAN
			-- If set, type of a_exception is ignorable.
		do
			Result := not Unignorable_exceptions.has (a_exception.type_id)
		ensure -- from EXCEPTION_MANAGER
			instance_free: class
		end

	is_ignored (a_exception: TYPE [detachable EXCEPTION]): BOOLEAN
			-- If set, type of a_exception is not raised.
		do
			Result := Ignored_exceptions.has (a_exception.type_id)
		ensure -- from EXCEPTION_MANAGER
			instance_free: class
			not_is_caught: Result = not is_caught (a_exception)
		end

	is_raisable (a_exception: TYPE [detachable EXCEPTION]): BOOLEAN
			-- If set, type of a_exception is raisable.
		do
			Result := not Unraisable_exceptions.has (a_exception.type_id)
		ensure -- from EXCEPTION_MANAGER
			instance_free: class
		end

	same_type (other: ANY): BOOLEAN
			-- Is type of current object identical to type of other?
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
		external
			"built_in"
		ensure -- from ANY
			definition: Result = (conforms_to (other) and other.conforms_to (Current))
		end
	
feature -- Status setting

	catch (a_exception: TYPE [detachable EXCEPTION])
			-- Set type of a_exception is_ignored.
		require -- from EXCEPTION_MANAGER
			a_exception_not_void: a_exception /= Void
		do
			Ignored_exceptions.remove (a_exception.type_id)
		ensure -- from EXCEPTION_MANAGER
			instance_free: class
			is_ignored: not is_ignored (a_exception)
		end

	ignore (a_exception: TYPE [detachable EXCEPTION])
			-- Make sure that any exception of type a_exception will be
			-- ignored. This is not the default.
		require -- from EXCEPTION_MANAGER
			a_exception_not_void: a_exception /= Void
			is_ignorable: is_ignorable (a_exception)
		local
			l_type: INTEGER_32
		do
			l_type := a_exception.type_id;
			Ignored_exceptions.force (l_type, l_type)
		ensure -- from EXCEPTION_MANAGER
			instance_free: class
			is_caught: is_ignored (a_exception)
		end

	set_is_ignored (a_exception: TYPE [detachable EXCEPTION]; a_ignored: BOOLEAN)
			-- Set type of a_exception to be a_ignored.
		require -- from EXCEPTION_MANAGER
			a_exception_not_void: a_exception /= Void
			a_ignored_implies_is_ignorable: a_ignored implies is_ignorable (a_exception)
		do
			if a_ignored then
				ignore (a_exception)
			else
				catch (a_exception)
			end
		ensure -- from EXCEPTION_MANAGER
			instance_free: class
			is_ignored_set: is_ignored (a_exception) = a_ignored
		end
	
feature {NONE} -- Element change

	set_exception_data (code: INTEGER_32; new_obj: BOOLEAN; signal_code: INTEGER_32; error_code: INTEGER_32; tag, recipient, eclass: STRING_8; rf_routine, rf_class: STRING_8; trace: STRING_8; line_number: INTEGER_32; is_invariant_entry: BOOLEAN)
			-- Set exception data.
		do
			Exception_data_cell.put ([code, signal_code, error_code, tag, recipient, eclass, rf_routine, rf_class, trace, line_number, is_invariant_entry])
			if new_obj then
				if attached {EXCEPTION} exception_from_data as e then
					set_last_exception (e)
				end
			else
				check
					last_exception_attached: attached last_exception as l_exception
				then
					l_exception.set_exception_trace (trace);
					l_exception.set_recipient_name (recipient);
					l_exception.set_type_name (eclass)
				end
			end
		ensure
			instance_free: class
		end

	set_last_exception (a_last_exception: detachable EXCEPTION)
			-- Set last_exception with a_last_exception.
		do
			Last_exception_cell.put (a_last_exception)
		ensure
			instance_free: class
			last_exception_set: Last_exception_cell.item = a_last_exception
		end
	
feature -- Duplication

	frozen clone (other: detachable ANY): like other
		obsolete "Use `twin' instead. [2017-05-31]"
			-- Void if other is void; otherwise new object
			-- equal to other
			--
			-- For non-void other, clone calls copy;
			-- to change copying/cloning semantics, redefine copy.
			-- (from ANY)
		do
			if other /= Void then
				Result := other.twin
			end
		ensure -- from ANY
			instance_free: class
			equal: Result ~ other
		end

	copy (other: ISE_EXCEPTION_MANAGER)
			-- Update current object using fields of object attached
			-- to other, so as to yield equal objects.
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
			type_identity: same_type (other)
		external
			"built_in"
		ensure -- from ANY
			is_equal: Current ~ other
		end

	frozen deep_clone (other: detachable ANY): like other
		obsolete "Use `deep_twin' instead. [2017-05-31]"
			-- Void if other is void: otherwise, new object structure
			-- recursively duplicated from the one attached to other
			-- (from ANY)
		do
			if other /= Void then
				Result := other.deep_twin
			end
		ensure -- from ANY
			instance_free: class
			deep_equal: deep_equal (other, Result)
		end

	frozen deep_copy (other: ISE_EXCEPTION_MANAGER)
			-- Effect equivalent to that of:
			--		copy (other . deep_twin)
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
		do
			copy (other.deep_twin)
		ensure -- from ANY
			deep_equal: deep_equal (Current, other)
		end

	frozen deep_twin: ISE_EXCEPTION_MANAGER
			-- New object structure recursively duplicated from Current.
			-- (from ANY)
		external
			"built_in"
		ensure -- from ANY
			deep_twin_not_void: Result /= Void
			deep_equal: deep_equal (Current, Result)
		end

	frozen standard_clone (other: detachable ANY): like other
		obsolete "Use `standard_twin' instead. [2017-05-31]"
			-- Void if other is void; otherwise new object
			-- field-by-field identical to other.
			-- Always uses default copying semantics.
			-- (from ANY)
		do
			if other /= Void then
				Result := other.standard_twin
			end
		ensure -- from ANY
			instance_free: class
			equal: standard_equal (Result, other)
		end

	frozen standard_copy (other: ISE_EXCEPTION_MANAGER)
			-- Copy every field of other onto corresponding field
			-- of current object.
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
			type_identity: same_type (other)
		external
			"built_in"
		ensure -- from ANY
			is_standard_equal: standard_is_equal (other)
		end

	frozen standard_twin: ISE_EXCEPTION_MANAGER
			-- New object field-by-field identical to other.
			-- Always uses default copying semantics.
			-- (from ANY)
		external
			"built_in"
		ensure -- from ANY
			standard_twin_not_void: Result /= Void
			equal: standard_equal (Result, Current)
		end

	frozen twin: ISE_EXCEPTION_MANAGER
			-- New object equal to Current
			-- twin calls copy; to change copying/twinning semantics, redefine copy.
			-- (from ANY)
		external
			"built_in"
		ensure -- from ANY
			twin_not_void: Result /= Void
			is_equal: Result ~ Current
		end
	
feature -- Basic operations

	frozen as_attached: attached ISE_EXCEPTION_MANAGER
		obsolete "Remove calls to this feature. [2017-05-31]"
			-- Attached version of Current.
			-- (Can be used during transitional period to convert
			-- non-void-safe classes to void-safe ones.)
			-- (from ANY)
		do
			Result := Current
		end

	frozen default: detachable ISE_EXCEPTION_MANAGER
			-- Default value of object's type
			-- (from ANY)
		do
		end

	frozen default_pointer: POINTER
			-- Default value of type POINTER
			-- (Avoid the need to write p.default for
			-- some p of type POINTER.)
			-- (from ANY)
		do
		ensure -- from ANY
			instance_free: class
		end

	default_rescue
			-- Process exception for routines with no Rescue clause.
			-- (Default: do nothing.)
			-- (from ANY)
		do
		end

	frozen do_nothing
			-- Execute a null action.
			-- (from ANY)
		do
		ensure -- from ANY
			instance_free: class
		end
	
feature {NONE} -- Implementation

	developer_raise (a_code: INTEGER_32; a_meaning, a_message: POINTER)
			-- Raise an exception
		external
			"built_in static"
		ensure
			instance_free: class
		end

	exception_from_data: detachable EXCEPTION
			-- Create an exception object exception_data
		local
			t: detachable EXCEPTION
		do
			if attached exception_data as l_data and then attached {EXCEPTION} exception_from_code (l_data.code) as e then
				if attached {ROUTINE_FAILURE} e as l_rf then
					t := last_exception
					if t /= Void then
						e.set_throwing_exception (t)
					end;
					l_rf.set_routine_name (l_data.rf_routine);
					l_rf.set_class_name (l_data.rf_class)
				elseif attached {OLD_VIOLATION} e as l_ov then
					t := last_exception
					if t /= Void then
						e.set_throwing_exception (t)
					end
				else
					if attached {INVARIANT_VIOLATION} e as l_inva then
						l_inva.set_is_entry (l_data.is_invariant_entry)
					elseif attached {OPERATING_SYSTEM_SIGNAL_FAILURE} e as l_sig then
						l_sig.set_signal_code (l_data.signal_code)
					elseif attached {IO_FAILURE} e as l_io then
						l_io.set_error_code (l_data.error_code)
					elseif attached {OPERATING_SYSTEM_FAILURE} e as l_sys then
						l_sys.set_error_code (l_data.error_code)
					elseif attached {COM_FAILURE} e as l_com then
						l_com.set_hresult_code (l_data.signal_code);
						l_com.set_exception_information (l_data.tag)
					end
					if in_rescue then
						t := last_exception
					end
					if t = Void then
						t := e
					end;
					e.set_throwing_exception (t)
				end;
				e.set_exception_trace (l_data.trace);
				e.set_description (l_data.tag);
				e.set_recipient_name (l_data.recipient);
				e.set_type_name (l_data.eclass)
				Result := e
			end
		ensure
			instance_free: class
		end

	frozen free_preallocated_trace
		local
			e: detachable EXCEPTION
		do
			e := No_memory_exception_object_cell.item
			if e /= Void then
				e.set_description (Void)
			end
		ensure
			instance_free: class
		end

	frozen in_rescue: BOOLEAN
			-- Current execution is during rescue?
		external
			"C use %"eif_except.h%""
		alias
			"eif_is_in_rescue"
		ensure
			instance_free: class
		end

	frozen init_exception_manager
			-- Call once routines to create objects beforehand,
			-- in case it goes into critical session (Stack overflow, no memory etc.)
			-- The creations doesn't fail.
		do
			Ignored_exceptions.do_nothing;
			Unignorable_exceptions.do_nothing;
			Unraisable_exceptions.do_nothing;
			Exception_data_cell.do_nothing;
			Last_exception_cell.do_nothing;
			No_memory_exception_object_cell.do_nothing
		ensure
			instance_free: class
		end

	is_code_ignored (a_code: INTEGER_32): BOOLEAN
			-- Is exception of a_code ignored?
		do
			if attached {TYPE [detachable EXCEPTION]} type_of_code (a_code) as l_type then
				Result := is_ignored (l_type)
			else
				Result := True
			end
		ensure
			instance_free: class
		end

	once_raise (a_exception: EXCEPTION)
			-- Called by runtime to raise saved exception for once routines.
		require
			a_exception_not_void: a_exception /= Void
		local
			p_meaning, p_message: POINTER
		do
			if not a_exception.is_ignored then
				if in_rescue then
					a_exception.original.set_throwing_exception (last_exception)
				end
				set_last_exception (a_exception)
				p_meaning := default_pointer
				if attached {C_STRING} a_exception.c_description as m then
					p_message := m.item
				else
					p_message := default_pointer
				end
				developer_raise (a_exception.code, p_meaning, p_message)
			end
		ensure
			instance_free: class
		end
	
feature {NONE} -- Cells

	Exception_data_cell: CELL [detachable TUPLE [code: INTEGER_32; signal_code: INTEGER_32; error_code: INTEGER_32; tag: STRING_8; recipient: STRING_8; eclass: STRING_8; rf_routine: STRING_8; rf_class: STRING_8; trace: STRING_8; line_number: INTEGER_32; is_invariant_entry: BOOLEAN]]
			-- Cell to hold current exception data
		once
			create Result.put (Void)
		ensure
			instance_free: class
		end

	Last_exception_cell: CELL [detachable EXCEPTION]
			-- Cell to hold last exception
		once
			create Result.put (Void)
		ensure
			instance_free: class
		end

	No_memory_exception_object_cell: CELL [NO_MORE_MEMORY]
			-- No more memory exception object.
		local
			l_nomem: NO_MORE_MEMORY
		once
			create l_nomem;
			l_nomem.set_exception_trace (create {STRING_8}.make (4096))
			create Result.put (l_nomem)
		ensure
			instance_free: class
		end
	
feature {EXCEPTIONS}{EXCEPTIONS} -- Compatibility support

	exception_from_code (a_code: INTEGER_32): detachable EXCEPTION
			-- Create exception object from a_code
		local
			l_rt_panic: EIFFEL_RUNTIME_PANIC
			l_io_failure: IO_FAILURE
			l_no_more_mem: NO_MORE_MEMORY
		do
			inspect a_code
			when {EXCEP_CONST}.void_call_target then
				create {VOID_TARGET} Result
			when {EXCEP_CONST}.no_more_memory then
				l_no_more_mem := No_memory_exception_object_cell.item;
				l_no_more_mem.set_code ({EXCEP_CONST}.no_more_memory)
				Result := l_no_more_mem
			when {EXCEP_CONST}.precondition then
				create {PRECONDITION_VIOLATION} Result
			when {EXCEP_CONST}.postcondition then
				create {POSTCONDITION_VIOLATION} Result
			when {EXCEP_CONST}.floating_point_exception then
				create {FLOATING_POINT_FAILURE} Result
			when {EXCEP_CONST}.class_invariant then
				create {INVARIANT_VIOLATION} Result
			when {EXCEP_CONST}.check_instruction then
				create {CHECK_VIOLATION} Result
			when {EXCEP_CONST}.routine_failure then
				create {ROUTINE_FAILURE} Result
			when {EXCEP_CONST}.incorrect_inspect_value then
				create {BAD_INSPECT_VALUE} Result
			when {EXCEP_CONST}.loop_variant then
				create {VARIANT_VIOLATION} Result
			when {EXCEP_CONST}.loop_invariant then
				create {LOOP_INVARIANT_VIOLATION} Result
			when {EXCEP_CONST}.signal_exception then
				create {OPERATING_SYSTEM_SIGNAL_FAILURE} Result
			when {EXCEP_CONST}.eiffel_runtime_panic then
				create l_rt_panic;
				l_rt_panic.set_code ({EXCEP_CONST}.eiffel_runtime_panic)
				Result := l_rt_panic
			when {EXCEP_CONST}.rescue_exception then
				create {RESCUE_FAILURE} Result
			when {EXCEP_CONST}.out_of_memory then
				l_no_more_mem := No_memory_exception_object_cell.item;
				l_no_more_mem.set_code ({EXCEP_CONST}.out_of_memory)
				Result := l_no_more_mem
			when {EXCEP_CONST}.resumption_failed then
				create {RESUMPTION_FAILURE} Result
			when {EXCEP_CONST}.create_on_deferred then
				create {CREATE_ON_DEFERRED} Result
			when {EXCEP_CONST}.external_exception then
				create {EXTERNAL_FAILURE} Result
			when {EXCEP_CONST}.void_assigned_to_expanded then
				create {VOID_ASSIGNED_TO_EXPANDED} Result
			when {EXCEP_CONST}.exception_in_signal_handler then
				create {EXCEPTION_IN_SIGNAL_HANDLER_FAILURE} Result
			when {EXCEP_CONST}.io_exception then
				create l_io_failure;
				l_io_failure.set_code ({EXCEP_CONST}.io_exception)
				Result := l_io_failure
			when {EXCEP_CONST}.operating_system_exception then
				create {OPERATING_SYSTEM_FAILURE} Result
			when {EXCEP_CONST}.retrieve_exception then
				create {MISMATCH_FAILURE} Result
			when {EXCEP_CONST}.developer_exception then
				create {DEVELOPER_EXCEPTION} Result
			when {EXCEP_CONST}.eiffel_runtime_fatal_error then
				create l_rt_panic;
				l_rt_panic.set_code ({EXCEP_CONST}.eiffel_runtime_fatal_error)
				Result := l_rt_panic
			when {EXCEP_CONST}.dollar_applied_to_melted_feature then
				create {ADDRESS_APPLIED_TO_MELTED_FEATURE} Result
			when {EXCEP_CONST}.runtime_io_exception then
				create l_io_failure;
				l_io_failure.set_code ({EXCEP_CONST}.runtime_io_exception)
				Result := l_io_failure
			when {EXCEP_CONST}.com_exception then
				create {COM_FAILURE} Result
			when {EXCEP_CONST}.runtime_check_exception then
				create {CHECK_VIOLATION} Result
			when {EXCEP_CONST}.old_exception then
				create {OLD_VIOLATION} Result
			when {EXCEP_CONST}.serialization_exception then
				create {SERIALIZATION_FAILURE} Result
			else
			end
		ensure -- from EXCEPTION_MANAGER
			instance_free: class
		end

	type_of_code (a_code: INTEGER_32): detachable TYPE [EXCEPTION]
			-- Exception type of a_code
		do
			inspect a_code
			when {EXCEP_CONST}.void_call_target then
				Result := {VOID_TARGET}
			when {EXCEP_CONST}.no_more_memory then
				Result := {NO_MORE_MEMORY}
			when {EXCEP_CONST}.precondition then
				Result := {PRECONDITION_VIOLATION}
			when {EXCEP_CONST}.postcondition then
				Result := {POSTCONDITION_VIOLATION}
			when {EXCEP_CONST}.floating_point_exception then
				Result := {FLOATING_POINT_FAILURE}
			when {EXCEP_CONST}.class_invariant then
				Result := {INVARIANT_VIOLATION}
			when {EXCEP_CONST}.check_instruction then
				Result := {CHECK_VIOLATION}
			when {EXCEP_CONST}.routine_failure then
				Result := {ROUTINE_FAILURE}
			when {EXCEP_CONST}.incorrect_inspect_value then
				Result := {BAD_INSPECT_VALUE}
			when {EXCEP_CONST}.loop_variant then
				Result := {VARIANT_VIOLATION}
			when {EXCEP_CONST}.loop_invariant then
				Result := {LOOP_INVARIANT_VIOLATION}
			when {EXCEP_CONST}.signal_exception then
				Result := {OPERATING_SYSTEM_SIGNAL_FAILURE}
			when {EXCEP_CONST}.eiffel_runtime_panic then
				Result := {EIFFEL_RUNTIME_PANIC}
			when {EXCEP_CONST}.rescue_exception then
				Result := {RESCUE_FAILURE}
			when {EXCEP_CONST}.out_of_memory then
				Result := {NO_MORE_MEMORY}
			when {EXCEP_CONST}.resumption_failed then
				Result := {RESUMPTION_FAILURE}
			when {EXCEP_CONST}.create_on_deferred then
				Result := {CREATE_ON_DEFERRED}
			when {EXCEP_CONST}.external_exception then
				Result := {EXTERNAL_FAILURE}
			when {EXCEP_CONST}.void_assigned_to_expanded then
				Result := {VOID_ASSIGNED_TO_EXPANDED}
			when {EXCEP_CONST}.exception_in_signal_handler then
				Result := {EXCEPTION_IN_SIGNAL_HANDLER_FAILURE}
			when {EXCEP_CONST}.io_exception then
				Result := {IO_FAILURE}
			when {EXCEP_CONST}.operating_system_exception then
				Result := {OPERATING_SYSTEM_FAILURE}
			when {EXCEP_CONST}.retrieve_exception then
				Result := {MISMATCH_FAILURE}
			when {EXCEP_CONST}.developer_exception then
				Result := {DEVELOPER_EXCEPTION}
			when {EXCEP_CONST}.eiffel_runtime_fatal_error then
				Result := {EIFFEL_RUNTIME_PANIC}
			when {EXCEP_CONST}.dollar_applied_to_melted_feature then
				Result := {ADDRESS_APPLIED_TO_MELTED_FEATURE}
			when {EXCEP_CONST}.runtime_io_exception then
				Result := {IO_FAILURE}
			when {EXCEP_CONST}.com_exception then
				Result := {COM_FAILURE}
			when {EXCEP_CONST}.runtime_check_exception then
				Result := {CHECK_VIOLATION}
			when {EXCEP_CONST}.old_exception then
				Result := {OLD_VIOLATION}
			when {EXCEP_CONST}.serialization_exception then
				Result := {SERIALIZATION_FAILURE}
			else
				Result := Void
			end
		ensure -- from EXCEPTION_MANAGER
			instance_free: class
		end
	
feature {NONE} -- Implementation, ignoring

	Ignored_exceptions: HASH_TABLE [INTEGER_32, INTEGER_32]
			-- Ignored exceptions
		once
			create Result.make (0)
		ensure
			instance_free: class
		end

	Unignorable_exceptions: HASH_TABLE [INTEGER_32, INTEGER_32]
			-- Unignorable exceptions
		local
			l_type: INTEGER_32
		once
			create Result.make (1)
			l_type := ({VOID_TARGET}).type_id;
			Result.force (l_type, l_type)
		ensure
			instance_free: class
		end

	Unraisable_exceptions: HASH_TABLE [INTEGER_32, INTEGER_32]
			-- Unraisable exceptions
		local
			l_type: INTEGER_32
		once
			create Result.make (2)
			l_type := ({ROUTINE_FAILURE}).type_id;
			Result.force (l_type, l_type)
			l_type := ({OLD_VIOLATION}).type_id;
			Result.force (l_type, l_type)
		ensure
			instance_free: class
		end
	
feature -- Output

	Io: STD_FILES
			-- Handle to standard file setup
			-- (from ANY)
		once
			create Result;
			Result.set_output_default
		ensure -- from ANY
			instance_free: class
			io_not_void: Result /= Void
		end

	out: STRING_8
			-- New string containing terse printable representation
			-- of current object
			-- (from ANY)
		do
			Result := tagged_out
		ensure -- from ANY
			out_not_void: Result /= Void
		end

	print (o: detachable ANY)
			-- Write terse external representation of o
			-- on standard output.
			-- (from ANY)
		local
			s: READABLE_STRING_8
		do
			if attached o then
				s := o.out
				if attached {READABLE_STRING_32} s as s32 then
					Io.put_string_32 (s32)
				elseif attached {READABLE_STRING_8} s as s8 then
					Io.put_string (s8)
				else
					Io.put_string_32 (s.as_string_32)
				end
			end
		ensure -- from ANY
			instance_free: class
		end

	frozen tagged_out: STRING_8
			-- New string containing terse printable representation
			-- of current object
			-- (from ANY)
		external
			"built_in"
		ensure -- from ANY
			tagged_out_not_void: Result /= Void
		end
	
feature -- Platform

	Operating_environment: OPERATING_ENVIRONMENT
			-- Objects available from the operating system
			-- (from ANY)
		once
			create Result
		ensure -- from ANY
			instance_free: class
			operating_environment_not_void: Result /= Void
		end
	
feature -- Raise

	raise (a_exception: EXCEPTION)
			-- Raise a_exception.
			-- Raising a_exception by this routine makes a_exception accessible by last_exception
			-- in rescue clause. Hence causes removal of original last_exception.
		require -- from EXCEPTION_MANAGER
			a_exception_not_void: a_exception /= Void
			a_exception_is_raisable: a_exception.is_raisable
		local
			p_meaning, p_message: POINTER
		do
			if not a_exception.is_ignored then
				if in_rescue then
					a_exception.set_throwing_exception (last_exception)
				end
				set_last_exception (a_exception)
				p_meaning := default_pointer
				if attached {C_STRING} a_exception.c_description as m then
					p_message := m.item
				else
					p_message := default_pointer
				end
				developer_raise (a_exception.code, p_meaning, p_message)
			end
		ensure -- from EXCEPTION_MANAGER
			instance_free: class
		end
	
feature {NONE} -- Retrieval

	frozen internal_correct_mismatch
			-- Called from runtime to perform a proper dynamic dispatch on correct_mismatch
			-- from MISMATCH_CORRECTOR.
			-- (from ANY)
		local
			l_msg: STRING_32
			l_exc: EXCEPTIONS
		do
			if attached {MISMATCH_CORRECTOR} Current as l_corrector then
				l_corrector.correct_mismatch
			else
				create l_msg.make_from_string ("Mismatch: ".as_string_32)
				create l_exc;
				l_msg.append (generating_type.name_32);
				l_exc.raise_retrieval_exception (l_msg)
			end
		end
	
invariant
		-- from ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)

note
	library: "EiffelBase: Library of reusable components for Eiffel."
	copyright: "Copyright (c) 1984-2020, Eiffel Software and others"
	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
	source: "[
		Eiffel Software
		5949 Hollister Ave., Goleta, CA 93117 USA
		Telephone 805-685-1006, Fax 805-685-6869
		Website http://www.eiffel.com
		Customer support http://support.eiffel.com
	]"

end -- class ISE_EXCEPTION_MANAGER

Generated by ISE EiffelStudio