2

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)があり、それらのエラーはパッケージ本体にwithandがなくてもそこにとどまります。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;
4

2 に答える 2

0

destinationの宣言をbyに置き換えます。

destination: access Stations.Station;

または問題のある行を次のように置き換えます

destination.all.Gogo(1);

これがコンパイラのバグなのか、それとも適切な動作なのかはわかりません。不審に見える!

その後: 私は comp.lang.ada にさらに削減された例を投稿しました。常駐の専門家の 1 人が、これはバグであることに同意しました。AdaCore に報告します。

于 2013-07-26T18:32:53.640 に答える