note
	description: "Files viewed as persistent sequences of ASCII characters"
	library: "Free implementation of ELKS library"
	status: "See notice at end of class."
	legal: "See notice at end of class."
	date: "$Date: 2020-05-28 16:02:59 +0000 (Thu, 28 May 2020) $"
	revision: "$Revision: 104378 $"

class interface
	PLAIN_TEXT_FILE

create 
	make (fn: STRING_8)
			-- Create file object with fn as file name.
			-- (from FILE)
		require -- from FILE
			string_exists: fn /= Void
			string_not_empty: not fn.is_empty
		ensure -- from FILE
			file_named: internal_name = fn
			file_closed: is_closed

	make_with_name (fn: READABLE_STRING_GENERAL)
			-- Create file object with fn as file name.
		require -- from FILE
			fn_exists: fn /= Void
			fn_not_empty: not fn.is_empty
		ensure -- from FILE
			file_named: internal_name = fn
			file_closed: is_closed

	make_with_path (a_path: PATH)
			-- Create file object with a_path as path.
		require -- from FILE
			a_path_attached: a_path /= Void
			a_path_not_empty: not a_path.is_empty
		ensure -- from FILE
			path_set: path.same_as (a_path)
			file_closed: is_closed

	make_open_read (fn: READABLE_STRING_GENERAL)
			-- Create file object with fn as file name
			-- and open file in read mode.
			-- (from FILE)
		require -- from FILE
			string_exists: fn /= Void
			string_not_empty: not fn.is_empty
		ensure -- from FILE
			file_named: internal_name = fn
			exists: exists
			open_read: is_open_read

	make_open_write (fn: READABLE_STRING_GENERAL)
			-- Create file object with fn as file name
			-- and open file for writing;
			-- create it if it does not exist.
			-- (from FILE)
		require -- from FILE
			string_exists: fn /= Void
			string_not_empty: not fn.is_empty
		ensure -- from FILE
			file_named: internal_name = fn
			exists: exists
			open_write: is_open_write

	make_open_append (fn: READABLE_STRING_GENERAL)
			-- Create file object with fn as file name
			-- and open file in append-only mode.
			-- (from FILE)
		require -- from FILE
			string_exists: fn /= Void
			string_not_empty: not fn.is_empty
		ensure -- from FILE
			file_named: internal_name = fn
			exists: exists
			open_append: is_open_append

	make_open_read_write (fn: READABLE_STRING_GENERAL)
			-- Create file object with fn as file name
			-- and open file for both reading and writing.
			-- (from FILE)
		require -- from FILE
			string_exists: fn /= Void
			string_not_empty: not fn.is_empty
		ensure -- from FILE
			file_named: internal_name = fn
			exists: exists
			open_read: is_open_read
			open_write: is_open_write

	make_create_read_write (fn: READABLE_STRING_GENERAL)
			-- Create file object with fn as file name
			-- and open file for both reading and writing;
			-- create it if it does not exist.
			-- (from FILE)
		require -- from FILE
			string_exists: fn /= Void
			string_not_empty: not fn.is_empty
		ensure -- from FILE
			file_named: internal_name = fn
			exists: exists
			open_read: is_open_read
			open_write: is_open_write

	make_open_read_append (fn: READABLE_STRING_GENERAL)
			-- Create file object with fn as file name
			-- and open file for reading anywhere
			-- but writing at the end only.
			-- Create file if it does not exist.
			-- (from FILE)
		require -- from FILE
			string_exists: fn /= Void
			string_not_empty: not fn.is_empty
		ensure -- from FILE
			file_named: internal_name = fn
			exists: exists
			open_read: is_open_read
			open_append: is_open_append

	make_open_temporary
			-- Create a file object with a unique temporary file name,
			-- with read/write mode.
			-- (from FILE)
		ensure -- from FILE
			exists: exists
			open_read: is_open_read
			open_write: is_open_write

	make_open_temporary_with_prefix (a_prefix: READABLE_STRING_GENERAL)
			-- Create a file object with a unique temporary file name with prefix a_prefix,
			-- with read/write mode.
			-- (from FILE)
		ensure -- from FILE
			exists: exists
			open_read: is_open_read
			open_write: is_open_write

feature -- Initialization

	make_create_read_write (fn: READABLE_STRING_GENERAL)
			-- Create file object with fn as file name
			-- and open file for both reading and writing;
			-- create it if it does not exist.
			-- (from FILE)
		require -- from FILE
			string_exists: fn /= Void
			string_not_empty: not fn.is_empty
		ensure -- from FILE
			file_named: internal_name = fn
			exists: exists
			open_read: is_open_read
			open_write: is_open_write

	make_open_append (fn: READABLE_STRING_GENERAL)
			-- Create file object with fn as file name
			-- and open file in append-only mode.
			-- (from FILE)
		require -- from FILE
			string_exists: fn /= Void
			string_not_empty: not fn.is_empty
		ensure -- from FILE
			file_named: internal_name = fn
			exists: exists
			open_append: is_open_append

	make_open_read (fn: READABLE_STRING_GENERAL)
			-- Create file object with fn as file name
			-- and open file in read mode.
			-- (from FILE)
		require -- from FILE
			string_exists: fn /= Void
			string_not_empty: not fn.is_empty
		ensure -- from FILE
			file_named: internal_name = fn
			exists: exists
			open_read: is_open_read

	make_open_read_append (fn: READABLE_STRING_GENERAL)
			-- Create file object with fn as file name
			-- and open file for reading anywhere
			-- but writing at the end only.
			-- Create file if it does not exist.
			-- (from FILE)
		require -- from FILE
			string_exists: fn /= Void
			string_not_empty: not fn.is_empty
		ensure -- from FILE
			file_named: internal_name = fn
			exists: exists
			open_read: is_open_read
			open_append: is_open_append

	make_open_read_write (fn: READABLE_STRING_GENERAL)
			-- Create file object with fn as file name
			-- and open file for both reading and writing.
			-- (from FILE)
		require -- from FILE
			string_exists: fn /= Void
			string_not_empty: not fn.is_empty
		ensure -- from FILE
			file_named: internal_name = fn
			exists: exists
			open_read: is_open_read
			open_write: is_open_write

	make_open_temporary
			-- Create a file object with a unique temporary file name,
			-- with read/write mode.
			-- (from FILE)
		ensure -- from FILE
			exists: exists
			open_read: is_open_read
			open_write: is_open_write

	make_open_temporary_with_prefix (a_prefix: READABLE_STRING_GENERAL)
			-- Create a file object with a unique temporary file name with prefix a_prefix,
			-- with read/write mode.
			-- (from FILE)
		ensure -- from FILE
			exists: exists
			open_read: is_open_read
			open_write: is_open_write

	make_open_write (fn: READABLE_STRING_GENERAL)
			-- Create file object with fn as file name
			-- and open file for writing;
			-- create it if it does not exist.
			-- (from FILE)
		require -- from FILE
			string_exists: fn /= Void
			string_not_empty: not fn.is_empty
		ensure -- from FILE
			file_named: internal_name = fn
			exists: exists
			open_write: is_open_write
	
