note
	description: "[
		Commonly used input and output mechanisms.
		This class may be used as either ancestor or supplier
		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: 2018-04-28 20:54:31 +0000 (Sat, 28 Apr 2018) $"
	revision: "$Revision: 101701 $"

class 
	STD_FILES

create 
	default_create

feature -- Access

	Input: PLAIN_TEXT_FILE
			-- Standard input file
		once
			create {CONSOLE} Result.make_open_stdin ("stdin")
		ensure
			instance_free: class
			input_not_void: Result /= Void
		end

	Output: PLAIN_TEXT_FILE
			-- Standard output file
		once
			create {CONSOLE} Result.make_open_stdout ("stdout")
		ensure
			instance_free: class
			output_not_void: Result /= Void
		end

	Error: PLAIN_TEXT_FILE
			-- Standard error file
		once
			create {CONSOLE} Result.make_open_stderr ("stderr")
		ensure
			instance_free: class
			error_not_void: Result /= Void
		end

	default_output: detachable PLAIN_TEXT_FILE
			-- Default output

	standard_default: PLAIN_TEXT_FILE
			-- Return the default_output or Output
			-- if default_output is Void.
		do
			Result := default_output
			if Result = Void then
				Result := Output
			end
		end
	
feature -- Status report

	last_character: CHARACTER_8
			-- Last character read by read_character
			-- Was declared in STD_FILES as synonym of lastchar.
		do
			Result := Input.last_character
		ensure
			instance_free: class
		end

	lastchar: CHARACTER_8
			-- Last character read by read_character
			-- Was declared in STD_FILES as synonym of last_character.
		do
			Result := Input.last_character
		ensure
			instance_free: class
		end

	last_integer: INTEGER_32
			-- Last integer read by read_integer
			-- Was declared in STD_FILES as synonym of lastint and last_integer_32.
		do
			Result := Input.last_integer
		ensure
			instance_free: class
		end

	lastint: INTEGER_32
			-- Last integer read by read_integer
			-- Was declared in STD_FILES as synonym of last_integer and last_integer_32.
		do
			Result := Input.last_integer
		ensure
			instance_free: class
		end

	last_integer_32: INTEGER_32
			-- Last integer read by read_integer
			-- Was declared in STD_FILES as synonym of last_integer and lastint.
		do
			Result := Input.last_integer
		ensure
			instance_free: class
		end

	last_integer_8: INTEGER_8
			-- Last 8-bit integer read by read_integer_8
		do
			Result := Input.last_integer_8
		ensure
			instance_free: class
		end

	last_integer_16: INTEGER_16
			-- Last 16-bit integer read by read_integer_16
		do
			Result := Input.last_integer_16
		ensure
			instance_free: class
		end

	last_integer_64: INTEGER_64
			-- Last 8-bit integer read by read_integer_64
		do
			Result := Input.last_integer_64
		ensure
			instance_free: class
		end

	last_natural_8: NATURAL_8
			-- Last 8-bit natural read by read_natural_8
		do
			Result := Input.last_natural_8
		ensure
			instance_free: class
		end

	last_natural_16: NATURAL_16
			-- Last 16-bit natural read by read_natural_16
		do
			Result := Input.last_natural_16
		ensure
			instance_free: class
		end

	last_natural: NATURAL_32
			-- Last 32-bit natural read by read_natural_32
			-- Was declared in STD_FILES as synonym of last_natural_32.
		do
			Result := Input.last_natural_32
		ensure
			instance_free: class
		end

	last_natural_32: NATURAL_32
			-- Last 32-bit natural read by read_natural_32
			-- Was declared in STD_FILES as synonym of last_natural.
		do
			Result := Input.last_natural_32
		ensure
			instance_free: class
		end

	last_natural_64: NATURAL_64
			-- Last 64-bit natural read by read_natural_64
		do
			Result := Input.last_natural_64
		ensure
			instance_free: class
		end

	last_real: REAL_32
			-- Last real read by read_real
			-- Was declared in STD_FILES as synonym of lastreal.
		do
			Result := Input.last_real
		ensure
			instance_free: class
		end

	lastreal: REAL_32
			-- Last real read by read_real
			-- Was declared in STD_FILES as synonym of last_real.
		do
			Result := Input.last_real
		ensure
			instance_free: class
		end

	last_string: STRING_8
			-- Last string read by read_line,
			-- read_stream, or read_word
			-- Was declared in STD_FILES as synonym of laststring.
		do
			Result := Input.last_string
		ensure
			instance_free: class
		end

	laststring: STRING_8
			-- Last string read by read_line,
			-- read_stream, or read_word
			-- Was declared in STD_FILES as synonym of last_string.
		do
			Result := Input.last_string
		ensure
			instance_free: class
		end

	last_double: REAL_64
			-- Last double read by read_double
			-- Was declared in STD_FILES as synonym of lastdouble.
		do
			Result := Input.last_double
		ensure
			instance_free: class
		end

	lastdouble: REAL_64
			-- Last double read by read_double
			-- Was declared in STD_FILES as synonym of last_double.
		do
			Result := Input.last_double
		ensure
			instance_free: class
		end
	
