note
	description: "Internal routine for RT_DBG_ classes"
	status: "See notice at end of class."
	legal: "See notice at end of class."
	date: "$Date: 2017-04-12 13:15:47 +0000 (Wed, 12 Apr 2017) $"
	revision: "$Revision: 100150 $"

deferred class 
	RT_DBG_INTERNAL

feature {NONE} -- Initialization

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

	Bit_type: INTEGER_32 = 8
			-- This type is obsolete and is not used anymore.
			-- (from REFLECTOR_CONSTANTS)

	Boolean_type: INTEGER_32 = 3
			-- Abstract type ID for predefined type BOOLEAN.
			-- (from REFLECTOR_CONSTANTS)

	Character_32_type: INTEGER_32 = 12
			-- Abstract type ID for predefined type CHARACTER_32.
			-- Was declared in REFLECTOR_CONSTANTS as synonym of Wide_character_type.
			-- (from REFLECTOR_CONSTANTS)

	Character_8_type: INTEGER_32 = 2
			-- Abstract type ID for predefined type CHARACTER_8.
			-- Was declared in REFLECTOR_CONSTANTS as synonym of Character_type.
			-- (from REFLECTOR_CONSTANTS)

	Character_type: INTEGER_32 = 2
			-- Abstract type ID for predefined type CHARACTER_8.
			-- Was declared in REFLECTOR_CONSTANTS as synonym of Character_8_type.
			-- (from REFLECTOR_CONSTANTS)

	Double_type: INTEGER_32 = 6
			-- Abstract type ID for predefined type REAL_64.
			-- Was declared in REFLECTOR_CONSTANTS as synonym of Real_64_type.
			-- (from REFLECTOR_CONSTANTS)

	Expanded_type: INTEGER_32 = 7
			-- Abstract type ID for a non-predefined expanded type.
			-- (from REFLECTOR_CONSTANTS)

	generating_type: TYPE [detachable RT_DBG_INTERNAL]
			-- 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

	Integer_16_type: INTEGER_32 = 10
			-- Abstract type ID for predefined type INTEGER_16.
			-- (from REFLECTOR_CONSTANTS)

	Integer_32_type: INTEGER_32 = 4
			-- Abstract type ID for predefined type INTEGER_32.
			-- Was declared in REFLECTOR_CONSTANTS as synonym of Integer_type.
			-- (from REFLECTOR_CONSTANTS)

	Integer_64_type: INTEGER_32 = 11
			-- Abstract type ID for predefined type INTEGER_64.
			-- (from REFLECTOR_CONSTANTS)

	Integer_8_type: INTEGER_32 = 9
			-- Abstract type ID for predefined type INTEGER_8.
			-- (from REFLECTOR_CONSTANTS)

	Integer_type: INTEGER_32 = 4
			-- Abstract type ID for predefined type INTEGER_32.
			-- Was declared in REFLECTOR_CONSTANTS as synonym of Integer_32_type.
			-- (from REFLECTOR_CONSTANTS)

	Max_predefined_type: INTEGER_32 = 16
			-- (from REFLECTOR_CONSTANTS)

	Min_predefined_type: INTEGER_32 = -2
			-- (from REFLECTOR_CONSTANTS)

	Natural_16_type: INTEGER_32 = 14
			-- Abstract type ID for predefined type NATURAL_16.
			-- (from REFLECTOR_CONSTANTS)

	Natural_32_type: INTEGER_32 = 15
			-- Abstract type ID for predefined type NATURAL_32.
			-- (from REFLECTOR_CONSTANTS)

	Natural_64_type: INTEGER_32 = 16
			-- Abstract type ID for predefined type NATURAL_64.
			-- (from REFLECTOR_CONSTANTS)

	Natural_8_type: INTEGER_32 = 13
			-- Abstract type ID for predefined type NATURAL_8.
			-- (from REFLECTOR_CONSTANTS)

	None_type: INTEGER_32 = -2
			-- Type ID representation for NONE.
			-- (from REFLECTOR_CONSTANTS)

	Pointer_type: INTEGER_32 = 0
			-- Abstract type ID for predefined type POINTER.
			-- (from REFLECTOR_CONSTANTS)

	Real_32_type: INTEGER_32 = 5
			-- Abstract type ID for predefined type REAL_32.
			-- Was declared in REFLECTOR_CONSTANTS as synonym of Real_type.
			-- (from REFLECTOR_CONSTANTS)

	Real_64_type: INTEGER_32 = 6
			-- Abstract type ID for predefined type REAL_64.
			-- Was declared in REFLECTOR_CONSTANTS as synonym of Double_type.
			-- (from REFLECTOR_CONSTANTS)

	Real_type: INTEGER_32 = 5
			-- Abstract type ID for predefined type REAL_32.
			-- Was declared in REFLECTOR_CONSTANTS as synonym of Real_32_type.
			-- (from REFLECTOR_CONSTANTS)

	Reference_type: INTEGER_32 = 1
			-- Abstract type ID for a reference type.
			-- (from REFLECTOR_CONSTANTS)

	Wide_character_type: INTEGER_32 = 12
			-- Abstract type ID for predefined type CHARACTER_32.
			-- Was declared in REFLECTOR_CONSTANTS as synonym of Character_32_type.
			-- (from REFLECTOR_CONSTANTS)
	
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 (other: RT_DBG_INTERNAL): 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: RT_DBG_INTERNAL): 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 (other: RT_DBG_INTERNAL): 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

	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 -- 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: RT_DBG_INTERNAL)
			-- 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: RT_DBG_INTERNAL)
			-- 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: RT_DBG_INTERNAL
			-- 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: RT_DBG_INTERNAL)
			-- 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: RT_DBG_INTERNAL
			-- 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: RT_DBG_INTERNAL
			-- 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 RT_DBG_INTERNAL
		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 RT_DBG_INTERNAL
			-- 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

	Reflected_object: REFLECTED_REFERENCE_OBJECT
			-- To enable object introspection.
		once
			create Result.make (Current)
		end

	Reflector: REFLECTOR
			-- To enable type discovery
		once
			create Result
		end
	
