|
|
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: 6144 (0x1800)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body T_Value, seg_047ca3
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with Unchecked_Deallocation, Text_Io;
package body T_Value is
procedure Free is new Unchecked_Deallocation (String, String_Access);
--Creation
procedure New_Value (V : out T_Value.Object) is
begin
V := (Kind => Undefined_Value);
end New_Value;
--Liberation
procedure Dispose (V : in out Object) is
begin
if V.Kind = String_Value then
Free (V.The_String);
end if;
V := (Kind => Undefined_Value);
end Dispose;
--Access
function Kind_Of_Value (V : in Object) return Kind_Of_Values is
begin
return (V.Kind);
end Kind_Of_Value;
function Get (V : in T_Value.Object) return Integer is
begin
if (V.Kind = Integer_Value) then
return (V.The_Integer);
else
raise Error_Integer_Value;
end if;
end Get;
function Get (V : in T_Value.Object) return Boolean is
begin
if (V.Kind = Boolean_Value) then
return (V.The_Boolean);
else
raise Error_Boolean_Value;
end if;
end Get;
function Get (V : in T_Value.Object) return String is
begin
if (V.Kind = String_Value) then
return (V.The_String.all);
else
raise Error_String_Value;
end if;
end Get;
function Equal (V1 : in Object; V2 : in Object) return Boolean is
begin
if (V1.Kind = V2.Kind) then
case V1.Kind is
when Integer_Value =>
return (V1.The_Integer = V2.The_Integer);
when Boolean_Value =>
return (V1.The_Boolean = V2.The_Boolean);
when String_Value =>
return (V1.The_String.all = V2.The_String.all);
when Undefined_Value =>
return True;
end case;
else
return False;
end if;
exception
when Constraint_Error =>
raise Error_Equal_Value;
end Equal;
function Image (V : in T_Value.Object) return String is
begin
case V.Kind is
when Integer_Value =>
return (Integer'Image (V.The_Integer));
when Boolean_Value =>
return (Boolean'Image (V.The_Boolean));
when String_Value =>
return (V.The_String.all);
when Undefined_Value =>
return ("Undefined Value");
end case;
end Image;
procedure Value_To_File (V : in T_Value.Object; F : V_File) is
begin
-- Text_IO.Put(F,T_Value_Image(V));
Text_Io.Put_Line ("Function not yet implemented");
end Value_To_File;
-- Modification
procedure Undefine (V : in out Object) is
begin
Dispose (V);
New_Value (V);
end Undefine;
procedure Set (V : in out Object; I : in Integer) is
begin
Undefine (V);
V := (Kind => Integer_Value, The_Integer => I);
exception
when Constraint_Error =>
raise Error_Integer_Value;
end Set;
procedure Set (V : in out Object; S : in String) is
Ptr : String_Access;
begin
Undefine (V);
if not (S'Length > Max_Value_String) then
Ptr := new String (1 .. S'Length);
V := (Kind => String_Value, The_String => Ptr);
V.The_String.all := S;
else
raise Error_String_Value;
end if;
exception
when Constraint_Error =>
raise Error_String_Value;
end Set;
procedure Set (V : in out Object; B : in Boolean) is
begin
Undefine (V);
V := (Kind => Boolean_Value, The_Boolean => B);
exception
when Constraint_Error =>
raise Error_Boolean_Value;
end Set;
procedure Copy (To_Value : in out T_Value.Object;
The_Value : in T_Value.Object) is
begin
if (The_Value.Kind = String_Value) then
Set (To_Value, The_Value.The_String.all);
else
Undefine (To_Value);
To_Value := The_Value;
end if;
end Copy;
procedure Set_Value_Using_File (V : in out Object; F : V_File) is
begin
-- Text_IO.Get(F,Value_Image(V));
Text_Io.Put_Line ("Function not yet implemented");
end Set_Value_Using_File;
end T_Value;
nblk1=5
nid=0
hdr6=a
[0x00] rec0=2c rec1=00 rec2=01 rec3=010
[0x01] rec0=1e rec1=00 rec2=02 rec3=02a
[0x02] rec0=22 rec1=00 rec2=03 rec3=03e
[0x03] rec0=26 rec1=00 rec2=04 rec3=006
[0x04] rec0=12 rec1=00 rec2=05 rec3=001
tail 0x2174b770086574a2dc6d0 0x42a00088462060003