note
	description: "[
		Commonly used console input and output mechanisms. 
		This class may be used as ancestor by classes needing its facilities.
	]"
	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
	CONSOLE

create {STD_FILES}
	make_open_stdin,
	make_open_stdout,
	make_open_stderr

feature -- Initialization

	make_open_stdin (fn: READABLE_STRING_GENERAL)
			-- Create a standard input file.

	make_open_stdout (fn: READABLE_STRING_GENERAL)
			-- Create a standard output file.

	make_open_stderr (fn: READABLE_STRING_GENERAL)
			-- Create a standard error file.
	
feature -- Encoding

	Default_encoding: ENCODING
			-- Default value for encoding.

	detect_encoding
			-- Detect and update encoding according to BOM detection.
	
feature -- Status report

	end_of_file: BOOLEAN
			-- Have we reached the end of file?

	exists: BOOLEAN
			-- Does file exist?

	Count: INTEGER_32 = 1
			-- Useless for CONSOLE class.
	
feature -- Removal

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

	back
			-- Not supported on console
	
feature -- Iteration

	new_cursor: FILE_ITERATION_CURSOR
			-- Fresh cursor associated with current structure
	
feature -- Input

	read_real
			-- Read a new real from standard input.
			-- Make result available in last_real.
			-- Was declared in CONSOLE as synonym of readreal.

	readreal
			-- Read a new real from standard input.
			-- Make result available in last_real.
			-- Was declared in CONSOLE as synonym of read_real.

	read_double
			-- Read a new double from standard input.
			-- Make result available in last_double.
			-- Was declared in CONSOLE as synonym of readdouble.

	readdouble
			-- Read a new double from standard input.
			-- Make result available in last_double.
			-- Was declared in CONSOLE as synonym of read_double.

	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 readline.
		require else
			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.
		require else
			is_readable: file_readable

	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.			
		require else
			is_readable: file_readable

	read_stream (nb_char: INTEGER_32)
			-- 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 readstream.

	readstream (nb_char: INTEGER_32)
			-- 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.

	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.			

	read_word
			-- Read a new word from standard input.
			-- Make result available in last_string.
			-- Was declared in CONSOLE as synonym of readword.

	readword
			-- Read a new word from standard input.
			-- Make result available in last_string.
			-- Was declared in CONSOLE as synonym of read_word.

	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.

	read_character
			-- Read a new character from standard input.
			-- Make result available in last_character.
			-- Was declared in CONSOLE as synonym of readchar.

	readchar
			-- Read a new character from standard input.
			-- Make result available in last_character.
			-- Was declared in CONSOLE as synonym of read_character.

	next_line
			-- Move to next input line on standard input.
	
feature -- Output

	put_character (c: CHARACTER_8)
			-- Write c at end of default output.
			-- Was declared in CONSOLE as synonym of putchar.

	putchar (c: CHARACTER_8)
			-- Write c at end of default output.
			-- Was declared in CONSOLE as synonym of put_character.

	put_string (s: READABLE_STRING_8)
			-- Write s at end of default output.
			-- Was declared in CONSOLE as synonym of putstring.

	putstring (s: READABLE_STRING_8)
			-- Write s at end of default output.
			-- Was declared in CONSOLE as synonym of put_string.

	put_real (r: REAL_32)
			-- Write r at end of default output.
			-- Was declared in CONSOLE as synonym of putreal.

	putreal (r: REAL_32)
			-- Write r at end of default output.
			-- Was declared in CONSOLE as synonym of put_real.

	put_double (d: REAL_64)
			-- Write d at end of default output.
			-- Was declared in CONSOLE as synonym of putdouble.

	putdouble (d: REAL_64)
			-- Write d at end of default output.
			-- Was declared in CONSOLE as synonym of put_double.

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

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

	put_new_line
			-- Write line feed at end of default output.
			-- Was declared in CONSOLE as synonym of new_line.

	new_line
			-- Write line feed at end of default output.
			-- Was declared in CONSOLE as synonym of put_new_line.
	
feature -- Inapplicable

	Is_empty: BOOLEAN = False
			-- Useless for CONSOLE class.
	
feature -- Implementation

	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.
	
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 CONSOLE

Generated by ISE EiffelStudio