with GAda.Text_IO ;
with GAda.Integer_Text_IO ;
with Caracteres ; use Caracteres ;
procedure Mission1 is
package Txt renames GAda.Text_IO ;
package ITxt renames GAda.Integer_Text_IO ;
package Car renames Caracteres ;
procedure Afficher_Trame (Trame : Car.T_Trame) is
begin
for Y in Trame'Range(1) loop
for X in Trame'Range(2) loop
case Trame(Y,X) is
when Car.Allume => Txt.Put("#") ;
when Car.Eteint => Txt.Put(" ") ;
end case ;
end loop ;
Txt.New_Line ;
end loop ;
end Afficher_Trame ;
procedure Tester_Afficher_Trame is
begin
Afficher_Trame(Car.Table(30).Trame) ;
Afficher_Trame(Car.Table(31).Trame) ;
Afficher_Trame(Car.Table(32).Trame) ;
end Tester_Afficher_Trame ;
function Trouver_Trame (Lettre : Character) return Car.T_Trame is
No_Case : Integer ;
Trouve : Boolean ;
begin
Trouve := False ;
No_Case := Car.Table'First ;
while (not Trouve) and No_Case <= Car.Table'Last loop
if Car.Table(No_Case).Car = Lettre then
Trouve := True ;
else
No_Case := No_Case + 1 ;
end if ;
end loop ;
if not Trouve then No_Case := 9 ;
end if ;
return Car.Table(No_Case).Trame ;
end Trouver_Trame ;
procedure Afficher_Mot(Mot : String) is
begin
for NoCase in Mot'Range loop
Afficher_Trame( Trouver_Trame( Mot(NoCase) ) ) ;
end loop ;
end Afficher_Mot ;
No_Car : Integer ;
begin
Txt.Put ("Numéro de caractère à afficher : ") ;
No_Car := ITxt.FGet ;
Txt.Put(Car.Table(No_Car).Car) ;
Tester_Afficher_Trame ;
Afficher_Mot("Sauron en Grèce") ;
end Mission1 ;