feature -- Element change

	set_error_default
			-- Use standard error as default output.
		do
			default_output := Error
		end

	set_file_default (f: PLAIN_TEXT_FILE)
			-- Use f as default output.
		require
			valid_argument: f /= Void
			file_open_write: f.is_open_write
		do
			default_output := f
		end

	set_output_default
			-- Use standard output as default output.
		do
			default_output := Output
		end

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

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

	put_string (s: STRING_8)
			-- Write s at end of default output.
			-- Was declared in STD_FILES as synonym of putstring.
		require
			string_not_void: s /= Void
		do
			standard_default.put_string (s)
		end

	putstring (s: STRING_8)
			-- Write s at end of default output.
			-- Was declared in STD_FILES as synonym of put_string.
		require
			string_not_void: s /= Void
		do
			standard_default.put_string (s)
		end

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

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

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

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

	put_integer (i: INTEGER_32)
			-- Write i at end of default output.
			-- Was declared in STD_FILES as synonym of putint and put_integer_32.
		do
			standard_default.put_integer (i)
		end

	putint (i: INTEGER_32)
			-- Write i at end of default output.
			-- Was declared in STD_FILES as synonym of put_integer and put_integer_32.
		do
			standard_default.put_integer (i)
		end

	put_integer_32 (i: INTEGER_32)
			-- Write i at end of default output.
			-- Was declared in STD_FILES as synonym of put_integer and putint.
		do
			standard_default.put_integer (i)
		end

	put_integer_8 (i: INTEGER_8)
			-- Write i at end of default output.
		do
			standard_default.put_integer_8 (i)
		end

	put_integer_16 (i: INTEGER_16)
			-- Write i at end of default output.
		do
			standard_default.put_integer_16 (i)
		end

	put_integer_64 (i: INTEGER_64)
			-- Write i at end of default output.
		do
			standard_default.put_integer_64 (i)
		end

	put_natural_8 (i: NATURAL_8)
			-- Write i at end of default output.
		do
			standard_default.put_natural_8 (i)
		end

	put_natural_16 (i: NATURAL_16)
			-- Write i at end of default output.
		do
			standard_default.put_natural_16 (i)
		end

	put_natural (i: NATURAL_32)
			-- Write i at end of default output.
			-- Was declared in STD_FILES as synonym of put_natural_32.
		do
			standard_default.put_natural_32 (i)
		end

	put_natural_32 (i: NATURAL_32)
			-- Write i at end of default output.
			-- Was declared in STD_FILES as synonym of put_natural.
		do
			standard_default.put_natural_32 (i)
		end

	put_natural_64 (i: NATURAL_64)
			-- Write i at end of default output.
		do
			standard_default.put_natural_64 (i)
		end

	put_boolean (b: BOOLEAN)
			-- Write b at end of default output.
			-- Was declared in STD_FILES as synonym of putbool.
		do
			if b then
				put_string ("True")
			else
				put_string ("False")
			end
		end

	putbool (b: BOOLEAN)
			-- Write b at end of default output.
			-- Was declared in STD_FILES as synonym of put_boolean.
		do
			if b then
				put_string ("True")
			else
				put_string ("False")
			end
		end

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

	new_line
			-- Write line feed at end of default output.
			-- Was declared in STD_FILES as synonym of put_new_line.
		do
			standard_default.put_new_line
		end
	