feature -- Access local

	frozen c_stack_value_at (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_rt_type: NATURAL_32): detachable ANY
			-- Object value referenced at off offset of object
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					return (EIF_REFERENCE) rt_dbg_stack_value((uint32)$dep, (uint32)$a_loc_type, (uint32)$pos, (uint32)$a_rt_type);
				#else
					return NULL;
				#endif
			]"
		end
	
feature -- Change field

	set_field_at (off: INTEGER_32; a_type: NATURAL_32; value: detachable ANY; object: ANY)
		require
			object_attached: object /= Void
		local
			a_eif_type: INTEGER_32
		do
			debug ("rt_dbg_internal")
				print ("set_field_at (" + off.out + ", " + a_type.out + ", value, " + object.generator + ") %N")
			end
			a_eif_type := eif_type (a_type)
			inspect a_eif_type
			when Boolean_type then
				if attached {BOOLEAN} value as bool then
					{ISE_RUNTIME}.set_boolean_field_at (off, $object.to_pointer, 0, bool)
				end
			when Character_8_type then
				if attached {CHARACTER_8} value as c8 then
					{ISE_RUNTIME}.set_character_8_field_at (off, $object.to_pointer, 0, c8)
				end
			when Character_32_type then
				if attached {CHARACTER_32} value as c32 then
					{ISE_RUNTIME}.set_character_32_field_at (off, $object.to_pointer, 0, c32)
				end
			when Natural_8_type then
				if attached {NATURAL_8} value as n8 then
					{ISE_RUNTIME}.set_natural_8_field_at (off, $object.to_pointer, 0, n8)
				end
			when Natural_16_type then
				if attached {NATURAL_16} value as n16 then
					{ISE_RUNTIME}.set_natural_16_field_at (off, $object.to_pointer, 0, n16)
				end
			when Natural_32_type then
				if attached {NATURAL_32} value as n32 then
					{ISE_RUNTIME}.set_natural_32_field_at (off, $object.to_pointer, 0, n32)
				end
			when Natural_64_type then
				if attached {NATURAL_64} value as n64 then
					{ISE_RUNTIME}.set_natural_64_field_at (off, $object.to_pointer, 0, n64)
				end
			when Integer_8_type then
				if attached {INTEGER_8} value as i8 then
					{ISE_RUNTIME}.set_integer_8_field_at (off, $object.to_pointer, 0, i8)
				end
			when Integer_16_type then
				if attached {INTEGER_16} value as i16 then
					{ISE_RUNTIME}.set_integer_16_field_at (off, $object.to_pointer, 0, i16)
				end
			when Integer_32_type then
				if attached {INTEGER_32} value as i32 then
					{ISE_RUNTIME}.set_integer_32_field_at (off, $object.to_pointer, 0, i32)
				end
			when Integer_64_type then
				if attached {INTEGER_64} value as i64 then
					{ISE_RUNTIME}.set_integer_64_field_at (off, $object.to_pointer, 0, i64)
				end
			when Real_32_type then
				if attached {REAL_32} value as r32 then
					{ISE_RUNTIME}.set_real_32_field_at (off, $object.to_pointer, 0, r32)
				end
			when Real_64_type then
				if attached {REAL_64} value as r64 then
					{ISE_RUNTIME}.set_real_64_field_at (off, $object.to_pointer, 0, r64)
				end
			when Pointer_type then
				if attached {POINTER} value as ptr then
					{ISE_RUNTIME}.set_pointer_field_at (off, $object.to_pointer, 0, ptr)
				end
			when Reference_type then
				{ISE_RUNTIME}.set_reference_field_at (off, $object.to_pointer, 0, value)
			else
			end
		end
	
