Difference between revisions of "Yurttas/PL/IL/Ada-95/F/06/trains/trains 03.adb"

From ZCubes Wiki
Jump to navigation Jump to search
(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...")
 
(No difference)

Latest revision as of 05:53, 5 November 2013

 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_03.adb
15
16
17with Ada.Text_IO;
18use Ada.Text_IO;
19
20procedure Trains_03 is
21
22  package Int_IO is new Integer_IO(Integer);
23  use Int_IO;
24
25  Train : Integer := 0;
26
27  procedure Approach_Points is
28  begin
29    Put_Line("...Approach_Points");
30  end Approach_Points;
31
32  procedure Cross_Points is
33  begin
34    Put_Line("   Cross_Points");
35  end Cross_Points;
36
37  procedure Go_Away_From_Points is
38  begin
39    Put_Line("   Go_Away_From_Points...");
40    Train := Train+1;
41    Put(Train);
42    New_Line;
43  end Go_Away_From_Points;
44
45  task Points is
46    entry Enter;
47    entry Leave;
48  end Points;
49
50  task body Points is
51  begin
52    loop
53      accept Enter;
54      accept Leave;
55      exit when Train=2;
56    end loop;
57  end Points;
58
59  task Train1;
60
61  task body Train1 is
62  begin
63    Approach_Points;
64    Points.Enter;
65    Cross_Points;
66    Points.Leave;
67    Go_Away_From_Points;
68  end Train1;
69
70  task Train2;
71
72  task body Train2 is
73  begin
74    Approach_Points;
75    Points.Enter;
76    Cross_Points;
77    Points.Leave;
78    Go_Away_From_Points;
79  end Train2;
80
81begin
82
83  null;
84
85end Trains_03;