|
|
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: 23552 (0x5c00)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Structured_Text_Generic, seg_0046e8
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with String_Utilities;
package body Structured_Text_Generic is
function Normalized (This_String : in String; Filler : in Character := ' ')
return String renames String_Utilities.Strip;
procedure Parse (This_Keyword : in String;
Is_Simple_Keyword : in out Boolean;
The_Simple_Keyword : in out Simple_Keywords) is
begin
Is_Simple_Keyword := False;
for Current_Keyword in Simple_Keywords loop
if String_Utilities.Upper_Case (This_Keyword) =
Simple_Keywords'Image (Current_Keyword) then
-- Found match.
Is_Simple_Keyword := True;
The_Simple_Keyword := Current_Keyword;
exit;
end if;
end loop;
end Parse;
procedure Parse (This_Keyword : in String;
Is_Valued_Keyword : in out Boolean;
The_alued_Keyword : in out Valued_Keywords) is
begin
Is_Valued_Keyword := False;
for Current_Keyword in Valued_Keywords loop
if String_Utilities.Upper_Case (This_Keyword) =
Valued_Keywords'Image (Current_Keyword) then
-- Found match.
Is_Valued_Keyword := True;
The_Valued_Keyword := Current_Keyword;
exit;
end if;
end loop;
end Parse;
procedure Parse (This_Line : in String;
Is_Simple_Annotation : in out Boolean;
The_Simple_Keyword : in out Simple_Keywords;
Is_Valued_Annotation : in out Boolean;
The_Valued_Keyword : in out Valued_Keywords) is
Normalized_Line : constant String := Normalized (This_Line);
Line_Begin : Integer := Normalized_Line'First;
Keyword_Begin : Integer := Line_Begin + 1; Keyword_End : Integer;
begin
-- Must initialize ALL "in out" and "out" parameters (Ada rule).
--
Is_Simple_Annotation := False;
The_Simple_Keyword := Simple_Keywords'First;
Is_Valued_Annotation := False;
The_Valued_Keyword := Valued_Keywords'First;
if Normalized_Line (Line_Begin) = Annotation_Indicator then
for Index in Keyword_Begin .. Normalized_Line'Last loop
if Normalized_Line (Index) = Argument_Delimiter then
--
-- Found an argument delimiter, so the annotation
-- might be valued.
--
Keyword_End := Index - 1;
Parse (Normalized_Line (Keyword_Begin .. Keyword_End),
Is_Valued_Annotation, The_Valued_Keyword);
exit when Is_Valued_Annotation;
end if;
if Index = Normalized_Line'Last then
--
-- Got all the way to the end of the line without
-- finding an argument delimiter, so the annotation
-- might be simple.
--
Keyword_End := Index;
Parse (Normalized_Line (Keyword_Begin .. Keyword_End),
Is_Simple_Annotation, The_Simple_Keyword);
end if;
end loop;
end if;
end Parse;
function Is_Simple_Annotation (This_Line : in Line) return Boolean is
Is_Simple_Annotation : Boolean := False;
The_Simple_Keyword : Simple_Keywords := Simple_Keywords'First;
Is_Valued_Annotation : Boolean := False;
The_Valued_Keyword : Valued_Keywords := Valued_Keywords'First;
begin
declare
The_Annotation : constant String :=
Normalized (Lines.Image (This_Line));
begin
Parse (The_Annotation, Is_Simple_Annotation, The_Simple_Keyword,
Is_Valued_Annotation, The_Valued_Keyword);
return Is_Simple_Annotation;
end;
exception
when Lines.Not_Initialized =>
raise Not_Initialized;
when others =>
return False;
end Is_Simple_Annotation;
function Is_Valued_Annotation (This_Line : in Line) return Boolean is
Is_Simple_Annotation : Boolean := False;
The_Simple_Keyword : Simple_Keywords := Simple_Keywords'First;
Is_Valued_Annotation : Boolean := False;
The_Valued_Keyword : Valued_Keywords := Valued_Keywords'First;
begin
declare
The_Annotation : constant String :=
Normalized (Lines.Image (This_Line));
begin
Parse (The_Annotation, Is_Simple_Annotation, The_Simple_Keyword,
Is_Valued_Annotation, The_Valued_Keyword);
return Is_Valued_Annotation;
end;
exception
when Lines.Not_Initialized =>
raise Not_Initialized;
when others =>
return False;
end Is_Valued_Annotation;
function Is_Annotation (This_Line : in Line) return Boolean is
Is_Simple_Annotation : Boolean := False;
The_Simple_Keyword : Simple_Keywords := Simple_Keywords'First;
Is_Valued_Annotation : Boolean := False;
The_Valued_Keyword : Valued_Keywords := Valued_Keywords'First;
begin
declare
The_Annotation : constant String :=
Normalized (Lines.Image (This_Line));
begin
Parse (The_Annotation, Is_Simple_Annotation, The_Simple_Keyword,
Is_Valued_Annotation, The_Valued_Keyword);
return Is_Simple_Annotation or else Is_Valued_Annotation;
end;
exception
when Lines.Not_Initialized =>
raise Not_Initialized;
when others =>
return False;
end Is_Annotation;
function Keywords_Match
(This_Simple_Annotation : in Simple_Annotation;
This_Simple_Keyword : in Simple_Keywords) return Boolean is
Is_Simple_Annotation : Boolean := False;
The_Simple_Keyword : Simple_Keywords := Simple_Keywords'First;
Is_Valued_Annotation : Boolean := False;
The_Valued_Keyword : Valued_Keywords := Valued_Keywords'First;
begin
declare
The_Annotation : constant String :=
Normalized (Lines.Image (This_Simple_Annotation));
begin
Parse (The_Annotation, Is_Simple_Annotation, The_Simple_Keyword,
Is_Valued_Annotation, The_Valued_Keyword);
return Is_Simple_Annotation and then
This_Simple_Keyword = The_Simple_Keyword;
end;
exception
when Lines.Not_Initialized =>
raise Not_Initialized;
when others =>
return False;
end Keywords_Match;
function Keywords_Match
(This_Valued_Annotation : in Valued_Annotation;
This_Valued_Keyword : in Valued_Keywords) return Boolean is
Is_Simple_Annotation : Boolean := False;
The_Simple_Keyword : Simple_Keywords := Simple_Keywords'First;
Is_Valued_Annotation : Boolean := False;
The_Valued_Keyword : Valued_Keywords := Valued_Keywords'First;
begin
declare
The_Annotation : constant String :=
Normalized (Lines.Image (This_Valued_Annotation));
begin
Parse (The_Annotation, Is_Simple_Annotation, The_Simple_Keyword,
Is_Valued_Annotation, The_Valued_Keyword);
return Is_Valued_Annotation and then
This_Valued_Keyword = The_Valued_Keyword;
end;
exception
when Lines.Not_Initialized =>
raise Not_Initialized;
when others =>
return False;
end Keywords_Match;
function Argument_To
(This_Valued_Annotation : in String;
This_Valued_Keyword : in Valued_Keywords) return String is
The_Valued_Annotation : constant String :=
Normalized (This_Valued_Annotation);
The_Keyword_Image : constant String :=
Valued_Keywords'Image (This_Valued_Keyword);
The_Keyword_Length : Integer := The_Keyword_Image'Length;
Argument_Start : Integer :=
The_Valued_Annotation'First + The_Keyword_Length + 2;
Argument_End : Integer := The_Valued_Annotation'Last;
begin
return The_Valued_Annotation (Argument_Start .. Argument_End);
end Argument_To;
function Value_Of (This_Line : in Line) return String is
Is_Simple_Annotation : Boolean := False;
The_Simple_Keyword : Simple_Keywords := Simple_Keywords'First;
Is_Valued_Annotation : Boolean := False;
The_Valued_Keyword : Valued_Keywords := Valued_Keywords'First;
begin
declare
The_Line : constant String := Normalized (Lines.Image (This_Line));
begin
Parse (The_Line, Is_Simple_Annotation, The_Simple_Keyword,
Is_Valued_Annotation, The_Valued_Keyword);
if Is_Simple_Annotation then
return "";
elsif (Is_Valued_Annotation) then
return Argument_To (The_Line, The_Valued_Keyword);
else
-- Not an annotation
return Lines.Image (This_Line);
end if;
end;
exception
when Lines.Not_Initialized =>
raise Not_Initialized;
when others =>
return "<UNKNOWN>";
end Value_Of;
function Simple_Annotation_From
(This_Keyword : in Simple_Keywords) return Line is
begin
return Lines.Create (Annotation_Indicator &
Simple_Keywords'Image (This_Keyword));
end Simple_Annotation_From;
function Valued_Annotation_From
(This_Keyword : in Valued_Keywords; This_Argument : in String)
return Line is
begin
return Lines.Create (Annotation_Indicator &
Valued_Keywords'Image (This_Keyword) &
Argument_Delimiter & This_Argument);
end Valued_Annotation_From;
function Arguments_Match (This_Valued_Annotation : in Valued_Annotation;
This_Argument : in Arguments) return Boolean is
Is_Simple_Annotation : Boolean := False;
The_Simple_Keyword : Simple_Keywords := Simple_Keywords'First;
Is_Valued_Annotation : Boolean := False;
The_Valued_Keyword : Valued_Keywords := Valued_Keywords'First;
begin
declare
The_Annotation : constant String :=
Normalized (Lines.Image (This_Valued_Annotation));
begin
Parse (The_Annotation, Is_Simple_Annotation, The_Simple_Keyword,
Is_Valued_Annotation, The_Valued_Keyword);
if not Is_Valued_Annotation then
return False;
else
return String_Utilities.Upper_Case
(Argument_To (The_Annotation, The_Valued_Keyword)) =
String_Utilities.Upper_Case
(Arguments'Image (This_Argument));
end if;
end;
exception
when Lines.Not_Initialized =>
raise Not_Initialized;
when others =>
return False;
end Arguments_Match;
end Structured_Text_Generic;
nblk1=16
nid=0
hdr6=2c
[0x00] rec0=1a rec1=00 rec2=01 rec3=032
[0x01] rec0=00 rec1=00 rec2=16 rec3=002
[0x02] rec0=19 rec1=00 rec2=02 rec3=002
[0x03] rec0=00 rec1=00 rec2=15 rec3=002
[0x04] rec0=16 rec1=00 rec2=03 rec3=03c
[0x05] rec0=00 rec1=00 rec2=14 rec3=00c
[0x06] rec0=18 rec1=00 rec2=04 rec3=05e
[0x07] rec0=01 rec1=00 rec2=13 rec3=018
[0x08] rec0=1b rec1=00 rec2=05 rec3=056
[0x09] rec0=00 rec1=00 rec2=12 rec3=024
[0x0a] rec0=1e rec1=00 rec2=06 rec3=036
[0x0b] rec0=01 rec1=00 rec2=11 rec3=00e
[0x0c] rec0=1a rec1=00 rec2=07 rec3=00e
[0x0d] rec0=01 rec1=00 rec2=10 rec3=016
[0x0e] rec0=18 rec1=00 rec2=08 rec3=06c
[0x0f] rec0=01 rec1=00 rec2=0f rec3=010
[0x10] rec0=1c rec1=00 rec2=09 rec3=078
[0x11] rec0=02 rec1=00 rec2=0e rec3=03e
[0x12] rec0=1b rec1=00 rec2=0a rec3=020
[0x13] rec0=02 rec1=00 rec2=0d rec3=01a
[0x14] rec0=16 rec1=00 rec2=0b rec3=004
[0x15] rec0=1c rec1=00 rec2=0c rec3=001
tail 0x217002a54815c6752d49e 0x42a00088462061e03