feature -- Access

	access_date: INTEGER_32
			-- Time stamp of last access made to the inode.
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	date: INTEGER_32
			-- Time stamp (time of last modification)
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	descriptor: INTEGER_32
			-- File descriptor as used by the operating system.
			-- (from FILE)
		require -- from IO_MEDIUM
			valid_handle: descriptor_available
		require else -- from FILE
			file_opened: not is_closed

	descriptor_available: BOOLEAN
			-- Is the handle available after class has been
			-- created?
			-- (from FILE)

	file_info: FILE_INFO
			-- Collected information about the file.
			-- (from FILE)

	file_pointer: POINTER
			-- File pointer as required in C
			-- (from FILE)

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

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

	group_id: INTEGER_32
			-- Group identification of owner
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	has (v: like item): BOOLEAN
			-- Does structure include an occurrence of v?
			-- (Reference or object equality,
			-- based on object_comparison.)
			-- (from LINEAR)
		require -- from  CONTAINER
			True
		ensure -- from CONTAINER
			not_found_in_empty: Result implies not is_empty

	index_of (v: like item; i: INTEGER_32): INTEGER_32
			-- Index of i-th occurrence of v.
			-- 0 if none.
			-- (Reference or object equality,
			-- based on object_comparison.)
			-- (from LINEAR)
		require -- from LINEAR
			positive_occurrences: i > 0
		ensure -- from LINEAR
			non_negative_result: Result >= 0

	inode: INTEGER_32
			-- I-node number
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	item: CHARACTER_8
			-- Current item
			-- (from FILE)
		require -- from ACTIVE
			readable: readable
		require -- from TRAVERSABLE
			not_off: not off

	item_for_iteration: CHARACTER_8
			-- Item at current position
			-- (from LINEAR)
		require -- from LINEAR
			not_off: not off

	links: INTEGER_32
			-- Number of links on file
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	null_name: STRING_8
			-- Null device name.
			-- (from FILE)
		ensure -- from FILE
			instance_free: class

	null_path: PATH
			-- Null device path.
			-- (from FILE)
		ensure -- from FILE
			instance_free: class

	occurrences (v: like item): INTEGER_32
			-- Number of times v appears.
			-- (Reference or object equality,
			-- based on object_comparison.)
			-- (from LINEAR)
		require -- from  BAG
			True
		ensure -- from BAG
			non_negative_occurrences: Result >= 0

	owner_name: STRING_8
			-- Name of owner
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	path: PATH
			-- Associated path of Current.
			-- (from FILE)
		ensure -- from FILE
			entry_not_empty: not Result.is_empty

	position: INTEGER_32
			-- Current cursor position.
			-- (from FILE)
		require -- from  LINEAR
			True

	protection: INTEGER_32
			-- Protection mode, in decimal value
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	retrieved: detachable ANY
			-- Retrieved object structure
			-- To access resulting object under correct type,
			-- use assignment attempt.
			-- Will raise an exception (code Retrieve_exception)
			-- if content is not a stored Eiffel structure.
			-- (from FILE)
		require -- from IO_MEDIUM
			is_readable: readable
			support_storable: Support_storable

	separator: CHARACTER_8
			-- ASCII code of character following last word read
			-- (from FILE)

	user_id: INTEGER_32
			-- User identification of owner
			-- (from FILE)
		require -- from FILE
			file_exists: exists
	
feature -- Measurement

	count: INTEGER_32
			-- Size in bytes (0 if no associated physical file)
			-- (from FILE)
		ensure -- from FINITE
			count_non_negative: Result >= 0
	
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)
		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)

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

	frozen is_deep_equal alias "≡≡≡" (other: PLAIN_TEXT_FILE): BOOLEAN
			-- Are Current and other attached to isomorphic object structures?
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
		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)

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

	same_file (fn: READABLE_STRING_GENERAL): BOOLEAN
			-- Is current file the same as a_filename?
			-- (from FILE)
		require -- from FILE
			fn_not_void: fn /= Void
			fn_not_empty: not fn.is_empty

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

	frozen standard_is_equal alias "≜" (other: PLAIN_TEXT_FILE): 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
		ensure -- from ANY
			same_type: Result implies same_type (other)
			symmetric: Result implies other.standard_is_equal (Current)
	
