今書いてみたヘボサンプルを貼ってみるテスト。 with Ada.Text_IO; procedure Test is task type A_Task is entry Setup(Message: in String); entry Join; end A_Task; task body A_Task is begin Ada.Text_IO.Put_Line("* start!"); accept Setup(Message: in String) do Ada.Text_IO.Put("* "); Ada.Text_IO.Put(Message); Ada.Text_IO.Put_Line("!"); end Setup; loop select accept Join do Ada.Text_IO.Put_Line("* exit!"); end Join; abort A_Task; else Ada.Text_IO.Put("#"); delay 0.1; end select; end loop; end A_Task; type A_Access is access A_Task; A: A_Access; begin Ada.Text_IO.Put_Line("go!"); A := new A_Task; A.Setup("setup"); delay 1.0; A.Join; Ada.Text_IO.Put_Line("end!"); end Test;
with Ada.Text_IO; procedure Test2 is begin select delay 1.0; then abort loop Ada.Text_IO.Put("*"); delay 0.1; end loop; end select; end Test2; 条件を満たしたらthen abort以下の処理を強制中断するとか…こんな機能あっても使うのか? RM読んでたら、並列処理関係はほんとのほんとに無駄に機能豊富。
Beagle 2: www.xgc.com/news/2000.htm The Beagle 2 Mars lander, using ERC32 Ada, successfully separated from Mars Express and started its descent to the red planet.
456 名前:デフォルトの名無しさん [04/11/20 00:27:35]
Atlas V: www.ddci.com/programs_atlasv.shtml Lockheed Martin Space Systems depends on TADS to develop modern, object-oriented real-time flight control software for the new Atlas V launch vehicle.
The maiden voyage of Lockheed Martin’s first Atlas V rocket lifted off from Space Launch Complex 41 at Cape Canaveral on August 12, 2002, freed from its earthly bonds by flight control software created with DDC-I’s Tartan Ada Development System (TADS).
正解の n番目の数を n番目に解答していれば, Hit と呼ぶ. Hit の個数がヒントとして提示される. 正解の n番目の数を m番目(n≠m)に解答していれば, Blow と呼ぶ. Blow の個数がヒントとして提示される.
469 名前:作ってみたその1 mailto:sage [04/12/01 00:02:43]
with Ada.Numerics.Discrete_Random,Ada.Text_Io,Ada.Integer_Text_Io,Ada.Calendar; use Ada.Text_Io,Ada.Integer_Text_Io,Ada.Calendar; procedure game Is package R Is New Ada.Numerics.Discrete_Random(natural); use R; type Four_Array is array(1..4)of Integer; function Generate Return Integer is seed:Generator; begin Reset(seed,Integer(Seconds(Clock)*100)); return Random(Seed) mod 10; end Generate; function Search(Target:Four_array;Seed:In Integer) Return integer Is begin for I in 1..4 loop if Target(I) = Seed then return i; end if; end loop; return 0; end Search; procedure Initialize(computer:In out Four_array) is begin for I in 1..4 loop computer(I):=-1; end loop; end initialize;
470 名前:作ってみたその2/3 mailto:sage [04/12/01 00:08:55]
procedure Decide(computer:in out Four_array) Is int:Integer; begin Initialize(Computer); for I in 1..4 Loop loop Int:=Generate;exit when Search(computer,Int) = 0; end loop; Computer(I):=Int;delay 0.01; end loop; end Decide; procedure Read(Player:in out Four_array) is int,Index:Integer:=1;Char:character; begin while Index <= 4 Loop Get_Immediate(char); case Char is when '0'..'9' => Int:=Character'Pos(char)-16#30#; if Search(Player,int) /= 0 then New_Line;Put_Line("その値はもう使えません"); for I in 1..Index-1 loop Put(Character'Val(Player(i)+16#30#)); end loop; else Put(char);Player(index):=int;Index:=Index+1; end if; when others => New_Line;Put_Line("0から9までの数値を入れてください"); for I in 1..Index-1 Loop Put(Character'Val(Player(I)+16#30#)); end loop; end case; end loop; end Read;
471 名前:作ってみたその3/3 mailto:sage [04/12/01 00:09:44]
function Compare(computer,Player:in Four_array) return Boolean is Hit_Count:Integer:=0; Blow_Count:Integer:=0; Search_Result:integer; begin for I In 1..4 Loop Search_Result:=Search(Computer,Player(i)); if Search_Result = I Then Hit_Count:=Hit_Count+1; elsif Search_result /= 0 then Blow_Count:=Blow_Count+1; end if; end loop; New_Line; Put_Line("Hit : "&Integer'Image(Hit_count)); Put_Line("Blow : "&Integer'Image(Blow_count)); if Hit_Count = 4 then return True; end if; return False; end Compare; computer,player:Four_Array; begin Decide(computer); loop Initialize(player); Read(Player); exit when Compare(computer,Player); end loop; end game;
LogicaCMG designed the Huygens software using the hierarchical object-oriented design (Hood) method and then developed it in Ada 83, a general-purpose programming language developed by the US Department of Defence to help software designers develop large, reliable applications.