|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 4633 (0x1219) Types: TextFile Notes: R1k Text-file segment
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦595c80207⟧ └─⟦this⟧
with a_strings; with os_files; use os_files; with system; with v_i_mutex; package file_support is stdin_fd: file_descriptor renames os_files.stdin_fd; stdout_fd: file_descriptor renames os_files.stdout_fd; stderr_fd: file_descriptor renames os_files.stderr_fd; function sequential return os_files.file_styles renames os_files.sequential; function direct return os_files.file_styles renames os_files.direct; function text return os_files.file_styles renames os_files.text; function "="(a, b: file_id_ptr) return boolean renames os_files."="; function same_id(a, b: file_id_ptr) return boolean renames os_files.same_id; function file_size(fd: file_descriptor; elem_size: integer) return integer renames os_files.file_size; function is_interactive(fd: file_descriptor) return boolean renames os_files.is_interactive; procedure position_file(fd: file_descriptor; to, size: integer) renames os_files.position_file; procedure skip_in_file(fd: file_descriptor; to: integer) renames os_files.skip_in_file; function read(fd: file_descriptor; addr: system.address; cnt: integer) return integer renames os_files.read; procedure write(fd: file_descriptor; addr: system.address; cnt:integer) renames os_files.write; function get_file_id(fd: file_descriptor) return os_files.file_id_ptr renames os_files.get_file_id; type byte_array is array(natural range <>) of character; type buffer_rec(size : natural) is record -- elem(0) is used for pushing in ascii.lf -- after read-ahead. buffer really starts at elem(1). elem : byte_array(0..size); end record; type access_bytes is access buffer_rec; type access_char is access character; type file_mode is (input, output, in_out); type file_pos is (unknown, at_char, at_eol, at_delayed_eol, at_eop, at_eof); type file_record; type file_ptr is access file_record; type file_record is record fd : file_descriptor; name : a_strings.a_string; mode : file_mode; form : a_strings.a_string; style : file_styles; resetable : boolean; index : natural; linelength : natural; pagelength : natural; line : natural; page : natural; pos : file_pos; delete : boolean; file_id : file_id_ptr; eof_char : character; test_eof : boolean := false; -- for buffering in the file. buffer : access_bytes; last : integer := -1; last_lf : integer := -1; in_ptr : integer := -1; out_ptr : integer := -1; always_flush: boolean; -- for get_line returning form feeds in the returned string want_ff : boolean := false; -- for linked list of file descriptors: all open files next : file_ptr; -- for task and abort safe file I/O mutex : v_i_mutex.safe_mutex_t; end record; -- Access to file_list must be protected via -- safe_support.file_support_lock(). file_list: file_ptr := null; -- The following are updated in text_io cur_input_id : file_id_ptr; cur_output_id : file_id_ptr; -- The file routines need to be safe_support.file_lock()'ed as follows: -- file_open(), setup_buffer() => -- upon entry/exit: unlocked -- file_close_upon_exit() => -- upon entry/exit: unlocked -- file_close(), file_delete() => -- upon entry: locked, upon exit unlocked -- all other file routines => -- upon entry/exit: locked procedure file_open(name : string := ""; file : in out file_ptr; mode : file_mode := in_out; create : boolean := false; form : string := ""; style : file_styles := text; record_size: integer := 0); procedure file_close(file : in out file_ptr); procedure file_delete(file : in out file_ptr); procedure file_reset(file : in out file_ptr; mode : file_mode); -- Called at program exit from close_all(). Doesn't do any -- locks/unlocks or frees procedure file_close_upon_exit(file : file_ptr); function file_eof(file : in file_ptr) return boolean; procedure putchar(file : file_ptr; char : character); function getchar(file : file_ptr) return character; procedure skip_past_eol(file: file_ptr); function tstfile(file : file_ptr) return file_pos; function tstfile_beyond_eol(file : file_ptr) return file_pos; procedure setup_buffer(file : file_ptr; size: natural); procedure refill_buffer(file : file_ptr); procedure always_flush(file: file_ptr); procedure want_ff(file: file_ptr); procedure flush(file: file_ptr); procedure set_buffer_size(file: file_ptr; size: natural); procedure set_eof_char(file:file_ptr; eof_char: character := ascii.eot); procedure write_to_stderr(message: string); end file_support