|
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 - metrics - download
Length: 12288 (0x3000) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Common_Env, seg_0052c0
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦this⟧
with Directory_Tools; with Io; with Library; with System_Utilities; package body Common_Env is ------------------------------------------------------------------------------ -- X Library Environment Variables - Common functions -- -- Common_Env - Common functions used by all environment variable functions. ------------------------------------------------------------------------------ -- Copyright 1990 - 1991 by Rational, Santa Clara, California. -- -- 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 Rational not be used in -- advertising or publicity pertaining to distribution of the software without -- specific, written prior permission. -- -- Rational disclaims all warranties with regard to this software, including -- all implied warranties of merchantability and fitness, in no event shall -- 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. ------------------------------------------------------------------------------ Home : constant String := System_Utilities.Home_Library; Session : constant String := System_Utilities.Session_Name; Environment : constant String := Home & "." & Session & "_Environment"; -- \x0c function Env_Directory return String is ------------------------------------------------------------------------------ -- Called to obtain the name of the directory that contains R1000 "environment" -- variables. One variable per file. Name of the file is the name of the -- variable. Case-insensitive. ------------------------------------------------------------------------------ begin return Environment; end Env_Directory; -- \x0c function Env_File (Var : String) return String is ------------------------------------------------------------------------------ -- Var - Specifies the name of the environment variable. -- -- Called to obtain the name of the file that contains a particular R1000 -- "environment" variable. Name of the file is the name of the variable. -- Case-insensitive. ------------------------------------------------------------------------------ begin return Environment & "." & Var; end Env_File; -- \x0c function Is_Set (Var : String) return Boolean is ------------------------------------------------------------------------------ -- Var - Specifies the name of the R1000 "environment" variable to fetch -- -- Called to see if an R1000 "environment" variable has been set. ------------------------------------------------------------------------------ Env : Io.File_Type; Env_Name : constant String := Env_Directory & "." & Var; begin ----If the file exists then the variable is set. Io.Open (Env, Io.In_File, Env_Name); Io.Close (Env); return True; exception when others => return False; end Is_Set; -- \x0c procedure Unset_Env (Var : String) is ------------------------------------------------------------------------------ -- Var - Specifies the name of the R1000 "environment" variable to unset -- -- Called to unset (delete) the definition of an R1000 "environment" variable. ------------------------------------------------------------------------------ Env : Io.File_Type; Env_Name : constant String := Env_Directory & "." & Var; begin ----Open the Environment Variable file then delete it. begin Io.Open (Env, Io.In_File, Env_Name); exception when others => return; end; Io.Delete (Env); end Unset_Env; -- \x0c procedure Set_Env (Var : String; Value : String) is ------------------------------------------------------------------------------ -- Var - Specifies the name of the R1000 "environment" variable to set -- Value - Specifies the value for the variable -- -- Called to set the definition of an R1000 "environment" variable. ------------------------------------------------------------------------------ Obj : Directory_Tools.Object.Handle; Env : Io.File_Type; Env_Name : constant String := Env_Directory & "." & Var; begin ----See if the Env_Directory exists or not. Obj := Directory_Tools.Naming.Resolution (Env_Directory); if Directory_Tools.Object.Is_Bad (Obj) then Library.Create_Directory (Name => Env_Directory, Kind => Library.Directory, Vol => Library.Nil, Model => "", Response => "<ERROR> RAISE_ERROR"); end if; ----Open the Environment Variable file. Write the first line. Close the file. -- The line is the value. begin Io.Create (Env, Io.Out_File, Env_Name); exception when others => Io.Open (Env, Io.Out_File, Env_Name); end; Io.Put_Line (Env, Value); Io.Close (Env); end Set_Env; -- \x0c function Get_Env (Var : String) return String is ------------------------------------------------------------------------------ -- Var - Specifies the name of the R1000 "environment" variable to fetch -- -- Called to obtain the definition of an R1000 "environment" variable. -- Returns "" if the variable is not defined. ------------------------------------------------------------------------------ Env : Io.File_Type; Env_Name : constant String := Env_Directory & "." & Var; function Read_Env return String is ----Read one line from Env; regardless of the length of the -- line. Line : String (1 .. 1024); Length : Natural; begin Io.Get_Line (Env, Line, Length); if Length = Line'Length and then Io.">" (Io.Col (Env), 1) then return Line & Read_Env; else return Line (1 .. Length); end if; end Read_Env; begin ----Open the Environment Variable file. Read the first line. Close the file. -- Return that line as the value. Io.Open (Env, Io.In_File, Env_Name); declare Env_Ptr : constant String := Read_Env; begin Io.Close (Env); return Env_Ptr; end; exception when others => begin -- Just in case. Io.Close (Env); exception when others => null; end; return ""; end Get_Env; -- \x0c end Common_Env;
nblk1=b nid=0 hdr6=16 [0x00] rec0=17 rec1=00 rec2=01 rec3=034 [0x01] rec0=12 rec1=00 rec2=02 rec3=008 [0x02] rec0=00 rec1=00 rec2=0b rec3=016 [0x03] rec0=1b rec1=00 rec2=03 rec3=08e [0x04] rec0=1f rec1=00 rec2=04 rec3=07a [0x05] rec0=02 rec1=00 rec2=0a rec3=002 [0x06] rec0=20 rec1=00 rec2=05 rec3=03a [0x07] rec0=00 rec1=00 rec2=09 rec3=014 [0x08] rec0=1a rec1=00 rec2=06 rec3=01e [0x09] rec0=1a rec1=00 rec2=07 rec3=094 [0x0a] rec0=19 rec1=00 rec2=08 rec3=001 tail 0x21700852a819786b82632 0x42a00088462063203