![]() |
Department of
Mathematics and Computer Science |
|
ACS CREATE LIBRARY [JSMITH.ADALIB]
Then you set the library via the command:
ACS SET LIBRARY [JSMITH.ADALIB]
Setting the library must be done for every login session (you can
insert this command into your LOGIN.COM file), although the
library directory need only be created once. Linking is done via
ACS, as in the following example:
[JDOE]> ADA MPADA [JDOE]> ACS LINK MPADA [JDOE]> RUN MPADA
With Text_IO;
Use Text_IO;
Package Int_IO is new Integer_IO(integer);
with int_IO;
use Int_IO;
Procedure Point is
--The following line can also be used in some versions of ADA as the
--header line.
--Package Body Point Is
type node;
type tree is access node;
type node is record
left : tree;
info : integer;
right: tree;
end record;
count:integer; --(* counts the recursive level. *)
numnode:integer;--(* counts the number of nodes created. *)
root:tree;
-- The following instantiation of Integer_IO (contained in
-- Text_IO) is standard. However, in the PC Janus/Ada version,
-- it is not necessary. This process of INSTANTIATION takes the
-- generic template for IO functions, and makes an actual version
-- of it with Integer as the data type used.
Package Int_IO is new Integer_IO(Integer);
Use Int_IO;
--(* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *)
--(* F U N C T I O N G E N T R E E *)
--(* This generates a tree. n is a small positive integer
-- specifying an upper bound on the number of nodes
-- of the tree. The nodes can have two children, and
-- an information field. The information field is
-- given a sequential node number. *)
function gentree(n:integer) return tree is
t : tree;
BEGIN
numnode := numnode + 1;
t := new node'(null,numnode,null);
IF n <=2 THEN t.left := null;
ELSE t.left := gentree(n / 2);
End If;
IF n <= 2 THEN t.right := null;
ELSE t.right := gentree(n / 2);
End If;
return(t);
END;
--(* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *)
--(* P R O C E D U R E T R E E P R I N T *)
--(* The information fields of the nodes of a tree
-- are printed so that the tree is rotated 90 degrees
-- counter-clockwise. The nodes are given proper
-- depths. *)
PROCEDURE treeprint (t:tree) is
BEGIN
count := count + 1;
IF t /= null THEN
treeprint(t.right);
FOR i in 1 .. count loop put(" "); End loop;
Put(t.info); New_line;
treeprint(t.left);
END If;
count := count - 1;
END;
BEGIN
numnode := 0; count := 0; --(* initialization *)
root := gentree(16);
treeprint(root);
END point;
[DSMOLARSKI]> photo
[DSMOLARSKI]> acs set library [dsmolarski.ada]
%ACS-I-CL_LIBIS, Current program library is FACULTY:[DSMOLARSKI.ADA]
[DSMOLARSKI]> ada point
[DSMOLARSKI]> acs link point
%ACS-I-CL_LINKING, Invoking the VAX/VMS Linker
[DSMOLARSKI]> run point
15
13
14
9
12
10
11
1
8
6
7
2
5
3
4
[DSMOLARSKI]> pop
Process DSMOLARSKI_1 logged out at 3-FEB-1988 21:34:43.03
My email address is
dsmolarski@math.scu.edu
This page last updated 25 March 2000.