Natools

Check-in [ad0685d1d1]
Login
Overview
Comment:s_expressions-atom_buffers: fix accessors to return only used part of the buffer
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ad0685d1d17bc1f714c8381d6c71d62c3675dd40
User & Date: nat on 2014-01-15 21:49:16
Other Links: manifest | tags
Context
2014-01-16
22:57
s_expressions-parsers-tests: add a few more tests check-in: d034b73c75 user: nat tags: trunk
2014-01-15
21:49
s_expressions-atom_buffers: fix accessors to return only used part of the buffer check-in: ad0685d1d1 user: nat tags: trunk
2014-01-14
20:30
s_expressions-atom_buffers-tests: new test for actual contents after soft reset check-in: b57427c879 user: nat tags: trunk
Changes

Modified src/natools-s_expressions-atom_buffers.adb from [5032a4fadd] to [3eff901ca5].

83
84
85
86
87
88
89
90
91
92
93
94
95
96
97

   function Data (Buffer : Atom_Buffer) return Atom is
   begin
      if Buffer.Ref.Is_Empty then
         pragma Assert (Buffer.Available = 0 and Buffer.Used = 0);
         return Null_Atom;
      else
         return Buffer.Ref.Query.Data.all;
      end if;
   end Data;


   function Raw_Query (Buffer : Atom_Buffer) return Atom_Refs.Accessor is
      function Create return Atom;








|







83
84
85
86
87
88
89
90
91
92
93
94
95
96
97

   function Data (Buffer : Atom_Buffer) return Atom is
   begin
      if Buffer.Ref.Is_Empty then
         pragma Assert (Buffer.Available = 0 and Buffer.Used = 0);
         return Null_Atom;
      else
         return Buffer.Ref.Query.Data.all (1 .. Buffer.Used);
      end if;
   end Data;


   function Raw_Query (Buffer : Atom_Buffer) return Atom_Refs.Accessor is
      function Create return Atom;

111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
   procedure Query
     (Buffer : in Atom_Buffer;
      Process : not null access procedure (Data : in Atom)) is
   begin
      if Buffer.Ref.Is_Empty then
         Process.all (Null_Atom);
      else
         Buffer.Ref.Query (Process);
      end if;
   end Query;


   procedure Read
     (Buffer : in Atom_Buffer;
      Data : out Atom;







|







111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
   procedure Query
     (Buffer : in Atom_Buffer;
      Process : not null access procedure (Data : in Atom)) is
   begin
      if Buffer.Ref.Is_Empty then
         Process.all (Null_Atom);
      else
         Process.all (Buffer.Ref.Query.Data.all (1 .. Buffer.Used));
      end if;
   end Query;


   procedure Read
     (Buffer : in Atom_Buffer;
      Data : out Atom;