feature -- Status report

	access_exists: BOOLEAN
			-- Does physical file exist?
			-- (Uses real UID.)
			-- (from FILE)

	after: BOOLEAN
			-- Is there no valid cursor position to the right of cursor position?
			-- (from FILE)

	before: BOOLEAN
			-- Is there no valid cursor position to the left of cursor position?
			-- (from FILE)

	bytes_read: INTEGER_32
			-- Last number of bytes read by read_to_managed_pointer.
			-- (from IO_MEDIUM)

	changeable_comparison_criterion: BOOLEAN
			-- May object_comparison be changed?
			-- (Answer: yes by default.)
			-- (from CONTAINER)

	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

	end_of_file: BOOLEAN
			-- Has an EOF been detected?
			-- (from FILE)
		require -- from FILE
			opened: not is_closed

	exhausted: BOOLEAN
			-- Has structure been completely explored?
			-- (from LINEAR)
		ensure -- from LINEAR
			exhausted_when_off: off implies Result

	exists: BOOLEAN
			-- Does physical file exist?
			-- (Uses effective UID.)
			-- (from FILE)
		require -- from  IO_MEDIUM
			True
		ensure then -- from FILE
			unchanged_mode: mode = old mode

	extendible: BOOLEAN
			-- May new items be added?
			-- (from FILE)
		require -- from  COLLECTION
			True
		require -- from  IO_MEDIUM
			True

	file_readable: BOOLEAN
			-- Is there a current item that may be read?
			-- (from FILE)

	file_writable: BOOLEAN
			-- Is there a current item that may be modified?
			-- (from FILE)

	Full: BOOLEAN = False
			-- Is structure filled to capacity?
			-- (from FILE)

	is_access_executable: BOOLEAN
			-- Is file executable by real UID?
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	is_access_owner: BOOLEAN
			-- Is file owned by real UID?
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	is_access_readable: BOOLEAN
			-- Is file readable by real UID?
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	is_access_writable: BOOLEAN
			-- Is file writable by real UID?
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	is_block: BOOLEAN
			-- Is file a block special file?
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	is_character: BOOLEAN
			-- Is file a character special file?
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	is_closed: BOOLEAN
			-- Is file closed?
			-- (from FILE)

	is_creatable: BOOLEAN
			-- Is file creatable in parent directory?
			-- (Uses effective UID to check that parent is writable
			-- and file does not exist.)
			-- (from FILE)

	is_device: BOOLEAN
			-- Is file a device?
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	is_directory: BOOLEAN
			-- Is file a directory?
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	is_empty: BOOLEAN
			-- Is structure empty?
			-- (from FINITE)

	is_executable: BOOLEAN
			-- Is file executable?
			-- (Checks execute permission for effective UID.)
			-- (from FILE)
		require -- from IO_MEDIUM
			handle_exists: exists

	is_fifo: BOOLEAN
			-- Is file a named pipe?
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	is_inserted (v: CHARACTER_8): BOOLEAN
			-- Has v been inserted by the most recent insertion?
			-- (By default, the value returned is equivalent to calling 
			-- has (v). However, descendants might be able to provide more
			-- efficient implementations.)
			-- (from COLLECTION)

	is_open_append: BOOLEAN
			-- Is file open for appending?
			-- (from FILE)

	is_open_read: BOOLEAN
			-- Is file open for reading?
			-- (from FILE)

	is_open_write: BOOLEAN
			-- Is file open for writing?
			-- (from FILE)

	is_owner: BOOLEAN
			-- Is file owned by effective UID?
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	is_plain: BOOLEAN
			-- Is file a plain file?
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	is_plain_text: BOOLEAN
			-- Is file reserved for text (character sequences)? (Yes)

	is_readable: BOOLEAN
			-- Is file readable?
			-- (Checks permission for effective UID.)
			-- (from FILE)
		require -- from IO_MEDIUM
			handle_exists: exists

	is_setgid: BOOLEAN
			-- Is file setgid?
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	is_setuid: BOOLEAN
			-- Is file setuid?
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	is_socket: BOOLEAN
			-- Is file a named socket?
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	is_sticky: BOOLEAN
			-- Is file sticky (for memory swaps)?
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	is_symlink: BOOLEAN
			-- Is file a symbolic link?
			-- (from FILE)
		require -- from FILE
			file_exists: path_exists

	is_writable: BOOLEAN
			-- Is file writable?
			-- (Checks write permission for effective UID.)
			-- (from FILE)
		require -- from IO_MEDIUM
			handle_exists: exists

	last_character: CHARACTER_8
			-- Last character read by read_character.
			-- (from IO_MEDIUM)

	last_double: REAL_64
			-- Last double read by read_double
			-- (from IO_MEDIUM)

	last_integer: INTEGER_32
			-- Last integer read by read_integer
			-- (from IO_MEDIUM)

	last_integer_16: INTEGER_16
			-- Last 16-bit integer read by read_integer_16
			-- (from IO_MEDIUM)

	last_integer_32: INTEGER_32
			-- Synonymy of last_integer
			-- (from IO_MEDIUM)

	last_integer_64: INTEGER_64
			-- Last 64-bit integer read by read_integer_64
			-- (from IO_MEDIUM)

	last_integer_8: INTEGER_8
			-- Last 8-bit integer read by read_integer_8
			-- (from IO_MEDIUM)

	last_natural: NATURAL_32
			-- Last 32-bit natural read by read_natural
			-- (from IO_MEDIUM)

	last_natural_16: NATURAL_16
			-- Last 16-bit natural read by read_natural_16
			-- (from IO_MEDIUM)

	last_natural_32: NATURAL_32
			-- Synonymy of last_natural
			-- (from IO_MEDIUM)

	last_natural_64: NATURAL_64
			-- Last 64-bit natural read by read_natural_64
			-- (from IO_MEDIUM)

	last_natural_8: NATURAL_8
			-- Last 8-bit natural read by read_natural_8
			-- (from IO_MEDIUM)

	last_real: REAL_32
			-- Last real read by read_real
			-- (from IO_MEDIUM)

	last_real_32: REAL_32
			-- Last 32-bit real read by read_real_32.
			-- Synonym of last_real.
			-- (from IO_MEDIUM)

	last_real_64: REAL_64
			-- Last 64-bit real read by read_real_64.
			-- Synonym of last_double.
			-- (from IO_MEDIUM)

	last_string: STRING_8
			-- Last string read
			-- (from IO_MEDIUM)

	object_comparison: BOOLEAN
			-- Must search operations use equal rather than =
			-- for comparing references? (Default: no, use =.)
			-- (from CONTAINER)

	off: BOOLEAN
			-- Is there no item?
			-- (from FILE)
		require -- from  TRAVERSABLE
			True

	path_exists: BOOLEAN
			-- Does physical file name exist without resolving
			-- symbolic links?
			-- (from FILE)
		ensure then -- from FILE
			unchanged_mode: mode = old mode

	prunable: BOOLEAN
			-- Is there an item to be removed?
			-- (from FILE)

	readable: BOOLEAN
			-- Is there a current item that may be read?
			-- (from SEQUENCE)
		require -- from  ACTIVE
			True
		require -- from IO_MEDIUM
			handle_exists: exists

	replaceable: BOOLEAN
			-- Can current item be replaced?
			-- (from FILE)

	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
		ensure -- from ANY
			definition: Result = (conforms_to (other) and other.conforms_to (Current))

	Support_storable: BOOLEAN = False
			-- Can medium be used to store an Eiffel structure?

	writable: BOOLEAN
			-- Is there a current item that may be modified?
			-- (from SEQUENCE)
	
