227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
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;
|
>
>
>
|
|
|
>
>
>
|
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
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
declare
Mutator : constant Atom_Refs.Mutator := Buffer.Ref.Update;
begin
Last := Item'Last;
Item := Mutator.Data.all (1 .. Item'Length);
Buffer.Used := Buffer.Used - Item'Length;
Mutator.Data.all (1 .. Buffer.Used) := Mutator.Data.all
(Item'Length + 1 .. Item'Length + Buffer.Used);
end;
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;
|