text
stringlengths
0
234
-- Nom : recuperer_chaque_option
-- sémantique : Récupérer les valeurs des options I, A, P et le nom de fichier
-- paramètres :
-- N N : in Integer;
-- vect_arg : in vecteur;
-- iteration : out Integer;
-- alpha : out T_alpha;
-- naive :out Boolean;
-- Nom_fichier : out Unbounded_String ;
-- Pre : True
-- Post : le nom de fichier finit en .net, alpha > 1 and alpha < 0 and iteration > 1
-- Tests : Aucun
-- Exception : voir sous-programme afficher_erreur pour la liste exhaustive
procedure recuperer_chaque_option (N : in Integer;
vect_arg : in vecteur;
iteration : in out Integer;
alpha : in out T_alpha;
naive : in out Boolean;
Nom_fichier : out Unbounded_String) is
-- Nom : detecter_option
-- sémantique : Marquer la lecture d'une option par un indicateur nommé option
-- paramètres :
-- vect_arg : in vecteur; -- vecteur des arguments
-- option : in out Character;
-- i : in Integer; -- iteration courante
-- type de retour : Character;
-- Pre : True
-- Post : detecter_option'Result = 'o' or detecter_option'Result = 'I' or detecter_option'Result = 'P'
-- or detecter_option'Result = 'A'
-- Tests : Aucun
-- Exception : voir sous-programme afficher_erreur avec code d'erreur 2, 1 et 6
procedure detecter_option(vect_arg : in vecteur;i : in Integer; option : in out Character) is
begin
-- Y a-t-il une option valide ?
if length(vect_arg.tableau(i)) /=2 then
Afficher_erreur(2);
else
if option = 'o' then
-- Vérifier qu'une option est possible
case To_String(vect_arg.tableau(i))(2) is
when 'I' => option := 'I';
when 'A' => option :='A';
when 'P' =>
option := 'o';
naive := True;
when others => Afficher_erreur(1);
end case;
else
Afficher_erreur(6);
end if;
end if;
end detecter_option;
-- Nom : Rentrer_alpha
-- sémantique : Obtenir un alpha compatible
-- paramètres :
-- alpha : out T_alpha;
-- nombre_reel : in T_alpha; -- valeur potentielle de alpha
-- indicateur_type : in Character; -- type de l'argument courant
-- option : in Character; -- option rencontrée ?
-- Pre : True
-- Post : alpha > T_alpha(1) and alpha < T_alpha(0) and option = 'o'
-- Tests : Aucun
-- Exception : voir sous-programme afficher_erreur avec code d'erreur 2 et 1
procedure Rentrer_alpha(alpha : in out T_alpha;
nombre_reel : in T_alpha;
indicateur_type : in Character;
option : in out Character) is
begin
if indicateur_type /= 'f' then -- erreur sur le type de alpha
Afficher_erreur(2);
else
alpha := nombre_reel;
-- Demander une saisie robuste entre 0 et 1
while alpha > T_alpha(1) or alpha < T_alpha(0) loop
begin
-- Donner la consigne
Put(" Alpha doit être compris entre 1 et 0 svp : ");
Real_IO.Get(alpha);
Skip_Line;
exception
when ADA.IO_EXCEPTIONS.DATA_ERROR => Skip_Line; -- SI l'utilisateur ne rentre même pas un réel !
Function Definition: function histEQUAL(img: in imge; hist: in histogram) return imge is