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

⟦4000c076b⟧ Ada Source

    Length: 27648 (0x6c00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Xlbip_Internal, seg_004f23

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦this⟧ 

E3 Source Code



with Unchecked_Deallocation;

with Xlbt_Arithmetic;  
use Xlbt_Arithmetic;  
with Xlbt_Basic;  
use Xlbt_Basic;  
with Xlbt_Context_Manager2;  
use Xlbt_Context_Manager2;  
with Xlbt_Display2;  
use Xlbt_Display2;  
with Xlbt_Event;  
use Xlbt_Event;  
with Xlbt_Event3;  
with Xlbt_Exceptions;  
use Xlbt_Exceptions;  
with Xlbt_Extension;  
use Xlbt_Extension;  
with Xlbt_Graphics;  
use Xlbt_Graphics;  
with Xlbt_Key;  
use Xlbt_Key;  
with Xlbt_Key2;  
use Xlbt_Key2;  
with Xlbt_Proc_Var;  
use Xlbt_Proc_Var;  
with Xlbt_Request3;  
use Xlbt_Request3;  
with Xlbt_Rm;  
use Xlbt_Rm;  
with Xlbt_String;  
use Xlbt_String;  
with Xlbt_Univ_Ptr;  
use Xlbt_Univ_Ptr;  
with Xlbt_Visual;  
use Xlbt_Visual;

with Xlbp_Display;  
use Xlbp_Display;  
with Xlbp_Error;  
use Xlbp_Error;  
with Xlbp_Proc_Var;  
use Xlbp_Proc_Var;  
with Xlbp_Rm;  
use Xlbp_Rm;  
with Xlbp_Window_Information;  
use Xlbp_Window_Information;

with Xlbit_Library3;  
use Xlbit_Library3;

with Xlbip_Put_Request;  
use Xlbip_Put_Request;

with Xlbmt_Network_Types;  
use Xlbmt_Network_Types;

with Xlbmp_Error_Log;  
use Xlbmp_Error_Log;

package body Xlbip_Internal is
------------------------------------------------------------------------------
-- X Library Machine Independent Internal Routines
--
-- Xlbip_Internal - Internal-to-X-Library routines - not for general users
------------------------------------------------------------------------------
-- 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.
------------------------------------------------------------------------------

--\x0c
    procedure Heap_Free_X_Display is  
       new Unchecked_Deallocation (X_Display_Rec,  
                                   X_Display);

--\x0c
    ------------------------------------------------------------------------------
-- Non-functional mutual exclusion functions.
------------------------------------------------------------------------------

    procedure Lock_Display (Display : X_Display) is  
    begin

--/ if not Multitask_Locking then
--//        if Display.Lock.flop = 0 then
--//            Display.Lock.Flop := 1;
--//        else
--//            raise X_Library_Confusion;
--//        end if;
--/ else
        Display.Lock.Lock;
--/ end if;

    end Lock_Display;

--\x0c
    procedure Unlock_Display (Display : X_Display) is  
    begin

--/ if not Multitask_Locking then
--//        if Display.Lock.Flop = 1 then
--//            Display.Lock.Flop := 0;
--//        else
--//            raise X_Library_Confusion;
--//        end if;
--/ else
        Display.Lock.Unlock;
--/ end if;

    end Unlock_Display;

--\x0c
    function Internal_X_Alloc_Id (Display : X_Display) return X_Id is
------------------------------------------------------------------------------
-- Default X_Alloc_Id implementation.  A user can roll his own and
-- instantiate it if he wants, but he must follow the rules.
------------------------------------------------------------------------------
        New_Id : X_Id;  
    begin

----See if we have any more ID's available.

        if Display.Resource_Mask.Number < Display.Resource_Id.Number then  
            raise Constraint_Error;     -- No, we don't.
        end if;

----This is the new ID.

        New_Id.Number := Display.Resource_Base.Number +  
                            Display.Resource_Id.Number;

----This is the next new ID; we don't check for overflow until the next ID
--  is required.

        Display.Resource_Id.Number :=  
           Display.Resource_Id.Number + Display.Resource_Incr;  
        return New_Id;

    end Internal_X_Alloc_Id;

--\x0c
    function Internal_X_Screen_Of_Window (Display : X_Display;  
                                          Window  : X_Window) return X_Screen is
------------------------------------------------------------------------------
--  Called to attempt to figure out what screen a window is drawn upon.
------------------------------------------------------------------------------
        Root   : X_Window;  
        X      : S_Short;  
        Y      : S_Short;  
        Width  : U_Short;  
        Height : U_Short;  
        Bw     : U_Short;  
        Depth  : U_Char;  
        Status : X_Status;  
    begin

        X_Get_Geometry (Display, Window.Drawable, Root, X, Y,  
                        Width, Height, Bw, Depth, Status);  
        if Status = Failed then  
            return None_X_Screen;  
        end if;  
        for I in Display.Screens'Range loop         -- find root from list
            if Root = X_Root_Window (Display, I) then  
                return X_Screen_Of_Display (Display, I);  
            end if;  
        end loop;  
        return None_X_Screen;

    end Internal_X_Screen_Of_Window;

--\x0c
    procedure Internal_X_Flush_Last_Request (Display : X_Display) is
------------------------------------------------------------------------------
-- Called to flush out the Display.Last_Request.  Some requests, e.g. Poly_Arc, are
-- cumulative; successive Poly_Arc requests will merge together in the display
-- buffer before being sent to the server for action.  This routine is called
-- to force any of the mergeable requests to be transmitted.
------------------------------------------------------------------------------
    begin

        case Display.Last_Request.Kind is

            when Invalid_Request =>  
                return;     -- Nothing needs to be done.

            when Fill_Poly =>  
                Put_X_Fill_Poly_Request  
                   (Display     => Display,  
                    Req         => Display.Last_Request.Fill_Poly_Req,  
                    Reservation => Display.Last_Request.Request_Position);

            when Poly_Fill_Arc =>  
                Put_X_Poly_Fill_Arc_Request  
                   (Display     => Display,  
                    Req         => Display.Last_Request.Poly_Fill_Arc_Req,  
                    Reservation => Display.Last_Request.Request_Position);

            when Poly_Line =>  
                Put_X_Poly_Line_Request  
                   (Display     => Display,  
                    Req         => Display.Last_Request.Poly_Line_Req,  
                    Reservation => Display.Last_Request.Request_Position);

            when Poly_Point =>  
                Put_X_Poly_Point_Request
                   (Display     => Display,  
                    Req         => Display.Last_Request.Poly_Point_Req,  
                    Reservation => Display.Last_Request.Request_Position);

            when Poly_Rectangle =>  
                Put_X_Poly_Rectangle_Request
                   (Display     => Display,  
                    Req         => Display.Last_Request.Poly_Rectangle_Req,  
                    Reservation => Display.Last_Request.Request_Position);

            when Poly_Fill_Rectangle =>  
                Put_X_Poly_Fill_Rectangle_Request
                   (Display     => Display,  
                    Req         => Display.Last_Request.Poly_Fill_Rectangle_Req,  
                    Reservation => Display.Last_Request.Request_Position);

            when Poly_Segment =>  
                Put_X_Poly_Segment_Request
                   (Display     => Display,  
                    Req         => Display.Last_Request.Poly_Segment_Req,  
                    Reservation => Display.Last_Request.Request_Position);

            when Xr128 .. Xr255 =>  
                declare  
                    use Proc_Var_X_Flush_Extension_Graphics;  
                begin  
                    if Display.Last_Request.Ext_Flush =  
                       None_X_Procedure_Variable then  
                        raise X_Library_Confusion;  -- The extension forgot.
                    end if;  
                    Call (To_Pv (Display.Last_Request.Ext_Flush), Display);  
                end;

            when others =>  
                raise X_Library_Confusion;
                ----There is a new type being cached in the X_Last_Request type and
                --  nobody told us.  How to they expect it to get to the server?
                --  This routine must be modified every time X_Last_Request is changed.

        end case;  
        Display.Last_Request.Kind := Invalid_Request;

    end Internal_X_Flush_Last_Request;

--\x0c
    procedure Internal_X_Free_Display_Structure (Display : in out X_Display) is
------------------------------------------------------------------------------
-- X_Free_Display_Structure frees all the storage associated with a
-- Display.  It is used by X_Open_Display if it runs out of memory,
-- and also by X_Close_Display.   It needs to check whether all pointers
-- are non-NULL before dereferencing them, since it may be called
-- by X_Open_Display before the Display structure is fully formed.
-- X_Open_Display must be sure to initialize all the pointers to NULL
-- before the first possible call on this.
------------------------------------------------------------------------------
        Sp : X_Screen;  
    begin

        if Display = None_X_Display then  
            return;  
        end if;

        if Display.Display_Name /= null then  
            Free_X_String_Pointer (Display.Display_Name);  
        end if;

        if Display.Vendor /= null then  
            Free_X_String_Pointer (Display.Vendor);  
        end if;

        if Display.Screens /= null then  
            for I in Display.Screens'Range loop  
                Sp := Display.Screens (I);  
                if Sp.Depths /= null then  
                    for J in Display.Screens (I).Depths'Range loop  
                        declare  
                            Dp : X_Depth_Rec renames Sp.Depths (J);  
                        begin  
                            if Dp.Visuals /= null then  
                                for K in Dp.Visuals'Range loop  
                                    declare  
                                        Vp : X_Visual renames Dp.Visuals (K);  
                                    begin  
                                        Free_X_Ext_Data_List (Vp.Ext_Data);  
                                    end;  
                                end loop;  
                                Free_X_Visual_List (Dp.Visuals);  
                            end if;  
                        end;  
                    end loop;  
                    Free_X_Depth_List (Sp.Depths);  
                end if;  
                Free_X_Ext_Data_List (Sp.Ext_Data);  
                Free_X_Screen (Sp);  
            end loop;  
            Free_X_Screen_List (Display.Screens);  
        end if;

        if Display.Pixmap_Format /= null then  
            for I in Display.Pixmap_Format'Range loop  
                Free_X_Ext_Data_List (Display.Pixmap_Format (I).Ext_Data);  
                Free_X_Screen_Format (Display.Pixmap_Format (I));  
            end loop;  
            Free_X_Screen_Format_List (Display.Pixmap_Format);  
        end if;

        if Display.Head /= null then  
            declare  
                This : X_Queued_Event;  
                That : X_Queued_Event;  
            begin  
                This := Display.Head;  
                while This /= null loop  
                    That := This.Next;  
                    Free_X_Queued_Event (This);  
                    This := That;  
                end loop;  
            end;  
        end if;

        if Display.Database /= None_X_Universal_Pointer then  
            Univ_X_Rm_Database.Free_Both_X_Universal_Pointer (Display.Database);  
        end if;

        if Display.Key_Syms /= null then  
            Free_X_Key_Sym_List_2d (Display.Key_Syms);  
        end if;

        if Display.Modifier_Map /= null then  
            if Display.Modifier_Map.Modifiermap /= null then  
                Free_X_Modifier_Key_Code_List  
                   (Display.Modifier_Map.Modifiermap);  
            end if;  
            Free_X_Modifier_Keymap (Display.Modifier_Map);  
        end if;

        if Display.Key_Bindings /= null then  
            Free_X_Key_Trans (Display.Key_Bindings);  
        end if;

        if Display.X_Defaults /= None_X_String_Pointer then  
            Free_X_String_Pointer (Display.X_Defaults);  
        end if;

        Free_X_Ext_Data_List (Display.Ext_Data);

--/ if OLD_CONTEXT_MANAGER then
--//         if Display.Contexts /= None_X_Universal_Pointer then
--//             Univ_X_Context_Hash_List.Free_Both_X_Universal_Pointer
--//                (Display.Contexts);
--//         end if;
--/ end if;

        Display.Lock.Unlock;  
        Free_X_Mutex (Display.Lock);

        Heap_Free_X_Display (Display);

    end Internal_X_Free_Display_Structure;

--\x0c
    procedure Internal_X_Vid_To_Visual (Display :        X_Display;  
                                        Id      :        X_Visual_Id;  
                                        Visual  : in out X_Visual;  
                                        Status  : out    X_Status) is
------------------------------------------------------------------------------
-- Given a visual id, find the X_Visual structure.  We walk over the various
-- visual info for a given display until we find the Visual whose Id matches
-- the one sent in.  This is used to translate Id's into X_Visuals when an
-- Id is returned by an incoming event.
------------------------------------------------------------------------------
        Sp : X_Screen;  
    begin  
        begin

----Loop over all Screens in the display.

            for I in Display.Screens'Range loop  
                Sp := Display.Screens (I);

----Loop over all Depths in the screen.

                for J in Sp.Depths'Range loop  
                    declare  
                        Dp : X_Depth_Rec renames Sp.Depths (J);  
                    begin

----Loop over all Visuals in the depth.

                        for K in Dp.Visuals'Range loop  
                            declare  
                                Vp : X_Visual renames Dp.Visuals (K);  
                            begin

----If this is the Visual we're looking for then return it.

                                if Vp.Visual_Id = Id then  
                                    Visual := Vp;  
                                    Status := Successful;  
                                    return;  
                                end if;  
                            end;  
                        end loop;  
                    end;  
                end loop;  
            end loop;

----Visual not found.

            Status := Failed;

        end;  
    end Internal_X_Vid_To_Visual;

--\x0c
    procedure Report_Io_Error (Display  : X_Display;  
                               Facility : X_String) is
------------------------------------------------------------------------------
-- Called when we have had an I/O error.  We convert Display.Fd_Error to a string
-- and stuff it into Display.Error and then we call the X_Lib.IO_Error
-- routine.
------------------------------------------------------------------------------
        Proc : X_Procedure_Variable;  
    begin

        X_Lib.Get_Io_Error (Display, Proc);  
        Err (Display.Last_Error,  
             X_Get_Error_String ("XlibError", "TError",  
                                 "Transport package error:") &  
             " (" & Facility & " ) " &  
             To_X_String (Image (Display.Network.Fd_Error)));  
        Proc_Var_X_Io_Error_Function.Call  
           (Proc_Var_X_Io_Error_Function.To_Pv (Proc), Display);  
        raise X_Network_Io_Error;

    end Report_Io_Error;

--\x0c
    procedure Sync_Handle (Display : X_Display) is
------------------------------------------------------------------------------
-- Call the Synchandler routine associated with a display.
--#define Sync_Handle() \
--    if (Display->synchandler) (*Display->synchandler)(Display)
------------------------------------------------------------------------------
    begin

        if Display.Synchandler /= None_X_Procedure_Variable then  
            Proc_Var_X_Synchandler.Call  
               (Proc_Var_X_Synchandler.To_Pv (Display.Synchandler), Display);  
        end if;

    end Sync_Handle;

--\x0c
    function Number_To_String (Num : S_Long) return X_String is  
        Buf : String (1 .. 13);  
    begin  
        S_Long_Io.Put (Buf, Num, Base => 16);  
        return To_X_String (Buf);  
    end Number_To_String;

--\x0c
    function Internal_X_Set_Last_Request_Read  
                (Display  : X_Display;  
                 Kind     : X_Event_Code;  
                 Sequence : U_Short) return S_Long is
------------------------------------------------------------------------------
-- The hard part about this is that we only get 16 bits from a reply.  Well,
-- then, we have three values that will march along, with the following
-- invariant:
--    Display.last_request_read <= rep.sequence_Number <= Display.Request
-- The right choice for rep.sequence_Number is the largest that
-- still meets these constraints.
------------------------------------------------------------------------------
        New_Seq  : S_Long;  
        Last_Seq : S_Long;  
    begin

----KeymapNotify has no sequence number, but is always guaranteed
--  to immediately follow anothr event; except when generated via
--  SendEvent (hmmmm).

        if Kind = Keymap_Notify then  
            return Display.Last_Request_Read;  
        end if;

        New_Seq  := (Display.Last_Request_Read and not 16#FFFF#) or  
                       S_Long (Sequence);  
        Last_Seq := Display.Last_Request_Read;  
        while New_Seq < Last_Seq loop  
            New_Seq := New_Seq + 16#10000#;  
            if New_Seq > Display.Request then  
                New_Seq := New_Seq - 16#10000#;  
                X_Report_Error  
                   ("XlibError", "SequenceLost",  
                    "Xlib; Sequence lost (new) %1 < %2 (old) in reply type %2.",  
                    Number_To_String (New_Seq),  
                    Number_To_String (Display.Request),  
                    To_X_String (X_Event_Code'Image (Kind)));  
                exit;  
            end if;  
        end loop;

        Display.Last_Request_Read := New_Seq;  
        return New_Seq;

    end Internal_X_Set_Last_Request_Read;

--\x0c
    procedure Internal_X_Enq (Display : X_Display;  
                              Event   : X_Event) is
------------------------------------------------------------------------------
-- Take a newly received event and place it into the queue of the display that
-- generated it.
------------------------------------------------------------------------------
        Qelt : X_Queued_Event;  
    begin

----Try to reuse an old queue element.

----Get a new event record.

        Qelt := Display.Q_Free;  
        if Qelt = None_X_Queued_Event then  
            begin  
                Qelt := new X_Queued_Event_Rec;  
            exception  
                when others =>  
                    declare  
                        Proc : X_Procedure_Variable;  
                    begin  
                        X_Lib.Get_Io_Error (Display, Proc);  
                        Display.Network.Fd_Error := No_Free_Memory;  
                        Err (Display.Last_Error,  
                             X_Get_Error_String ("XlibError", "NoMemory",  
                                                 "No free memory available."));  
                        Proc_Var_X_Io_Error_Function.Call  
                           (Proc_Var_X_Io_Error_Function.To_Pv (Proc), Display);  
                        raise X_Network_Io_Error;
                    end;  
            end;  
        else  
            Display.Q_Free := Qelt.Next;  
            Qelt.Next      := None_X_Queued_Event;  
        end if;  
        Qelt.Event := Event;

----Queue the old/new event at the tail of the existing queue, if any.

        Qelt.Next := None_X_Queued_Event;  
        if Display.Tail /= null then  
            Display.Tail.Next := Qelt;  
        else  
            Display.Head := Qelt;  
        end if;  
        Display.Tail  := Qelt;  
        Display.Q_Len := Display.Q_Len + 1;

    end Internal_X_Enq;

--\x0c
end Xlbip_Internal;  

E3 Meta Data

    nblk1=1a
    nid=0
    hdr6=34
        [0x00] rec0=2f rec1=00 rec2=01 rec3=036
        [0x01] rec0=1c rec1=00 rec2=02 rec3=060
        [0x02] rec0=14 rec1=00 rec2=03 rec3=06a
        [0x03] rec0=25 rec1=00 rec2=04 rec3=04a
        [0x04] rec0=1d rec1=00 rec2=05 rec3=024
        [0x05] rec0=17 rec1=00 rec2=06 rec3=022
        [0x06] rec0=01 rec1=00 rec2=1a rec3=01a
        [0x07] rec0=17 rec1=00 rec2=07 rec3=04e
        [0x08] rec0=16 rec1=00 rec2=08 rec3=044
        [0x09] rec0=15 rec1=00 rec2=09 rec3=038
        [0x0a] rec0=15 rec1=00 rec2=0a rec3=086
        [0x0b] rec0=1a rec1=00 rec2=0b rec3=044
        [0x0c] rec0=14 rec1=00 rec2=0c rec3=014
        [0x0d] rec0=1b rec1=00 rec2=0d rec3=034
        [0x0e] rec0=1b rec1=00 rec2=0e rec3=06a
        [0x0f] rec0=17 rec1=00 rec2=0f rec3=01a
        [0x10] rec0=1e rec1=00 rec2=10 rec3=00a
        [0x11] rec0=1c rec1=00 rec2=11 rec3=02c
        [0x12] rec0=1b rec1=00 rec2=12 rec3=004
        [0x13] rec0=17 rec1=00 rec2=13 rec3=03e
        [0x14] rec0=00 rec1=00 rec2=19 rec3=002
        [0x15] rec0=19 rec1=00 rec2=14 rec3=00a
        [0x16] rec0=00 rec1=00 rec2=18 rec3=004
        [0x17] rec0=1c rec1=00 rec2=15 rec3=056
        [0x18] rec0=18 rec1=00 rec2=16 rec3=04a
        [0x19] rec0=06 rec1=00 rec2=17 rec3=000
    tail 0x2170066e8819780baffce 0x42a00088462063203