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

⟦f3b2ee7fb⟧ Ada Source

    Length: 10240 (0x2800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Keyboard, seg_0046bf, separate Spreadsheet_Generic

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 Window_Io;
with System_Utilities;
separate (Spreadsheet_Generic)
package body Keyboard is

    Key_Not_Found_In_Visible_Key_Names : exception;
    Terminal_Not_Supported             : exception;

    package Raw renames Window_Io.Raw;
    Nil : constant Raw.Key := Raw.Key'Last;

    function "<=" (K1, K2 : Raw.Key) return Boolean renames Raw."<=";
    function ">=" (K1, K2 : Raw.Key) return Boolean renames Raw.">=";
    function "="  (K1, K2 : Raw.Key) return Boolean renames Raw."=";

    Terminal_Type : constant String := System_Utilities.Terminal_Type;

    A_Char : String (1 .. 3) := "' '";

    Numeric_0, Numeric_9, Dot_Key, Dash_Key, Comma_Key : Raw.Key := Nil;

    Disconnect_Key, Quit_Key : Raw.Key;

    subtype Printable_Characters is Character range ' ' .. '~';
    Characters : array (Printable_Characters) of Raw.Key;

    Functions : array (Logical_Key range Up .. Enter) of Raw.Key :=
       (Up .. Enter => Nil);

    Str : Raw.Stream_Type;

    K    : Raw.Key;
    Char : Character;

    function Get_Char return Character is
    begin
        return Char;
    end Get_Char;

    function Get_Key return Logical_Key is
    begin
        Raw.Open (Str);
        Raw.Get (Str, K);
        Raw.Close (Str);

-- Ascii_Char
        if K in Raw.Simple_Key then
            Char := Raw.Convert (K);
            if Char = Ascii.Lf then
                return Bottom;
            else
                return Ascii_Char;
            end if;
        end if;

-- function key
        for F in Functions'Range loop
            if K = Functions (F) then
                return F;
            end if;
        end loop;

-- numeric pad
        if (K >= Numeric_0 and K <= Numeric_9) then
            Char := Character'Val (Character'Pos ('0') + Integer (K) -
                                   Integer (Numeric_0));
            return Numeric;
        elsif K = Dot_Key then
            Char := '.';
            return Numeric;
        elsif K = Dash_Key then
            Char := '-';
            return Numeric;
        elsif K = Comma_Key then
            Char := ',';
            return Numeric;
        end if;

-- escape
        if K = Disconnect_Key then
            raise Disconnect;
        elsif K = Quit_Key then
            raise Quit;
        end if;