feature -- Change local

	frozen c_set_boolean_stack_value (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_bool: BOOLEAN): INTEGER_32
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					EIF_TYPED_VALUE a_val; a_val.type = SK_BOOL; a_val.it_bool = (EIF_BOOLEAN) $a_bool;
					return rt_dbg_set_stack_value ((uint32)$dep, (uint32)$a_loc_type, (uint32)$pos, (EIF_TYPED_VALUE*) &a_val);
				#else
					return 0;
				#endif
			]"
		end

	frozen c_set_character_32_stack_value (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_ch32: CHARACTER_32): INTEGER_32
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					EIF_TYPED_VALUE a_val; a_val.type = SK_WCHAR; a_val.it_c4 = (EIF_WIDE_CHAR) $a_ch32;
					return rt_dbg_set_stack_value ((uint32)$dep, (uint32)$a_loc_type, (uint32)$pos, (EIF_TYPED_VALUE*) &a_val);
				#else
					return 0;
				#endif
			]"
		end

	frozen c_set_character_8_stack_value (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_ch8: CHARACTER_8): INTEGER_32
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					EIF_TYPED_VALUE a_val; a_val.type = SK_CHAR; a_val.it_c1 = (EIF_CHARACTER) $a_ch8;
					return rt_dbg_set_stack_value ((uint32)$dep, (uint32)$a_loc_type, (uint32)$pos, (EIF_TYPED_VALUE*) &a_val);
				#else
					return 0;
				#endif
			]"
		end

	frozen c_set_integer_16_stack_value (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_i16: INTEGER_16): INTEGER_32
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					EIF_TYPED_VALUE a_val; a_val.type = SK_INT16; a_val.it_i2 = (EIF_INTEGER_16) $a_i16;
					return rt_dbg_set_stack_value ((uint32)$dep, (uint32)$a_loc_type, (uint32)$pos, (EIF_TYPED_VALUE*) &a_val);
				#else
					return 0;
				#endif
			]"
		end

	frozen c_set_integer_32_stack_value (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_i32: INTEGER_32): INTEGER_32
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					EIF_TYPED_VALUE a_val; a_val.type = SK_INT32; a_val.it_i4 = (EIF_INTEGER_32) $a_i32;
					return rt_dbg_set_stack_value ((uint32)$dep, (uint32)$a_loc_type, (uint32)$pos, (EIF_TYPED_VALUE*) &a_val);
				#else
					return 0;
				#endif
			]"
		end

	frozen c_set_integer_64_stack_value (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_i64: INTEGER_64): INTEGER_32
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					EIF_TYPED_VALUE a_val; a_val.type = SK_INT64; a_val.it_i8 = (EIF_INTEGER_64) $a_i64;
					return rt_dbg_set_stack_value ((uint32)$dep, (uint32)$a_loc_type, (uint32)$pos, (EIF_TYPED_VALUE*) &a_val);
				#else
					return 0;
				#endif
			]"
		end

	frozen c_set_integer_8_stack_value (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_i8: INTEGER_8): INTEGER_32
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					EIF_TYPED_VALUE a_val; a_val.type = SK_INT8; a_val.it_i1 = (EIF_INTEGER_8) $a_i8;
					return rt_dbg_set_stack_value ((uint32)$dep, (uint32)$a_loc_type, (uint32)$pos, (EIF_TYPED_VALUE*) &a_val);
				#else
					return 0;
				#endif
			]"
		end

	frozen c_set_natural_16_stack_value (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_n16: NATURAL_16): INTEGER_32
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					EIF_TYPED_VALUE a_val; a_val.type = SK_UINT16; a_val.it_n2 = (EIF_NATURAL_16) $a_n16;
					return rt_dbg_set_stack_value ((uint32)$dep, (uint32)$a_loc_type, (uint32)$pos, (EIF_TYPED_VALUE*) &a_val);
				#else
					return 0;
				#endif
			]"
		end

	frozen c_set_natural_32_stack_value (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_n32: NATURAL_32): INTEGER_32
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					EIF_TYPED_VALUE a_val; a_val.type = SK_UINT32; a_val.it_n4 = (EIF_NATURAL_32) $a_n32;
					return rt_dbg_set_stack_value ((uint32)$dep, (uint32)$a_loc_type, (uint32)$pos, (EIF_TYPED_VALUE*) &a_val);
				#else
					return 0;
				#endif
			]"
		end

	frozen c_set_natural_64_stack_value (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_n64: NATURAL_64): INTEGER_32
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					EIF_TYPED_VALUE a_val; a_val.type = SK_UINT64; a_val.it_n8 = (EIF_NATURAL_64) $a_n64;
					return rt_dbg_set_stack_value ((uint32)$dep, (uint32)$a_loc_type, (uint32)$pos, (EIF_TYPED_VALUE*) &a_val);
				#else
					return 0;
				#endif
			]"
		end

	frozen c_set_natural_8_stack_value (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_n8: NATURAL_8): INTEGER_32
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					EIF_TYPED_VALUE a_val; a_val.type = SK_UINT8; a_val.it_n1 = (EIF_NATURAL_8) $a_n8;
					return rt_dbg_set_stack_value ((uint32)$dep, (uint32)$a_loc_type, (uint32)$pos, (EIF_TYPED_VALUE*) &a_val);
				#else
					return 0;
				#endif
			]"
		end

	frozen c_set_pointer_stack_value (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_p: POINTER): INTEGER_32
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					EIF_TYPED_VALUE a_val; a_val.type = SK_POINTER; a_val.it_p = (EIF_POINTER) $a_p;
					return rt_dbg_set_stack_value ((uint32)$dep, (uint32)$a_loc_type, (uint32)$pos, (EIF_TYPED_VALUE*) &a_val);
				#else
					return 0;
				#endif
			]"
		end

	frozen c_set_real_32_stack_value (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_i32: REAL_32): INTEGER_32
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					EIF_TYPED_VALUE a_val; a_val.type = SK_REAL32; a_val.it_r4 = (EIF_REAL_32) $a_i32;
					return rt_dbg_set_stack_value ((uint32)$dep, (uint32)$a_loc_type, (uint32)$pos, (EIF_TYPED_VALUE*) &a_val);
				#else
					return 0;
				#endif
			]"
		end

	frozen c_set_real_64_stack_value (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_i64: REAL_64): INTEGER_32
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					EIF_TYPED_VALUE a_val; a_val.type = SK_REAL64; a_val.it_r8 = (EIF_REAL_64) $a_i64;
					return rt_dbg_set_stack_value ((uint32)$dep, (uint32)$a_loc_type, (uint32)$pos, (EIF_TYPED_VALUE*) &a_val);
				#else
					return 0;
				#endif
			]"
		end

	frozen c_set_reference_stack_value (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_ref: POINTER): INTEGER_32
		require
			a_ref_not_null: a_ref /= default_pointer
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					EIF_TYPED_VALUE a_val; 
					a_val.type = SK_REF; 
					a_val.it_ref = (EIF_REFERENCE) &($a_ref);
					return rt_dbg_set_stack_value ((uint32)$dep, (uint32)$a_loc_type, (uint32)$pos, (EIF_TYPED_VALUE*) &a_val);
				#else
					return 0;
				#endif
			]"
		end

	frozen c_set_void_stack_value (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32): INTEGER_32
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					EIF_TYPED_VALUE a_val; 
					a_val.type = SK_VOID; 
					a_val.it_ref = (char*) 0;
					return rt_dbg_set_stack_value ((uint32)$dep, (uint32)$a_loc_type, (uint32)$pos, (EIF_TYPED_VALUE*) &a_val);
				#else
					return 0;
				#endif
			]"
		end

	Rt_dlt_argument: INTEGER_32 = 0
			-- DLT=DebugLocalType, the type is an argument of a function

	Rt_dlt_localvar: INTEGER_32 = 1
			-- DLT=DebugLocalType, the type is a local variable inside a function

	Rt_dlt_result: INTEGER_32 = 2
			-- DLT=DebugLocalType, the type is the Result of the current feature

	set_stack_value_at (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_rt_type: NATURAL_32; value: detachable ANY): INTEGER_32
			-- Set stack value at position pos on stack of depth dep with value
		require
			a_loc_type_valid: a_loc_type = Rt_dlt_localvar or a_loc_type = Rt_dlt_argument or a_loc_type = Rt_dlt_result
		local
			a_eif_type: INTEGER_32
		do
			debug ("rt_dbg_internal")
				print ("set_stack_value_at (dep=" + dep.out + ", loc_type=" + a_loc_type.out + ", pos=" + pos.out + ", type=0x" + a_rt_type.to_hex_string + ", value=")
				if value = Void then
					print ("Void) %N")
				else
					print (value.generating_type.name + ": " + value.out + ") %N")
				end
			end
			a_eif_type := eif_type (a_rt_type)
			inspect a_eif_type
			when Boolean_type then
				if attached {BOOLEAN} value as bool then
					Result := c_set_boolean_stack_value (dep, a_loc_type, pos, bool)
				end
			when Character_8_type then
				if attached {CHARACTER_8} value as c8 then
					Result := c_set_character_8_stack_value (dep, a_loc_type, pos, c8)
				end
			when Character_32_type then
				if attached {CHARACTER_32} value as c32 then
					Result := c_set_character_32_stack_value (dep, a_loc_type, pos, c32)
				end
			when Natural_8_type then
				if attached {NATURAL_8} value as n8 then
					Result := c_set_natural_8_stack_value (dep, a_loc_type, pos, n8)
				end
			when Natural_16_type then
				if attached {NATURAL_16} value as n16 then
					Result := c_set_natural_16_stack_value (dep, a_loc_type, pos, n16)
				end
			when Natural_32_type then
				if attached {NATURAL_32} value as n32 then
					Result := c_set_natural_32_stack_value (dep, a_loc_type, pos, n32)
				end
			when Natural_64_type then
				if attached {NATURAL_64} value as n64 then
					Result := c_set_natural_64_stack_value (dep, a_loc_type, pos, n64)
				end
			when Integer_8_type then
				if attached {INTEGER_8} value as i8 then
					Result := c_set_integer_8_stack_value (dep, a_loc_type, pos, i8)
				end
			when Integer_16_type then
				if attached {INTEGER_16} value as i16 then
					Result := c_set_integer_16_stack_value (dep, a_loc_type, pos, i16)
				end
			when Integer_32_type then
				if attached {INTEGER_32} value as i32 then
					Result := c_set_integer_32_stack_value (dep, a_loc_type, pos, i32)
				end
			when Integer_64_type then
				if attached {INTEGER_64} value as i64 then
					Result := c_set_integer_64_stack_value (dep, a_loc_type, pos, i64)
				end
			when Real_32_type then
				if attached {REAL_32} value as r32 then
					Result := c_set_real_32_stack_value (dep, a_loc_type, pos, r32)
				end
			when Real_64_type then
				if attached {REAL_64} value as r64 then
					Result := c_set_real_64_stack_value (dep, a_loc_type, pos, r64)
				end
			when Pointer_type then
				if attached {POINTER} value as ptr then
					Result := c_set_pointer_stack_value (dep, a_loc_type, pos, ptr)
				end
			when Reference_type then
				if value /= Void then
					Result := c_set_reference_stack_value (dep, a_loc_type, pos, $value.to_pointer)
				else
					Result := c_set_void_stack_value (dep, a_loc_type, pos)
				end
			else
				Result := 2
			end
			debug ("rt_dbg_internal")
				print ("set_stack_value_at (dep=" + dep.out + ", loc_type=" + a_loc_type.out + ", pos=" + pos.out + ", ...) -> " + Result.out + " %N")
				print ("set_stack_value_at: check modification -> ")
				if attached stack_value_at (dep, a_loc_type, pos, a_rt_type) as a then
					print (a.generating_type.name + ": " + a.out + "%N")
				else
					print (" Void %N")
				end
			end
		end
	
