2013-12-28 16:52:31 +00:00
|
|
|
with H2.Scheme;
|
2014-01-01 14:07:03 +00:00
|
|
|
with Ada.Wide_Text_IO;
|
2013-12-28 16:52:31 +00:00
|
|
|
|
|
|
|
package Stream is
|
|
|
|
|
2014-01-09 15:32:36 +00:00
|
|
|
--package S renames H2.Scheme;
|
|
|
|
package S is new H2.Scheme (Standard.Wide_Character, Standard.Wide_String);
|
2013-12-28 16:52:31 +00:00
|
|
|
|
|
|
|
------------------------------------------------------------
|
2014-01-01 14:07:03 +00:00
|
|
|
--type Object_String_Pointer is access all S.Object_String;
|
|
|
|
type Object_String_Pointer is access constant S.Object_String;
|
2013-12-28 16:52:31 +00:00
|
|
|
type String_Input_Stream_Record(Str: Object_String_Pointer) is new S.Stream_Record with record
|
|
|
|
Pos: Standard.Natural := 0;
|
|
|
|
end record;
|
|
|
|
|
|
|
|
--type String_Input_Stream_Record(Len: Standard.Natural) is new S.Stream_Record with record
|
|
|
|
-- Pos: Standard.Natural := 0;
|
|
|
|
-- Str: S.Object_String (1 .. Len) := (others => ' ');
|
|
|
|
--end record;
|
|
|
|
|
|
|
|
procedure Open (Stream: in out String_Input_Stream_Record);
|
|
|
|
procedure Close (Stream: in out String_Input_Stream_Record);
|
|
|
|
procedure Read (Stream: in out String_Input_Stream_Record;
|
|
|
|
Data: out S.Object_String;
|
|
|
|
Last: out Standard.Natural);
|
|
|
|
procedure Write (Stream: in out String_Input_Stream_Record;
|
|
|
|
Data: out S.Object_String;
|
|
|
|
Last: out Standard.Natural);
|
|
|
|
|
|
|
|
------------------------------------------------------------
|
|
|
|
--type File_Stream_Record(Name: Object_String_Pointer) is new S.Stream_Record with record
|
2014-01-01 14:07:03 +00:00
|
|
|
-- Handle: H2.Text_IO.File_Type;
|
2013-12-28 16:52:31 +00:00
|
|
|
--end record;
|
|
|
|
|
|
|
|
type File_Stream_Record is new S.Stream_Record with record
|
2014-01-01 14:07:03 +00:00
|
|
|
Name: S.Constant_Object_String_Pointer;
|
|
|
|
Handle: Ada.Wide_Text_IO.File_Type;
|
2013-12-28 16:52:31 +00:00
|
|
|
end record;
|
|
|
|
|
2014-01-01 14:07:03 +00:00
|
|
|
|
2013-12-28 16:52:31 +00:00
|
|
|
procedure Open (Stream: in out File_Stream_Record);
|
|
|
|
procedure Close (Stream: in out File_Stream_Record);
|
|
|
|
procedure Read (Stream: in out File_Stream_Record;
|
|
|
|
Data: out S.Object_String;
|
|
|
|
Last: out Standard.Natural);
|
|
|
|
procedure Write (Stream: in out File_Stream_Record;
|
|
|
|
Data: out S.Object_String;
|
|
|
|
Last: out Standard.Natural);
|
|
|
|
|
2014-01-01 14:07:03 +00:00
|
|
|
------------------------------------------------------------
|
|
|
|
procedure Allocate_Stream (Interp: in out S.Interpreter_Record;
|
|
|
|
Name: in S.Constant_Object_String_Pointer;
|
|
|
|
Result: out S.Stream_Pointer);
|
|
|
|
|
|
|
|
procedure Deallocate_Stream (Interp: in out S.Interpreter_Record;
|
|
|
|
Source: in out S.Stream_Pointer);
|
|
|
|
|
|
|
|
--private
|
|
|
|
-- type File_Stream_Record is new S.Stream_Record with record
|
|
|
|
-- Name: S.Constant_Object_String_Pointer;
|
|
|
|
-- Handle: Ada.Wide_Text_IO.File_Type;
|
|
|
|
-- end record;
|
|
|
|
|
2013-12-28 16:52:31 +00:00
|
|
|
end Stream;
|
|
|
|
|