|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 5120 (0x1400) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, procedure Display_Queue, seg_0127f5
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦this⟧
with Io; with Io_Exceptions; with String_Utilities; with System_Utilities; with Queue; procedure Display_Queue (Printer : String := "<Default>") is package Strings renames String_Utilities; Map_Filename : constant String := "!Machine.Queues.User_To_Printer_Map"; function Eq (A, B : String; Ignore_Case : Boolean := True) return Boolean renames Strings.Equal; function Get_Queue_Class return String is F : Io.File_Type; Next : Integer; function Match (Pattern, Name : String) return Boolean is begin if Name'Length /= 0 and then Name (Name'First) = '*' then return Eq (Pattern, Name); elsif Eq (Pattern, "others") then return True; elsif Pattern = "@" then return True; else return Eq (Pattern, Name); end if; end Match; function Get_User_Printer (Printer : String) return String is -- given the global printer parameter which is either <default> or -- a printer name, return the string to search for in the user -- to printer map file. If <default> this is the user name, -- else it is the value of the parameter prefixed with an "*". begin if Eq (Printer, "<Default>") then return System_Utilities.User_Name; elsif Eq (Printer, "Others") then return Printer; else return "*" & Printer; end if; end Get_User_Printer; function Token (S : String) return String is Start, Stop : Natural; begin if Next = -1 then Next := S'First; -- tricky initialization end if; Start := Next; -- skip leading blanks while Start <= S'Last and then S (Start) = ' ' loop Start := Start + 1; end loop; Next := Start; while Next <= S'Last and then S (Next) /= ' ' loop Next := Next + 1; end loop; if Start <= S'Last then if Next > S'Last then Stop := S'Last; else -- S (Next) = ' ' Stop := Next - 1; end if; return S (Start .. Stop); else return ""; end if; end Token; begin -- Find printer information in the user printer map declare User : constant String := Get_User_Printer (Printer); begin Io.Open (F, Io.In_File, Map_Filename); while not Io.End_Of_File (F) loop Next := -1; declare Line : constant String := Io.Get_Line (F); User_Name : constant String := Token (Line); Class_Name : constant String := Token (Line); begin if User_Name'Length < 2 or else User_Name (User_Name'First .. User_Name'First + 1) /= "--" then if Match (User_Name, User) then Io.Close (F); return Class_Name; end if; end if; end; end loop; -- Didn't find a match! Io.Close (F); -- Therefore return passed value return Printer; end; exception when Io_Exceptions.Name_Error => -- map file does not exist! return Printer; end Get_Queue_Class; begin Queue.Display (Get_Queue_Class); end Display_Queue;
nblk1=4 nid=0 hdr6=8 [0x00] rec0=28 rec1=00 rec2=01 rec3=020 [0x01] rec0=18 rec1=00 rec2=02 rec3=05a [0x02] rec0=1d rec1=00 rec2=03 rec3=01e [0x03] rec0=1b rec1=00 rec2=04 rec3=001 tail 0x2170e4de482b0807d9574 0x42a00088462065003