feature -- Status setting

	close
			-- Close file.
			-- (from FILE)
		require -- from IO_MEDIUM
			medium_is_open: not is_closed
		ensure then -- from FILE
			is_closed: is_closed

	compare_objects
			-- Ensure that future search operations will use equal
			-- rather than = for comparing references.
			-- (from CONTAINER)
		require -- from CONTAINER
			changeable_comparison_criterion: changeable_comparison_criterion
		ensure -- from CONTAINER
				object_comparison

	compare_references
			-- Ensure that future search operations will use =
			-- rather than equal for comparing references.
			-- (from CONTAINER)
		require -- from CONTAINER
			changeable_comparison_criterion: changeable_comparison_criterion
		ensure -- from CONTAINER
			reference_comparison: not object_comparison

	create_read_write
			-- Open file in read and write mode;
			-- create it if it does not exist.
			-- (from FILE)
		require -- from FILE
			is_closed: is_closed
		ensure -- from FILE
			exists: exists
			open_read: is_open_read
			open_write: is_open_write

	fd_open_append (fd: INTEGER_32)
			-- Open file of descriptor fd in append mode.
			-- (from FILE)
		ensure -- from FILE
			exists: exists
			open_append: is_open_append

	fd_open_read (fd: INTEGER_32)
			-- Open file of descriptor fd in read-only mode.
			-- (from FILE)
		ensure -- from FILE
			exists: exists
			open_read: is_open_read

	fd_open_read_append (fd: INTEGER_32)
			-- Open file of descriptor fd
			-- in read and write-at-end mode.
			-- (from FILE)
		ensure -- from FILE
			exists: exists
			open_read: is_open_read
			open_append: is_open_append

	fd_open_read_write (fd: INTEGER_32)
			-- Open file of descriptor fd in read-write mode.
			-- (from FILE)
		ensure -- from FILE
			exists: exists
			open_read: is_open_read
			open_write: is_open_write

	fd_open_write (fd: INTEGER_32)
			-- Open file of descriptor fd in write mode.
			-- (from FILE)
		ensure -- from FILE
			exists: exists
			open_write: is_open_write

	open_append
			-- Open file in append-only mode;
			-- create it if it does not exist.
			-- (from FILE)
		require -- from FILE
			is_closed: is_closed
		ensure -- from FILE
			exists: exists
			open_append: is_open_append

	open_read
			-- Open file in read-only mode.
			-- (from FILE)
		require -- from FILE
			is_closed: is_closed
		ensure -- from FILE
			exists: exists
			open_read: is_open_read

	open_read_append
			-- Open file in read and write-at-end mode;
			-- create it if it does not exist.
			-- (from FILE)
		require -- from FILE
			is_closed: is_closed
		ensure -- from FILE
			exists: exists
			open_read: is_open_read
			open_append: is_open_append

	open_read_write
			-- Open file in read and write mode.
			-- (from FILE)
		require -- from FILE
			is_closed: is_closed
		ensure -- from FILE
			exists: exists
			open_read: is_open_read
			open_write: is_open_write

	open_write
			-- Open file in write-only mode;
			-- create it if it does not exist.
			-- (from FILE)
		ensure -- from FILE
			exists: exists
			open_write: is_open_write

	recreate_read_write (fname: READABLE_STRING_GENERAL)
			-- Reopen in read-write mode with file of name fname;
			-- create file if it does not exist.
			-- (from FILE)
		require -- from FILE
			is_open: not is_closed
			valid_name: fname /= Void
		ensure -- from FILE
			exists: exists
			open_read: is_open_read
			open_write: is_open_write

	reopen_append (fname: READABLE_STRING_GENERAL)
			-- Reopen in append mode with file of name fname;
			-- create file if it does not exist.
			-- (from FILE)
		require -- from FILE
			is_open: not is_closed
			valid_name: fname /= Void
		ensure -- from FILE
			exists: exists
			open_append: is_open_append

	reopen_read (fname: READABLE_STRING_GENERAL)
			-- Reopen in read-only mode with file of name fname;
			-- create file if it does not exist.
			-- (from FILE)
		require -- from FILE
			is_open: not is_closed
			valid_name: fname /= Void
		ensure -- from FILE
			exists: exists
			open_read: is_open_read

	reopen_read_append (fname: READABLE_STRING_GENERAL)
			-- Reopen in read and write-at-end mode with file
			-- of name fname; create file if it does not exist.
			-- (from FILE)
		require -- from FILE
			is_open: not is_closed
			valid_name: fname /= Void
		ensure -- from FILE
			exists: exists
			open_read: is_open_read
			open_append: is_open_append

	reopen_read_write (fname: READABLE_STRING_GENERAL)
			-- Reopen in read-write mode with file of name fname.
			-- (from FILE)
		require -- from FILE
			is_open: not is_closed
			valid_name: fname /= Void
		ensure -- from FILE
			exists: exists
			open_read: is_open_read
			open_write: is_open_write

	reopen_write (fname: READABLE_STRING_GENERAL)
			-- Reopen in write-only mode with file of name fname;
			-- create file if it does not exist.
			-- (from FILE)
		require -- from FILE
			is_open: not is_closed
			valid_name: fname /= Void
		ensure -- from FILE
			exists: exists
			open_write: is_open_write
	
feature -- Cursor movement

	back
			-- Go back one position.
			-- (from FILE)
		require -- from BILINEAR
			not_before: not before

	finish
			-- Go to last position.
			-- (from FILE)
		require -- from  LINEAR
			True
		require else -- from FILE
			file_opened: not is_closed

	forth
			-- Go to next position.
			-- (from FILE)
		require -- from LINEAR
			not_after: not after
		require else -- from FILE
			file_opened: not is_closed

	go (abs_position: INTEGER_32)
			-- Go to the absolute position.
			-- (New position may be beyond physical length.)
			-- (from FILE)
		require -- from FILE
			file_opened: not is_closed
			non_negative_argument: abs_position >= 0

	move (offset: INTEGER_32)
			-- Advance by offset from current location.
			-- (from FILE)
		require -- from FILE
			file_opened: not is_closed

	next_line
			-- Move to next input line.
			-- (from FILE)
		require -- from FILE
			is_readable: file_readable

	recede (abs_position: INTEGER_32)
			-- Go to the absolute position backwards,
			-- starting from end of file.
			-- (from FILE)
		require -- from FILE
			file_opened: not is_closed
			non_negative_argument: abs_position >= 0

	search (v: like item)
			-- Move to first position (at or after current
			-- position) where item and v are equal.
			-- If structure does not include v ensure that
			-- exhausted will be true.
			-- (Reference or object equality,
			-- based on object_comparison.)
			-- (from BILINEAR)
		ensure -- from LINEAR
			object_found: (not exhausted and object_comparison) implies v ~ item
			item_found: (not exhausted and not object_comparison) implies v = item

	start
			-- Go to first position.
			-- (from FILE)
		require -- from  TRAVERSABLE
			True
		require else -- from FILE
			file_opened: not is_closed
	
