214
215
216
217
218
219
220
221
|
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
procedure Soft_Reset (Buffer : in out Atom_Buffer) is
begin
Buffer.Used := 0;
end Soft_Reset;
overriding procedure Write
(Buffer : in out Atom_Buffer;
Item : in Ada.Streams.Stream_Element_Array)
renames Append;
overriding procedure Read
(Buffer : in out Atom_Buffer;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset) is
begin
if Item'Length < Buffer.Used then
Last := Item'Last;
Item := Buffer.Ref.Query.Data.all (1 .. Item'Length);
Buffer.Used := Buffer.Used - Item'Length;
else
Last := Item'First + Buffer.Used - 1;
Item (Item'First .. Last)
:= Buffer.Ref.Query.Data.all (1 .. Buffer.Used);
Buffer.Used := 0;
end if;
end Read;
end Natools.S_Expressions.Atom_Buffers;
|