|
|
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 Values, seg_045c14
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
package body Values is
-- creation
procedure New_Value (V : out Value) is
begin
V := (Kind => Undef);
end New_Value;
-- access
function Kind_Of (V : in Value) return Kind_Of_Values is
begin
return V.Kind;
end Kind_Of;
function Value_As (V : in Value) return Natural is
begin
if V.Kind = Int then
return V.The_Natural;
else
raise No_Natural_Value;
end if;
end Value_As;
function Value_As (V : in Value) return Boolean is
begin
if V.Kind = Bool then
return V.The_Boolean;
else
raise No_Boolean_Value;
end if;
end Value_As;
function Value_As (V : in Value) return String is
begin
if V.Kind = Chaine then
return Bounded_String.Image (V.The_String);
else
if V.Kind = Enum then
return Bounded_String.Image (V.Enum_String);
else
raise No_String_Value;
end if;
end if;
end Value_As;
function Value_As (V : in Value)
return Struct_Component.Liste_Structure.Listiter is
begin
return V.The_Refs;
end Value_As;
function Value_As (V : in Value)
return Struct_Component.Liste_Attribut.Listiter is
begin
return V.The_Refa;
end Value_As;
function Equal (V1 : in Value; V2 : in Value) return Boolean is
begin
if V1.Kind = V2.Kind then
case V1.Kind is
when Undef =>
return True;
when Int =>
return (V1.The_Natural = V2.The_Natural);
when Bool =>
return (V1.The_Boolean = V2.The_Boolean);
when Chaine =>
return Bounded_String.Image (V1.The_String) =
Bounded_String.Image (V2.The_String);
when Enum =>
return Bounded_String.Image (V1.Enum_String) =
Bounded_String.Image (V2.Enum_String);
when Ref2struct =>
return Bounded_String.Image
(Struct_Component.Liste_Structure.Cellvalue
(V1.The_Refs).Name) =
Bounded_String.Image
(Struct_Component.Liste_Structure.Cellvalue
(V2.The_Refs).Name) and
(Struct_Component.Liste_Attribut.Equal
(Struct_Component.Liste_Structure.Cellvalue
(V1.The_Refs).Attribut,
Struct_Component.Liste_Structure.Cellvalue
(V2.The_Refs).Attribut));
when Ref2att =>
return Bounded_String.Image
(Struct_Component.Liste_Attribut.Cellvalue
(V1.The_Refa).Name) =
Bounded_String.Image
(Struct_Component.Liste_Attribut.Cellvalue
(V2.The_Refa).Name);
end case;
else
return False;
end if;
end Equal;
function Image (V : in Value) return String is
begin
case V.Kind is
when Undef =>
return "Undefine value !!";
when Int =>
return Integer'Image (V.The_Natural);
when Bool =>
return Boolean'Image (V.The_Boolean);
when Chaine =>
return Bounded_String.Image (V.The_String);
when Enum =>
return Bounded_String.Image (V.Enum_String);
when Ref2struct =>
return Bounded_String.Image
(Struct_Component.Liste_Structure.Cellvalue
(V.The_Refs).Name);
when Ref2att =>
return Bounded_String.Image
(Struct_Component.Liste_Attribut.Cellvalue
(V.The_Refa).Name);
end case;
end Image;
procedure Image (L : in My_List) is
Tmp_String : My_String;
Iterator : String_Table.Int_List.Listiter;
begin
if not String_Table.Int_List.Isempty (L) then
Iterator := String_Table.Int_List.Makelistiter (L);
while String_Table.Int_List.More (Iterator) loop
String_Table.Int_List.Next (Iterator, Tmp_String);
Text_Io.Put (Bounded_String.Image (Tmp_String));
Text_Io.Put (" ");
end loop;
Text_Io.New_Line;
else
Text_Io.Put_Line ("Liste Vide");
end if;
end Image;
procedure Image (B : in Box) is
begin
Text_Io.Put_Line ("------------------------------------");
Text_Io.Put_Line ("Type :" & Kind_Of_Values'Image (B.The_Type));
Text_Io.Put_Line ("Id :" & Bounded_String.Image (B.Id));
Text_Io.Put ("Val :");
Text_Io.Put_Line (Image (B.Val));
Text_Io.Put ("Acc :");
Image (B.Acc);
end Image;
-- modification
procedure Undefine (V : in out Value) is
begin
Dispose (V);
New_Value (V);
end Undefine;
procedure Set_To (V : in out Value; I : in Natural) is
begin
Undefine (V);
V := (Kind => Int, The_Natural => I);
end Set_To;
procedure Set_To (V : in out Value; B : in Boolean) is
begin
Undefine (V);
V := (Kind => Bool, The_Boolean => B);
end Set_To;
procedure Set_To (V : in out Value; S : in String) is
begin
if V.Kind = Chaine then
V := (Kind => Chaine, The_String => Bounded_String.Value (S, 128));
else
V := (Kind => Enum, Enum_String => Bounded_String.Value (S, 128));
end if;
end Set_To;
procedure Set_To (V : in out Value;
I : in Struct_Component.Liste_Structure.Listiter) is
begin
Undefine (V);
V := (Kind => Ref2struct, The_Refs => I);
end Set_To;
procedure Set_To (V : in out Value;
I : in Struct_Component.Liste_Attribut.Listiter) is
begin
Undefine (V);
V := (Kind => Ref2att, The_Refa => I);
end Set_To;
procedure Set_Id (B : in out Box; S : in String) is
begin
Bounded_String.Copy (B.Id, S);
end Set_Id;
procedure Set_Type (B : in out Box; E : in Kind_Of_Values) is
begin
B.The_Type := E;
end Set_Type;
procedure Set_Acc (B : in out Box; L : in My_List) is
begin
B.Acc := L;
end Set_Acc;
procedure Set_Val (B : in out Box; S : in String) is
begin
Set_To (B.Val, S);
end Set_Val;
procedure Set_Val (B : in out Box; Bo : in Boolean) is
begin
Set_To (B.Val, Bo);
end Set_Val;
procedure Set_Val (B : in out Box; I : in Natural) is
begin
Set_To (B.Val, I);
end Set_Val;
procedure Set_Val (B : in out Box;
Its : in Struct_Component.Liste_Structure.Listiter) is
begin
Set_To (B.Val, Its);
end Set_Val;
procedure Set_Val (B : in out Box;
It : in Struct_Component.Liste_Attribut.Listiter) is
begin
Set_To (B.Val, It);
end Set_Val;
-- procedure Copy (To_Value : in out Value; The_Value : in Value) is
-- begin
-- Undefine (To_Value);
-- if The_Value.Kind = Chaine then
-- To_Value.Kind := Chaine;
-- Set_To (To_Value, Bounded_String.Image (The_Value.The_String));
-- -- To_Value := (Kind => Chaine);
-- else
-- To_Value := (Kind => Chaine);
-- Set_To (To_Value, Bounded_String.Image (The_Value.Enum_String));
-- -- To_Value := (Kind => Enum);
-- end if;
-- else
-- Undefine (To_Value);
-- To_Value := The_Value;
-- end if;
-- end Copy;
-- liberation
procedure Dispose (V : in out Value) is
begin
if V.Kind = Chaine or V.Kind = Enum then
Bounded_String.Free (V.The_String);
end if;
V := (Kind => Undef);
end Dispose;
end Values;
nblk1=b
nid=4
hdr6=14
[0x00] rec0=2f rec1=00 rec2=01 rec3=040
[0x01] rec0=21 rec1=00 rec2=09 rec3=074
[0x02] rec0=12 rec1=00 rec2=03 rec3=014
[0x03] rec0=1b rec1=00 rec2=02 rec3=010
[0x04] rec0=18 rec1=00 rec2=05 rec3=012
[0x05] rec0=29 rec1=00 rec2=06 rec3=022
[0x06] rec0=02 rec1=00 rec2=07 rec3=016
[0x07] rec0=21 rec1=00 rec2=0b rec3=06e
[0x08] rec0=25 rec1=00 rec2=0a rec3=00e
[0x09] rec0=1d rec1=00 rec2=08 rec3=000
[0x0a] rec0=09 rec1=00 rec2=09 rec3=000
tail 0x21747cdfc864c543887af 0x42a00088462060003
Free Block Chain:
0x4: 0000 00 00 03 fc 80 07 2d 4a 61 6e 2d 39 35 07 00 1d ┆ -Jan-95 ┆