feature -- Element change

	add_permission (who, what: STRING_8)
			-- Add read, write, execute or setuid permission
			-- for who ('u', 'g' or 'o') to what.
			-- (from FILE)
		require -- from FILE
			who_is_not_void: who /= Void
			what_is_not_void: what /= Void
			file_descriptor_exists: exists

	append (f: PLAIN_TEXT_FILE)
			-- Append a copy of the contents of f.
			-- (from FILE)
		require -- from SEQUENCE
			argument_not_void: f /= Void
		require else -- from FILE
			target_is_closed: is_closed
			source_is_closed: f.is_closed
		ensure -- from SEQUENCE
			new_count: count >= old count
		ensure then -- from FILE
			new_count: count = old count + f.count
			files_closed: f.is_closed and is_closed

	basic_store (object: ANY)
			-- Produce an external representation of the
			-- entire object structure reachable from object.
			-- Retrievable within current system only.
			-- (from FILE)
		require -- from IO_MEDIUM
			object_not_void: object /= Void
			extendible: extendible
			support_storable: Support_storable

	change_date: INTEGER_32
			-- Time stamp of last change.
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	change_group (new_group_id: INTEGER_32)
			-- Change group of file to new_group_id found in
			-- system password file.
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	change_mode (mask: INTEGER_32)
			-- Replace mode by mask.
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	change_owner (new_owner_id: INTEGER_32)
			-- Change owner of file to new_owner_id found in
			-- system password file. On some systems this
			-- requires super-user privileges.
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	extend (v: like item)
			-- Include v at end.
			-- (from FILE)
		require -- from COLLECTION
			extendible: extendible
		ensure -- from COLLECTION
			item_inserted: is_inserted (v)

	fill (other: CONTAINER [CHARACTER_8])
			-- Fill with as many items of other as possible.
			-- The representations of other and current structure
			-- need not be the same.
			-- (from COLLECTION)
		require -- from COLLECTION
			other_not_void: other /= Void
			extendible: extendible

	flush
			-- Flush buffered data to disk.
			-- Note that there is no guarantee that the operating
			-- system will physically write the data to the disk.
			-- At least it will end up in the buffer cache,
			-- making the data visible to other processes.
			-- (from FILE)
		require -- from FILE
			is_open: not is_closed

	force (v: like item)
			-- Add v to end.
			-- (from SEQUENCE)
		require -- from SEQUENCE
			extendible: extendible
		ensure then -- from SEQUENCE
			new_count: count = old count + 1
			item_inserted: has (v)

	general_store (object: ANY)
			-- Produce an external representation of the
			-- entire object structure reachable from object.
			-- Retrievable from other systems for same platform
			-- (machine architecture).
			-- (from FILE)
		require -- from IO_MEDIUM
			object_not_void: object /= Void
			extendible: extendible
			support_storable: Support_storable

	independent_store (object: ANY)
			-- Produce an external representation of the
			-- entire object structure reachable from object.
			-- Retrievable from other systems for the same or other
			-- platform (machine architecture).
			-- (from FILE)
		require -- from IO_MEDIUM
			object_not_void: object /= Void
			extendible: extendible
			support_storable: Support_storable

	link (fn: READABLE_STRING_GENERAL)
			-- Link current file to fn.
			-- fn must not already exist.
			-- (from FILE)
		require -- from FILE
			file_exists: exists

	new_line
			-- Write a new line character at current position.
			-- Was declared in FILE as synonym of put_new_line.
			-- (from FILE)
		require -- from IO_MEDIUM
			extendible: extendible

	put (v: like item)
			-- Add v to end.
			-- (from SEQUENCE)
		require -- from COLLECTION
			extendible: extendible
		ensure -- from COLLECTION
			item_inserted: is_inserted (v)
		ensure then -- from SEQUENCE
			new_count: count = old count + 1

	put_character (c: CHARACTER_8)
			-- Write c at current position.
			-- Was declared in FILE as synonym of putchar.
			-- (from FILE)
		require -- from IO_MEDIUM
			extendible: extendible

	put_managed_pointer (p: MANAGED_POINTER; start_pos, nb_bytes: INTEGER_32)
			-- Put data of length nb_bytes pointed by start_pos index in p at
			-- current position.
			-- (from FILE)
		require -- from IO_MEDIUM
			p_not_void: p /= Void
			p_large_enough: p.count >= nb_bytes + start_pos
			nb_bytes_non_negative: nb_bytes >= 0
			extendible: extendible

	put_new_line
			-- Write a new line character at current position.
			-- Was declared in FILE as synonym of new_line.
			-- (from FILE)
		require -- from IO_MEDIUM
			extendible: extendible

	put_string (s: READABLE_STRING_8)
			-- Write s at current position.
			-- Was declared in FILE as synonym of putstring.
			-- (from FILE)
		require -- from IO_MEDIUM
			extendible: extendible
			non_void: s /= Void

	putchar (c: CHARACTER_8)
			-- Write c at current position.
			-- Was declared in FILE as synonym of put_character.
			-- (from FILE)
		require -- from IO_MEDIUM
			extendible: extendible

	putstring (s: READABLE_STRING_8)
			-- Write s at current position.
			-- Was declared in FILE as synonym of put_string.
			-- (from FILE)
		require -- from IO_MEDIUM
			extendible: extendible
			non_void: s /= Void

	remove_permission (who, what: STRING_8)
			-- Remove read, write, execute or setuid permission
			-- for who ('u', 'g' or 'o') to what.
			-- (from FILE)
		require -- from FILE
			who_is_not_void: who /= Void
			what_is_not_void: what /= Void
			file_descriptor_exists: exists

	rename_file (new_name: READABLE_STRING_GENERAL)
			-- Change file name to new_name
			-- (from FILE)
		require -- from FILE
			new_name_not_void: new_name /= Void
			new_name_not_empty: not new_name.is_empty
			file_exists: exists
		ensure -- from FILE
			name_changed: internal_name = new_name

	rename_path (new_path: PATH)
			-- Change file name to new_path
			-- (from FILE)
		require -- from FILE
			new_path_not_void: new_path /= Void
			new_path_not_empty: not new_path.is_empty
			file_exists: exists
		ensure -- from FILE
			name_changed: internal_name.same_string (new_path.name)

	set_access (time: INTEGER_32)
			-- Stamp with time (access only).
			-- (from FILE)
		require -- from FILE
			file_exists: exists
		ensure -- from FILE
			acess_date_updated: access_date = time
			date_unchanged: date = old date

	set_date (time: INTEGER_32)
			-- Stamp with time (modification time only).
			-- (from FILE)
		require -- from FILE
			file_exists: exists
		ensure -- from FILE
			access_date_unchanged: access_date = old access_date
			date_updated: date = time

	stamp (time: INTEGER_32)
			-- Stamp with time (for both access and modification).
			-- (from FILE)
		require -- from FILE
			file_exists: exists
		ensure -- from FILE
			date_updated: date = time

	touch
			-- Update time stamp (for both access and modification).
			-- (from FILE)
		require -- from FILE
			file_exists: exists
		ensure -- from FILE
			date_changed: date /= old date
	
feature -- Removal

	delete
			-- Remove link with physical file.
			-- File does not physically disappear from the disk
			-- until no more processes reference it.
			-- I/O operations on it are still possible.
			-- A directory must be empty to be deleted.
			-- (from FILE)
		require -- from FILE
			exists: path_exists

	dispose
			-- Ensure this medium is closed when garbage collected.
			-- (from IO_MEDIUM)

	prune_all (v: like item)
			-- Remove all occurrences of v; go off.
			-- (from SEQUENCE)
		require -- from COLLECTION
			prunable: prunable
		ensure -- from COLLECTION
			no_more_occurrences: not has (v)

	reset (fn: READABLE_STRING_GENERAL)
			-- Change file name to fn and reset
			-- file descriptor and all information.
			-- (from FILE)
		require -- from FILE
			valid_file_name: fn /= Void
		ensure -- from FILE
			file_renamed: internal_name = fn
			file_closed: is_closed

	reset_path (fp: PATH)
			-- Change file name to fp and reset
			-- file descriptor and all information.
			-- (from FILE)
		require -- from FILE
			valid_file_name: fp /= Void
		ensure -- from FILE
			file_closed: is_closed

	wipe_out
			-- Remove all items.
			-- (from FILE)
		require -- from COLLECTION
			prunable: prunable
		require else -- from FILE
			is_closed: is_closed
		ensure -- from COLLECTION
			wiped_out: is_empty
	
