indexing
	description: "Commonly used console input and output mechanisms. This class may be used as ancestor by classes needing its facilities."

class interface
	CONSOLE

create

feature -- Initialization

	make_open_stderr (fn: STRING)
			-- Create an unix standard error file.

	make_open_stdin (fn: STRING)
			-- Create an unix standard input file.
		require -- from FILE
			string_exists: fn /= void;
			string_not_empty: not fn.empty
		ensure -- from FILE
			exists: exists;


	make_open_stdout (fn: STRING)
			-- Create an unix standard output file.
		require -- from FILE
			string_exists: fn /= void;
			string_not_empty: not fn.empty
		ensure -- from FILE
			exists: exists;

	
feature {ANY} -- Access

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

	separator: CHARACTER
			-- ASCII code of character following last word read
			-- (from FILE)
	
feature -- Status report

	end_of_file: BOOLEAN
			-- Have we reached the end of file?
		require -- from FILE
			opened: not is_closed

	exists: BOOLEAN
			-- Does file exist?

feature {ANY} -- Status report

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

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

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

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

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

	last_string: STRING
			-- Last string read
			-- (from IO_MEDIUM)
	
feature {ANY} -- Element change

	append (f: like Current)
			-- Append a copy of the contents of f.
			-- (from FILE)
		require -- from SEQUENCE
			argument_not_void: s /= void
		require else -- from FILE
			target_is_closed: is_closed;
			source_is_closed: f.is_closed

feature -- Removal

	dispose
			-- This is closed by the operating system at completion.
	
feature -- Output

	new_line
			-- Write line feed at end of default output.
		require -- from IO_MEDIUM
			extendible: extendible

	put_boolean (b: BOOLEAN)
			-- Write b at end of default output.
			-- Was declared in CONSOLE as synonym of put_boolean and putbool.
		require -- from IO_MEDIUM
			extendible: extendible

	put_character (c: CHARACTER)
			-- Write c at end of default output.
			-- Was declared in CONSOLE as synonym of put_character and putchar.
		require -- from IO_MEDIUM
			extendible: extendible

	put_double (d: DOUBLE)
			-- Write d at end of default output.
			-- Was declared in CONSOLE as synonym of put_double and putdouble.
		require -- from IO_MEDIUM
			extendible: extendible

	put_integer (i: INTEGER)
			-- Write i at end of default output.
			-- Was declared in CONSOLE as synonym of put_integer and putint.
		require -- from IO_MEDIUM
			extendible: extendible

	put_real (r: REAL)
			-- Write r at end of default output.
			-- Was declared in CONSOLE as synonym of put_real and putreal.
		require -- from IO_MEDIUM
			extendible: extendible

	put_string (s: STRING)
			-- Write s at end of default output.
			-- Was declared in CONSOLE as synonym of put_string and putstring.
		require -- from IO_MEDIUM
			extendible: extendible;
			non_void: s /= void

	putbool (b: BOOLEAN)
			-- Write b at end of default output.
			-- Was declared in CONSOLE as synonym of put_boolean and putbool.
		require -- from IO_MEDIUM
			extendible: extendible

	putchar (c: CHARACTER)
			-- Write c at end of default output.
			-- Was declared in CONSOLE as synonym of put_character and putchar.
		require -- from IO_MEDIUM
			extendible: extendible

	putdouble (d: DOUBLE)
			-- Write d at end of default output.
			-- Was declared in CONSOLE as synonym of put_double and putdouble.
		require -- from IO_MEDIUM
			extendible: extendible

	putint (i: INTEGER)
			-- Write i at end of default output.
			-- Was declared in CONSOLE as synonym of put_integer and putint.
		require -- from IO_MEDIUM
			extendible: extendible

	putreal (r: REAL)
			-- Write r at end of default output.
			-- Was declared in CONSOLE as synonym of put_real and putreal.
		require -- from IO_MEDIUM
			extendible: extendible

	putstring (s: STRING)
			-- Write s at end of default output.
			-- Was declared in CONSOLE as synonym of put_string and putstring.
		require -- from IO_MEDIUM
			extendible: extendible;
			non_void: s /= void
	
feature -- Input

	next_line
			-- Move to next input line on standard input.
		require -- from FILE
			is_readable: file_readable

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

	read_double
			-- Read a new double from standard input.
			-- Make result available in last_double.
			-- Was declared in CONSOLE as synonym of read_double and readdouble.
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable

	read_integer
			-- Read a new integer from standard input.
			-- Make result available in last_integer.
			-- Was declared in CONSOLE as synonym of read_integer and readint.
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_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 CONSOLE as synonym of read_line and readline.
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable
		require else
			is_readable: file_readable

	read_real
			-- Read a new real from standard input.
			-- Make result available in last_real.
			-- Was declared in CONSOLE as synonym of read_real and readreal.
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable

	read_stream (nb_char: INTEGER)
			-- Read a string of at most nb_char bound characters
			-- from standard input.
			-- Make result available in last_string.
			-- Was declared in CONSOLE as synonym of read_stream and readstream.
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable

	read_word
			-- Read a new word from standard input.
			-- Make result available in last_string.
			-- Was declared in CONSOLE as synonym of read_word and readword.
		require -- from FILE
			is_readable: file_readable

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

	readdouble
			-- Read a new double from standard input.
			-- Make result available in last_double.
			-- Was declared in CONSOLE as synonym of read_double and readdouble.
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable

	readint
			-- Read a new integer from standard input.
			-- Make result available in last_integer.
			-- Was declared in CONSOLE as synonym of read_integer and readint.
		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 CONSOLE as synonym of read_line and readline.
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable
		require else
			is_readable: file_readable

	readreal
			-- Read a new real from standard input.
			-- Make result available in last_real.
			-- Was declared in CONSOLE as synonym of read_real and readreal.
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable

	readstream (nb_char: INTEGER)
			-- Read a string of at most nb_char bound characters
			-- from standard input.
			-- Make result available in last_string.
			-- Was declared in CONSOLE as synonym of read_stream and readstream.
		require -- from IO_MEDIUM
			is_readable: readable
		require else -- from FILE
			is_readable: file_readable

	readword
			-- Read a new word from standard input.
			-- Make result available in last_string.
			-- Was declared in CONSOLE as synonym of read_word and readword.
		require -- from FILE
			is_readable: file_readable
	
feature {ANY} -- Obsolete

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

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

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

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

	laststring: STRING
			-- Last string read
			-- (from IO_MEDIUM)
	
end -- class CONSOLE