-- unknown key
        return Unknown;
    end Get_Key;


    function Get return Character is
    begin
        return Char;
    end Get;

    procedure Bind_Key (Name : String; Key : in out Raw.Key) is
        Found : Boolean;
    begin
        Raw.Value (Name, Terminal_Type, Key, Found);
        if not Found then
            raise Key_Not_Found_In_Visible_Key_Names;
        end if;
    end Bind_Key;
    procedure Bind_Key (Name : String; Key : Logical_Key) is
    begin
        Bind_Key (Name, Functions (Key));
    end Bind_Key;

    procedure Facit is
    begin
        Bind_Key ("back_tab", Begin_Of);
        Bind_Key ("tab", End_Of);
        Bind_Key ("promot", Compute);
        Bind_Key ("complt", Home);
        Bind_Key ("format", Format);
        Bind_Key ("Delete", Del);
        Bind_Key ("Window", Window);

        Bind_Key ("F4", Definition);
        Bind_Key ("F5", Help);
        Bind_Key ("F6", Save); -- install
        Bind_Key ("F7", Edit);
        Bind_Key ("F8", Command);  
        Bind_Key ("f9", Show); -- other part
        Bind_Key ("f10", Load); -- semanticize
        Bind_Key ("f11", Print);
        Bind_Key ("F12", Time);

        Bind_Key ("backspace", Reset);
        Bind_Key ("esc_enter", Quit_Key);

        Bind_Key ("Numeric_0", Numeric_0);
        Bind_Key ("Numeric_9", Numeric_9);
        Bind_Key ("Enter", Enter);
        Bind_Key ("dot", Dot_Key);
        Bind_Key ("dash", Dash_Key);
        Bind_Key ("numeric_comma", Comma_Key);

        Bind_Key ("object", Object);

    end Facit;
    procedure Vt100 is
    begin
        Bind_Key ("numeric_7", Begin_Of);
        Bind_Key ("numeric_9", End_Of);
        Bind_Key ("enter", Compute);
        Bind_Key ("numeric_5", Home);
        Bind_Key ("dash", Format);
        Bind_Key ("Delete", Del);
        Bind_Key ("pf2", Window);

        Bind_Key ("numeric_8", Definition);
        Bind_Key ("pf1", Help);
        Bind_Key ("numeric_2", Save);
        Bind_Key ("numeric_1", Edit);
        Bind_Key ("dot", Command);  
        Bind_Key ("numeric_6", Show);
        Bind_Key ("numeric_3", Load);
        Bind_Key ("pf3", Print);
        Bind_Key ("pf4", Time);

        Bind_Key ("numeric_4", Reset);
        Bind_Key ("esc_slash", Quit_Key);

        Bind_Key ("C_M", Enter);
        Bind_Key ("numeric_comma", Comma_Key);

        Bind_Key ("numeric_0", Object);
    end Vt100;

    procedure Rational is
    begin

        Bind_Key ("begin_of", Begin_Of);
        Bind_Key ("end_of", End_Of);
        Bind_Key ("promot", Compute);
        Bind_Key ("complt", Home);
        Bind_Key ("format", Format);
        Bind_Key ("Delete", Del);
        Bind_Key ("Window", Window);

        Bind_Key ("F10", Definition);
        Bind_Key ("F11", Help);
        Bind_Key ("F13", Save);
        Bind_Key ("F14", Edit);
        Bind_Key ("F15", Command);  
        Bind_Key ("f17", Show);
        Bind_Key ("f16", Load);
        Bind_Key ("cm_f11", Print);
        Bind_Key ("F20", Time);

        Bind_Key ("cs_delete", Reset);
        Bind_Key ("cs_enter", Quit_Key);

        Bind_Key ("Numeric_0", Numeric_0);
        Bind_Key ("Numeric_9", Numeric_9);
        Bind_Key ("Enter", Enter);
        Bind_Key ("dot", Dot_Key);
        Bind_Key ("dash", Dash_Key);
        Bind_Key ("numeric_comma", Comma_Key);

        Bind_Key ("object", Object);

    end Rational;
begin

    for C in Printable_Characters loop
        A_Char (2) := C;
        Bind_Key (A_Char, Characters (C));
    end loop;

    Bind_Key ("Up", Up);
    Bind_Key ("Down", Down);
    Bind_Key ("Left", Left);
    Bind_Key ("Right", Right);

    Bind_Key ("C_G", Disconnect_Key);
    Bind_Key ("C_D", Erase);

    if Terminal_Type = "FACIT" then
        Facit;
    elsif Terminal_Type = "RATIONAL" then
        Rational;
    elsif Terminal_Type = "VT100" then
        Vt100;
    else
        raise Terminal_Not_Supported;
    end if;

end Keyboard;

E3 Meta Data

    nblk1=9
    nid=0
    hdr6=12
        [0x00] rec0=1f rec1=00 rec2=01 rec3=01a
        [0x01] rec0=00 rec1=00 rec2=09 rec3=01a
        [0x02] rec0=27 rec1=00 rec2=02 rec3=02c
        [0x03] rec0=00 rec1=00 rec2=08 rec3=004
        [0x04] rec0=2a rec1=00 rec2=03 rec3=000
        [0x05] rec0=1f rec1=00 rec2=04 rec3=008
        [0x06] rec0=22 rec1=00 rec2=05 rec3=020
        [0x07] rec0=21 rec1=00 rec2=06 rec3=028
        [0x08] rec0=17 rec1=00 rec2=07 rec3=000
    tail 0x215004a26815c66fbe95a 0x42a00088462061e03