DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦c44328abc⟧ TextFile

    Length: 6139 (0x17fb)
    Types: TextFile
    Names: »B«

Derivation

└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦this⟧ 
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Text_Io;
separate (Directory)
package body Naming is

    Directory_Separator : constant Character := '/';
    Extension_Separator : constant Character := '.';

    Default_Context_Object : Context;

    procedure Set_Default_Context (The_Context : Naming.String_Name) is
        Name : Gs.Object;
    begin
        if Di.Existent_Entry (Path => The_Context) then
            if Di.Is_Directory (Path => The_Context) then
                if Absolute (The_Context) then
                    Gs.Create (Name, The_Context);
                else
                    Gs.Create (Name, Absolute_Name (The_Context));
                end if;
                if Di.Change_Directory (Gs.Image (Name)) then
                    Gs.Copy (Default_Context_Object.Name, Name);
                else
                    Put_Error_Message;
                    raise System_Error;
                end if;
            else
                Put_Error_Message
                   ("The object must be a directory to become the default context");
                raise System_Error;
            end if;
        else
            raise Non_Existent_Object_Error;
        end if;
    end Set_Default_Context;


    procedure Set_Default_Context (The_Context : Naming.Context) is
    begin  
        if Class (The_Context) = Directory_Class then
            if Di.Change_Directory (Path => Naming.Full_Name (The_Context)) then
                Gs.Copy (Default_Context_Object.Name, The_Context.Name);
            else
                Put_Error_Message;
                raise System_Error;
            end if;
        else
            Put_Error_Message
               ("The object must be a directory to become the default context");
            raise System_Error;
        end if;
    end Set_Default_Context;


    function Default_Context return Naming.String_Name is
    begin  
        return Gs.Image (Default_Context_Object.Name);
    end Default_Context;


    function Default_Context return Naming.Context is
        C : Context;
    begin
        Gs.Copy (C.Name, Default_Context_Object.Name);
        return C;
    end Default_Context;


    function Absolute (The_Name : String_Name) return Boolean is
        I : constant Natural := Su.Locate
                                   (Directory_Separator, The_Name, False);
    begin
        return (I = The_Name'First);
    end Absolute;

    function Absolute_Name (The_Name : String_Name) return String_Name is
        Name      : Gs.Object;
        Tail_Name : Gs.Object := Gs.Undefined_Object;
    begin
        if Di.Is_Directory (The_Name) then
            Gs.Create (Name, The_Name);
        else
            Gs.Create (Name, Prefix (The_Name));
            Gs.Create (Tail_Name, "/" & Simple_Name (The_Name));
        end if;
        declare  
            Str  : constant String := Di.Get_Absolute_Path (Gs.Image (Name));
            Tail : constant String := Gs.Image (Tail_Name);
        begin
            if Str = "" then
                Put_Error_Message;
                raise System_Error;
            else
                return Str & Tail;
            end if;
        end;
    end Absolute_Name;

    function Prefix (The_Name : String_Name) return String_Name is
        I : constant Natural := Su.Reverse_Locate
                                   (Directory_Separator, The_Name, False);
    begin
        if I = 0 then
            return "";
        else
            return The_Name (The_Name'First .. I - 1);
        end if;
    end Prefix;


    function Simple_Name (The_Name : String_Name) return Simple_String_Name is
        I : constant Natural := Su.Reverse_Locate
                                   (Directory_Separator, The_Name, False);
    begin
        if I = 0 then
            return The_Name;
        else
            return The_Name (I + 1 .. The_Name'Last);
        end if;
    end Simple_Name;

    function Simple_Name_Without_Extension
                (The_Name : String_Name) return Simple_String_Name is
        Str : constant String := Simple_Name (The_Name);
    begin
        if Extension (Str) /= "" then
            declare
                I : constant Natural := Su.Reverse_Locate
                                           (Extension_Separator, Str, False);
            begin
                return Str (Str'First .. I - 1);
            end;
        else
            return Str;
        end if;
    end Simple_Name_Without_Extension;

    function Head (The_Name : String_Name) return Simple_String_Name is
        I : constant Natural := Su.Locate
                                   (Directory_Separator, The_Name, False);
    begin
        if I = 0 then
            return The_Name;
        elsif I = The_Name'First then
            return "/";
        else
            return The_Name (The_Name'First .. I - 1);
        end if;
    end Head;


    function Tail (The_Name : String_Name) return String_Name is
        I : constant Natural := Su.Locate
                                   (Directory_Separator, The_Name, False);
    begin
        if I = 0 then
            return "";
        else
            return The_Name (I + 1 .. The_Name'Last);
        end if;
    end Tail;


    function Extension (A_Name : String_Name) return String is
        I : constant Natural := Su.Reverse_Locate
                                   (Extension_Separator, A_Name, False);
    begin
        if I = 0 then
            return "";
        else
            return A_Name (I + 1 .. A_Name'Last);
        end if;
    end Extension;


    function Full_Name (The_Object : Object) return Naming.String_Name is
    begin
        return Gs.Image (The_Object.Name);
    end Full_Name;


    function Simple_Name (The_Object : Object) return Simple_String_Name is
        S : constant String := Gs.Image (The_Object.Name);
    begin  
        return Simple_Name (The_Name => S);
    end Simple_Name;

    function Simple_Name_Without_Extension
                (The_Object : Object) return Simple_String_Name is
    begin
        return Simple_Name_Without_Extension
                  (The_Name => (Full_Name (The_Object)));
    end Simple_Name_Without_Extension;

end Naming;