feature -- Conversion

	linear_representation: LINEAR [CHARACTER_8]
			-- Representation as a linear structure
			-- (from LINEAR)
		require -- from  CONTAINER
			True
	
feature -- Duplication

	copy (other: PLAIN_TEXT_FILE)
			-- 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)
		ensure -- from ANY
			is_equal: Current ~ other

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

	frozen deep_twin: PLAIN_TEXT_FILE
			-- New object structure recursively duplicated from Current.
			-- (from ANY)
		ensure -- from ANY
			deep_twin_not_void: Result /= Void
			deep_equal: deep_equal (Current, Result)

	frozen standard_copy (other: PLAIN_TEXT_FILE)
			-- 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)
		ensure -- from ANY
			is_standard_equal: standard_is_equal (other)

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

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

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

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

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

	frozen do_nothing
			-- Execute a null action.
			-- (from ANY)
		ensure -- from ANY
			instance_free: class
	
feature -- Obsolete

	lastchar: CHARACTER_8
			-- Last character read by read_character
			-- (from IO_MEDIUM)

	lastdouble: REAL_64
			-- Last double read by read_double
			-- (from IO_MEDIUM)

	lastint: INTEGER_32
			-- Last integer read by read_integer
			-- (from IO_MEDIUM)

	lastreal: REAL_32
			-- Last real read by read_real
			-- (from IO_MEDIUM)

	laststring: like last_string
			-- Last string read
			-- (from IO_MEDIUM)
	
feature -- Inapplicable

	prune (v: like item)
			-- Remove an occurrence of v if any.
			-- (from FILE)
		require -- from COLLECTION
			prunable: prunable
		ensure then -- from FILE
				count <= old count

	remove
			-- Remove current item.
			-- (from FILE)
		require -- from ACTIVE
			prunable: prunable
			writable: writable

	replace (v: like item)
			-- Replace current item by v.
			-- (from FILE)
		require -- from ACTIVE
			writable: writable
			replaceable: replaceable
		ensure -- from ACTIVE
			item_replaced: item = v
	
feature -- Convenience

	copy_to (file: PLAIN_TEXT_FILE)
			-- Copy content of current from current cursor
			-- position to end of file into file from
			-- current cursor position of file.
			-- (from FILE)
		require -- from FILE
			file_not_void: file /= Void
			file_is_open_write: file.is_open_write
			current_is_open_read: is_open_read
	
feature -- Encoding

	Default_encoding: ENCODING
			-- Default value for encoding.
		ensure
			default_encoding_not_void: Result /= Void

	detect_encoding
			-- Detect and update encoding according to BOM detection.
		require
				is_open_read

	encoding: ENCODING
			-- Associated encoding.
		ensure
			encoding_not_void: Result /= Void

	put_encoding_bom
			-- Put Byte Order Mark (BOM) related to encoding.
		require
			is_open_write: is_open_write
			at_beginning: position = 0

	set_encoding (enc: like encoding)
			-- Set associated encoding with enc.
		require
			enc_not_void: enc /= Void
		ensure
			encoding_set: encoding = enc

	set_utf8_encoding
			-- Set encoding to UTF-8.
		ensure
			encoding_set: encoding = {SYSTEM_ENCODINGS}.utf8
	
feature -- Initialization	

	make_with_name (fn: READABLE_STRING_GENERAL)
			-- Create file object with fn as file name.
		require -- from FILE
			fn_exists: fn /= Void
			fn_not_empty: not fn.is_empty
		ensure -- from FILE
			file_named: internal_name = fn
			file_closed: is_closed

	make_with_path (a_path: PATH)
			-- Create file object with a_path as path.
		require -- from FILE
			a_path_attached: a_path /= Void
			a_path_not_empty: not a_path.is_empty
		ensure -- from FILE
			path_set: path.same_as (a_path)
			file_closed: is_closed
	
