1--
2-- Copyright(C) 1998
3-- All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
4--
5-- Permission to use, copy, modify, and distribute this
6-- software and its documentation for EDUCATIONAL purposes
7-- and without fee is hereby granted provided that this
8-- copyright notice appears in all copies.
9--
10
11-- date : January 1, 1998.
12-- authorĀ : Salih Yurttas.
13
14-- trains_11.adb
15
16
17with Ada.Text_IO;
18use Ada.Text_IO;
19
20procedure Trains_11 is
21
22 package IO is new Integer_IO(Integer);
23 use IO;
24
25 T : Integer := 0;
26
27 task Points is
28 entry Cross(T : in Integer);
29 end Points;
30
31 task type Train;
32
33 TA : array(1..3) of Train;
34
35 procedure Approach_Points(T : in Integer) is
36 begin
37 Put("...Approach_Points");
38 Put(T);
39 New_Line;
40 end Approach_Points;
41
42 procedure Cross_Points(T : in Integer) is
43 begin
44 Put(T);
45 Put_Line(" Crossing_Points");
46 end Cross_Points;
47
48 procedure Go_Away_From_Points(T : in Integer) is
49 begin
50 Put(" Go_Away_From_Points...");
51 Put(T);
52 New_Line;
53 end Go_Away_From_Points;
54
55 task body Points is
56 begin
57 loop
58 select
59 accept Cross(T : in Integer) do
60 Cross_Points(T);
61 end Cross;
62 or terminate;
63 end select;
64 end loop;
65 end Points;
66
67 task body Train is
68 begin
69 T := T+1;
70 Approach_Points(T);
71 TA(T).Points.Cross(T);
72 Go_Away_From_Points(T);
73 end Train;
74
75begin
76
77 null;
78
79end Trains_11;