2013-12-28 16:52:31 +00:00
|
|
|
with H2.Scheme;
|
2014-01-15 09:21:26 +00:00
|
|
|
with H2.Utf8;
|
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-10 14:54:46 +00:00
|
|
|
package S is new H2.Scheme (Standard.Wide_Character);
|
2014-01-15 09:21:26 +00:00
|
|
|
package Utf8 is new H2.Utf8 (Standard.Character, Standard.Wide_Character);
|
2013-12-28 16:52:31 +00:00
|
|
|
|
|
|
|
------------------------------------------------------------
|
2014-01-16 16:52:18 +00:00
|
|
|
--type Object_Character_Array_Pointer is access all S.Object_Character_Array;
|
|
|
|
type Object_Character_Array_Pointer is access constant S.Object_Character_Array;
|
|
|
|
type String_Input_Stream_Record(Str: Object_Character_Array_Pointer) is new S.Stream_Record with record
|
|
|
|
Pos: S.Object_Size := 0;
|
2013-12-28 16:52:31 +00:00
|
|
|
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;
|
2014-01-16 16:52:18 +00:00
|
|
|
Data: out S.Object_Character_Array;
|
|
|
|
Last: out S.Object_Size);
|
2013-12-28 16:52:31 +00:00
|
|
|
procedure Write (Stream: in out String_Input_Stream_Record;
|
2014-01-16 16:52:18 +00:00
|
|
|
Data: out S.Object_Character_Array;
|
|
|
|
Last: out S.Object_Size);
|
2013-12-28 16:52:31 +00:00
|
|
|
|
|
|
|
------------------------------------------------------------
|
|
|
|
|
|
|
|
type File_Stream_Record is new S.Stream_Record with record
|
2014-01-16 16:52:18 +00:00
|
|
|
Name: S.Constant_Object_Character_Array_Pointer;
|
2014-01-01 14:07:03 +00:00
|
|
|
Handle: Ada.Wide_Text_IO.File_Type;
|
2013-12-28 16:52:31 +00:00
|
|
|
end record;
|
|
|
|
|
|
|
|
procedure Open (Stream: in out File_Stream_Record);
|
|
|
|
procedure Close (Stream: in out File_Stream_Record);
|
|
|
|
procedure Read (Stream: in out File_Stream_Record;
|
2014-01-16 16:52:18 +00:00
|
|
|
Data: out S.Object_Character_Array;
|
|
|
|
Last: out S.Object_Size);
|
2013-12-28 16:52:31 +00:00
|
|
|
procedure Write (Stream: in out File_Stream_Record;
|
2014-01-16 16:52:18 +00:00
|
|
|
Data: out S.Object_Character_Array;
|
|
|
|
Last: out S.Object_Size);
|
2013-12-28 16:52:31 +00:00
|
|
|
|
2014-01-01 14:07:03 +00:00
|
|
|
------------------------------------------------------------
|
|
|
|
procedure Allocate_Stream (Interp: in out S.Interpreter_Record;
|
2014-01-16 16:52:18 +00:00
|
|
|
Name: access S.Object_Character_Array;
|
2014-01-01 14:07:03 +00:00
|
|
|
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
|
2014-01-16 16:52:18 +00:00
|
|
|
-- Name: S.Constant_Object_Character_Array_Pointer;
|
2014-01-01 14:07:03 +00:00
|
|
|
-- Handle: Ada.Wide_Text_IO.File_Type;
|
|
|
|
-- end record;
|
|
|
|
|
2013-12-28 16:52:31 +00:00
|
|
|
end Stream;
|
|
|
|
|