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

⟦bc0ade175⟧ Ada Source

    Length: 31744 (0x7c00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Xlbp_Font_Names, seg_004f61

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 Xlbt_Arithmetic;  
use Xlbt_Arithmetic;  
with Xlbt_Basic;  
use Xlbt_Basic;  
with Xlbt_Font;  
use Xlbt_Font;  
with Xlbt_Font2;  
use Xlbt_Font2;  
with Xlbt_Misc;  
use Xlbt_Misc;  
with Xlbt_Reply;  
use Xlbt_Reply;  
with Xlbt_Request;  
use Xlbt_Request;  
with Xlbt_String;  
use Xlbt_String;

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

with Xlbmt_Network_Types;  
use Xlbmt_Network_Types;

package body Xlbp_Font_Names is
------------------------------------------------------------------------------
-- X Library Font Names
--
-- Xlbp_Font_Names - What fonts are there and where do they live?
------------------------------------------------------------------------------
-- 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
    function X_Get_Font_Path (Display : X_Display)  
                             return X_String_Pointer_List is  
        Rep    : X_Reply_Contents;  
        Length : S_Natural;  
        Succ   : X_Status;  
    begin

----Lock the display.

        Lock_Display (Display);  
        begin

----Send the request.

            Put_X_Get_Font_Path_Request  
               (Display, (Kind   => Get_Font_Path,  
                          Length => X_Get_Font_Path_Request'Size / 32,  
                          Pad    => 0));

----Get the reply.

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

----Watch for failure.

            if Succ = Failed then  
                Unlock_Display (Display);  
                Sync_Handle (Display);  
                return None_X_String_Pointer_List;  
            end if;

----Return the results.

            if Rep.Get_Font_Path.N_Paths /= 0 then  
                declare  
                    Amount : S_Natural;  
                    Flist : X_String_Pointer_List;  
                    Ch : X_String (1 ..  
                                      S_Natural (Rep.Get_Font_Path.Length) * 4);  
                begin  
                    Get_X_String (Display, Ch);  
                    Flist  := new X_String_Pointer_Array  
                                     (1 .. S_Natural  
                                              (Rep.Get_Font_Path.N_Paths));  
                    Length := 1;  
                    for I in Flist'Range loop  
                        for J in Length .. Ch'Last loop  
                            if Ch (J) = Nul then  
                                Amount := J - Length;
                                ----Ada may not be able to take the full
                                --  amount.  Chop the string if necessary.
--/ if not Positive_Is_Large then
--//                                 if Amount > S_Natural (Positive'Last) then
--//                                     Amount := S_Natural (Positive'Last);
--//                                 end if;
--/ end if;
                                Flist (I)     := new X_String (1 .. Amount);  
                                Flist (I).all :=  
                                   Ch (Length .. Length + Amount - 1);  
                                Length        := J + 1;  
                            end if;  
                        end loop;  
                    end loop;  
                    Unlock_Display (Display);  
                    Sync_Handle (Display);  
                    return Flist;  
                exception  
                    when others =>  
                        Free_X_String_Pointer_List (Flist);  
                        raise;  
                end;  
            else  
                Unlock_Display (Display);  
                Sync_Handle (Display);  
                return None_X_String_Pointer_List;  
            end if;

----Catch exceptions.

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

    end X_Get_Font_Path;

--\x0c
    procedure X_Set_Font_Path (Display     : X_Display;  
                               Directories : X_String_Pointer_Array) is  
        N : S_Natural := 0;  
    begin

----Lock the display.

        Lock_Display (Display);  
        begin

----Send the request.

            for I in Directories'Range loop  
                N := N + Directories (I)'Length + 1;  
            end loop;  
            Put_X_Set_Font_Path_Request  
               (Display,  
                (Kind    => Set_Font_Path,  
                 Length  =>  
                    X_Set_Font_Path_Request'Size / 32 + U_Short ((N + 3) / 4),  
                 Pad     => 0,  
                 Pad1    => 0,  
                 Pad2    => 0,  
                 N_Fonts => Directories'Length),  
                N);

----Send the directory strings.

            declare  
                P  : X_String (1 .. N);  
                Pi : S_Natural := P'First;  
            begin
                --
                -- pack into counted strings.
                --
                for I in Directories'Range loop  
                    declare  
                        Sp : X_String_Pointer := Directories (I);  
                    begin  
                        for J in Sp'Range loop  
                            P (Pi) := Sp (J);  
                            Pi     := Pi + 1;  
                        end loop;  
                    end;  
                    P (Pi) := Nul;  
                    Pi     := Pi + 1;  
                end loop;  
                Put_X_String (Display, P);  
            end;

----Catch exceptions.

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

----Unlock; sync; return.

        Unlock_Display (Display);  
        Sync_Handle (Display);

    end X_Set_Font_Path;

--\x0c
    procedure X_Free_Font_Info (Info : in out X_Fonts_With_Info) is  
    begin

        for I in Info.Info'Range loop  
            declare  
                Fs : X_Font_Struct := Info.Info (I);  
            begin  
                Free_X_Char_Struct_List_2d (Fs.Per_Char);  
                Free_X_Font_Prop_List (Fs.Properties);  
                Free_X_Font_Struct (Fs);  
                Info.Info (I) := None_X_Font_Struct;  
            end;  
            Free_X_String_Pointer (Info.Name (I));  
        end loop;

    end X_Free_Font_Info;

--\x0c
    function X_List_Fonts_With_Info  
                (Display       : X_Display;  
                 Pattern       : X_String; -- null-terminated
                 Maximum_Names : U_Short) return X_Fonts_With_Info is  
        N_Bytes : U_Short;  
        Fs      : S_Natural := 0;  
        Fsi     : X_Font_Struct;  
        Info    : X_Fonts_With_Info;  
        Reply   : X_Reply_Contents;  
        Succ    : X_Status;

        procedure Free_It_All is  
        begin  
            for J in 1 .. Fs loop  
                Free_X_String_Pointer (Info.Name (Fs));  
                Fsi := Info.Info (Fs);  
                if Fsi.Properties /= null then  
                    Free_X_Font_Prop_List (Fsi.Properties);  
                end if;  
            end loop;  
        end Free_It_All;

    begin

----Lock the display;

        Lock_Display (Display);  
        begin  
            Info.Info := new X_Font_Struct_Array  
                                (1 .. S_Natural (Maximum_Names));  
            Info.Name := new X_String_Pointer_Array  
                                (1 .. S_Natural (Maximum_Names));

----Send the request.

            N_Bytes := Pattern'Length;  
            Put_X_List_Fonts_With_Info_Request  
               (Display,  
                (Kind      => List_Fonts_With_Info,  
                 Length    => X_List_Fonts_With_Info_Request'Size / 32 +  
                                 (N_Bytes + 3) / 4,  
                 Pad       => 0,  
                 Max_Names => Maximum_Names,  
                 N_Bytes   => N_Bytes), S_Natural (N_Bytes));

----Send the pattern.

            Put_X_String (Display, Pattern);

----Read replies until we get one with 0 length.

            for I in U_Short'First .. U_Short'Last loop  
                Get_Reply (Display => Display,  
                           Code    => List_Fonts_With_Info,  
                           Reply   => Reply,  
                           Extra   => 0,  
                           Discard => False,  
                           Status  => Succ);

----Any failure means abort the whole thing.

                if Succ = Failed then  
                    Free_It_All;  
                    Unlock_Display (Display);  
                    Sync_Handle (Display);  
                    return (Info => None_X_Font_Struct_List,  
                            Name => None_X_String_Pointer_List);  
                end if;

----Zero length reply; end-of-list.

                if Reply.List_Fonts_With_Info.Name_Length = 0 then  
                    exit;  
                end if;

----Convert this reply into a font struct.  (no per_char info)

                Fs := S_Natural (I);  
                begin  
                    Fsi :=  
                       new X_Font_Struct_Rec'  
                              ((Ext_Data          => null,  
                                Font_Id           => None_X_Font,  
                                Direction         =>  
                                   Reply.List_Fonts_With_Info.Draw_Direction,  
                                Default_Char      =>  
                                   (Char1 => U_Char (Reply.List_Fonts_With_Info.  
                                                     Default_Char / 256),  
                                    Char2 => U_Char (Reply.List_Fonts_With_Info.  
                                                     Default_Char rem 256)),  
                                Min_Char_Or_Byte2 =>  
                                   Reply.List_Fonts_With_Info.Min_Char_Or_Byte2,  
                                Max_Char_Or_Byte2 =>  
                                   Reply.List_Fonts_With_Info.Max_Char_Or_Byte2,  
                                Min_Byte1         =>  
                                   Reply.List_Fonts_With_Info.Min_Byte1,  
                                Max_Byte1         =>  
                                   Reply.List_Fonts_With_Info.Max_Byte1,  
                                All_Chars_Exist   =>  
                                   To_Boolean (Reply.List_Fonts_With_Info.  
                                               All_Chars_Exist),  
                                Ascent            =>  
                                   Reply.List_Fonts_With_Info.Font_Ascent,  
                                Descent           =>  
                                   Reply.List_Fonts_With_Info.Font_Descent,  
                                Min_Bounds        =>  
                                   Reply.List_Fonts_With_Info.Min_Bounds,  
                                Max_Bounds        =>  
                                   Reply.List_Fonts_With_Info.Max_Bounds,  
                                Per_Char          => null,  
                                Properties        => null));  
                exception  
                    when others =>  
                        Eat_Raw_Data  
                           (Display,  
                            S_Natural  
                               (Reply.List_Fonts_With_Info.N_Font_Props) *  
                            X_Font_Prop'Size / 8 +  
                            S_Natural (Reply.List_Fonts_With_Info.Name_Length));  
                        Free_It_All;  
                        raise;  
                end;  
                Info.Info (Fs) := Fsi;


----Read the properties.

                if Reply.List_Fonts_With_Info.N_Font_Props > 0 then  
                    begin  
                        Fsi.Properties :=  
                           new X_Font_Prop_Array  
                                  (1 .. S_Natural (Reply.List_Fonts_With_Info.  
                                                   N_Font_Props));  
                    exception  
                        when others =>  
                            Eat_Raw_Data (Display,  
                                          S_Natural (Reply.List_Fonts_With_Info.  
                                                     N_Font_Props) *  
                                          X_Font_Prop'Size / 8 +  
                                          S_Natural (Reply.List_Fonts_With_Info.  
                                                     Name_Length));  
                            Free_It_All;  
                            raise;  
                    end;  
                    Get_X_Font_Prop_Array (Display, Fsi.Properties.all);  
                end if;

----Read the name.

                declare  
                    Buff : X_String (1 .. S_Natural (Reply.List_Fonts_With_Info.  
                                                     Name_Length));  
                begin  
                    Get_X_String (Display, Buff);  
                    Info.Name (Fs) := new X_String'(Buff);  
                exception  
                    when others =>  
                        Free_It_All;  
                        raise;  
                end;  
            end loop;

----Return our lists.

            declare  
                Inf : X_Fonts_With_Info;  
            begin  
                Inf.Info := new X_Font_Struct_Array'(Info.Info (1 .. Fs));  
                Inf.Name := new X_String_Pointer_Array'(Info.Name (1 .. Fs));  
                Unlock_Display (Display);  
                Sync_Handle (Display);  
                return Inf;  
            exception  
                when others =>  
                    Inf.Info.all := (Inf.Info'Range => None_X_Font_Struct);  
                    Inf.Name.all := (Inf.Name'Range => None_X_String_Pointer);  
                    Free_X_Font_Struct_List (Inf.Info);  
                    Free_X_String_Pointer_List (Inf.Name);  
                    raise;  
            end;

----Catch exceptions.

        exception

            when Storage_Error =>

----Free up heap storage.

                Free_It_All;

----Read the rest of the replies.  We know that we are at a reply-boundary
--  because all of the code up above does it's best to get us there.

                for I in U_Short'First .. U_Short'Last loop  
                    Get_Reply (Display => Display,  
                               Code    => List_Fonts_With_Info,  
                               Reply   => Reply,  
                               Extra   => 0,  
                               Discard => False,  
                               Status  => Succ);

----Any failure means abort the whole thing.  Zero length reply; end-of-list.

                    if Succ = Failed or else  
                       Reply.List_Fonts_With_Info.Name_Length = 0 then  
                        exit;  
                    end if;

----Read the properties and the name.

                    Eat_Raw_Data  
                       (Display,  
                        S_Natural (Reply.List_Fonts_With_Info.N_Font_Props) *  
                           X_Font_Prop'Size / 8 +  
                        S_Natural (Reply.List_Fonts_With_Info.Name_Length));  
                end loop;  
                Unlock_Display (Display);  
                raise;

----Other types of exceptions are unexpected and may constitute bugs.  In any
--  case we don't know how to recover from them.

            when others =>  
                Free_It_All;  
                Unlock_Display (Display);  
                raise;

        end;

    end X_List_Fonts_With_Info;

--\x0c
    function X_List_Fonts  
                (Display       : X_Display;  
                 Pattern       : X_String;  
                 Maximum_Names : U_Short) return X_String_Pointer_List is  
        N_Bytes : U_Short;  
        Rep     : X_Reply_Contents;  
        Succ    : X_Status;  
    begin

----Lock the display.

        Lock_Display (Display);  
        begin

----Send the request.

            N_Bytes := Pattern'Length;  
            Put_X_List_Fonts_Request  
               (Display,  
                (Kind      => List_Fonts,  
                 Length    => X_List_Fonts_Request'Size / 32  
                                  + (N_Bytes + 3) / 4,  
                 Pad       => 0,  
                 Max_Names => Maximum_Names,  
                 N_Bytes   => N_Bytes), S_Natural (N_Bytes));  
            Put_X_String (Display, Pattern);

----Get the reply.

            Get_Reply (Display => Display,  
                       Code    => List_Fonts,  
                       Reply   => Rep,  
                       Extra   => 0,  
                       Discard => False,  
                       Status  => Succ);  
            if Succ = Failed then  
                Unlock_Display (Display);  
                Sync_Handle (Display);  
                return None_X_String_Pointer_List;  
            end if;

----Get the info we requested.

            if Rep.List_Fonts.N_Fonts /= 0 then  
                declare  
                    Amount : S_Natural;  
                    Flist : X_String_Pointer_List;  
                    Ch : X_String (1 .. S_Natural (Rep.List_Fonts.Length) * 4);  
                    Chs : S_Natural;  
                    Chf : S_Natural;  
                begin  
                    Get_X_String (Display, Ch);  
                    Flist := new X_String_Pointer_Array  
                                    (1 .. S_Natural (Rep.List_Fonts.N_Fonts));  
                    Chs   := 1;  
                    Chf   := 1;  
                    for I in Flist'Range loop  
                        while Chf <= Ch'Last and then Ch (Chf) /= Nul loop  
                            Chf := Chf + 1;  
                        end loop;  
                        Amount := Chf - Chs;
--/ if not Positive_Is_Large then
--//                         if Amount > S_Natural (Positive'Last) then
--//                             Amount := S_Natural (Positive'Last);
--//                         end if;
--/ end if;
                        Flist (I)     := new X_String (1 .. Amount);  
                        Flist (I).all := Ch (Chs .. Chf - 1);  
                        Chs           := Chf + 1;  
                        Chf           := Chs;  
                    end loop;  
                    Unlock_Display (Display);  
                    Sync_Handle (Display);  
                    return Flist;  
                exception  
                    when others =>  
                        Free_X_String_Pointer_List (Flist);  
                        raise;  
                end;  
            else  
                Unlock_Display (Display);  
                Sync_Handle (Display);  
                return None_X_String_Pointer_List;  
            end if;

----Catch exceptions.

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

    end X_List_Fonts;

--\x0c
end Xlbp_Font_Names;  

E3 Meta Data

    nblk1=1e
    nid=0
    hdr6=3c
        [0x00] rec0=26 rec1=00 rec2=01 rec3=028
        [0x01] rec0=10 rec1=00 rec2=02 rec3=026
        [0x02] rec0=22 rec1=00 rec2=03 rec3=03c
        [0x03] rec0=00 rec1=00 rec2=1e rec3=00a
        [0x04] rec0=17 rec1=00 rec2=04 rec3=040
        [0x05] rec0=00 rec1=00 rec2=1d rec3=006
        [0x06] rec0=13 rec1=00 rec2=05 rec3=048
        [0x07] rec0=01 rec1=00 rec2=1c rec3=016
        [0x08] rec0=25 rec1=00 rec2=06 rec3=016
        [0x09] rec0=1b rec1=00 rec2=07 rec3=026
        [0x0a] rec0=00 rec1=00 rec2=1b rec3=00a
        [0x0b] rec0=23 rec1=00 rec2=08 rec3=022
        [0x0c] rec0=01 rec1=00 rec2=1a rec3=000
        [0x0d] rec0=20 rec1=00 rec2=09 rec3=056
        [0x0e] rec0=01 rec1=00 rec2=19 rec3=00e
        [0x0f] rec0=19 rec1=00 rec2=0a rec3=03a
        [0x10] rec0=1c rec1=00 rec2=0b rec3=01c
        [0x11] rec0=0e rec1=00 rec2=0e rec3=024
        [0x12] rec0=0f rec1=00 rec2=0c rec3=032
        [0x13] rec0=18 rec1=00 rec2=0d rec3=028
        [0x14] rec0=14 rec1=00 rec2=0f rec3=036
        [0x15] rec0=1d rec1=00 rec2=10 rec3=000
        [0x16] rec0=1c rec1=00 rec2=11 rec3=018
        [0x17] rec0=1e rec1=00 rec2=12 rec3=022
        [0x18] rec0=01 rec1=00 rec2=18 rec3=000
        [0x19] rec0=1c rec1=00 rec2=13 rec3=038
        [0x1a] rec0=17 rec1=00 rec2=14 rec3=03a
        [0x1b] rec0=00 rec1=00 rec2=17 rec3=008
        [0x1c] rec0=18 rec1=00 rec2=15 rec3=02a
        [0x1d] rec0=0c rec1=00 rec2=16 rec3=000
    tail 0x217006c1a8197823daa1c 0x42a00088462063203