Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | s_expressions-atom_buffers: new procedure to reverse the contents of an atom buffer |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
20f1537eb47ddec7239ae4904438b04e |
| User & Date: | nat 2014-03-22 20:58:23.790 |
Context
|
2014-03-23
| ||
| 13:31 | s_expressions-printers-pretty-config: fix Read_Screen_Offset mangling its output parameter check-in: a7eba2a389 user: nat tags: trunk | |
|
2014-03-22
| ||
| 20:58 | s_expressions-atom_buffers: new procedure to reverse the contents of an atom buffer check-in: 20f1537eb4 user: nat tags: trunk | |
|
2014-03-21
| ||
| 20:15 | s_expressions-printers-pretty-config-tests: add a test for the serializer check-in: 3604ae2791 user: nat tags: trunk | |
Changes
Changes to src/natools-s_expressions-atom_buffers.adb.
| ︙ | ︙ | |||
86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
end loop;
end Process;
begin
Preallocate (Buffer, Data'Length);
Buffer.Ref.Update (Process'Access);
end Append_Reverse;
function Length (Buffer : Atom_Buffer) return Count is
begin
return Buffer.Used;
end Length;
| > > > > > > > > > > > > > > > > > > > > > > > | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
end loop;
end Process;
begin
Preallocate (Buffer, Data'Length);
Buffer.Ref.Update (Process'Access);
end Append_Reverse;
procedure Invert (Buffer : in out Atom_Buffer) is
procedure Process (Data : in out Atom);
procedure Process (Data : in out Atom) is
Low : Count := Data'First;
High : Count := Buffer.Used;
Tmp : Octet;
begin
while Low < High loop
Tmp := Data (Low);
Data (Low) := Data (High);
Data (High) := Tmp;
Low := Low + 1;
High := High - 1;
end loop;
end Process;
begin
if not Buffer.Ref.Is_Empty then
Buffer.Ref.Update (Process'Access);
end if;
end Invert;
function Length (Buffer : Atom_Buffer) return Count is
begin
return Buffer.Used;
end Length;
|
| ︙ | ︙ |
Changes to src/natools-s_expressions-atom_buffers.ads.
| ︙ | ︙ | |||
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
procedure Append (Buffer : in out Atom_Buffer; Data : in Atom);
procedure Append (Buffer : in out Atom_Buffer; Data : in Octet);
-- Append Data after the end of Buffer
procedure Append_Reverse (Buffer : in out Atom_Buffer; Data : in Atom);
-- Append bytes from Atom from last to first
function Length (Buffer : Atom_Buffer) return Count;
function Data (Buffer : Atom_Buffer) return Atom;
procedure Query
(Buffer : in Atom_Buffer;
Process : not null access procedure (Data : in Atom));
procedure Read
(Buffer : in Atom_Buffer;
| > > > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
procedure Append (Buffer : in out Atom_Buffer; Data : in Atom);
procedure Append (Buffer : in out Atom_Buffer; Data : in Octet);
-- Append Data after the end of Buffer
procedure Append_Reverse (Buffer : in out Atom_Buffer; Data : in Atom);
-- Append bytes from Atom from last to first
procedure Invert (Buffer : in out Atom_Buffer);
-- Invert the order of bytes (first becomes last, etc)
function Length (Buffer : Atom_Buffer) return Count;
function Data (Buffer : Atom_Buffer) return Atom;
procedure Query
(Buffer : in Atom_Buffer;
Process : not null access procedure (Data : in Atom));
procedure Read
(Buffer : in Atom_Buffer;
|
| ︙ | ︙ |