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: B T

⟦637e3b12c⟧ TextFile

    Length: 5654 (0x1616)
    Types: TextFile
    Names: »B«

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

with Command_Line_Handler, Character_Set;
package body Command_Line_Interface is

    subtype Name_String is String (1 .. 80);
    type Name_Record is
        record
            Name : Name_String;
            Last : Natural;
        end record;

    Names_Size : constant := 10; -- 4 entries and 6 user dicts
    Names : array (1 .. Names_Size) of Name_Record;
    File_Idx : constant := 1;
    Word_Idx : constant := 2;
    Mdict_Idx : constant := 3;
    Adict_Idx : constant := 4;
    Udict_Idx : constant := 5;

    Error_Word : Name_Record;
    Are_Names_Extracted : Boolean := False;

    procedure Initialize_Names is
    begin
        for I in 1 .. Names_Size loop
            Names (I).Name := (others => ' ');
            Names (I).Last := 0;
        end loop;
    end Initialize_Names;

    function Is_Named_Association (Word : String) return Boolean is
    begin
        for I in Word'First .. Word'Last loop
            if Word (I) = '=' then
                return True;
            end if;
        end loop;
        return False;
    end Is_Named_Association;

    procedure Process_Association (Str : String) is
        Word : Name_String;
        Last : Natural;
        Idx : Natural;
        In_Name : Boolean := False;
    begin
        case Character_Set.To_Upper (Str (1)) is
            when 'F' =>
                Idx := 1;
            when 'W' =>
                Idx := 2;
            when 'M' =>
                Idx := 3;
            when 'A' =>
                Idx := 4;
            when 'U' =>
                case Str (2) is
                    when '1' =>
                        Idx := 5;
                    when '2' =>
                        Idx := 6;
                    when '3' =>
                        Idx := 7;
                    when '4' =>
                        Idx := 8;
                    when '5' =>
                        Idx := 9;
                    when '6' =>
                        Idx := 10;
                    when others =>
                        raise User_Dictionary_Number;
                end case;
            when others =>
                Error_Word.Name (1 .. Str'Length) := Str;
                Error_Word.Last := Str'Length;
                raise Name_Error;
        end case;
        Last := 0;
        for I in Str'First .. Str'Last loop
            if In_Name then
                Last := Last + 1;
                Word (Last) := Str (I);
            else
                if Str (I) = '=' then
                    In_Name := True;
                end if;
            end if;
        end loop;
        Names (Idx).Name (1 .. Last) := Word (1 .. Last);
        Names (Idx).Last := Last;
    end Process_Association;

    procedure Extract_Names is
        Word : Name_String;
        Word_Length : Natural;
        Index : Natural := 0;
        Name_Flag : Boolean := False;
    begin
        if not Are_Names_Extracted then
            Initialize_Names;
            Are_Names_Extracted := True;
            loop
                Command_Line_Handler.Next_Word (Word, Word_Length);
                if Is_Named_Association (Word (1 .. Word_Length)) then
                    Process_Association (Word (1 .. Word_Length));
                    Name_Flag := True;
                else
                    if not Name_Flag then
                        Index := Index + 1;
                        Names (Index).Name := Word;
                        Names (Index).Last := Word_Length;
                    else
                        Error_Word.Name := Word;
                        Error_Word.Last := Word_Length;
                        raise Mix_Error;
                    end if;
                end if;
            end loop;
        end if;
    exception
        when Mix_Error =>
            raise;
        when others =>
            null;
    end Extract_Names;

    procedure Bad_Word (Word : out String; Last : out Natural) is
        Count : Natural;
    begin
        Count := 0;
        for I in Word'First .. Word'Last loop
            Count := Count + 1;
            Word (I) := Error_Word.Name (Count);
            exit when Count = Error_Word.Last;
        end loop;
        Last := Count;
    end Bad_Word;

    procedure Get_Word (Idx : Natural; Word : out String; Last : out Natural) is
        Count : Natural := 0;
    begin
        if Names (Idx).Last /= 0 then
            for I in Word'First .. Word'Last loop
                Count := Count + 1;
                Word (I) := Names (Idx).Name (Count);
                exit when Count = Names (Idx).Last;
            end loop;
        end if;
        Last := Count;
    end Get_Word;

    procedure File_Name (File : out String; Last : out Natural) is
    begin
        Extract_Names;
        Get_Word (File_Idx, File, Last);
    end File_Name;

    procedure Word_List (File : out String; Last : out Natural) is
    begin
        Extract_Names;
        Get_Word (Word_Idx, File, Last);
    end Word_List;

    procedure Master_Dictionary (File : out String; Last : out Natural) is
    begin
        Extract_Names;
        Get_Word (Mdict_Idx, File, Last);
    end Master_Dictionary;

    procedure Acronym_Dictionary (File : out String; Last : out Natural) is
    begin
        Extract_Names;
        Get_Word (Adict_Idx, File, Last);
    end Acronym_Dictionary;

    procedure User_Dictionary
                 (Key : Natural; File : out String; Last : out Natural) is
    begin
        if Key in 1 .. 6 then
            Extract_Names;
            Get_Word (Udict_Idx + Key - 1, File, Last);
        else
            raise User_Dictionary_Number;
        end if;
    end User_Dictionary;

end Command_Line_Interface;