feature -- Input

	read_character
			-- Read a new character.
			-- Make result available in last_character.
			-- Was declared in FILE as synonym of readchar.
			-- (from FILE)
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable

	read_double
			-- Read the ASCII representation of a new double
			-- from file. Make result available in last_double.
			-- Was declared in PLAIN_TEXT_FILE as synonym of readdouble and read_real_64.
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable

	read_integer
			-- Read the ASCII representation of a new 32-bit integer
			-- from file. Make result available in last_integer.
			-- Was declared in PLAIN_TEXT_FILE as synonym of readint and read_integer_32.
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable

	read_integer_16
			-- Read the ASCII representation of a new 16-bit integer
			-- from file. Make result available in last_integer_16.
		require -- from IO_MEDIUM
			is_readable: readable

	read_integer_32
			-- Read the ASCII representation of a new 32-bit integer
			-- from file. Make result available in last_integer.
			-- Was declared in PLAIN_TEXT_FILE as synonym of read_integer and readint.
		require -- from IO_MEDIUM
			is_readable: readable

	read_integer_64
			-- Read the ASCII representation of a new 64-bit integer
			-- from file. Make result available in last_integer_64.
		require -- from IO_MEDIUM
			is_readable: readable

	read_integer_8
			-- Read the ASCII representation of a new 8-bit integer
			-- from file. Make result available in last_integer_8.
		require -- from IO_MEDIUM
			is_readable: readable

	read_line
			-- Read a string until new line or end of file.
			-- Make result available in last_string.
			-- New line will be consumed but not part of last_string.
			-- Was declared in FILE as synonym of readline.
			-- (from FILE)
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable
		ensure -- from IO_MEDIUM
			last_string_not_void: last_string /= Void

	read_line_thread_aware
			-- Read characters until a new line or
			-- end of medium.
			-- Make result available in last_string.
			-- Functionally identical to read_line but
			-- won't prevent garbage collection from occurring
			-- while blocked waiting for data, though data must
			-- be copied an extra time.			
			-- (from FILE)
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable
		ensure -- from IO_MEDIUM
			last_string_not_void: last_string /= Void

	read_natural
			-- Read the ASCII representation of a new 32-bit natural
			-- from file. Make result available in last_natural.
			-- Was declared in PLAIN_TEXT_FILE as synonym of read_natural_32.
		require -- from IO_MEDIUM
			is_readable: readable

	read_natural_16
			-- Read the ASCII representation of a new 16-bit natural
			-- from file. Make result available in last_natural_16.
		require -- from IO_MEDIUM
			is_readable: readable

	read_natural_32
			-- Read the ASCII representation of a new 32-bit natural
			-- from file. Make result available in last_natural.
			-- Was declared in PLAIN_TEXT_FILE as synonym of read_natural.
		require -- from IO_MEDIUM
			is_readable: readable

	read_natural_64
			-- Read the ASCII representation of a new 64-bit natural
			-- from file. Make result available in last_natural_64.
		require -- from IO_MEDIUM
			is_readable: readable

	read_natural_8
			-- Read the ASCII representation of a new 8-bit natural
			-- from file. Make result available in last_natural_8.
		require -- from IO_MEDIUM
			is_readable: readable

	read_real
			-- Read the ASCII representation of a new real
			-- from file. Make result available in last_real.
			-- Was declared in PLAIN_TEXT_FILE as synonym of readreal and read_real_32.
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable

	read_real_32
			-- Read the ASCII representation of a new real
			-- from file. Make result available in last_real.
			-- Was declared in PLAIN_TEXT_FILE as synonym of read_real and readreal.
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable

	read_real_64
			-- Read the ASCII representation of a new double
			-- from file. Make result available in last_double.
			-- Was declared in PLAIN_TEXT_FILE as synonym of read_double and readdouble.
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable

	read_stream (nb_char: INTEGER_32)
			-- Read a string of at most nb_char bound characters
			-- or until end of file.
			-- Make result available in last_string.
			-- Was declared in FILE as synonym of readstream.
			-- (from FILE)
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable
		ensure -- from IO_MEDIUM
			last_string_not_void: last_string /= Void

	read_stream_thread_aware (nb_char: INTEGER_32)
			-- Read a string of at most nb_char bound characters
			-- or until end of medium is encountered.
			-- Make result available in last_string.
			-- Functionally identical to read_stream but
			-- won't prevent garbage collection from occurring
			-- while blocked waiting for data, though data must
			-- be copied an extra time.			
			-- (from FILE)
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable
		ensure -- from IO_MEDIUM
			last_string_not_void: last_string /= Void

	read_to_managed_pointer (p: MANAGED_POINTER; start_pos, nb_bytes: INTEGER_32)
			-- Read at most nb_bytes bound bytes and make result
			-- available in p at position start_pos.
			-- (from FILE)
		require -- from IO_MEDIUM
			p_not_void: p /= Void
			p_large_enough: p.count >= nb_bytes + start_pos
			nb_bytes_non_negative: nb_bytes >= 0
			is_readable: readable
		require else -- from FILE
			p_not_void: p /= Void
			p_large_enough: p.count >= nb_bytes + start_pos
			is_readable: file_readable
		ensure -- from IO_MEDIUM
			bytes_read_non_negative: bytes_read >= 0
			bytes_read_not_too_big: bytes_read <= nb_bytes

	read_to_string (a_string: STRING_8; pos, nb: INTEGER_32): INTEGER_32
			-- Fill a_string, starting at position pos with at
			-- most nb characters read from current file.
			-- Return the number of characters actually read.
		require -- from FILE
			is_readable: file_readable
			not_end_of_file: not end_of_file
			a_string_not_void: a_string /= Void
			valid_position: a_string.valid_index (pos)
			nb_large_enough: nb > 0
			nb_small_enough: nb <= a_string.count - pos + 1
		ensure -- from FILE
			nb_char_read_large_enough: Result >= 0
			nb_char_read_small_enough: Result <= nb
			character_read: not end_of_file implies Result > 0

	read_word
			-- Read a string, excluding white space and stripping
			-- leading white space.
			-- Make result available in last_string.
			-- White space characters are: blank, new_line, tab,
			-- vertical tab, formfeed, end of file.
			-- Was declared in FILE as synonym of readword.
			-- (from FILE)
		require -- from FILE
			is_readable: file_readable
		ensure -- from FILE
			last_string_not_void: last_string /= Void

	read_word_thread_aware
			-- Read a string, excluding white space and stripping
			-- leading white space.
			-- Make result available in last_string.
			-- White space characters are: blank, new_line, tab,
			-- vertical tab, formfeed, end of file.
			-- (from FILE)
		require -- from FILE
			is_readable: file_readable
		ensure -- from FILE
			last_string_not_void: last_string /= Void

	readchar
			-- Read a new character.
			-- Make result available in last_character.
			-- Was declared in FILE as synonym of read_character.
			-- (from FILE)
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable

	readdouble
			-- Read the ASCII representation of a new double
			-- from file. Make result available in last_double.
			-- Was declared in PLAIN_TEXT_FILE as synonym of read_double and read_real_64.
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable

	readint
			-- Read the ASCII representation of a new 32-bit integer
			-- from file. Make result available in last_integer.
			-- Was declared in PLAIN_TEXT_FILE as synonym of read_integer and read_integer_32.
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable

	readline
			-- Read a string until new line or end of file.
			-- Make result available in last_string.
			-- New line will be consumed but not part of last_string.
			-- Was declared in FILE as synonym of read_line.
			-- (from FILE)
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable
		ensure -- from IO_MEDIUM
			last_string_not_void: last_string /= Void

	readreal
			-- Read the ASCII representation of a new real
			-- from file. Make result available in last_real.
			-- Was declared in PLAIN_TEXT_FILE as synonym of read_real and read_real_32.
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable

	readstream (nb_char: INTEGER_32)
			-- Read a string of at most nb_char bound characters
			-- or until end of file.
			-- Make result available in last_string.
			-- Was declared in FILE as synonym of read_stream.
			-- (from FILE)
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable
		ensure -- from IO_MEDIUM
			last_string_not_void: last_string /= Void

	readword
			-- Read a string, excluding white space and stripping
			-- leading white space.
			-- Make result available in last_string.
			-- White space characters are: blank, new_line, tab,
			-- vertical tab, formfeed, end of file.
			-- Was declared in FILE as synonym of read_word.
			-- (from FILE)
		require -- from FILE
			is_readable: file_readable
		ensure -- from FILE
			last_string_not_void: last_string /= Void
	
