|
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 Tree, seg_04569a
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─⟦5a81ac88f⟧ »Space Info Vol 1« └─⟦this⟧
package body Tree is type Node; type Branch is access Node; type Node is record Value : Element; Left, Right : Branch; end record; Root_Node, Current_Node : Branch; Free_Nodes : Branch := null; Aux_Node : Branch; function New_Node return Branch is Result : Branch; begin if Free_Nodes = null then Result := new Node; else Result := Free_Nodes; Free_Nodes := Free_Nodes.Right; end if; Result.Right := null; Result.Left := null; return Result; end New_Node; procedure Insert_Node (The_Node : in out Branch; X : in Element) is begin if The_Node = null then The_Node := New_Node; The_Node.Value := X; elsif X < The_Node.Value then Insert_Node (The_Node.Left, X); elsif X > The_Node.Value then Insert_Node (The_Node.Right, X); end if; end Insert_Node; procedure Insert (X : in Element) is begin if Root_Node = null then Root_Node := New_Node; Root_Node.Value := X; else Insert_Node (Root_Node, X); end if; end Insert; function Find_Node (The_Node : in Branch; X : in Element) return Boolean is begin if The_Node = null then return False; elsif X < The_Node.Value then return Find_Node (The_Node.Left, X); elsif X > The_Node.Value then return Find_Node (The_Node.Right, X); else Current_Node := The_Node; return True; end if; end Find_Node; function Find (X : in Element) return Boolean is begin return Find_Node (Root_Node, X); end Find; procedure Set_Current_Element (X : in Element) is begin Current_Node.Value := X; end Set_Current_Element; procedure Go_First is begin Current_Node := Root_Node; while Current_Node.Left /= null loop Current_Node := Current_Node.Left; end loop; end Go_First; function Get_Current_Element return Element is begin if Current_Node /= null then return Current_Node.Value; end if; end Get_Current_Element; procedure Go_Left is begin if Current_Node /= null then Current_Node := Current_Node.Left; end if; end Go_Left; procedure Go_Right is begin if Current_Node /= null then Current_Node := Current_Node.Right; end if; end Go_Right; procedure Go_Root is begin Current_Node := Root_Node; end Go_Root; function At_End return Boolean is begin return Current_Node = null; end At_End; begin for I in 1 .. Nb_Preallocation_Node loop Aux_Node := New_Node; Aux_Node.Right := Free_Nodes; Free_Nodes := Aux_Node; end loop; end Tree;
nblk1=7 nid=5 hdr6=8 [0x00] rec0=27 rec1=00 rec2=01 rec3=014 [0x01] rec0=21 rec1=00 rec2=06 rec3=024 [0x02] rec0=2a rec1=00 rec2=04 rec3=008 [0x03] rec0=0b rec1=00 rec2=02 rec3=000 [0x04] rec0=2e rec1=00 rec2=04 rec3=01e [0x05] rec0=17 rec1=00 rec2=05 rec3=000 [0x06] rec0=3e rec1=e4 rec2=00 rec3=028 tail 0x21541bcd0864b345d52cb 0x42a00088462060003 Free Block Chain: 0x5: 0000 00 07 01 b1 00 11 20 20 20 20 65 6e 64 20 47 6f ┆ end Go┆ 0x7: 0000 00 03 00 4e 80 08 6f 64 65 2c 20 58 29 3b 08 00 ┆ N ode, X); ┆ 0x3: 0000 00 00 01 f9 80 14 20 20 70 72 6f 63 65 64 75 72 ┆ procedur┆