Natools

Check-in [f16c5302d7]
Login
Overview
Comment:s_expressions-printers: new procedure Transfer running a Descriptor into a Printer
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f16c5302d7eb918660f32131d36f96cbb6b2c7d2
User & Date: nat on 2014-01-11 11:40:45
Other Links: manifest | tags
Context
2014-01-12
16:14
s_expressions-parsers-tests: basic test suite for S-expression parser check-in: 50d86c2bfe user: nat tags: trunk
2014-01-11
11:40
s_expressions-printers: new procedure Transfer running a Descriptor into a Printer check-in: f16c5302d7 user: nat tags: trunk
2014-01-10
22:49
s_expressions-parsers: new package containing an event-base S-expression parser check-in: dffc102c0d user: nat tags: trunk
Changes

Modified src/natools-s_expressions-printers.adb from [43fb78d2eb] to [a821173aae].

39
40
41
42
43
44
45






























46


   overriding procedure Close_List (Output : in out Canonical) is
   begin
      Output.Stream.Write ((0 => Encodings.List_End));
   end Close_List;































end Natools.S_Expressions.Printers;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76


   overriding procedure Close_List (Output : in out Canonical) is
   begin
      Output.Stream.Write ((0 => Encodings.List_End));
   end Close_List;


   procedure Transfer
     (Source : in out Descriptor'Class;
      Target : in out Printer'Class)
   is
      procedure Print_Atom (Data : in Atom);

      procedure Print_Atom (Data : in Atom) is
      begin
         Target.Append_Atom (Data);
      end Print_Atom;

      Event : Events.Event := Source.Current_Event;
   begin
      loop
         case Event is
            when Events.Error | Events.End_Of_Input =>
               exit;
            when Events.Open_List =>
               Target.Open_List;
            when Events.Close_List =>
               Target.Close_List;
            when Events.Add_Atom =>
               Source.Query_Atom (Print_Atom'Access);
         end case;

         Source.Next (Event);
      end loop;
   end Transfer;

end Natools.S_Expressions.Printers;

Modified src/natools-s_expressions-printers.ads from [fb1c125d35] to [fea555b603].

35
36
37
38
39
40
41




42
43
44
45
46
47
48
49
50

   type Printer is limited interface;

   procedure Open_List (Output : in out Printer) is abstract;
   procedure Append_Atom (Output : in out Printer; Data : in Atom) is abstract;
   procedure Close_List (Output : in out Printer) is abstract;





   type Canonical (Stream : access Ada.Streams.Root_Stream_Type'Class) is
     new Printer with null record;

   overriding procedure Open_List (Output : in out Canonical);
   overriding procedure Append_Atom (Output : in out Canonical;
                                     Data : in Atom);
   overriding procedure Close_List (Output : in out Canonical);

end Natools.S_Expressions.Printers;







>
>
>
>









35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

   type Printer is limited interface;

   procedure Open_List (Output : in out Printer) is abstract;
   procedure Append_Atom (Output : in out Printer; Data : in Atom) is abstract;
   procedure Close_List (Output : in out Printer) is abstract;

   procedure Transfer
     (Source : in out Descriptor'Class;
      Target : in out Printer'Class);

   type Canonical (Stream : access Ada.Streams.Root_Stream_Type'Class) is
     new Printer with null record;

   overriding procedure Open_List (Output : in out Canonical);
   overriding procedure Append_Atom (Output : in out Canonical;
                                     Data : in Atom);
   overriding procedure Close_List (Output : in out Canonical);

end Natools.S_Expressions.Printers;