Natools

Check-in [66590abe20]
Login
Overview
Comment:s_expressions-generic_caches: use Parent links to unwind levels much faster when unlocking
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 66590abe20483d5580e8b88a05dffd3cfda2c1b8
User & Date: nat on 2014-07-21 18:33:23
Other Links: manifest | tags
Context
2014-07-22
18:40
s_expressions-lockable-tests: deepen the test on unwinding, to double-check the new Generic_Caches unwinding check-in: 49fd23378a user: nat tags: trunk
2014-07-21
18:33
s_expressions-generic_caches: use Parent links to unwind levels much faster when unlocking check-in: 66590abe20 user: nat tags: trunk
2014-07-20
19:03
sxcat: new tool to concatenate and pretty-print S-expressions check-in: 7fadcee47a user: nat tags: trunk
Changes

Modified src/natools-s_expressions-generic_caches.adb from [53e712c6b3] to [a1983f5e7e].

403
404
405
406
407
408
409
410

411
412
413


414
415
416
417



418
419

420
421
422
423
424


425
426
427
428
429
430
431
432
403
404
405
406
407
408
409

410



411
412




413
414
415


416





417
418

419
420
421
422
423
424
425







-
+
-
-
-
+
+
-
-
-
-
+
+
+
-
-
+
-
-
-
-
-
+
+
-







      Previous_Level : constant Natural
        := Lockable.Current_Level (Object.Stack);
   begin
      Lockable.Pop_Level (Object.Stack, State);
      State := Lockable.Null_State;
      Object.Locked := False;

      if Finish then
      if Finish and Object.Position /= null then
         declare
            Event : Events.Event := Object.Current_Event;
         begin
         if Object.Position.Kind = List_Node and then Object.Opening then
            Object.Opening := False;
            loop
               case Event is
                  when Events.Add_Atom | Events.Open_List =>
                     null;
         end if;
         pragma Assert (not Object.Opening);

                  when Events.Close_List =>
                     exit when Object.Absolute_Level < Previous_Level;
         for I in 1 .. Object.Absolute_Level - Previous_Level + 1 loop
                  when Events.Error | Events.End_Of_Input =>
                     exit;
               end case;
               Object.Next (Event);
            end loop;
            Object.Position := Object.Position.Parent;
         end loop;
         end;
      end if;

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

end Natools.S_Expressions.Generic_Caches;