This site contains older material on Eiffel. For the main Eiffel page, see http://www.eiffel.com.

EiffelBase class
(HTML page generated by ISE Eiffel 4.2)

Eiffel Class
indexing
	description: "Commonly used input and output mechanisms. This class may be used as either ancestor or supplier by classes needing its facilities.";
	status: "See notice at end of class";
	date: "$Date: 2007-03-30 19:10:11 +0000 (Fri, 30 Mar 2007) $";
	revision: "$Revision: 95354 $"

class STD_FILES

feature -- Access

	input: PLAIN_TEXT_FILE is
			-- Standard input file
		once
			!CONSOLE! Result.make_open_stdin ("stdin")
		end;

	output: PLAIN_TEXT_FILE is
			-- Standard output file
		once
			!CONSOLE! Result.make_open_stdout ("stdout")
		end;

	error: PLAIN_TEXT_FILE is
			-- Standard error file
		once
			!CONSOLE! Result.make_open_stderr ("stderr")
		end;

	default_output: PLAIN_TEXT_FILE;
			-- Default output

	standard_default: PLAIN_TEXT_FILE is
			-- Return the default_output or output
			-- if default_output is Void.
		do
			if default_output = void then
				Result := output
			else
				Result := default_output
			end
		end;

feature -- Status report

	last_character: CHARACTER is
			-- Last character read by read_character
			-- Was declared in STD_FILES as synonym of last_character and lastchar.
		do
			Result := input.last_character
		end;

	lastchar: CHARACTER is
			-- Last character read by read_character
			-- Was declared in STD_FILES as synonym of last_character and lastchar.
		do
			Result := input.last_character
		end;

	last_integer: INTEGER is
			-- Last integer read by read_integer
			-- Was declared in STD_FILES as synonym of last_integer and lastint.
		do
			Result := input.last_integer
		end;

	lastint: INTEGER is
			-- Last integer read by read_integer
			-- Was declared in STD_FILES as synonym of last_integer and lastint.
		do
			Result := input.last_integer
		end;

	last_real: REAL is
			-- Last real read by read_real
			-- Was declared in STD_FILES as synonym of last_real and lastreal.
		do
			Result := input.last_real
		end;

	lastreal: REAL is
			-- Last real read by read_real
			-- Was declared in STD_FILES as synonym of last_real and lastreal.
		do
			Result := input.last_real
		end;

	last_string: STRING is
			-- Last string read by read_line,
			-- read_stream, or read_word
			-- Was declared in STD_FILES as synonym of last_string and laststring.
		do
			Result := input.last_string
		end;

	laststring: STRING is
			-- Last string read by read_line,
			-- read_stream, or read_word
			-- Was declared in STD_FILES as synonym of last_string and laststring.
		do
			Result := input.last_string
		end;

	last_double: DOUBLE is
			-- Last double read by read_double
			-- Was declared in STD_FILES as synonym of last_double and lastdouble.
		do
			Result := input.last_double
		end;

	lastdouble: DOUBLE is
			-- Last double read by read_double
			-- Was declared in STD_FILES as synonym of last_double and lastdouble.
		do
			Result := input.last_double
		end;

feature -- Element change

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

	set_file_default (f: PLAIN_TEXT_FILE) is
			-- 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 is
			-- Use standard output as default output.
		do
			default_output := output
		end;

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

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

	put_string (s: STRING) is
			-- Write s at end of default output.
			-- Was declared in STD_FILES as synonym of put_string and putstring.
		require
			string_not_void: s /= void
		do
			standard_default.put_string (s)
		end;

	putstring (s: STRING) is
			-- Write s at end of default output.
			-- Was declared in STD_FILES as synonym of put_string and putstring.
		require
			string_not_void: s /= void
		do
			standard_default.put_string (s)
		end;

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

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

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

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

	put_integer (i: INTEGER) is
			-- 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;

	putint (i: INTEGER) is
			-- 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_boolean (b: BOOLEAN) is
			-- Write b at end of default output.
			-- Was declared in STD_FILES as synonym of put_boolean and putbool.
		do
			if b then
				put_string ("true")
			else
				put_string ("false")
			end
		end;

	putbool (b: BOOLEAN) is
			-- Write b at end of default output.
			-- Was declared in STD_FILES as synonym of put_boolean and putbool.
		do
			if b then
				put_string ("true")
			else
				put_string ("false")
			end
		end;

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

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

feature -- Input

	read_integer is
			-- Read a new 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
		end;

	readint is
			-- Read a new 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
		end;

	read_real is
			-- Read a new real from standard input.
			-- Make result available in last_real.
			-- Was declared in STD_FILES as synonym of read_real and readreal.
		do
			input.read_real
		end;

	readreal is
			-- Read a new real from standard input.
			-- Make result available in last_real.
			-- Was declared in STD_FILES as synonym of read_real and readreal.
		do
			input.read_real
		end;

	read_double is
			-- Read a new double from standard input.
			-- Make result available in last_double.
			-- Was declared in STD_FILES as synonym of read_double and readdouble.
		do
			input.read_double
		end;

	readdouble is
			-- Read a new double from standard input.
			-- Make result available in last_double.
			-- Was declared in STD_FILES as synonym of read_double and readdouble.
		do
			input.read_double
		end;

	read_line is
			-- Read a line from standard input.
			-- Make result available in last_string.
			-- Was declared in STD_FILES as synonym of read_line and readline.
		do
			input.read_line
		end;

	readline is
			-- Read a line from standard input.
			-- Make result available in last_string.
			-- Was declared in STD_FILES as synonym of read_line and readline.
		do
			input.read_line
		end;

	read_stream (nb_char: INTEGER) is
			-- 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 and readstream.
		do
			input.read_stream (nb_char)
		end;

	readstream (nb_char: INTEGER) is
			-- 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 and readstream.
		do
			input.read_stream (nb_char)
		end;

	read_word is
			-- Read a new word from standard input.
			-- Make result available in last_string.
			-- Was declared in STD_FILES as synonym of read_word and readword.
		do
			input.read_word
		end;

	readword is
			-- Read a new word from standard input.
			-- Make result available in last_string.
			-- Was declared in STD_FILES as synonym of read_word and readword.
		do
			input.read_word
		end;

	read_character is
			-- Read a new character from standard input.
			-- Make result available in last_character.
			-- Was declared in STD_FILES as synonym of read_character and readchar.
		do
			input.read_character
		end;

	readchar is
			-- Read a new character from standard input.
			-- Make result available in last_character.
			-- Was declared in STD_FILES as synonym of read_character and readchar.
		do
			input.read_character
		end;

	to_next_line is
			-- Move to next input line on standard input.
			-- Was declared in STD_FILES as synonym of to_next_line and next_line.
		do
			input.next_line
		end;

	next_line is
			-- Move to next input line on standard input.
			-- Was declared in STD_FILES as synonym of to_next_line and next_line.
		do
			input.next_line
		end;

end -- class STD_FILES