Yurttas/PL/IL/Ada-95/F/06/trains/crossroads p.adb

From ZCubes Wiki
Jump to navigation Jump to search
 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-- crossroads_p.adb
15
16
17package body Crossroads_P is
18
19  procedure Approach_Points(T : in Train_Id) is
20  begin
21    Put("...Approach_Points");
22    Put(T);
23    New_Line;
24  end Approach_Points;
25
26  procedure Cross_Points(T : in Train_Id) is
27  begin
28    Put(T);
29    Put_Line(" Crossing_Points");
30  end Cross_Points;
31
32  procedure Go_Away_From_Points(T : in Train_Id) is
33  begin
34    Put("     Go_Away_From_points...");
35    Put(T);
36    New_Line;
37  end Go_Away_From_Points;
38
39  task body Points is
40  begin
41    loop
42      select
43        accept Cross (T : in Train_Id) do
44          Cross_Points(T);
45        end Cross;
46      or terminate;
47      end select;
48    end loop;
49  end Points;
50
51  task body Train is
52  begin
53    loop
54      select
55        accept Go(T : in Train_Id) do
56          Points.Cross(T);
57        end Go;
58      or terminate;
59      end select;
60   end loop;
61  end Train;
62
63end Crossroads_P;