1--  Copyright 1994 Grady Booch
2--  Copyright 1998-2014 Simon Wright <simon@pushface.org>
3
4--  This package is free software; you can redistribute it and/or
5--  modify it under terms of the GNU General Public License as
6--  published by the Free Software Foundation; either version 2, or
7--  (at your option) any later version. This package is distributed in
8--  the hope that it will be useful, but WITHOUT ANY WARRANTY; without
9--  even the implied warranty of MERCHANTABILITY or FITNESS FOR A
10--  PARTICULAR PURPOSE. See the GNU General Public License for more
11--  details. You should have received a copy of the GNU General Public
12--  License distributed with this package; see file COPYING.  If not,
13--  write to the Free Software Foundation, 59 Temple Place - Suite
14--  330, Boston, MA 02111-1307, USA.
15
16package body Chunks is
17
18   Magic_Number : Natural := 0;
19
20   function "=" (L, R : Chunk) return Boolean is
21   begin
22      return L.Number = R.Number and then L.Count = R.Count;
23   end "=";
24
25   function Priority (C : Chunk) return Natural is
26   begin
27      return C.Number;
28   end Priority;
29
30   function Image (C : Chunk) return String is
31   begin
32      return "[ID:"
33        & Integer'Image (C.Number)
34        & ","
35        & Integer'Image (C.Count)
36        & "]";
37   end Image;
38
39   procedure Initialize (C : in out Chunk) is
40   begin
41      Magic_Number := Magic_Number + 1;
42      C.Number := Magic_Number;
43      C.Count := 0;
44   end Initialize;
45
46   procedure Adjust (C : in out Chunk) is
47   begin
48      C.Count := C.Count + 1;
49   end Adjust;
50
51end Chunks;
52