|
|
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: 7168 (0x1c00)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Placeholder_Replacement_Generic, seg_0046e6
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with Files;
with Lines;
with Directory_Tools;
with String_Utilities;
package body Placeholder_Replacement_Generic is
function Replaced_Line (This_Line : in String) return String is
Parsing_Placeholder : Boolean := False;
Placeholder_Start_Position : Natural := This_Line'First;
begin
for Index in This_Line'First .. This_Line'Last loop
if This_Line (Index) = Placeholder_Start_Indicator then
if Parsing_Placeholder then
--
-- Was already parsing a placeholder.
--
if Index = (Placeholder_Start_Position + 1) then
--
-- Found two placeholder start indicators in a row,
-- so is not a placeholder
--
Parsing_Placeholder := False;
else
--
-- Old possible placeholder is now defunct, but may
-- have found start of a new placeholder.
--
Placeholder_Start_Position := Index;
end if;
else
--
-- Found start of possible placeholder.
--
Parsing_Placeholder := True;
Placeholder_Start_Position := Index;
end if;
elsif This_Line (Index) = Placeholder_Finish_Indicator then
if Parsing_Placeholder then
--
-- May have found placeholder, so check string enclosed
-- in placeholder start and finish indicators.
--
begin
declare
The_Placeholder : constant Placeholders :=
Placeholders'Value
(String_Utilities.Strip
(This_Line
((Placeholder_Start_Position + 1) ..
(Index - 1))));
begin
--
-- Since conversion was successful, found a
-- placeholder, so replace it.
--
return This_Line
(This_Line'First ..
(Placeholder_Start_Position - 1)) &
Replacement_For (The_Placeholder) &
Replaced_Line (This_Line
((Index + 1) ..
This_Line'Last));
end;
exception
when Constraint_Error =>
-- Wasn't a placeholder because string didn't match.
null;
end;
end if;
end if;
end loop;
--
-- Found no placeholders in line.
--
return This_Line;
end Replaced_Line;
procedure Replace_Placeholders (This_File : in String) is
begin
declare
The_File : Files.Iterator := Files.Create (From_File => This_File);
begin
Lines.Reset_To_First (The_File);
while not Lines.Done (The_File) loop
Lines.Modify (The_File,
Lines.Create (Replaced_Line
(Lines.Image (Lines.Current
(The_File)))));
Lines.Next (The_File);
end loop;
Files.Save (This_File, The_File);
Lines.Dispose (The_File);
end;
exception
when Files.Io_Failure =>
raise Io_Failure;
end Replace_Placeholders;
procedure Replace_Placeholders_In (These_Files : in String) is
The_Files : Directory_Tools.Object.Iterator :=
Directory_Tools.Naming.Resolution (These_Files);
begin
Directory_Tools.Object.Reset (The_Files);
while not Directory_Tools.Object.Done (The_Files) loop
Replace_Placeholders
(This_File => Directory_Tools.Naming.Unique_Full_Name
(Directory_Tools.Object.Value (The_Files)));
Directory_Tools.Object.Next (The_Files);
end loop;
end Replace_Placeholders_In;
end Placeholder_Replacement_Generic;
nblk1=6
nid=0
hdr6=c
[0x00] rec0=1d rec1=00 rec2=01 rec3=020
[0x01] rec0=15 rec1=00 rec2=02 rec3=042
[0x02] rec0=00 rec1=00 rec2=06 rec3=00e
[0x03] rec0=13 rec1=00 rec2=03 rec3=018
[0x04] rec0=1a rec1=00 rec2=04 rec3=01c
[0x05] rec0=1b rec1=00 rec2=05 rec3=000
tail 0x217002a50815c674d0620 0x42a00088462061e03