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

Revision as of 05:53, 5 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="ada" line start="1" enclose="div">-- -- Copyright(C) 1998 -- All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc.. -- -- Permis...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 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_01.adb
15
16
17with Ada.Text_IO;
18use Ada.Text_IO;
19
20procedure Trains_01 is
21
22  Train : Integer;
23
24  procedure Approach_Points is
25  begin
26    Put_Line("...Approach_Points");
27  end Approach_Points;
28
29  procedure Cross_Points is
30  begin
31    Put_Line("   Cross_Points");
32  end Cross_Points;
33
34  procedure Go_Away_From_Points(T: Integer) is
35  begin
36    Put_Line("   Go_Away_From_Points...");
37    Train := T;
38  end Go_Away_From_Points;
39
40  task Points is
41    entry Enter;
42    entry Leave;
43  end Points;
44
45  task body Points is
46  begin
47    loop
48      accept Enter;
49      accept Leave;
50      exit when Train=2;
51    end loop;
52  end Points;
53
54  task Train1;
55
56  task body Train1 is
57  begin
58    Approach_Points;
59    Points.Enter;
60    Cross_Points;
61    Points.Leave;
62    Go_Away_From_Points(1);
63  end Train1;
64
65  task Train2;
66
67  task body Train2 is
68  begin
69    Approach_Points;
70    Points.Enter;
71    Cross_Points;
72    Points.Leave;
73    Go_Away_From_Points(2);
74  end Train2;
75
76begin
77
78  null;
79
80end Trains_01;