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 - download
Index: ┃ B T

⟦778a76a67⟧ TextFile

    Length: 8947 (0x22f3)
    Types: TextFile
    Names: »B«

Derivation

└─⟦85b835f43⟧ Bits:30000549 8mm tape, Rational 1000, Xlib rev 6.00
    └─ ⟦0c20f784e⟧ »DATA« 
        └─⟦1abbe589f⟧ 
            └─⟦059497ac5⟧ 
                └─⟦this⟧ 

TextFile

with Xlbt_Arithmetic;  
use Xlbt_Arithmetic;  
with Xlbt_Basic;  
use Xlbt_Basic;  
with Xlbt_Keyboard;  
use Xlbt_Keyboard;  
with Xlbt_Misc;  
use Xlbt_Misc;  
with Xlbt_Reply;  
use Xlbt_Reply;  
with Xlbt_Request;  
use Xlbt_Request;

with Xlbip_Get_Reply;  
use Xlbip_Get_Reply;  
with Xlbip_Internal;  
use Xlbip_Internal;  
with Xlbip_Put_Request;  
use Xlbip_Put_Request;

package body Xlbp_Keyboard_Control is
------------------------------------------------------------------------------
-- X Library Keyboard Controls
--
-- Xlbp_Keyboard_Control - Controls over physical portions of the keyboard
------------------------------------------------------------------------------
-- Copyright 1989 - 1991 by Rational, Santa Clara, California.
-- Copyright 1985 - 1989 by the Massachusetts Institute of Technology
--
--                  All Rights Reserved.
--
-- Permission to use, copy, modify, and distribute this software and its
-- documentation for any purpose and without fee is hereby granted,
-- provided that the above copyright notice(s) appear in all copies and that
-- both that copyright notice(s) and this permission notice appear in
-- supporting documentation, and that the names of MIT or Rational not be
-- used in advertising or publicity pertaining to distribution of the software
-- without specific, written prior permission.
--
-- MIT and Rational disclaim all warranties with regard to this software,
-- including all implied warranties of merchantability and fitness, in no
-- event shall MIT or Rational be liable for any special, indirect or
-- consequential damages or any damages whatsoever resulting from loss of use,
-- data or profits, whether in an action of contract, negligence or other
-- tortious action, arising out of or in connection with the use or performance
-- of this software.
------------------------------------------------------------------------------

--\f

    procedure X_Auto_Repeat_On (Display : X_Display) is  
        Values : X_Keyboard_Control;  
    begin  
        Values.Auto_Repeat_Mode := Auto_Repeat_Mode_On;  
        X_Change_Keyboard_Control  
           (Display,  
            X_Keyboard_Control_Flags'  
               (Kb_Auto_Repeat_Mode => True, others => False),  
            Values);  
    end X_Auto_Repeat_On;

--\f

    procedure X_Auto_Repeat_Off (Display : X_Display) is  
        Values : X_Keyboard_Control;  
    begin  
        Values.Auto_Repeat_Mode := Auto_Repeat_Mode_Off;  
        X_Change_Keyboard_Control  
           (Display,  
            X_Keyboard_Control_Flags'  
               (Kb_Auto_Repeat_Mode => True, others => False),  
            Values);  
    end X_Auto_Repeat_Off;

--\f

    procedure X_Bell (Display : X_Display; Percent : S_Percent) is  
    begin

        Lock_Display (Display);  
        begin  
            Put_X_Bell_Request (Display, (Kind    => Bell,  
                                          Length  => X_Bell_Request'Size / 32,  
                                          Percent => Percent));  
        exception  
            when others =>  
                Unlock_Display (Display);  
                raise;  
        end;  
        Unlock_Display (Display);  
        Sync_Handle (Display);

    end X_Bell;

--\f

    procedure X_Change_Keyboard_Control (Display     : X_Display;  
                                         Values_Mask : X_Keyboard_Control_Flags;  
                                         Values      : X_Keyboard_Control) is  
        Extra_Words : S_Natural;  
    begin

----Lock the display.

        Lock_Display (Display);  
        begin

----Count the extra words we will send in the request

            Extra_Words := 0;  
            for I in Values_Mask'Range loop  
                if Values_Mask (I) then  
                    Extra_Words := Extra_Words + 1;  
                end if;  
            end loop;

----Send the request.

            Put_X_Change_Keyboard_Control_Request  
               (Display,  
                (Kind   => Change_Keyboard_Control,  
                 Length => X_Change_Keyboard_Control_Request'Size / 32 +  
                              U_Short (Extra_Words),  
                 Pad    => 0,  
                 Mask   => Values_Mask),  
                Extra_Words * 4);

