DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

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

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦cba4de6ac⟧ Ada Source

    Length: 12288 (0x3000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, procedure Rm_010, seg_005609

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦this⟧ 

E3 Source Code



with Test_Io;  
use Test_Io;

with Xlbt_Arithmetic;  
use Xlbt_Arithmetic;  
with Xlbt_Rm;  
use Xlbt_Rm;  
with Xlbt_Rm2;  
use Xlbt_Rm2;  
with Xlbt_String;  
use Xlbt_String;

with Xlbp_Rm_Quark;  
use Xlbp_Rm_Quark;

with Xlbit_Library3;  
use Xlbit_Library3;

with Xlbmp_Debugger;

procedure Rm_010 is
------------------------------------------------------------------------------
-- Tests for Xlbp_Rm_Quark.
------------------------------------------------------------------------------
-- 07/05/90 GEB     | Created.
------------------------------------------------------------------------------

    Quark1 : X_Rm_Quark;  
    Quark2 : X_Rm_Quark;

    type Quark_Array is array (S_Natural range <>) of X_Rm_Quark;

    Quark_List : Quark_Array (1 .. 10);  
    Bind_List  : X_Rm_Binding_Array (1 .. 10);

    Validate_Names : Boolean := True;

    function X_Rm_Str_To_Q  
                (Name     : X_String;  
                Validate : Boolean := Validate_Names) return X_Rm_Quark;

    procedure X_Rm_Str_To_Ql is  
       new X_Rm_String_To_Quark_List  
              (Quark_Type       => X_Rm_Quark,  
               None_Quark       => None_X_Rm_Quark,  
               Quark_Array_Type => Quark_Array,  
               String_To_Quark  => X_Rm_Str_To_Q);

    procedure X_Rm_Str_To_Bl is  
       new X_Rm_String_To_Binding_Quark_List  
              (Quark_Type       => X_Rm_Quark,  
               None_Quark       => None_X_Rm_Quark,  
               Quark_Array_Type => Quark_Array,  
               String_To_Quark  => X_Rm_Str_To_Q);

    function X_Rm_Str_To_Q  
                (Name     : X_String;  
                 Validate : Boolean := Validate_Names) return X_Rm_Quark is  
    begin  
        return X_Rm_String_To_Quark (Name, Validate);  
    end X_Rm_Str_To_Q;

    procedure Qts (Name : X_String; Valid : Boolean := True) is
------------------------------------------------------------------------------
--  Name    - Specifies the name to use for the test
--  Valid   - Specifies if the name is a valid component name.
--
-- Called to turn a name into a quark and then the quark back into a string.
-- Print out the results so we can have a log of what happens.
------------------------------------------------------------------------------
    begin  
        if Validate_Names then  
            Put ("Component ");  
        else  
            Put ("Quark ");  
        end if;  
        Putx ('"' & Name & '"');  
        Put (' ');  
        Set_Col (31);  
        Quark1 := X_Rm_Str_To_Q (Name);  
        Put (Quark1.Id);  
        Put (" => ");  
        Putx ('"' & X_Rm_Quark_To_String (Quark1) & '"');  
        if Validate_Names and not Valid then  
            Put ('?');  
        end if;  
        New_Line;  
    exception  
        when Constraint_Error =>  
            if not Valid then  
                Put_Line (" is invalid.");  
            else  
                raise;  
            end if;  
    end Qts;

    procedure Qtl (List : X_String; Valid : Boolean := True) is
------------------------------------------------------------------------------
--  List    - Specifies a name/quark-list to use
--  Valid   - Specifies if the list is a valid component name list.
--
-- Called to turn a list of names into a list of quarks.  We print out the
-- list and the resultant list so that we have a log of what happens.
------------------------------------------------------------------------------
    begin

        if Validate_Names then  
            Put ("Components := ");  
        else  
            Put ("Quark-List := ");  
        end if;  
        Putx ('"' & List & '"');  
        New_Line;  
        Put ("Result => ");  
        X_Rm_Str_To_Ql (List, Quark_List);  
        if Validate_Names and not Valid then  
            Put ('?');  
        end if;  
        New_Line;  
        for I in Quark_List'Range loop  
            if Quark_List (I) = None_X_Rm_Quark then  
                exit;  
            end if;  
            Put ("    ");  
            Put (I);  
            Put (' ');  
            Putx ('"' & X_Rm_Quark_To_String (Quark_List (I)) & '"');  
            New_Line;  
        end loop;  
        New_Line;  
    exception  
        when Constraint_Error =>  
            if Validate_Names and not Valid then  
                Put (" invalid");  
                New_Line;  
            else  
                raise;  
            end if;

    end Qtl;

    procedure Qtbl (List : X_String; Valid : Boolean := True) is
------------------------------------------------------------------------------
--  List    - Specifies a name/quark-list to use
--  Valid   - Specifies if the list is a valid component name list.
--
-- Called to turn a list of names into a list of quarks.  We print out the
-- list and the resultant list so that we have a log of what happens.
------------------------------------------------------------------------------
    begin

        if Validate_Names then  
            Put ("Components := ");  
        else  
            Put ("Quark-List := ");  
        end if;  
        Putx ('"' & List & '"');  
        New_Line;  
        Put ("Result => ");  
        X_Rm_Str_To_Bl (List, Bind_List, Quark_List);  
        if Validate_Names and not Valid then  
            Put ('?');  
        end if;  
        New_Line;  
        for I in Quark_List'Range loop  
            if Quark_List (I) = None_X_Rm_Quark then  
                exit;  
            end if;  
            Put ("    ");  
            Put (I);  
            Put (' ');  
            Put (X_Rm_Binding'Image (Bind_List (I)));  
            Put (' ');  
            Putx ('"' & X_Rm_Quark_To_String (Quark_List (I)) & '"');  
            New_Line;  
        end loop;  
        New_Line;  
    exception  
        when Constraint_Error =>  
            if Validate_Names and not Valid then  
                Put ("invalid");  
                New_Line;  
            else  
                raise;  
            end if;

    end Qtbl;

begin

----Set up for debugging.

    Xlbmp_Debugger.Register_Debugging_Imagers;  
    X_Lib.Set_Next_Quark (Quark => (Id => 1000));
    -- Force testing to begin with a known state.
    -- Applications that do this are committing
    -- suicide.

----Call X_Rm_Unique_Quark a few times and make sure that each one results
--  in a new value.

    Section ("X_Rm_Unique_Quark");  
    for I in 1 .. 5 loop  
        Quark1 := X_Rm_Unique_Quark;  
        Put ("Unique quark ");  
        Put (Quark1.Id);  
        Put (" => ");  
        Putx (X_Rm_Quark_To_String (Quark1));  
        New_Line;  
    end loop;

----See if we can turn strings into quarks and back again.

    Section ("X_Rm_Quark_To/From_String");  
    Qts ("0");  
    Qts ("One");  
    Qts ("Two");  
    Qts ("Three");  
    Qts ("Four");  
    Qts ("And-A_Long_String");  
    Qts ("Something_Else");  
    Qts ("something_else");

----See if we can turn those same strings into the same quarks all over again.

    Section ("X_Rm_Quark_To/From_Old_String");  
    Qts ("0");  
    Qts ("One");  
    Qts ("Two");  
    Qts ("Three");  
    Qts ("Four");  
    Qts ("And-A_Long_String");  
    Qts ("Something_Else");  
    Qts ("something_else");

----See if we can successfully parse some quark lists.

    Section ("Simple quark lists");  
    Qtl ("One");  
    Qtl ("Two.");  
    Qtl ("Three*Four");  
    Qtl ("Four.Three.One.Two.Something_Else");  
    Qtl ("_0*1.2-3_");  
    Qtl ("A.B.C.D.E.F.G");

----Try those same lists a Binding-Quark lists

    Section ("Tight Quark/Binding lists");  
    Qtbl ("One");  
    Qtbl ("Two.");  
    Qtbl ("Three.Four");  
    Qtbl ("Four.Three.One.Two.Something_Else");  
    Qtbl ("A.B.C.D.E.F.G");

----Try those same lists a Binding-Quark lists and add some different bindings

    Section ("Mixed Quark/Binding lists");  
    Qtbl ("One");  
    Qtbl ("*One");  
    Qtbl (".One");  
    Qtbl ("Two.");  
    Qtbl ("Two*");  
    Qtbl ("Three.Four");  
    Qtbl ("Three*Four");  
    Qtbl ("Four.Three.One.Two.Something_Else");  
    Qtbl ("*Four.Three*One.Two*Something_Else");  
    Qtbl ("A*B*C*D.E.F.G");

----Try some interesting QTS cases.

    Section ("Interesting X_Rm_Quark_To/From_String cases");  
    Qts ("");  
    Qts ("");  
    Qts (".", False);  
    Qts ("*", False);  
    Qts ("A bad component..", False);  
    Validate_Names := False;  
    Qts ("...but a good quark!", False);  
    Qts ("...but a good quark!", False);  
    Validate_Names := True;

----And some interesting QTL cases.

    Section ("Interesting X_Rm_Quark_To_List cases");  
    Qtl ("Mixed*Separators.In.Component*Lists");  
    Qtl ("... Bogus list ...", False);  
    Qtl ("...Valid.List...");  
    Qtl ("Nul.Terminator" & Nul & " stops processing");  
    Qtl (Nul & " Leading null");  
    Qtl ("Another.Nul." & Nul);  
    Validate_Names := False;  
    Qtl ("Junk accepted in *QUARK* lists!", False);  
    Validate_Names := True;  
    Qtl ("");  
    Qtl ("*.*.*");

----And some interesting QTBL cases.

    Section ("Interesting X_Rm_Quark_To_Binding_List cases");  
    Qtbl ("");  
    Qtbl (".*.*.");  
    Qtbl ("... Bogus list ...", False);  
    Qtbl ("...Valid.list...");  
    Qtbl ("*Terminating.Nul" & Nul & " stops processing");  
    Qtbl (Nul & " Leading nul");  
    Qtbl ("Another.Nul." & Nul);  
    Validate_Names := False;  
    Qtbl ("Junk accepted in *QUARK* lists!", False);  
    Validate_Names := True;

end Rm_010;  

E3 Meta Data

    nblk1=b
    nid=0
    hdr6=16
        [0x00] rec0=29 rec1=00 rec2=01 rec3=01c
        [0x01] rec0=00 rec1=00 rec2=0b rec3=002
        [0x02] rec0=18 rec1=00 rec2=02 rec3=054
        [0x03] rec0=1b rec1=00 rec2=03 rec3=028
        [0x04] rec0=1b rec1=00 rec2=04 rec3=020
        [0x05] rec0=1d rec1=00 rec2=05 rec3=094
        [0x06] rec0=1d rec1=00 rec2=06 rec3=01a
        [0x07] rec0=24 rec1=00 rec2=07 rec3=074
        [0x08] rec0=26 rec1=00 rec2=08 rec3=024
        [0x09] rec0=22 rec1=00 rec2=09 rec3=030
        [0x0a] rec0=1c rec1=00 rec2=0a rec3=001
    tail 0x21500a34e81978d0fa45a 0x42a00088462063203