feature -- Input

	read_integer
			-- Read a new 32-bit integer from standard input.
			-- Make result available in last_integer.
			-- Was declared in STD_FILES as synonym of readint and read_integer_32.
		do
			Input.read_integer
		ensure
			instance_free: class
		end

	readint
			-- Read a new 32-bit integer from standard input.
			-- Make result available in last_integer.
			-- Was declared in STD_FILES as synonym of read_integer and read_integer_32.
		do
			Input.read_integer
		ensure
			instance_free: class
		end

	read_integer_32
			-- Read a new 32-bit integer from standard input.
			-- Make result available in last_integer.
			-- Was declared in STD_FILES as synonym of read_integer and readint.
		do
			Input.read_integer
		ensure
			instance_free: class
		end

	read_integer_8
			-- Read a new 8-bit integer from standard input.
			-- Make result available in last_integer_8.
		do
			Input.read_integer_8
		ensure
			instance_free: class
		end

	read_integer_16
			-- Read a new 16-bit integer from standard input.
			-- Make result available in last_integer_16.
		do
			Input.read_integer_16
		ensure
			instance_free: class
		end

	read_integer_64
			-- Read a new 64-bit integer from standard input.
			-- Make result available in last_integer_64.
		do
			Input.read_integer_64
		ensure
			instance_free: class
		end

	read_natural_8
			-- Read a new 8-bit natural from standard input.
			-- Make result available in last_natural_8.
		do
			Input.read_natural_8
		ensure
			instance_free: class
		end

	read_natural_16
			-- Read a new 16-bit natural from standard input.
			-- Make result available in last_natural_16.
		do
			Input.read_natural_16
		ensure
			instance_free: class
		end

	read_natural
			-- Read a new 32-bit natural from standard input.
			-- Make result available in last_natural.
			-- Was declared in STD_FILES as synonym of read_natural_32.
		do
			Input.read_natural_32
		ensure
			instance_free: class
		end

	read_natural_32
			-- Read a new 32-bit natural from standard input.
			-- Make result available in last_natural.
			-- Was declared in STD_FILES as synonym of read_natural.
		do
			Input.read_natural_32
		ensure
			instance_free: class
		end

	read_natural_64
			-- Read a new 64-bit natural from standard input.
			-- Make result available in last_natural_64.
		do
			Input.read_natural_64
		ensure
			instance_free: class
		end

	read_real
			-- Read a new real from standard input.
			-- Make result available in last_real.
			-- Was declared in STD_FILES as synonym of readreal.
		do
			Input.read_real
		ensure
			instance_free: class
		end

	readreal
			-- Read a new real from standard input.
			-- Make result available in last_real.
			-- Was declared in STD_FILES as synonym of read_real.
		do
			Input.read_real
		ensure
			instance_free: class
		end

	read_double
			-- Read a new double from standard input.
			-- Make result available in last_double.
			-- Was declared in STD_FILES as synonym of readdouble.
		do
			Input.read_double
		ensure
			instance_free: class
		end

	readdouble
			-- Read a new double from standard input.
			-- Make result available in last_double.
			-- Was declared in STD_FILES as synonym of read_double.
		do
			Input.read_double
		ensure
			instance_free: class
		end

	read_line
			-- Read a line from standard input.
			-- Make result available in last_string.
			-- Was declared in STD_FILES as synonym of readline.
		do
			Input.read_line
		ensure
			instance_free: class
			last_string_not_void: last_string /= Void
		end

	readline
			-- Read a line from standard input.
			-- Make result available in last_string.
			-- Was declared in STD_FILES as synonym of read_line.
		do
			Input.read_line
		ensure
			instance_free: class
			last_string_not_void: last_string /= Void
		end

	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 STD_FILES as synonym of readstream.
		do
			Input.read_stream (nb_char)
		ensure
			instance_free: class
			last_string_not_void: last_string /= Void
		end

	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 STD_FILES as synonym of read_stream.
		do
			Input.read_stream (nb_char)
		ensure
			instance_free: class
			last_string_not_void: last_string /= Void
		end

	read_word
			-- Read a new word from standard input.
			-- Make result available in last_string.
			-- Was declared in STD_FILES as synonym of readword.
		do
			Input.read_word
		ensure
			instance_free: class
			last_string_not_void: last_string /= Void
		end

	readword
			-- Read a new word from standard input.
			-- Make result available in last_string.
			-- Was declared in STD_FILES as synonym of read_word.
		do
			Input.read_word
		ensure
			instance_free: class
			last_string_not_void: last_string /= Void
		end

	read_character
			-- Read a new character from standard input.
			-- It will not return until read operation is
			-- terminated when enter key is pressed.
			-- Make result available in last_character.
			-- last_character will also contains platform
			-- specific newline character.
			-- Was declared in STD_FILES as synonym of readchar.
		do
			Input.read_character
		ensure
			instance_free: class
		end

	readchar
			-- Read a new character from standard input.
			-- It will not return until read operation is
			-- terminated when enter key is pressed.
			-- Make result available in last_character.
			-- last_character will also contains platform
			-- specific newline character.
			-- Was declared in STD_FILES as synonym of read_character.
		do
			Input.read_character
		ensure
			instance_free: class
		end

	to_next_line
			-- Move to next input line on standard input.
			-- Was declared in STD_FILES as synonym of next_line.
		do
			Input.next_line
		ensure
			instance_free: class
		end

	next_line
			-- Move to next input line on standard input.
			-- Was declared in STD_FILES as synonym of to_next_line.
		do
			Input.next_line
		ensure
			instance_free: class
		end
	
note
	copyright: "Copyright (c) 1984-2018, 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 STD_FILES

Generated by ISE EiffelStudio