feature {NONE} -- External implementation

	frozen c_eif_type (a_field_type: NATURAL_32): INTEGER_32
			-- EIF_ type related to a_field_type
		external
			"C inline use %"eif_internal.h%""
		alias
			"ei_eif_type((uint32) $a_field_type)"
		end

	frozen c_object_is_expanded (object: POINTER): BOOLEAN
		external
			"C inline use %"eif_eiffel.h%""
		alias
			"eif_is_expanded(HEADER($object)->ov_flags)"
		end

	frozen c_rt_dynamic_type (object: POINTER): INTEGER_32
			-- Dynamic type of object.
		external
			"C macro signature (EIF_REFERENCE): EIF_INTEGER use %"eif_macros.h%""
		alias
			"Dtype"
		end

	frozen c_rt_field_type (i: INTEGER_32; a_type_id: INTEGER_32): NATURAL_32
			-- RT field type related to i on a_type_id
		external
			"C inline use %"eif_internal.h%""
		alias
			"System(To_dtype($a_type_id)).cn_types[$i]"
		end
	
feature {NONE} -- Factory

	frozen object_attribute_record (off: INTEGER_32; t: NATURAL_32; obj: ANY): detachable RT_DBG_VALUE_RECORD
			-- Record for attribute of type t at offset o on object obj
		require
			obj_attached: obj /= Void
		local
			ft: INTEGER_32
			l_reflected_object: REFLECTED_REFERENCE_OBJECT
		do
			ft := eif_type (t)
			inspect ft
			when Boolean_type then
				create {RT_DBG_ATTRIBUTE_RECORD [BOOLEAN]} Result.make (obj, off, ft, t, {ISE_RUNTIME}.boolean_field_at (off, $obj.to_pointer, 0))
			when Character_8_type then
				create {RT_DBG_ATTRIBUTE_RECORD [CHARACTER_8]} Result.make (obj, off, ft, t, {ISE_RUNTIME}.character_8_field_at (off, $obj.to_pointer, 0))
			when Character_32_type then
				create {RT_DBG_ATTRIBUTE_RECORD [CHARACTER_32]} Result.make (obj, off, ft, t, {ISE_RUNTIME}.character_32_field_at (off, $obj.to_pointer, 0))
			when Integer_8_type then
				create {RT_DBG_ATTRIBUTE_RECORD [INTEGER_8]} Result.make (obj, off, ft, t, {ISE_RUNTIME}.integer_8_field_at (off, $obj.to_pointer, 0))
			when Integer_16_type then
				create {RT_DBG_ATTRIBUTE_RECORD [INTEGER_16]} Result.make (obj, off, ft, t, {ISE_RUNTIME}.integer_16_field_at (off, $obj.to_pointer, 0))
			when Integer_32_type then
				create {RT_DBG_ATTRIBUTE_RECORD [INTEGER_32]} Result.make (obj, off, ft, t, {ISE_RUNTIME}.integer_32_field_at (off, $obj.to_pointer, 0))
			when Integer_64_type then
				create {RT_DBG_ATTRIBUTE_RECORD [INTEGER_64]} Result.make (obj, off, ft, t, {ISE_RUNTIME}.integer_64_field_at (off, $obj.to_pointer, 0))
			when Natural_8_type then
				create {RT_DBG_ATTRIBUTE_RECORD [NATURAL_8]} Result.make (obj, off, ft, t, {ISE_RUNTIME}.natural_8_field_at (off, $obj.to_pointer, 0))
			when Natural_16_type then
				create {RT_DBG_ATTRIBUTE_RECORD [NATURAL_16]} Result.make (obj, off, ft, t, {ISE_RUNTIME}.natural_16_field_at (off, $obj.to_pointer, 0))
			when Natural_32_type then
				create {RT_DBG_ATTRIBUTE_RECORD [NATURAL_32]} Result.make (obj, off, ft, t, {ISE_RUNTIME}.natural_8_field_at (off, $obj.to_pointer, 0).to_natural_32)
			when Natural_64_type then
				create {RT_DBG_ATTRIBUTE_RECORD [NATURAL_64]} Result.make (obj, off, ft, t, {ISE_RUNTIME}.natural_8_field_at (off, $obj.to_pointer, 0).to_natural_64)
			when Real_32_type then
				create {RT_DBG_ATTRIBUTE_RECORD [REAL_32]} Result.make (obj, off, ft, t, {ISE_RUNTIME}.real_32_field_at (off, $obj.to_pointer, 0))
			when Real_64_type then
				create {RT_DBG_ATTRIBUTE_RECORD [REAL_64]} Result.make (obj, off, ft, t, {ISE_RUNTIME}.real_64_field_at (off, $obj.to_pointer, 0))
			when Pointer_type then
				create {RT_DBG_ATTRIBUTE_RECORD [POINTER]} Result.make (obj, off, ft, t, {ISE_RUNTIME}.pointer_field_at (off, $obj.to_pointer, 0))
			when Reference_type then
				create {RT_DBG_ATTRIBUTE_RECORD [ANY]} Result.make (obj, off, ft, t, {ISE_RUNTIME}.reference_field_at (off, $obj.to_pointer, 0))
			when Expanded_type then
				create l_reflected_object.make_for_expanded_field_at (obj, off)
				create {RT_DBG_ATTRIBUTE_RECORD [ANY]} Result.make (obj, off, ft, t, l_reflected_object.object)
			else
			end
		end

	frozen object_local_record (dep: INTEGER_32; pos: INTEGER_32; t: NATURAL_32): detachable RT_DBG_VALUE_RECORD
			-- Local or Result value record.
		local
			ft: INTEGER_32
		do
			ft := eif_type (t)
			inspect ft
			when Boolean_type then
				create {RT_DBG_LOCAL_RECORD [BOOLEAN]} Result.make (dep, pos, ft, t)
			when Character_8_type then
				create {RT_DBG_LOCAL_RECORD [CHARACTER_8]} Result.make (dep, pos, ft, t)
			when Character_32_type then
				create {RT_DBG_LOCAL_RECORD [CHARACTER_32]} Result.make (dep, pos, ft, t)
			when Natural_8_type then
				create {RT_DBG_LOCAL_RECORD [NATURAL_8]} Result.make (dep, pos, ft, t)
			when Natural_16_type then
				create {RT_DBG_LOCAL_RECORD [NATURAL_16]} Result.make (dep, pos, ft, t)
			when Natural_32_type then
				create {RT_DBG_LOCAL_RECORD [NATURAL_32]} Result.make (dep, pos, ft, t)
			when Natural_64_type then
				create {RT_DBG_LOCAL_RECORD [NATURAL_64]} Result.make (dep, pos, ft, t)
			when Integer_8_type then
				create {RT_DBG_LOCAL_RECORD [INTEGER_8]} Result.make (dep, pos, ft, t)
			when Integer_16_type then
				create {RT_DBG_LOCAL_RECORD [INTEGER_16]} Result.make (dep, pos, ft, t)
			when Integer_32_type then
				create {RT_DBG_LOCAL_RECORD [INTEGER_32]} Result.make (dep, pos, ft, t)
			when Integer_64_type then
				create {RT_DBG_LOCAL_RECORD [INTEGER_64]} Result.make (dep, pos, ft, t)
			when Real_32_type then
				create {RT_DBG_LOCAL_RECORD [REAL_32]} Result.make (dep, pos, ft, t)
			when Real_64_type then
				create {RT_DBG_LOCAL_RECORD [REAL_64]} Result.make (dep, pos, ft, t)
			when Pointer_type then
				create {RT_DBG_LOCAL_RECORD [POINTER]} Result.make (dep, pos, ft, t)
			when Reference_type then
				create {RT_DBG_LOCAL_RECORD [ANY]} Result.make (dep, pos, ft, t)
			when Expanded_type then
				create {RT_DBG_LOCAL_RECORD [ANY]} Result.make (dep, pos, ft, t)
			when None_type then
			else
			end
			if Result /= Void then
				Result.get_value
			end
		end

	frozen object_record (i: INTEGER_32; obj: ANY): detachable RT_DBG_VALUE_RECORD
		require
			obj_attached: obj /= Void
		local
			ft: INTEGER_32
			l_reflected_object: like Reflected_object
		do
			l_reflected_object := Reflected_object
			l_reflected_object.set_object (obj)
			ft := l_reflected_object.field_type (i)
			Result := object_attribute_record (l_reflected_object.field_offset (i), c_rt_field_type (i, ft), obj)
			inspect ft
			when Integer_8_type then
				create {RT_DBG_FIELD_RECORD [INTEGER_8]} Result.make (obj, i, ft, l_reflected_object.integer_8_field (i))
			when Integer_16_type then
				create {RT_DBG_FIELD_RECORD [INTEGER_16]} Result.make (obj, i, ft, l_reflected_object.integer_16_field (i))
			when Integer_32_type then
				create {RT_DBG_FIELD_RECORD [INTEGER_32]} Result.make (obj, i, ft, l_reflected_object.integer_32_field (i))
			when Integer_64_type then
				create {RT_DBG_FIELD_RECORD [INTEGER_64]} Result.make (obj, i, ft, l_reflected_object.integer_64_field (i))
			when Natural_8_type then
				create {RT_DBG_FIELD_RECORD [NATURAL_8]} Result.make (obj, i, ft, l_reflected_object.natural_8_field (i))
			when Natural_16_type then
				create {RT_DBG_FIELD_RECORD [NATURAL_16]} Result.make (obj, i, ft, l_reflected_object.natural_16_field (i))
			when Natural_32_type then
				create {RT_DBG_FIELD_RECORD [NATURAL_32]} Result.make (obj, i, ft, l_reflected_object.natural_32_field (i))
			when Natural_64_type then
				create {RT_DBG_FIELD_RECORD [NATURAL_64]} Result.make (obj, i, ft, l_reflected_object.natural_64_field (i))
			when Pointer_type then
				create {RT_DBG_FIELD_RECORD [POINTER]} Result.make (obj, i, ft, l_reflected_object.pointer_field (i))
			when Reference_type then
				create {RT_DBG_FIELD_RECORD [detachable ANY]} Result.make (obj, i, ft, l_reflected_object.reference_field (i))
			when Expanded_type then
				create {RT_DBG_FIELD_RECORD [detachable ANY]} Result.make (obj, i, ft, l_reflected_object.field (i))
			when Boolean_type then
				create {RT_DBG_FIELD_RECORD [BOOLEAN]} Result.make (obj, i, ft, l_reflected_object.boolean_field (i))
			when Real_32_type then
				create {RT_DBG_FIELD_RECORD [REAL_32]} Result.make (obj, i, ft, l_reflected_object.real_32_field (i))
			when Real_64_type then
				create {RT_DBG_FIELD_RECORD [REAL_64]} Result.make (obj, i, ft, l_reflected_object.real_64_field (i))
			when Character_8_type then
				create {RT_DBG_FIELD_RECORD [CHARACTER_8]} Result.make (obj, i, ft, l_reflected_object.character_8_field (i))
			when Character_32_type then
				create {RT_DBG_FIELD_RECORD [CHARACTER_32]} Result.make (obj, i, ft, l_reflected_object.character_32_field (i))
			else
			end
		end
	
