|
|
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 Naming, seg_0267f8, seg_027c59, seg_027cf4, separate Directory
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with Text_Io;
separate (Directory)
package body Naming is
Directory_Separator : constant Character := '/';
Extension_Separator : constant Character := '.';
Default_Context_Object : Context;
procedure Set_Default_Context (The_Context : Naming.String_Name) is
Name : Gs.Object;
begin
if Di.Existent_Entry (Path => The_Context) then
if Di.Is_Directory (Path => The_Context) then
if Absolute (The_Context) then
Gs.Create (Name, The_Context);
else
Gs.Create (Name, Absolute_Name (The_Context));
end if;
if Di.Change_Directory (Gs.Image (Name)) then
Gs.Copy (Default_Context_Object.Name, Name);
else
Put_Error_Message;
raise System_Error;
end if;
else
Put_Error_Message
("The object must be a directory to become the default context");
raise System_Error;
end if;
else
raise Non_Existent_Object_Error;
end if;
end Set_Default_Context;
procedure Set_Default_Context (The_Context : Naming.Context) is
begin
if Class (The_Context) = Directory_Class then
if Di.Change_Directory (Path => Naming.Full_Name (The_Context)) then
Gs.Copy (Default_Context_Object.Name, The_Context.Name);
else
Put_Error_Message;
raise System_Error;
end if;
else
Put_Error_Message
("The object must be a directory to become the default context");
raise System_Error;
end if;
end Set_Default_Context;
function Default_Context return Naming.String_Name is
begin
return Gs.Image (Default_Context_Object.Name);
end Default_Context;
function Default_Context return Naming.Context is
C : Context;
begin
Gs.Copy (C.Name, Default_Context_Object.Name);
return C;
end Default_Context;
function Absolute (The_Name : String_Name) return Boolean is
I : constant Natural := Su.Locate
(Directory_Separator, The_Name, False);
begin
return (I = The_Name'First);
end Absolute;
function Absolute_Name (The_Name : String_Name) return String_Name is
Name : Gs.Object;
Tail_Name : Gs.Object := Gs.Undefined_Object;
begin
if Di.Is_Directory (The_Name) then
Gs.Create (Name, The_Name);
else
Gs.Create (Name, Prefix (The_Name));
Gs.Create (Tail_Name, "/" & Simple_Name (The_Name));
end if;
declare
Str : constant String := Di.Get_Absolute_Path (Gs.Image (Name));
Tail : constant String := Gs.Image (Tail_Name);
begin
if Str = "" then
Put_Error_Message;
raise System_Error;
else
return Str & Tail;
end if;
end;
end Absolute_Name;
function Prefix (The_Name : String_Name) return String_Name is
I : constant Natural := Su.Reverse_Locate
(Directory_Separator, The_Name, False);
begin
if I = 0 then
return "";
else
return The_Name (The_Name'First .. I - 1);
end if;
end Prefix;
function Simple_Name (The_Name : String_Name) return Simple_String_Name is
I : constant Natural := Su.Reverse_Locate
(Directory_Separator, The_Name, False);
begin
if I = 0 then
return The_Name;
else
return The_Name (I + 1 .. The_Name'Last);
end if;
end Simple_Name;
function Simple_Name_Without_Extension
(The_Name : String_Name) return Simple_String_Name is
Str : constant String := Simple_Name (The_Name);
begin
if Extension (Str) /= "" then
declare
I : constant Natural := Su.Reverse_Locate
(Extension_Separator, Str, False);
begin
return Str (Str'First .. I - 1);
end;
else
return Str;
end if;
end Simple_Name_Without_Extension;
function Head (The_Name : String_Name) return Simple_String_Name is
I : constant Natural := Su.Locate
(Directory_Separator, The_Name, False);
begin
if I = 0 then
return The_Name;
elsif I = The_Name'First then
return "/";
else
return The_Name (The_Name'First .. I - 1);
end if;
end Head;
function Tail (The_Name : String_Name) return String_Name is
I : constant Natural := Su.Locate
(Directory_Separator, The_Name, False);
begin
if I = 0 then
return "";
else
return The_Name (I + 1 .. The_Name'Last);
end if;
end Tail;
function Extension (A_Name : String_Name) return String is
I : constant Natural := Su.Reverse_Locate
(Extension_Separator, A_Name, False);
begin
if I = 0 then
return "";
else
return A_Name (I + 1 .. A_Name'Last);
end if;
end Extension;
function Full_Name (The_Object : Object) return Naming.String_Name is
begin
return Gs.Image (The_Object.Name);
end Full_Name;
function Simple_Name (The_Object : Object) return Simple_String_Name is
S : constant String := Gs.Image (The_Object.Name);
begin
return Simple_Name (The_Name => S);
end Simple_Name;
function Simple_Name_Without_Extension
(The_Object : Object) return Simple_String_Name is
begin
return Simple_Name_Without_Extension
(The_Name => (Full_Name (The_Object)));
end Simple_Name_Without_Extension;
end Naming;
nblk1=b
nid=9
hdr6=e
[0x00] rec0=1d rec1=00 rec2=01 rec3=004
[0x01] rec0=1c rec1=00 rec2=05 rec3=060
[0x02] rec0=1e rec1=00 rec2=03 rec3=09a
[0x03] rec0=1f rec1=00 rec2=04 rec3=05e
[0x04] rec0=14 rec1=00 rec2=0b rec3=042
[0x05] rec0=1f rec1=00 rec2=07 rec3=02c
[0x06] rec0=1d rec1=00 rec2=02 rec3=000
[0x07] rec0=1d rec1=00 rec2=02 rec3=000
[0x08] rec0=08 rec1=00 rec2=03 rec3=000
[0x09] rec0=08 rec1=00 rec2=03 rec3=000
[0x0a] rec0=9d rec1=00 rec2=00 rec3=000
tail 0x2172120da83ab40e35862 0x42a00088462062803
Free Block Chain:
0x9: 0000 00 08 00 04 80 01 65 01 02 03 04 05 06 07 08 09 ┆ e ┆
0x8: 0000 00 0a 00 c8 80 0c 66 20 49 20 3d 20 30 20 74 68 ┆ f I = 0 th┆
0xa: 0000 00 06 03 fb 80 3a 62 6a 65 63 74 20 6d 75 73 74 ┆ :bject must┆
0x6: 0000 00 00 00 1d 00 1a 20 20 20 20 20 20 20 20 20 20 ┆ ┆