----Send the extra data.

            if Values_Mask (Kb_Key_Click_Percent) then  
                Put_S_Long (Display, S_Long (Values.Key_Click_Percent));  
            end if;  
            if Values_Mask (Kb_Bell_Percent) then  
                Put_S_Long (Display, S_Long (Values.Bell_Percent));  
            end if;  
            if Values_Mask (Kb_Bell_Pitch) then  
                Put_S_Long (Display, S_Long (Values.Bell_Pitch));  
            end if;  
            if Values_Mask (Kb_Bell_Duration) then  
                Put_S_Long (Display, S_Long (Values.Bell_Duration));  
            end if;  
            if Values_Mask (Kb_Led) then  
                Put_X_Led_Bits (Display, Values.Led);  
            end if;  
            if Values_Mask (Kb_Led_Mode) then  
                Put_S_Long (Display, S_Long (X_Led_Mode'Pos (Values.Led_Mode)));  
            end if;  
            if Values_Mask (Kb_Key) then  
                Put_S_Long (Display, S_Long (Values.Key));  
            end if;  
            if Values_Mask (Kb_Auto_Repeat_Mode) then  
                Put_S_Long (Display, S_Long (X_Auto_Repeat_Mode'Pos  
                                                (Values.Auto_Repeat_Mode)));  
            end if;

----Catch exceptions.

        exception  
            when others =>  
                Unlock_Display (Display);  
                raise;  
        end;

----Unlock; sync; return.

        Unlock_Display (Display);  
        Sync_Handle (Display);

    end X_Change_Keyboard_Control;

--\f

    procedure X_Get_Keyboard_Control (Display :     X_Display;  
                                      State   : out X_Keyboard_State) is  
        Rep  : X_Reply_Contents;  
        Succ : X_Status;  
    begin

----Lock the display.

        Lock_Display (Display);  
        begin

----Send the request.

            Put_X_Get_Keyboard_Control_Request  
               (Display, (Kind   => Get_Keyboard_Control,  
                          Length => X_Get_Keyboard_Control_Request'Size / 32,  
                          Pad    => 0));

----Read the reply.

            Get_Reply (Display => Display,  
                       Code    => Get_Keyboard_Control,  
                       Reply   => Rep,  
                       Extra   => 0,  
                       Discard => True,  
                       Status  => Succ);

----If we succeeded then return the values.

            if Succ /= Failed then  
                State.Key_Click_Percent :=  
                   Rep.Get_Keyboard_Control.Key_Click_Percent;  
                State.Bell_Percent := Rep.Get_Keyboard_Control.Bell_Percent;  
                State.Bell_Pitch := Rep.Get_Keyboard_Control.Bell_Pitch;  
                State.Bell_Duration := Rep.Get_Keyboard_Control.Bell_Duration;  
                State.Led_Mask := Rep.Get_Keyboard_Control.Led_Mask;  
                State.Global_Auto_Repeat :=  
                   To_Boolean (Rep.Get_Keyboard_Control.Global_Auto_Repeat);  
                State.Auto_Repeats := Rep.Get_Keyboard_Control.Map;  
            else  
                State := None_X_Keyboard_State;  
            end if;

----Catch exceptions.

        exception  
            when others =>  
                Unlock_Display (Display);  
                raise;  
        end;

----Unlock; sync; and return.

        Unlock_Display (Display);  
        Sync_Handle (Display);

    end X_Get_Keyboard_Control;

--\f

    procedure X_Query_Keymap (Display :     X_Display;  
                              Keys    : out X_Keyboard_As_Bits) is  
        Rep  : X_Reply_Contents;  
        Succ : X_Status;  
    begin

----Lock the display.

        Lock_Display (Display);  
        begin

----Send the request.

            Put_X_Query_Keymap_Request  
               (Display, (Kind   => Query_Keymap,  
                          Length => X_Query_Keymap_Request'Size / 32,  
                          Pad    => 0));

----Get the reply.

            Get_Reply (Display => Display,  
                       Code    => Query_Keymap,  
                       Reply   => Rep,  
                       Extra   => 0,  
                       Discard => True,  
                       Status  => Succ);  
            if Succ /= Failed then  
                Keys := Rep.Query_Keymap.Map;  
            else  
                Keys := (others => False);  
            end if;

----Catch exceptions.

        exception  
            when others =>  
                Unlock_Display (Display);  
                raise;  
        end;

----Unlock; sync; return.

        Unlock_Display (Display);  
        Sync_Handle (Display);

    end X_Query_Keymap;

--\f

end Xlbp_Keyboard_Control;