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

⟦a0137e65f⟧ TextFile

    Length: 2900 (0xb54)
    Types: TextFile
    Names: »B«

Derivation

└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Message_Interchange;
with String_Utilities;
with Unchecked_Deallocation;


package body Parameter is

    use Bs;

    package Mi renames Message_Interchange;
    function Sup (S : String) return String renames String_Utilities.Upper_Case;


    function Create (Name : String; Class : String; Value : String)
                    return Parameter.Object is
    begin  
        return Object'(Name => Bs.Value (Sup (Name)),
                       Class => Bs.Value (Sup (Class)),
                       Value => Bs.Value (Sup (Value)));
    end Create;


    function Image (Of_Parameter : Parameter.Object) return String is
        P : Parameter.Object renames Of_Parameter;
    begin
        return Bs.Image (P.Name) & Mi.Separator & Bs.Image (P.Class) &
                  Mi.Separator & Bs.Image (P.Value);
    end Image;


    function Value (Of_String : String) return Parameter.Object is
        First : constant Positive := Of_String'First;
        Last : constant Positive := Of_String'Last;
        S1 : Positive := First;
        S2 : Positive;  
    begin
        loop
            exit when Of_String (S1) = Mi.Separator;
            S1 := S1 + 1;
        end loop;
        S2 := S1 + 1; -- to point jbst after the separator

        loop
            exit when Of_String (S2) = Mi.Separator;
            S2 := S2 + 1;
        end loop;

        return Object'(Name => Bs.Value (Sup (Of_String (First .. S1 - 1))),
                       Class => Bs.Value (Sup (Of_String (S1 + 1 .. S2 - 1))),
                       Value => Bs.Value (Sup (Of_String (S2 + 1 .. Last))));

    end Value;


    function Is_Valued (Parameter : Standard.Parameter.Object) return Boolean is
    begin
        return Bs.Image (Parameter.Value) /= Void;
    end Is_Valued;


    function Is_Null (Parameter : Standard.Parameter.Object) return Boolean is
    begin
        return Bs.Image (Parameter.Name) = Void;
        -- right now the criteria is based only on the name
        -- this is to allow untyped parameters
    end Is_Null;
    function Is_Equal (Left, Right : Parameter.Object) return Boolean is
    begin
        return Left.Name = Right.Name and Left.Class = Right.Class and
                  Left.Value = Right.Value;
    end Is_Equal;


    function Is_Compatible (Left, Right : Parameter.Object) return Boolean is
    begin
        return Left.Name = Right.Name and Left.Class = Right.Class;
    end Is_Compatible;


    function Get_Name (Parameter : Standard.Parameter.Object) return String is
    begin
        return Bs.Image (Parameter.Name);
    end Get_Name;


    function Get_Class (Parameter : Standard.Parameter.Object) return String is
    begin
        return Bs.Image (Parameter.Class);
    end Get_Class;


    function Get_Value (Parameter : Standard.Parameter.Object) return String is
    begin
        return Bs.Image (Parameter.Value);
    end Get_Value;

end Parameter;