EiffelBase class
(HTML page generated by ISE Eiffel 4.2)
Eiffel Class
indexing
description: "Files, viewed as persistent sequences of bytes";
status: "See notice at end of class";
date: "$Date: 2007-03-30 19:10:11 +0000 (Fri, 30 Mar 2007) $";
revision: "$Revision: 95354 $"
class RAW_FILE
inherit
FILE
rename
index as position
redefine
file_reopen, file_open, file_dopen
end
creation
make,
make_open_read,
make_open_write,
make_open_append,
make_open_read_write,
make_create_read_write,
make_open_read_append
feature -- Status report
Support_storable: BOOLEAN is true;
-- Can medium be used to an Eiffel structure?
feature -- Output
put_integer (i: INTEGER) is
-- Write binary value of i at current position.
-- Was declared in RAW_FILE as synonym of put_integer and putint.
do
file_pib (file_pointer, i)
end;
putint (i: INTEGER) is
-- Write binary value of i at current position.
-- Was declared in RAW_FILE as synonym of put_integer and putint.
do
file_pib (file_pointer, i)
end;
put_boolean (b: BOOLEAN) is
-- Write binary value of b at current position.
-- Was declared in RAW_FILE as synonym of put_boolean and putbool.
local
ext_bool_str: ANY
do
if b then
put_character ('%/1/')
else
put_character ('%U')
end
end;
putbool (b: BOOLEAN) is
-- Write binary value of b at current position.
-- Was declared in RAW_FILE as synonym of put_boolean and putbool.
local
ext_bool_str: ANY
do
if b then
put_character ('%/1/')
else
put_character ('%U')
end
end;
put_real (r: REAL) is
-- Write binary value of r at current position.
-- Was declared in RAW_FILE as synonym of put_real and putreal.
do
file_prb (file_pointer, r)
end;
putreal (r: REAL) is
-- Write binary value of r at current position.
-- Was declared in RAW_FILE as synonym of put_real and putreal.
do
file_prb (file_pointer, r)
end;
put_double (d: DOUBLE) is
-- Write binary value d at current position.
-- Was declared in RAW_FILE as synonym of put_double and putdouble.
do
file_pdb (file_pointer, d)
end;
putdouble (d: DOUBLE) is
-- Write binary value d at current position.
-- Was declared in RAW_FILE as synonym of put_double and putdouble.
do
file_pdb (file_pointer, d)
end;
feature -- Input
read_integer is
-- Read the binary representation of a new integer
-- from file. Make result available in last_integer.
-- Was declared in RAW_FILE as synonym of read_integer and readint.
do
last_integer := file_gib (file_pointer)
end;
readint is
-- Read the binary representation of a new integer
-- from file. Make result available in last_integer.
-- Was declared in RAW_FILE as synonym of read_integer and readint.
do
last_integer := file_gib (file_pointer)
end;
read_real is
-- Read the binary representation of a new real
-- from file. Make result available in last_real.
-- Was declared in RAW_FILE as synonym of read_real and readreal.
do
last_real := file_grb (file_pointer)
end;
readreal is
-- Read the binary representation of a new real
-- from file. Make result available in last_real.
-- Was declared in RAW_FILE as synonym of read_real and readreal.
do
last_real := file_grb (file_pointer)
end;
read_double is
-- Read the binary representation of a new double
-- from file. Make result available in last_double.
-- Was declared in RAW_FILE as synonym of read_double and readdouble.
do
last_double := file_gdb (file_pointer)
end;
readdouble is
-- Read the binary representation of a new double
-- from file. Make result available in last_double.
-- Was declared in RAW_FILE as synonym of read_double and readdouble.
do
last_double := file_gdb (file_pointer)
end;
feature {NONE} -- Implementation
file_gib (file: POINTER): INTEGER is
-- Get an integer from file
external
"C (FILE *): EIF_INTEGER | %"eif_file.h%""
end;
file_grb (file: POINTER): REAL is
-- Read a real from file
external
"C (FILE *): EIF_REAL | %"eif_file.h%""
end;
file_gdb (file: POINTER): DOUBLE is
-- Read a double from file
external
"C (FILE *): EIF_DOUBLE | %"eif_file.h%""
end;
file_open (f_name: POINTER; how: INTEGER): POINTER is
-- File pointer for file f_name, in mode how.
external
"C | %"eif_file.h%""
alias
"file_binary_open"
end;
file_dopen (fd, how: INTEGER): POINTER is
-- File pointer for file of descriptor fd in mode how
-- (which must fit the way fd was obtained).
external
"C | %"eif_file.h%""
alias
"file_binary_dopen"
end;
file_reopen (f_name: POINTER; how: INTEGER; file: POINTER): POINTER is
-- File pointer to file, reopened to have new name f_name
-- in a mode specified by how.
external
"C (char *, EIF_INTEGER, FILE *): EIF_POINTER | %"eif_file.h%""
alias
"file_binary_reopen"
end;
file_pib (file: POINTER; n: INTEGER) is
-- Put n to end of file.
external
"C (FILE *, EIF_INTEGER) | %"eif_file.h%""
end;
file_prb (file: POINTER; r: REAL) is
-- Put r to end of file.
external
"C (FILE *, EIF_REAL) | %"eif_file.h%""
end;
file_pdb (file: POINTER; d: DOUBLE) is
-- Put d to end of file.
external
"C (FILE *, EIF_DOUBLE) | %"eif_file.h%""
end;
invariant
not_plain_text: notis_plain_text;
end -- class RAW_FILE
|