summaryrefslogtreecommitdiff
path: root/example/info_list.adb
blob: 5dcdcf0315de8bf422a4625444f7c2e180c51141 (plain)
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
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


--  Programmed by Jedidiah Barber
--  Released into the public domain

--  This program displays information about all available libao drivers


with

    Ada.Characters.Latin_1,
    Ada.Strings.Fixed,
    Ada.Text_IO,
    Libao;

use type

    Libao.Output_Kind;


procedure Info_List is

    package Latin renames Ada.Characters.Latin_1;
    package Str   renames Ada.Strings;
    package TIO   renames Ada.Text_IO;

    function "*"
           (Left  : in Natural;
            Right : in Character)
        return String
    renames Ada.Strings.Fixed."*";

    My_Information : Libao.Info_Array := Libao.Driver_Info_List;

begin

    TIO.Put_Line ("libao driver information");
    TIO.New_Line;

    TIO.Put_Line ("Is big endian: " & Boolean'Image (Libao.Is_Big_Endian));
    TIO.Put_Line ("Number of drivers:" & Integer'Image (My_Information'Length));
    TIO.Put_Line ("Default driver:" & Libao.Driver_ID_Number'Image (Libao.Default_Driver_ID));
    TIO.New_Line;

    for Item of My_Information loop
        TIO.Put_Line (36 * '-' & " Driver ID #" & Str.Fixed.Trim
            (Libao.Driver_ID_Number'Image (Libao.Driver_ID (Item.Short_Name)), Str.Left));

        TIO.Put_Line ("Kind: " & Libao.Output_Kind'Image (Item.Kind));
        TIO.Put_Line ("Name: " & Item.Name);
        TIO.Put_Line ("Short name: " & Item.Short_Name);
        TIO.Put_Line ("Preferred byte format: " &
            Libao.Endianness'Image (Item.Preferred_Byte_Format));
        TIO.Put_Line ("Priority Level:" & Positive'Image (Item.Priority_Level));
        TIO.Put_Line ("Comment: " & Item.Comment);

        if Item.Kind = Libao.File_Output then
            TIO.Put_Line ("File extension: " & Libao.File_Extension
                (Libao.Driver_ID (Item.Short_Name)));
        end if;

        TIO.Put_Line ("Option count:" & Integer'Image (Item.Option_Count));
        for Index in Integer range 1 .. Item.Option_Count loop
            TIO.Put_Line (Latin.HT & "#" & Str.Fixed.Trim (Integer'Image (Index), Str.Left) &
                " " & Item.Option_Key (Index));
        end loop;

        TIO.Put_Line (46 * '-');
        TIO.New_Line;
    end loop;

end Info_List;