libadalang_tools_24.0.0_d864b5a8/testsuite/tests/test/marshalling_record_size/example_gen.adb

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
with Ada.Streams;
with Ada.Streams.Stream_IO;       use Ada.Streams.Stream_IO;
with Ada.Text_IO;                 use Ada.Text_IO;
with Interfaces;                  use Interfaces;
with Foo;                         use Foo;
with Foo.TGen_Support;            use Foo.TGen_Support;

procedure Example_Gen is

   F         : Ada.Streams.Stream_IO.File_Type;
   S         : Stream_Access;
   File_Name : constant String := "scratch_pad.bin";
   Rec_1, Rec_2 : Larger_Record_Type;


begin
   Create (F, Out_File, File_Name);
   S := Stream (F);

   Rec_1 :=
     (A => 1,
      B => 1.0,
      C => True,
      D => 'R',
      E => "123456789012345678901234567");

   TGen_Marshalling_foo_larger_record_type_output (S, Rec_1);

   Close (F);

   Open (F, In_File, File_Name);
   S := Stream (F);

   Rec_2 := TGen_Marshalling_foo_larger_record_type_input(S);

   Close (F);

   if Rec_1 /= Rec_2 then
      Put_Line ("Error comparing Larger_Record_Type");
   end if;

end Example_Gen;