Natools

Check-in [14c328e4b4]
Login
Overview
Comment:s_expressions-generic_caches: implement the new Replayable.Descriptor interface in cursors
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 14c328e4b41a206e4c527a21a6d67d7a39038b8b
User & Date: nat on 2014-09-08 19:52:03
Other Links: manifest | tags
Context
2014-09-09
18:36
s_expressions-cache_tests: add a test for the new replayable interface check-in: dd07424307 user: nat tags: trunk
2014-09-08
19:52
s_expressions-generic_caches: implement the new Replayable.Descriptor interface in cursors check-in: 14c328e4b4 user: nat tags: trunk
2014-09-07
20:13
s_expressions-replayable: new interface for S-expression descriptors that can duplicated check-in: 39fe9aca16 user: nat tags: trunk
Changes

Modified src/natools-s_expressions-generic_caches.adb from [a1983f5e7e] to [64adc939bb].

418
419
420
421
422
423
424






425
418
419
420
421
422
423
424
425
426
427
428
429
430
431







+
+
+
+
+
+

         end loop;
      end if;

      Object.Locked
        := Object.Absolute_Level < Lockable.Current_Level (Object.Stack);
   end Unlock;


   overriding function Duplicate (Object : Cursor) return Cursor is
   begin
      return Object;
   end Duplicate;

end Natools.S_Expressions.Generic_Caches;

Modified src/natools-s_expressions-generic_caches.ads from [f971cf3cde] to [869771231b].

26
27
28
29
30
31
32

33
34
35
36
37
38
39
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40







+







-- see Natools.S_Expressions.Holders.                                       --
------------------------------------------------------------------------------

with System.Storage_Pools;

with Natools.S_Expressions.Lockable;
with Natools.S_Expressions.Printers;
with Natools.S_Expressions.Replayable;

private with Ada.Finalization;
private with Ada.Unchecked_Deallocation;
private with Natools.References;

generic
   Atom_Pool : in out System.Storage_Pools.Root_Storage_Pool'Class;
51
52
53
54
55
56
57
58


59
60
61
62
63
64
65
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67







-
+
+







     (Output : in out Reference; Data : in Atom);
   overriding procedure Close_List (Output : in out Reference);

   function Duplicate (Cache : Reference) return Reference;
      --  Create a new copy of the S-expression held in Cache and return it


   type Cursor is new Lockable.Descriptor with private;
   type Cursor is new Lockable.Descriptor and Replayable.Descriptor
     with private;
   pragma Preelaborable_Initialization (Cursor);

   overriding function Current_Event (Object : in Cursor) return Events.Event;
   overriding function Current_Atom (Object : in Cursor) return Atom;
   overriding function Current_Level (Object : in Cursor) return Natural;
   overriding procedure Query_Atom
     (Object : in Cursor;
75
76
77
78
79
80
81


82
83
84
85
86
87
88
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92







+
+







   overriding procedure Lock
     (Object : in out Cursor;
      State : out Lockable.Lock_State);
   overriding procedure Unlock
     (Object : in out Cursor;
      State : in out Lockable.Lock_State;
      Finish : in Boolean := True);

   overriding function Duplicate (Object : Cursor) return Cursor;

   function First (Cache : Reference'Class) return Cursor;
      --  Create a new Cursor pointing at the beginning of Cache

private

   type Atom_Access is access Atom;
139
140
141
142
143
144
145
146

147
148
149
150
151
152
153
154
155
156
143
144
145
146
147
148
149

150
151
152
153
154
155
156
157
158
159
160







-
+












   type Reference is new Printers.Printer with record
      Exp : Trees.Reference;
   end record;


   type Cursor is new Lockable.Descriptor with record
   type Cursor is new Lockable.Descriptor and Replayable.Descriptor with record
      Exp : Trees.Reference;
      Position : Node_Access := null;
      Opening : Boolean := False;
      Stack : Lockable.Lock_Stack;
      Locked : Boolean := False;
   end record;

   function Absolute_Level (Object : Cursor) return Natural;

end Natools.S_Expressions.Generic_Caches;