feature -- Object access

	frozen eif_type (a_field_type: NATURAL_32): INTEGER_32
			-- EIF_ type from field type a_field_type
		do
			Result := c_eif_type (a_field_type)
		end

	frozen field_at (off: INTEGER_32; a_field_type: NATURAL_32; object: ANY): detachable ANY
			-- Object attached at offset off field of object
			-- (directly or through a reference)
		require
			object_not_void: object /= Void
			index_large_enough: off >= 1
		local
			t: INTEGER_32
		do
			t := eif_type (a_field_type)
			inspect t
			when Boolean_type then
				Result := {ISE_RUNTIME}.boolean_field_at (off, $object.to_pointer, 0)
			when Character_8_type then
				Result := {ISE_RUNTIME}.character_8_field_at (off, $object.to_pointer, 0)
			when Character_32_type then
				Result := {ISE_RUNTIME}.character_32_field_at (off, $object.to_pointer, 0)
			when Natural_8_type then
				Result := {ISE_RUNTIME}.natural_8_field_at (off, $object.to_pointer, 0)
			when Natural_16_type then
				Result := {ISE_RUNTIME}.natural_16_field_at (off, $object.to_pointer, 0)
			when Natural_32_type then
				Result := {ISE_RUNTIME}.natural_32_field_at (off, $object.to_pointer, 0)
			when Natural_64_type then
				Result := {ISE_RUNTIME}.natural_64_field_at (off, $object.to_pointer, 0)
			when Integer_8_type then
				Result := {ISE_RUNTIME}.integer_8_field_at (off, $object.to_pointer, 0)
			when Integer_16_type then
				Result := {ISE_RUNTIME}.integer_16_field_at (off, $object.to_pointer, 0)
			when Integer_32_type then
				Result := {ISE_RUNTIME}.integer_32_field_at (off, $object.to_pointer, 0)
			when Integer_64_type then
				Result := {ISE_RUNTIME}.integer_64_field_at (off, $object.to_pointer, 0)
			when Real_32_type then
				Result := {ISE_RUNTIME}.real_32_field_at (off, $object.to_pointer, 0)
			when Real_64_type then
				Result := {ISE_RUNTIME}.real_64_field_at (off, $object.to_pointer, 0)
			when Pointer_type then
				Result := {ISE_RUNTIME}.pointer_field_at (off, $object.to_pointer, 0)
			when Reference_type then
				Result := {ISE_RUNTIME}.reference_field_at (off, $object.to_pointer, 0)
			else
			end
		end

	frozen field_index_at (off: INTEGER_32; obj: ANY): INTEGER_32
			-- Field name at offset off on obj
		require
				obj /= Void
		local
			n: INTEGER_32
			l_reflected_object: like Reflected_object
		do
			from
				l_reflected_object := Reflected_object
				l_reflected_object.set_object (obj)
				n := l_reflected_object.field_count
			until
				n = 0 or Result > 0
			loop
				if off = l_reflected_object.field_offset (n) then
					Result := n
				end
				n := n - 1
			end
		end

	frozen field_name_at (off: INTEGER_32; obj: ANY): detachable STRING_8
			-- Field name at offset off on obj
		require
				obj /= Void
		local
			i: INTEGER_32
		do
			i := field_index_at (off, obj)
			if i > 0 then
				Reflected_object.set_object (obj)
				Result := Reflected_object.field_name (i)
			end
		end

	frozen object_field_count (obj: ANY): INTEGER_32
			-- Field_count on obj
		require
			obj_attached: obj /= Void
		do
			Reflected_object.set_object (obj)
			Result := Reflected_object.field_count
		end

	frozen object_is_expanded (object: ANY): BOOLEAN
			-- Is object an expanded value ?
		require
			object_not_void: object /= Void
		do
			Result := c_object_is_expanded ($object.to_pointer)
		end

	frozen object_records (obj: ANY): detachable ARRAYED_LIST [RT_DBG_VALUE_RECORD]
			-- List of field records on obj
		require
			obj_attached: obj /= Void
		local
			i, cnb: INTEGER_32
			l_records: like object_records
		do
			cnb := object_field_count (obj)
			if cnb > 0 then
				create l_records.make (cnb)
				from
					i := 1
				until
					i > cnb
				loop
					if attached {like object_record} object_record (i, obj) as r then
						l_records.extend (r)
					end
					i := i + 1
				end
				Result := l_records
			end
		end

	frozen rt_dynamic_type (object: ANY): INTEGER_32
			-- Dynamic type of object
		require
			object_not_void: object /= Void
		do
			Result := c_rt_dynamic_type ($object.to_pointer)
		ensure
			rt_dynamic_type_nonnegative: Result >= 0
		end

	frozen stack_value_at (dep: INTEGER_32; a_loc_type: INTEGER_32; pos: INTEGER_32; a_rt_type: NATURAL_32): detachable ANY
			-- Object attached at offset off field of object
			-- (directly or through a reference)
		require
			index_large_enough: pos >= 1
		do
			debug ("rt_dbg_internal")
				print ("%Nstack_value_at (" + dep.out + ", " + pos.out + ", 0x" + a_rt_type.to_hex_string + ")%N")
			end
			Result := c_stack_value_at (dep, a_loc_type, pos, a_rt_type)
			debug ("rt_dbg_internal")
				print ("stack_value_at -> ")
				if Result /= Void then
					print (Result.generating_type.name + " = " + Result.out)
				else
					print ("Void Result")
				end
				print ("%N")
			end
		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)
		do
			if o /= Void then
				Io.put_string (o.out)
			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 {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_8
			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: ")
				create l_exc
				l_msg.append (generating_type.name)
				l_exc.raise_retrieval_exception (l_msg)
			end
		end
	
feature -- Testing

	c_rt_set_is_inside_rt_eiffel_code (v: INTEGER_32)
		external
			"C inline use %"eif_debug.h%""
		alias
			"[
				#ifdef WORKBENCH
					EIF_GET_CONTEXT; is_inside_rt_eiffel_code = $v;
				#endif
			]"
		end

	test_locals (dep: INTEGER_32; loc_pos: INTEGER_32; val: ANY; a_rt_type: NATURAL_32)
		local
			s: STRING_8
			retried: BOOLEAN
		do
			if not retried then
				c_rt_set_is_inside_rt_eiffel_code (1)
				s := "----------------------------------%N"
				s.append ("Loc #" + loc_pos.out + "(stack depth=" + dep.out + ")")
				if val /= Void then
					s.append (": should be " + val.generating_type.name)
				end
				s.append ("%N")
				print (s)
				s.append (" -> ")
				if attached stack_value_at (dep, Rt_dlt_localvar, loc_pos, a_rt_type) as a then
					s.append (a.generating_type.name + "=" + a.out)
				else
					s.append ("Void object")
				end
				s.append ("%N")
				print (s)
				c_rt_set_is_inside_rt_eiffel_code (0)
			else
				print ("Rescued%N")
				c_rt_set_is_inside_rt_eiffel_code (0)
			end
		rescue
			retried := True
			retry
		end

	test_set_local (dep: INTEGER_32; loc_pos: INTEGER_32; val: ANY; a_rt_type: NATURAL_32)
		local
			s: STRING_8
			r: INTEGER_32
			retried: BOOLEAN
		do
			if not retried then
				c_rt_set_is_inside_rt_eiffel_code (1)
				s := "----------------------------------%N"
				s.append ("SetLoc #" + loc_pos.out + "(stack depth=" + dep.out + ")")
				if val /= Void then
					s.append (": value " + val.generating_type.name)
				else
					s.append (": value Void")
				end
				s.append ("%N")
				print (s)
				r := set_stack_value_at (dep, Rt_dlt_localvar, loc_pos, a_rt_type, val)
				s.append (" -> ")
				s.append ("Result = " + r.out)
				s.append ("%N")
				print (s)
				c_rt_set_is_inside_rt_eiffel_code (0)
			else
				print ("Rescued%N")
				c_rt_set_is_inside_rt_eiffel_code (0)
			end
		rescue
			retried := True
			retry
		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-2017, 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 RT_DBG_INTERNAL

Generated by ISE EiffelStudio