|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 5358 (0x14ee)
Types: TextFile
Names: »B«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
└─⟦129cab021⟧ »DATA«
└─⟦this⟧
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
└─⟦d65440be7⟧ »DATA«
└─⟦this⟧
with Communications;
with Errors;
with Files;
with Interchange;
with Mac_Files;
with Mac_Path;
with Mac_Types;
with Mac_Text;
with Osutils;
with Rational_Error;
with System;
with Talk_Utils;
with Text_Io;
use Text_Io;
with Unchecked_Conversion;
package body Get_R is
package Get_F is
procedure From_Remote_File_In (Name : Mac_Text.Text);
function End_Iter_I return Boolean;
procedure Content_Out (T : in out Mac_Text.Text);
procedure Options_In (Options : Mac_Text.Text);
procedure End_Get;
end Get_F;
package body Get_F is
Err : Mac_Types.Oserr := Mac_Types.Noerr;
Refnum : Mac_Types.Integer;
function As_Varinteger is new Unchecked_Conversion
(Source => System.Address,
Target => Mac_Types.Varinteger);
function As_Varlongint is new Unchecked_Conversion
(Source => System.Address,
Target => Mac_Types.Varlongint);
procedure From_Remote_File_In (Name : Mac_Text.Text) is
S : Mac_Types.Str255 := Mac_Text.Value (Name);
begin
Err := Files.Fsopen (S, 0, As_Varinteger (Refnum'Address));
if Err /= Mac_Types.Noerr then
return;
end if;
end From_Remote_File_In;
function End_Iter_I return Boolean is
Length : Mac_Types.Longint;
Leof : Mac_Types.Longint;
begin
if Err /= Mac_Types.Noerr then
return True;
end if;
Err := Files.Geteof (Refnum, As_Varlongint (Leof'Address));
if Err = Mac_Types.Noerr then
Err := Files.Getfpos (Refnum, As_Varlongint (Length'Address));
if Err = Mac_Types.Noerr then
return Length >= Leof;
end if;
end if;
return True;
end End_Iter_I;
procedure Options_In (Options : Mac_Text.Text) is
begin
null;
end Options_In;
procedure Content_Out (T : in out Mac_Text.Text) is
Length : Mac_Types.Longint;
begin
if Err /= Mac_Types.Noerr then
return;
end if;
Length := Mac_Text.Length (T);
Err := Files.Fsread (Refnum, As_Varlongint (Length'Address),
Mac_Text.As_Ptr (T));
Mac_Text.Set_Length (T, Mac_Text.Index (Length));
if Err = Errors.Eoferr then
Err := Mac_Types.Noerr;
end if;
end Content_Out;
procedure End_Get is
begin
if Err = Mac_Types.Noerr then
Err := Files.Fsclose (Refnum);
else
Err := Files.Fsclose (Refnum);
Rational_Error.Raise_Mac_Error (Err);
end if;
end End_Get;
end Get_F;
procedure Read (A_Connection : in out Communications.Connection) is
I : Mac_Types.Longint;
B : Boolean;
T : Mac_Text.Text (256);
begin
Put_Line ("get_r:read begin");
Interchange.Get_Int (A_Connection, I);
if I /= Talk_Utils.F_From_Remote_File then
Rational_Error.Raise_Error (Rational_Error.Internal_Error);
end if;
Interchange.Get_Text (A_Connection, T);
Get_F.From_Remote_File_In (T);
Put ("get_r:from file '");
for I in 1 .. Mac_Text.Length (T) loop
Put (Character'Val (Mac_Types.Char'Pos (Mac_Text.Value (I, T))));
end loop;
Put_Line ("'");
Interchange.Get_Int (A_Connection, I);
if I /= Talk_Utils.F_Options then
Rational_Error.Raise_Error (Rational_Error.Internal_Error);
end if;
Interchange.Get_Text (A_Connection, T);
Get_F.Options_In (T);
Interchange.Get_Int (A_Connection, I);
if I /= Talk_Utils.F_Delimitor then
Rational_Error.Raise_Error (Rational_Error.Internal_Error);
end if;
Interchange.Get_Int (A_Connection, I);
if I /= Talk_Utils.R_Get then
Rational_Error.Raise_Error (Rational_Error.Internal_Error);
end if;
Put_Line ("get_r:read end");
end Read;
procedure Write (A_Connection : in out Communications.Connection) is
Iter_I : Positive;
Buffer : Mac_Text.Text (2000);
begin
Put_Line ("get_r:write begin");
begin
Iter_I := 1;
while not Get_F.End_Iter_I loop
Put_Line ("get_r:write iteration: ");
Put (Positive'Image (Iter_I));
Get_F.Content_Out (Buffer);
Interchange.Put_Int (A_Connection, Talk_Utils.F_Content);
Interchange.Put_Text (A_Connection, Buffer);
Iter_I := Iter_I + 1;
end loop;
Get_F.End_Get;
exception
when others =>
Rational_Error.Report
(A_Connection, Talk_Utils.R_Get, Rational_Error.Get);
end;
Interchange.Put_Int (A_Connection, Talk_Utils.F_Delimitor);
Interchange.Put_Int (A_Connection, Talk_Utils.R_Get);
Put_Line ("get_r:write end");
end Write;
end Get_R;