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

⟦2d9b908de⟧ TextFile

    Length: 6113 (0x17e1)
    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

separate (Help_Utility)
-------------------------PROLOGUE---------------------------------------
--                                                                    -*
-- Unit name    :  PRINT_TOPIC_MENU
-- Date created :  28 January 1985
-- Last update  :
--                                                                    -*
------------------------------------------------------------------------
--                                                                    -*
-- Abstract     :  This procedure will print a list of subtopics (menu) for
----------------: the given node (if any exist). The subtopics are listed
----------------: in two columns.
--                                                                    -*
------------------------------------------------------------------------
--
-- Mnemonic     :
-- Name         :
-- Release date :
------------------ Revision history ------------------------------------
--
-- DATE  AUTHOR   HISTORY
--
--
--


--------------------END-PROLOGUE----------------------------------------
procedure Print_Topic_Menu (Node : in Help_Utility.Help_Link) is

    Total_Number_Of_Topics : Natural := 0;
    Num_Topics_In_Column_One : Positive := 1;
    Topics_In_Column_Two : Boolean := False;
    Col_Width : Integer := (Help_Info_Support.Max_Line_Length / 2) - 1;
    Right_Column_Start : Integer := Col_Width + 3;
    Even : Boolean := False;
    Current_Node : Help_Utility.Help_Link := null;
    Col_One_Node : Help_Utility.Help_Link := null;
    Col_Two_Node : Help_Utility.Help_Link := null;

begin

    Current_Node := Node.Subtopics;

    -- count the number of subtopics for this node

    while Current_Node /= null loop
        Total_Number_Of_Topics := Total_Number_Of_Topics + 1;
        Current_Node := Current_Node.Next_Topic;
    end loop;

    -- If there is more than one topic, then split the topics into two columns
    -- Column one will have the first half and column two the second half.
    -- If there are an odd number of topics, column one will have the odd number

    if Total_Number_Of_Topics /= 0 then
        if Total_Number_Of_Topics >= 2 then
            Topics_In_Column_Two := True;
            Num_Topics_In_Column_One := Total_Number_Of_Topics / 2;

            -- More than one topic, split the number
            -- See if odd number. If so, increment the topic count so odd goes in 1st col.

            if Total_Number_Of_Topics /= (Total_Number_Of_Topics / 2) * 2 then
                Num_Topics_In_Column_One := Num_Topics_In_Column_One + 1;

            else
                Even := True;
            end if;
        end if;

        -- set the beginning node for each column

        Col_One_Node := Node.Subtopics;
        Current_Node := Node.Subtopics;

        for I in 1 .. Num_Topics_In_Column_One loop
            Col_Two_Node := Current_Node.Next_Topic;
            Current_Node := Current_Node.Next_Topic;
        end loop;

        if Topics_In_Column_Two then
            while Col_Two_Node /= null loop
                Help_Utility.Output_Line :=
                   Help_Utility.Blank_Line; -- blank the line buffer

                -- Put first topic in left half of output line
                --     if full name will not fit then truncate

                if Col_Width > Col_One_Node.Name_Length then

                    --      full name will fit

                    Help_Utility.Output_Line (1 .. Col_One_Node.Name_Length) :=
                       Col_One_Node.Name (1 .. Col_One_Node.Name_Length);

                else

                    --      truncate

                    Help_Utility.Output_Line (1 .. Col_Width) :=
                       Col_One_Node.Name (1 .. Col_Width);
                end if;

                -- Put second topic in second half of output line
                --     if full name will not fit then truncate

                if Col_Width > Col_Two_Node.Name_Length then

                    --      full name will fit

                    Help_Utility.Output_Line
                       (Right_Column_Start ..
                           Right_Column_Start + Col_Two_Node.Name_Length - 1) :=
                       Col_Two_Node.Name (1 .. Col_Two_Node.Name_Length);
                    Help_Info_Support.Append_To_Display
                       (Help_Utility.Output_Line,
                        Right_Column_Start - 1 + Col_Two_Node.Name_Length);

                else

                    --      truncate

                    Help_Utility.Output_Line
                       (Right_Column_Start ..
                           Right_Column_Start + Col_Width - 1) :=
                       Col_Two_Node.Name (1 .. Col_Width);
                    Help_Info_Support.Append_To_Display
                       (Help_Utility.Output_Line,
                        Right_Column_Start - 1 + Col_Width);

                end if;

                Col_One_Node := Col_One_Node.Next_Topic;
                Col_Two_Node := Col_Two_Node.Next_Topic;
            end loop;
        end if;

        if not Even then

            -- Put the odd topic in the output buffer

            Help_Utility.Output_Line := Help_Utility.Blank_Line;

            --  check if name will fit on output line

            if Help_Info_Support.Max_Line_Length > Col_One_Node.Name_Length then

                --    name fits

                Help_Utility.Output_Line (1 .. Col_One_Node.Name_Length) :=
                   Col_One_Node.Name (1 .. Col_One_Node.Name_Length);
                Help_Info_Support.Append_To_Display
                   (Help_Utility.Output_Line, Col_One_Node.Name_Length);

                --  truncate

            else
                Help_Utility.Output_Line
                   (1 .. Help_Info_Support.Max_Line_Length) :=
                   Col_One_Node.Name (1 .. Help_Info_Support.Max_Line_Length);
                Help_Info_Support.Append_To_Display
                   (Help_Utility.Output_Line,
                    Help_Info_Support.Max_Line_Length);
            end if;
        end if;
    end if;

exception
    when others =>
        raise;

end Print_Topic_Menu;