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

⟦7b20cf70c⟧ Ada Source

    Length: 16384 (0x4000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, generic, package Spreadsheet_Generic, seg_0046b9

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



--| @SUMMARY Provide tool and engine to build a small spreadsheet-like
--|          application using Window_IO.
--|
generic  -- package Spreadsheet

    -- Grid definition
    --
    type Line_Type   is (<>);
    type Column_Type is (<>);

    -- Name used in default file name and on the window name
    --
    Default_Name : in String := "Spreadsheet";

    Application_Version : in String := "";

package Spreadsheet_Generic is

    Spreadsheet_Version : constant String := "Rev2.0";


    --| @DESCRIPTION Application interface to access the display
    --|
    function Current_Line   return Line_Type;
    function Current_Column return Column_Type;

    procedure Set (L : Line_Type := Current_Line;
                   C : Column_Type := Current_Column;
                   To_String : String;
                   Immediately_Shown : Boolean := False);
    procedure Set_And_Show (L : Line_Type;
                            C : Column_Type;
                            To_String : String;
                            Immediately_Shown : Boolean := True) renames Set;

    function Get (L : Line_Type   := Current_Line;
                  C : Column_Type := Current_Column) return String;

    function Width (C : Column_Type := Current_Column) return Positive;


    --| @DESCRIPTION A few utilities to help build the application
    --|
    package Tool_Set is

        -- String utilities
        --
        function "*"         (Width : Integer; C : Character) return String;
        function Left_Align  (S : String; Width : Natural) return String;
        function Right_Align (S : String; Width : Natural) return String;
        function Center      (S : String; Width : Natural) return String;
        function Capitalize  (S : String) return String;

        -- Expression evaluators : any level of parenthesing, 4 arithmetic
        --    operations
        --
        function Integer_Value (Expression : String) return Integer;
        --
        -- this one accept both Integers and Floats
        function Float_Value (Expression : String) return Float;

        -- Formatting utilities
        --
        function Image (F             : Float;
                        Width         : Natural;
                        Aft           : Natural := 2;
                        Exp           : Natural := 0;
                        Blank_If_Zero : Boolean := False) return String;
        function Image (I             : Integer;
                        Width         : Natural;
                        K_Or_M_Suffix : Boolean := False;
                        Blank_If_Zero : Boolean := False) return String;

        -- Queries the user in standard i/o window
        --
        function Ask_For (Question : String) return String;

        -- Reporting small errors and attracting attention
        --
        procedure Alert (S : String; Beeps : Natural := 2);
        procedure Beep (S : String := ""; Beeps : Natural := 1) renames Alert;
        procedure Echo_Line (S : String; Beeps : Natural := 0) renames Alert;

    end Tool_Set;


    --------------------------------------------------------------
    --
    -- Default subprograms for Engine instantiation:
    --
    function  All_Columns_Equal (C : Column_Type) return Positive;
    function  All_Modifiable    (L : Line_Type; C : Column_Type) return Boolean;
    function  Not_Selected      (L : Line_Type; C : Column_Type) return Boolean;
    function  No_Help return String;
    function  No_Definition     (L : Line_Type; C : Column_Type) return String;
    function  No_Message return String;
    procedure Up_And_Left_Border; -- uses Line_Type and Column_Type
    procedure Upper_Left_Corner (L : out Line_Type; C : out Column_Type);
    function  No_File_Name return String;     -- returns "<None>"
    function  Default_File_Name return String;-- returns "<Default>"
    procedure Noop;
    --
    -----------------------------------------------------------------


    --| @DESCRIPTION This is the real stuff: the engine of the spreadsheet.
    --
    generic

        --  1.  Compulsory parameters (must be provided by application)
        --
        with procedure Compute;
        with procedure Feed (L     :     Line_Type;
                             C     :     Column_Type;
                             Data  :     String;
                             Valid : out Boolean);

        -- 2. Optional parameters (default to nil or minimal functionality)
        --
        ---- 2.1 grid definition
        --
        with procedure Initialize is Up_And_Left_Border;  
        with procedure Home_Position (L : out Line_Type; C : out Column_Type) is
           Upper_Left_Corner;  
        with function  Column_Width  (C : Column_Type)    return Positive is
           All_Columns_Equal;
        with function  Is_Modifiable
                         (L : Line_Type; C : Column_Type) return Boolean is
           All_Modifiable;
        with function  Is_Selected
                         (L : Line_Type; C : Column_Type) return Boolean is
           Not_Selected;
        with function  Edit_Prompt
                         (L : Line_Type; C : Column_Type) return String is Get;
        --
        ---- 2.2 Help features
        --
        with function Definition
                         (L : Line_Type; C : Column_Type) return String is
           No_Definition;
        with function Help return String is No_Help;  
        with function Diagnosis return String is No_Message;

        --
        ---- 2.3 Input-Output
        --
        with function Save_File_Name return String is Default_File_Name;
        with function Load_File_Name return String is No_File_Name;
        --
        ---- 2.4 Application defined command
        --
        with procedure Command is Noop;

        --
        ---- 2.5 Engine behaviour parameters
        --
        Moving_Cursor_Also_Commits : in Boolean := True;
        Committing_Also_Computes   : in Boolean := False;
        Computing_Also_Reformats   : in Boolean := False;

    procedure Engine (Window_Name          : String := Default_Name;
                      Initial_File_To_Load : String := No_File_Name);

end Spreadsheet_Generic;

--
-- The spreadsheet uses a notion of logical key. Here is the mapping
-- of those logical keys to keypresses of 3 commonly used terminals.
-- Note also that except on the VT100, the numeric keypad can be used
-- for numbers entries (unlike the Environment editor usage).
--
-- [Logical key]              Facit terminal      VT100    Rational
-- -----------------------------------------------------------------
-- Help        **             F5  [Help/Help]     PF1      F11
-- Definition  *              F4  [Definition]    pad 8    F10
-- Show        *              F9  [Other Part]    pad 6    F17
-- Format                     X6  [Format]        pad -    Format
-- Compute     *              X4  [Promote]       enter    Promot
-- Save        **             F6  [Install]       pad 2    F13
-- Load        *              F10 [Semanticize]   pad 3    F16
-- Time                       F12 [What Time]     PF4      F20
-- Command     *              F8  [Create Comm.]  pad .    F15
-- Window                     X3  [Window]        PF2      window
-- Print       (future)       F11 [Print]         PF3      CM_F11
--
-- *  indicates that function is application dependent
-- ** indicates that function is patially application dependent
--
-- Up, Down                   Up, Down           <-idem    <-idem
-- Left, Right                Left,Right
--
-- Begin_Of                       [Back_Tab]      pad 7    Begin_of
-- End_Of                     C_I [Tab]           pad 9    End_Of
-- Home                       X5  [Complete]      pad 5    complet
-- Bottom                     C_  Line_Feed       C_       ????
--
-- Del                        Del                          Del
-- Erase                      C_D                 C_D      C_D
--
-- Reset                      C_H [Backspace]     pad 4    C_H
-- Quit                       Esc-Enter           Esc-G    Esc-Enter
-- Disconnect                 C_G                 C_G      C_G
-- Reconnect                  esc-F11             ????     meta-F19
--
-------------------------------------------------------------------------------

E3 Meta Data

    nblk1=f
    nid=0
    hdr6=1e
        [0x00] rec0=22 rec1=00 rec2=01 rec3=006
        [0x01] rec0=00 rec1=00 rec2=0f rec3=004
        [0x02] rec0=18 rec1=00 rec2=0e rec3=05c
        [0x03] rec0=00 rec1=00 rec2=02 rec3=022
        [0x04] rec0=18 rec1=00 rec2=03 rec3=03e
        [0x05] rec0=16 rec1=00 rec2=04 rec3=004
        [0x06] rec0=00 rec1=00 rec2=0d rec3=028
        [0x07] rec0=19 rec1=00 rec2=05 rec3=068
        [0x08] rec0=00 rec1=00 rec2=0c rec3=00c
        [0x09] rec0=1c rec1=00 rec2=06 rec3=008
        [0x0a] rec0=00 rec1=00 rec2=0b rec3=004
        [0x0b] rec0=15 rec1=00 rec2=07 rec3=038
        [0x0c] rec0=00 rec1=00 rec2=0a rec3=008
        [0x0d] rec0=12 rec1=00 rec2=08 rec3=07a
        [0x0e] rec0=0b rec1=00 rec2=09 rec3=000
    tail 0x2150049d4815c66ee5f9c 0x42a00088462061e03