|
|
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 Copy_F, package body Copy_R, seg_025067
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with Communications;
with Errors;
with Files;
with Files;
with Interchange;
with Mac_Files;
with Mac_Path;
with Mac_Types;
with Mac_Text;
with Memory;
with Osutils;
with Rational_Error;
with System;
with Talk_Utils;
with Text_Io;
use Text_Io;
with Unchecked_Conversion;
package body Copy_R is
package Copy_F is
procedure Link_In (Is_Link : Boolean);
procedure From_Remote_File_In (Name : Mac_Text.Text);
procedure To_Remote_File_In (Name : Mac_Text.Text);
procedure Options_In (Options : Mac_Text.Text);
procedure End_Copy;
end Copy_F;
package body Copy_F is
Err : Mac_Types.Oserr := Mac_Types.Noerr;
Link_It : Boolean;
From_File_Name : Mac_Types.Str255;
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 Link_In (Is_Link : Boolean) is
begin
Err := Mac_Types.Noerr;
Link_It := Is_Link;
end Link_In;
procedure From_Remote_File_In (Name : Mac_Text.Text) is
begin
From_File_Name := Mac_Text.Value (Name);
end From_Remote_File_In;
procedure To_Remote_File_In (Name : Mac_Text.Text) is
To_File_Name : Mac_Types.Str255 := Mac_Text.Value (Name);
From_Refnum, To_Refnum : Mac_Types.Integer;
Err2 : Mac_Types.Oserr;
Max_Length : constant Mac_Types.Longint := 4096;
A_Ptr : Mac_Types.Ptr;
Count : Mac_Types.Longint;
begin
if Link_It then
Err := Errors.Ioerr;
else
Err := Mac_Files.Create_File (Name);
Err := Files.Fsopen (To_File_Name, 0,
As_Varinteger (To_Refnum'Address));
if Err /= Mac_Types.Noerr then
return;
end if;
Err := Files.Fsopen (From_File_Name, 0,
As_Varinteger (From_Refnum'Address));
if Err /= Mac_Types.Noerr then
Err2 := Files.Fsclose (To_Refnum);
return;
end if;
A_Ptr := Memory.Newptr (Bytecount => Max_Length);
if Mac_Types."=" (A_Ptr, null) then
Err := Errors.Memfullerr;
Err2 := Files.Fsclose (To_Refnum);
Err2 := Files.Fsclose (From_Refnum);
return;
end if;
loop
Count := Max_Length;
Err := Files.Fsread (From_Refnum,
As_Varlongint (Count'Address), A_Ptr);
Err2 := Files.Fswrite
(To_Refnum,
As_Varlongint (Count'Address), A_Ptr);
exit when Err /= Mac_Types.Noerr or Err2 /= Mac_Types.Noerr;
end loop;
Memory.Disposptr (A_Ptr);
if Err2 /= Mac_Types.Noerr then
Err := Err2;
end if;
if Err /= Mac_Types.Noerr and Err /= Errors.Eoferr then
Err2 := Files.Fsclose (To_Refnum);
Err2 := Files.Fsclose (From_Refnum);
return;
end if;
Err := Files.Fsclose (To_Refnum);
Err2 := Files.Fsclose (From_Refnum);
if Err2 /= Mac_Types.Noerr then
Err := Err2;
end if;
end if;
end To_Remote_File_In;
procedure Options_In (Options : Mac_Text.Text) is
begin
null;
end Options_In;
procedure End_Copy is
begin
if Err /= Mac_Types.Noerr then
Rational_Error.Raise_Mac_Error (Err);
end if;
end End_Copy;
end Copy_F;
procedure Read (A_Connection : in out Communications.Connection) is
I : Mac_Types.Longint;
B : Boolean;
T : Mac_Text.Text (256);
begin
Put_Line ("copy_r:read begin");
Interchange.Get_Int (A_Connection, I);
if I /= Talk_Utils.F_Link then
Rational_Error.Raise_Error (Rational_Error.Internal_Error);
end if;
Interchange.Get_Bool (A_Connection, B);
Copy_F.Link_In (B);
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);
Copy_F.From_Remote_File_In (T);
Put ("copy_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_To_Remote_File then
Rational_Error.Raise_Error (Rational_Error.Internal_Error);
end if;
Interchange.Get_Text (A_Connection, T);
Copy_F.To_Remote_File_In (T);
Put ("copy_r:to 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);
Copy_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_Copy then
Rational_Error.Raise_Error (Rational_Error.Internal_Error);
end if;
Put_Line ("copy_r:read end");
end Read;
procedure Write (A_Connection : in out Communications.Connection) is
begin
Put_Line ("copy_r:write begin");
begin
Copy_F.End_Copy;
exception
when others =>
Rational_Error.Report
(A_Connection, Talk_Utils.R_Copy, Rational_Error.Get);
end;
Interchange.Put_Int (A_Connection, Talk_Utils.F_Delimitor);
Interchange.Put_Int (A_Connection, Talk_Utils.R_Copy);
Put_Line ("copy_r:write end");
end Write;
end Copy_R;
nblk1=b
nid=8
hdr6=12
[0x00] rec0=26 rec1=00 rec2=01 rec3=08e
[0x01] rec0=02 rec1=00 rec2=03 rec3=02c
[0x02] rec0=1a rec1=00 rec2=06 rec3=020
[0x03] rec0=15 rec1=00 rec2=0a rec3=006
[0x04] rec0=13 rec1=00 rec2=05 rec3=05e
[0x05] rec0=21 rec1=00 rec2=04 rec3=020
[0x06] rec0=16 rec1=00 rec2=09 rec3=04a
[0x07] rec0=1b rec1=00 rec2=0b rec3=05a
[0x08] rec0=06 rec1=00 rec2=02 rec3=000
[0x09] rec0=06 rec1=00 rec2=08 rec3=000
[0x0a] rec0=da rec1=ea rec2=e0 rec3=000
tail 0x217200462839f49e2ed04 0x42a00088462060003
Free Block Chain:
0x8: 0000 00 07 00 a1 80 0f 73 2e 46 5f 44 65 6c 69 6d 69 ┆ s.F_Delimi┆
0x7: 0000 00 00 03 f9 80 03 65 29 3b 03 00 35 20 20 20 20 ┆ e); 5 ┆