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 - metrics - download
Index: T V

⟦914b0440c⟧ TextFile

    Length: 5651 (0x1613)
    Types: TextFile
    Names: »V«

Derivation

└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
    └─⟦5cb1d1d7f⟧ »DATA« 
        └─⟦3b1ee7bd8⟧ 
            └─⟦this⟧ 

TextFile

package Pathnames is

    type Pathname is private;

    -- A pathname is the directory name of an object in the environment.
    -- It may be fully qualified from the root ('!') of the directory
    -- system such as "!Users.Rjb.Blapper" or it may relative to some
    -- context such as "Rjb.Blapper" which is valid in the context
    -- "!Users".
    --
    -- Pathnames may also have attributes appended to them.
    -- Attributes are of the form "'XXXX".  All legal Attributes
    -- are defined below.  Pathnames may contain more than one
    -- attribute at a time.
    --

    subtype Segment is String;

    -- Pathnames are made up of segments.
    --
    -- There is one special segment, the Root segment ("!").
    --
    -- All segments in a pathname (except for the Root) are separated
    -- from each other by a '.' character.  The pathname
    -- "!Directory_Tools.Rev2_1_Spec.Units.Object" contains five segments:
    -- the Root, "Directory_Tools", "Rev2_1_Spec", "Units", and "Object".
    --
    -- Segments must be legal Ada identifiers.
    --

    function Make (Path : String) return Pathname;

    -- Builds a pathname object from a string.
    --
    -- Raises: Illegal_Pathname if the input is not a legal pathname.
    --

    function Image (Path : Pathname) return String;

    -- return the string image of a pathname
    --

    type Segment_Iterator is private;

    function Explode (Path : Pathname) return Segment_Iterator;

    -- breaks a pathname into its segments
    --

    function Done (Iter : Segment_Iterator) return Boolean;
    function Value (Iter : Segment_Iterator) return Segment;
    procedure Next (Iter : in out Segment_Iterator);


    function Is_Root (Path : Pathname) return Boolean;
    function Is_Root (A_Segment : Segment) return Boolean;

    -- returns true if the pathname or segment is the Root
    --

    procedure Append (The_Segment : Segment; To : in out Pathname);

    -- Adds a specified segment to a pathname
    --
    -- Raises: Illegal_Pathname if the resulting pathname would not be
    --         legal.
    --

    function Depth (Path : Pathname) return Positive;

    -- returns the number of segments in a pathname.

    function Depth (Of_Segment : Segment; Within : Pathname) return Natural;

    -- returns the number of segment in a pathname that matches Of_Segment
    -- Raise:  Segment_Not_Found if no segment matches Of_Segment.
    --

    function Last (Path : Pathname) return Segment;

    -- returns the last segment in a pathname
    --

    function Parent (Path : Pathname) return Pathname;

    -- returns the pathname with the last segment removed.
    --

    function Has_Context (Context : Pathname; Path : Pathname) return Boolean;

    -- returns True if the the path contains the specified context
    -- Examples:
    --
    --  "!Tools.System_Utilities has the contexts "!" and "!Tools"
    --  but not "Tools".
    --
    --  "Machine.Error_Logs" has the context "Machine" but not "!Machine".
    --

    procedure Remove_Context (Context : Pathname; From : in out Pathname);

    -- strips off a context from a pathname.  If the pathname does not have
    -- the specified context, then this procedure has no effect
    --
    -- Examples:
    --
    -- "!Commands" can be removed from "!Commands.Editor.Cursor.Next"
    --
    -- "Here_We_Go.Loop_Tee_Loop." can be removed from
    -- "Here_We_Go.Loop_Tee_Loop.All_On_A_Saturday_Night"
    --

    procedure Change_Segment (Old_Segment : Segment;
                              New_Segment : Segment;
                              In_Path : in out Pathname);

    -- replaces the first occurence (scanning left to right) of the
    -- old segment with the new segement in the pathname In_Path.
    -- Raises: Segment_Not_Found if the pathname is does contain the
    -- Old_Segment.
    --

    procedure Change_Segment (At_Depth : Positive;
                              New_Segment : Segment;
                              In_Path : in out Pathname);

    -- replaces the the At_depth segment (scanning left to right) with the
    -- New_Segment in tha pathname In_Path.
    --
    -- Raises: Segment_Not_Found if the pathname is does not have a depth
    -- equal to or greater than At_Depth,
    --

    type Attribute is

       (Ada_Spec,      -- "'spec"
        Ada_Body,      -- "'body"
        Version,       -- "'V(*)"  where * is some positive number
        Class);        -- "'C(*)"  where * is defined below

    procedure Remove (The_Attribute : Attribute; From : in out Pathname);

    -- removes the specified attribute from the pathname
    --
    -- If the specified pathname does not contain an attribute of this
    -- type, this procedure has not effect.

    type Class_Type is (Library, Ada, File, Pipe);

    procedure Add_Class_Attribute
                 (With_Class : Class_Type; To : in out Pathname);

    -- appends a class attribute to the pathname
    --
    -- Examples:
    --
    --  Class_type Ada  appends "'C(Ada)"
    --  Class_type File appends "'C(File)"
    --

    procedure Add_Version_Attribute
                 (Version_Number : Positive; To : in out Pathname);

    -- appends a version attribute to the pathname for the specified
    -- Version_Number
    --

    Illegal_Pathname : exception;

    -- raised on operations that attempt to construct pathnames that are
    -- not legal
    --

    Segment_Not_Found : exception;

    -- raised on operations that attempt to find a segment in a pathname
    -- that does not exist.
    --

private

    type Pathname is new Boolean;

    type Segment_Iterator is new Boolean;

end Pathnames;