note
	description: "Platform-dependent properties."
	library: "Free implementation of ELKS library"
	status: "See notice at end of class."
	legal: "See notice at end of class."
	date: "$Date: 2020-05-19 14:29:33 +0000 (Tue, 19 May 2020) $"
	revision: "$Revision: 104259 $"

class 
	PLATFORM

create 
	default_create

feature -- Platform

	is_thread_capable: BOOLEAN
			-- Is current platform capable of multi-threading?
		external
			"built_in static"
		ensure
			instance_free: class
		end

	is_scoop_capable: BOOLEAN
			-- Is current platform capable of SCOOP?
		external
			"built_in static"
		ensure
			instance_free: class
		end

	is_dotnet: BOOLEAN
			-- Are we targetting .NET?
		external
			"built_in static"
		ensure
			instance_free: class
		end

	is_windows: BOOLEAN
			-- Are we running on Windows platform?
		external
			"built_in static"
		ensure
			instance_free: class
		end

	is_unix: BOOLEAN
			-- Are we running on a Unix like platform?
		external
			"built_in static"
		ensure
			instance_free: class
		end

	is_vms: BOOLEAN
			-- Are we running on VMS?
		external
			"built_in static"
		ensure
			instance_free: class
		end

	is_mac: BOOLEAN
			-- Are we running on Mac OS?
		external
			"built_in static"
		ensure
			instance_free: class
		end

	is_vxworks: BOOLEAN
			-- Are we running on VxWorks?
		external
			"built_in static"
		ensure
			instance_free: class
		end

	Is_little_endian: BOOLEAN
			-- Is current platform a little endian one?
		local
			l_nat16: NATURAL_16
			l_nat8: NATURAL_8
			l_first: NATURAL_8
		once
			l_nat16 := 17185
			l_nat8 := 33;
			($l_first).memory_copy ($l_nat16.to_pointer, 1)
			Result := l_first = l_nat8
		ensure
			instance_free: class
		end

	is_64_bits: BOOLEAN
			-- Is the current process runing in 64-bit mode
		external
			"built_in static"
		ensure
			instance_free: class
		end
	
feature -- Access bytes size

	boolean_bytes: INTEGER_32
			-- Number of bytes in a value of type BOOLEAN
		external
			"built_in static"
		ensure
			instance_free: class
		end

	Character_8_bytes: INTEGER_32 = 1
			-- Number of bytes in a value of type CHARACTER_8

	Character_32_bytes: INTEGER_32 = 4
			-- Number of bytes in a value of type CHARACTER_32

	Natural_8_bytes: INTEGER_32 = 1
			-- Number of bytes in a value of type NATURAL_8

	Natural_16_bytes: INTEGER_32 = 2
			-- Number of bytes in a value of type NATURAL_16

	Natural_32_bytes: INTEGER_32 = 4
			-- Number of bytes in a value of type NATURAL_32

	Natural_64_bytes: INTEGER_32 = 8
			-- Number of bytes in a value of type NATURAL_64

	Integer_8_bytes: INTEGER_32 = 1
			-- Number of bytes in a value of type INTEGER_8

	Integer_16_bytes: INTEGER_32 = 2
			-- Number of bytes in a value of type INTEGER_16

	Integer_32_bytes: INTEGER_32 = 4
			-- Number of bytes in a value of type INTEGER_32

	Integer_64_bytes: INTEGER_32 = 8
			-- Number of bytes in a value of type INTEGER_64

	Real_32_bytes: INTEGER_32 = 4
			-- Number of bytes in a value of type REAL_32

	Real_64_bytes: INTEGER_32 = 8
			-- Number of bytes in a value of type REAL_64

	pointer_bytes: INTEGER_32
			-- Number of bytes in a value of type POINTER
		external
			"built_in static"
		ensure
			instance_free: class
		end
	
