DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ B T ┃
Length: 5080 (0x13d8) Types: TextFile Names: »B«
└─⟦d10a02448⟧ Bits:30000409 8mm tape, Rational 1000, ENVIRONMENT, D_12_7_3 └─ ⟦fc9b38f02⟧ »DATA« └─⟦9b46a407a⟧ └─⟦12c68c704⟧ └─⟦this⟧ └─⟦5f3412b64⟧ Bits:30000745 8mm tape, Rational 1000, ENVIRONMENT 12_6_5 TOOLS └─ ⟦91c658230⟧ »DATA« └─⟦458657fb6⟧ └─⟦220843204⟧ └─⟦this⟧
with Io; with Io_Exceptions; with String_Utilities; with System_Utilities; with Queue; with Remote; procedure Cancel_Print_Request (Printer : String := "<Default>"; Request_Id : Positive) 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 the passed value return Printer; end; exception when Io_Exceptions.Name_Error => -- map file does not exist! return Printer; end Get_Queue_Class; function Is_Remote_Name (Name : String) return Boolean is begin return Name'Length >= 2 and then Name (Name'First .. Name'First + 1) = "!!"; end Is_Remote_Name; begin declare Printer_Class : constant String := Get_Queue_Class; begin if Is_Remote_Name (Printer_Class) then declare Machine_Start : Natural := Strings.Locate ("!!", Printer_Class, True) + 2; Machine_End : Natural := Strings.Locate (".", Printer_Class, True) - 1; Machine_Name : constant String := Printer_Class (Machine_Start .. Machine_End); begin Remote.Run (Machine => Machine_Name, Command => "Queue.Cancel(Request_Id =>" & Positive'Image (Request_Id) & ");", File_Context => "!Machine", Run_Context => "!Machine", Options => "", Response => "<PROGRESS>"); end; else Queue.Cancel (Request_Id => Request_Id); end if; end; end Cancel_Print_Request;