## winix-text-file-for-os.api
#
# This extends the Mythryl Winix_Text_File_For_Os__Premicrothread
# api with mailop-valued operations.
# Compiled by:
#
src/lib/std/standard.libstipulate
package ns = number_string; # number_string is from
src/lib/std/src/number-string.pkg package tbi = winix_base_text_file_io_driver_for_posix; # winix_base_text_file_io_driver_for_posix is from
src/lib/std/src/io/winix-base-text-file-io-driver-for-posix.pkg package tk = threadkit; # threadkit is from
src/lib/src/lib/thread-kit/src/core-thread-kit/threadkit.pkgherein
# This api is implemented (only) in:
#
#
src/lib/std/src/io/winix-text-file-for-os-g.pkg #
api Winix_Text_File_For_Os {
#
# include File
Vector = String;
Element = Char;
Input_Stream;
Output_Stream;
read: Input_Stream -> Vector;
read_one: Input_Stream -> Null_Or( Element );
read_n: (Input_Stream, Int) -> Vector;
read_all: Input_Stream -> Vector;
peek: Input_Stream -> Null_Or(Element); # Return next element in stream without advancing file pointer.
close_input: Input_Stream -> Void;
end_of_stream: Input_Stream -> Bool;
write: (Output_Stream, Vector) -> Void;
write_one: (Output_Stream, Element) -> Void;
flush: Output_Stream -> Void;
close_output: Output_Stream -> Void;
package pur # "pur" == "pure" (I/O).
: Winix_Pure_Text_File_For_Os # Winix_Pure_Text_File_For_Os is from
src/lib/std/src/io/winix-pure-text-file-for-os.api where Filereader == tbi::Filereader
where Filewriter == tbi::Filewriter
where File_Position == tbi::File_Position
where Vector == String
where Element == Char;
/*
my getPosIn: Input_Stream -> pur::in_pos
my setPosIn: (Input_Stream * pur::in_pos) -> Void
*/
make_instream: pur::Input_Stream -> Input_Stream;
get_instream: Input_Stream -> pur::Input_Stream;
set_instream: (Input_Stream, pur::Input_Stream) -> Void;
get_output_position: Output_Stream -> pur::Out_Position;
set_output_position: (Output_Stream, pur::Out_Position) -> Void;
make_outstream: pur::Output_Stream -> Output_Stream;
get_outstream: Output_Stream -> pur::Output_Stream;
set_outstream: (Output_Stream, pur::Output_Stream) -> Void;
read_line: Input_Stream -> Null_Or(String);
read_lines: Input_Stream -> List( String );
as_lines: String -> List( String );
# as_string: String -> String; # This would be a really convenient way of reading a file as a single string.
write_substring: (Output_Stream, Substring) -> Void;
from_lines: String -> List(String) -> Void; # filename -> file_lines -> ().
open_for_read: String -> Input_Stream;
open_string: String -> Input_Stream;
open_for_write: String -> Output_Stream;
open_for_append: String -> Output_Stream;
stdin: Input_Stream;
stdout: Output_Stream;
stderr: Output_Stream;
input1evt: Input_Stream -> tk::Mailop( Null_Or( Element ) );
input_nevt: (Input_Stream, Int) -> tk::Mailop( Vector );
input_mailop: Input_Stream -> tk::Mailop( Vector );
input_all_mailop: Input_Stream -> tk::Mailop( Vector );
open_slot_in: tk::Mailslot( String ) -> Input_Stream;
open_slot_out: tk::Mailslot( String ) -> Output_Stream;
print: String -> Void;
exists: String -> Bool; # TRUE iff there exists a plain file by that name.
scan_stream
:
( ns::Reader( Element, pur::Input_Stream )
-> ns::Reader( X, pur::Input_Stream )
)
-> Input_Stream
-> Null_Or(X);
};
end;
## COPYRIGHT (c) 1991 John H. Reppy.
## COPYRIGHT (c) 1996 AT&T Research.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.