feature -- Access bits size

	boolean_bits: INTEGER_32
			-- Number of bits in a value of type BOOLEAN
		do
			Result := boolean_bytes * 8
		ensure
			instance_free: class
		end

	Character_8_bits: INTEGER_32 = 8
			-- Number of bits in a value of type CHARACTER_8

	Character_32_bits: INTEGER_32 = 32
			-- Number of bits in a value of type CHARACTER_32

	Natural_8_bits: INTEGER_32 = 8
			-- Number of bits in a value of type NATURAL_8

	Natural_16_bits: INTEGER_32 = 16
			-- Number of bits in a value of type NATURAL_16

	Natural_32_bits: INTEGER_32 = 32
			-- Number of bits in a value of type NATURAL_32

	Natural_64_bits: INTEGER_32 = 64
			-- Number of bits in a value of type NATURAL_64

	Integer_8_bits: INTEGER_32 = 8
			-- Number of bits in a value of type INTEGER_8

	Integer_16_bits: INTEGER_32 = 16
			-- Number of bits in a value of type INTEGER_16

	Integer_32_bits: INTEGER_32 = 32
			-- Number of bits in a value of type INTEGER_32

	Integer_64_bits: INTEGER_32 = 64
			-- Number of bits in a value of type INTEGER_64

	Real_32_bits: INTEGER_32 = 32
			-- Number of bits in a value of type REAL_32

	Real_64_bits: INTEGER_32 = 64
			-- Number of bits in a value of type REAL_64

	pointer_bits: INTEGER_32
			-- Number of bits in a value of type POINTER
		do
			Result := pointer_bytes * 8
		ensure
			instance_free: class
		end
	
feature -- Obsoletes

	character_bytes: INTEGER_32
		obsolete "Use `character_8_bytes' instead. [2017-05-31]"
			-- Number of bytes in a value of type CHARACTER_8
		external
			"built_in static"
		ensure
			instance_free: class
		end

	wide_character_bytes: INTEGER_32
		obsolete "Use `character_32_bytes' instead. [2017-05-31]"
			-- Number of bytes in a value of type CHARACTER_32
		external
			"built_in static"
		ensure
			instance_free: class
		end

	integer_bytes: INTEGER_32
		obsolete "Use `integer_32_bytes' instead. [2017-05-31]"
			-- Number of bytes in a value of type INTEGER_32
		external
			"built_in static"
		ensure
			instance_free: class
		end

	real_bytes: INTEGER_32
		obsolete "Use `real_32_bytes' instead. [2017-05-31]"
			-- Number of bytes in a value of type REAL_32
		external
			"built_in static"
		ensure
			instance_free: class
		end

	double_bytes: INTEGER_32
		obsolete "Use `real_64_bytes' instead. [2017-05-31]"
			-- Number of bytes in a value of type REAL_64
		external
			"built_in static"
		ensure
			instance_free: class
		end

	character_bits: INTEGER_32
		obsolete "Use `character_8_bits' instead. [2017-05-31]"
			-- Number of bits in a value of type CHARACTER_8
		do
			Result := 8
		ensure
			instance_free: class
		end

	integer_bits: INTEGER_32
		obsolete "Use `integer_32_bits' instead. [2017-05-31]"
			-- Number of bits in a value of type INTEGER_32
		do
			Result := 32
		ensure
			instance_free: class
		end

	real_bits: INTEGER_32
		obsolete "Use `real_32_bits' instead. [2017-05-31]"
			-- Number of bits in a value of type REAL_32
		do
			Result := 32
		ensure
			instance_free: class
		end

	double_bits: INTEGER_32
		obsolete "Use `real_64_bits' instead. [2017-05-31]"
			-- Number of bits in a value of type REAL_64
		do
			Result := 64
		ensure
			instance_free: class
		end

	maximum_character_code: INTEGER_32
		obsolete "Use `{CHARACTER_8}.max_value' instead. [2017-05-31]"
			-- Largest supported code for CHARACTER_8 values
		do
			Result := {CHARACTER_8}.max_value
		ensure
			instance_free: class
			meaningful: Result >= 127
		end

	maximum_integer: INTEGER_32
		obsolete "Use `{INTEGER}.max_value' instead. [2017-05-31]"
			-- Largest supported value of type INTEGER_32
		do
			Result := {INTEGER_32}.max_value
		ensure
			instance_free: class
			meaningful: Result >= 0
		end

	minimum_character_code: INTEGER_32
		obsolete "Use `{CHARACTER_8}.min_value' instead. [2017-05-31]"
			-- Smallest supported code for CHARACTER_8 values
		do
			Result := {CHARACTER_8}.min_value
		ensure
			instance_free: class
			meaningful: Result <= 0
		end

	minimum_integer: INTEGER_32
		obsolete "Use `{INTEGER}.min_value' instead. [2017-05-31]"
			-- Smallest supported value of type INTEGER_32
		do
			Result := {INTEGER_32}.min_value
		ensure
			instance_free: class
			meaningful: Result <= 0
		end
	
note
	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 PLATFORM

Generated by ISE EiffelStudio