|
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: 5120 (0x1400) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Square, seg_02fa30, seg_0356f8, seg_038f6b
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─⟦5a81ac88f⟧ »Space Info Vol 1« └─⟦this⟧
with Square, Text_Io; package body Square is procedure Move (D : Direction; Tab : in out Magic_Square) is begin case D is when North => if Tab.Row = Tab.Table'First (2) then Tab.Row := Tab.Table'Last (2); else Tab.Row := Tab.Row - 1; end if; when West => if Tab.Line = Tab.Table'First (1) then Tab.Line := Tab.Table'Last (1); else Tab.Line := Tab.Line - 1; end if; when East => if Tab.Line = Tab.Table'Last (1) then Tab.Line := Tab.Table'First (1); else Tab.Line := Tab.Line + 1; end if; end case; end Move; procedure Display_Zero (Tab : in out Magic_Square) is begin for R in Tab.Table'Range (2) loop for L in Tab.Table'Range (1) loop Tab.Table (L, R) := 0; end loop; end loop; end Display_Zero; procedure Walking (Tab : in out Magic_Square) is X : Natural; begin X := 1; Tab.Table (Tab.Line, Tab.Row) := X; X := X + 1; while not (X > (Tab.Dim ** 2)) loop Move (North, Tab); Move (East, Tab); if Tab.Table (Tab.Line, Tab.Row) = 0 then Tab.Table (Tab.Line, Tab.Row) := X; else Move (North, Tab); Move (West, Tab); Tab.Table (Tab.Line, Tab.Row) := X; end if; X := X + 1; end loop; end Walking; procedure Display (Tab : in out Magic_Square) is package Io is new Text_Io.Integer_Io (Integer); begin Display_Zero (Tab); Walking (Tab); for Row in Tab.Table'Range (2) loop for Line in Tab.Table'Range (1) loop Io.Put (Tab.Table (Line, Row)); end loop; Text_Io.Put_Line (""); end loop; end Display; end Square;
nblk1=4 nid=3 hdr6=6 [0x00] rec0=22 rec1=00 rec2=01 rec3=04e [0x01] rec0=2c rec1=00 rec2=04 rec3=006 [0x02] rec0=10 rec1=00 rec2=02 rec3=000 [0x03] rec0=1c rec1=00 rec2=02 rec3=000 tail 0x21528ca268491625729a5 0x42a00088462060003 Free Block Chain: 0x3: 0000 00 00 00 04 80 01 69 01 02 03 04 63 65 64 75 72 ┆ i cedur┆