@@ -23,6 +23,7 @@ with Ada.Text_IO; use Ada.Text_IO;
23
23
with GNAT.Regpat ; use GNAT.Regpat;
24
24
with SCOs ;
25
25
26
+ with Checkpoints ; use Checkpoints;
26
27
with Diagnostics ; use Diagnostics;
27
28
with Files_Table ; use Files_Table;
28
29
with Get_SCOs ;
@@ -31,6 +32,14 @@ with Outputs; use Outputs;
31
32
32
33
package body ALI_Files is
33
34
35
+ procedure Read
36
+ (CLS : in out Checkpoint_Load_State; Value : out ALI_Annotation);
37
+ -- Read a ALI_Annotation from CLS
38
+
39
+ procedure Write
40
+ (CSS : in out Checkpoint_Save_State; Value : ALI_Annotation);
41
+ -- Write a ALI_Annotation to CSS
42
+
34
43
-- ---------------------------------------------
35
44
-- Regular expressions for ALI files parsing --
36
45
-- ---------------------------------------------
@@ -627,37 +636,69 @@ package body ALI_Files is
627
636
-- --------
628
637
629
638
procedure Read
630
- (S : access Root_Stream_Type'Class;
631
- V : out ALI_Annotation)
632
- is
639
+ (CLS : in out Checkpoint_Load_State; Value : out ALI_Annotation) is
633
640
begin
634
- CU_Id'Read (S, V.CU) ;
635
- ALI_Annotation_Kind'Read (S, V.Kind );
641
+ Value.CU := CLS.Read_CU ;
642
+ Value.Kind := ALI_Annotation_Kind'Val (CLS.Read_U8 );
636
643
637
644
declare
638
- Msg : constant String := String'Input (S) ;
645
+ Msg : constant String := CLS.Read_String ;
639
646
begin
640
647
if Msg'Length > 0 then
641
- V .Message := new String'(Msg);
648
+ Value .Message := new String'(Msg);
642
649
end if ;
643
650
end ;
644
- V.Violation_Count := 0 ;
645
- V.Undetermined_Cov_Count := 0 ;
651
+
652
+ Value.Violation_Count := 0 ;
653
+ Value.Undetermined_Cov_Count := 0 ;
654
+ end Read ;
655
+
656
+ procedure Read
657
+ (CLS : in out Checkpoints.Checkpoint_Load_State;
658
+ Value : out ALI_Annotation_Maps.Map)
659
+ is
660
+ procedure Read_Map is new Checkpoints.Read_Map
661
+ (Key_Type => Source_Location,
662
+ Element_Type => ALI_Annotation,
663
+ Map_Type => ALI_Annotation_Maps.Map,
664
+ Clear => ALI_Annotation_Maps.Clear,
665
+ Insert => ALI_Annotation_Maps.Insert,
666
+ Read_Key => Read,
667
+ Read_Element => Read);
668
+ begin
669
+ Read_Map (CLS, Value);
646
670
end Read ;
647
671
648
672
-- ---------
649
673
-- Write --
650
674
-- ---------
651
675
652
- procedure Write (S : access Root_Stream_Type'Class; V : ALI_Annotation) is
676
+ procedure Write (CSS : in out Checkpoint_Save_State; Value : ALI_Annotation)
677
+ is
653
678
begin
654
- CU_Id'Write (S, V.CU);
655
- ALI_Annotation_Kind'Write (S, V.Kind);
656
- if V.Message /= null then
657
- String'Output (S, V.Message.all );
658
- else
659
- String'Output (S, " " );
660
- end if ;
679
+ CSS.Write_CU (Value.CU);
680
+ CSS.Write_U8 (ALI_Annotation_Kind'Pos (Value.Kind));
681
+ CSS.Write_Unbounded (if Value.Message = null
682
+ then " "
683
+ else Value.Message.all );
684
+ end Write ;
685
+
686
+ procedure Write
687
+ (CSS : in out Checkpoints.Checkpoint_Save_State;
688
+ Value : ALI_Annotation_Maps.Map)
689
+ is
690
+ procedure Write_Map is new Checkpoints.Write_Map
691
+ (Key_Type => Source_Location,
692
+ Element_Type => ALI_Annotation,
693
+ Map_Type => ALI_Annotation_Maps.Map,
694
+ Cursor_Type => ALI_Annotation_Maps.Cursor,
695
+ Length => ALI_Annotation_Maps.Length,
696
+ Iterate => ALI_Annotation_Maps.Iterate,
697
+ Query_Element => ALI_Annotation_Maps.Query_Element,
698
+ Write_Key => Write,
699
+ Write_Element => Write);
700
+ begin
701
+ Write_Map (CSS, Value);
661
702
end Write ;
662
703
663
704
end ALI_Files ;
0 commit comments