task
お互いに電話できるようにいくつかの s を取得しようとしていますが、このlimited with
ことはあまり得意ではないようです..
私は仕様を持っていますsctrain-trains.ads
limited with SCTrain.Stations;
with SCTrain.Travellers, SCTrain.Tracks, Ada.Strings.Unbounded;
use SCTrain.Travellers, SCTrain.Tracks, Ada.Strings.Unbounded;
package SCTrain.Trains is
type my_station_access_t is access all Stations.Station;
task type Train is
entry Start(leaving: my_station_access_t; arriving: my_station_access_t);
end Train;
end SCTrain.Trains;
そしてその.adb
with SCTrain.Stations;
use SCTrain.Stations;
package body SCTrain.Trains is
task body Train is
destination: my_station_access_t;
begin
accept Start(leaving: my_station_access_t; arriving: my_station_access_t) do
destination := arriving;
end Start;
destination.Gogo(1);
end Train;
end SCTrain.Trains;
私が読んでいるドキュメントwith
で、本体に「循環」パッケージを使用するとスムーズに実行できることがわかりましたが、どうやらまだinvalid prefix in selected component "destination"
理由dereference must not be of an incomplete type (RM 3.10.1)
があり、それらのエラーはパッケージ本体にwith
andがなくてもそこにとどまります。use
私は何か、おそらく非常に基本的な何かが欠けていると確信しており、それが何であるかを知りたいと思っています. 私が解決しようとしている問題は、列車が出発を許可され、その後も到着時刻を伝えることができる駅からの信号を必要とすることです。
最新の GNAT-GPL を使用しています。
どうもありがとうございました。
編集:Station
のコードを追加
limited with SCTrain.Trains;
with Ada.Calendar, Ada.Strings.Unbounded, Ada.Text_IO;
use Ada.Calendar, Ada.Strings.Unbounded, Ada.Text_IO;
package SCTrain.Stations is
task type Station is
entry Gogo(name_d : Integer := 0);
end Station;
end SCTrain.Stations;
そして本体:
with SCTrain.Trains;
use SCTrain.Trains;
package body SCTrain.Stations is
task body Station is
name : Integer;
begin
accept Gogo (name_d : Integer := 0) do
name := name_d;
Put_Line("Station " & Integer'Image(name) & " is alive");
end Gogo;
end Station;
end SCTrain.Stations;