|
|
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: 8192 (0x2000)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Interchange, seg_0244c4
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with Bit_Ops;
with Mac_Types;
with Communications;
with Mac_Text;
package body Interchange is
-- R1000 RPC interchange package for Unix C
use Bit_Ops;
procedure Put_Short (A_Connection : in out Communications.Connection;
Value : Mac_Types.Integer) is
Buf : Communications.Bytearray (0 .. 1);
begin
Buf (0) := Mac_Types.Byte ((Value / 256) and 8#377#);
Buf (1) := Mac_Types.Byte (Value and 8#377#);
Communications.Write (A_Connection, Buf);
end Put_Short;
procedure Get_Short (A_Connection : in out Communications.Connection;
Value : out Mac_Types.Integer) is
Buf : Communications.Bytearray (0 .. 1);
Read_Count : Natural;
begin
Communications.Read (A_Connection, Buf);
Value := Mac_Types.Integer (Buf (0)) * 256 +
Mac_Types.Integer (Buf (1));
end Get_Short;
procedure Put_Int (A_Connection : in out Communications.Connection;
Value : Mac_Types.Longint) is -- 32 bit signed, 4 bytes
Buf : Communications.Bytearray (0 .. 3);
begin
Buf (0) := Mac_Types.Byte ((Value / (2 ** 24)) and 8#377#);
Buf (1) := Mac_Types.Byte ((Value / (2 ** 16)) and 8#377#);
Buf (2) := Mac_Types.Byte ((Value / (2 ** 8)) and 8#377#);
Buf (3) := Mac_Types.Byte (Value and 8#377#);
Communications.Write (A_Connection, Buf);
end Put_Int;
procedure Get_Int (A_Connection : in out Communications.Connection;
Value : out Mac_Types.Longint) is
Buf : Communications.Bytearray (0 .. 3);
Read_Count : Natural;
begin
Communications.Read (A_Connection, Buf);
Value :=
((Mac_Types.Longint (Buf (0)) * 256 + Mac_Types.Longint (Buf (1))) *
256 + Mac_Types.Longint (Buf (2))) * 256 +
Mac_Types.Longint (Buf (3));
end Get_Int;
procedure Put_Bool (A_Connection : in out Communications.Connection;
Value : Boolean) is
begin
if Value then
Put_Short (A_Connection, 1);
else
Put_Short (A_Connection, 0);
end if;
end Put_Bool;
procedure Get_Bool (A_Connection : in out Communications.Connection;
Value : out Boolean) is
I : Mac_Types.Integer;
begin
Get_Short (A_Connection, I);
Value := I /= 0;
end Get_Bool;
procedure Put_Text (A_Connection : in out Communications.Connection;
Value : in Mac_Text.Text) is
Text_Length : Mac_Text.Index;
begin
Text_Length := Mac_Text.Length (Value);
Put_Int (A_Connection, Text_Length);
if Text_Length > 0 then
declare
Buf : Communications.Bytearray (1 .. Text_Length);
Extra : Communications.Bytearray (1 .. 1) := (others => 0);
begin
for I in 1 .. Text_Length loop
Buf (I) := Mac_Types.Char'Pos (Mac_Text.Value (I, Value));
end loop;
Communications.Write (A_Connection, Buf);
if Text_Length mod 2 /= 0 then
Communications.Write (A_Connection, Extra);
end if;
end;
end if;
end Put_Text;
procedure Get_Text (A_Connection : in out Communications.Connection;
Value : in out Mac_Text.Text) is
Length : Mac_Types.Longint;
Remaining : Mac_Types.Longint;
Load : Mac_Types.Longint;
begin
Get_Int (A_Connection, Length);
Mac_Text.Set_Empty (Value);
if Length = 0 then
return;
end if;
if Length <= Mac_Text.Maximum_Length (Value) then
declare
Buf : Communications.Bytearray (1 .. Length);
begin
Communications.Read (A_Connection, Buf);
for I in 1 .. Length loop
Mac_Text.Append (Mac_Types.Char'Val (Buf (I)), Value);
end loop;
end;
else
-- Must truncate string
declare
Buf : Communications.Bytearray
(1 .. Mac_Text.Maximum_Length (Value));
begin
Communications.Read (A_Connection, Buf);
for I in 1 .. Mac_Text.Maximum_Length (Value) loop
Mac_Text.Append (Mac_Types.Char'Val (Buf (I)), Value);
end loop;
end;
Remaining := Length - Mac_Text.Maximum_Length (Value);
while Remaining > 0 loop
if Remaining > 256 then
Load := 256;
else
Load := Remaining;
end if;
declare
Buf : Communications.Bytearray (1 .. Load);
begin
Communications.Read (A_Connection, Buf);
end;
Remaining := Remaining - Load;
end loop;
end if;
if Length mod 2 /= 0 then
declare
Buf : Communications.Bytearray (1 .. 1);
begin
Communications.Read (A_Connection, Buf);
end;
end if;
end Get_Text;
end Interchange;
nblk1=7
nid=6
hdr6=c
[0x00] rec0=22 rec1=00 rec2=01 rec3=02c
[0x01] rec0=17 rec1=00 rec2=07 rec3=044
[0x02] rec0=1f rec1=00 rec2=02 rec3=02c
[0x03] rec0=1c rec1=00 rec2=03 rec3=030
[0x04] rec0=1a rec1=00 rec2=05 rec3=018
[0x05] rec0=15 rec1=00 rec2=04 rec3=000
[0x06] rec0=80 rec1=80 rec2=80 rec3=404
tail 0x2171f83dc839c6b800fc5 0x42a00088462060003
Free Block Chain:
0x6: 0000 00 00 02 38 80 10 20 20 20 20 20 20 20 20 20 64 ┆ 8 d┆