feature -- Iteration

	do_all (action: PROCEDURE [CHARACTER_8])
			-- Apply action to every item.
			-- Semantics not guaranteed if action changes the structure;
			-- in such a case, apply iterator to clone of structure instead.
			-- (from LINEAR)
		require -- from TRAVERSABLE
			action_exists: action /= Void

	do_if (action: PROCEDURE [CHARACTER_8]; test: FUNCTION [CHARACTER_8, BOOLEAN])
			-- Apply action to every item that satisfies test.
			-- Semantics not guaranteed if action or test changes the structure;
			-- in such a case, apply iterator to clone of structure instead.
			-- (from LINEAR)
		require -- from TRAVERSABLE
			action_exists: action /= Void
			test_exists: test /= Void

	for_all (test: FUNCTION [CHARACTER_8, BOOLEAN]): BOOLEAN
			-- Is test true for all items?
			-- Semantics not guaranteed if test changes the structure;
			-- in such a case, apply iterator to clone of structure instead.
			-- (from LINEAR)
		require -- from TRAVERSABLE
			test_exists: test /= Void
		ensure then -- from LINEAR
			empty: is_empty implies Result

	new_cursor: FILE_ITERATION_CURSOR
			-- Fresh cursor associated with current structure
			-- (from FILE)
		ensure -- from ITERABLE
			result_attached: Result /= Void

	there_exists (test: FUNCTION [CHARACTER_8, BOOLEAN]): BOOLEAN
			-- Is test true for at least one item?
			-- Semantics not guaranteed if test changes the structure;
			-- in such a case, apply iterator to clone of structure instead.
			-- (from LINEAR)
		require -- from TRAVERSABLE
			test_exists: test /= Void
	
feature -- Output

	Io: STD_FILES
			-- Handle to standard file setup
			-- (from ANY)
		ensure -- from ANY
			instance_free: class
			io_not_void: Result /= Void

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

	print (o: detachable ANY)
			-- Write terse external representation of o
			-- on standard output.
			-- (from ANY)
		ensure -- from ANY
			instance_free: class

	put_boolean (b: BOOLEAN)
			-- Write ASCII value of b at current position.
			-- Was declared in PLAIN_TEXT_FILE as synonym of putbool.
		require -- from IO_MEDIUM
			extendible: extendible

	put_double (d: REAL_64)
			-- Write ASCII value d at current position.
			-- Was declared in PLAIN_TEXT_FILE as synonym of putdouble and put_real_64.
		require -- from IO_MEDIUM
			extendible: extendible

	put_integer (i: INTEGER_32)
			-- Write ASCII value of i at current position.
			-- Was declared in PLAIN_TEXT_FILE as synonym of putint and put_integer_32.
		require -- from IO_MEDIUM
			extendible: extendible

	put_integer_16 (i: INTEGER_16)
			-- Write ASCII value of i at current position.
		require -- from IO_MEDIUM
			extendible: extendible

	put_integer_32 (i: INTEGER_32)
			-- Write ASCII value of i at current position.
			-- Was declared in PLAIN_TEXT_FILE as synonym of put_integer and putint.
		require -- from IO_MEDIUM
			extendible: extendible

	put_integer_64 (i: INTEGER_64)
			-- Write ASCII value of i at current position.
		require -- from IO_MEDIUM
			extendible: extendible

	put_integer_8 (i: INTEGER_8)
			-- Write ASCII value of i at current position.
		require -- from IO_MEDIUM
			extendible: extendible

	put_natural (i: NATURAL_32)
			-- Write ASCII value of i at current position.
			-- Was declared in PLAIN_TEXT_FILE as synonym of put_natural_32.
		require -- from IO_MEDIUM
			extendible: extendible

	put_natural_16 (i: NATURAL_16)
			-- Write ASCII value of i at current position.
		require -- from IO_MEDIUM
			extendible: extendible

	put_natural_32 (i: NATURAL_32)
			-- Write ASCII value of i at current position.
			-- Was declared in PLAIN_TEXT_FILE as synonym of put_natural.
		require -- from IO_MEDIUM
			extendible: extendible

	put_natural_64 (i: NATURAL_64)
			-- Write ASCII value of i at current position.
		require -- from IO_MEDIUM
			extendible: extendible

	put_natural_8 (i: NATURAL_8)
			-- Write ASCII value of i at current position.
		require -- from IO_MEDIUM
			extendible: extendible

	put_real (r: REAL_32)
			-- Write ASCII value of r at current position.
			-- Was declared in PLAIN_TEXT_FILE as synonym of putreal and put_real_32.
		require -- from IO_MEDIUM
			extendible: extendible

	put_real_32 (r: REAL_32)
			-- Write ASCII value of r at current position.
			-- Was declared in PLAIN_TEXT_FILE as synonym of put_real and putreal.
		require -- from IO_MEDIUM
			extendible: extendible

	put_real_64 (d: REAL_64)
			-- Write ASCII value d at current position.
			-- Was declared in PLAIN_TEXT_FILE as synonym of put_double and putdouble.
		require -- from IO_MEDIUM
			extendible: extendible

	put_string_32 (s: READABLE_STRING_32)
			-- Write string s at current position.

	put_string_general (s: READABLE_STRING_GENERAL)
			-- Write string s at current position.
		require
			extendible: extendible
			non_void: s /= Void

	putbool (b: BOOLEAN)
			-- Write ASCII value of b at current position.
			-- Was declared in PLAIN_TEXT_FILE as synonym of put_boolean.
		require -- from IO_MEDIUM
			extendible: extendible

	putdouble (d: REAL_64)
			-- Write ASCII value d at current position.
			-- Was declared in PLAIN_TEXT_FILE as synonym of put_double and put_real_64.
		require -- from IO_MEDIUM
			extendible: extendible

	putint (i: INTEGER_32)
			-- Write ASCII value of i at current position.
			-- Was declared in PLAIN_TEXT_FILE as synonym of put_integer and put_integer_32.
		require -- from IO_MEDIUM
			extendible: extendible

	putreal (r: REAL_32)
			-- Write ASCII value of r at current position.
			-- Was declared in PLAIN_TEXT_FILE as synonym of put_real and put_real_32.
		require -- from IO_MEDIUM
			extendible: extendible

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

	Operating_environment: OPERATING_ENVIRONMENT
			-- Objects available from the operating system
			-- (from ANY)
		ensure -- from ANY
			instance_free: class
			operating_environment_not_void: Result /= Void
	
feature -- Unicode input

	last_string_32: STRING_32
			-- Last unicode string read.

	read_unicode_line
			-- Read a line as STRING_32.
	
invariant
	plain_text: is_plain_text

		-- from FILE
	valid_mode: Closed_file <= mode and mode <= Append_read_file
	name_exists: internal_name /= Void
	name_not_empty: not internal_name.is_empty

		-- from FINITE
	empty_definition: is_empty = (count = 0)

		-- from ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)

		-- from ACTIVE
	writable_constraint: writable implies readable
	empty_constraint: is_empty implies (not readable) and (not writable)

		-- from BILINEAR
	not_both: not (after and before)
	before_constraint: before implies off

		-- from LINEAR
	after_constraint: after implies off

		-- from TRAVERSABLE
	empty_constraint: is_empty implies off

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 PLAIN_TEXT_FILE

Generated by ISE EiffelStudio