trendy_test_0.0.3_a0e14736/src/trendy_locations.adb

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
with Ada.Strings.Fixed;

package body Trendy_Locations is
    function Make_Source_Location (File : Char_Ptr := File_Name;
                                    Line : Natural := File_Line) return Source_Location is
    begin
        return (File, Line);
    end Make_Source_Location;

    function Image (Loc : Source_Location) return String is
        use Ada.Strings;
        use Ada.Strings.Fixed;
    begin
        -- The trimming step here removes the extra space printed to the
        -- left and hence reports filename:line which editors can use to
        -- jump directly to errors.
        return Image (Loc.File) & ':' & Trim (Loc.Line'Image, Left);
    end Image;
end Trendy_Locations;