This commit is contained in:
Laureηt 2023-06-10 21:03:54 +02:00
commit 3ca566604f
Signed by: Laurent
SSH key fingerprint: SHA256:kZEpW8cMJ54PDeCvOhzreNr4FSh6R13CMGH/POoO8DI
95 changed files with 9184 additions and 0 deletions

7
td07/afficher_un_entier.adb Executable file
View file

@ -0,0 +1,7 @@
with Ada.Integer_Text_IO;
procedure Afficher_Un_Entier (N: in Integer) is
begin
Ada.Integer_Text_IO.Put (N, 1);
end Afficher_Un_Entier;

4
td07/afficher_un_entier.ads Executable file
View file

@ -0,0 +1,4 @@
-- Afficher l'entier N sur la sortie standard.
-- Cette procédure s'appuie sur Ada.Integer_Text_IO.Put mais permet d'avoir
-- une procédure avec un seul paramètre.
procedure Afficher_Un_Entier (N: in Integer);

24
td07/exemple_1.adb Executable file
View file

@ -0,0 +1,24 @@
with text_io; use text_io;
with ada.integer_text_io; use ada.integer_text_io;
procedure Exemple_1 is
-- spécification volontairement omise !
procedure Lire_Entier (Fvaleur : out Integer) is
begin
Put_Line ("Début lire_entier");
Get (Fvaleur);
Put_Line ("Fin lire_entier");
exception
when Data_Error => Put_Line ("Erreur de saisie dans lire_entier");
end Lire_Entier;
-- Programme principal
Nb : Integer; -- le nombre à lire
begin
Put_Line ("Début instructions du programme Exemple 1");
Lire_Entier (Nb);
Put_Line ("Fin instructions du programme Exemple 1");
end Exemple_1;

23
td07/exemple_2.adb Executable file
View file

@ -0,0 +1,23 @@
with text_io; use text_io;
with ada.integer_text_io; use ada.integer_text_io;
procedure Exemple_2 is
-- spécification volontairement omise !
procedure Lire_Entier (Fvaleur : out Integer) is
begin
Put_Line ("Début de lire_entier");
Get (Fvaleur);
Put_Line ("Fin de lire_entier");
end lire_entier;
-- Programme principal
Nb : Integer; -- le nombre à lire
begin
Put_Line ("Début de Exemple_2");
lire_entier (nb);
Put_Line ("Fin de Exemple_2");
exception
when Data_Error => Put_Line ("Erreur de saisie");
end Exemple_2;

32
td07/exemple_3.adb Executable file
View file

@ -0,0 +1,32 @@
with text_io; use text_io;
with ada.integer_text_io; use ada.integer_text_io;
procedure Exemple_3 is
-- spécification volontairement omise !
procedure lire_entier (Fvaleur : out Integer) is
-- spécification volontairement omise !
procedure Lire_Interne (Fvaleur_Interne : out Integer) is
begin
Put_Line ("Début de Lire_Interne");
Get (Fvaleur_Interne);
Put_Line ("Fin de Lire_Interne");
end lire_interne;
begin
Put_Line ("Début de lire_entier");
lire_interne (Fvaleur);
Put_Line ("Fin de lire_entier");
exception
when Data_Error => Put_Line ("Erreur de saisie dans Lire_Entier");
end lire_entier;
-- Programme principal
Nb: Integer; -- le nombre à lire
begin
Put_Line ("Début de exemple_3");
Lire_Entier (Nb);
Put_Line ("Fin de exemple_3");
end Exemple_3;

33
td07/exemple_4.adb Executable file
View file

@ -0,0 +1,33 @@
with text_io; use text_io;
with ada.integer_text_io; use ada.integer_text_io;
procedure Exemple_4 is
-- spécification volontairement omise !
procedure Lire_Entier (Fvaleur : out Integer) is
-- spécification volontairement omise !
procedure Lire_Interne (Fvaleur_Interne : out Integer) is
begin
Put_Line ("Début de Lire_Interne");
Get (Fvaleur_Interne);
Put_Line ("Fin de Lire_Interne");
end lire_interne;
begin
Put_Line ("Début de lire_entier");
Lire_Interne (Fvaleur);
Put_Line ("Fin de lire_entier");
end lire_entier;
-- Programme principal
Nb : Integer; -- le nombre à lire
begin
Put_Line ("Début de exemple_4");
Lire_Entier (Nb);
Put_Line ("Fin de exemple_4");
exception
when Data_Error => Put_Line ("Erreur de saisie");
end Exemple_4;

26
td07/exemple_5.adb Executable file
View file

@ -0,0 +1,26 @@
with text_io; use text_io;
with ada.integer_text_io; use ada.integer_text_io;
procedure Exemple_5 is
-- spécification volontairement omise !
procedure Lire_Entier (valeur : out Integer) is
begin
Put_Line ("Début lire_entier");
Get (valeur);
Put_Line ("Fin lire_entier");
exception
when Data_Error =>
Put_Line ("Erreur de saisie dans lire_entier");
Skip_Line;
Lire_Entier (valeur);
end Lire_Entier;
-- Programme principal
Nb : Integer; -- le nombre à lire
begin
Put_Line ("Début de Exemple_5");
Lire_Entier (nb);
Put_Line ("Fin de Exemple_5");
end Exemple_5;

62
td07/piles.adb Executable file
View file

@ -0,0 +1,62 @@
-- Implantation du module Piles.
with Ada.Text_IO; use Ada.Text_IO;
--! Ce module est nécessaire parce qu'on a ajouté le SP Afficher.
package body Piles is
procedure Initialiser (Pile : out T_Pile) is
begin
Pile.Taille := 0;
end Initialiser;
function Est_Vide (Pile : in T_Pile) return Boolean is
begin
return Pile.Taille = 0;
end Est_Vide;
function Est_Pleine (Pile : in T_Pile) return Boolean is
begin
return Pile.Taille >= Capacite;
end Est_Pleine;
function Sommet (Pile : in T_Pile) return T_Element is
begin
return Pile.Elements (Pile.Taille);
end Sommet;
procedure Empiler (Pile : in out T_Pile; Element : in T_Element) is
begin
Pile.Taille := Pile.Taille + 1;
Pile.Elements (Pile.Taille) := Element;
end Empiler;
procedure Depiler (Pile : in out T_Pile) is
begin
Pile.Taille := Pile.Taille - 1;
end Depiler;
procedure Afficher (Pile : in T_Pile) is
begin
Put ('[');
if not Est_Vide (Pile) then
Put (' ');
Afficher_Element (Pile.Elements (1));
for I in 2..Pile.Taille loop
Put (", ");
Afficher_Element (Pile.Elements (I));
end loop;
else
Null;
end if;
Put (" >");
end Afficher;
end Piles;

58
td07/piles.ads Executable file
View file

@ -0,0 +1,58 @@
-- Spécification du module Piles.
generic
Capacite : Integer; -- Nombre maximal d'éléments qu'une pile peut contenir
type T_Element is private; -- Type des éléments de la pile
package Piles is
type T_Pile is limited private; --! "très privé" en Algorithmique !
--! Sur un type privé, on a droit à l'affectation (:=) et l'égalité (=).
--! On perd ces opérations avec un type "limited private" (très privé).
-- Initilaiser une pile. La pile est vide.
procedure Initialiser (Pile : out T_Pile) with
Post => Est_Vide (Pile);
-- Est-ce que la pile est vide ?
function Est_Vide (Pile : in T_Pile) return Boolean;
-- Est-ce que la pile est pleine ?
function Est_Pleine (Pile : in T_Pile) return Boolean;
-- L'élément en sommet de la pile.
function Sommet (Pile : in T_Pile) return T_Element with
Pre => not Est_Vide (Pile);
-- Empiler l'élément en somment de la pile.
procedure Empiler (Pile : in out T_Pile; Element : in T_Element) with
Pre => not Est_Pleine (Pile),
Post => Sommet (Pile) = Element;
-- Supprimer l'élément en sommet de pile
procedure Depiler (Pile : in out T_Pile) with
Pre => not Est_Vide (Pile);
-- Afficher les éléments de la pile
generic
with procedure Afficher_Element (Un_Element: in T_Element);
procedure Afficher (Pile : in T_Pile);
private
type T_Tab_Elements is array (1..Capacite) of T_Element;
type T_Pile is
record
Elements : T_Tab_Elements; -- les éléments de la pile
Taille: Integer; -- Nombre d'éléments dans la pile
end record;
end Piles;

9
td07/saisir_pile_robuste.adb Executable file
View file

@ -0,0 +1,9 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Piles;
with Afficher_Un_Entier;
procedure Saisir_Pile_Robuste is
end Saisir_Pile_Robuste;

23
td07/somme.adb Executable file
View file

@ -0,0 +1,23 @@
with ada.text_io; use ada.text_io;
with ada.integer_text_io; use ada.integer_text_io;
-- Calculer la somme d'une suite d'entiers lus clavier. L'entier 0 marque la
-- fin de la ©rie. Il n'en fait pas partie.
procedure Somme is
Somme: Integer; -- la somme de valeurs lues au clavier
Val: Integer; -- valeur lue au clavier
begin
-- calculer la somme d'une suite de valeurs entières, se terminant par 0
Somme := 0;
loop
Put_Line ("Entrez une valeur entière ");
Get (val);
Somme := Somme + Val;
exit when Val = 0;
end loop;
-- afficher la somme
Put ("la somme vaut : ");
Put (somme);
New_Line;
end Somme;

24
td07/td07.gpr Executable file
View file

@ -0,0 +1,24 @@
project TD07 is
for Main use ("exemple_1.adb",
"exemple_2.adb",
"exemple_3.adb",
"exemple_4.adb",
"exemple_5.adb",
"somme.adb",
"saisir_pile_robuste.adb",
"test_piles.adb");
package Builder is
for Default_Switches ("ada") use ("-s");
end Builder;
package Compiler is
for Default_Switches ("ada") use ("-gnatwa", "-gnata", "-g");
end Compiler;
package Binder is
for Default_Switches ("ada") use ("-E");
end Binder;
end TD07;

109
td07/test_piles.adb Executable file
View file

@ -0,0 +1,109 @@
with Piles;
-- Programme de test du module Pile.
procedure Test_Piles is
package Pile_Caractere is
new Piles (Capacite => 3, T_Element => Character);
use Pile_Caractere;
-- Initialiser une pile avec 'O' puis 'K' empilés dans la pile vide.
procedure Initialiser_Avec_OK (Pile : out T_Pile) is
begin
Initialiser (Pile);
Empiler (Pile, 'O');
Empiler (Pile, 'K');
end Initialiser_Avec_OK;
procedure Tester_Est_Vide is
Pile1, Pile2 : T_Pile;
begin
Initialiser (Pile1);
pragma Assert (Est_Vide (Pile1));
Empiler (Pile1, 'A');
pragma Assert (not Est_Vide (Pile1));
Initialiser_Avec_OK (Pile2);
pragma Assert (not Est_Vide (Pile2));
end Tester_Est_Vide;
procedure Tester_Empiler is
Pile1 : T_Pile;
begin
Initialiser_Avec_OK (Pile1);
pragma Assert (not Est_Pleine (Pile1));
Empiler (Pile1, 'N');
pragma Assert ('N' = Sommet (Pile1));
pragma Assert (Est_Pleine (Pile1));
end Tester_Empiler;
procedure Tester_Depiler is
Pile1 : T_Pile;
begin
Initialiser_Avec_OK (Pile1);
Depiler (Pile1);
pragma Assert ('O' = Sommet (Pile1));
Depiler (Pile1);
pragma Assert (Est_Vide (Pile1));
end Tester_Depiler;
procedure Tester_Depiler_Pile_Vide_Exception is
Pile : T_Pile;
begin
Initialiser (Pile);
Depiler (Pile);
pragma Assert (False); --! On ne devrait pas arriver ici !
exception
when Pile_Vide_Error =>
null; --! C'est bien l'exception attendue !
when others =>
pragma Assert (False); --! Ce n'est pas l'exception attendue !
end Tester_Depiler_Pile_Vide_Exception;
procedure Tester_Sommet_Pile_Vide_Exception is
Pile : T_Pile;
Element: Character;
begin
Initialiser (Pile);
Element := Sommet (Pile);
pragma Assert (False); --! On ne devrait pas arriver ici !
pragma Assert ('0' = Element); --! Pour éviter le message d'avertissement !
exception
when Pile_Vide_Error =>
null; --! C'est bien l'exception attendue !
when others =>
pragma Assert (False); --! Ce n'est pas l'exception attendue !
end Tester_Sommet_Pile_Vide_Exception;
procedure Tester_Empiler_Pile_Pleine_Exception is
Pile : T_Pile;
begin
Initialiser (Pile);
loop
Empiler (Pile, 'x');
end loop;
exception
when Pile_Pleine_Error =>
null; --! C'est bien l'exception attendue !
when others =>
pragma Assert (False); --! Ce n'est pas l'exception attendue !
end Tester_Empiler_Pile_Pleine_Exception;
begin
Tester_Est_Vide;
Tester_Empiler;
Tester_Depiler;
Tester_Depiler_Pile_Vide_Exception;
Tester_Sommet_Pile_Vide_Exception;
Tester_Empiler_Pile_Pleine_Exception;
end Test_Piles;

255
td08/b__tester_listes.adb Executable file
View file

@ -0,0 +1,255 @@
pragma Warnings (Off);
pragma Ada_95;
pragma Source_File_Name (ada_main, Spec_File_Name => "b__tester_listes.ads");
pragma Source_File_Name (ada_main, Body_File_Name => "b__tester_listes.adb");
pragma Suppress (Overflow_Check);
with Ada.Exceptions;
package body ada_main is
E073 : Short_Integer; pragma Import (Ada, E073, "system__os_lib_E");
E011 : Short_Integer; pragma Import (Ada, E011, "system__soft_links_E");
E023 : Short_Integer; pragma Import (Ada, E023, "system__exception_table_E");
E068 : Short_Integer; pragma Import (Ada, E068, "ada__io_exceptions_E");
E053 : Short_Integer; pragma Import (Ada, E053, "ada__strings_E");
E038 : Short_Integer; pragma Import (Ada, E038, "ada__containers_E");
E025 : Short_Integer; pragma Import (Ada, E025, "system__exceptions_E");
E055 : Short_Integer; pragma Import (Ada, E055, "ada__strings__maps_E");
E059 : Short_Integer; pragma Import (Ada, E059, "ada__strings__maps__constants_E");
E043 : Short_Integer; pragma Import (Ada, E043, "interfaces__c_E");
E019 : Short_Integer; pragma Import (Ada, E019, "system__soft_links__initialize_E");
E079 : Short_Integer; pragma Import (Ada, E079, "system__object_reader_E");
E048 : Short_Integer; pragma Import (Ada, E048, "system__dwarf_lines_E");
E037 : Short_Integer; pragma Import (Ada, E037, "system__traceback__symbolic_E");
E103 : Short_Integer; pragma Import (Ada, E103, "ada__tags_E");
E101 : Short_Integer; pragma Import (Ada, E101, "ada__streams_E");
E115 : Short_Integer; pragma Import (Ada, E115, "system__file_control_block_E");
E114 : Short_Integer; pragma Import (Ada, E114, "system__finalization_root_E");
E112 : Short_Integer; pragma Import (Ada, E112, "ada__finalization_E");
E111 : Short_Integer; pragma Import (Ada, E111, "system__file_io_E");
E099 : Short_Integer; pragma Import (Ada, E099, "ada__text_io_E");
E137 : Short_Integer; pragma Import (Ada, E137, "system__assertions_E");
E135 : Short_Integer; pragma Import (Ada, E135, "listes_E");
Sec_Default_Sized_Stacks : array (1 .. 1) of aliased System.Secondary_Stack.SS_Stack (System.Parameters.Runtime_Default_Sec_Stack_Size);
Local_Priority_Specific_Dispatching : constant String := "";
Local_Interrupt_States : constant String := "";
Is_Elaborated : Boolean := False;
procedure finalize_library is
begin
E099 := E099 - 1;
declare
procedure F1;
pragma Import (Ada, F1, "ada__text_io__finalize_spec");
begin
F1;
end;
declare
procedure F2;
pragma Import (Ada, F2, "system__file_io__finalize_body");
begin
E111 := E111 - 1;
F2;
end;
declare
procedure Reraise_Library_Exception_If_Any;
pragma Import (Ada, Reraise_Library_Exception_If_Any, "__gnat_reraise_library_exception_if_any");
begin
Reraise_Library_Exception_If_Any;
end;
end finalize_library;
procedure adafinal is
procedure s_stalib_adafinal;
pragma Import (C, s_stalib_adafinal, "system__standard_library__adafinal");
procedure Runtime_Finalize;
pragma Import (C, Runtime_Finalize, "__gnat_runtime_finalize");
begin
if not Is_Elaborated then
return;
end if;
Is_Elaborated := False;
Runtime_Finalize;
s_stalib_adafinal;
end adafinal;
type No_Param_Proc is access procedure;
procedure adainit is
Main_Priority : Integer;
pragma Import (C, Main_Priority, "__gl_main_priority");
Time_Slice_Value : Integer;
pragma Import (C, Time_Slice_Value, "__gl_time_slice_val");
WC_Encoding : Character;
pragma Import (C, WC_Encoding, "__gl_wc_encoding");
Locking_Policy : Character;
pragma Import (C, Locking_Policy, "__gl_locking_policy");
Queuing_Policy : Character;
pragma Import (C, Queuing_Policy, "__gl_queuing_policy");
Task_Dispatching_Policy : Character;
pragma Import (C, Task_Dispatching_Policy, "__gl_task_dispatching_policy");
Priority_Specific_Dispatching : System.Address;
pragma Import (C, Priority_Specific_Dispatching, "__gl_priority_specific_dispatching");
Num_Specific_Dispatching : Integer;
pragma Import (C, Num_Specific_Dispatching, "__gl_num_specific_dispatching");
Main_CPU : Integer;
pragma Import (C, Main_CPU, "__gl_main_cpu");
Interrupt_States : System.Address;
pragma Import (C, Interrupt_States, "__gl_interrupt_states");
Num_Interrupt_States : Integer;
pragma Import (C, Num_Interrupt_States, "__gl_num_interrupt_states");
Unreserve_All_Interrupts : Integer;
pragma Import (C, Unreserve_All_Interrupts, "__gl_unreserve_all_interrupts");
Exception_Tracebacks : Integer;
pragma Import (C, Exception_Tracebacks, "__gl_exception_tracebacks");
Detect_Blocking : Integer;
pragma Import (C, Detect_Blocking, "__gl_detect_blocking");
Default_Stack_Size : Integer;
pragma Import (C, Default_Stack_Size, "__gl_default_stack_size");
Default_Secondary_Stack_Size : System.Parameters.Size_Type;
pragma Import (C, Default_Secondary_Stack_Size, "__gnat_default_ss_size");
Leap_Seconds_Support : Integer;
pragma Import (C, Leap_Seconds_Support, "__gl_leap_seconds_support");
Bind_Env_Addr : System.Address;
pragma Import (C, Bind_Env_Addr, "__gl_bind_env_addr");
procedure Runtime_Initialize (Install_Handler : Integer);
pragma Import (C, Runtime_Initialize, "__gnat_runtime_initialize");
Finalize_Library_Objects : No_Param_Proc;
pragma Import (C, Finalize_Library_Objects, "__gnat_finalize_library_objects");
Binder_Sec_Stacks_Count : Natural;
pragma Import (Ada, Binder_Sec_Stacks_Count, "__gnat_binder_ss_count");
Default_Sized_SS_Pool : System.Address;
pragma Import (Ada, Default_Sized_SS_Pool, "__gnat_default_ss_pool");
begin
if Is_Elaborated then
return;
end if;
Is_Elaborated := True;
Main_Priority := -1;
Time_Slice_Value := -1;
WC_Encoding := 'b';
Locking_Policy := ' ';
Queuing_Policy := ' ';
Task_Dispatching_Policy := ' ';
Priority_Specific_Dispatching :=
Local_Priority_Specific_Dispatching'Address;
Num_Specific_Dispatching := 0;
Main_CPU := -1;
Interrupt_States := Local_Interrupt_States'Address;
Num_Interrupt_States := 0;
Unreserve_All_Interrupts := 0;
Exception_Tracebacks := 1;
Detect_Blocking := 0;
Default_Stack_Size := -1;
Leap_Seconds_Support := 0;
ada_main'Elab_Body;
Default_Secondary_Stack_Size := System.Parameters.Runtime_Default_Sec_Stack_Size;
Binder_Sec_Stacks_Count := 1;
Default_Sized_SS_Pool := Sec_Default_Sized_Stacks'Address;
Runtime_Initialize (1);
Finalize_Library_Objects := finalize_library'access;
System.Soft_Links'Elab_Spec;
System.Exception_Table'Elab_Body;
E023 := E023 + 1;
Ada.Io_Exceptions'Elab_Spec;
E068 := E068 + 1;
Ada.Strings'Elab_Spec;
E053 := E053 + 1;
Ada.Containers'Elab_Spec;
E038 := E038 + 1;
System.Exceptions'Elab_Spec;
E025 := E025 + 1;
System.Os_Lib'Elab_Body;
E073 := E073 + 1;
Ada.Strings.Maps'Elab_Spec;
Ada.Strings.Maps.Constants'Elab_Spec;
E059 := E059 + 1;
Interfaces.C'Elab_Spec;
System.Soft_Links.Initialize'Elab_Body;
E019 := E019 + 1;
E011 := E011 + 1;
E055 := E055 + 1;
E043 := E043 + 1;
System.Object_Reader'Elab_Spec;
System.Dwarf_Lines'Elab_Spec;
E048 := E048 + 1;
System.Traceback.Symbolic'Elab_Body;
E037 := E037 + 1;
E079 := E079 + 1;
Ada.Tags'Elab_Spec;
Ada.Tags'Elab_Body;
E103 := E103 + 1;
Ada.Streams'Elab_Spec;
E101 := E101 + 1;
System.File_Control_Block'Elab_Spec;
E115 := E115 + 1;
System.Finalization_Root'Elab_Spec;
E114 := E114 + 1;
Ada.Finalization'Elab_Spec;
E112 := E112 + 1;
System.File_Io'Elab_Body;
E111 := E111 + 1;
Ada.Text_Io'Elab_Spec;
Ada.Text_Io'Elab_Body;
E099 := E099 + 1;
System.Assertions'Elab_Spec;
E137 := E137 + 1;
E135 := E135 + 1;
end adainit;
procedure Ada_Main_Program;
pragma Import (Ada, Ada_Main_Program, "_ada_tester_listes");
function main
(argc : Integer;
argv : System.Address;
envp : System.Address)
return Integer
is
procedure Initialize (Addr : System.Address);
pragma Import (C, Initialize, "__gnat_initialize");
procedure Finalize;
pragma Import (C, Finalize, "__gnat_finalize");
SEH : aliased array (1 .. 2) of Integer;
Ensure_Reference : aliased System.Address := Ada_Main_Program_Name'Address;
pragma Volatile (Ensure_Reference);
begin
gnat_argc := argc;
gnat_argv := argv;
gnat_envp := envp;
Initialize (SEH'Address);
adainit;
Ada_Main_Program;
adafinal;
Finalize;
return (gnat_exit_status);
end;
-- BEGIN Object file/option list
-- /home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation impérative/tp/td08/listes.o
-- /home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation impérative/tp/td08/tester_listes.o
-- -L/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation impérative/tp/td08/
-- -L/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation impérative/tp/td08/
-- -L/usr/lib/gcc/x86_64-linux-gnu/9/adalib/
-- -shared
-- -lgnat-9
-- -ldl
-- END Object file/option list
end ada_main;

461
td08/b__tester_listes.ads Executable file
View file

@ -0,0 +1,461 @@
pragma Warnings (Off);
pragma Ada_95;
with System;
with System.Parameters;
with System.Secondary_Stack;
package ada_main is
gnat_argc : Integer;
gnat_argv : System.Address;
gnat_envp : System.Address;
pragma Import (C, gnat_argc);
pragma Import (C, gnat_argv);
pragma Import (C, gnat_envp);
gnat_exit_status : Integer;
pragma Import (C, gnat_exit_status);
GNAT_Version : constant String :=
"GNAT Version: 9.3.0" & ASCII.NUL;
pragma Export (C, GNAT_Version, "__gnat_version");
Ada_Main_Program_Name : constant String := "_ada_tester_listes" & ASCII.NUL;
pragma Export (C, Ada_Main_Program_Name, "__gnat_ada_main_program_name");
procedure adainit;
pragma Export (C, adainit, "adainit");
procedure adafinal;
pragma Export (C, adafinal, "adafinal");
function main
(argc : Integer;
argv : System.Address;
envp : System.Address)
return Integer;
pragma Export (C, main, "main");
type Version_32 is mod 2 ** 32;
u00001 : constant Version_32 := 16#5538137e#;
pragma Export (C, u00001, "tester_listesB");
u00002 : constant Version_32 := 16#050ff2f0#;
pragma Export (C, u00002, "system__standard_libraryB");
u00003 : constant Version_32 := 16#4113f22b#;
pragma Export (C, u00003, "system__standard_libraryS");
u00004 : constant Version_32 := 16#76789da1#;
pragma Export (C, u00004, "adaS");
u00005 : constant Version_32 := 16#9762c9f2#;
pragma Export (C, u00005, "ada__exceptionsB");
u00006 : constant Version_32 := 16#585ef86b#;
pragma Export (C, u00006, "ada__exceptionsS");
u00007 : constant Version_32 := 16#5726abed#;
pragma Export (C, u00007, "ada__exceptions__last_chance_handlerB");
u00008 : constant Version_32 := 16#41e5552e#;
pragma Export (C, u00008, "ada__exceptions__last_chance_handlerS");
u00009 : constant Version_32 := 16#4635ec04#;
pragma Export (C, u00009, "systemS");
u00010 : constant Version_32 := 16#ae860117#;
pragma Export (C, u00010, "system__soft_linksB");
u00011 : constant Version_32 := 16#0336e7b2#;
pragma Export (C, u00011, "system__soft_linksS");
u00012 : constant Version_32 := 16#f32b4133#;
pragma Export (C, u00012, "system__secondary_stackB");
u00013 : constant Version_32 := 16#03a1141d#;
pragma Export (C, u00013, "system__secondary_stackS");
u00014 : constant Version_32 := 16#86dbf443#;
pragma Export (C, u00014, "system__parametersB");
u00015 : constant Version_32 := 16#0ed9b82f#;
pragma Export (C, u00015, "system__parametersS");
u00016 : constant Version_32 := 16#ced09590#;
pragma Export (C, u00016, "system__storage_elementsB");
u00017 : constant Version_32 := 16#6bf6a600#;
pragma Export (C, u00017, "system__storage_elementsS");
u00018 : constant Version_32 := 16#75bf515c#;
pragma Export (C, u00018, "system__soft_links__initializeB");
u00019 : constant Version_32 := 16#5697fc2b#;
pragma Export (C, u00019, "system__soft_links__initializeS");
u00020 : constant Version_32 := 16#41837d1e#;
pragma Export (C, u00020, "system__stack_checkingB");
u00021 : constant Version_32 := 16#c88a87ec#;
pragma Export (C, u00021, "system__stack_checkingS");
u00022 : constant Version_32 := 16#34742901#;
pragma Export (C, u00022, "system__exception_tableB");
u00023 : constant Version_32 := 16#1b9b8546#;
pragma Export (C, u00023, "system__exception_tableS");
u00024 : constant Version_32 := 16#ce4af020#;
pragma Export (C, u00024, "system__exceptionsB");
u00025 : constant Version_32 := 16#2e5681f2#;
pragma Export (C, u00025, "system__exceptionsS");
u00026 : constant Version_32 := 16#69416224#;
pragma Export (C, u00026, "system__exceptions__machineB");
u00027 : constant Version_32 := 16#d27d9682#;
pragma Export (C, u00027, "system__exceptions__machineS");
u00028 : constant Version_32 := 16#aa0563fc#;
pragma Export (C, u00028, "system__exceptions_debugB");
u00029 : constant Version_32 := 16#38bf15c0#;
pragma Export (C, u00029, "system__exceptions_debugS");
u00030 : constant Version_32 := 16#6c2f8802#;
pragma Export (C, u00030, "system__img_intB");
u00031 : constant Version_32 := 16#44ee0cc6#;
pragma Export (C, u00031, "system__img_intS");
u00032 : constant Version_32 := 16#39df8c17#;
pragma Export (C, u00032, "system__tracebackB");
u00033 : constant Version_32 := 16#181732c0#;
pragma Export (C, u00033, "system__tracebackS");
u00034 : constant Version_32 := 16#9ed49525#;
pragma Export (C, u00034, "system__traceback_entriesB");
u00035 : constant Version_32 := 16#466e1a74#;
pragma Export (C, u00035, "system__traceback_entriesS");
u00036 : constant Version_32 := 16#448e9548#;
pragma Export (C, u00036, "system__traceback__symbolicB");
u00037 : constant Version_32 := 16#c84061d1#;
pragma Export (C, u00037, "system__traceback__symbolicS");
u00038 : constant Version_32 := 16#179d7d28#;
pragma Export (C, u00038, "ada__containersS");
u00039 : constant Version_32 := 16#701f9d88#;
pragma Export (C, u00039, "ada__exceptions__tracebackB");
u00040 : constant Version_32 := 16#20245e75#;
pragma Export (C, u00040, "ada__exceptions__tracebackS");
u00041 : constant Version_32 := 16#5ab55268#;
pragma Export (C, u00041, "interfacesS");
u00042 : constant Version_32 := 16#769e25e6#;
pragma Export (C, u00042, "interfaces__cB");
u00043 : constant Version_32 := 16#467817d8#;
pragma Export (C, u00043, "interfaces__cS");
u00044 : constant Version_32 := 16#e865e681#;
pragma Export (C, u00044, "system__bounded_stringsB");
u00045 : constant Version_32 := 16#31c8cd1d#;
pragma Export (C, u00045, "system__bounded_stringsS");
u00046 : constant Version_32 := 16#0062635e#;
pragma Export (C, u00046, "system__crtlS");
u00047 : constant Version_32 := 16#bba79bcb#;
pragma Export (C, u00047, "system__dwarf_linesB");
u00048 : constant Version_32 := 16#9a78d181#;
pragma Export (C, u00048, "system__dwarf_linesS");
u00049 : constant Version_32 := 16#5b4659fa#;
pragma Export (C, u00049, "ada__charactersS");
u00050 : constant Version_32 := 16#8f637df8#;
pragma Export (C, u00050, "ada__characters__handlingB");
u00051 : constant Version_32 := 16#3b3f6154#;
pragma Export (C, u00051, "ada__characters__handlingS");
u00052 : constant Version_32 := 16#4b7bb96a#;
pragma Export (C, u00052, "ada__characters__latin_1S");
u00053 : constant Version_32 := 16#e6d4fa36#;
pragma Export (C, u00053, "ada__stringsS");
u00054 : constant Version_32 := 16#96df1a3f#;
pragma Export (C, u00054, "ada__strings__mapsB");
u00055 : constant Version_32 := 16#1e526bec#;
pragma Export (C, u00055, "ada__strings__mapsS");
u00056 : constant Version_32 := 16#d68fb8f1#;
pragma Export (C, u00056, "system__bit_opsB");
u00057 : constant Version_32 := 16#0765e3a3#;
pragma Export (C, u00057, "system__bit_opsS");
u00058 : constant Version_32 := 16#72b39087#;
pragma Export (C, u00058, "system__unsigned_typesS");
u00059 : constant Version_32 := 16#92f05f13#;
pragma Export (C, u00059, "ada__strings__maps__constantsS");
u00060 : constant Version_32 := 16#a0d3d22b#;
pragma Export (C, u00060, "system__address_imageB");
u00061 : constant Version_32 := 16#e7d9713e#;
pragma Export (C, u00061, "system__address_imageS");
u00062 : constant Version_32 := 16#ec78c2bf#;
pragma Export (C, u00062, "system__img_unsB");
u00063 : constant Version_32 := 16#ed47ac70#;
pragma Export (C, u00063, "system__img_unsS");
u00064 : constant Version_32 := 16#d7aac20c#;
pragma Export (C, u00064, "system__ioB");
u00065 : constant Version_32 := 16#d8771b4b#;
pragma Export (C, u00065, "system__ioS");
u00066 : constant Version_32 := 16#f790d1ef#;
pragma Export (C, u00066, "system__mmapB");
u00067 : constant Version_32 := 16#7c445363#;
pragma Export (C, u00067, "system__mmapS");
u00068 : constant Version_32 := 16#92d882c5#;
pragma Export (C, u00068, "ada__io_exceptionsS");
u00069 : constant Version_32 := 16#0cdaa54a#;
pragma Export (C, u00069, "system__mmap__os_interfaceB");
u00070 : constant Version_32 := 16#82f29877#;
pragma Export (C, u00070, "system__mmap__os_interfaceS");
u00071 : constant Version_32 := 16#834dfe5e#;
pragma Export (C, u00071, "system__mmap__unixS");
u00072 : constant Version_32 := 16#fa90b46b#;
pragma Export (C, u00072, "system__os_libB");
u00073 : constant Version_32 := 16#4542b55d#;
pragma Export (C, u00073, "system__os_libS");
u00074 : constant Version_32 := 16#ec4d5631#;
pragma Export (C, u00074, "system__case_utilB");
u00075 : constant Version_32 := 16#79e05a50#;
pragma Export (C, u00075, "system__case_utilS");
u00076 : constant Version_32 := 16#2a8e89ad#;
pragma Export (C, u00076, "system__stringsB");
u00077 : constant Version_32 := 16#2623c091#;
pragma Export (C, u00077, "system__stringsS");
u00078 : constant Version_32 := 16#5a3f5337#;
pragma Export (C, u00078, "system__object_readerB");
u00079 : constant Version_32 := 16#82413105#;
pragma Export (C, u00079, "system__object_readerS");
u00080 : constant Version_32 := 16#1a74a354#;
pragma Export (C, u00080, "system__val_lliB");
u00081 : constant Version_32 := 16#dc110aa4#;
pragma Export (C, u00081, "system__val_lliS");
u00082 : constant Version_32 := 16#afdbf393#;
pragma Export (C, u00082, "system__val_lluB");
u00083 : constant Version_32 := 16#0841c7f5#;
pragma Export (C, u00083, "system__val_lluS");
u00084 : constant Version_32 := 16#269742a9#;
pragma Export (C, u00084, "system__val_utilB");
u00085 : constant Version_32 := 16#ea955afa#;
pragma Export (C, u00085, "system__val_utilS");
u00086 : constant Version_32 := 16#d7bf3f29#;
pragma Export (C, u00086, "system__exception_tracesB");
u00087 : constant Version_32 := 16#62eacc9e#;
pragma Export (C, u00087, "system__exception_tracesS");
u00088 : constant Version_32 := 16#8c33a517#;
pragma Export (C, u00088, "system__wch_conB");
u00089 : constant Version_32 := 16#5d48ced6#;
pragma Export (C, u00089, "system__wch_conS");
u00090 : constant Version_32 := 16#9721e840#;
pragma Export (C, u00090, "system__wch_stwB");
u00091 : constant Version_32 := 16#7059e2d7#;
pragma Export (C, u00091, "system__wch_stwS");
u00092 : constant Version_32 := 16#a831679c#;
pragma Export (C, u00092, "system__wch_cnvB");
u00093 : constant Version_32 := 16#52ff7425#;
pragma Export (C, u00093, "system__wch_cnvS");
u00094 : constant Version_32 := 16#ece6fdb6#;
pragma Export (C, u00094, "system__wch_jisB");
u00095 : constant Version_32 := 16#d28f6d04#;
pragma Export (C, u00095, "system__wch_jisS");
u00096 : constant Version_32 := 16#f64b89a4#;
pragma Export (C, u00096, "ada__integer_text_ioB");
u00097 : constant Version_32 := 16#082ea75f#;
pragma Export (C, u00097, "ada__integer_text_ioS");
u00098 : constant Version_32 := 16#927a893f#;
pragma Export (C, u00098, "ada__text_ioB");
u00099 : constant Version_32 := 16#5194351e#;
pragma Export (C, u00099, "ada__text_ioS");
u00100 : constant Version_32 := 16#10558b11#;
pragma Export (C, u00100, "ada__streamsB");
u00101 : constant Version_32 := 16#67e31212#;
pragma Export (C, u00101, "ada__streamsS");
u00102 : constant Version_32 := 16#d398a95f#;
pragma Export (C, u00102, "ada__tagsB");
u00103 : constant Version_32 := 16#12a0afb8#;
pragma Export (C, u00103, "ada__tagsS");
u00104 : constant Version_32 := 16#796f31f1#;
pragma Export (C, u00104, "system__htableB");
u00105 : constant Version_32 := 16#c2f75fee#;
pragma Export (C, u00105, "system__htableS");
u00106 : constant Version_32 := 16#089f5cd0#;
pragma Export (C, u00106, "system__string_hashB");
u00107 : constant Version_32 := 16#60a93490#;
pragma Export (C, u00107, "system__string_hashS");
u00108 : constant Version_32 := 16#73d2d764#;
pragma Export (C, u00108, "interfaces__c_streamsB");
u00109 : constant Version_32 := 16#b1330297#;
pragma Export (C, u00109, "interfaces__c_streamsS");
u00110 : constant Version_32 := 16#71ac0ba7#;
pragma Export (C, u00110, "system__file_ioB");
u00111 : constant Version_32 := 16#e1440d61#;
pragma Export (C, u00111, "system__file_ioS");
u00112 : constant Version_32 := 16#86c56e5a#;
pragma Export (C, u00112, "ada__finalizationS");
u00113 : constant Version_32 := 16#95817ed8#;
pragma Export (C, u00113, "system__finalization_rootB");
u00114 : constant Version_32 := 16#09c79f94#;
pragma Export (C, u00114, "system__finalization_rootS");
u00115 : constant Version_32 := 16#bbaa76ac#;
pragma Export (C, u00115, "system__file_control_blockS");
u00116 : constant Version_32 := 16#f6fdca1c#;
pragma Export (C, u00116, "ada__text_io__integer_auxB");
u00117 : constant Version_32 := 16#09097bbe#;
pragma Export (C, u00117, "ada__text_io__integer_auxS");
u00118 : constant Version_32 := 16#181dc502#;
pragma Export (C, u00118, "ada__text_io__generic_auxB");
u00119 : constant Version_32 := 16#16b3615d#;
pragma Export (C, u00119, "ada__text_io__generic_auxS");
u00120 : constant Version_32 := 16#b10ba0c7#;
pragma Export (C, u00120, "system__img_biuB");
u00121 : constant Version_32 := 16#b49118ca#;
pragma Export (C, u00121, "system__img_biuS");
u00122 : constant Version_32 := 16#4e06ab0c#;
pragma Export (C, u00122, "system__img_llbB");
u00123 : constant Version_32 := 16#f5560834#;
pragma Export (C, u00123, "system__img_llbS");
u00124 : constant Version_32 := 16#9dca6636#;
pragma Export (C, u00124, "system__img_lliB");
u00125 : constant Version_32 := 16#577ab9d5#;
pragma Export (C, u00125, "system__img_lliS");
u00126 : constant Version_32 := 16#a756d097#;
pragma Export (C, u00126, "system__img_llwB");
u00127 : constant Version_32 := 16#5c3a2ba2#;
pragma Export (C, u00127, "system__img_llwS");
u00128 : constant Version_32 := 16#eb55dfbb#;
pragma Export (C, u00128, "system__img_wiuB");
u00129 : constant Version_32 := 16#dad09f58#;
pragma Export (C, u00129, "system__img_wiuS");
u00130 : constant Version_32 := 16#d763507a#;
pragma Export (C, u00130, "system__val_intB");
u00131 : constant Version_32 := 16#0e90c63b#;
pragma Export (C, u00131, "system__val_intS");
u00132 : constant Version_32 := 16#1d9142a4#;
pragma Export (C, u00132, "system__val_unsB");
u00133 : constant Version_32 := 16#621b7dbc#;
pragma Export (C, u00133, "system__val_unsS");
u00134 : constant Version_32 := 16#804ab1aa#;
pragma Export (C, u00134, "listesB");
u00135 : constant Version_32 := 16#60baefd6#;
pragma Export (C, u00135, "listesS");
u00136 : constant Version_32 := 16#52f1910f#;
pragma Export (C, u00136, "system__assertionsB");
u00137 : constant Version_32 := 16#8bb8c090#;
pragma Export (C, u00137, "system__assertionsS");
u00138 : constant Version_32 := 16#2323a8af#;
pragma Export (C, u00138, "system__memoryB");
u00139 : constant Version_32 := 16#1f488a30#;
pragma Export (C, u00139, "system__memoryS");
-- BEGIN ELABORATION ORDER
-- ada%s
-- ada.characters%s
-- ada.characters.latin_1%s
-- interfaces%s
-- system%s
-- system.img_int%s
-- system.img_int%b
-- system.img_lli%s
-- system.img_lli%b
-- system.io%s
-- system.io%b
-- system.parameters%s
-- system.parameters%b
-- system.crtl%s
-- interfaces.c_streams%s
-- interfaces.c_streams%b
-- system.storage_elements%s
-- system.storage_elements%b
-- system.stack_checking%s
-- system.stack_checking%b
-- system.string_hash%s
-- system.string_hash%b
-- system.htable%s
-- system.htable%b
-- system.strings%s
-- system.strings%b
-- system.traceback_entries%s
-- system.traceback_entries%b
-- system.unsigned_types%s
-- system.img_biu%s
-- system.img_biu%b
-- system.img_llb%s
-- system.img_llb%b
-- system.img_llw%s
-- system.img_llw%b
-- system.img_uns%s
-- system.img_uns%b
-- system.img_wiu%s
-- system.img_wiu%b
-- system.wch_con%s
-- system.wch_con%b
-- system.wch_jis%s
-- system.wch_jis%b
-- system.wch_cnv%s
-- system.wch_cnv%b
-- system.traceback%s
-- system.traceback%b
-- system.case_util%s
-- system.standard_library%s
-- system.exception_traces%s
-- ada.exceptions%s
-- system.wch_stw%s
-- system.val_util%s
-- system.val_llu%s
-- system.val_lli%s
-- system.os_lib%s
-- system.bit_ops%s
-- ada.characters.handling%s
-- ada.exceptions.traceback%s
-- system.secondary_stack%s
-- system.case_util%b
-- system.address_image%s
-- system.bounded_strings%s
-- system.soft_links%s
-- system.exception_table%s
-- system.exception_table%b
-- ada.io_exceptions%s
-- ada.strings%s
-- ada.containers%s
-- system.exceptions%s
-- system.exceptions%b
-- ada.exceptions.last_chance_handler%s
-- system.exceptions_debug%s
-- system.exceptions_debug%b
-- system.exception_traces%b
-- system.memory%s
-- system.memory%b
-- system.wch_stw%b
-- system.val_util%b
-- system.val_llu%b
-- system.val_lli%b
-- system.os_lib%b
-- system.bit_ops%b
-- ada.strings.maps%s
-- ada.strings.maps.constants%s
-- ada.characters.handling%b
-- interfaces.c%s
-- ada.exceptions.traceback%b
-- system.exceptions.machine%s
-- system.exceptions.machine%b
-- system.secondary_stack%b
-- system.address_image%b
-- system.bounded_strings%b
-- system.soft_links.initialize%s
-- system.soft_links.initialize%b
-- system.soft_links%b
-- ada.exceptions.last_chance_handler%b
-- system.standard_library%b
-- system.mmap%s
-- ada.strings.maps%b
-- interfaces.c%b
-- system.object_reader%s
-- system.dwarf_lines%s
-- system.dwarf_lines%b
-- system.mmap.unix%s
-- system.mmap.os_interface%s
-- system.mmap%b
-- system.traceback.symbolic%s
-- system.traceback.symbolic%b
-- ada.exceptions%b
-- system.object_reader%b
-- system.mmap.os_interface%b
-- ada.tags%s
-- ada.tags%b
-- ada.streams%s
-- ada.streams%b
-- system.file_control_block%s
-- system.finalization_root%s
-- system.finalization_root%b
-- ada.finalization%s
-- system.file_io%s
-- system.file_io%b
-- system.val_uns%s
-- system.val_uns%b
-- system.val_int%s
-- system.val_int%b
-- ada.text_io%s
-- ada.text_io%b
-- ada.text_io.generic_aux%s
-- ada.text_io.generic_aux%b
-- ada.text_io.integer_aux%s
-- ada.text_io.integer_aux%b
-- ada.integer_text_io%s
-- ada.integer_text_io%b
-- system.assertions%s
-- system.assertions%b
-- listes%s
-- listes%b
-- tester_listes%b
-- END ELABORATION ORDER
end ada_main;

290
td08/b__tester_listes.ali Executable file
View file

@ -0,0 +1,290 @@
V "GNAT Lib v9"
A -gnatA
A -gnatA
A -gnatWb
A -gnatiw
A -gnatws
A -g
A -mtune=generic
A -march=x86-64
P ZX
RN
RV NO_ACCESS_SUBPROGRAMS
RV NO_DEFAULT_INITIALIZATION
RV NO_IMPLEMENTATION_ATTRIBUTES
RV NO_IMPLEMENTATION_PRAGMAS
RV NO_IMPLICIT_LOOPS
RV NO_ELABORATION_CODE
RV NO_OBSOLESCENT_FEATURES
RV SPARK_05
U ada_main%b b__tester_listes.adb 859e9f2d OO PK IL
W ada%s ada.ads ada.ali
W ada.exceptions%s a-except.adb a-except.ali
Z system%s system.ads system.ali
U ada_main%s b__tester_listes.ads 5800faab EE NE OO PK IL
W system%s system.ads system.ali
W system.parameters%s s-parame.adb s-parame.ali
W system.secondary_stack%s s-secsta.adb s-secsta.ali
D ada.ads 20200312110721 76789da1 ada%s
D a-except.ads 20200312110721 291912d5 ada.exceptions%s
D a-unccon.ads 20200312110721 0e9b276f ada.unchecked_conversion%s
D b__tester_listes.ads 20201106152811 7662a4b2 ada_main%s
D b__tester_listes.adb 20201106152811 dae5294a ada_main%b
D system.ads 20200312110721 4635ec04 system%s
D s-parame.ads 20200312110721 48ec542b system.parameters%s
D s-secsta.ads 20200312110721 20bbe636 system.secondary_stack%s
D s-stalib.ads 20200312110721 09bd3940 system.standard_library%s
D s-stoele.ads 20200312110721 2dc34a04 system.storage_elements%s
D s-traent.ads 20200312110721 005bf670 system.traceback_entries%s
X 1 ada.ads
16K9*Ada 20e8 5|6r6
X 2 a-except.ads
54K13*Exceptions 349e19 5|6w10
X 4 b__tester_listes.ads
6K9*ada_main 461l5 461e13 5|8b14 255l5 255t13
8i4*gnat_argc{integer} 12m22 12r22 5|232m7
9m4*gnat_argv{6|67M9} 13m22 13r22 5|233m7
10m4*gnat_envp{6|67M9} 14m22 14r22 5|234m7
16i4*gnat_exit_status{integer} 17m22 17r22 5|241r15
19a4*GNAT_Version{string} 21r22
23a4*Ada_Main_Program_Name{string} 24r22 5|228r52
26U14*adainit 27i<c,adainit>22 5|83b14 210l8 210t15 237s7
29U14*adafinal 30i<c,adafinal>22 5|65b14 79l8 79t16 239s7
32V13*main{integer} 33>7 34>7 35>7 37i<c,main>22 5|215b13 242t7
33i7 argc{integer} 5|216b7 232r20
34m7 argv{6|67M9} 5|217b7 233r20
35m7 envp{6|67M9} 5|218b7 234r20
39M9*Version_32 40r22 42r22 44r22 46r22 48r22 50r22 52r22 54r22 56r22 58r22
. 60r22 62r22 64r22 66r22 68r22 70r22 72r22 74r22 76r22 78r22 80r22 82r22
. 84r22 86r22 88r22 90r22 92r22 94r22 96r22 98r22 100r22 102r22 104r22 106r22
. 108r22 110r22 112r22 114r22 116r22 118r22 120r22 122r22 124r22 126r22 128r22
. 130r22 132r22 134r22 136r22 138r22 140r22 142r22 144r22 146r22 148r22 150r22
. 152r22 154r22 156r22 158r22 160r22 162r22 164r22 166r22 168r22 170r22 172r22
. 174r22 176r22 178r22 180r22 182r22 184r22 186r22 188r22 190r22 192r22 194r22
. 196r22 198r22 200r22 202r22 204r22 206r22 208r22 210r22 212r22 214r22 216r22
. 218r22 220r22 222r22 224r22 226r22 228r22 230r22 232r22 234r22 236r22 238r22
. 240r22 242r22 244r22 246r22 248r22 250r22 252r22 254r22 256r22 258r22 260r22
. 262r22 264r22 266r22 268r22 270r22 272r22 274r22 276r22 278r22 280r22 282r22
. 284r22 286r22 288r22 290r22 292r22 294r22 296r22 298r22 300r22 302r22 304r22
. 306r22 308r22 310r22 312r22 314r22 316r22
40m4*u00001{39M9} 41r22
42m4*u00002{39M9} 43r22
44m4*u00003{39M9} 45r22
46m4*u00004{39M9} 47r22
48m4*u00005{39M9} 49r22
50m4*u00006{39M9} 51r22
52m4*u00007{39M9} 53r22
54m4*u00008{39M9} 55r22
56m4*u00009{39M9} 57r22
58m4*u00010{39M9} 59r22
60m4*u00011{39M9} 61r22
62m4*u00012{39M9} 63r22
64m4*u00013{39M9} 65r22
66m4*u00014{39M9} 67r22
68m4*u00015{39M9} 69r22
70m4*u00016{39M9} 71r22
72m4*u00017{39M9} 73r22
74m4*u00018{39M9} 75r22
76m4*u00019{39M9} 77r22
78m4*u00020{39M9} 79r22
80m4*u00021{39M9} 81r22
82m4*u00022{39M9} 83r22
84m4*u00023{39M9} 85r22
86m4*u00024{39M9} 87r22
88m4*u00025{39M9} 89r22
90m4*u00026{39M9} 91r22
92m4*u00027{39M9} 93r22
94m4*u00028{39M9} 95r22
96m4*u00029{39M9} 97r22
98m4*u00030{39M9} 99r22
100m4*u00031{39M9} 101r22
102m4*u00032{39M9} 103r22
104m4*u00033{39M9} 105r22
106m4*u00034{39M9} 107r22
108m4*u00035{39M9} 109r22
110m4*u00036{39M9} 111r22
112m4*u00037{39M9} 113r22
114m4*u00038{39M9} 115r22
116m4*u00039{39M9} 117r22
118m4*u00040{39M9} 119r22
120m4*u00041{39M9} 121r22
122m4*u00042{39M9} 123r22
124m4*u00043{39M9} 125r22
126m4*u00044{39M9} 127r22
128m4*u00045{39M9} 129r22
130m4*u00046{39M9} 131r22
132m4*u00047{39M9} 133r22
134m4*u00048{39M9} 135r22
136m4*u00049{39M9} 137r22
138m4*u00050{39M9} 139r22
140m4*u00051{39M9} 141r22
142m4*u00052{39M9} 143r22
144m4*u00053{39M9} 145r22
146m4*u00054{39M9} 147r22
148m4*u00055{39M9} 149r22
150m4*u00056{39M9} 151r22
152m4*u00057{39M9} 153r22
154m4*u00058{39M9} 155r22
156m4*u00059{39M9} 157r22
158m4*u00060{39M9} 159r22
160m4*u00061{39M9} 161r22
162m4*u00062{39M9} 163r22
164m4*u00063{39M9} 165r22
166m4*u00064{39M9} 167r22
168m4*u00065{39M9} 169r22
170m4*u00066{39M9} 171r22
172m4*u00067{39M9} 173r22
174m4*u00068{39M9} 175r22
176m4*u00069{39M9} 177r22
178m4*u00070{39M9} 179r22
180m4*u00071{39M9} 181r22
182m4*u00072{39M9} 183r22
184m4*u00073{39M9} 185r22
186m4*u00074{39M9} 187r22
188m4*u00075{39M9} 189r22
190m4*u00076{39M9} 191r22
192m4*u00077{39M9} 193r22
194m4*u00078{39M9} 195r22
196m4*u00079{39M9} 197r22
198m4*u00080{39M9} 199r22
200m4*u00081{39M9} 201r22
202m4*u00082{39M9} 203r22
204m4*u00083{39M9} 205r22
206m4*u00084{39M9} 207r22
208m4*u00085{39M9} 209r22
210m4*u00086{39M9} 211r22
212m4*u00087{39M9} 213r22
214m4*u00088{39M9} 215r22
216m4*u00089{39M9} 217r22
218m4*u00090{39M9} 219r22
220m4*u00091{39M9} 221r22
222m4*u00092{39M9} 223r22
224m4*u00093{39M9} 225r22
226m4*u00094{39M9} 227r22
228m4*u00095{39M9} 229r22
230m4*u00096{39M9} 231r22
232m4*u00097{39M9} 233r22
234m4*u00098{39M9} 235r22
236m4*u00099{39M9} 237r22
238m4*u00100{39M9} 239r22
240m4*u00101{39M9} 241r22
242m4*u00102{39M9} 243r22
244m4*u00103{39M9} 245r22
246m4*u00104{39M9} 247r22
248m4*u00105{39M9} 249r22
250m4*u00106{39M9} 251r22
252m4*u00107{39M9} 253r22
254m4*u00108{39M9} 255r22
256m4*u00109{39M9} 257r22
258m4*u00110{39M9} 259r22
260m4*u00111{39M9} 261r22
262m4*u00112{39M9} 263r22
264m4*u00113{39M9} 265r22
266m4*u00114{39M9} 267r22
268m4*u00115{39M9} 269r22
270m4*u00116{39M9} 271r22
272m4*u00117{39M9} 273r22
274m4*u00118{39M9} 275r22
276m4*u00119{39M9} 277r22
278m4*u00120{39M9} 279r22
280m4*u00121{39M9} 281r22
282m4*u00122{39M9} 283r22
284m4*u00123{39M9} 285r22
286m4*u00124{39M9} 287r22
288m4*u00125{39M9} 289r22
290m4*u00126{39M9} 291r22
292m4*u00127{39M9} 293r22
294m4*u00128{39M9} 295r22
296m4*u00129{39M9} 297r22
298m4*u00130{39M9} 299r22
300m4*u00131{39M9} 301r22
302m4*u00132{39M9} 303r22
304m4*u00133{39M9} 305r22
306m4*u00134{39M9} 307r22
308m4*u00135{39M9} 309r22
310m4*u00136{39M9} 311r22
312m4*u00137{39M9} 313r22
314m4*u00138{39M9} 315r22
316m4*u00139{39M9} 317r22
X 5 b__tester_listes.adb
10i4 E073{short_integer} 10m46 10r46 175m7 175r15
11i4 E011{short_integer} 11m46 11r46 182m7 182r15
12i4 E023{short_integer} 12m46 12r46 165m7 165r15
13i4 E068{short_integer} 13m46 13r46 167m7 167r15
14i4 E053{short_integer} 14m46 14r46 169m7 169r15
15i4 E038{short_integer} 15m46 15r46 171m7 171r15
16i4 E025{short_integer} 16m46 16r46 173m7 173r15
17i4 E055{short_integer} 17m46 17r46 183m7 183r15
18i4 E059{short_integer} 18m46 18r46 178m7 178r15
19i4 E043{short_integer} 19m46 19r46 184m7 184r15
20i4 E019{short_integer} 20m46 20r46 181m7 181r15
21i4 E079{short_integer} 21m46 21r46 190m7 190r15
22i4 E048{short_integer} 22m46 22r46 187m7 187r15
23i4 E037{short_integer} 23m46 23r46 189m7 189r15
24i4 E103{short_integer} 24m46 24r46 193m7 193r15
25i4 E101{short_integer} 25m46 25r46 195m7 195r15
26i4 E115{short_integer} 26m46 26r46 197m7 197r15
27i4 E114{short_integer} 27m46 27r46 199m7 199r15
28i4 E112{short_integer} 28m46 28r46 201m7 201r15
29i4 E111{short_integer} 29m46 29r46 54m10 54r18 203m7 203r15
30i4 E099{short_integer} 30m46 30r46 43m7 43r15 206m7 206r15
31i4 E137{short_integer} 31m46 31r46 208m7 208r15
32i4 E135{short_integer} 32m46 32r46 209m7 209r15
34a4 Sec_Default_Sized_Stacks(8|45R9) 157m32 157r32
36a4 Local_Priority_Specific_Dispatching{string} 143r9
37a4 Local_Interrupt_States{string} 146r27
39b4 Is_Elaborated{boolean} 73r14 76m7 132r10 135m7
41U14 finalize_library 41b14 63l8 63t24 161r35
45U20*F1 46b<ada,ada__text_io__finalize_spec>30 48s10
51U20*F2 52b<ada,system__file_io__finalize_body>30 55s10
58U20*Reraise_Library_Exception_If_Any 59b<ada,__gnat_reraise_library_exception_if_any>33
. 61s10
66U17*s_stalib_adafinal 67b<c,system__standard_library__adafinal>25 78s7
69U17*Runtime_Finalize 70b<c,__gnat_runtime_finalize>25 77s7
81P9 No_Param_Proc 124r34
84i7*Main_Priority{integer} 85m25 85r25 136m7
86i7*Time_Slice_Value{integer} 87m25 87r25 137m7
88e7*WC_Encoding{character} 89m25 89r25 138m7
90e7*Locking_Policy{character} 91m25 91r25 139m7
92e7*Queuing_Policy{character} 93m25 93r25 140m7
94e7*Task_Dispatching_Policy{character} 95m25 95r25 141m7
96m7*Priority_Specific_Dispatching{6|67M9} 97m25 97r25 142m7
98i7*Num_Specific_Dispatching{integer} 99m25 99r25 144m7
100i7*Main_CPU{integer} 101m25 101r25 145m7
102m7*Interrupt_States{6|67M9} 103m25 103r25 146m7
104i7*Num_Interrupt_States{integer} 105m25 105r25 147m7
106i7*Unreserve_All_Interrupts{integer} 107m25 107r25 148m7
108i7*Exception_Tracebacks{integer} 109m25 109r25 149m7
110i7*Detect_Blocking{integer} 111m25 111r25 150m7
112i7*Default_Stack_Size{integer} 113m25 113r25 151m7
114i7*Default_Secondary_Stack_Size{7|58I9} 115m25 115r25 155m7
116i7*Leap_Seconds_Support{integer} 117m25 117r25 152m7
118m7*Bind_Env_Addr{6|67M9} 119m25 119r25
121U17*Runtime_Initialize 121>37 122b<c,__gnat_runtime_initialize>25 159s7
121i37 Install_Handler{integer}
124p7*Finalize_Library_Objects{81P9} 125m25 125r25 161m7
126i7*Binder_Sec_Stacks_Count{natural} 127m27 127r27 156m7
128m7*Default_Sized_SS_Pool{6|67M9} 129m27 129r27 157m7
212U14 Ada_Main_Program 213b<ada,_ada_tester_listes>24 238s7
221U17*Initialize 221>29 222b<c,__gnat_initialize>25 236s7
221m29 Addr{6|67M9}
224U17*Finalize 225b<c,__gnat_finalize>25 240s7
226a7 SEH(integer) 236m19 236r19
228m7 Ensure_Reference{6|67M9} 229r24
X 6 system.ads
37K9*System 4|3w6 4r6 5r6 9r16 10r16 34r14 35r14 5|34r57 34r90 96r39 102r26
. 114r38 118r23 128r31 155r39 217r14 218r14 221r36 228r34 6|156e11
67M9*Address 4|9r23 10r23 34r21 35r21 5|96r46 102r33 118r30 128r38 217r21
. 218r21 221r43 228r41
X 7 s-parame.ads
51K16*Parameters 4|4w13 5|34r97 114r45 155r46 7|198e22
58I9*Size_Type<long_integer> 5|114r56
95i4*Runtime_Default_Sec_Stack_Size{58I9} 5|34r108 155r57
X 8 s-secsta.ads
37K16*Secondary_Stack 4|5w13 5|34r64 8|430e27
45R9*SS_Stack 5|34r80 8|330e14

216
td08/b~tester_listes.adb Executable file
View file

@ -0,0 +1,216 @@
pragma Ada_95;
pragma Warnings (Off);
pragma Source_File_Name (ada_main, Spec_File_Name => "b~tester_listes.ads");
pragma Source_File_Name (ada_main, Body_File_Name => "b~tester_listes.adb");
pragma Suppress (Overflow_Check);
with Ada.Exceptions;
package body ada_main is
E011 : Short_Integer; pragma Import (Ada, E011, "system__soft_links_E");
E021 : Short_Integer; pragma Import (Ada, E021, "system__exception_table_E");
E023 : Short_Integer; pragma Import (Ada, E023, "system__exceptions_E");
E015 : Short_Integer; pragma Import (Ada, E015, "system__secondary_stack_E");
E054 : Short_Integer; pragma Import (Ada, E054, "ada__io_exceptions_E");
E077 : Short_Integer; pragma Import (Ada, E077, "interfaces__c_E");
E079 : Short_Integer; pragma Import (Ada, E079, "system__os_lib_E");
E056 : Short_Integer; pragma Import (Ada, E056, "ada__tags_E");
E053 : Short_Integer; pragma Import (Ada, E053, "ada__streams_E");
E082 : Short_Integer; pragma Import (Ada, E082, "system__file_control_block_E");
E075 : Short_Integer; pragma Import (Ada, E075, "system__finalization_root_E");
E073 : Short_Integer; pragma Import (Ada, E073, "ada__finalization_E");
E072 : Short_Integer; pragma Import (Ada, E072, "system__file_io_E");
E051 : Short_Integer; pragma Import (Ada, E051, "ada__text_io_E");
E106 : Short_Integer; pragma Import (Ada, E106, "system__assertions_E");
E104 : Short_Integer; pragma Import (Ada, E104, "listes_E");
Local_Priority_Specific_Dispatching : constant String := "";
Local_Interrupt_States : constant String := "";
Is_Elaborated : Boolean := False;
procedure finalize_library is
begin
E051 := E051 - 1;
declare
procedure F1;
pragma Import (Ada, F1, "ada__text_io__finalize_spec");
begin
F1;
end;
declare
procedure F2;
pragma Import (Ada, F2, "system__file_io__finalize_body");
begin
E072 := E072 - 1;
F2;
end;
declare
procedure Reraise_Library_Exception_If_Any;
pragma Import (Ada, Reraise_Library_Exception_If_Any, "__gnat_reraise_library_exception_if_any");
begin
Reraise_Library_Exception_If_Any;
end;
end finalize_library;
procedure adafinal is
procedure s_stalib_adafinal;
pragma Import (C, s_stalib_adafinal, "system__standard_library__adafinal");
procedure Runtime_Finalize;
pragma Import (C, Runtime_Finalize, "__gnat_runtime_finalize");
begin
if not Is_Elaborated then
return;
end if;
Is_Elaborated := False;
Runtime_Finalize;
s_stalib_adafinal;
end adafinal;
type No_Param_Proc is access procedure;
procedure adainit is
Main_Priority : Integer;
pragma Import (C, Main_Priority, "__gl_main_priority");
Time_Slice_Value : Integer;
pragma Import (C, Time_Slice_Value, "__gl_time_slice_val");
WC_Encoding : Character;
pragma Import (C, WC_Encoding, "__gl_wc_encoding");
Locking_Policy : Character;
pragma Import (C, Locking_Policy, "__gl_locking_policy");
Queuing_Policy : Character;
pragma Import (C, Queuing_Policy, "__gl_queuing_policy");
Task_Dispatching_Policy : Character;
pragma Import (C, Task_Dispatching_Policy, "__gl_task_dispatching_policy");
Priority_Specific_Dispatching : System.Address;
pragma Import (C, Priority_Specific_Dispatching, "__gl_priority_specific_dispatching");
Num_Specific_Dispatching : Integer;
pragma Import (C, Num_Specific_Dispatching, "__gl_num_specific_dispatching");
Main_CPU : Integer;
pragma Import (C, Main_CPU, "__gl_main_cpu");
Interrupt_States : System.Address;
pragma Import (C, Interrupt_States, "__gl_interrupt_states");
Num_Interrupt_States : Integer;
pragma Import (C, Num_Interrupt_States, "__gl_num_interrupt_states");
Unreserve_All_Interrupts : Integer;
pragma Import (C, Unreserve_All_Interrupts, "__gl_unreserve_all_interrupts");
Detect_Blocking : Integer;
pragma Import (C, Detect_Blocking, "__gl_detect_blocking");
Default_Stack_Size : Integer;
pragma Import (C, Default_Stack_Size, "__gl_default_stack_size");
Leap_Seconds_Support : Integer;
pragma Import (C, Leap_Seconds_Support, "__gl_leap_seconds_support");
Bind_Env_Addr : System.Address;
pragma Import (C, Bind_Env_Addr, "__gl_bind_env_addr");
procedure Runtime_Initialize (Install_Handler : Integer);
pragma Import (C, Runtime_Initialize, "__gnat_runtime_initialize");
Finalize_Library_Objects : No_Param_Proc;
pragma Import (C, Finalize_Library_Objects, "__gnat_finalize_library_objects");
begin
if Is_Elaborated then
return;
end if;
Is_Elaborated := True;
Main_Priority := -1;
Time_Slice_Value := -1;
WC_Encoding := 'b';
Locking_Policy := ' ';
Queuing_Policy := ' ';
Task_Dispatching_Policy := ' ';
Priority_Specific_Dispatching :=
Local_Priority_Specific_Dispatching'Address;
Num_Specific_Dispatching := 0;
Main_CPU := -1;
Interrupt_States := Local_Interrupt_States'Address;
Num_Interrupt_States := 0;
Unreserve_All_Interrupts := 0;
Detect_Blocking := 0;
Default_Stack_Size := -1;
Leap_Seconds_Support := 0;
Runtime_Initialize (1);
Finalize_Library_Objects := finalize_library'access;
System.Soft_Links'Elab_Spec;
System.Exception_Table'Elab_Body;
E021 := E021 + 1;
System.Exceptions'Elab_Spec;
E023 := E023 + 1;
System.Soft_Links'Elab_Body;
E011 := E011 + 1;
System.Secondary_Stack'Elab_Body;
E015 := E015 + 1;
Ada.Io_Exceptions'Elab_Spec;
E054 := E054 + 1;
Interfaces.C'Elab_Spec;
E077 := E077 + 1;
System.Os_Lib'Elab_Body;
E079 := E079 + 1;
Ada.Tags'Elab_Spec;
Ada.Tags'Elab_Body;
E056 := E056 + 1;
Ada.Streams'Elab_Spec;
E053 := E053 + 1;
System.File_Control_Block'Elab_Spec;
E082 := E082 + 1;
System.Finalization_Root'Elab_Spec;
E075 := E075 + 1;
Ada.Finalization'Elab_Spec;
E073 := E073 + 1;
System.File_Io'Elab_Body;
E072 := E072 + 1;
Ada.Text_Io'Elab_Spec;
Ada.Text_Io'Elab_Body;
E051 := E051 + 1;
System.Assertions'Elab_Spec;
E106 := E106 + 1;
E104 := E104 + 1;
end adainit;
procedure Ada_Main_Program;
pragma Import (Ada, Ada_Main_Program, "_ada_tester_listes");
function main
(argc : Integer;
argv : System.Address;
envp : System.Address)
return Integer
is
procedure Initialize (Addr : System.Address);
pragma Import (C, Initialize, "__gnat_initialize");
procedure Finalize;
pragma Import (C, Finalize, "__gnat_finalize");
SEH : aliased array (1 .. 2) of Integer;
Ensure_Reference : aliased System.Address := Ada_Main_Program_Name'Address;
pragma Volatile (Ensure_Reference);
begin
gnat_argc := argc;
gnat_argv := argv;
gnat_envp := envp;
Initialize (SEH'Address);
adainit;
Ada_Main_Program;
adafinal;
Finalize;
return (gnat_exit_status);
end;
-- BEGIN Object file/option list
-- ./listes.o
-- ./tester_listes.o
-- -L./
-- -L/usr/lib/gcc/x86_64-linux-gnu/7/adalib/
-- -shared
-- -lgnat-7
-- END Object file/option list
end ada_main;

366
td08/b~tester_listes.ads Executable file
View file

@ -0,0 +1,366 @@
pragma Ada_95;
pragma Warnings (Off);
with System;
package ada_main is
gnat_argc : Integer;
gnat_argv : System.Address;
gnat_envp : System.Address;
pragma Import (C, gnat_argc);
pragma Import (C, gnat_argv);
pragma Import (C, gnat_envp);
gnat_exit_status : Integer;
pragma Import (C, gnat_exit_status);
GNAT_Version : constant String :=
"GNAT Version: 7.5.0" & ASCII.NUL;
pragma Export (C, GNAT_Version, "__gnat_version");
Ada_Main_Program_Name : constant String := "_ada_tester_listes" & ASCII.NUL;
pragma Export (C, Ada_Main_Program_Name, "__gnat_ada_main_program_name");
procedure adainit;
pragma Export (C, adainit, "adainit");
procedure adafinal;
pragma Export (C, adafinal, "adafinal");
function main
(argc : Integer;
argv : System.Address;
envp : System.Address)
return Integer;
pragma Export (C, main, "main");
type Version_32 is mod 2 ** 32;
u00001 : constant Version_32 := 16#eb9c3630#;
pragma Export (C, u00001, "tester_listesB");
u00002 : constant Version_32 := 16#b6df930e#;
pragma Export (C, u00002, "system__standard_libraryB");
u00003 : constant Version_32 := 16#7ec093d3#;
pragma Export (C, u00003, "system__standard_libraryS");
u00004 : constant Version_32 := 16#76789da1#;
pragma Export (C, u00004, "adaS");
u00005 : constant Version_32 := 16#c2326fda#;
pragma Export (C, u00005, "ada__exceptionsB");
u00006 : constant Version_32 := 16#6e98a13f#;
pragma Export (C, u00006, "ada__exceptionsS");
u00007 : constant Version_32 := 16#e947e6a9#;
pragma Export (C, u00007, "ada__exceptions__last_chance_handlerB");
u00008 : constant Version_32 := 16#41e5552e#;
pragma Export (C, u00008, "ada__exceptions__last_chance_handlerS");
u00009 : constant Version_32 := 16#4635ec04#;
pragma Export (C, u00009, "systemS");
u00010 : constant Version_32 := 16#4e7785b8#;
pragma Export (C, u00010, "system__soft_linksB");
u00011 : constant Version_32 := 16#d8b13451#;
pragma Export (C, u00011, "system__soft_linksS");
u00012 : constant Version_32 := 16#b01dad17#;
pragma Export (C, u00012, "system__parametersB");
u00013 : constant Version_32 := 16#381fe17b#;
pragma Export (C, u00013, "system__parametersS");
u00014 : constant Version_32 := 16#30ad09e5#;
pragma Export (C, u00014, "system__secondary_stackB");
u00015 : constant Version_32 := 16#fca7137e#;
pragma Export (C, u00015, "system__secondary_stackS");
u00016 : constant Version_32 := 16#f103f468#;
pragma Export (C, u00016, "system__storage_elementsB");
u00017 : constant Version_32 := 16#6bf6a600#;
pragma Export (C, u00017, "system__storage_elementsS");
u00018 : constant Version_32 := 16#41837d1e#;
pragma Export (C, u00018, "system__stack_checkingB");
u00019 : constant Version_32 := 16#c88a87ec#;
pragma Export (C, u00019, "system__stack_checkingS");
u00020 : constant Version_32 := 16#87a448ff#;
pragma Export (C, u00020, "system__exception_tableB");
u00021 : constant Version_32 := 16#1b9b8546#;
pragma Export (C, u00021, "system__exception_tableS");
u00022 : constant Version_32 := 16#ce4af020#;
pragma Export (C, u00022, "system__exceptionsB");
u00023 : constant Version_32 := 16#2e5681f2#;
pragma Export (C, u00023, "system__exceptionsS");
u00024 : constant Version_32 := 16#843d48dc#;
pragma Export (C, u00024, "system__exceptions__machineS");
u00025 : constant Version_32 := 16#aa0563fc#;
pragma Export (C, u00025, "system__exceptions_debugB");
u00026 : constant Version_32 := 16#38bf15c0#;
pragma Export (C, u00026, "system__exceptions_debugS");
u00027 : constant Version_32 := 16#6c2f8802#;
pragma Export (C, u00027, "system__img_intB");
u00028 : constant Version_32 := 16#44ee0cc6#;
pragma Export (C, u00028, "system__img_intS");
u00029 : constant Version_32 := 16#39df8c17#;
pragma Export (C, u00029, "system__tracebackB");
u00030 : constant Version_32 := 16#181732c0#;
pragma Export (C, u00030, "system__tracebackS");
u00031 : constant Version_32 := 16#9ed49525#;
pragma Export (C, u00031, "system__traceback_entriesB");
u00032 : constant Version_32 := 16#466e1a74#;
pragma Export (C, u00032, "system__traceback_entriesS");
u00033 : constant Version_32 := 16#6fd210f2#;
pragma Export (C, u00033, "system__traceback__symbolicB");
u00034 : constant Version_32 := 16#dd19f67a#;
pragma Export (C, u00034, "system__traceback__symbolicS");
u00035 : constant Version_32 := 16#701f9d88#;
pragma Export (C, u00035, "ada__exceptions__tracebackB");
u00036 : constant Version_32 := 16#20245e75#;
pragma Export (C, u00036, "ada__exceptions__tracebackS");
u00037 : constant Version_32 := 16#9f00b3d3#;
pragma Export (C, u00037, "system__address_imageB");
u00038 : constant Version_32 := 16#e7d9713e#;
pragma Export (C, u00038, "system__address_imageS");
u00039 : constant Version_32 := 16#8c33a517#;
pragma Export (C, u00039, "system__wch_conB");
u00040 : constant Version_32 := 16#5d48ced6#;
pragma Export (C, u00040, "system__wch_conS");
u00041 : constant Version_32 := 16#9721e840#;
pragma Export (C, u00041, "system__wch_stwB");
u00042 : constant Version_32 := 16#7059e2d7#;
pragma Export (C, u00042, "system__wch_stwS");
u00043 : constant Version_32 := 16#a831679c#;
pragma Export (C, u00043, "system__wch_cnvB");
u00044 : constant Version_32 := 16#52ff7425#;
pragma Export (C, u00044, "system__wch_cnvS");
u00045 : constant Version_32 := 16#5ab55268#;
pragma Export (C, u00045, "interfacesS");
u00046 : constant Version_32 := 16#ece6fdb6#;
pragma Export (C, u00046, "system__wch_jisB");
u00047 : constant Version_32 := 16#d28f6d04#;
pragma Export (C, u00047, "system__wch_jisS");
u00048 : constant Version_32 := 16#f64b89a4#;
pragma Export (C, u00048, "ada__integer_text_ioB");
u00049 : constant Version_32 := 16#b85ee1d1#;
pragma Export (C, u00049, "ada__integer_text_ioS");
u00050 : constant Version_32 := 16#1d1c6062#;
pragma Export (C, u00050, "ada__text_ioB");
u00051 : constant Version_32 := 16#e1e47390#;
pragma Export (C, u00051, "ada__text_ioS");
u00052 : constant Version_32 := 16#10558b11#;
pragma Export (C, u00052, "ada__streamsB");
u00053 : constant Version_32 := 16#67e31212#;
pragma Export (C, u00053, "ada__streamsS");
u00054 : constant Version_32 := 16#92d882c5#;
pragma Export (C, u00054, "ada__io_exceptionsS");
u00055 : constant Version_32 := 16#3d17c74c#;
pragma Export (C, u00055, "ada__tagsB");
u00056 : constant Version_32 := 16#5a4e344a#;
pragma Export (C, u00056, "ada__tagsS");
u00057 : constant Version_32 := 16#c3335bfd#;
pragma Export (C, u00057, "system__htableB");
u00058 : constant Version_32 := 16#c2f75fee#;
pragma Export (C, u00058, "system__htableS");
u00059 : constant Version_32 := 16#089f5cd0#;
pragma Export (C, u00059, "system__string_hashB");
u00060 : constant Version_32 := 16#60a93490#;
pragma Export (C, u00060, "system__string_hashS");
u00061 : constant Version_32 := 16#72b39087#;
pragma Export (C, u00061, "system__unsigned_typesS");
u00062 : constant Version_32 := 16#afdbf393#;
pragma Export (C, u00062, "system__val_lluB");
u00063 : constant Version_32 := 16#0841c7f5#;
pragma Export (C, u00063, "system__val_lluS");
u00064 : constant Version_32 := 16#27b600b2#;
pragma Export (C, u00064, "system__val_utilB");
u00065 : constant Version_32 := 16#ea955afa#;
pragma Export (C, u00065, "system__val_utilS");
u00066 : constant Version_32 := 16#d1060688#;
pragma Export (C, u00066, "system__case_utilB");
u00067 : constant Version_32 := 16#623c85d3#;
pragma Export (C, u00067, "system__case_utilS");
u00068 : constant Version_32 := 16#4c01b69c#;
pragma Export (C, u00068, "interfaces__c_streamsB");
u00069 : constant Version_32 := 16#b1330297#;
pragma Export (C, u00069, "interfaces__c_streamsS");
u00070 : constant Version_32 := 16#36a43a0a#;
pragma Export (C, u00070, "system__crtlS");
u00071 : constant Version_32 := 16#4db84b5a#;
pragma Export (C, u00071, "system__file_ioB");
u00072 : constant Version_32 := 16#e1440d61#;
pragma Export (C, u00072, "system__file_ioS");
u00073 : constant Version_32 := 16#86c56e5a#;
pragma Export (C, u00073, "ada__finalizationS");
u00074 : constant Version_32 := 16#95817ed8#;
pragma Export (C, u00074, "system__finalization_rootB");
u00075 : constant Version_32 := 16#09c79f94#;
pragma Export (C, u00075, "system__finalization_rootS");
u00076 : constant Version_32 := 16#769e25e6#;
pragma Export (C, u00076, "interfaces__cB");
u00077 : constant Version_32 := 16#70be4e8c#;
pragma Export (C, u00077, "interfaces__cS");
u00078 : constant Version_32 := 16#cc2ce7a7#;
pragma Export (C, u00078, "system__os_libB");
u00079 : constant Version_32 := 16#c1e9580f#;
pragma Export (C, u00079, "system__os_libS");
u00080 : constant Version_32 := 16#1a817b8e#;
pragma Export (C, u00080, "system__stringsB");
u00081 : constant Version_32 := 16#388afd62#;
pragma Export (C, u00081, "system__stringsS");
u00082 : constant Version_32 := 16#bbaa76ac#;
pragma Export (C, u00082, "system__file_control_blockS");
u00083 : constant Version_32 := 16#f6fdca1c#;
pragma Export (C, u00083, "ada__text_io__integer_auxB");
u00084 : constant Version_32 := 16#b9793d30#;
pragma Export (C, u00084, "ada__text_io__integer_auxS");
u00085 : constant Version_32 := 16#181dc502#;
pragma Export (C, u00085, "ada__text_io__generic_auxB");
u00086 : constant Version_32 := 16#a6c327d3#;
pragma Export (C, u00086, "ada__text_io__generic_auxS");
u00087 : constant Version_32 := 16#b10ba0c7#;
pragma Export (C, u00087, "system__img_biuB");
u00088 : constant Version_32 := 16#b49118ca#;
pragma Export (C, u00088, "system__img_biuS");
u00089 : constant Version_32 := 16#4e06ab0c#;
pragma Export (C, u00089, "system__img_llbB");
u00090 : constant Version_32 := 16#f5560834#;
pragma Export (C, u00090, "system__img_llbS");
u00091 : constant Version_32 := 16#9dca6636#;
pragma Export (C, u00091, "system__img_lliB");
u00092 : constant Version_32 := 16#577ab9d5#;
pragma Export (C, u00092, "system__img_lliS");
u00093 : constant Version_32 := 16#a756d097#;
pragma Export (C, u00093, "system__img_llwB");
u00094 : constant Version_32 := 16#5c3a2ba2#;
pragma Export (C, u00094, "system__img_llwS");
u00095 : constant Version_32 := 16#eb55dfbb#;
pragma Export (C, u00095, "system__img_wiuB");
u00096 : constant Version_32 := 16#dad09f58#;
pragma Export (C, u00096, "system__img_wiuS");
u00097 : constant Version_32 := 16#d763507a#;
pragma Export (C, u00097, "system__val_intB");
u00098 : constant Version_32 := 16#0e90c63b#;
pragma Export (C, u00098, "system__val_intS");
u00099 : constant Version_32 := 16#1d9142a4#;
pragma Export (C, u00099, "system__val_unsB");
u00100 : constant Version_32 := 16#621b7dbc#;
pragma Export (C, u00100, "system__val_unsS");
u00101 : constant Version_32 := 16#1a74a354#;
pragma Export (C, u00101, "system__val_lliB");
u00102 : constant Version_32 := 16#dc110aa4#;
pragma Export (C, u00102, "system__val_lliS");
u00103 : constant Version_32 := 16#12c2f32c#;
pragma Export (C, u00103, "listesB");
u00104 : constant Version_32 := 16#6e6e8c16#;
pragma Export (C, u00104, "listesS");
u00105 : constant Version_32 := 16#52f1910f#;
pragma Export (C, u00105, "system__assertionsB");
u00106 : constant Version_32 := 16#8bb8c090#;
pragma Export (C, u00106, "system__assertionsS");
u00107 : constant Version_32 := 16#a6359005#;
pragma Export (C, u00107, "system__memoryB");
u00108 : constant Version_32 := 16#1f488a30#;
pragma Export (C, u00108, "system__memoryS");
-- BEGIN ELABORATION ORDER
-- ada%s
-- interfaces%s
-- system%s
-- system.case_util%s
-- system.case_util%b
-- system.img_int%s
-- system.img_int%b
-- system.img_lli%s
-- system.img_lli%b
-- system.parameters%s
-- system.parameters%b
-- system.crtl%s
-- interfaces.c_streams%s
-- interfaces.c_streams%b
-- system.storage_elements%s
-- system.storage_elements%b
-- system.stack_checking%s
-- system.stack_checking%b
-- system.string_hash%s
-- system.string_hash%b
-- system.htable%s
-- system.htable%b
-- system.strings%s
-- system.strings%b
-- system.traceback_entries%s
-- system.traceback_entries%b
-- system.unsigned_types%s
-- system.img_biu%s
-- system.img_biu%b
-- system.img_llb%s
-- system.img_llb%b
-- system.img_llw%s
-- system.img_llw%b
-- system.img_wiu%s
-- system.img_wiu%b
-- system.wch_con%s
-- system.wch_con%b
-- system.wch_jis%s
-- system.wch_jis%b
-- system.wch_cnv%s
-- system.wch_cnv%b
-- system.traceback%s
-- system.traceback%b
-- system.wch_stw%s
-- system.standard_library%s
-- system.exceptions_debug%s
-- system.exceptions_debug%b
-- ada.exceptions%s
-- system.wch_stw%b
-- ada.exceptions.traceback%s
-- system.soft_links%s
-- system.exception_table%s
-- system.exception_table%b
-- system.exceptions%s
-- system.exceptions%b
-- system.secondary_stack%s
-- system.address_image%s
-- system.soft_links%b
-- ada.exceptions.last_chance_handler%s
-- system.memory%s
-- system.memory%b
-- ada.exceptions.traceback%b
-- system.traceback.symbolic%s
-- system.traceback.symbolic%b
-- system.exceptions.machine%s
-- system.secondary_stack%b
-- system.address_image%b
-- ada.exceptions.last_chance_handler%b
-- system.standard_library%b
-- ada.exceptions%b
-- ada.io_exceptions%s
-- interfaces.c%s
-- interfaces.c%b
-- system.os_lib%s
-- system.os_lib%b
-- system.val_util%s
-- system.val_util%b
-- system.val_llu%s
-- system.val_llu%b
-- ada.tags%s
-- ada.tags%b
-- ada.streams%s
-- ada.streams%b
-- system.file_control_block%s
-- system.finalization_root%s
-- system.finalization_root%b
-- ada.finalization%s
-- system.file_io%s
-- system.file_io%b
-- system.val_lli%s
-- system.val_lli%b
-- system.val_uns%s
-- system.val_uns%b
-- system.val_int%s
-- system.val_int%b
-- ada.text_io%s
-- ada.text_io%b
-- ada.text_io.generic_aux%s
-- ada.text_io.generic_aux%b
-- ada.text_io.integer_aux%s
-- ada.text_io.integer_aux%b
-- ada.integer_text_io%s
-- ada.integer_text_io%b
-- system.assertions%s
-- system.assertions%b
-- listes%s
-- listes%b
-- tester_listes%b
-- END ELABORATION ORDER
end ada_main;

230
td08/b~tester_listes.ali Executable file
View file

@ -0,0 +1,230 @@
V "GNAT Lib v7"
A -g
A -gnatA
A -gnatWb
A -gnatiw
A -g
A -gnatws
A -mtune=generic
A -march=x86-64
P ZX
RN
RV NO_ACCESS_SUBPROGRAMS
RV NO_IMPLEMENTATION_ATTRIBUTES
RV NO_IMPLEMENTATION_PRAGMAS
RV NO_OBSOLESCENT_FEATURES
RV SPARK_05
U ada_main%b b~tester_listes.adb ca2bc6c0 NE OO PK IL
W ada%s ada.ads ada.ali
W ada.exceptions%s a-except.adb a-except.ali
W system%s system.ads system.ali
U ada_main%s b~tester_listes.ads 027b2313 EE NE OO PK IL
W system%s system.ads system.ali
D ada.ads 20170106103348 76789da1 ada%s
D a-except.ads 20151016123252 291912d5 ada.exceptions%s
D a-unccon.ads 20170106103348 31484697 ada.unchecked_conversion%s
D b~tester_listes.ads 20201106153928 444ecf17 ada_main%s
D b~tester_listes.adb 20201106153928 a77c1b02 ada_main%b
D system.ads 20170510173650 4635ec04 system%s
D s-parame.ads 20140801093848 7e2a0d7f system.parameters%s
D s-stalib.ads 20151112104907 09bd3940 system.standard_library%s
D s-traent.ads 20140730135025 005bf670 system.traceback_entries%s
X 1 ada.ads
16K9*Ada 20e8 5|6r6
X 2 a-except.ads
54K13*Exceptions 349e19 5|6w10
X 4 b~tester_listes.ads
4K9*ada_main 366l5 366e13 5|8b14 216l5 216t13
6i4*gnat_argc{integer} 10m22 10r22 5|195m7
7m4*gnat_argv{6|67M9} 11m22 11r22 5|196m7
8m4*gnat_envp{6|67M9} 12m22 12r22 5|197m7
14i4*gnat_exit_status{integer} 15m22 15r22 5|204r15
17a4*GNAT_Version{string} 19r22
21a4*Ada_Main_Program_Name{string} 22r22 5|191r52
24U14*adainit 25i<c,adainit>22 5|74b14 173l8 173t15 200s7
27U14*adafinal 28i<c,adafinal>22 5|56b14 70l8 70t16 202s7
30V13*main{integer} 31>7 32>7 33>7 35i<c,main>22 5|178b13 205t7
31i7 argc{integer} 5|179b7 195r20
32m7 argv{6|67M9} 5|180b7 196r20
33m7 envp{6|67M9} 5|181b7 197r20
37M9*Version_32 38r22 40r22 42r22 44r22 46r22 48r22 50r22 52r22 54r22 56r22
. 58r22 60r22 62r22 64r22 66r22 68r22 70r22 72r22 74r22 76r22 78r22 80r22
. 82r22 84r22 86r22 88r22 90r22 92r22 94r22 96r22 98r22 100r22 102r22 104r22
. 106r22 108r22 110r22 112r22 114r22 116r22 118r22 120r22 122r22 124r22 126r22
. 128r22 130r22 132r22 134r22 136r22 138r22 140r22 142r22 144r22 146r22 148r22
. 150r22 152r22 154r22 156r22 158r22 160r22 162r22 164r22 166r22 168r22 170r22
. 172r22 174r22 176r22 178r22 180r22 182r22 184r22 186r22 188r22 190r22 192r22
. 194r22 196r22 198r22 200r22 202r22 204r22 206r22 208r22 210r22 212r22 214r22
. 216r22 218r22 220r22 222r22 224r22 226r22 228r22 230r22 232r22 234r22 236r22
. 238r22 240r22 242r22 244r22 246r22 248r22 250r22 252r22
38m4*u00001{37M9} 39r22
40m4*u00002{37M9} 41r22
42m4*u00003{37M9} 43r22
44m4*u00004{37M9} 45r22
46m4*u00005{37M9} 47r22
48m4*u00006{37M9} 49r22
50m4*u00007{37M9} 51r22
52m4*u00008{37M9} 53r22
54m4*u00009{37M9} 55r22
56m4*u00010{37M9} 57r22
58m4*u00011{37M9} 59r22
60m4*u00012{37M9} 61r22
62m4*u00013{37M9} 63r22
64m4*u00014{37M9} 65r22
66m4*u00015{37M9} 67r22
68m4*u00016{37M9} 69r22
70m4*u00017{37M9} 71r22
72m4*u00018{37M9} 73r22
74m4*u00019{37M9} 75r22
76m4*u00020{37M9} 77r22
78m4*u00021{37M9} 79r22
80m4*u00022{37M9} 81r22
82m4*u00023{37M9} 83r22
84m4*u00024{37M9} 85r22
86m4*u00025{37M9} 87r22
88m4*u00026{37M9} 89r22
90m4*u00027{37M9} 91r22
92m4*u00028{37M9} 93r22
94m4*u00029{37M9} 95r22
96m4*u00030{37M9} 97r22
98m4*u00031{37M9} 99r22
100m4*u00032{37M9} 101r22
102m4*u00033{37M9} 103r22
104m4*u00034{37M9} 105r22
106m4*u00035{37M9} 107r22
108m4*u00036{37M9} 109r22
110m4*u00037{37M9} 111r22
112m4*u00038{37M9} 113r22
114m4*u00039{37M9} 115r22
116m4*u00040{37M9} 117r22
118m4*u00041{37M9} 119r22
120m4*u00042{37M9} 121r22
122m4*u00043{37M9} 123r22
124m4*u00044{37M9} 125r22
126m4*u00045{37M9} 127r22
128m4*u00046{37M9} 129r22
130m4*u00047{37M9} 131r22
132m4*u00048{37M9} 133r22
134m4*u00049{37M9} 135r22
136m4*u00050{37M9} 137r22
138m4*u00051{37M9} 139r22
140m4*u00052{37M9} 141r22
142m4*u00053{37M9} 143r22
144m4*u00054{37M9} 145r22
146m4*u00055{37M9} 147r22
148m4*u00056{37M9} 149r22
150m4*u00057{37M9} 151r22
152m4*u00058{37M9} 153r22
154m4*u00059{37M9} 155r22
156m4*u00060{37M9} 157r22
158m4*u00061{37M9} 159r22
160m4*u00062{37M9} 161r22
162m4*u00063{37M9} 163r22
164m4*u00064{37M9} 165r22
166m4*u00065{37M9} 167r22
168m4*u00066{37M9} 169r22
170m4*u00067{37M9} 171r22
172m4*u00068{37M9} 173r22
174m4*u00069{37M9} 175r22
176m4*u00070{37M9} 177r22
178m4*u00071{37M9} 179r22
180m4*u00072{37M9} 181r22
182m4*u00073{37M9} 183r22
184m4*u00074{37M9} 185r22
186m4*u00075{37M9} 187r22
188m4*u00076{37M9} 189r22
190m4*u00077{37M9} 191r22
192m4*u00078{37M9} 193r22
194m4*u00079{37M9} 195r22
196m4*u00080{37M9} 197r22
198m4*u00081{37M9} 199r22
200m4*u00082{37M9} 201r22
202m4*u00083{37M9} 203r22
204m4*u00084{37M9} 205r22
206m4*u00085{37M9} 207r22
208m4*u00086{37M9} 209r22
210m4*u00087{37M9} 211r22
212m4*u00088{37M9} 213r22
214m4*u00089{37M9} 215r22
216m4*u00090{37M9} 217r22
218m4*u00091{37M9} 219r22
220m4*u00092{37M9} 221r22
222m4*u00093{37M9} 223r22
224m4*u00094{37M9} 225r22
226m4*u00095{37M9} 227r22
228m4*u00096{37M9} 229r22
230m4*u00097{37M9} 231r22
232m4*u00098{37M9} 233r22
234m4*u00099{37M9} 235r22
236m4*u00100{37M9} 237r22
238m4*u00101{37M9} 239r22
240m4*u00102{37M9} 241r22
242m4*u00103{37M9} 243r22
244m4*u00104{37M9} 245r22
246m4*u00105{37M9} 247r22
248m4*u00106{37M9} 249r22
250m4*u00107{37M9} 251r22
252m4*u00108{37M9} 253r22
X 5 b~tester_listes.adb
10i4 E011{short_integer} 10m46 10r46 145m7 145r15
11i4 E021{short_integer} 11m46 11r46 141m7 141r15
12i4 E023{short_integer} 12m46 12r46 143m7 143r15
13i4 E015{short_integer} 13m46 13r46 147m7 147r15
14i4 E054{short_integer} 14m46 14r46 149m7 149r15
15i4 E077{short_integer} 15m46 15r46 151m7 151r15
16i4 E079{short_integer} 16m46 16r46 153m7 153r15
17i4 E056{short_integer} 17m46 17r46 156m7 156r15
18i4 E053{short_integer} 18m46 18r46 158m7 158r15
19i4 E082{short_integer} 19m46 19r46 160m7 160r15
20i4 E075{short_integer} 20m46 20r46 162m7 162r15
21i4 E073{short_integer} 21m46 21r46 164m7 164r15
22i4 E072{short_integer} 22m46 22r46 45m10 45r18 166m7 166r15
23i4 E051{short_integer} 23m46 23r46 34m7 34r15 169m7 169r15
24i4 E106{short_integer} 24m46 24r46 171m7 171r15
25i4 E104{short_integer} 25m46 25r46 172m7 172r15
27a4 Local_Priority_Specific_Dispatching{string} 125r9
28a4 Local_Interrupt_States{string} 128r27
30b4 Is_Elaborated{boolean} 64r14 67m7 114r10 117m7
32U14 finalize_library 32b14 54l8 54t24 137r35
36U20*F1 37b<ada,ada__text_io__finalize_spec>30 39s10
42U20*F2 43b<ada,system__file_io__finalize_body>30 46s10
49U20*Reraise_Library_Exception_If_Any 50b<ada,__gnat_reraise_library_exception_if_any>33
. 52s10
57U17*s_stalib_adafinal 58b<c,system__standard_library__adafinal>25 69s7
60U17*Runtime_Finalize 61b<c,__gnat_runtime_finalize>25 68s7
72P9 No_Param_Proc 111r34
75i7*Main_Priority{integer} 76m25 76r25 118m7
77i7*Time_Slice_Value{integer} 78m25 78r25 119m7
79e7*WC_Encoding{character} 80m25 80r25 120m7
81e7*Locking_Policy{character} 82m25 82r25 121m7
83e7*Queuing_Policy{character} 84m25 84r25 122m7
85e7*Task_Dispatching_Policy{character} 86m25 86r25 123m7
87m7*Priority_Specific_Dispatching{6|67M9} 88m25 88r25 124m7
89i7*Num_Specific_Dispatching{integer} 90m25 90r25 126m7
91i7*Main_CPU{integer} 92m25 92r25 127m7
93m7*Interrupt_States{6|67M9} 94m25 94r25 128m7
95i7*Num_Interrupt_States{integer} 96m25 96r25 129m7
97i7*Unreserve_All_Interrupts{integer} 98m25 98r25 130m7
99i7*Detect_Blocking{integer} 100m25 100r25 131m7
101i7*Default_Stack_Size{integer} 102m25 102r25 132m7
103i7*Leap_Seconds_Support{integer} 104m25 104r25 133m7
105m7*Bind_Env_Addr{6|67M9} 106m25 106r25
108U17*Runtime_Initialize 108>37 109b<c,__gnat_runtime_initialize>25 135s7
108i37 Install_Handler{integer}
111p7*Finalize_Library_Objects{72P9} 112m25 112r25 137m7
175U14 Ada_Main_Program 176b<ada,_ada_tester_listes>24 201s7
184U17*Initialize 184>29 185b<c,__gnat_initialize>25 199s7
184m29 Addr{6|67M9}
187U17*Finalize 188b<c,__gnat_finalize>25 203s7
189a7 SEH(integer) 199m19 199r19
191m7 Ensure_Reference{6|67M9} 192r24
X 6 system.ads
37K9*System 4|3w6 7r16 8r16 32r14 33r14 5|87r39 93r26 105r23 180r14 181r14
. 184r36 191r34 6|156e11
67M9*Address 4|7r23 8r23 32r21 33r21 5|87r46 93r33 105r30 180r21 181r21 184r43
. 191r41

91
td08/gpsauto.cgpr Executable file
View file

@ -0,0 +1,91 @@
project _Auto is
for Library_Support use "full";
for Library_Auto_Init_Supported use "true";
for Target use "";
for Default_Language use "ada";
package Compiler is
for Driver ("ada") use "gcc";
for Language_Kind ("ada") use "unit_based";
for Dependency_Kind ("ada") use "ALI_File";
for Object_File_Suffix ("html") use "-";
for Object_File_Suffix ("xml") use "-";
for Object_File_Suffix ("matlab") use "-";
for Object_File_Suffix ("c#") use "-";
for Object_File_Suffix ("asm2") use "-";
for Object_File_Suffix ("asm_cpp") use "-";
for Object_File_Suffix ("asm") use "-";
for Object_File_Suffix ("gnat expanded code") use "-";
for Object_File_Suffix ("java") use "-";
for Object_File_Suffix ("javascript") use "-";
for Object_File_Suffix ("tcl") use "-";
for Object_File_Suffix ("shell") use "-";
for Object_File_Suffix ("makefile") use "-";
for Object_File_Suffix ("m4") use "-";
for Object_File_Suffix ("fortran 90") use "-";
for Object_File_Suffix ("pascal") use "-";
for Object_File_Suffix ("perl") use "-";
for Object_File_Suffix ("awk") use "-";
for Object_File_Suffix ("autoconf") use "-";
for Object_File_Suffix ("rest") use "-";
for Object_File_Suffix ("texinfo") use "-";
for Object_File_Suffix ("project file") use "-";
for Object_File_Suffix ("changelog") use "-";
for Object_File_Suffix ("qgen") use "-";
for Object_File_Suffix ("simulink") use "-";
for Object_File_Suffix ("python") use ".pyc";
for Object_File_Suffix ("css") use "-";
for Object_File_Suffix ("c++") use ".o";
for Object_File_Suffix ("c") use ".o";
for Object_File_Suffix ("ada") use ".o";
end Compiler;
package Naming is
for Spec_Suffix ("ada") use ".ads";
for Body_Suffix ("ada") use ".adb";
for Spec_Suffix ("c") use ".h";
for Body_Suffix ("c") use ".c";
for Spec_Suffix ("c++") use ".hh";
for Body_Suffix ("c++") use ".cpp";
for Dot_Replacement use "-";
for Casing use "lowercase";
for Spec_Suffix ("html") use ".html";
for Body_Suffix ("xml") use ".xml";
for Body_Suffix ("matlab") use ".m";
for Spec_Suffix ("c#") use ".cs";
for Body_Suffix ("asm2") use ".asm";
for Body_Suffix ("asm_cpp") use ".S";
for Body_Suffix ("asm") use ".s";
for Body_Suffix ("gnat expanded code") use ".dg";
for Body_Suffix ("java") use ".java";
for Body_Suffix ("javascript") use ".js";
for Body_Suffix ("tcl") use ".tcl";
for Body_Suffix ("shell") use ".sh";
for Body_Suffix ("m4") use ".m4";
for Body_Suffix ("fortran 90") use ".f";
for Body_Suffix ("pascal") use ".pas";
for Body_Suffix ("perl") use ".pl";
for Body_Suffix ("awk") use ".awk";
for Body_Suffix ("autoconf") use "configure.in";
for Body_Suffix ("rest") use ".rst";
for Body_Suffix ("texinfo") use ".texi";
for Body_Suffix ("project file") use ".gpr";
for Spec_Suffix ("changelog") use ".changelog";
for Body_Suffix ("qgen") use ".xmi";
for Spec_Suffix ("simulink") use ".slx";
for Body_Suffix ("simulink") use ".mdl";
for Body_Suffix ("python") use ".py";
for Body_Suffix ("css") use ".css";
for Spec_Suffix ("c++") use ".hh";
for Body_Suffix ("c++") use ".cpp";
for Spec_Suffix ("c") use ".h";
for Body_Suffix ("c") use ".c";
for Spec_Suffix ("ada") use ".ads";
for Body_Suffix ("ada") use ".adb";
end Naming;
for Library_Support use "full";
end _Auto;

946
td08/listes.adb Executable file
View file

@ -0,0 +1,946 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Unchecked_Deallocation;
package body Listes is
--! Les sous-programmes pour lesquels on demande une version itérative et
--! récursive apparaissent trois fois :
--! - avec le suffixe _Recursive : pour la version récursive
--! - avec le suffixe _Iterative : pour la version itérative
--! - sans suffixe : c'est le corps du sous-programme de l'interface qui
--! appelle la version récursive. Inutile de le changer (sauf pour
--! Afficher on pourra le changer pour essayer l'autre version).
--!
--! Un trait horizontal sépare les différents groupes de sous-programmes.
----------------------------------------------------------------------------
procedure Free is
new Ada.Unchecked_Deallocation (T_Cellule, T_Liste);
---------------------------------------------------------------------------- question 1
procedure Initialiser (Liste: out T_Liste) is
begin
Liste := null;
end Initialiser;
----------------------------------------------------------------------------
procedure Detruire_Recursive (Liste: in out T_Liste) is
begin
if Liste /= null then
Detruire_Recursive(Liste.All.Suivante);
Free(Liste);
Liste := null;
end if;
end Detruire_Recursive;
procedure Detruire_Iterative (Liste: in out T_Liste) is
A_Detruire: T_Liste := Liste;
Curseur: T_Liste := A_Detruire.All.Suivante;
begin
while (Curseur /= null) loop
Free(A_Detruire);
A_Detruire := Curseur;
Curseur := Curseur.All.Suivante;
end loop;
Free(A_Detruire);
Liste := null;
end Detruire_Iterative;
procedure Detruire (Liste: in out T_Liste) is
begin
Detruire_Recursive (Liste);
end Detruire;
---------------------------------------------------------------------------- question 2
procedure Ajouter_Debut (Liste: in out T_Liste; Element: in T_Element) is
begin
if Liste = null then
Liste := new T_Cellule'(Element, Null);
else
Liste := new T_Cellule'(Element, Liste);
end if;
end Ajouter_Debut;
---------------------------------------------------------------------------- question 3
function Premier (Liste: in T_Liste) return T_Element is
begin
if Taille(Liste) = 0 then
raise Element_Absent_Error;
else
return Liste.All.Element;
end if;
end Premier;
---------------------------------------------------------------------------- question 4
function Taille_Recursive (Liste: in T_Liste) return Integer is
begin
if Liste = null then
return 0;
else
return 1 + Taille_Recursive(Liste.All.Suivante);
end if;
end Taille_Recursive;
function Taille_Iterative (Liste: in T_Liste) return Integer is
Cursor : T_liste := Liste;
l : Integer := 0;
begin
while (Cursor /= null) loop
Cursor := Cursor.All.Suivante;
l := l + 1;
end loop;
return l;
end Taille_Iterative;
function Taille (Liste: in T_Liste) return Integer is
begin
return Taille_Recursive (Liste);
end Taille;
---------------------------------------------------------------------------- question 5
generic
with procedure Afficher_Element (Element: in T_Element);
procedure Afficher_Recursive (Liste: in T_Liste);
procedure Afficher_Recursive (Liste: in T_Liste) is
begin
if Liste = null then
put("--E");
else
put("-->[");
Afficher_Element(Liste.All.Element);
put("]");
Afficher_Recursive(Liste.All.Suivante);
end if;
end Afficher_Recursive;
generic
with procedure Afficher_Element (Element: in T_Element);
procedure Afficher_Iterative (Liste: in T_Liste);
procedure Afficher_Iterative (Liste: in T_Liste) is
Cursor : T_liste := Liste;
begin
while (Cursor /= null) loop
put("-->[");
Afficher_Element(Cursor.All.Element);
put("]");
Cursor := Cursor.All.Suivante;
end loop;
put("--E");
end Afficher_Iterative;
procedure Afficher (Liste: in T_Liste) is
procedure Afficher_Recursive_Instanciee is
new Afficher_Recursive (Afficher_Element);
begin
Afficher_Recursive_Instanciee (Liste);
end Afficher;
---------------------------------------------------------------------------- question 6
function Est_Present_Recursive (Liste: in T_Liste; Element: in T_Element) return Boolean is
begin
if Liste = null then
return False;
elsif Liste.All.Element = Element then
return True;
else
return Est_Present_Recursive(Liste.All.Suivante, Element);
end if;
end Est_Present_Recursive;
function Est_Present_Iterative (Liste: in T_Liste; Element: in T_Element) return Boolean is
Cursor : T_liste := Liste;
begin
while (Cursor /= null) loop
if Cursor.All.Element = Element then
return True;
end if;
Cursor := Cursor.All.Suivante;
end loop;
return False;
end Est_Present_Iterative;
function Est_Present (Liste: in T_Liste; Element: in T_Element) return Boolean is
begin
return Est_Present_Recursive (Liste, Element);
end Est_Present;
---------------------------------------------------------------------------- question 7
procedure Supprimer_Recursive (Liste: in out T_Liste; Element: in T_Element) is
Cursor : T_Liste;
begin
if not Est_Present(Liste, Element) then
raise Element_Absent_Error;
elsif Liste.All.Suivante.All.Element = Element then
Cursor := Liste.All.Suivante.All.Suivante;
Free(Liste.All.Suivante);
Liste.All.Suivante:= Cursor;
else
Supprimer_Recursive(Liste.All.Suivante, Element);
end if;
end Supprimer_Recursive;
procedure Supprimer_Iterative (Liste: in out T_Liste; Element: in T_Element) is
Cursor: T_Liste := Liste;
Cursor_next: T_Liste;
begin
if not Est_Present(Liste, Element) then
raise Element_Absent_Error;
else
while (Cursor.All.Suivante /= null) loop
exit when Cursor.All.Suivante.All.Element = Element;
Cursor := Cursor.All.Suivante;
end loop;
Cursor_next := Cursor.All.Suivante.All.Suivante;
Free(Cursor.All.Suivante);
Cursor.All.Suivante := Cursor_next;
end if;
end Supprimer_Iterative;
procedure Supprimer (Liste: in out T_Liste; Element: in T_Element) is
begin
Supprimer_Recursive (Liste, Element);
end Supprimer;
---------------------------------------------------------------------------- question 8
function Cellule_Contenant_Recursive (Element: T_Element; Liste: in T_Liste) return T_Liste is
begin
if Liste = null then
return null;
elsif Liste.All.Element = Element then
return Liste;
else
return Cellule_Contenant_Recursive(Element, Liste.All.Suivante);
end if;
end Cellule_Contenant_Recursive;
function Cellule_Contenant_Iterative (Element: T_Element; Liste: in T_Liste) return T_Liste is
Cursor : T_liste := Liste;
begin
while (Cursor /= null) loop
if Cursor.All.Element = Element then
return Cursor;
end if;
Cursor := Cursor.All.Suivante;
end loop;
return null;
end Cellule_Contenant_Iterative;
function Cellule_Contenant (Element: T_Element; Liste: in T_Liste) return T_Liste is
begin
return Cellule_Contenant_Recursive (Element, Liste);
end Cellule_Contenant;
---------------------------------------------------------------------------- question 9
procedure Inserer_Apres (Liste: in out T_Liste ; Nouveau, Element: in T_Element) is
Cursor: T_Liste;
begin
if not Est_Present(Liste, Element) then
raise Element_Absent_Error;
else
Cursor := Cellule_Contenant(Element, Liste);
Cursor.All.Suivante := new T_Cellule'(Nouveau, Cursor.All.Suivante);
end if;
end Inserer_Apres;
---------------------------------------------------------------------------- question 10
function Ieme_Recursive (Liste: in T_Liste; Indice: in Integer) return T_Element is
begin
if Indice < 0 then
raise Indice_Error;
elsif Indice = 0 then
return Liste.All.Element;
else
return Ieme_Recursive(Liste.All.Suivante, Indice - 1);
end if;
end Ieme_Recursive;
function Ieme_Iterative (Liste: in T_Liste; Indice: in Integer) return T_Element is
Cursor : T_liste := Liste;
l : Integer := 0;
begin
if Indice < 0 then
raise Indice_Error;
else
While (Cursor /= null) Loop
exit when l = Indice;
Cursor := Cursor.All.Suivante;
l := l + 1;
End Loop;
return Cursor.All.Element;
end if;
end Ieme_Iterative;
function Ieme (Liste: in T_Liste; Indice: in Integer) return T_Element is
begin
return Ieme_Recursive (Liste, Indice);
end Ieme;
---------------------------------------------------------------------------- question 11
procedure Supprimer_Ieme_Recursive (Liste: in out T_Liste; Indice: in Integer) is
Cursor : T_Liste := Liste;
begin
if Indice < 0 then
raise Indice_Error;
elsif Indice = 0 then
Liste := Liste.All.Suivante;
Free(Cursor);
elsif Indice = 1 then
Cursor := Liste.All.Suivante.All.Suivante;
Free(Liste.All.Suivante);
Liste.All.Suivante:= Cursor;
else
Supprimer_Ieme_Recursive(Liste.All.Suivante, Indice - 1);
end if;
end Supprimer_Ieme_Recursive;
procedure Supprimer_Ieme_Iterative (Liste: in out T_Liste; Indice: in Integer) is
Cursor: T_Liste := Liste;
Cursor_next: T_Liste;
l : Integer := 0;
begin
if Indice < 0 then
raise Indice_Error;
else
While (Cursor.All.Suivante.All.Suivante /= null) Loop
exit when l = Indice - 1;
Cursor := Cursor.All.Suivante;
l := l + 1;
End Loop;
end if;
if l /= Indice - 1 then
raise Indice_Error;
else
Cursor_next := Cursor.All.Suivante.All.Suivante;
Free(Cursor.All.Suivante);
Cursor.All.Suivante := Cursor_next;
end if;
end Supprimer_Ieme_Iterative;
procedure Supprimer_Ieme (Liste: in out T_Liste; Indice: in Integer) is
begin
Supprimer_Ieme_Recursive (Liste, Indice);
end Supprimer_Ieme;
---| les tests |------------------------------------------------------------
procedure Tester is
-- XXX
procedure Put is new Afficher (Afficher_Element);
-- Initialiser une liste [ Un, Trois, Un, Deux].
-- Elle devra être détruite.
procedure Initialiser_Liste1312 (Liste: out T_Liste) is
begin
Initialiser (Liste);
Ajouter_Debut (Liste, Deux);
Ajouter_Debut (Liste, Un);
Ajouter_Debut (Liste, Trois);
Ajouter_Debut (Liste, Un);
end;
procedure Tester_Initialiser is
Vide: T_Liste;
begin
Initialiser (Vide);
pragma Assert (Vide = null);
end Tester_Initialiser;
procedure Tester_Ajouter_Debut is
Liste: T_Liste;
begin
Initialiser (Liste);
-- ajouter un premier élémnet
Ajouter_Debut (Liste, Un);
pragma Assert (Liste /= null);
pragma Assert (Liste.all.Suivante = null);
pragma Assert (Liste.all.Element = Un);
-- ajouter un deuxième élémnet
Ajouter_Debut (Liste, Deux);
pragma Assert (Liste /= null);
pragma Assert (Liste.all.Element = Deux);
pragma Assert (Liste.all.Suivante /= null);
pragma Assert (Liste.all.Suivante.all.Element = Un);
pragma Assert (Liste.all.Suivante.all.Suivante = null);
Detruire (Liste);
end Tester_Ajouter_Debut;
procedure Tester_Premier is
Liste: T_Liste;
begin
Initialiser (Liste);
-- ajouter un premier élémnet
Ajouter_Debut (Liste, Un);
pragma Assert (Premier (Liste) = Un);
-- ajouter un deuxième élémnet
Ajouter_Debut (Liste, Deux);
pragma Assert (Premier (Liste) = Deux);
-- ajouter un troisième élémnet
Ajouter_Debut (Liste, Trois);
pragma Assert (Premier (Liste) = Trois);
Detruire (Liste);
end Tester_Premier;
generic
with function Taille (Liste: in T_Liste) return Integer;
procedure Tester_Taille;
procedure Tester_Taille is
Liste: T_Liste;
begin
Initialiser (Liste);
pragma Assert (Taille (Liste) = 0);
-- ajouter un premier élémnet
Ajouter_Debut (Liste, Un);
pragma Assert (Taille (Liste) = 1);
-- ajouter un deuxième élémnet
Ajouter_Debut (Liste, Deux);
pragma Assert (Taille (Liste) = 2);
-- ajouter un troisième élémnet
Ajouter_Debut (Liste, Trois);
pragma Assert (Taille (Liste) = 3);
-- ajouter un quatirème élémnet
Ajouter_Debut (Liste, Un);
pragma Assert (Taille (Liste) = 4);
Detruire (Liste);
end Tester_Taille;
procedure Tester_Taille_Recursive is
new Tester_Taille (Taille_Recursive);
procedure Tester_Taille_Iterative is
new Tester_Taille (Taille_Iterative);
generic
with function Est_Present (Liste: in T_Liste; Element: in T_Element) return Boolean;
procedure Tester_Est_Present;
procedure Tester_Est_Present is
Liste: T_Liste;
begin
Initialiser (Liste);
pragma Assert (not Est_Present (Liste, Un));
-- ajouter un premier élémnet
Ajouter_Debut (Liste, Un);
pragma Assert (Est_Present (Liste, Un));
pragma Assert (not Est_Present (Liste, Deux));
-- ajouter un deuxième élémnet
Ajouter_Debut (Liste, Deux);
pragma Assert (Est_Present (Liste, Un));
pragma Assert (Est_Present (Liste, Deux));
pragma Assert (not Est_Present (Liste, Trois));
-- ajouter un troisième élémnet
Ajouter_Debut (Liste, Un);
pragma Assert (Est_Present (Liste, Un));
pragma Assert (Est_Present (Liste, Deux));
pragma Assert (not Est_Present (Liste, Trois));
Detruire (Liste);
end Tester_Est_Present;
procedure Tester_Est_Present_Recursive is
new Tester_Est_Present (Est_Present_Recursive);
procedure Tester_Est_Present_Iterative is
new Tester_Est_Present (Est_Present_Iterative);
generic
with function Cellule_Contenant (Element: in T_Element; Liste: in T_Liste) return T_Liste;
procedure Tester_Cellule_Contenant;
procedure Tester_Cellule_Contenant is
procedure Tester_Existants is
Liste: T_Liste;
begin
Initialiser_Liste1312 (Liste);
pragma Assert (Cellule_Contenant (Un, Liste) = Liste);
pragma Assert (Cellule_Contenant (Trois, Liste) = Liste.all.Suivante);
pragma Assert (Cellule_Contenant (Deux, Liste) = Liste.all.Suivante.all.Suivante.all.Suivante);
Detruire (Liste);
end Tester_Existants;
procedure Tester_Absent (Liste: in T_Liste; Element: in T_Element) is
Ptr: T_Liste;
begin
Ptr := Cellule_Contenant (Element, Liste);
pragma Assert (False);
pragma Assert (Ptr = null); --! pour éviter l'avertissement
exception
when Element_Absent_Error =>
null;
when others =>
pragma Assert (False);
end;
Liste: T_Liste;
begin
Tester_Existants;
-- tester les cas l'élément n'est pas présent
Initialiser (Liste);
Tester_Absent (Liste, Un);
Ajouter_Debut (Liste, Deux);
Tester_Absent (Liste, Un);
Ajouter_Debut (Liste, Trois);
Tester_Absent (Liste, Un);
Detruire (Liste);
end Tester_Cellule_Contenant;
procedure Tester_Cellule_Contenant_Recursive is
new Tester_Cellule_Contenant (Cellule_Contenant_Recursive);
procedure Tester_Cellule_Contenant_Iterative is
new Tester_Cellule_Contenant (Cellule_Contenant_Iterative);
generic
with procedure Supprimer (Liste: in out T_Liste; Element: in T_Element);
procedure Tester_Supprimer;
procedure Tester_Supprimer is
procedure Supprimer_Trace (Liste: in out T_Liste; Element: in T_Element) is
begin
-- Tracer l'instruction qui va être exécutée
Put ("> Supprimer (..., ");
Afficher_Element (Element);
Put (");");
New_Line;
Supprimer (Liste, Element);
-- Afficher la liste
Put (Liste);
New_Line;
New_Line;
end Supprimer_Trace;
procedure Supprimer_Extremites is
Liste: T_Liste;
begin
Initialiser_Liste1312 (Liste);
New_Line;
Put_Line ("## Supprimer_Extremites");
New_Line;
Put (Liste);
New_Line;
New_Line;
-- supprimer le premier élément
Supprimer_Trace (Liste, Un);
pragma Assert (Premier (Liste) = Trois);
pragma Assert (Taille (Liste) = 3);
-- supprimer le dernier élément
Supprimer_Trace (Liste, Deux);
pragma Assert (Taille (Liste) = 2);
-- supprimer le dernier élément
Supprimer_Trace (Liste, Un);
pragma Assert (Taille (Liste) = 1);
-- supprimer le seul élément
Supprimer_Trace (Liste, Trois);
pragma Assert (Taille (Liste) = 0);
Detruire (Liste);
end Supprimer_Extremites;
procedure Supprimer_Milieu is
Liste: T_Liste;
begin
Initialiser_Liste1312 (Liste);
New_Line;
Put_Line ("## Supprimer_Milieu");
New_Line;
Put (Liste);
New_Line;
New_Line;
-- supprimer le premier élément
Supprimer_Trace (Liste, Un);
pragma Assert (Premier (Liste) = Trois);
pragma Assert (Taille (Liste) = 3);
pragma Assert (Est_Present (Liste, Un));
pragma Assert (Est_Present (Liste, Deux));
-- supprimer un élément au milieu
Supprimer_Trace (Liste, Un);
pragma Assert (Taille (Liste) = 2);
pragma Assert (Premier (Liste) = Trois);
pragma Assert (Est_Present (Liste, Deux));
Detruire (Liste);
end Supprimer_Milieu;
procedure Supprimer_Liste_Vide is
Vide: T_Liste;
begin
Initialiser (Vide);
Supprimer (Vide, Un);
pragma Assert (False);
exception
when Element_Absent_Error =>
null;
Detruire (Vide);
when others =>
--pragma Assert (False);
null;
end Supprimer_Liste_Vide;
procedure Supprimer_Liste1_Un_Element_Present is
Liste: T_Liste;
begin
Initialiser (Liste);
Ajouter_Debut (Liste, Un);
Supprimer (Liste, Un);
pragma Assert (Taille(Liste) = 0);
Detruire (Liste);
end Supprimer_Liste1_Un_Element_Present;
procedure Supprimer_Liste1_Un_Element_Absent is
Liste: T_Liste;
begin
Initialiser (Liste);
Ajouter_Debut (Liste, Un);
Supprimer (Liste, Deux);
pragma Assert (False);
exception
when Element_Absent_Error =>
null;
Detruire (Liste);
when others =>
pragma Assert (False);
end Supprimer_Liste1_Un_Element_Absent;
begin
pragma Assert (Un /= Deux);
pragma Assert (Un /= Trois);
pragma Assert (Deux /= Trois);
Supprimer_Liste_Vide;
Supprimer_Liste1_Un_Element_Present;
Supprimer_Liste1_Un_Element_Absent;
Supprimer_Extremites;
Supprimer_Milieu;
end;
procedure Tester_Supprimer_Recursive is
new Tester_Supprimer(Supprimer_Recursive);
procedure Tester_Supprimer_Iterative is
new Tester_Supprimer(Supprimer_Iterative);
generic
with function Ieme (Liste: in T_Liste; Indice: in Integer) return T_Element;
procedure Tester_Ieme;
procedure Tester_Ieme is
procedure Tester_Nominal is
Liste: T_Liste;
begin
Initialiser_Liste1312 (Liste);
pragma Assert (Ieme (Liste, 0) = Un);
pragma Assert (Ieme (Liste, 1) = Trois);
pragma Assert (Ieme (Liste, 2) = Un);
pragma Assert (Ieme (Liste, 3) = Deux);
Detruire (Liste);
end Tester_Nominal;
procedure Tester_Indice_Invalide (Liste: in T_Liste; Indice: in Integer) is
Element: T_Element;
begin
Element := Ieme (Liste, Indice);
pragma Assert (False);
pragma Assert (Element = Un); -- pour eviter le warning
exception
when Indice_Error =>
null;
when others =>
pragma Assert (False);
end Tester_Indice_Invalide;
Vide: T_Liste;
Liste: T_Liste;
begin
Tester_Nominal;
Initialiser (Vide);
Tester_Indice_Invalide (Vide, 0);
Tester_Indice_Invalide (Vide, -1);
Tester_Indice_Invalide (Vide, 1);
Detruire (Vide);
Initialiser_Liste1312 (Liste);
Tester_Indice_Invalide (Vide, 4);
Tester_Indice_Invalide (Vide, 10);
Tester_Indice_Invalide (Vide, -1);
Tester_Indice_Invalide (Vide, -10);
Detruire (Liste);
end Tester_Ieme;
procedure Tester_Ieme_Recursive is
new Tester_Ieme (Ieme_Recursive);
procedure Tester_Ieme_Iterative is
new Tester_Ieme (Ieme_Iterative);
procedure Tester_Inserer_Apres is
procedure Test_Nominal is
Liste: T_Liste;
begin
Initialiser (Liste);
Ajouter_Debut (Liste, Un);
Inserer_Apres (Liste, Deux, Un);
pragma Assert (Taille (Liste) = 2);
pragma Assert (Premier (Liste) = Un);
pragma Assert (Liste.all.Suivante.all.Element = Deux);
Inserer_Apres (Liste, Un, Deux);
pragma Assert (Taille (Liste) = 3);
pragma Assert (Premier (Liste) = Un);
pragma Assert (Liste.all.Suivante.all.Element = Deux);
pragma Assert (Liste.all.Suivante.all.Suivante.all.Element = Un);
Inserer_Apres (Liste, Trois, Un);
pragma Assert (Taille (Liste) = 4);
pragma Assert (Premier (Liste) = Un);
pragma Assert (Liste.all.Suivante.all.Element = Trois);
pragma Assert (Liste.all.Suivante.all.Suivante.all.Element = Deux);
Detruire (Liste);
end Test_Nominal;
procedure Test_Erreur (Liste: in out T_Liste; Element: in T_Element) is
begin
Inserer_Apres (Liste, Un, Element);
pragma Assert (False);
exception
when Element_Absent_Error =>
null;
when others =>
pragma Assert (False);
end Test_Erreur;
Liste: T_Liste;
begin
Test_Nominal;
-- Tests erreurs
Initialiser (Liste);
for I in 1..10 loop
Test_Erreur (Liste, Deux);
Ajouter_Debut (Liste, Un);
end loop;
Detruire (Liste);
end Tester_Inserer_Apres;
generic
with procedure Supprimer_Ieme (Liste: in out T_Liste; Indice: in Integer);
procedure Tester_Supprimer_Ieme;
procedure Tester_Supprimer_Ieme is
procedure Supprimer_Ieme_Trace (Liste: in out T_Liste; Indice: in Integer) is
begin
-- Tracer l'instruction qui va être exécutée
Put ("> Supprimer_Ieme (..., ");
Put (Indice, 1);
Put (");");
New_Line;
Supprimer_Ieme (Liste, Indice);
-- Afficher la liste
Put (Liste);
New_Line;
New_Line;
end Supprimer_Ieme_Trace;
procedure Supprimer_Ieme_Nominal is
Liste: T_Liste;
begin
Initialiser_Liste1312 (Liste);
New_Line;
Put_Line ("## Supprimer_Ieme_Nominal");
New_Line;
Put (Liste);
New_Line;
New_Line;
-- supprimer au milieu
Supprimer_Ieme_Trace (Liste, 2);
pragma Assert (Taille (Liste) = 3);
pragma Assert (Est_Present (Liste, Un));
pragma Assert (Est_Present (Liste, Deux));
pragma Assert (Est_Present (Liste, Trois));
-- supprimer le dernier élément
Supprimer_Ieme_Trace (Liste, 2);
pragma Assert (Taille (Liste) = 2);
pragma Assert (Est_Present (Liste, Un));
pragma Assert (not Est_Present (Liste, Deux));
pragma Assert (Est_Present (Liste, Trois));
-- supprimer le premier élément
Supprimer_Ieme_Trace (Liste, 0);
pragma Assert (Taille (Liste) = 1);
pragma Assert (Premier (Liste) = Trois);
-- supprimer le seul élément
Supprimer_Ieme_Trace (Liste, 0);
pragma Assert (Taille (Liste) = 0);
Detruire (Liste);
end Supprimer_Ieme_Nominal;
procedure Supprimer_Ieme_Erreur (Liste: in out T_Liste; Indice: in Integer) is
begin
Supprimer_Ieme (Liste, Indice);
pragma Assert (False);
exception
when Indice_Error =>
null;
when others =>
pragma Assert (False);
end Supprimer_Ieme_Erreur;
Liste: T_Liste;
begin
Supprimer_Ieme_Nominal;
Initialiser (Liste);
Supprimer_Ieme_Erreur (Liste, 0);
Supprimer_Ieme_Erreur (Liste, -1);
Supprimer_Ieme_Erreur (Liste, 1);
Detruire (Liste);
Initialiser_Liste1312 (Liste);
Supprimer_Ieme_Erreur (Liste, Taille (Liste));
Supprimer_Ieme_Erreur (Liste, -1);
Detruire (Liste);
end Tester_Supprimer_Ieme;
procedure Tester_Supprimer_Ieme_Recursive is
new Tester_Supprimer_Ieme(Supprimer_Ieme_Recursive);
procedure Tester_Supprimer_Ieme_Iterative is
new Tester_Supprimer_Ieme(Supprimer_Ieme_Iterative);
begin
pragma Assert (Un /= Deux);
pragma Assert (Un /= Trois);
pragma Assert (Deux /= Trois);
Tester_Initialiser;
Tester_Ajouter_Debut;
Tester_Premier;
Tester_Taille_Recursive;
Tester_Taille_Iterative;
Tester_Est_Present_Recursive;
Tester_Est_Present_Iterative;
Tester_Supprimer_Recursive;
Tester_Supprimer_Iterative;
Tester_Cellule_Contenant_Recursive;
Tester_Cellule_Contenant_Iterative;
Tester_Inserer_Apres;
Tester_Ieme_Recursive;
Tester_Ieme_Iterative;
Tester_Supprimer_Ieme_Recursive;
Tester_Supprimer_Ieme_Iterative;
end Tester;
end Listes;

2
td08/listes.adb.stderr Executable file
View file

@ -0,0 +1,2 @@
listes.adb:43:19: warning: procedure "Detruire_Iterative" is not referenced
listes.adb:131:19: warning: generic procedure "Afficher_Iterative" is never instantiated

0
td08/listes.adb.stdout Executable file
View file

97
td08/listes.ads Executable file
View file

@ -0,0 +1,97 @@
generic
type T_Element is private;
package Listes is
type T_Liste is limited private;
Indice_Error: Exception; -- Un indice est invalide
Element_Absent_Error: Exception; -- Élément non trouvé
-- Initialiser une liste.
procedure Initialiser (Liste: out T_Liste);
-- Détruire une liste et libérer toutes les ressources qu'elle utilise.
-- Une liste détruite ne doit plus être utilisée.
procedure Detruire (Liste: in out T_Liste);
-- Ajouter un nouvel élément au début d'une liste.
procedure Ajouter_Debut (Liste: in out T_Liste; Element: T_Element);
-- Retourner le premier élément d'une liste.
-- Exception : Element_Absent_Error si la liste est vide
function Premier (Liste: in T_Liste) return T_Element;
-- Retourner la taille d'une liste.
function Taille (Liste: in T_Liste) return Integer;
-- Afficher les éléments d'une liste en révélant la structure interne.
-- Par exemple : -->[1]-->[3]-->[1]-->[2]--E
--! Cette opération serait plutôt utilisée à des fin de mise au point et
--! pourrait rester locale au module. Pour l'utilisateur du module
--! une procédure qui affiche [1, 3, 1, 2] serait plus utile.
generic
with procedure Afficher_Element (Element: in T_Element);
procedure Afficher (Liste: in T_Liste);
-- Retourner vrai ssi Element est dans Liste.
function Est_Present (Liste: in T_Liste; Element: in T_Element) return Boolean;
-- Suppprimer la première occurrence de Element dans Liste.
-- Exception : Element_Absent_Error si l'élément n'est pas trouvé.
procedure Supprimer (Liste: in out T_Liste; Element: in T_Element);
-- Insérer un nouvel élément (Nouveau) dans la liste (Liste) après un
-- élément existant (Element).
-- Exception : Element_Absent_Error si Element n'est pas dans la liste
procedure Inserer_Apres (Liste: in out T_Liste; Nouveau, Element: in T_Element);
-- Retourner l'élément à la position Indice dans la Liste.
-- Le premier élément est à l'indice 0.
-- Exception : Indice_Error si l'indice n'est pas valide
function Ieme (Liste: in T_Liste; Indice: in Integer) return T_Element;
-- Supprimer l'élément à la position Indice dans la Liste.
-- Le premier élément est à l'indice 0.
-- Exception : Indice_Error si l'indice n'est pas valide
procedure Supprimer_Ieme (Liste: in out T_Liste; Indice: in Integer);
-- Procédure de test de la liste.
generic
Un, Deux, Trois : T_Element; -- Trois éléments différents
with procedure Afficher_Element (Element: in T_Element);
procedure Tester;
private
type T_Cellule;
type T_Liste is access T_Cellule;
type T_Cellule is
record
Element: T_Element;
Suivante: T_Liste;
end record;
function Cellule_Contenant (Element: T_Element; Liste: in T_Liste) return T_Liste with
Post => Cellule_Contenant'Result /= null
and then Cellule_Contenant'Result.all.Element = Element;
--! Spécifier ici, dans la partie private, ce sous-programme n'est
--! pas accessible des utilisateurs du module mais le sera de tous
--! sous-programme du corps du module.
end Listes;

340
td08/listes.ali Executable file
View file

@ -0,0 +1,340 @@
V "GNAT Lib v7"
A -gnatwa
A -gnata
A -g
P ZX
RN
RV NO_ALLOCATORS
RV NO_EXCEPTION_HANDLERS
RV NO_EXCEPTIONS
RV NO_IO
RV NO_LOCAL_ALLOCATORS
RV NO_RECURSION
RV NO_STANDARD_STORAGE_POOLS
RV NO_UNCHECKED_DEALLOCATION
RV NO_DEFAULT_INITIALIZATION
RV SPARK_05
U listes%b listes.adb 12c2f32c NE OO PK GE
W ada%s ada.ads ada.ali
W ada.integer_text_io%s a-inteio.ads a-inteio.ali
W ada.text_io%s a-textio.adb a-textio.ali
W ada.unchecked_deallocation%s
U listes%s listes.ads 6e6e8c16 BN EE NE OO PK GE
D ada.ads 20170106103348 76789da1 ada%s
D a-except.ads 20151016123252 291912d5 ada.exceptions%s
D a-inteio.ads 20070406091342 f64b89a4 ada.integer_text_io%s
D a-ioexce.ads 20140225151544 e4a01f64 ada.io_exceptions%s
D a-stream.ads 20141120112812 119b8fb3 ada.streams%s
D a-tags.ads 20151016130316 01f5e3ef ada.tags%s
D a-textio.ads 20140717063745 386df5d4 ada.text_io%s
D a-tiinio.ads 20140717063513 aa04e5d6 ada.text_io.integer_io%s
D a-unccon.ads 20170106103348 31484697 ada.unchecked_conversion%s
D a-uncdea.ads 20070406091342 f15a5ed1 ada.unchecked_deallocation%s
D interfac.ads 20160502101001 5ab55268 interfaces%s
D i-cstrea.ads 20140801100435 e53d8b8e interfaces.c_streams%s
D listes.ads 20201106153924 6e6e8c16 listes%s
D listes.adb 20201106153924 43d05d9b listes%b
D system.ads 20170510173650 4635ec04 system%s
D s-crtl.ads 20141120112812 0ebbdb71 system.crtl%s
D s-exctab.ads 20140225151139 54135002 system.exception_table%s
D s-ficobl.ads 20140718105747 078245e4 system.file_control_block%s
D s-parame.ads 20140801093848 7e2a0d7f system.parameters%s
D s-soflin.ads 20151020124036 14e1eb6c system.soft_links%s
D s-stache.ads 20140225151139 a37c21ec system.stack_checking%s
D s-stalib.ads 20151112104907 09bd3940 system.standard_library%s
D s-stoele.ads 20140225151139 2dc34a04 system.storage_elements%s
D s-traent.ads 20140730135025 005bf670 system.traceback_entries%s
D s-unstyp.ads 20160502101423 34867c83 system.unsigned_types%s
D s-wchcon.ads 20140718092328 1b7d22d2 system.wch_con%s
X 1 ada.ads
16K9*Ada 20e8 14|1r6 1r31 2r6 2r31 3r6 22r21
X 3 a-inteio.ads
18K13*Integer_Text_IO[8|46] 14|2w10 2r35
X 7 a-textio.ads
49K13*Text_IO 471e16 14|1w10 1r35
166U14*New_Line 14|572s33 578s33 579s33 587s33 589s33 591s33 592s33 620s33
. 622s33 624s33 625s33 832s33 838s33 839s33 847s33 849s33 851s33 852s33
242U14*Put 14|123s13 125s13 127s25 142s13 144s13 147s9 569s33 571s33 829s33
. 831s33
263U14*Put_Line 14|588s33 621s33 848s33
X 8 a-tiinio.ads
66U14*Put 14|830s33[3|18]
X 10 a-uncdea.ads
20u15*Unchecked_Deallocation 14|3w10 22r25
X 13 listes.ads
2+14 T_Element 21r66 26r53 39r62 44r62 49r65 55r78 61r70 72r35 73r62 85r34
. 89r46 14|64r69 75r53 116r62 134r62 160r72 172r72 185r62 192r75 207r75 225r65
. 232r56 244r56 257r46 264r79 277r80 289r80 306r70 470r83 507r70 522r81 561r86
. 566r87 706r91 723r42 794r83
4k9*Listes 2z14 79E14 97l5 97e11 14|5b14 946l5 946t11
6P14*T_Liste 13r43 17r43 21r48 26r37 30r36 40r39 44r41 49r44 55r48 61r34
. 67r49 81c14 86r35 89r67 89r83 14|22r60 26r43 33r53 43r53 44r29 45r26 57r43
. 64r48 75r37 86r46 96r46 97r18 108r36 117r49 120r49 135r49 138r49 139r18
. 151r39 160r51 172r51 173r18 185r41 192r54 193r26 207r54 208r25 209r30 225r44
. 232r77 232r93 244r77 244r93 245r26 257r67 257r83 264r48 265r17 277r44 289r44
. 290r18 306r34 313r59 314r26 330r59 331r25 332r22 354r49 371r61 382r31 390r32
. 413r32 435r57 439r32 470r62 474r32 507r91 507r107 513r40 522r60 523r38
. 535r32 561r65 566r66 583r40 616r40 646r39 662r40 673r40 706r55 712r40 722r69
. 736r31 737r32 767r40 794r62 805r32 821r70 826r71 843r40 881r72 892r32
8X9*Indice_Error 14|280r31 294r31 317r31 336r31 345r31 729r38 886r38
9X9*Element_Absent_Error 14|78r31 196r31 212r31 268r31 529r38 652r38 680r38
. 799r38
13U19*Initialiser 13<32 14|26b19 29l13 29t24 373s25 384s25 392s25 415s25
. 441s25 476s25 540s25 648s33 664s33 675s33 742s25 769s33 810s25 896s25
13p32 Liste{6P14} 14|26b32 28m17
17U19*Detruire 17=29 14|57b19 60l13 60t21 408s25 429s25 460s25 496s25 519s33
. 549s25 611s33 641s33 654s41 668s33 682s41 719s33 746s25 753s25 791s33 816s25
. 877s33 900s25 905s25
17p29 Liste{6P14} 14|57b29 59m37
21U19*Ajouter_Debut 21=34 21>57 14|64b19 71l13 71t26 374s25 375s25 376s25
. 377s25 395s25 401s25 418s25 422s25 426s25 445s25 449s25 453s25 457s25 480s25
. 485s25 491s25 543s25 546s25 665s33 676s33 771s33 814s33
21p34 Liste{6P14} 14|64b34 66r20 67m25 69m25 69r58
21*57 Element{2+14} 14|64b57 67r49 69r49
26V18*Premier{2+14} 26>27 14|75b18 82l13 82t20 419s40 423s40 427s40 596s48
. 630s48 638s48 775s48 780s48 787s48 871s48
26p27 Liste{6P14} 14|75b27 77r27 80r32
30V18*Taille{integer} 30>26 14|77s20 108b18 111l13 111t19 597s48 601s48 605s48
. 609s48 631s48 637s48 667s48 774s48 779s48 786s48 856s48 863s48 870s48 875s48
. 903s55
30p26 Liste{6P14} 14|108b26 110r42
39U32 Afficher_Element 39>50 14|153r49
39*50 Element{2+14}
40u19*Afficher 40>29 14|151b19 156l13 156t21 366r38
40p29 Liste{6P14} 14|151b29 155r48
44V18*Est_Present{boolean} 44>31 44>50 14|185b18 188l13 188t24 195s24 211s24
. 267s24 632s48 633s48 639s48 857s48 858s48 859s48 864s48 865s52 866s48
44p31 Liste{6P14} 14|185b31 187r47
44*50 Element{2+14} 14|185b50 187r54
49U19*Supprimer 49=30 49>53 14|225b19 228l13 228t22
49p30 Liste{6P14} 14|225b30 227m38
49*53 Element{2+14} 14|225b53 227r45
55U19*Inserer_Apres 55=34 55>57 55>66 14|264b19 273l13 273t26 772s33 778s33
. 784s33 796s33
55p34 Liste{6P14} 14|264b34 267r36 270r62
55*57 Nouveau{2+14} 14|264b58 271r63
55*66 Element{2+14} 14|264b67 267r43 270r53
61V18*Ieme{2+14} 61>24 61>43 14|306b18 309l13 309t17
61p24 Liste{6P14} 14|306b24 308r40
61i43 Indice{integer} 14|306b43 308r47
67U19*Supprimer_Ieme 67=35 67>58 14|354b19 357l13 357t27
67p35 Liste{6P14} 14|354b35 356m43
67i58 Indice{integer} 14|354b58 356r50
72*17 Un{2+14} 14|375r47 377r47 395r47 398r60 405r73 418r47 419r58 445r47
. 457r47 477r64 480r47 481r60 486r60 491r47 492r60 516r67 541r47 544r47 547r47
. 595r57 604r57 629r57 632r68 636r57 649r50 665r55 666r51 676r55 688r40 689r40
. 715r66 717r66 727r58 771r55 772r61 775r66 778r55 780r66 782r94 784r62 787r66
. 796r55 814r55 857r68 864r68 917r32 918r32
72*21 Deux{2+14} 14|374r47 401r47 403r60 422r47 423r58 449r47 482r64 485r47
. 487r60 493r60 518r67 543r47 600r57 633r68 639r68 677r51 688r46 690r40 718r66
. 772r55 776r81 778r59 781r81 789r94 813r53 858r68 865r72 917r38 919r32
72*27 Trois{2+14} 14|376r47 426r47 427r58 453r47 488r64 494r64 517r67 546r47
. 596r66 608r57 630r66 638r66 689r46 690r48 716r66 784r55 788r81 859r68 866r68
. 871r66 918r38 919r40
73U32 Afficher_Element 73>50 14|366r48 570s33
73*50 Element{2+14}
74u19*Tester 14|363b19 944l13 944t19
79R14 T_Cellule 81r32 83c14 87e27 14|22r49 67r38 69r38 271r52
85*25 Element{2+14} 91r71 14|80r42 126r52 143r41 164r33 176r27 197r46 215r67
. 236r33 248r27 282r42 301r43 398r50 403r50 405r63 776r71 781r71 782r84 788r71
. 789r84
86p25 Suivante{6P14} 14|36m54 45r52 50r43 91r51 101r34 128r42 145r34 167r52
. 179r34 197r33 198r45 198r58 199m40 200m35 202m55 214r43 215r54 216r54 218r51
. 218r64 219m41 220m36 239r79 251r34 271m36 271r83 284r57 298r54 319r44 322r45
. 322r58 323m40 324m35 326m60 338r43 338r56 340r54 347r51 347r64 348m41 349m36
. 397r50 404r50 405r50 406r50 406r63 517r93 518r92 518r105 518r118 776r58
. 781r58 782r58 782r71 788r58 789r58 789r71
89V18 Cellule_Contenant{6P14} 89>37 89>57 90r25 91r42 14|257b18 260l13 260t30
. 270s35
89*37 Element{2+14} 91r81 14|257b37 259r53
89p57 Liste{6P14} 14|257b57 259r62
X 14 listes.adb
21U19 Free[10|20] 37s25 48s20 52s17 199s25 219s25 320s25 323s25 348s25
33U19 Detruire_Recursive 33b19 33=39 36s25 40l13 40t31 59s17
33p39 Liste{13|6P14} 35r20 36r44 37m30 38m25
43U19 Detruire_Iterative 43b19 43=39 54l13 54t31
43p39 Liste{13|6P14} 44r40 53m9
44p17 A_Detruire{13|6P14} 45r37 48m25 48r25 49m20 52m22 52r22
45p17 Curseur{13|6P14} 47r24 49r34 50m20 50r31
86V18 Taille_Recursive{integer} 86b18 86>36 91s24 93l13 93t29 110s24 464r44
86p36 Liste{13|6P14} 88r12 91r41
96V18 Taille_Iterative{integer} 96b18 96>36 105l13 105t29 466r44
96p36 Liste{13|6P14} 97r29
97p9 Cursor{13|6P14} 100r16 101m13 101r23
98i9 l{integer} 102m13 102r18 104r16
116U32 Afficher_Element 116>50 126s25
116*50 Element{13|2+14}
117u19 Afficher_Recursive 117>39 120b19 128s13 130l13 130t31 153r29
117p39 Liste{13|6P14} 120b39 122r12 126r42 128r32
134U32 Afficher_Element 134>50 143s13
134*50 Element{13|2+14}
135u19 Afficher_Iterative 135>39 138b19 148l13 148t31
135p39 Liste{13|6P14} 138b39 139r29
139p9 Cursor{13|6P14} 141r16 143r30 145m13 145r23
152U27 Afficher_Recursive_Instanciee[117] 155s17
160V18 Est_Present_Recursive{boolean} 160b18 160>41 160>60 167s20 169l13
. 169t34 187s24 500r49
160p41 Liste{13|6P14} 162r20 164r23 167r42
160*60 Element{13|2+14} 164r43 167r62
172V18 Est_Present_Iterative{boolean} 172b18 172>41 172>60 182l13 182t34
. 502r49
172p41 Liste{13|6P14} 173r29
172*60 Element{13|2+14} 176r37
173p9 Cursor{13|6P14} 175r16 176r16 179m13 179r23
192U19 Supprimer_Recursive 192b19 192=40 192>63 202s25 204l13 204t32 227s17
. 700r46
192p40 Liste{13|6P14} 195r36 197r23 198r35 199r30 200r25 202r45
192*63 Element{13|2+14} 195r43 197r56 202r65
193p17 Cursor{13|6P14} 198m25 200r46
207U19 Supprimer_Iterative 207b19 207=40 207>63 222l13 222t32 702r46
207p40 Liste{13|6P14} 208r36 211r36
207*63 Element{13|2+14} 211r43 215r77
208p17 Cursor{13|6P14} 214r32 215r43 216m33 216r43 218r40 219r30 220r25
209p17 Cursor_next{13|6P14} 218m25 220r48
232V18 Cellule_Contenant_Recursive{13|6P14} 232b18 232>47 232>67 239s32 241l13
. 241t40 259s24 553r55
232*47 Element{13|2+14} 236r43 239r60
232p67 Liste{13|6P14} 234r20 236r23 237r32 239r69
244V18 Cellule_Contenant_Iterative{13|6P14} 244b18 244>47 244>67 254l13 254t40
. 555r55
244*47 Element{13|2+14} 248r37
244p67 Liste{13|6P14} 245r37
245p17 Cursor{13|6P14} 247r16 248r16 249r24 251m13 251r23
265p9 Cursor{13|6P14} 270m25 271r25 271r72
277V18 Ieme_Recursive{13|2+14} 277b18 277>34 277>53 284s32 286l13 286t27
. 308s24 758r42
277p34 Liste{13|6P14} 282r32 284r47
277i53 Indice{integer} 279r20 281r23 284r67
289V18 Ieme_Iterative{13|2+14} 289b18 289>34 289>53 303l13 303t27 760r42
289p34 Liste{13|6P14} 290r29
289i53 Indice{integer} 293r20 297r47
290p9 Cursor{13|6P14} 296r32 298m33 298r43 301r32
291i9 l{integer} 297r43 299m33 299r38
313U19 Supprimer_Ieme_Recursive 313b19 313=45 313>68 326s25 328l13 328t37
. 356s17 910r51
313p45 Liste{13|6P14} 314r37 319m25 319r34 322r35 323r30 324r25 326r50
313i68 Indice{integer} 316r20 318r23 321r23 326r70
314p17 Cursor{13|6P14} 320m30 320r30 322m25 324r46
330U19 Supprimer_Ieme_Iterative 330b19 330=45 330>68 351l13 351t37 912r51
330p45 Liste{13|6P14} 331r36
330i68 Indice{integer} 335r20 339r47 344r25
331p17 Cursor{13|6P14} 338r32 340m33 340r43 347r40 348r30 349r25
332p9 Cursor_next{13|6P14} 347m25 349r48
333i17 l{integer} 339r43 341m33 341r38 344r20
366U27 Put[13|40] 577s33 590s33 623s33 837s33 850s33
371U27 Initialiser_Liste1312 371b27 371<50 378t20 515s33 585s33 618s33 714s33
. 748s25 845s33 902s25
371p50 Liste{13|6P14} 373m38 374m40 375m40 376m40 377m40
381U27 Tester_Initialiser 381b27 386l21 386t39 921s17
382p25 Vide{13|6P14} 384m38 384r38 385r40
389U27 Tester_Ajouter_Debut 389b27 409l21 409t41 922s17
390p25 Liste{13|6P14} 392m38 392r38 395m40 395r40 396r40 397r40 398r40 401m40
. 401r40 402r40 403r40 404r40 405r40 406r40 408m35 408r35
412U27 Tester_Premier 412b27 431l21 431t35 923s17
413p25 Liste{13|6P14} 415m38 415r38 418m40 418r40 419r49 422m40 422r40 423r49
. 426m40 426r40 427r49 429m35 429r35
435V39 Taille{integer} 435>47 442s40 446s40 450s40 454s40 458s40
435p47 Liste{13|6P14}
436u27 Tester_Taille 438b27 461l21 461t34 464r29 466r29
439p25 Liste{13|6P14} 441m38 441r38 442r48 445m40 445r40 446r48 449m40 449r40
. 450r48 453m40 453r40 454r48 457m40 457r40 458r48 460m35 460r35
463U27 Tester_Taille_Recursive[436] 925s17
465U27 Tester_Taille_Iterative[436] 926s17
470V39 Est_Present{boolean} 470>52 470>71 477s44 481s40 482s44 486s40 487s40
. 488s44 492s40 493s40 494s44
470p52 Liste{13|6P14}
470*71 Element{13|2+14}
471u27 Tester_Est_Present 473b27 497l21 497t39 500r29 502r29
474p25 Liste{13|6P14} 476m38 476r38 477r57 480m40 480r40 481r53 482r57 485m40
. 485r40 486r53 487r53 488r57 491m40 491r40 492r53 493r53 494r57 496m35 496r35
499U27 Tester_Est_Present_Recursive[471] 928s17
501U27 Tester_Est_Present_Iterative[471] 929s17
507V39 Cellule_Contenant{13|6P14} 507>58 507>81 516s48 517s48 518s48 525s40
507*58 Element{13|2+14}
507p81 Liste{13|6P14}
508u27 Tester_Cellule_Contenant 510b27 550l21 550t45 553r29 555r29
512U35 Tester_Existants 512b35 520l29 520t45 537s25
513p33 Liste{13|6P14} 515m56 515r56 516r71 516r80 517r74 517r83 518r73 518r82
. 519m43 519r43
522U35 Tester_Absent 522b35 522>50 522>69 533t28 541s25 544s25 547s25
522p50 Liste{13|6P14} 525r68
522*69 Element{13|2+14} 525r59
523p33 Ptr{13|6P14} 525m33 527r48
535p25 Liste{13|6P14} 540m38 540r38 541r40 543m40 543r40 544r40 546m40 546r40
. 547r40 549m35 549r35
552U27 Tester_Cellule_Contenant_Recursive[508] 934s17
554U27 Tester_Cellule_Contenant_Iterative[508] 935s17
561U40 Supprimer 561=51 561>74 574s33 649s33 666s33 677s33
561p51 Liste{13|6P14}
561*74 Element{13|2+14}
562u27 Tester_Supprimer 564b27 697t20 700r29 702r29
566U35 Supprimer_Trace 566b35 566=52 566>75 580l29 580t44 595s33 600s33 604s33
. 608s33 629s33 636s33
566p52 Liste{13|6P14} 574m44 577r38
566*75 Element{13|2+14} 570r51 574r51
582U35 Supprimer_Extremites 582b35 612l29 612t49 695s25
583p33 Liste{13|6P14} 585m56 585r56 590r38 595m50 595r50 596r57 597r56 600m50
. 600r50 601r56 604m50 604r50 605r56 608m50 608r50 609r56 611m43 611r43
615U35 Supprimer_Milieu 615b35 642l29 642t45 696s25
616p33 Liste{13|6P14} 618m56 618r56 623r38 629m50 629r50 630r57 631r56 632r61
. 633r61 636m50 636r50 637r56 638r57 639r61 641m43 641r43
645U35 Supprimer_Liste_Vide 645b35 658l29 658t49 692s25
646p33 Vide{13|6P14} 648m46 648r46 649m44 649r44 654m51 654r51
661U35 Supprimer_Liste1_Un_Element_Present 661b35 669l29 669t64 693s25
662p33 Liste{13|6P14} 664m46 664r46 665m48 665r48 666m44 666r44 667r55 668m43
. 668r43
672U35 Supprimer_Liste1_Un_Element_Absent 672b35 685l29 685t63 694s25
673p33 Liste{13|6P14} 675m46 675r46 676m48 676r48 677m44 677r44 682m51 682r51
699U27 Tester_Supprimer_Recursive[562] 931s17
701U27 Tester_Supprimer_Iterative[562] 932s17
706V39 Ieme{13|2+14} 706>45 706>64 715s48 716s48 717s48 718s48 725s44
706p45 Liste{13|6P14}
706i64 Indice{integer}
707u27 Tester_Ieme 709b27 755l21 755t32 758r29 760r29
711U35 Tester_Nominal 711b35 720l29 720t43 739s25
712p33 Liste{13|6P14} 714m56 714r56 715r54 716r54 717r54 718r54 719m43 719r43
722U35 Tester_Indice_Invalide 722b35 722>59 722>78 733l29 733t51 743s25 744s25
. 745s25 749s25 750s25 751s25 752s25
722p59 Liste{13|6P14} 725r50
722i78 Indice{integer} 725r57
723*33 Element{13|2+14} 725m33 727r48
736p25 Vide{13|6P14} 742m38 742r38 743r49 744r49 745r49 746m35 746r35 749r49
. 750r49 751r49 752r49
737p25 Liste{13|6P14} 748m48 748r48 753m35 753r35
757U27 Tester_Ieme_Recursive[707] 939s17
759U27 Tester_Ieme_Iterative[707] 940s17
764U27 Tester_Inserer_Apres 764b27 817l21 817t41 937s17
766U35 Test_Nominal 766b35 792l29 792t41 807s25
767p33 Liste{13|6P14} 769m46 769r46 771m48 771r48 772m48 772r48 774r56 775r57
. 776r48 778m48 778r48 779r56 780r57 781r48 782r48 784m48 784r48 786r56 787r57
. 788r48 789r48 791m43 791r43
794U35 Test_Erreur 794b35 794=48 794>71 803l29 803t40 813s33
794p48 Liste{13|6P14} 796m48
794*71 Element{13|2+14} 796r59
805p25 Liste{13|6P14} 810m38 810r38 813m46 813r46 814m48 814r48 816m35 816r35
812i29 I{integer}
821U40 Supprimer_Ieme 821=56 821>79 834s33 883s33
821p56 Liste{13|6P14}
821i79 Indice{integer}
822u27 Tester_Supprimer_Ieme 824b27 907l21 907t42 910r29 912r29
826U35 Supprimer_Ieme_Trace 826b35 826=57 826>80 840l29 840t49 855s33 862s33
. 869s33 874s33
826p57 Liste{13|6P14} 834m49 837r38
826i80 Indice{integer} 830r38 834r56
842U35 Supprimer_Ieme_Nominal 842b35 878l29 878t51 894s25
843p33 Liste{13|6P14} 845m56 845r56 850r38 855m55 855r55 856r56 857r61 858r61
. 859r61 862m55 862r55 863r56 864r61 865r65 866r61 869m55 869r55 870r56 871r57
. 874m55 874r55 875r56 877m43 877r43
881U35 Supprimer_Ieme_Erreur 881b35 881=58 881>81 890l29 890t50 897s25 898s25
. 899s25 903s25 904s25
881p58 Liste{13|6P14} 883m49
881i81 Indice{integer} 883r56
892p25 Liste{13|6P14} 896m38 896r38 897m48 897r48 898m48 898r48 899m48 899r48
. 900m35 900r35 902m48 902r48 903m48 903r48 903r63 904m48 904r48 905m35 905r35
909U27 Tester_Supprimer_Ieme_Recursive[822] 942s17
911U27 Tester_Supprimer_Ieme_Iterative[822] 943s17

8
td08/listes.cswi Executable file
View file

@ -0,0 +1,8 @@
20201106152811
-c
-x
ada
-gnatA
-gnatwa
-gnata
-g

422
td08/td08-loc.xml Executable file
View file

@ -0,0 +1,422 @@
<?xml version="1.0"?>
<Locations >
<Project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_file>
<file_marker column=" 9" line=" 278" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 69" line=" 75" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.ads</vfs_file>
</file_marker>
<file_marker column=" 9" line=" 278" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 314" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 335" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 303" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 25" line=" 278" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 21" line=" 281" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 17" line=" 279" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 9" line=" 8" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/tester_listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 223" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 9" line=" 8" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/tester_listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 270" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 9" line=" 8" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/tester_listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 334" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 9" line=" 8" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/tester_listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 43" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 9" line=" 8" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/tester_listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 717" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 715" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 9" line=" 8" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/tester_listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 7" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.ads</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 54" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.ads</vfs_file>
</file_marker>
<file_marker column=" 43" line=" 61" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.ads</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 54" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.ads</vfs_file>
</file_marker>
<file_marker column=" 82" line=" 75" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.ads</vfs_file>
</file_marker>
<file_marker column=" 9" line=" 8" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/tester_listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 302" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 9" line=" 8" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/tester_listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 168" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 11" line=" 4" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/tester_listes.adb</vfs_file>
</file_marker>
<file_marker column=" 9" line=" 8" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/tester_listes.adb</vfs_file>
</file_marker>
<file_marker column=" 22" line=" 160" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 872" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 9" line=" 8" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/tester_listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 13" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/tester_listes.adb</vfs_file>
</file_marker>
<file_marker column=" 9" line=" 8" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/tester_listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 872" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 9" line=" 8" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/tester_listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 872" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 9" line=" 8" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/tester_listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 42" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 14" line=" 34" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 1" line=" 42" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker column=" 26" line=" 50" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
<file_marker current="true" column=" 19" line=" 43" >
<vfs_project>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/td08.gpr</vfs_project>
<vfs_file>/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation imp#195;#169;rative/tp/td08/listes.adb</vfs_file>
</file_marker>
</Project>
</Locations>

18
td08/td08.gpr Executable file
View file

@ -0,0 +1,18 @@
project TD08 is
for Main use ("tester_listes.adb");
package Builder is
for Default_Switches ("ada") use ("-s");
end Builder;
package Compiler is
for Default_Switches ("ada") use ("-gnatwa", "-gnata", "-g");
end Compiler;
package Binder is
for Default_Switches ("ada") use ("-E");
end Binder;
end TD08;

BIN
td08/tester_listes Executable file

Binary file not shown.

12
td08/tester_listes.adb Executable file
View file

@ -0,0 +1,12 @@
with Ada.Text_IO; use Ada.Text_IO;
with Listes;
procedure Tester_Listes is
package Listes_Character is
new Listes (Character);
use Listes_Character;
procedure Tester_Character is
new Tester('A', 'B', 'C', Put);
begin
Tester_Character;
end Tester_Listes;

0
td08/tester_listes.adb.stderr Executable file
View file

0
td08/tester_listes.adb.stdout Executable file
View file

74
td08/tester_listes.ali Executable file
View file

@ -0,0 +1,74 @@
V "GNAT Lib v7"
M P W=b
A -gnatwa
A -gnata
A -g
P ZX
RN
RV NO_ALLOCATORS
RV NO_EXCEPTION_HANDLERS
RV NO_EXCEPTIONS
RV NO_IO
RV NO_IMPLICIT_CONDITIONALS
RV NO_LOCAL_ALLOCATORS
RV NO_RECURSION
RV NO_STANDARD_ALLOCATORS_AFTER_ELABORATION
RV NO_STANDARD_STORAGE_POOLS
RV NO_DEFAULT_INITIALIZATION
RV SPARK_05
U tester_listes%b tester_listes.adb eb9c3630 NE OO SU
W ada%s ada.ads ada.ali
W ada.exceptions%s a-except.adb a-except.ali
Z ada.integer_text_io%s a-inteio.ads a-inteio.ali
W ada.tags%s a-tags.adb a-tags.ali
W ada.text_io%s a-textio.adb a-textio.ali
Z ada.unchecked_deallocation%s
W listes%s listes.adb listes.ali
W system%s system.ads system.ali
W system.assertions%s s-assert.adb s-assert.ali
W system.exception_table%s s-exctab.adb s-exctab.ali
W system.standard_library%s s-stalib.adb s-stalib.ali
D ada.ads 20170106103348 76789da1 ada%s
D a-except.ads 20151016123252 291912d5 ada.exceptions%s
D a-inteio.ads 20070406091342 f64b89a4 ada.integer_text_io%s
D a-ioexce.ads 20140225151544 e4a01f64 ada.io_exceptions%s
D a-stream.ads 20141120112812 119b8fb3 ada.streams%s
D a-tags.ads 20151016130316 01f5e3ef ada.tags%s
D a-textio.ads 20140717063745 386df5d4 ada.text_io%s
D a-tiinio.ads 20140717063513 aa04e5d6 ada.text_io.integer_io%s
D a-unccon.ads 20170106103348 31484697 ada.unchecked_conversion%s
D a-uncdea.ads 20070406091342 f15a5ed1 ada.unchecked_deallocation%s
D interfac.ads 20160502101001 5ab55268 interfaces%s
D i-cstrea.ads 20140801100435 e53d8b8e interfaces.c_streams%s
D listes.ads 20201106153924 6e6e8c16 listes%s
D listes.adb 20201106153924 43d05d9b listes%b
D system.ads 20170510173650 4635ec04 system%s
D s-assert.ads 20140225151544 cd8d2c94 system.assertions%s
D s-crtl.ads 20141120112812 0ebbdb71 system.crtl%s
D s-exctab.ads 20140225151139 54135002 system.exception_table%s
D s-ficobl.ads 20140718105747 078245e4 system.file_control_block%s
D s-parame.ads 20140801093848 7e2a0d7f system.parameters%s
D s-soflin.ads 20151020124036 14e1eb6c system.soft_links%s
D s-stache.ads 20140225151139 a37c21ec system.stack_checking%s
D s-stalib.ads 20151112104907 09bd3940 system.standard_library%s
D s-stoele.ads 20140225151139 2dc34a04 system.storage_elements%s
D s-traent.ads 20140730135025 005bf670 system.traceback_entries%s
D s-unstyp.ads 20160502101423 34867c83 system.unsigned_types%s
D s-wchcon.ads 20140718092328 1b7d22d2 system.wch_con%s
D tester_listes.adb 20201106153925 bd9f4ff2 tester_listes%b
X 1 ada.ads
16K9*Ada 20e8 28|1r6 1r30
X 7 a-textio.ads
49K13*Text_IO 471e16 28|1w10 1r34
208U14*Put 28|9r43
X 13 listes.ads
4k9*Listes 97e11 28|2w6 6r21
74u19 Tester 28|9r21[5]
X 28 tester_listes.adb
4U11*Tester_Listes 4b11 12l5 12t18
5K17 Listes_Character[13|4] 7r13
8U19 Tester_Character[13|74] 11s9

23
td08/tester_listes.bexch Executable file
View file

@ -0,0 +1,23 @@
[GENERATED OBJECT FILE]
b__tester_listes.o
[PROJECT FILES]
/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation impérative/tp/td08/td08.gpr
20201104174539
[BOUND OBJECT FILES]
/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation impérative/tp/td08/listes.o
/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation impérative/tp/td08/tester_listes.o
[GENERATED SOURCE FILES]
b__tester_listes.ads
b__tester_listes.adb
b__tester_listes.ali
[RESULTING OPTIONS]
-L/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation impérative/tp/td08/
-L/home/laurent/Documents/Cours/ENSEEIHT/S5 - Programmation impérative/tp/td08/
-L/usr/lib/gcc/x86_64-linux-gnu/9/adalib/
-shared
-shared-libgcc
-lgnat-9
-ldl
[RUN PATH OPTION]
/usr/lib/gcc/x86_64-linux-gnu/9/adalib/
/usr/lib

8
td08/tester_listes.cswi Executable file
View file

@ -0,0 +1,8 @@
20201106152811
-c
-x
ada
-gnatA
-gnatwa
-gnata
-g

58
td09/abr.adb Executable file
View file

@ -0,0 +1,58 @@
with SDA_Exceptions; use SDA_Exceptions;
with Ada.Unchecked_Deallocation;
package body ABR is
procedure Free is
new Ada.Unchecked_Deallocation (Object => T_Noeud, Name => T_ABR);
procedure Initialiser(Sda: out T_ABR) is
begin
null; -- TODO : à changer
end Initialiser;
function Est_Vide (Sda : T_ABR) return Boolean is
begin
return False; -- TODO : à changer
end Est_Vide;
function Taille (Sda : in T_ABR) return Integer is
begin
return 0; -- TODO : à changer
end Taille;
procedure Enregistrer (Sda : in out T_ABR ; Cle : in T_Cle ; Donnee : in T_Donnee) is
begin
null; -- TODO : à changer
end Enregistrer;
function La_Donnee (Sda : in T_ABR ; Cle : in T_Cle) return T_Donnee is
begin
null; -- TODO : à changer
end La_Donnee;
procedure Supprimer (Sda : in out T_ABR ; Cle : in T_Cle) is
begin
null; -- TODO : à changer
end Supprimer;
procedure Vider (Sda : in out T_ABR) is
begin
null; -- TODO : à changer
end Vider;
procedure Pour_Chaque (Sda : in T_ABR) is
begin
null; -- TODO : à changer
end Pour_Chaque;
end ABR;

74
td09/abr.ads Executable file
View file

@ -0,0 +1,74 @@
-- Définition de structures de données associatives sous forme d'un arbre
-- binaire de recherche (ABR).
generic
type T_Cle is private;
type T_Donnee is private;
with function "<" (Gauche, Droite : in T_Cle) return Boolean;
package ABR is
type T_ABR is limited private;
-- Initialiser une Sda. La Sda est vide.
procedure Initialiser(Sda: out T_ABR) with
Post => Est_Vide (Sda);
-- Est-ce qu'une Sda est vide ?
function Est_Vide (Sda : T_ABR) return Boolean;
-- Obtenir le nombre d'éléments d'une Sda.
function Taille (Sda : in T_ABR) return Integer with
Post => Taille'Result >= 0
and (Taille'Result = 0) = Est_Vide (Sda);
-- Enregistrer une Donnée associée à une Clé dans une Sda.
-- Si la clé est déjà présente dans la Sda, sa donnée est changée.
procedure Enregistrer (Sda : in out T_ABR ; Cle : in T_Cle ; Donnee : in T_Donnee) with
Post => (La_Donnee (Sda, Cle) = Donnee), -- donnée insérée
Contract_Cases => (others =>
(Taille (Sda) = Taille (Sda)'Old or Taille (Sda) = Taille (Sda)'Old + 1));
-- Supprimer la Donnée associée à une Clé dans une Sda.
-- Exception : Cle_Absente_Exception si Clé n'est pas utilisée dans la Sda
procedure Supprimer (Sda : in out T_ABR ; Cle : in T_Cle) with
Post => Taille (Sda) = Taille (Sda)'Old - 1; -- un élément de moins
-- Obtenir la donnée associée à une Cle dans la Sda.
-- Exception : Cle_Absente_Exception si Clé n'est pas utilisée dans l'Sda
function La_Donnee (Sda : in T_ABR ; Cle : in T_Cle) return T_Donnee;
-- Supprimer tous les éléments d'une Sda.
procedure Vider (Sda : in out T_ABR) with
Post => Est_Vide (Sda);
-- Appliquer un traitement (Traiter) pour chaque couple d'une Sda.
-- Le parcours est infixe : on traite le sous-arbre gauche, puis le
-- noeud, puis le sous-arbre droit.
generic
with procedure Traiter (Cle : in T_Cle; Donnee: in T_Donnee);
procedure Pour_Chaque (Sda : in T_ABR);
private
type T_Noeud;
type T_ABR is access T_Noeud;
type T_Noeud is
record
Cle: T_Cle;
Donnee : T_Donnee;
Sous_Arbre_Gauche : T_ABR;
Sous_Arbre_Droit : T_ABR;
-- Invariant
-- Pour tout noeud N dans Sous_Arbre_Gauche, N.Cle < Cle
-- Pour tout noeud N dans Sous_Arbre_Droit, N.Cle > Cle
end record;
end ABR;

6
td09/sda_exceptions.ads Executable file
View file

@ -0,0 +1,6 @@
-- Définition d'une exception commune à toutes les SDA.
package SDA_Exceptions is
Cle_Absente_Exception : Exception; -- une clé est absente d'un SDA
end SDA_Exceptions;

393
td09/test_abr.adb Executable file
View file

@ -0,0 +1,393 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with SDA_Exceptions; use SDA_Exceptions;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
--! Les Unbounded_String ont une capacité variable, contrairement au String
--! pour lesquelles une capacité doit être fixée.
with ABR;
procedure Test_ABR is
package ABR_String_Integer is
new ABR (T_Cle => Unbounded_String, T_Donnee => Integer, "<" => "<");
use ABR_String_Integer;
-- Est-ce que la Cle est utilisée dans la Sda
function Cle_Presente (Sda : in T_ABR ; Cle : in Unbounded_String) return Boolean is
begin
return False; -- TODO : à changer
end Cle_Presente;
-- Retourner une chaîne avec des guillemets autour de S
function Avec_Guillemets (S: Unbounded_String) return String is
begin
return '"' & To_String (S) & '"';
end;
-- Utiliser & entre String à gauche et Unbounded_String à droite. Des
-- guillemets sont ajoutées autour de la Unbounded_String
-- Il s'agit d'un masquage de l'opérteur & défini dans Strings.Unbounded
function "&" (Left: String; Right: Unbounded_String) return String is
begin
return Left & Avec_Guillemets (Right);
end;
-- Surcharge l'opérateur unaire "+" pour convertir une String
-- en Unbounded_String.
-- Cette astuce permet de simplifier l'initialisation
-- de cles un peu plus loin.
function "+" (Item : in String) return Unbounded_String
renames To_Unbounded_String;
-- Afficher une Unbounded_String et un entier.
procedure Afficher (S : in Unbounded_String; N: in Integer) is
begin
Put (Avec_Guillemets (S));
Put (" : ");
Put (N, 1);
New_Line;
end Afficher;
-- Afficher la Sda.
procedure Afficher is
new Pour_Chaque (Afficher);
Nb_Cles : constant Integer := 17;
Cles : constant array (1..Nb_Cles) of Unbounded_String
:= (+"Frank", +"Bob", +"Henri", +"Dick", +"Alice",
+"Eric", +"Giles", +"Jack", +"Irene", +"Chris",
+"un", +"deux", +"trois", +"quatre", +"cinq",
+"quatre-vingt-dix-neuf", +"vingt-et-un");
Inconnu : constant Unbounded_String := To_Unbounded_String ("Inconnu");
Donnees : constant array (1..Nb_Cles) of Integer
:= (6156, 9278, 1476, 9327, 3890,
9223, 4512, 6843, 0924, 3839,
1, 2, 3, 4, 5, 99, 21);
Somme_Donnees : constant Integer := 55468 + 135;
Somme_Donnees_Len4 : constant Integer := 25393 + 7; -- somme si Length (Cle) = 4
Somme_Donnees_Q: constant Integer := 103; -- somme si initiale de Cle = 'q'
-- Initialiser l'annuaire avec les Donnees et Cles ci-dessus.
-- Attention, c'est à l'appelant de libérer la mémoire associée en
-- utilisant Vider.
-- Si Bavard est vrai, les insertions sont tracées (affichées).
procedure Construire_Exemple_Sujet (Annuaire : out T_ABR; Bavard: Boolean := False) is
begin
Initialiser (Annuaire);
pragma Assert (Est_Vide (Annuaire));
pragma Assert (Taille (Annuaire) = 0);
for I in 1..Nb_Cles loop
Enregistrer (Annuaire, Cles (I), Donnees (I));
if Bavard then
Put_Line ("Après insertion de la clé " & Cles (I));
Afficher (Annuaire); New_Line;
else
null;
end if;
pragma Assert (not Est_Vide (Annuaire));
pragma Assert (Taille (Annuaire) = I);
for J in 1..I loop
pragma Assert (La_Donnee (Annuaire, Cles (J)) = Donnees (J));
end loop;
for J in I+1..Nb_Cles loop
pragma Assert (not Cle_Presente (Annuaire, Cles (J)));
end loop;
end loop;
end Construire_Exemple_Sujet;
procedure Tester_Exemple_Sujet is
Annuaire : T_ABR;
begin
Construire_Exemple_Sujet (Annuaire, True);
Vider (Annuaire);
end Tester_Exemple_Sujet;
-- Tester suppression en commençant par les derniers éléments ajoutés
procedure Tester_Supprimer_Inverse is
Annuaire : T_ABR;
begin
Put_Line ("=== Tester_Supprimer_Inverse..."); New_Line;
Construire_Exemple_Sujet (Annuaire);
for I in reverse 1..Nb_Cles loop
Supprimer (Annuaire, Cles (I));
Put_Line ("Après suppression de " & Cles (I) & " :");
Afficher (Annuaire); New_Line;
for J in 1..I-1 loop
pragma Assert (Cle_Presente (Annuaire, Cles (J)));
pragma Assert (La_Donnee (Annuaire, Cles (J)) = Donnees (J));
end loop;
for J in I..Nb_Cles loop
pragma Assert (not Cle_Presente (Annuaire, Cles (J)));
end loop;
end loop;
Vider (Annuaire);
end Tester_Supprimer_Inverse;
-- Tester suppression en commençant les les premiers éléments ajoutés
procedure Tester_Supprimer is
Annuaire : T_ABR;
begin
Put_Line ("=== Tester_Supprimer..."); New_Line;
Construire_Exemple_Sujet (Annuaire);
for I in 1..Nb_Cles loop
Put_Line ("Suppression de " & Cles (I) & " :");
Supprimer (Annuaire, Cles (I));
Afficher (Annuaire); New_Line;
for J in 1..I loop
pragma Assert (not Cle_Presente (Annuaire, Cles (J)));
end loop;
for J in I+1..Nb_Cles loop
pragma Assert (Cle_Presente (Annuaire, Cles (J)));
pragma Assert (La_Donnee (Annuaire, Cles (J)) = Donnees (J));
end loop;
end loop;
Vider (Annuaire);
end Tester_Supprimer;
procedure Tester_Supprimer_Un_Element is
-- Tester supprimer sur un élément, celui à Indice dans Cles.
procedure Tester_Supprimer_Un_Element (Indice: in Integer) is
Annuaire : T_ABR;
begin
Construire_Exemple_Sujet (Annuaire);
Put_Line ("Suppression de " & Cles (Indice) & " :");
Supprimer (Annuaire, Cles (Indice));
Afficher (Annuaire); New_Line;
for J in 1..Nb_Cles loop
if J = Indice then
pragma Assert (not Cle_Presente (Annuaire, Cles (J)));
else
pragma Assert (Cle_Presente (Annuaire, Cles (J)));
end if;
end loop;
Vider (Annuaire);
end Tester_Supprimer_Un_Element;
begin
Put_Line ("=== Tester_Supprimer_Un_Element..."); New_Line;
for I in 1..Nb_Cles loop
Tester_Supprimer_Un_Element (I);
end loop;
end Tester_Supprimer_Un_Element;
procedure Tester_Remplacer_Un_Element is
-- Tester enregistrer sur un élément présent, celui à Indice dans Cles.
procedure Tester_Remplacer_Un_Element (Indice: in Integer; Nouveau: in Integer) is
Annuaire : T_ABR;
begin
Construire_Exemple_Sujet (Annuaire);
Put_Line ("Remplacement de " & Cles (Indice)
& " par " & Integer'Image(Nouveau) & " :");
enregistrer (Annuaire, Cles (Indice), Nouveau);
Afficher (Annuaire); New_Line;
for J in 1..Nb_Cles loop
pragma Assert (Cle_Presente (Annuaire, Cles (J)));
if J = Indice then
pragma Assert (La_Donnee (Annuaire, Cles (J)) = Nouveau);
else
pragma Assert (La_Donnee (Annuaire, Cles (J)) = Donnees (J));
end if;
end loop;
Vider (Annuaire);
end Tester_Remplacer_Un_Element;
begin
Put_Line ("=== Tester_Remplacer_Un_Element..."); New_Line;
for I in 1..Nb_Cles loop
Tester_Remplacer_Un_Element (I, 0);
null;
end loop;
end Tester_Remplacer_Un_Element;
procedure Tester_Supprimer_Erreur is
Annuaire : T_ABR;
begin
begin
Put_Line ("=== Tester_Supprimer_Erreur..."); New_Line;
Construire_Exemple_Sujet (Annuaire);
Supprimer (Annuaire, Inconnu);
exception
when Cle_Absente_Exception =>
null;
when others =>
pragma Assert (False);
end;
Vider (Annuaire);
end Tester_Supprimer_Erreur;
procedure Tester_La_Donnee_Erreur is
Annuaire : T_ABR;
Inutile: Integer;
begin
begin
Put_Line ("=== Tester_Supprimer_Erreur..."); New_Line;
Construire_Exemple_Sujet (Annuaire);
Inutile := La_Donnee (Annuaire, Inconnu);
exception
when Cle_Absente_Exception =>
null;
when others =>
pragma Assert (False);
end;
Vider (Annuaire);
end Tester_La_Donnee_Erreur;
procedure Tester_Pour_chaque is
Annuaire : T_ABR;
Somme: Integer;
procedure Sommer (Cle: Unbounded_String; Donnee: Integer) is
begin
Put (" + ");
Put (Donnee, 2);
New_Line;
Somme := Somme + Donnee;
end;
procedure Sommer is
new Pour_Chaque (Sommer);
begin
Put_Line ("=== Tester_Pour_Chaque..."); New_Line;
Construire_Exemple_Sujet(Annuaire);
Somme := 0;
Sommer (Annuaire);
pragma Assert (Somme = Somme_Donnees);
Vider(Annuaire);
New_Line;
end Tester_Pour_chaque;
procedure Tester_Pour_chaque_Somme_Si_Cle_Commence_Par_Q is
Annuaire : T_ABR;
Somme: Integer;
procedure Sommer_Cle_Commence_Par_Q (Cle: Unbounded_String; Donnee: Integer) is
begin
if To_String (Cle) (1) = 'q' then
Put (" + ");
Put (Donnee, 2);
New_Line;
Somme := Somme + Donnee;
else
null;
end if;
end;
procedure Sommer is
new Pour_Chaque (Sommer_Cle_Commence_Par_Q);
begin
Put_Line ("=== Tester_Pour_Chaque_Somme_Si_Cle_Commence_Par_Q..."); New_Line;
Construire_Exemple_Sujet(Annuaire);
Somme := 0;
Sommer (Annuaire);
pragma Assert (Somme = Somme_Donnees_Q);
Vider(Annuaire);
New_Line;
end Tester_Pour_chaque_Somme_Si_Cle_Commence_Par_Q;
procedure Tester_Pour_chaque_Somme_Len4_Erreur is
Annuaire : T_ABR;
Somme: Integer;
procedure Sommer_Len4_Erreur (Cle: Unbounded_String; Donnee: Integer) is
Nouvelle_Exception: Exception;
begin
if Length (Cle) = 4 then
Put (" + ");
Put (Donnee, 2);
New_Line;
Somme := Somme + Donnee;
else
raise Nouvelle_Exception;
end if;
end;
procedure Sommer is
new Pour_Chaque (Sommer_Len4_Erreur);
begin
Put_Line ("=== Tester_Pour_Chaque_Somme_Len4_Erreur..."); New_Line;
Construire_Exemple_Sujet(Annuaire);
Somme := 0;
Sommer (Annuaire);
pragma Assert (Somme = Somme_Donnees_Len4);
Vider(Annuaire);
New_Line;
end Tester_Pour_chaque_Somme_Len4_Erreur;
begin
Tester_Exemple_Sujet;
Tester_Supprimer_Inverse;
Tester_Supprimer;
Tester_Supprimer_Un_Element;
Tester_Remplacer_Un_Element;
Tester_Supprimer_Erreur;
Tester_La_Donnee_Erreur;
Tester_Pour_chaque;
Tester_Pour_chaque_Somme_Si_Cle_Commence_Par_Q;
Tester_Pour_chaque_Somme_Len4_Erreur;
Put_Line ("Fin des tests : OK.");
end Test_ABR;

66
tp06/dates.adb Executable file
View file

@ -0,0 +1,66 @@
-- Implantation d'un module Dates très simplifié.
with Ada.Text_IO;
use Ada.Text_IO;
with Ada.Integer_Text_IO;
use Ada.Integer_Text_IO;
package body Dates is
procedure Initialiser ( Date : out T_Date ;
Jour : in Integer ;
Mois : in T_Mois ;
Annee : in Integer ) is
begin
Date.Jour := Jour;
Date.Mois := Mois;
Date.Annee := Annee;
end Initialiser;
-- Afficher un entier sur 2 positons au moins (avec des zéros
-- supplémentaires si nécessaires)
--
-- Paramètres :
-- Nombre : le nombre à afficher
--
-- Nécessite :
-- Nombre >= 0
--
procedure Afficher_Deux_Positions (Nombre : in Integer) with
Pre => Nombre >= 0
is
begin
Put (Nombre / 10, 1);
Put (Nombre mod 10, 1);
end Afficher_Deux_Positions;
procedure Afficher (Date : in T_Date) is
begin
Afficher_Deux_Positions (Date.Jour);
Put ('/');
Afficher_Deux_Positions (T_Mois'pos (Date.Mois) + 1);
Put ('/');
Afficher_Deux_Positions (Date.Annee / 100);
Afficher_Deux_Positions (Date.Annee mod 100);
end Afficher;
function Le_Jour (Date : in T_Date) return Integer is
begin
return Date.Jour;
end Le_Jour;
function Le_Mois(Date : in T_Date) return T_Mois is
begin
return Date.Mois;
end Le_Mois;
function L_Annee (Date : in T_Date) return Integer is
begin
return Date.Annee;
end L_Annee;
end Dates;

70
tp06/dates.ads Executable file
View file

@ -0,0 +1,70 @@
-- Spécification d'un module Dates très simplifié.
--
-- Attention : Bien gérer les dates est compliqué. Les dates et opérations
-- associées sont disponibles dans les bibliothèques des langages de
-- programmation. Par exemple dans le paquetage Ada.Calendar pour Ada.
package Dates is
type T_Mois is (JANVIER, FEVRIER, MARS, AVRIL, MAI, JUIN, JUILLET,
AOUT, SEPTEMBRE, OCTOBRE, NOVEMBRE, DECEMBRE);
type T_Date is private;
-- Initialiser une date à partir du jour, du mois et de l'année.
--
-- Paramètres :
-- Date : la date à initialiser
-- Jour : la valeur du jour
-- Mois : la valeur du mois
-- Annee : la valeur de l'année
--
-- Nécessite :
-- Jour/Mois/Annee constituent une date valide
--
-- Assure
-- Le_Jour (Date) = Jour
-- Le_Mois (Date) = Mois
-- L_Annee (Date) = Annee
--
procedure Initialiser ( Date : out T_Date ;
Jour : in Integer ;
Mois : in T_Mois ;
Annee : in Integer )
with
Pre => Annee >= 0 and Jour >= 1 and Jour <= 31, -- simplifiée !
Post => Le_Jour (Date) = Jour and Le_Mois (Date) = Mois and L_Annee (Date) = Annee;
-- Afficher une date sous la forme jj/mm/aaaa
procedure Afficher (Date : in T_Date);
-- Obtenir le mois d'une date.
-- Paramètres
-- Date : la date dont on veut obtenir le moi
function Le_Mois (Date : in T_Date) return T_Mois;
-- Obtenir le jour d'une date.
-- Paramètres
-- Date : la date dont on veut obtenir le jour
function Le_Jour (Date : in T_Date) return Integer;
-- Obtenir l'année d'une date.
-- Paramètres
-- Date : la date dont on veut obtenir l'année
function L_Annee (Date : in T_Date) return Integer;
private
type T_Date is
record
Jour : Integer;
Mois : T_Mois;
Annee : Integer;
-- Invariant
-- Annee > 0
-- Jour >= 1
-- Jour <= Nombre_Jours (Mois, Annee)
end record;
end Dates;

15
tp06/exemple_dates.adb Executable file
View file

@ -0,0 +1,15 @@
with Ada.Text_IO;
use Ada.Text_IO;
with Dates;
use Dates;
procedure Exemple_Dates is
Une_Date : T_Date;
begin
-- Initialiser une date
Initialiser (Une_Date, 1, OCTOBRE, 2018);
-- L'afficher
Afficher (Une_Date);
New_Line;
end Exemple_Dates;

46
tp06/exemple_dates_erreurs.adb Executable file
View file

@ -0,0 +1,46 @@
with Ada.Text_IO;
use Ada.Text_IO;
with Dates; use Dates;
procedure Exemple_Dates_Erreurs is
Une_Date : T_Date;
Mois_Suivant : T_Mois;
Autre_Date : T_Date;
begin
-- Initialiser une date
Initialiser (Une_Date, 1, OCTOBRE, 2018);
-- L'afficher
Afficher (Une_Date);
New_Line;
-- Afficher un enter sur 2 positions
-- Afficher_Deux_Positions (2); -- pas dans le ads
New_Line;
-- Afficher le mois suivant de Une_Date
Mois_Suivant := T_Mois'succ (Le_Mois (Une_Date));
Put ("Mois suivant : ");
Put (T_Mois'Image (Mois_Suivant));
New_Line;
-- OK car le type T_Mois est accessible de l'utilisateur.
-- Modifier directement la date, pas possible T_Date private
-- Une_Date.jour := 15;
-- Une_Date.Mois := Mois_Suivant;
Afficher (Une_Date);
New_Line;
-- Illustrer les opérations possibles sur T_Date, type privé
Autre_Date := Une_Date;
Put ("Autre date : ");
Afficher (Autre_Date);
New_Line;
if Autre_Date = Une_Date then
Put_Line ("Ce sont les mêmes dates !");
else
Put_Line ("Les dates sont différentes !");
end if;
end Exemple_Dates_Erreurs;

45
tp06/scenario_stock.adb Executable file
View file

@ -0,0 +1,45 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Stocks_Materiel; use Stocks_Materiel;
-- Auteur:
-- Gérer un stock de matériel informatique.
--
procedure Scenario_Stock is
Mon_Stock : T_Stock;
begin
-- Créer un stock vide
Creer (Mon_Stock);
pragma Assert (Nb_Materiels (Mon_Stock) = 0);
-- Enregistrer quelques matériels
Enregistrer (Mon_Stock, 1012, UNITE_CENTRALE, 2016);
pragma Assert (Nb_Materiels (Mon_Stock) = 1);
Enregistrer (Mon_Stock, 2143, ECRAN, 2016);
pragma Assert (Nb_Materiels (Mon_Stock) = 2);
Enregistrer (Mon_Stock, 3001, IMPRIMANTE, 2017);
pragma Assert (Nb_Materiels (Mon_Stock) = 3);
Enregistrer (Mon_Stock, 3012, UNITE_CENTRALE, 2017);
pragma Assert (Nb_Materiels (Mon_Stock) = 4);
pragma Assert ( Nb_Materiels (Mon_Stock) = 4 );
change_state (Mon_Stock, false, 2143);
pragma Assert ( Nb_Materiels_DEAD (Mon_Stock) = 1 );
supprimer_all_dead(Mon_Stock);
pragma Assert ( Nb_Materiels_DEAD (Mon_Stock) = 0 );
pragma Assert ( Nb_Materiels (Mon_Stock) = 3 );
supprimer_materiel(Mon_Stock, 3001);
pragma Assert ( Nb_Materiels (Mon_Stock) = 2 );
put("test ok");
end Scenario_Stock;

112
tp06/stocks_materiel.adb Executable file
View file

@ -0,0 +1,112 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
-- Auteur:
-- Gérer un stock de matériel informatique.
--
package body Stocks_Materiel is
procedure Creer (Stock : out T_Stock) is
begin
null;
end Creer;
function Nb_Materiels (Stock: in T_Stock) return Integer is
begin
return Stock.taille;
end Nb_Materiels;
function Nb_Materiels_DEAD (Stock: in T_Stock) return Integer is
n : Natural := 0;
begin
for i in 1..Stock.Taille loop
if not Stock.Elements(i).Etat then
n := n + 1;
end if;
end loop;
return n;
end Nb_Materiels_DEAD;
procedure change_state (Stock: in out T_Stock; state: in Boolean; identifiant: in Integer) is
begin
for i in 1..Stock.Taille loop
if Stock.Elements(i).ID = identifiant then
Stock.Elements(i).Etat := state;
-- exit; ?
end if;
end loop;
end change_state;
procedure supprimer_materiel (Stock: in out T_Stock; identifiant: in Integer) is
begin
for i in 1..Stock.Taille loop
if Stock.Elements(i).ID = identifiant then
Stock.Elements(i..CAPACITE-1) := Stock.Elements(i+1..CAPACITE);
Stock.Taille := Stock.Taille - 1;
exit;
end if;
end loop;
end supprimer_materiel;
procedure supprimer_all_dead (stock: in out T_Stock) is
i :integer := 1;
begin
loop
if not Stock.Elements(i).Etat then
Stock.Elements(i..CAPACITE-1) := Stock.Elements(i+1..CAPACITE);
Stock.Taille := Stock.Taille - 1;
else
i := i + 1;
end if;
exit when Stock.Elements(i).ID = -1;
end loop;
end supprimer_all_dead;
procedure Enregistrer (
Stock : in out T_Stock;
Numero_Serie : in Integer;
Nature : in T_Nature;
Annee_Achat : in Integer
) is
begin
Stock.Elements(Stock.Taille+1).ID := Numero_Serie;
Stock.Elements(Stock.Taille+1).Nature := Nature;
Stock.Elements(Stock.Taille+1).Annee := Annee_Achat;
Stock.Elements(Stock.Taille+1).Etat := True;
Stock.taille := Stock.Taille + 1;
end Enregistrer;
end Stocks_Materiel;

62
tp06/stocks_materiel.ads Executable file
View file

@ -0,0 +1,62 @@
-- Auteur:
-- Gérer un stock de matériel informatique.
package Stocks_Materiel is
CAPACITE : constant Integer := 10; -- nombre maximum de matériels dans un stock
type T_Nature is (UNITE_CENTRALE, DISQUE, ECRAN, CLAVIER, IMPRIMANTE);
type t_Materiel is limited private;
type T_Array is array (1..CAPACITE) of T_Materiel;
type T_Stock is limited private;
procedure Creer (Stock : out T_Stock) with
Post => Nb_Materiels (Stock) = 0;
function Nb_Materiels (Stock: in T_Stock) return Integer with
Post => Nb_Materiels'Result >= 0 and Nb_Materiels'Result <= CAPACITE;
procedure Enregistrer (
Stock : in out T_Stock;
Numero_Serie : in Integer;
Nature : in T_Nature;
Annee_Achat : in Integer
) with
Pre => Nb_Materiels (Stock) < CAPACITE,
Post => Nb_Materiels (Stock) = Nb_Materiels (Stock)'Old + 1;
function Nb_Materiels_DEAD (Stock: in T_Stock) return Integer with
Post => Nb_Materiels_DEAD'Result >= 0 and Nb_Materiels_DEAD'Result <= CAPACITE;
procedure change_state (Stock: in out T_Stock; state: in Boolean; identifiant: in Integer);
procedure supprimer_materiel (stock: in out T_Stock; identifiant: in Integer);
procedure supprimer_all_dead (stock: in out T_Stock);
private
type T_Materiel is
record
ID: Integer := -1;
Nature: T_Nature;
Annee: Integer;
Etat: Boolean;
end record;
type T_Stock is
record
Elements: T_Array;
Taille: Integer := 0;
end record;
end Stocks_Materiel;

18
tp06/tp06.gpr Executable file
View file

@ -0,0 +1,18 @@
project TP4 is
for Main use ("exemple_dates.adb", "exemple_dates_erreurs.adb", "scenario_stock.adb");
package Builder is
for Default_Switches ("ada") use ("-s");
end Builder;
package Compiler is
for Default_Switches ("ada") use ("-gnatwa", "-gnata", "-g");
end Compiler;
package Binder is
for Default_Switches ("ada") use ("-E");
end Binder;
end TP4;

7
tp07/afficher_un_entier.adb Executable file
View file

@ -0,0 +1,7 @@
with Ada.Integer_Text_IO;
procedure Afficher_Un_Entier (N: in Integer) is
begin
Ada.Integer_Text_IO.Put (N, 1);
end Afficher_Un_Entier;

4
tp07/afficher_un_entier.ads Executable file
View file

@ -0,0 +1,4 @@
-- Afficher l'entier N sur la sortie standard.
-- Cette procédure s'appuie sur Ada.Integer_Text_IO.Put mais permet d'avoir
-- une procédure avec un seul paramètre.
procedure Afficher_Un_Entier (N: in Integer);

34
tp07/exemple_integer_io.adb Executable file
View file

@ -0,0 +1,34 @@
with Ada.Text_IO; use Ada.Text_IO;
with Integer_IO; use Integer_IO;
-- utiliser les opérations de Integer_IO.
procedure Exemple_Integer_IO is
Nombre: Integer;
begin
Put ("10 = ");
Afficher (10);
New_Line;
Put ("0 = ");
Afficher (0);
New_Line;
Put ("Integer'Last = ");
Afficher (Integer'Last);
New_Line;
loop
Put ("Nombre (0 pour quitter) : ");
Saisir (Nombre);
if Nombre /= -1 then
Put ("Vous avez saisi : ");
Afficher (Nombre);
New_Line;
else
Put_Line ("Ce n'est pas un entier naturel !");
Skip_Line; -- vider le buffer d'entrée (jusqu'à EOL)
end if;
exit when Nombre = 0;
end loop;
end Exemple_Integer_IO;

108
tp07/integer_io.adb Executable file
View file

@ -0,0 +1,108 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Characters.Handling; use Ada.Characters.Handling; -- définit is_digit
with Piles;
package body Integer_IO is
procedure Afficher (N : in Integer) is
package Pile_Integer is
new Piles (Integer'Width, Integer);
use Pile_Integer;
Nombre : Integer; -- le nombre à afficher (copie de N)
Chiffre : Integer; -- un chiffre de Nombre
Chiffres : T_Pile; -- les chiffres de Nombre
Caractere : Character; -- le caractère correspondant à Chiffre.
begin
-- Empiler les chiffres de l'entier
Initialiser (Chiffres);
Nombre := N;
loop
-- récupérer le chiffre des unités
Chiffre := Nombre Mod 10;
-- l'empiler
pragma Assert (not Est_Pleine (Chiffres));
Empiler (Chiffres, Chiffre);
-- réduire le nombre en supprimant les unités
Nombre := Nombre / 10;
exit when Nombre = 0;
end loop;
pragma Assert (Nombre = 0);
pragma Assert (not Est_Vide (Chiffres));
-- Afficher les chiffres de la pile
loop
-- Obtenir le chiffre en sommet de pile
Chiffre := Sommet (Chiffres);
-- le convertir en un caractère
caractere := Character'Val (Character'Pos('0') + Chiffre);
-- afficher le caractère
Put (caractere);
-- supprimer le caractère de la pile
Depiler (Chiffres);
exit when Est_Vide (Chiffres);
end loop;
end;
-- Consommer les caratères blancs et indiquer le prochain caractère sur
-- l'entrée standard.
-- Assure : C /= ' '
procedure Consommer_Blancs (Prochain_Caractere : out Character) with
Post => Prochain_Caractere /= ' '
is
Fin_De_Ligne : Boolean; -- fin de ligne atteinte ?
begin
Look_Ahead (Prochain_Caractere, Fin_De_Ligne); -- consulter le caractère suivant
while Fin_De_Ligne or else Prochain_Caractere = ' ' loop
-- consommer le caractère consulté
if Fin_De_Ligne then
Skip_Line;
else
Get (Prochain_Caractere);
end if;
-- Consulter le prochain caractère
Look_Ahead (Prochain_Caractere, Fin_De_Ligne);
end loop;
pragma Assert (not Fin_De_Ligne and Prochain_Caractere /= ' ');
end;
procedure Saisir (N : out Integer) is
C : Character; -- un caractère lu au clavier
Fin_De_Ligne : Boolean; -- fin de ligne atteinte ?
Chiffre : Integer; -- le chiffre correspondant à C
begin
Consommer_Blancs (C);
if Is_Digit (C) then --{ Un chiffre, donc un entier }--
-- reconnaître l'entier à partir des caractères de l'entrée standard
N := 0;
loop
-- Mettre à jour N avec C
Chiffre := Character'Pos (C) - Character'Pos ('0');
N := N * 10 + Chiffre;
-- Consulter le caractère suivant
Get (C);
Look_Ahead (C, Fin_De_Ligne);
exit when Fin_De_Ligne or else not Is_Digit (C);
end loop;
else --{ Pas d'entier }--
N := -1;
end if;
end;
end Integer_IO;

19
tp07/integer_io.ads Executable file
View file

@ -0,0 +1,19 @@
-- Entrées/Sorties sur les entiers.
-- Remarque : on refait, de manière simplifiée, le Put et le Get de
-- Integer_Text_IO.
package Integer_IO is
-- Afficher un entier naturel sur la sortie standard.
procedure Afficher (N : in Integer) with
Pre => N >= 0;
-- Saisir un entier naturel au clavier. Sa valeur est mise dans N.
-- Il peut y avoir des caractères blancs (ignorés) devant l'entier.
-- N vaut -1 si les caractères de l'entrée ne correspondent pas à un entier.
procedure Saisir (N : out Integer) with
Post => N = -1 or else N >= 0;
end Integer_IO;

242
tp07/parenthesage.adb Executable file
View file

@ -0,0 +1,242 @@
with Piles;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Parenthesage is
-- L'indice dans la chaîne Meule de l'é©ment Aiguille.
-- Si l'Aiguille n'est pas dans la Meule, on retourne Meule'Last + 1.
Function Index (Meule : in String; Aiguille: Character) return Integer with
Post => Meule'First <= Index'Result and then Index'Result <= Meule'Last + 1
and then (Index'Result > Meule'Last or else Meule (Index'Result) = Aiguille)
is
begin
for i in Meule'First..Meule'Last loop
if Aiguille = Meule(i) then
return i;
end if;
end loop;
return Meule'Last + 1;
end Index;
-- Programme de test de Index.
procedure Tester_Index is
ABCDEF : constant String := "abcdef";
begin
pragma Assert (1 = Index (ABCDEF, 'a'));
pragma Assert (3 = Index (ABCDEF, 'c'));
pragma Assert (6 = Index (ABCDEF, 'f'));
pragma Assert (7 = Index (ABCDEF, 'z'));
pragma Assert (4 = Index (ABCDEF (1..3), 'z'));
pragma Assert (3 = Index (ABCDEF (3..5), 'c'));
pragma Assert (5 = Index (ABCDEF (3..5), 'e'));
pragma Assert (6 = Index (ABCDEF (3..5), 'a'));
pragma Assert (6 = Index (ABCDEF (3..5), 'g'));
end;
-- ©rifier les bon parenthésage d'une Chaîne (D). Le sous-programme
-- indique si le parenthésage est bon ou non (Correct : R) et dans le cas
-- ¹ il n'est pas correct, l'indice (Indice_Erreur : R) du symbole qui
-- n'est pas appairé (symbole ouvrant ou fermant).
--
-- Exemples
-- "[({})]" -> Correct
-- "]" -> Non Correct et Indice_Erreur = 1
-- "((()" -> Non Correct et Indice_Erreur = 2
--
procedure Verifier_Parenthesage (Chaine: in String ; Correct : out Boolean ; Indice_Erreur : out Integer) is
Ouvrants : Constant String := "([{";
Fermants : Constant String := ")]}";
type T_container is record
char : Character;
index : Integer;
end record;
package Pile_paranthese is
new Piles (Capacite => 100, T_Element => T_container);
use Pile_paranthese;
pile : T_Pile;
elm : T_container;
begin
-- on initialise la pile
Initialiser(pile);
-- si la chaine est vide c'est correct
if Chaine = "" then
Correct := True;
else -- sinon on procède à la vérification
-- si le premier caractère est un Fermant on s'arrête
if Index(Fermants, Chaine(Chaine'First)) <= Fermants'Last then
Correct := False;
Indice_Erreur := Chaine'First;
else -- sinon on continue
-- on commence la vérification pour les prochains caractères
for i in Chaine'First..Chaine'Last loop
-- à chaque tour de boucle on actualise notre element
elm.char := Chaine(i);
elm.index := i;
-- si le caractère est un Ouvrant, on empile
if Index(Ouvrants, elm.char) <= Ouvrants'Last then
Empiler(pile, elm);
-- si le caractère est un Ferment, on cherche son correspondant
elsif Index(Fermants, elm.char) <= Fermants'Last then
-- si on ne peut pas chercher de correspondant, la chaine n'est pas correcte
if Est_Vide(Pile) then
Correct := False;
Indice_Erreur := elm.index;
return;
end if;
-- on cherche le correspondant
for j in Ouvrants'First..Ouvrants'Last loop
-- si on trouve le correspondant on continue la procédure de vérification (pour les prochains caractères)
if Ouvrants(j) = Sommet(Pile).char and Fermants(j) = elm.char then
Depiler(Pile);
Correct := True;
exit;
else -- sinon la chaine n'est pas correcte
Correct := false;
Indice_Erreur := elm.index;
if j = Ouvrants'Last then
return;
end if;
end if;
end loop;
end if;
end loop;
end if;
if not Est_Vide(pile) then
Correct := false;
Indice_Erreur := Sommet(pile).index;
end if;
end if;
end Verifier_Parenthesage;
-- Programme de test de Verifier_Parenthesage
procedure Tester_Verifier_Parenthesage is
Exemple1 : constant String(1..2) := "{}";
Exemple2 : constant String(11..18) := "]{[(X)]}";
Indice : Integer; -- Réultat de ... XXX
Correct : Boolean;
begin
Verifier_Parenthesage ("(a < b)", Correct, Indice);
pragma Assert (Correct);
Verifier_Parenthesage ("([{a}])", Correct, Indice);
pragma Assert (Correct);
Verifier_Parenthesage ("(][{a}])", Correct, Indice);
pragma Assert (not Correct);
put(Indice); new_line;
pragma Assert (Indice = 2);
Verifier_Parenthesage ("]([{a}])", Correct, Indice);
pragma Assert (not Correct);
put(Indice); new_line;
pragma Assert (Indice = 1);
Verifier_Parenthesage ("([{}])}", Correct, Indice);
pragma Assert (not Correct);
put(Indice); new_line;
pragma Assert (Indice = 7);
Verifier_Parenthesage ("([{", Correct, Indice);
pragma Assert (not Correct);
put(Indice); new_line;
pragma Assert (Indice = 3);
Verifier_Parenthesage ("([{}]", Correct, Indice);
pragma Assert (not Correct);
put(Indice); new_line;
pragma Assert (Indice = 1);
Verifier_Parenthesage ("", Correct, Indice);
pragma Assert (Correct);
Verifier_Parenthesage (Exemple1, Correct, Indice);
pragma Assert (Correct);
Verifier_Parenthesage (Exemple2, Correct, Indice);
pragma Assert (not Correct);
put(Indice); new_line;
pragma Assert (Indice = 11);
Verifier_Parenthesage (Exemple2(12..18), Correct, Indice);
pragma Assert (Correct);
Verifier_Parenthesage (Exemple2(12..15), Correct, Indice);
pragma Assert (not Correct);
put(Indice); new_line;
pragma Assert (Indice = 14);
Verifier_Parenthesage ("([{}]", Correct, Indice);
pragma Assert (not Correct);
put(Indice); new_line;
pragma Assert (Indice = 1);
Verifier_Parenthesage ("f(x) = 4(a + b) - [ 6 { 56 } ]", Correct, Indice);
pragma Assert (Correct);
Verifier_Parenthesage("f(x)) = 4(a + b) - [ 6 { 56 } ]", Correct, Indice);
pragma Assert (not Correct);
put(Indice); new_line;
pragma Assert (Indice = 5);
Verifier_Parenthesage("f(x))) = 4(a + b) - [ 6 { 56 } ]", Correct, Indice);
pragma Assert (not Correct);
put(Indice); new_line;
pragma Assert (Indice = 5);
Verifier_Parenthesage("f((x) = 4(a + b) - [ 6 { 56 } ]", Correct, Indice);
pragma Assert (not Correct);
put(Indice); new_line;
pragma Assert (Indice = 2);
Verifier_Parenthesage("f(((x) = 4(a + b) - [ 6 { 56 } ]", Correct, Indice);
pragma Assert (not Correct);
put(Indice); new_line;
pragma Assert (Indice = 3);
Verifier_Parenthesage ("( ((())) [{}{}] ) [[]] {}", Correct, Indice);
pragma Assert (Correct);
Verifier_Parenthesage ("((a a(aa(szegzse)z))ffsse [dz{dz}efsefse{zd}]fse)f [sf[d]zzd]sefs {qzd}", Correct, Indice);
pragma Assert (Correct);
end Tester_Verifier_Parenthesage;
begin
Tester_Index;
Tester_Verifier_Parenthesage;
end Parenthesage;

66
tp07/piles.adb Executable file
View file

@ -0,0 +1,66 @@
-- Implantation du module Piles.
with Ada.Text_IO; use Ada.Text_IO;
--! Ce module est nécessaire parce qu'on a ajouté le SP Afficher.
package body Piles is
procedure Initialiser (Pile : out T_Pile) is
begin
Pile.Taille := 0;
end Initialiser;
function Est_Vide (Pile : in T_Pile) return Boolean is
begin
return Pile.Taille = 0;
end Est_Vide;
function Est_Pleine (Pile : in T_Pile) return Boolean is
begin
return Pile.Taille >= Capacite;
end Est_Pleine;
function Sommet (Pile : in T_Pile) return T_Element is
begin
return Pile.Elements (Pile.Taille);
end Sommet;
procedure Empiler (Pile : in out T_Pile; Element : in T_Element) is
begin
Pile.Taille := Pile.Taille + 1;
Pile.Elements (Pile.Taille) := Element;
end Empiler;
procedure Depiler (Pile : in out T_Pile) is
begin
Pile.Taille := Pile.Taille - 1;
end Depiler;
function Taille (Pile: in T_Pile) return Natural is
begin
return Pile.Taille;
end Taille;
procedure Afficher (Pile : in T_Pile) is
begin
Put ('[');
if not Est_Vide (Pile) then
Put (' ');
Afficher_Element (Pile.Elements (1));
for I in 2..Pile.Taille loop
Put (", ");
Afficher_Element (Pile.Elements (I));
end loop;
else
Null;
end if;
Put (" ]");
end Afficher;
end Piles;

60
tp07/piles.ads Executable file
View file

@ -0,0 +1,60 @@
-- Spécification du module Piles.
generic
Capacite : Integer; -- Nombre maximal d'éléments qu'une pile peut contenir
type T_Element is private; -- Type des éléments de la pile
package Piles is
type T_Pile is limited private; --! "très privé" en Algorithmique !
--! Sur un type privé, on a droit à l'affectation (:=) et l'égalité (=).
--! On perd ces opérations avec un type "limited private" (très privé).
-- Initilaiser une pile. La pile est vide.
procedure Initialiser (Pile : out T_Pile) with
Post => Est_Vide (Pile);
-- Est-ce que la pile est vide ?
function Est_Vide (Pile : in T_Pile) return Boolean;
-- Est-ce que la pile est pleine ?
function Est_Pleine (Pile : in T_Pile) return Boolean;
-- L'élément en sommet de la pile.
function Sommet (Pile : in T_Pile) return T_Element with
Pre => not Est_Vide (Pile);
-- Empiler l'élément en somment de la pile.
procedure Empiler (Pile : in out T_Pile; Element : in T_Element) with
Pre => not Est_Pleine (Pile),
Post => Sommet (Pile) = Element;
-- Supprimer l'élément en sommet de pile
procedure Depiler (Pile : in out T_Pile) with
Pre => not Est_Vide (Pile);
function taille (Pile : in T_Pile) return Natural;
-- Afficher les éléments de la pile
generic
with procedure Afficher_Element (Un_Element: in T_Element);
procedure Afficher (Pile : in T_Pile);
private
type T_Tab_Elements is array (1..Capacite) of T_Element;
type T_Pile is
record
Elements : T_Tab_Elements; -- les éléments de la pile
Taille: Integer; -- Nombre d'éléments dans la pile
end record;
end Piles;

61
tp07/test_piles.adb Executable file
View file

@ -0,0 +1,61 @@
with Piles;
-- Programme de test du module Pile.
procedure Test_Piles is
package Pile_Caractere is
new Piles (Capacite => 3, T_Element => Character);
use Pile_Caractere;
-- Initialiser une pile avec 'O' puis 'K' empilés dans la pile vide.
procedure Initialiser_Avec_OK (Pile : out T_Pile) is
begin
Initialiser (Pile);
Empiler (Pile, 'O');
Empiler (Pile, 'K');
end Initialiser_Avec_OK;
procedure Tester_Est_Vide is
Pile1, Pile2 : T_Pile;
begin
Initialiser (Pile1);
pragma Assert (Est_Vide (Pile1));
Empiler (Pile1, 'A');
pragma Assert (not Est_Vide (Pile1));
Initialiser_Avec_OK (Pile2);
pragma Assert (not Est_Vide (Pile2));
end Tester_Est_Vide;
procedure Tester_Empiler is
Pile1 : T_Pile;
begin
Initialiser_Avec_OK (Pile1);
pragma Assert (not Est_Pleine (Pile1));
Empiler (Pile1, 'N');
pragma Assert ('N' = Sommet (Pile1));
pragma Assert (Est_Pleine (Pile1));
end Tester_Empiler;
procedure Tester_Depiler is
Pile1 : T_Pile;
begin
Initialiser_Avec_OK (Pile1);
Depiler (Pile1);
pragma Assert ('O' = Sommet (Pile1));
Depiler (Pile1);
pragma Assert (Est_Vide (Pile1));
end Tester_Depiler;
begin
Tester_Est_Vide;
Tester_Empiler;
Tester_Depiler;
end Test_Piles;

18
tp07/tp07.gpr Executable file
View file

@ -0,0 +1,18 @@
project TP07 is
for Main use ("exemple_integer_io.adb", "parenthesage.adb", "test_piles.adb", "utiliser_piles.adb");
package Builder is
for Default_Switches ("ada") use ("-s");
end Builder;
package Compiler is
for Default_Switches ("ada") use ("-gnatwa", "-gnata", "-g");
end Compiler;
package Binder is
for Default_Switches ("ada") use ("-E");
end Binder;
end TP07;

260
tp07/utiliser_piles.adb Executable file
View file

@ -0,0 +1,260 @@
with Piles;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Characters.Latin_1; -- des constantes comme Apostrophe (Latin1 ?!?!)
use Ada.Characters.Latin_1;
-- Programme de test du module Pile.
procedure Utiliser_Piles is
-- Utiliser la pile pour en montrer les possibilités sur un exemples.
--! Attention, même si on utiliser « pragma Assert », on ne peut pas
--! vraiment considérer cette procédure comme un programme de tests.
--! Il est souhaitables que chaque programmes de test soit court,
--! indépendant des autres et teste un aspect.
procedure Utiliser_Pile_Caractere is
package Pile_Caractere_3 is
new Piles (Capacite => 3, T_Element => Character);
--! On a nommé les paramètres de généricité. On peut ne pas les
--! nommer à condition de respecter l'ordre
--!
--! package Pile_Caractere_3 is
--! new Piles (3, Character);
use Pile_Caractere_3;
procedure Afficher_Pile is new Afficher (Afficher_Element => Put);
Pile : T_Pile;
begin
Put_Line ("Tester_Pile_Caractere");
-- initilaiser la pile
Initialiser (Pile);
pragma Assert (Est_Vide (Pile));
-- empiler un premier élément
Empiler (Pile, 'A');
pragma Assert (not Est_Vide (Pile));
pragma Assert (not Est_Pleine (Pile));
pragma Assert ('A' = Sommet (Pile));
-- remplir la pile
Empiler (Pile, 'B');
pragma Assert ('B' = Sommet (Pile));
Empiler (Pile, 'C');
pragma Assert ('C' = Sommet (Pile));
pragma Assert (not Est_Vide (Pile));
pragma Assert (Est_Pleine (Pile));
-- Afficher la pile
Afficher_Pile (Pile); New_Line;
-- supprimer un éléments
Depiler (Pile);
pragma Assert (not Est_Pleine (Pile));
pragma Assert ('B' = Sommet (Pile));
-- ajouter un élément
Empiler (Pile, 'D');
pragma Assert ('D' = Sommet (Pile));
pragma Assert (Est_Pleine (Pile));
-- Afficher la pile
Afficher_Pile (Pile); New_Line;
-- vider la pile
Depiler (Pile);
pragma Assert (not Est_Vide (Pile));
pragma Assert ('B' = Sommet (Pile));
Depiler (Pile);
pragma Assert (not Est_Vide (Pile));
pragma Assert ('A' = Sommet (Pile));
Depiler (Pile);
pragma Assert (Est_Vide (Pile));
-- Afficher la pile
Afficher_Pile (Pile); New_Line;
end Utiliser_Pile_Caractere;
procedure Utiliser_Pile_Entier is
-- Capacite de la pile de test.
Capacite : constant Integer := 10;
package Pile_Integer is
new Piles(Capacite, Integer);
use Pile_Integer;
-- Afficher un entier.
--! On ne peut pas directement utliser Put car cette procédure ne
--! prend pas qu'un seul paramètre. Elle n'a donc pas la bonne
--! signature.
--! Pour éviter de devoir définir cette procédure plusieurs fois, on
--! pourrait la définir dans un autre module ou unité, par exemple
--! afficher_un_entier.ads/.adb.
procedure Afficher_Entier (N: in Integer) is
begin
Put (N, 1);
end Afficher_Entier;
procedure Afficher is new Pile_Integer.Afficher (Afficher_Entier);
--! On pourrait ne pas mettre Pile_Integer et
--! nommer Afficher_Entier simplement Afficher.
P1 : T_Pile;
begin
Put_Line ("Tester_Pile_Entier");
-- initilaiser la pile
Initialiser (P1);
pragma Assert (Est_Vide (P1));
-- remplir la pile
for I in 1..Capacite loop
Empiler (P1, I);
end loop;
pragma Assert (Est_Pleine (P1));
-- Afficher la pile
Afficher (P1); New_Line;
-- vider la pile
for I in reverse 1..Capacite loop
pragma Assert (I = Sommet (P1));
Depiler (P1);
end loop;
pragma Assert (Est_Vide (P1));
end Utiliser_Pile_Entier;
procedure Illustrer_Surcharge is
package Pile_Integer is
new Piles(10, Integer);
use Pile_Integer;
procedure Afficher (N: in Integer) is
begin
Put (N, 1);
end Afficher;
procedure Afficher is new Pile_Integer.Afficher (Afficher);
--! Il y a deux procédures qui s'appelle Afficher :
--! 1. Afficher (Integer),
--! 2. Afficher (Pile_Integer.T_Pile) : instance de la 1.
--!
--! Ceci ne pose pas de problème car en fonction du paramètre
--! effectif fourni : Integer ou T_Pile, le compilateur saura
--! laquelle choisir.
--!
--! Remarque : on doit mettre Pile_Integer.Afficher parce que
--! Ada ne veut pas que l'instance Afficher (T_Pile) porte le même nom
--! que la procédure générique (risque de masquage).
P : T_Pile;
begin
Put_Line ("Illustrer_Surcharge");
Initialiser (P);
Empiler (P, 5);
Put ("5 = "); Afficher (5); New_Line; --! la 1 : afficher entier
Put ("P = "); Afficher (P); New_Line; --! la 2 : afficher pile
--! Décommenter la ligne suivante et compiler pour voir l'erreur
--! signalée par le compilateur et les versions de Afficher qu'il
--! connait.
-- Afficher("XXX");
--! utiliser_piles.adb:167:18: expected private type "T_Pile" defined at piles.ads:9, instance at line 134
--! utiliser_piles.adb:167:18: found a string type
--! utiliser_piles.adb:167:18: ==> in call to "Afficher" at line 143
--! utiliser_piles.adb:167:18: ==> in call to "Afficher" at line 138
end Illustrer_Surcharge;
-- Afficher le caractère C entre apostrophes.
procedure Afficher(C : in Character) is
begin
Put (Apostrophe & C & Apostrophe);
end Afficher;
procedure Illustrer_Plusieurs_Afficher_Pour_Meme_Pile is
package PPC3 is
new Piles (Capacite => 3, T_Element => Character);
use PPC3;
procedure Afficher is new PPC3.Afficher (Put);
procedure Afficher_Apostrophe is new PPC3.Afficher (Afficher);
--! Ici, il faut un nom différent pour les deux procédures car
--! elles ont la même signature : une T_Pile de PPC3.
P: T_Pile;
begin
Put_Line ("Illustrer_Plusieurs_Afficher_Pour_Meme_Pile");
Initialiser (P);
Empiler (P, 'A');
Put ("P = "); Afficher (P); New_Line;
Put ("P = "); Afficher_Apostrophe (P); New_Line;
end Illustrer_Plusieurs_Afficher_Pour_Meme_Pile;
-- Montrer deux instances du même module dans le même sous-programme.
procedure Illustrer_Plusieurs_Piles is
package PPC1 is
new Piles(3, Character);
use PPC1;
procedure Afficher is new PPC1.Afficher (Put);
package PPC2 is
new Piles(10, Character);
use PPC2;
procedure Afficher is new PPC2.Afficher (Put);
procedure Afficher_Apostrophe is new PPC2.Afficher (Afficher);
PC1 : PPC1.T_Pile;
PC2 : PPC2.T_Pile;
begin
Put_Line ("Illustrer_Plusieurs_Piles");
--! Décommenter la ligne suivante et compiler pour voir l'erreur
--! signalée par le compilateur et les versions de Afficher qu'il
--! connait.
-- Afficher("XXX");
--! utiliser_piles.adb:220:09: no candidate interpretations match the actuals:
--! utiliser_piles.adb:220:18: expected private type "T_Pile" defined at piles.ads:9, instance at line 206
--! utiliser_piles.adb:220:18: found a string type
--! utiliser_piles.adb:220:18: ==> in call to "Afficher" at line 212
--! utiliser_piles.adb:220:18: ==> in call to "Afficher" at line 207
--! utiliser_piles.adb:220:18: ==> in call to "Afficher" at line 177
-- Initialiser les piles
Initialiser (PC1);
Initialiser (PC2);
-- Ajouter des éléments dans les piles
for C in Character range 'A'..'C' loop
Empiler (PC1, C);
Empiler (PC2, C);
end loop;
-- Afficher les piles
Put ("PC1 = "); Afficher (PC1); New_Line;
Put ("PC2 = "); Afficher (PC2); New_Line;
Put ("PC2 = "); Afficher_Apostrophe (PC2); New_Line;
-- Ne pas respecter un contrat
for C in Character range 'A'..'Z' loop
Empiler (PC1, C);
end loop;
Afficher (PC1);
end Illustrer_Plusieurs_Piles;
begin
Utiliser_Pile_Caractere;
Utiliser_Pile_Entier;
Illustrer_Surcharge;
Illustrer_Plusieurs_Afficher_Pour_Meme_Pile;
Illustrer_Plusieurs_Piles;
end Utiliser_Piles;

7
tp08/afficher_un_entier.adb Executable file
View file

@ -0,0 +1,7 @@
with Ada.Integer_Text_IO;
procedure Afficher_Un_Entier (N: in Integer) is
begin
Ada.Integer_Text_IO.Put (N, 1);
end Afficher_Un_Entier;

4
tp08/afficher_un_entier.ads Executable file
View file

@ -0,0 +1,4 @@
-- Afficher l'entier N sur la sortie standard.
-- Cette procédure s'appuie sur Ada.Integer_Text_IO.Put mais permet d'avoir
-- une procédure avec un seul paramètre.
procedure Afficher_Un_Entier (N: in Integer);

View file

@ -0,0 +1,125 @@
with Piles;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Unchecked_Deallocation; --! Pour libérer la mémoire allouée dynamiquement
procedure Exemples_Memoire_Dynamique is
type T_Pointeur_Integer is access Integer;
procedure Free
is new Ada.Unchecked_Deallocation (Integer, T_Pointeur_Integer);
-- ou Ada.Unchecked_Deallocation (Object => Integer, Name => T_Pointeur_Integer);
-- Allocation dynamique de mémoire et libération de cette mémoire.
procedure Illustrer_Memoire_Dynamique is
Ptr1 : T_Pointeur_Integer;
begin
Ptr1 := new Integer; -- Allocation dyamique de mémoire
Ptr1.all := 5; -- Utilisation de cette mémoire
Put_Line ("Ptr1.all = " & Integer'Image (Ptr1.all));
Free (Ptr1); -- Libération de la mémoire
pragma Assert (Ptr1 = Null); -- Free met le pointeur à Null
end Illustrer_Memoire_Dynamique;
-- Mémoire allouée dynamiquement et non libérée.
procedure Illustrer_Memoire_Dynamique_Sans_Free is
Ptr1 : T_Pointeur_Integer;
begin
Ptr1 := new Integer;
Ptr1.all := 5;
Put_Line ("Ptr1.all = " & Integer'Image (Ptr1.all));
Free (Ptr1); -- on libère la mémoire
end Illustrer_Memoire_Dynamique_Sans_Free;
-- Illustrer la libération explicite de la mémoire et les précautions à
-- prendre...
procedure Illustrer_Memoire_Dynamique_Erreur is
Ptr1, Ptr2 : T_Pointeur_Integer;
begin
Ptr1 := new Integer;
Ptr2 := Ptr1;
Ptr1.all := 5;
pragma Assert (Ptr1.all = 5);
pragma Assert (Ptr2.all = 5);
Free (Ptr1);
pragma Assert (Ptr1 = Null); -- le pointeur est bien mis à Null
pragma Assert (Ptr2 /= Null);
-- XXX Quelle est la valeur de Ptr2.all ? 0
-- Put_Line ("Ptr2.all = " & Integer'Image (Ptr2.all));
-- -> opération invalide
-- Ptr2.all := 7;
-- pragma Assert (Ptr2.all = 7);
-- -> opérations invalides
-- XXX A-t-on le droit de manipuler Ptr2.all ? oui
-- XXX Que se passe-t-il si on exécute le programme avec valkyrie ?
-- -> il nous dit que l'on utilise une zone mémoire que l'on a libéré !
--
-- Le terme "Unchecked" dans Unchecked_Deallocation vient de . Ada
-- n'a pas de moyen de contrôler que quand on libère de la mémoire il
-- n'y a plus aucun pointeur dans le programme qui la référence. C'est
-- à la charge du programmeur ! Utiliser un ramasse-miettes (garbage
-- collector) résoud ce problème car il ne libèrera la mémoire que s'il
-- n'y a plus aucune référence dessus.
end Illustrer_Memoire_Dynamique_Erreur;
-- Illustrer les conséquence d'avoir un paramètre en in qui est un pointeur.
procedure Illustrer_Pointeur_In is
procedure SP (Ptr : in T_Pointeur_Integer) is
begin
Ptr.all := 123;
end SP;
Ptr : T_Pointeur_Integer;
begin
Ptr := new Integer;
Ptr.all := 111;
SP (Ptr);
-- XXX Quelle est la valeur de Ptr.all ? 123
Put_Line ("valeur de Ptr.all ? " & Integer'Image (Ptr.all));
Free (Ptr);
end Illustrer_Pointeur_In;
-- Illustrer la question "Faut-il Detruire un pile chaînée si c'est
-- une variable locale d'un sous-programme ?".
procedure Illustrer_Pile_Locale is
package Pile is
new Piles (Integer);
use Pile;
P : T_Pile;
begin
Initialiser (P);
Empiler (P, 4);
Put_Line ("Sommet = " & Integer'Image (Sommet (P)));
Empiler (P, 2);
Put_Line ("Sommet = " & Integer'Image (Sommet (P)));
-- XXX P étant une variable locale du sous-programme, a-t-on besoin
-- d'appeler Detruire dessus ? non
end Illustrer_Pile_Locale;
begin
Illustrer_Memoire_Dynamique;
Illustrer_Memoire_Dynamique_Sans_Free;
Illustrer_Memoire_Dynamique_Erreur;
-- Illustrer_Pointeur_In
-- Illustrer_Pile_Locale;
end Exemples_Memoire_Dynamique;

View file

@ -0,0 +1,34 @@
with Piles;
with Ada.Text_IO; use Ada.Text_IO;
-- Montrer le risque d'autoriser l'affectation entre variables dont le type
-- est une structure chaînée.
procedure Illustrer_Affectation_Pile is
package Pile is
new Piles (Character);
use Pile;
procedure Afficher is
new Pile.Afficher (Put);
P1, P2 : T_Pile;
begin
-- construire la pile P1
Initialiser (P1);
Empiler (P1, 'A');
Empiler (P1, 'B');
Afficher (P1); New_Line; -- XXX Qu'est ce qui s'affiche ? [ A, B >
P2 := P1; -- XXX Conseillé ? non car si on supprime l'un des deux pointeurs, cela peut mener à des erreurs.
-- -> le limited private permet d'empecher cette erreur
pragma Assert (P1 = P2);
Depiler (P2); -- XXX Quel effet ? le sommet de la pile P2 est deallocated, donc P1 pointe vers de la mémoire libéré
Afficher (P2); New_Line; -- XXX Qu'est ce qui s'affiche ? [ A >
Afficher (P1); New_Line; -- XXX Qu'est ce qui s'affiche ? [ truc bizarre, >
-- XXX Que donne l'exécution avec valkyrie ?
Depiler (P1); -- XXX correct ? non car on essaye de Free un espace mémoire qui a déjà été libéré.
-- free(): double free detected in tcache 2
-- raised PROGRAM_ERROR : unhandled signal
end Illustrer_Affectation_Pile;

94
tp08/piles.adb Executable file
View file

@ -0,0 +1,94 @@
-- Implantation du module Piles.
with Ada.Unchecked_Deallocation;
with Ada.Text_IO; use Ada.Text_IO;
--! Ce module est nécessaire parce qu'on a ajouté le SP Afficher.
package body Piles is
procedure Free is
new Ada.Unchecked_Deallocation (T_Cellule, T_Pile);
procedure Initialiser (Pile : out T_Pile) is
begin
Pile := Null;
end Initialiser;
function Est_Vide (Pile : in T_Pile) return Boolean is
begin
return Pile = Null;
end Est_Vide;
function Sommet (Pile : in T_Pile) return T_Element is
begin
return Pile.all.Element;
end Sommet;
procedure Empiler (Pile : in out T_Pile; Element : in T_Element) is
-- Nouvelle_Cellule: T_Pile;
begin
-- Créer une nouvelle cellule (allcoation puis initialisation)
-- Nouvelle_Cellule := new T_Cellule;
-- Nouvelle_Cellule.all.Element := Element;
-- Nouvelle_Cellule.all.Suivant := Pile;
-- Changer Pile (elle pointe sur la nouvelle cellule)
-- Pile := Nouvelle_Cellule;
-- au lieu de créer un pointeur on créé directement la cellule
Pile := new T_Cellule'(Element, Pile);
end Empiler;
procedure Depiler (Pile : in out T_Pile) is
A_Detruire : T_Pile;
begin
A_Detruire := Pile;
Pile := Pile.all.Suivant;
Free (A_Detruire);
end Depiler;
procedure Detruire (P: in out T_Pile) is
begin
if P /= Null then
Detruire (P.all.Suivant);
Free (P);
else
Null;
end if;
end Detruire;
-- afficher.body START DELETE
-- afficher.body STOP DELETE
procedure Afficher (Pile : in T_Pile) is
-- Afficher les éléments de la pile. Le premier affiché est le fond de
-- pile, le dernier le sommet, ils sont séparés par des virgules.
procedure Afficher_Elements (Pile : in T_Pile) is
begin
if Pile = Null then
Null;
elsif Pile.all.Suivant = Null then
Put (" ");
Afficher_Element (Pile.all.Element);
else
Afficher_Elements (Pile.all.Suivant);
Put (", ");
Afficher_Element (Pile.all.Element);
end if;
end Afficher_Elements;
begin
Put ('[');
Afficher_Elements (Pile);
Put (" >");
end Afficher;
end Piles;

59
tp08/piles.ads Executable file
View file

@ -0,0 +1,59 @@
-- Spécification du module Piles.
generic
type T_Element is private; -- Type des éléments de la pile
package Piles is
type T_Pile is limited private;
-- Initilaiser une pile. La pile est vide.
procedure Initialiser (Pile : out T_Pile) with
Post => Est_Vide (Pile);
-- Est-ce que la pile est vide ?
function Est_Vide (Pile : in T_Pile) return Boolean;
-- L'élément en sommet de la pile.
function Sommet (Pile : in T_Pile) return T_Element with
Pre => not Est_Vide (Pile);
-- Empiler l'élément en somment de la pile.
-- Exception : Storage_Exception s'il n'y a plus de mémoire.
procedure Empiler (Pile : in out T_Pile; Element : in T_Element) with
Post => Sommet (Pile) = Element;
-- Supprimer l'élément en sommet de pile
procedure Depiler (Pile : in out T_Pile) with
Pre => not Est_Vide (Pile);
-- Détruire une pile.
-- Cette pile ne doit plus être utilisée sauf à être de nouveau initialisée.
procedure Detruire (P: in out T_Pile);
-- Afficher les éléments de la pile
generic
with procedure Afficher_Element (Un_Element: in T_Element);
procedure Afficher (Pile : in T_Pile);
private
type T_Cellule;
type T_Pile is access T_Cellule;
type T_Cellule is
record
Element: T_Element;
Suivant: T_Pile;
end record;
end Piles;

59
tp08/test_piles.adb Executable file
View file

@ -0,0 +1,59 @@
with Piles;
-- Programme de test du module Pile.
procedure Test_Piles is
package Pile_Caractere is
new Piles (T_Element => Character);
use Pile_Caractere;
-- Initialiser une pile avec 'O' puis 'K' empilés dans la pile vide.
procedure Initialiser_Avec_OK (Pile : out T_Pile) is
begin
Initialiser (Pile);
Empiler (Pile, 'O');
Empiler (Pile, 'K');
end Initialiser_Avec_OK;
procedure Tester_Est_Vide is
Pile1, Pile2 : T_Pile;
begin
Initialiser (Pile1);
pragma Assert (Est_Vide (Pile1));
Empiler (Pile1, 'A');
pragma Assert (not Est_Vide (Pile1));
Initialiser_Avec_OK (Pile2);
pragma Assert (not Est_Vide (Pile2));
end Tester_Est_Vide;
procedure Tester_Empiler is
Pile1 : T_Pile;
begin
Initialiser_Avec_OK (Pile1);
Empiler (Pile1, 'N');
pragma Assert ('N' = Sommet (Pile1));
end Tester_Empiler;
procedure Tester_Depiler is
Pile1 : T_Pile;
begin
Initialiser_Avec_OK (Pile1);
Depiler (Pile1);
pragma Assert ('O' = Sommet (Pile1));
Depiler (Pile1);
pragma Assert (Est_Vide (Pile1));
end Tester_Depiler;
begin
Tester_Est_Vide;
Tester_Empiler;
Tester_Depiler;
end Test_Piles;

18
tp08/tp08.gpr Executable file
View file

@ -0,0 +1,18 @@
project TP08 is
for Main use ("illustrer_affectation_pile.adb", "exemples_memoire_dynamique.adb", "test_piles.adb");
package Builder is
for Default_Switches ("ada") use ("-s");
end Builder;
package Compiler is
for Default_Switches ("ada") use ("-gnatwa", "-gnata", "-g");
end Compiler;
package Binder is
for Default_Switches ("ada") use ("-E");
end Binder;
end TP08;

45
tp09/exemple_vecteurs_creux.adb Executable file
View file

@ -0,0 +1,45 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
with Vecteurs_Creux; use Vecteurs_Creux;
-- Exemple d'utilisation des vecteurs creux.
procedure Exemple_Vecteurs_Creux is
V : T_Vecteur_Creux;
Epsilon: constant Float := 1.0e-5;
begin
Put_Line ("Début du scénario");
-- question 1
Put_Line ( "question 1" );
Initialiser (V);
Afficher(V); New_Line;
-- question 2
Put_Line ( "question 2" );
pragma Assert ( true = Est_Nul(V) );
-- question 3
Put_Line ( "question 3" );
Detruire(v);
pragma Assert ( true = Est_Nul(V) );
-- question 5
Put_Line ( "question 5" );
Modifier (V, 18, 0.0);
Afficher(V); New_Line;
-- question 4
Put_Line ( "question 4" );
pragma Assert ( 0.0 = Composante_Recursif (V, 18) );
pragma Assert ( 0.0 = Composante_Iteratif (V, 18) );
-- question 6
Put_Line ( "question 6" );
pragma Assert ( true = Sont_Egaux_Recursif (V, V) );
pragma Assert ( true = Sont_Egaux_Iteratif (V, V) );
Put_Line ("Fin du scénario");
end Exemple_Vecteurs_Creux;

309
tp09/test_vecteurs_creux.adb Executable file
View file

@ -0,0 +1,309 @@
with Ada.Text_IO; use Ada.Text_IO;
with Vecteurs_Creux; use Vecteurs_Creux;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
procedure Test_Vecteurs_Creux is
procedure Initialiser (VC0, VC1, VC2 : out T_Vecteur_Creux) is
begin
-- VC0 est un vecteur nul
Initialiser (VC0);
-- VC1 est un vecteur à deux composante
Initialiser (VC1);
Modifier (VC1, 10, 4.0);
Modifier (VC1, 3, -3.0);
Initialiser (VC2);
Modifier (VC2, 100, 2.0);
Modifier (VC2, 3, 3.0);
Modifier (VC2, 1, 2.0);
-- Afficher les vecteurs
-- Put ("VC0 = "); Afficher (VC0); New_Line;
-- Put ("VC1 = "); Afficher (VC1); New_Line;
-- Put ("VC2 = "); Afficher (VC2); New_Line;
end;
procedure Detruire (VC0, VC1, VC2 : in out T_Vecteur_Creux) is
begin
Detruire (VC0);
Detruire (VC1);
Detruire (VC2);
end;
procedure Tester_Nul is
VC0, VC1, VC2: T_Vecteur_Creux;
begin
Initialiser (VC0, VC1, VC2);
pragma Assert (Est_Nul (VC0));
pragma Assert (not Est_Nul (VC1));
pragma Assert (not Est_Nul (VC2));
Detruire (VC0, VC1, VC2);
end Tester_Nul;
procedure Tester_Norme2 is
VC0, VC1, VC2: T_Vecteur_Creux;
begin
Initialiser (VC0, VC1, VC2);
pragma Assert (0.0 = Norme2 (VC0));
pragma Assert (25.0 = Norme2 (VC1));
Detruire (VC0, VC1, VC2);
end Tester_Norme2;
type T_Fonction_Composante is
access Function (VC : in T_Vecteur_Creux ; Indice : in Integer) return Float;
--! Un pointeur sur un sous-programme permet de manipuler un
--! sous-programme comme une donnée.
Composante : constant T_Fonction_Composante := Composante_Recursif'Access;
--! Composante est donc une constante qui pointe sur le sous-programme
--! Composante_Recursif.
procedure Tester_Composante(La_Composante : T_Fonction_Composante) is
--! Remarque : On aurait pu arriver au même résultat en définissant un
--! sous-programme générique.
--! Voir Tester_Sont_Egaux pour une version générique.
VC0, VC1, VC2: T_Vecteur_Creux;
begin
Initialiser (VC0, VC1, VC2);
pragma Assert ( 0.0 = La_Composante (VC0, 1));
pragma Assert ( 0.0 = La_Composante (VC1, 1));
pragma Assert (-3.0 = La_Composante (VC1, 3));
pragma Assert ( 0.0 = La_Composante (VC1, 4));
pragma Assert ( 0.0 = La_Composante (VC1, 9));
pragma Assert ( 4.0 = La_Composante (VC1, 10));
pragma Assert ( 0.0 = La_Composante (VC1, 11));
Detruire (VC0, VC1, VC2);
end Tester_Composante;
procedure Tester_Modifier is
VC0, VC1, VC2: T_Vecteur_Creux;
begin
Initialiser (VC0, VC1, VC2);
pragma Assert (2 = Nombre_Composantes_Non_Nulles (VC1));
-- Changer des composantes non nulles
-- * en première position
Modifier (VC1, 3, 3.0);
pragma Assert (3.0 = Composante (VC1, 3));
pragma Assert (2 = Nombre_Composantes_Non_Nulles (VC1));
-- * après la première
Modifier (VC1, 10, 15.0);
pragma Assert (15.0 = Composante (VC1, 10));
pragma Assert (2 = Nombre_Composantes_Non_Nulles (VC1));
-- Ajouter au début
Modifier (VC1, 1, 1.5);
pragma Assert (1.5 = Composante (VC1, 1));
pragma Assert (3 = Nombre_Composantes_Non_Nulles (VC1));
-- Ajouter au milieu
Modifier (VC1, 7, 7.5);
pragma Assert (7.5 = Composante (VC1, 7));
pragma Assert (4 = Nombre_Composantes_Non_Nulles (VC1));
-- Ajouter à la fin.
Modifier (VC1, 111, 0.5);
pragma Assert (0.5 = Composante (VC1, 111));
pragma Assert (5 = Nombre_Composantes_Non_Nulles (VC1));
-- Mettre à 0.0 une composante existante
-- * Au milieu
Modifier (VC1, 10, 0.0);
pragma Assert (0.0 = composante (VC1, 10));
pragma Assert (4 = Nombre_Composantes_Non_Nulles (VC1));
-- * À la fin
Modifier (VC1, 111, 0.0);
pragma Assert (0.0 = composante (VC1, 111));
pragma Assert (3 = Nombre_Composantes_Non_Nulles (VC1));
-- * Au début
Modifier (VC1, 1, 0.0);
pragma Assert (0.0 = composante (VC1, 1));
pragma Assert (2 = Nombre_Composantes_Non_Nulles (VC1));
-- Mettre à 0.0 une composante déjà nulle
Modifier (VC1, 6, 0.0);
pragma Assert (2 = Nombre_Composantes_Non_Nulles (VC1));
Modifier (VC1, 2, 0.0);
pragma Assert (2 = Nombre_Composantes_Non_Nulles (VC1));
Modifier (VC1, 56, 0.0);
pragma Assert (2 = Nombre_Composantes_Non_Nulles (VC1));
-- Supprimer toutes les composantes
Modifier (VC1, 7, 0.0);
pragma Assert (1 = Nombre_Composantes_Non_Nulles (VC1));
Modifier (VC1, 3, 0.0);
pragma Assert (0 = Nombre_Composantes_Non_Nulles (VC1));
pragma Assert (Est_Nul (VC1));
Detruire (VC0, VC1, VC2);
end Tester_Modifier;
generic
with function Egaux (Vecteur1, Vecteur2 : in T_Vecteur_Creux) return Boolean;
procedure Tester_Sont_Egaux;
procedure Tester_Sont_Egaux is
VC0, VC1, VC2, VC3: T_Vecteur_Creux;
begin
Initialiser (VC0, VC1, VC2);
pragma Assert (Egaux (VC0, VC0));
pragma Assert (Egaux (VC1, VC1));
pragma Assert (Egaux (VC2, VC2));
pragma Assert (not Egaux (VC0, VC1));
pragma Assert (not Egaux (VC0, VC2));
pragma Assert (not Egaux (VC1, VC2));
pragma Assert (not Egaux (VC1, VC0));
pragma Assert (not Egaux (VC2, VC0));
pragma Assert (not Egaux (VC2, VC1));
-- VC3 avec les mêmes composantes que VC1
Initialiser (VC3);
Modifier (VC3, 10, 4.0);
Modifier (VC3, 3, -3.0);
pragma Assert (Egaux (VC1, VC3));
pragma Assert (Egaux (VC3, VC1));
Detruire (VC0, VC1, VC2);
Detruire (VC3);
end Tester_Sont_Egaux;
--! Remarque : si on instancie les deux sous-programmes suivant juste
--! avant l'implantation de Tester_Sont_Egaux ci-dessus, on n'a pas
--! d'erreur de compilation mais une erreur à l'exécution.
procedure Tester_Sont_Egaux_Iteratif is
new Tester_Sont_Egaux (Sont_Egaux_Iteratif);
procedure Tester_Sont_Egaux_Recursif is
new Tester_Sont_Egaux (Sont_Egaux_Recursif);
procedure Tester_Produit_Scalaire is
VC0, VC1, VC2, VC3: T_Vecteur_Creux;
begin
Initialiser (VC0, VC1, VC2);
pragma Assert (0.0 = Produit_Scalaire (VC0, VC1));
pragma Assert (0.0 = Produit_Scalaire (VC0, VC2));
pragma Assert (0.0 = Produit_Scalaire (VC1, VC0));
pragma Assert (-9.0 = Produit_Scalaire (VC1, VC2));
pragma Assert (25.0 = Produit_Scalaire (VC1, VC1));
Initialiser (VC3);
Modifier (VC3, 150, 5.0);
Modifier (VC3, 10, 4.0);
Modifier (VC3, 3, 3.0);
Modifier (VC3, 2, 2.0);
Modifier (VC3, 1, 1.0);
pragma Assert (11.0 = Produit_Scalaire (VC2, VC3));
pragma Assert (11.0 = Produit_Scalaire (VC3, VC2));
pragma Assert (7.0 = Produit_Scalaire (VC1, VC3));
pragma Assert (7.0 = Produit_Scalaire (VC3, VC1));
Detruire (VC0, VC1, VC2);
Detruire (VC3);
end Tester_Produit_Scalaire;
procedure Tester_Additionner_Partage is
VC0, VC1: T_Vecteur_Creux;
begin
-- Construire VC0
Initialiser (VC0);
for I in 1..5 loop
Modifier (VC0, I, Float(I));
end loop;
-- Construire VC1
Initialiser (VC1);
for I in 4..15 loop
Modifier (VC1, I, Float(I));
end loop;
-- Additionner
Additionner (VC0, VC1);
Afficher(VC1); New_Line;
-- Vérifier qu'il n'y a pas de partage entre cellules de VC0 et VC1
Modifier (VC1, 10, 111.0);
pragma Assert (111.0 = Composante (VC1, 10));
put(Composante (VC0, 10)); New_Line;
pragma Assert (10.0 = Composante (VC0, 10));
Detruire (VC0);
Detruire (VC1);
end Tester_Additionner_Partage;
procedure Tester_Additionner is
VC0, VC1, VC2: T_Vecteur_Creux;
begin
Initialiser (VC0, VC1, VC2);
Additionner (VC0, VC1);
pragma Assert (Sont_Egaux_Recursif (VC0, VC1));
pragma Assert (2 = Nombre_Composantes_Non_Nulles (VC0));
pragma Assert (-3.0 = Composante (VC0, 3));
pragma Assert ( 4.0 = Composante (VC0, 10));
Additionner (VC0, VC2);
pragma Assert (3 = Nombre_Composantes_Non_Nulles (VC0));
pragma Assert (2.0 = Composante (VC0, 1));
pragma Assert (0.0 = Composante (VC0, 3));
pragma Assert (4.0 = Composante (VC0, 10));
pragma Assert (2.0 = Composante (VC0, 100));
Additionner (VC2, VC1);
pragma Assert (Sont_Egaux_Recursif (VC0, VC2));
Detruire (VC0, VC1, VC2);
end Tester_Additionner;
begin
Tester_Nul;
Tester_Norme2;
Tester_Composante (Composante_Recursif'Access);
Tester_Composante (Composante_Iteratif'Access);
Tester_Modifier;
Tester_Sont_Egaux_Recursif;
Tester_Sont_Egaux_Iteratif;
Tester_Produit_Scalaire;
Tester_Additionner_Partage;
Tester_Additionner;
end Test_Vecteurs_Creux;

18
tp09/tp09.gpr Executable file
View file

@ -0,0 +1,18 @@
project TP09 is
for Main use ("exemple_vecteurs_creux.adb", "test_vecteurs_creux.adb");
package Builder is
for Default_Switches ("ada") use ("-s");
end Builder;
package Compiler is
for Default_Switches ("ada") use ("-gnatwa", "-gnata", "-g");
end Compiler;
package Binder is
for Default_Switches ("ada") use ("-E");
end Binder;
end TP09;

238
tp09/vecteurs_creux.adb Executable file
View file

@ -0,0 +1,238 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
with Ada.Unchecked_Deallocation;
package body Vecteurs_Creux is
procedure Free is
new Ada.Unchecked_Deallocation (T_Cellule, T_Vecteur_Creux);
procedure Initialiser (V : out T_Vecteur_Creux) is
begin
V := null;
end Initialiser;
procedure Detruire (V: in out T_Vecteur_Creux) is
begin
if V /= null then
Detruire(V.All.Suivant);
Free(V);
V := null;
end if;
end Detruire;
function Est_Nul (V : in T_Vecteur_Creux) return Boolean is
begin
return V = null;
end Est_Nul;
function Composante_Recursif (V : in T_Vecteur_Creux ; Indice : in Integer) return Float is
begin
if V = null or else V.All.Indice > Indice then
put("testestest");
Afficher(V); new_line;
return 0.0;
elsif Indice = V.All.Indice then
return V.All.Valeur;
else
return Composante_Recursif(V.All.Suivant, Indice);
end if;
end Composante_Recursif;
function Composante_Iteratif (V : in T_Vecteur_Creux ; Indice : in Integer) return Float is
Cursor : T_Vecteur_Creux;
l : Integer := 0;
begin
if V = null then
return 0.0;
else
Cursor := V;
While (Cursor /= null) Loop
l := Cursor.All.Indice;
if l > Indice then
return 0.0;
elsif l = Indice then
return Cursor.All.Valeur;
end if;
Cursor := Cursor.All.Suivant;
End Loop;
return 0.0;
end if;
end Composante_Iteratif;
procedure Modifier (V : in out T_Vecteur_Creux ; -- TODO: réimplémenter avec un Cursor_last pour compresser la procédure
Indice : in Integer ;
Valeur : in Float ) is
Cursor : T_Vecteur_Creux;
aDetruire : T_Vecteur_Creux;
begin
if V = null then
V := new T_Cellule'(Indice, Valeur, null);
elsif V.All.Indice > Indice and Valeur /= 0.0 then
V := new T_Cellule'(Indice, Valeur, V);
elsif V.All.Indice = Indice then
if Valeur = 0.0 then
aDetruire := V;
V := V.All.Suivant;
Free(aDetruire);
else
V.All.Valeur := Valeur;
end if;
else
Cursor := V;
While (Cursor /= null) Loop
if Cursor.All.Suivant = null then
exit when Valeur = 0.0;
Cursor.All.Suivant := new T_Cellule'(Indice, Valeur, null);
exit;
elsif Cursor.All.Suivant.All.Indice = Indice then
if Valeur = 0.0 then
aDetruire := Cursor.All.Suivant;
Cursor.All.Suivant := Cursor.All.Suivant.All.Suivant;
Free(aDetruire);
exit;
else
Cursor.All.Suivant.All.Valeur := Valeur;
exit;
end if;
elsif Cursor.All.Suivant.All.Indice > Indice then
exit when Valeur = 0.0;
Cursor.All.Suivant := new T_Cellule'(Indice, Valeur, Cursor.All.Suivant);
exit;
end if;
Cursor := Cursor.All.Suivant;
End Loop;
end if;
end Modifier;
function Sont_Egaux_Recursif (V1, V2 : in T_Vecteur_Creux) return Boolean is
begin
if V1 = null xor V2 = null then
return false;
elsif V1 = null and V2 = null then
return true;
elsif (V1.All.Valeur = V2.All.Valeur and V1.All.Indice = V2.All.Indice) then
return true;
else
return Sont_Egaux_Recursif (V1.All.Suivant, V2.All.Suivant);
end if;
end Sont_Egaux_Recursif;
function Sont_Egaux_Iteratif (V1, V2 : in T_Vecteur_Creux) return Boolean is
Cursor1, Cursor2 : T_Vecteur_Creux;
begin
if V1 = null xor V2 = null then
return false;
elsif V1 = null and V2 = null then
return true;
else
Cursor1 := V1;
Cursor2 := V2;
While true Loop
if not (Cursor1.All.Valeur = Cursor2.All.Valeur and Cursor1.All.Indice = Cursor2.All.Indice) then
return false;
else
Cursor1 := Cursor1.All.Suivant;
Cursor2 := Cursor2.All.Suivant;
exit when Cursor1 = null and Cursor2 = null;
end if;
End Loop;
return true;
end if;
end Sont_Egaux_Iteratif;
procedure Additionner (V1 : in out T_Vecteur_Creux; V2 : in T_Vecteur_Creux) is
V : T_Vecteur_Creux;
Cursor1, Cursor2 : T_Vecteur_Creux;
begin
Initialiser(V);
if V1 /= null and V2 = null then
null;
elsif V1 = null and V2 /= null then
V1 := V2;
elsif V1 = null and V2 = null then
null;
else
Cursor1 := V1;
Cursor2 := V2;
while (Cursor1 /= null and Cursor2 /= null) loop
if Cursor1 /= null then
Modifier(V, Cursor1.All.Indice, Cursor1.All.Valeur);
Cursor1 := Cursor1.All.Suivant;
end if;
if Cursor2 /= null then
Modifier(V, Cursor2.All.Indice, Cursor2.All.Valeur);
Cursor2 := Cursor2.All.Suivant;
end if;
end loop;
end if;
V1 := V;
end Additionner;
function Norme2 (V : in T_Vecteur_Creux) return Float is
Cursor : T_Vecteur_Creux;
n : Float := 0.0;
begin
Cursor := V;
while (Cursor /= null) loop
n := n + Cursor.All.Valeur*Cursor.All.Valeur;
Cursor := Cursor.All.Suivant;
end loop;
return n;
end Norme2;
Function Produit_Scalaire (V1, V2: in T_Vecteur_Creux) return Float is
Cursor : T_Vecteur_Creux;
n : float := 0.0;
begin
Cursor := V1;
while (Cursor /= null) loop
n := n + Cursor.All.Valeur*Composante_Recursif(V2, Cursor.All.Indice);
Cursor := Cursor.All.Suivant;
end loop;
return n;
end Produit_Scalaire;
procedure Afficher (V : T_Vecteur_Creux) is
begin
if V = Null then
Put ("--E");
else
-- Afficher la composante V.all
Put ("-->[ ");
Put (V.all.Indice, 0);
Put (" | ");
Put (V.all.Valeur, Fore => 0, Aft => 1, Exp => 0);
Put (" ]");
-- Afficher les autres composantes
Afficher (V.all.Suivant);
end if;
end Afficher;
function Nombre_Composantes_Non_Nulles (V: in T_Vecteur_Creux) return Integer is
begin
if V = Null then
return 0;
else
return 1 + Nombre_Composantes_Non_Nulles (V.All.Suivant);
end if;
end Nombre_Composantes_Non_Nulles;
end Vecteurs_Creux;

93
tp09/vecteurs_creux.ads Executable file
View file

@ -0,0 +1,93 @@
-- Ce module définit un type Vecteur_Creux et les opérations associés. Un
-- vecteur creux est un vecteur qui contient essentiellement des 0. Aussi pour
-- économiser l'espace de stockage et les temps de calculs, on ne conserve que
-- les valeurs non nulles.
package Vecteurs_Creux is
type T_Vecteur_Creux is limited private;
-- Initialiser un vecteur creux. Il est nul.
procedure Initialiser (V : out T_Vecteur_Creux) with
Post => Est_Nul (V);
-- Détruire le vecteur V.
procedure Detruire (V: in out T_Vecteur_Creux);
-- Est-ce que le vecteur V est nul ?
function Est_Nul (V : in T_Vecteur_Creux) return Boolean;
-- Récupérer la composante (valeur) du vecteur V à l'indice Indice.
function Composante_Recursif (V : in T_Vecteur_Creux ; Indice : in Integer) return Float
with Pre => Indice >= 1;
-- Récupérer la composante (valeur) du vecteur V à l'indice Indice.
function Composante_Iteratif (V : in T_Vecteur_Creux ; Indice : in Integer) return Float
with Pre => Indice >= 1;
-- Modifier une composante (Indice, Valeur) d'un vecteur creux.
procedure Modifier (V : in out T_Vecteur_Creux ;
Indice : in Integer ;
Valeur : in Float ) with
pre => Indice >= 1,
post => Composante_Recursif (V, Indice) = Valeur;
-- Est-ce que deux vecteurs creux sont égaux ?
function Sont_Egaux_Recursif (V1, V2 : in T_Vecteur_Creux) return Boolean;
-- Est-ce que deux vecteurs creux sont égaux ?
function Sont_Egaux_Iteratif (V1, V2 : in T_Vecteur_Creux) return Boolean;
-- Additionner V1 avec V2. Ce sous-programme réalise l'opération suivante :
-- V1 := V1 + V2
procedure Additionner (V1 : in out T_Vecteur_Creux; V2 : in T_Vecteur_Creux);
-- Norme au carré du vecteur V.
function Norme2 (V : in T_Vecteur_Creux) return Float;
-- Le produit scalaire de deux vecteurs.
function Produit_Scalaire (V1, V2: in T_Vecteur_Creux) return Float;
-- Afficher le vecteur creux à des fins de mise au point.
procedure Afficher (V : T_Vecteur_Creux);
-- Nombre de composantes non nulles du vecteur V.
--
-- Ce sous-programme ne fait normalement pas partie de la spécification
-- du module. Il a été ajouté pour faciliter l'écriture des programmes
-- de test.
function Nombre_Composantes_Non_Nulles (V: in T_Vecteur_Creux) return Integer with
Post => Nombre_Composantes_Non_Nulles'Result >= 0;
private
type T_Cellule;
type T_Vecteur_Creux is access T_Cellule;
type T_Cellule is
record
Indice : Integer;
Valeur : Float;
Suivant : T_Vecteur_Creux;
-- Invariant :
-- Indice >= 1;
-- Suivant = Null or else Suivant.all.Indice > Indice;
-- -- les cellules sont stockés dans l'ordre croissant des indices.
end record;
end Vecteurs_Creux;

1
tp10/.gitignore vendored Executable file
View file

@ -0,0 +1 @@
build/

10
tp10/Makefile Executable file
View file

@ -0,0 +1,10 @@
make:
cd build/ && \
gnat make -gnatwa -gnata -g ../src/*.adb
clean:
cd build/ && \
gnat clean ../src/*.adb
pdf:
pandoc README.md -o README.pdf

101
tp10/README.md Executable file
View file

@ -0,0 +1,101 @@
Compte-rendu minimal du mini-projet SDA : LCA et TH
Auteur : Fainsin Laurent
Groupe de TP : 1SN-G
# Building
~~~
$ colormake
~~~
# Cleaning
~~~
$ make clean
~~~
# Generate PDF
~~~
$ pandoc README.md -o README.pdf \
-V geometry:"paperwidth=21cm, paperheight=47cm, margin=3cm"
~~~
# Question 1.4
Implantation par listes chaînées d'une SDA.
## Inconvénients
- L'utilisation de pointeurs est parfois compliquée.
- Le parcours de la liste est au minimum linéaire, et non pas en O(1).
- L'utilisation des pointeurs peut mener à des situations imprévisibles voire dangereuse.
## Avantages
- La taille de la liste est dynamique.
# Évaluation expérimentale.
## Performances LCA
~~~
$ build/evaluer_alea_lca 1000 1000000
Borne : 1000
Taille : 1000000
Min : 8.68000E-04
Max : 1.12400E-03
~~~
~~~
$ time build/evaluer_alea_th 1000 1000000
5,82s user 0,00s system 99% cpu 5,823 total
~~~
~~~
$ valgrind build/evaluer_alea_lca 1000 1000000
HEAP SUMMARY:
in use at exit: 0 bytes in 0 blocks
total heap usage: 3,011 allocs, 3,011 frees, 1,430,544 bytes allocated
All heap blocks were freed -- no leaks are possible
~~~
## Performances TH
~~~
$ build/evaluer_alea_th 1000 1000000
Borne : 1000
Taille : 1000000
Min : 8.84000E-04
Max : 1.09400E-03
~~~
~~~
$ time build/evaluer_alea_th 1000 1000000
0,06s user 0,00s system 99% cpu 0,060 total
~~~
~~~
$ valgrind build/evaluer_alea_th 1000 1000000
HEAP SUMMARY:
in use at exit: 0 bytes in 0 blocks
total heap usage: 1,011 allocs, 1,011 frees, 710,544 bytes allocated
All heap blocks were freed -- no leaks are possible
~~~
## Comparaison
LH est bien plus efficace temporellement et spatialement que LCA.
## Qualité du générateur aléatoire
Pourvu que Taille soit assez grand, on retrouve bien un générateur aléatoire de bonne qualité puisque Min et Max sont très proches. (à noter que j'ai choisi de véritablement afficher les fréquences, puisque celles-ci doivent aussi converger vers 0 quand Taille tend vers +infini)
# Principales difficultés rencontrées
La généricité des modules est parfois compliquée, il faut bien cerner le problème et cela peut demander du temps. L'implémentation en elle-même des modules n'est pas si compliqué que cela, mais le debugging (avec valgrind) pour arriver à un code sans erreur ou warning est fastidieux.
# Informations complémentaires
J'ai détaillé les étapes principales du mini-projet avec git. Ainsi j'ai parfois rajouté des fonctions dans lca et th pour résoudre des problèmes liés à d'autres exercices.
# Bilan personnel
Il ressemblait fortement aux quelques derniers TP/TD, donc il solidifie mes connaissances en Ada et sur les pointeurs.

BIN
tp10/README.pdf Executable file

Binary file not shown.

20
tp10/src/alea.adb Executable file
View file

@ -0,0 +1,20 @@
with Ada.Numerics.Discrete_Random;
package body Alea is
subtype Intervalle is Integer range Lower_Bound..Upper_Bound;
package Generateur_P is
new Ada.Numerics.Discrete_Random (Intervalle);
use Generateur_P;
Generateur : Generateur_P.Generator;
procedure Get_Random_Number (Resultat : out Integer) is
begin
Resultat := Random (Generateur);
end Get_Random_Number;
begin
Reset(Generateur);
end Alea;

13
tp10/src/alea.ads Executable file
View file

@ -0,0 +1,13 @@
generic
Lower_Bound, Upper_Bound : Integer; -- bounds in which random numbers are generated
-- { Lower_Bound <= Upper_Bound }
package Alea is
-- Compute a random number in the range Lower_Bound..Upper_Bound.
--
-- Notice that Ada advocates the definition of a range type in such a case
-- to ensure that the type reflects the real possible values.
procedure Get_Random_Number (Resultat : out Integer);
end Alea;

156
tp10/src/evaluer_alea_lca.adb Executable file
View file

@ -0,0 +1,156 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
with Ada.Command_Line; use Ada.Command_Line;
with SDA_Exceptions; use SDA_Exceptions;
with Alea;
with LCA;
-- Évaluer la qualité du générateur aléatoire et les SDA.
procedure Evaluer_Alea_LCA is
-- Afficher l'usage.
procedure Afficher_Usage is
begin
New_Line;
Put_Line ("Usage : " & Command_Name & " Borne Taille");
New_Line;
Put_Line (" Borne (int) : les nombres sont tirés dans l'intervalle 1..Borne");
Put_Line (" Taille (int) : la taille de l'échantillon");
New_Line;
end Afficher_Usage;
-- Afficher le Nom et la Valeur d'une variable.
-- La Valeur est affichée sur la Largeur_Valeur précisée.
procedure Afficher_Variable (Nom: String; Valeur: in Integer; Largeur_Valeur: in Integer := 1) is
begin
Put (Nom);
Put (" : ");
Put (Valeur, Largeur_Valeur);
New_Line;
end Afficher_Variable;
-- surchage pour le type Float
procedure Afficher_Variable (Nom: String; Valeur: in Float; Largeur_Valeur: in Integer := 1) is
begin
Put (Nom);
Put (" : ");
Put (Valeur, Largeur_Valeur);
New_Line;
end Afficher_Variable;
procedure Calculer_Statistiques (
Borne : in Integer; -- Borne supérieur de l'intervalle de recherche
Taille : in Integer; -- Taille de l'échantillon
Min, Max : out Float -- min et max des fréquences de l'échantillon
) with
Pre => Borne > 1 and Taille > 1,
Post => 0.0 <= Min and Min <= Float(Taille)
and 0.0 <= Max and Max <= Float(Taille)
and Min + Max <= Float(Taille)
is
package Mon_Alea is
new Alea (1, Borne);
use Mon_Alea;
package LCA_String_Integer is
new LCA(T_Cle => Integer, T_Donnee => Float);
use LCA_String_Integer;
procedure Diviser(C: in out Integer ; D: in out Float) is
begin
D := D / Float(Taille);
end Diviser;
procedure Normaliser is
new Pour_Chaque(Diviser);
procedure Comparaison(C: in out Integer ; D: in out Float) is
begin
if Min > D then
Min := D;
end if;
if Max < D then
Max := D;
end if;
end Comparaison;
procedure Min_Max is
new Pour_Chaque(Comparaison);
my_lca: T_LCA;
nb: Integer;
begin
Initialiser(my_lca);
-- on génère des nombres
for I in 1..Taille loop
Get_Random_Number(nb);
begin
Enregistrer(my_lca, nb, La_Donnee(my_lca, nb) + 1.0);
exception
when Cle_Absente_Exception => Enregistrer(my_lca, nb, 1.0);
end;
end loop;
-- on divise par Taille pour obtenir la fréquence
Normaliser(my_lca);
Min := Premiere_Donnee(my_lca);
Max := Premiere_Donnee(my_lca);
Min_Max(my_lca);
Vider(my_lca);
end Calculer_Statistiques;
Min, Max: Float; -- fréquence minimale et maximale d'un échantillon
Borne: Integer; -- les nombres aléatoire sont tirés dans 1..Borne
Taille: integer; -- nombre de tirages aléatoires
procedure Demander(nb: in out Integer ; txt: in String) is
S: String(1 .. 10) := " ";
Last: Integer;
begin
Afficher_Usage;
put(txt); put(" ? ");
Get_Line(S, Last);
nb := Integer'Value(S);
exception
when others => Demander(nb, txt);
end Demander;
begin
if Argument_Count /= 2 then
Afficher_Usage;
else
-- Récupération robuste des arguments
begin
Borne := Integer'Value(Argument(1));
exception
when CONSTRAINT_ERROR => Demander(Borne, "Borne");
end;
begin
Taille := Integer'Value(Argument(2));
exception
when CONSTRAINT_ERROR => Demander(Taille, "Taille");
end;
New_Line;
-- Afficher les valeur de Borne et Taille
Afficher_Variable("Borne", Borne);
Afficher_Variable("Taille", Taille);
Calculer_Statistiques(Borne, Taille, Min, Max);
-- Afficher les fréquence Min et Max
Afficher_Variable ("Min", Min);
Afficher_Variable ("Max", Max);
end if;
end Evaluer_Alea_LCA;

165
tp10/src/evaluer_alea_th.adb Executable file
View file

@ -0,0 +1,165 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
with Ada.Command_Line; use Ada.Command_Line;
with SDA_Exceptions; use SDA_Exceptions;
with Alea;
with TH;
-- Évaluer la qualité du générateur aléatoire et les SDA.
procedure Evaluer_Alea_TH is
Capacite: constant Integer := 1000;
-- Afficher l'usage.
procedure Afficher_Usage is
begin
New_Line;
Put_Line ("Usage : " & Command_Name & " Borne Taille");
New_Line;
Put_Line (" Borne (int) : les nombres sont tirés dans l'intervalle 1..Borne");
Put_Line (" Taille (int) : la taille de l'échantillon");
New_Line;
end Afficher_Usage;
-- Afficher le Nom et la Valeur d'une variable.
-- La Valeur est affichée sur la Largeur_Valeur précisée.
procedure Afficher_Variable (Nom: String; Valeur: in Integer; Largeur_Valeur: in Integer := 1) is
begin
Put (Nom);
Put (" : ");
Put (Valeur, Largeur_Valeur);
New_Line;
end Afficher_Variable;
-- surchage pour le type Float
procedure Afficher_Variable (Nom: String; Valeur: in Float; Largeur_Valeur: in Integer := 1) is
begin
Put (Nom);
Put (" : ");
Put (Valeur, Largeur_Valeur);
New_Line;
end Afficher_Variable;
procedure Calculer_Statistiques (
Borne : in Integer; -- Borne supérieur de l'intervalle de recherche
Taille : in Integer; -- Taille de l'échantillon
Min, Max : out Float -- min et max des fréquences de l'échantillon
) with
Pre => Borne > 1 and Taille > 1 and Borne <= Capacite,
Post => 0.0 <= Min and Min <= Float(Taille)
and 0.0 <= Max and Max <= Float(Taille)
and Min + Max <= Float(Taille)
is
package Mon_Alea is
new Alea (1, Borne);
use Mon_Alea;
function fonction_hachage(S: in Integer) return Integer is
begin
return S;
end fonction_hachage;
package TH_String_Integer is
new TH(T_Cle => Integer, Cle_init => 0,
T_Donnee => Float, Donnee_init => 0.0,
Capacite => Capacite,
Hash => fonction_hachage);
use TH_String_Integer;
procedure Diviser(C: in out Integer ; D: in out Float) is
begin
D := D / Float(Taille);
end Diviser;
procedure Normaliser is
new Pour_Chaque(Diviser);
procedure Comparaison(C: in out Integer ; D: in out Float) is
begin
if Min > D then
Min := D;
end if;
if Max < D then
Max := D;
end if;
end Comparaison;
procedure Min_Max is
new Pour_Chaque(Comparaison);
my_TH: T_TH;
nb: Integer;
begin
Initialiser(my_TH);
-- on génère des nombres
for I in 1..Taille loop
Get_Random_Number(nb);
begin
Enregistrer(my_TH, nb, La_Donnee(my_TH, nb) + 1.0);
exception
when Cle_Absente_Exception => Enregistrer(my_TH, nb, 1.0);
end;
end loop;
-- on divise par Taille pour obtenir la fréquence
Normaliser(my_TH);
Min := Premiere_Donnee(my_TH);
Max := Premiere_Donnee(my_TH);
Min_Max(my_TH);
Vider(my_TH);
end Calculer_Statistiques;
Min, Max: Float; -- fréquence minimale et maximale d'un échantillon
Borne: Integer; -- les nombres aléatoire sont tirés dans 1..Borne
Taille: integer; -- nombre de tirages aléatoires
procedure Demander(nb: in out Integer ; txt: in String) is
S: String(1 .. 10) := " ";
Last: Integer;
begin
Afficher_Usage;
put(txt); put(" ? ");
Get_Line(S, Last);
nb := Integer'Value(S);
exception
when others => Demander(nb, txt);
end Demander;
begin
if Argument_Count /= 2 then
Afficher_Usage;
else
-- Récupération robuste des arguments
begin
Borne := Integer'Value(Argument(1));
exception
when CONSTRAINT_ERROR => Demander(Borne, "Borne");
end;
begin
Taille := Integer'Value(Argument(2));
exception
when CONSTRAINT_ERROR => Demander(Taille, "Taille");
end;
New_Line;
-- Afficher les valeur de Borne et Taille
Afficher_Variable("Borne", Borne);
Afficher_Variable("Taille", Taille);
Calculer_Statistiques(Borne, Taille, Min, Max);
-- Afficher les fréquence Min et Max
Afficher_Variable ("Min", Min);
Afficher_Variable ("Max", Max);
end if;
end Evaluer_Alea_TH;

21
tp10/src/exemple_alea.adb Executable file
View file

@ -0,0 +1,21 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Alea;
-- Procédure qui illustre l'utilisation du paquetage Alea.
procedure Exemple_Alea is
package Mon_Alea is
new Alea (5, 15); -- générateur de nombre dans l'intervalle [5, 15]
use Mon_Alea;
Nombre: Integer;
begin
-- Afficher 10 nombres aléatoires
Put_Line ("Quelques nombres aléatoires : ");
for I in 1..10 loop
Get_Random_Number (Nombre);
Put (Nombre);
New_Line;
end loop;
end Exemple_Alea;

View file

@ -0,0 +1,33 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_IO.Unbounded_IO; use Ada.Text_IO.Unbounded_IO;
-- Exemple d'utilisation des Unbonded_String
procedure Exemple_Unbounded_String is
Chaine: Unbounded_String;
begin
-- Intialiser une Unbounded_String à partir d'une String
Chaine := To_Unbounded_String ("Exemple");
-- Afficher une Unbounded_String
Put_Line ("La chaine est : " & Chaine); --! & concaténation des chaînes
-- Longueur d'une Unbounded_String
Put ("Sa longueur est : ");
Put (Length (Chaine), 1);
New_Line;
-- L'initiale de la chaîne
Put_Line ("Son initiale est " & To_String (Chaine) (1));
-- Ajouter une chaîne à la fin d'une Unbounded_String
Append (Chaine, " final");
Put_Line ("La chaine après concaténation est : " & Chaine);
-- Lire au clavier une Unbounded_String
Put ("Donner une chaîne : ");
Chaine := Get_Line;
Put_Line ("La chaine lu est : " & Chaine);
end Exemple_Unbounded_String;

135
tp10/src/lca.adb Executable file
View file

@ -0,0 +1,135 @@
with SDA_Exceptions; use SDA_Exceptions;
with Ada.Unchecked_Deallocation;
package body LCA is
procedure Free is
new Ada.Unchecked_Deallocation(Object => T_Cellule, Name => T_LCA);
-- fonction récursive pour simplifier l'écriture des autres fonctions/procédures du module
function Goto_Cle(SDA: in T_LCA; Cle: in T_Cle) return T_LCA is
begin
if SDA = null then
raise Cle_Absente_Exception;
elsif SDA.all.Cle = Cle then
return SDA;
else
return Goto_Cle(SDA.all.Next, Cle);
end if;
end Goto_Cle;
procedure Initialiser(SDA: in out T_LCA) is
begin
SDA := null;
end Initialiser;
function Est_Vide(SDA: in T_LCA) return Boolean is
begin
return SDA = null;
end Est_Vide;
-- version récursive
function Taille(SDA: in T_LCA) return Integer is
begin
if SDA = null then
return 0;
else
return 1 + Taille(SDA.all.Next);
end if;
end Taille;
procedure Enregistrer(SDA: in out T_LCA; Cle: in T_Cle; Donnee: in T_Donnee) is
Cursor: T_LCA;
begin
Cursor := Goto_Cle(SDA, Cle);
Cursor.all.Donnee := Donnee;
exception
when Cle_Absente_Exception
=> SDA := new T_Cellule'(Cle, Donnee, SDA);
end Enregistrer;
-- version récursive
procedure Supprimer(SDA: in out T_LCA; Cle: in T_Cle) is
procedure Suppression(SDA: in T_LCA; Cle: in T_Cle) is
Cursor: T_LCA;
begin
if SDA.all.Next.all.Cle = Cle then
Cursor := SDA.all.Next.all.Next;
Free(SDA.all.Next);
SDA.all.Next := Cursor;
else
Suppression(SDA.all.Next, Cle);
end if;
end Suppression;
Cursor: T_LCA := SDA;
begin
-- si il n'y a pas la clé on lève un exception
if not Cle_Presente(SDA, Cle) then
raise Cle_Absente_Exception;
-- si SDA n'est constitué que d'un élément, dont la cle est celle que l'on cherche
elsif SDA.all.Cle = Cle and SDA.all.Next = null then
free(SDA);
SDA := null;
-- si on tombe directement sur la clé
elsif SDA.all.Cle = Cle then
SDA := SDA.all.Next;
free(Cursor);
-- sinon on va cherche récursivement la clé
else
Suppression(SDA, Cle);
end if;
end Supprimer;
function Cle_Presente(SDA: in T_LCA; Cle: in T_Cle) return Boolean is
begin
return Goto_Cle(SDA, Cle) /= null;
exception
when Cle_Absente_Exception => return False;
end Cle_Presente;
function La_Donnee(SDA: in T_LCA; Cle: in T_Cle) return T_Donnee is
Cursor: T_LCA;
begin
Cursor := Goto_Cle(SDA, Cle);
return Cursor.all.Donnee;
end La_Donnee;
-- version récursive
procedure Vider(SDA: in out T_LCA) is
begin
if SDA /= null then
Vider(SDA.all.Next);
Free(SDA);
SDA := null;
end if;
end Vider;
procedure Pour_Chaque(SDA: in out T_LCA) is
Cursor: T_LCA := SDA;
begin
while (Cursor /= null) loop
Traiter(Cursor.all.Cle, Cursor.all.Donnee);
Cursor := Cursor.all.Next;
end loop;
exception
-- si il y a un problème on passe simplement au suivant
when others => Pour_Chaque(Cursor.all.Next);
end Pour_Chaque;
function Premiere_Donnee(SDA: in T_LCA) return T_Donnee is
begin
return SDA.all.Donnee;
end Premiere_Donnee;
end LCA;

72
tp10/src/lca.ads Executable file
View file

@ -0,0 +1,72 @@
-- Définition de structures de données associatives (SDA) sous forme d'une liste chaînée associative (LCA).
generic
type T_Cle is private;
type T_Donnee is private;
package LCA is
type T_Cellule is limited private;
type T_LCA is limited private;
-- Initialiser une SDA. La SDA est vide.
procedure Initialiser(SDA: in out T_LCA) with
Post => Est_Vide(SDA);
-- Est-ce qu'une SDA est vide ?
function Est_Vide(SDA: in T_LCA) return Boolean;
-- Obtenir le nombre d'éléments d'une SDA.
function Taille(SDA: in T_LCA) return Integer with
Post => Taille'Result >= 0
and (Taille'Result = 0) = Est_Vide(SDA);
-- Enregistrer une Donnée associée à une Clé dans une SDA.
-- Si la clé est déjà présente dans la SDA, sa donnée est changée.
procedure Enregistrer(SDA: in out T_LCA; Cle: in T_Cle; Donnee: in T_Donnee) with
Post => Cle_Presente(SDA, Cle)
and then (La_Donnee(SDA, Cle) = Donnee);
-- Supprimer la Donnée associée à une Clé dans une SDA.
-- Exception: Cle_Absente_Exception si Clé n'est pas utilisée dans la SDA
procedure Supprimer(SDA: in out T_LCA; Cle: in T_Cle) with
Post => not Cle_Presente (SDA, Cle);
-- Savoir si une Clé est présente dans une SDA.
function Cle_Presente(SDA: in T_LCA; Cle: in T_Cle) return Boolean;
-- Obtenir la donnée associée à une Cle dans la SDA.
-- Exception: Cle_Absente_Exception si Clé n'est pas utilisée dans l'SDA
function La_Donnee(SDA: in T_LCA; Cle: in T_Cle) return T_Donnee;
-- Supprimer tous les éléments d'une SDA.
procedure Vider(SDA: in out T_LCA) with
Post => Est_Vide(SDA);
-- Appliquer un traitement (Traiter) pour chaque couple d'une SDA.
generic
with procedure Traiter(Cle: in out T_Cle; Donnee: in out T_Donnee);
procedure Pour_Chaque(SDA: in out T_LCA);
function Premiere_Donnee(SDA: in T_LCA) return T_Donnee;
private
type T_LCA is access T_Cellule;
type T_Cellule is
record
Cle: T_Cle;
Donnee: T_Donnee;
Next: T_LCA;
end record;
end LCA;

38
tp10/src/lca_sujet.adb Executable file
View file

@ -0,0 +1,38 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with LCA;
-- Procédure qui illustre l'utilisation du paquetage LCA.
procedure LCA_Sujet is
package LCA_String_Integer is
new LCA(T_Cle => Unbounded_String, T_Donnee => Integer);
use LCA_String_Integer;
procedure Formatage(S: in out Unbounded_String ; N: in out Integer) is
begin
put('"');
put(To_String(S));
put('"');
put(" : ");
put(N, 1);
new_line;
end Formatage;
procedure Afficher is
new Pour_Chaque(Formatage);
my_lca: T_LCA;
begin
Initialiser(my_lca);
Enregistrer(my_lca, To_Unbounded_String("un"), 1);
Enregistrer(my_lca, To_Unbounded_String("deux"), 2);
Afficher(my_lca);
put_line("OK");
end LCA_Sujet;

6
tp10/src/sda_exceptions.ads Executable file
View file

@ -0,0 +1,6 @@
-- Définition d'une exception commune à toutes les SDA.
package SDA_Exceptions is
Cle_Absente_Exception: Exception; -- une clé est absente d'un SDA
end SDA_Exceptions;

375
tp10/src/test_lca.adb Executable file
View file

@ -0,0 +1,375 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with SDA_Exceptions; use SDA_Exceptions;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
--! Les Unbounded_String ont une capacité variable, contrairement au String
--! pour lesquelles une capacité doit être fixée.
with LCA;
procedure Test_LCA is
package LCA_String_Integer is
new LCA(T_Cle => Unbounded_String, T_Donnee => Integer);
use LCA_String_Integer;
-- Retourner une chaîne avec des guillemets autour de S
function Avec_Guillemets(S: Unbounded_String) return String is
begin
return '"' & To_String(S) & '"';
end Avec_Guillemets;
-- Utiliser & entre String à gauche et Unbounded_String à droite. Des
-- guillemets sont ajoutées autour de la Unbounded_String
-- Il s'agit d'un masquage de l'opérteur & défini dans Strings.Unbounded
function "&"(Left: String; Right: Unbounded_String) return String is
begin
return Left & Avec_Guillemets(Right);
end "&";
-- Surcharge l'opérateur unaire "+" pour convertir une String
-- en Unbounded_String.
-- Cette astuce permet de simplifier l'initialisation
-- de cles un peu plus loin.
function "+" (Item: in String) return Unbounded_String
renames To_Unbounded_String;
-- Afficher une Unbounded_String et un entier.
procedure Afficher(S: in out Unbounded_String; N: in out Integer) is
begin
Put(Avec_Guillemets(S));
Put(": ");
Put(N, 1);
New_Line;
end Afficher;
-- Afficher la Sda.
procedure Afficher is
new Pour_Chaque(Afficher);
Nb_Cles: constant Integer := 7;
Cles: constant array (1..Nb_Cles) of Unbounded_String
:= (+"un", +"deux", +"trois", +"quatre", +"cinq",
+"quatre-vingt-dix-neuf", +"vingt-et-un");
Inconnu: constant Unbounded_String := To_Unbounded_String("Inconnu");
Donnees: constant array (1..Nb_Cles) of Integer
:= (1, 2, 3, 4, 5, 99, 21);
Somme_Donnees: constant Integer := 135;
Somme_Donnees_Len4: constant Integer := 7; -- somme si Length (Cle) = 4
Somme_Donnees_Q: constant Integer := 103; -- somme si initiale de Cle = 'q'
-- Initialiser l'annuaire avec les Donnees et Cles ci-dessus.
-- Attention, c'est à l'appelant de libérer la mémoire associée en
-- utilisant Vider.
-- Si Bavard est vrai, les insertions sont tracées (affichées).
procedure Construire_Exemple_Sujet(Annuaire: out T_LCA; Bavard: Boolean := False) is
begin
Initialiser(Annuaire);
pragma Assert(Est_Vide(Annuaire));
pragma Assert(Taille(Annuaire) = 0);
for I in 1..Nb_Cles loop
Enregistrer(Annuaire, Cles(I), Donnees(I));
if Bavard then
Put_Line("Après insertion de la clé " & Cles(I));
Afficher(Annuaire); New_Line;
else
null;
end if;
pragma Assert(not Est_Vide(Annuaire));
pragma Assert(Taille(Annuaire) = I);
for J in 1..I loop
pragma Assert(La_Donnee(Annuaire, Cles(J)) = Donnees(J));
end loop;
for J in I+1..Nb_Cles loop
pragma Assert(not Cle_Presente(Annuaire, Cles(J)));
end loop;
end loop;
end Construire_Exemple_Sujet;
procedure Tester_Exemple_Sujet is
Annuaire: T_LCA;
begin
Construire_Exemple_Sujet(Annuaire, True);
Vider(Annuaire);
end Tester_Exemple_Sujet;
-- Tester suppression en commençant par les derniers éléments ajoutés
procedure Tester_Supprimer_Inverse is
Annuaire: T_LCA;
begin
Put_Line("=== Tester_Supprimer_Inverse..."); New_Line;
Construire_Exemple_Sujet(Annuaire);
for I in reverse 1..Nb_Cles loop
Supprimer(Annuaire, Cles(I));
Put_Line("Après suppression de " & Cles(I) & ":");
Afficher(Annuaire); New_Line;
for J in 1..I-1 loop
pragma Assert(Cle_Presente(Annuaire, Cles(J)));
pragma Assert(La_Donnee(Annuaire, Cles(J)) = Donnees(J));
end loop;
for J in I..Nb_Cles loop
pragma Assert(not Cle_Presente(Annuaire, Cles(J)));
end loop;
end loop;
Vider(Annuaire);
end Tester_Supprimer_Inverse;
-- Tester suppression en commençant les les premiers éléments ajoutés
procedure Tester_Supprimer is
Annuaire: T_LCA;
begin
Put_Line("=== Tester_Supprimer..."); New_Line;
Construire_Exemple_Sujet(Annuaire);
for I in 1..Nb_Cles loop
Put_Line("Suppression de " & Cles(I) & ":");
Supprimer(Annuaire, Cles(I));
Afficher(Annuaire); New_Line;
for J in 1..I loop
pragma Assert(not Cle_Presente(Annuaire, Cles(J)));
end loop;
for J in I+1..Nb_Cles loop
pragma Assert(Cle_Presente(Annuaire, Cles(J)));
pragma Assert(La_Donnee(Annuaire, Cles(J)) = Donnees(J));
end loop;
end loop;
Vider(Annuaire);
end Tester_Supprimer;
procedure Tester_Supprimer_Un_Element is
-- Tester supprimer sur un élément, celui à Indice dans Cles.
procedure Tester_Supprimer_Un_Element (Indice: in Integer) is
Annuaire: T_LCA;
begin
Construire_Exemple_Sujet(Annuaire);
Put_Line("Suppression de " & Cles(Indice) & ":");
Supprimer(Annuaire, Cles(Indice));
Afficher(Annuaire); New_Line;
for J in 1..Nb_Cles loop
if J = Indice then
pragma Assert(not Cle_Presente(Annuaire, Cles(J)));
else
pragma Assert(Cle_Presente(Annuaire, Cles(J)));
end if;
end loop;
Vider(Annuaire);
end Tester_Supprimer_Un_Element;
begin
Put_Line("=== Tester_Supprimer_Un_Element..."); New_Line;
for I in 1..Nb_Cles loop
Tester_Supprimer_Un_Element (I);
end loop;
end Tester_Supprimer_Un_Element;
procedure Tester_Remplacer_Un_Element is
-- Tester enregistrer sur un élément présent, celui à Indice dans Cles.
procedure Tester_Remplacer_Un_Element(Indice: in Integer; Nouveau: in Integer) is
Annuaire: T_LCA;
begin
Construire_Exemple_Sujet(Annuaire);
Put_Line("Remplacement de " & Cles(Indice)
& " par " & Integer'Image(Nouveau) & ":");
enregistrer(Annuaire, Cles(Indice), Nouveau);
Afficher(Annuaire); New_Line;
for J in 1..Nb_Cles loop
pragma Assert(Cle_Presente(Annuaire, Cles(J)));
if J = Indice then
pragma Assert(La_Donnee(Annuaire, Cles(J)) = Nouveau);
else
pragma Assert(La_Donnee(Annuaire, Cles(J)) = Donnees(J));
end if;
end loop;
Vider(Annuaire);
end Tester_Remplacer_Un_Element;
begin
Put_Line("=== Tester_Remplacer_Un_Element..."); New_Line;
for I in 1..Nb_Cles loop
Tester_Remplacer_Un_Element(I, 0);
null;
end loop;
end Tester_Remplacer_Un_Element;
procedure Tester_Supprimer_Erreur is
Annuaire: T_LCA;
begin
Put_Line("=== Tester_Supprimer_Erreur..."); New_Line;
Construire_Exemple_Sujet(Annuaire);
Supprimer(Annuaire, Inconnu);
exception
when Cle_Absente_Exception =>
null;
when others =>
pragma Assert(False);
Vider(Annuaire);
end Tester_Supprimer_Erreur;
procedure Tester_La_Donnee_Erreur is
Annuaire: T_LCA;
Inutile: Integer;
begin
Put_Line("=== Tester_Supprimer_Erreur..."); New_Line;
Construire_Exemple_Sujet(Annuaire);
Inutile := La_Donnee(Annuaire, Inconnu);
exception
when Cle_Absente_Exception =>
null;
when others =>
pragma Assert(False);
Vider(Annuaire);
end Tester_La_Donnee_Erreur;
procedure Tester_Pour_chaque is
Annuaire: T_LCA;
Somme: Integer;
procedure Sommer(Cle: in out Unbounded_String; Donnee: in out Integer) is
begin
Put(" + ");
Put(Donnee, 2);
New_Line;
Somme := Somme + Donnee;
end Sommer;
procedure Sommer is
new Pour_Chaque(Sommer);
begin
Put_Line("=== Tester_Pour_Chaque..."); New_Line;
Construire_Exemple_Sujet(Annuaire);
Somme := 0;
Sommer(Annuaire);
pragma Assert(Somme = Somme_Donnees);
Vider(Annuaire);
New_Line;
end Tester_Pour_chaque;
procedure Tester_Pour_chaque_Somme_Si_Cle_Commence_Par_Q is
Annuaire: T_LCA;
Somme: Integer;
procedure Sommer_Cle_Commence_Par_Q(Cle: in out Unbounded_String; Donnee: in out Integer) is
begin
if To_String (Cle) (1) = 'q' then
Put(" + ");
Put(Donnee, 2);
New_Line;
Somme := Somme + Donnee;
else
null;
end if;
end Sommer_Cle_Commence_Par_Q;
procedure Sommer is
new Pour_Chaque(Sommer_Cle_Commence_Par_Q);
begin
Put_Line("=== Tester_Pour_Chaque_Somme_Si_Cle_Commence_Par_Q..."); New_Line;
Construire_Exemple_Sujet(Annuaire);
Somme := 0;
Sommer(Annuaire);
pragma Assert(Somme = Somme_Donnees_Q);
Vider(Annuaire);
New_Line;
end Tester_Pour_chaque_Somme_Si_Cle_Commence_Par_Q;
procedure Tester_Pour_chaque_Somme_Len4_Erreur is
Annuaire: T_LCA;
Somme: Integer;
procedure Sommer_Len4_Erreur(Cle: in out Unbounded_String; Donnee: in out Integer) is
Nouvelle_Exception: Exception;
begin
if Length(Cle) = 4 then
Put(" + ");
Put(Donnee, 2);
New_Line;
Somme := Somme + Donnee;
else
raise Nouvelle_Exception;
end if;
end Sommer_Len4_Erreur;
procedure Sommer is
new Pour_Chaque(Sommer_Len4_Erreur);
begin
Put_Line("=== Tester_Pour_Chaque_Somme_Len4_Erreur..."); New_Line;
Construire_Exemple_Sujet(Annuaire);
Somme := 0;
Sommer(Annuaire);
pragma Assert(Somme = Somme_Donnees_Len4);
Vider(Annuaire);
New_Line;
end Tester_Pour_chaque_Somme_Len4_Erreur;
begin
Tester_Exemple_Sujet;
Tester_Supprimer_Inverse;
Tester_Supprimer;
Tester_Supprimer_Un_Element;
Tester_Remplacer_Un_Element;
Tester_Supprimer_Erreur;
Tester_La_Donnee_Erreur;
Tester_Pour_chaque;
Tester_Pour_chaque_Somme_Si_Cle_Commence_Par_Q;
Tester_Pour_chaque_Somme_Len4_Erreur;
Put_Line("Fin des tests: OK.");
end Test_LCA;

409
tp10/src/test_th.adb Executable file
View file

@ -0,0 +1,409 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with SDA_Exceptions; use SDA_Exceptions;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
--! Les Unbounded_String ont une capacité variable, contrairement au String
--! pour lesquelles une capacité doit être fixée.
with TH;
procedure Test_TH is
Capacite: constant Integer := 11;
function fonction_hachage(S: in Unbounded_String) return Integer is
begin
return Length(S) mod Capacite + 1;
end fonction_hachage;
package TH_String_Integer is
new TH(T_Cle => Unbounded_String, Cle_init => To_Unbounded_String(""),
T_Donnee => Integer, Donnee_init => 0,
Capacite => Capacite,
Hash => fonction_hachage);
use TH_String_Integer;
-- Retourner une chaîne avec des guillemets autour de S
function Avec_Guillemets(S: Unbounded_String) return String is
begin
return '"' & To_String(S) & '"';
end Avec_Guillemets;
-- Utiliser & entre String à gauche et Unbounded_String à droite. Des
-- guillemets sont ajoutées autour de la Unbounded_String
-- Il s'agit d'un masquage de l'opérteur & défini dans Strings.Unbounded
function "&"(Left: String; Right: Unbounded_String) return String is
begin
return Left & Avec_Guillemets(Right);
end "&";
-- Surcharge l'opérateur unaire "+" pour convertir une String
-- en Unbounded_String.
-- Cette astuce permet de simplifier l'initialisation
-- de cles un peu plus loin.
function "+" (Item: in String) return Unbounded_String
renames To_Unbounded_String;
-- Afficher une Unbounded_String et un entier.
procedure Afficher(S: in out Unbounded_String; N: in out Integer) is
begin
Put(Avec_Guillemets(S));
Put(": ");
Put(N, 1);
New_Line;
end Afficher;
-- Afficher la Sda.
procedure Afficher is
new Pour_Chaque(Afficher);
Nb_Cles: constant Integer := 6;
Cles: constant array (1..Nb_Cles) of Unbounded_String
:= (+"un", +"deux", +"trois", +"quatre",
+"quatre-vingt-dix-neuf", +"vingt-et-un");
Inconnu: constant Unbounded_String := To_Unbounded_String("Inconnu");
Donnees: constant array (1..Nb_Cles) of Integer
:= (1, 2, 3, 4, 99, 21);
Somme_Donnees: constant Integer := 130;
Somme_Donnees_Len4: constant Integer := 2; -- somme si Length (Cle) = 4
Somme_Donnees_Q: constant Integer := 103; -- somme si initiale de Cle = 'q'
-- Initialiser l'annuaire avec les Donnees et Cles ci-dessus.
-- Attention, c'est à l'appelant de libérer la mémoire associée en
-- utilisant Vider.
-- Si Bavard est vrai, les insertions sont tracées (affichées).
procedure Construire_Exemple_Sujet(Annuaire: out T_TH; Bavard: Boolean := False) is
begin
Initialiser(Annuaire);
pragma Assert(Est_Vide(Annuaire));
pragma Assert(Taille(Annuaire) = 0);
for I in 1..Nb_Cles loop
Enregistrer(Annuaire, Cles(I), Donnees(I));
if Bavard then
Put_Line("Après insertion de la clé " & Cles(I));
Afficher(Annuaire); New_Line;
else
null;
end if;
pragma Assert(not Est_Vide(Annuaire));
pragma Assert(Taille(Annuaire) = I);
for J in 1..I loop
pragma Assert(La_Donnee(Annuaire, Cles(J)) = Donnees(J));
end loop;
for J in I+1..Nb_Cles loop
pragma Assert(not Cle_Presente(Annuaire, Cles(J)));
end loop;
end loop;
end Construire_Exemple_Sujet;
procedure Tester_Exemple_Sujet is
Annuaire: T_TH;
begin
Construire_Exemple_Sujet(Annuaire, True);
Vider(Annuaire);
end Tester_Exemple_Sujet;
-- Tester suppression en commençant par les derniers éléments ajoutés
procedure Tester_Supprimer_Inverse is
Annuaire: T_TH;
begin
Put_Line("=== Tester_Supprimer_Inverse..."); New_Line;
Construire_Exemple_Sujet(Annuaire);
for I in reverse 1..Nb_Cles loop
Afficher(Annuaire);
Put(Taille(Annuaire));
Supprimer(Annuaire, Cles(I));
Afficher(Annuaire);
Put(Taille(Annuaire));
Put_Line("Après suppression de " & Cles(I) & ":");
Afficher(Annuaire); New_Line;
for J in 1..I-1 loop
pragma Assert(Cle_Presente(Annuaire, Cles(J)));
pragma Assert(La_Donnee(Annuaire, Cles(J)) = Donnees(J));
end loop;
for J in I..Nb_Cles loop
pragma Assert(not Cle_Presente(Annuaire, Cles(J)));
end loop;
end loop;
Vider(Annuaire);
end Tester_Supprimer_Inverse;
-- Tester suppression en commençant les les premiers éléments ajoutés
procedure Tester_Supprimer is
Annuaire: T_TH;
begin
Put_Line("=== Tester_Supprimer..."); New_Line;
Construire_Exemple_Sujet(Annuaire);
for I in 1..Nb_Cles loop
Put_Line("Suppression de " & Cles(I) & ":");
Supprimer(Annuaire, Cles(I));
Afficher(Annuaire); New_Line;
for J in 1..I loop
pragma Assert(not Cle_Presente(Annuaire, Cles(J)));
end loop;
for J in I+1..Nb_Cles loop
pragma Assert(Cle_Presente(Annuaire, Cles(J)));
pragma Assert(La_Donnee(Annuaire, Cles(J)) = Donnees(J));
end loop;
end loop;
Vider(Annuaire);
end Tester_Supprimer;
procedure Tester_Supprimer_Un_Element is
-- Tester supprimer sur un élément, celui à Indice dans Cles.
procedure Tester_Supprimer_Un_Element (Indice: in Integer) is
Annuaire: T_TH;
begin
Construire_Exemple_Sujet(Annuaire);
Put_Line("Suppression de " & Cles(Indice) & ":");
Supprimer(Annuaire, Cles(Indice));
Afficher(Annuaire); New_Line;
for J in 1..Nb_Cles loop
if J = Indice then
pragma Assert(not Cle_Presente(Annuaire, Cles(J)));
else
pragma Assert(Cle_Presente(Annuaire, Cles(J)));
end if;
end loop;
Vider(Annuaire);
end Tester_Supprimer_Un_Element;
begin
Put_Line("=== Tester_Supprimer_Un_Element..."); New_Line;
for I in 1..Nb_Cles loop
Tester_Supprimer_Un_Element (I);
end loop;
end Tester_Supprimer_Un_Element;
procedure Tester_Remplacer_Un_Element is
-- Tester enregistrer sur un élément présent, celui à Indice dans Cles.
procedure Tester_Remplacer_Un_Element(Indice: in Integer; Nouveau: in Integer) is
Annuaire: T_TH;
begin
Construire_Exemple_Sujet(Annuaire);
Put_Line("Remplacement de " & Cles(Indice)
& " par " & Integer'Image(Nouveau) & ":");
enregistrer(Annuaire, Cles(Indice), Nouveau);
Afficher(Annuaire); New_Line;
for J in 1..Nb_Cles loop
pragma Assert(Cle_Presente(Annuaire, Cles(J)));
if J = Indice then
pragma Assert(La_Donnee(Annuaire, Cles(J)) = Nouveau);
else
pragma Assert(La_Donnee(Annuaire, Cles(J)) = Donnees(J));
end if;
end loop;
Vider(Annuaire);
end Tester_Remplacer_Un_Element;
begin
Put_Line("=== Tester_Remplacer_Un_Element..."); New_Line;
for I in 1..Nb_Cles loop
Tester_Remplacer_Un_Element(I, 0);
null;
end loop;
end Tester_Remplacer_Un_Element;
procedure Tester_Supprimer_Erreur is
Annuaire: T_TH;
begin
Put_Line("=== Tester_Supprimer_Erreur..."); New_Line;
Construire_Exemple_Sujet(Annuaire);
Supprimer(Annuaire, Inconnu);
exception
when Cle_Absente_Exception =>
null;
when others =>
pragma Assert(False);
Vider(Annuaire);
end Tester_Supprimer_Erreur;
procedure Tester_La_Donnee_Erreur is
Annuaire: T_TH;
Inutile: Integer;
begin
Put_Line("=== Tester_Supprimer_Erreur..."); New_Line;
Construire_Exemple_Sujet(Annuaire);
Inutile := La_Donnee(Annuaire, Inconnu);
exception
when Cle_Absente_Exception =>
null;
when others =>
pragma Assert(False);
Vider(Annuaire);
end Tester_La_Donnee_Erreur;
procedure Tester_Pour_chaque is
Annuaire: T_TH;
Somme: Integer;
procedure Sommer(Cle: in out Unbounded_String; Donnee: in out Integer) is
begin
Put(" + ");
Put(Donnee, 2);
New_Line;
Somme := Somme + Donnee;
end Sommer;
procedure Sommer is
new Pour_Chaque(Sommer);
begin
Put_Line("=== Tester_Pour_Chaque..."); New_Line;
Construire_Exemple_Sujet(Annuaire);
Somme := 0;
Sommer(Annuaire);
pragma Assert(Somme = Somme_Donnees);
Vider(Annuaire);
New_Line;
end Tester_Pour_chaque;
procedure Tester_Pour_chaque_Somme_Si_Cle_Commence_Par_Q is
Annuaire: T_TH;
Somme: Integer;
procedure Sommer_Cle_Commence_Par_Q(Cle: in out Unbounded_String; Donnee: in out Integer) is
begin
if To_String (Cle) (1) = 'q' then
Put(" + ");
Put(Donnee, 2);
New_Line;
Somme := Somme + Donnee;
else
null;
end if;
end Sommer_Cle_Commence_Par_Q;
procedure Sommer is
new Pour_Chaque(Sommer_Cle_Commence_Par_Q);
begin
Put_Line("=== Tester_Pour_Chaque_Somme_Si_Cle_Commence_Par_Q..."); New_Line;
Construire_Exemple_Sujet(Annuaire);
Somme := 0;
Sommer(Annuaire);
pragma Assert(Somme = Somme_Donnees_Q);
Vider(Annuaire);
New_Line;
end Tester_Pour_chaque_Somme_Si_Cle_Commence_Par_Q;
procedure Tester_Pour_chaque_Somme_Len4_Erreur is
Annuaire: T_TH;
Somme: Integer;
procedure Sommer_Len4_Erreur(Cle: in out Unbounded_String; Donnee: in out Integer) is
Nouvelle_Exception: Exception;
begin
if Length(Cle) = 4 then
Put(" + ");
Put(Donnee, 2);
New_Line;
Somme := Somme + Donnee;
else
raise Nouvelle_Exception;
end if;
end Sommer_Len4_Erreur;
procedure Sommer is
new Pour_Chaque(Sommer_Len4_Erreur);
begin
Put_Line("=== Tester_Pour_Chaque_Somme_Len4_Erreur..."); New_Line;
Construire_Exemple_Sujet(Annuaire);
Somme := 0;
Sommer(Annuaire);
pragma Assert(Somme = Somme_Donnees_Len4);
Vider(Annuaire);
New_Line;
end Tester_Pour_chaque_Somme_Len4_Erreur;
begin
Put_Line("Tester_Exemple_Sujet");
Tester_Exemple_Sujet;
Put_Line("Tester_Supprimer_Inverse");
Tester_Supprimer_Inverse;
Put_Line("Tester_Supprimer");
Tester_Supprimer;
Put_Line("Tester_Supprimer_Un_Element");
Tester_Supprimer_Un_Element;
Put_Line("Tester_Remplacer_Un_Element");
Tester_Remplacer_Un_Element;
Put_Line("Tester_Supprimer_Erreur");
Tester_Supprimer_Erreur;
Put_Line("Tester_La_Donnee_Erreur");
Tester_La_Donnee_Erreur;
Put_Line("Tester_Pour_chaque");
Tester_Pour_chaque;
Put_Line("Tester_Pour_chaque_Somme_Si_Cle_Commence_Par_Q");
Tester_Pour_chaque_Somme_Si_Cle_Commence_Par_Q;
Put_Line("Tester_Pour_chaque_Somme_Len4_Erreur");
Tester_Pour_chaque_Somme_Len4_Erreur;
Put_Line("Fin des tests: OK.");
end Test_TH;

104
tp10/src/th.adb Executable file
View file

@ -0,0 +1,104 @@
with SDA_Exceptions; use SDA_Exceptions;
package body TH is
procedure Initialiser(SDA: in out T_TH) is
begin
for i in 1..Capacite loop
SDA(i).Libre := true;
SDA(i).Cle := Cle_init;
SDA(i).Donnee := Donnee_init;
end loop;
end Initialiser;
function Est_Vide(SDA: in T_TH) return Boolean is
begin
for i in 1..Capacite loop
if SDA(i).Libre = false then
return false;
end if;
end loop;
return true;
end Est_Vide;
function Taille(SDA: in T_TH) return Integer is
nb: Integer := 0;
begin
for i in 1..Capacite loop
if SDA(i).Libre = false then
nb := nb + 1;
end if;
end loop;
return nb;
end Taille;
procedure Enregistrer(SDA: in out T_TH; Cle: in T_Cle; Donnee: in T_Donnee) is
h: constant Integer := Hash(Cle);
begin
SDA(h).Cle := Cle;
SDA(h).Donnee := Donnee;
SDA(h).Libre := false;
end Enregistrer;
procedure Supprimer(SDA: in out T_TH; Cle: in T_Cle) is
h: constant Integer := Hash(Cle);
begin
if SDA(h).Cle /= Cle then
raise Cle_Absente_Exception;
else
SDA(h).Libre := true;
end if;
end Supprimer;
function Cle_Presente(SDA: in T_TH; Cle: in T_Cle) return Boolean is
h: constant Integer := Hash(Cle);
begin
return not SDA(h).Libre and then SDA(h).Cle = Cle;
end Cle_Presente;
function La_Donnee(SDA: in T_TH; Cle: in T_Cle) return T_Donnee is
h: constant Integer := Hash(Cle);
begin
if SDA(h).Cle /= Cle then
raise Cle_Absente_Exception;
else
return SDA(h).Donnee;
end if;
end La_Donnee;
procedure Vider(SDA: in out T_TH) is
begin
for i in 1..Capacite loop
SDA(i).Libre := true;
end loop;
end Vider;
procedure Pour_Chaque(SDA: in out T_TH) is
begin
for i in 1..Capacite loop
begin
if not SDA(i).Libre then
Traiter(SDA(i).Cle, SDA(i).Donnee);
end if;
exception
-- si il y a un problème on passe simplement au suivant
when others => null;
end;
end loop;
end Pour_Chaque;
function Premiere_Donnee(SDA: in T_TH) return T_Donnee is
begin
return SDA(1).Donnee;
end Premiere_Donnee;
end TH;

75
tp10/src/th.ads Executable file
View file

@ -0,0 +1,75 @@
generic
type T_Cle is private;
Cle_init: T_Cle;
type T_Donnee is private;
Donnee_init: T_Donnee;
Capacite: Integer;
with function Hash(Cle: in T_Cle) return Integer;
package TH is
type T_Cellule is limited private;
type T_TH is limited private;
-- Initialiser une SDA. La SDA est vide.
procedure Initialiser(SDA: in out T_TH) with
Post => Est_Vide(SDA);
-- Est-ce qu'une SDA est vide ?
function Est_Vide(SDA: in T_TH) return Boolean;
-- Obtenir le nombre d'éléments d'une SDA.
function Taille(SDA: in T_TH) return Integer with
Post => Taille'Result >= 0
and (Taille'Result = 0) = Est_Vide(SDA);
-- Enregistrer une Donnée associée à une Clé dans une SDA.
-- Si la clé est déjà présente dans la SDA, sa donnée est changée.
procedure Enregistrer(SDA: in out T_TH; Cle: in T_Cle; Donnee: in T_Donnee) with
Post => Cle_Presente(SDA, Cle)
and then (La_Donnee(SDA, Cle) = Donnee);
-- Supprimer la Donnée associée à une Clé dans une SDA.
-- Exception: Cle_Absente_Exception si Clé n'est pas utilisée dans la SDA
procedure Supprimer(SDA: in out T_TH; Cle: in T_Cle) with
Post => not Cle_Presente(SDA, Cle);
-- Savoir si une Clé est présente dans une SDA.
function Cle_Presente(SDA: in T_TH; Cle: in T_Cle) return Boolean;
-- Obtenir la donnée associée à une Cle dans la SDA.
-- Exception: Cle_Absente_Exception si Clé n'est pas utilisée dans l'SDA
function La_Donnee(SDA: in T_TH; Cle: in T_Cle) return T_Donnee;
-- Supprimer tous les éléments d'une SDA.
procedure Vider(SDA: in out T_TH) with
Post => Est_Vide(SDA);
-- Appliquer un traitement (Traiter) pour chaque couple d'une SDA.
generic
with procedure Traiter(Cle: in out T_Cle; Donnee: in out T_Donnee);
procedure Pour_Chaque(SDA: in out T_TH);
function Premiere_Donnee(SDA: in T_TH) return T_Donnee;
private
type T_Cellule is
record
Cle: T_Cle;
Donnee: T_Donnee;
Libre: Boolean;
end record;
type T_TH is array (1..Capacite) of T_Cellule;
end TH;

54
tp10/src/th_sujet.adb Executable file
View file

@ -0,0 +1,54 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with TH;
-- Procédure qui illustre l'utilisation du paquetage LCA.
procedure TH_Sujet is
Capacite: constant Integer := 11;
function fonction_hachage(S: in Unbounded_String) return Integer is
begin
return Length(S) mod Capacite + 1;
end fonction_hachage;
package TH_String_Integer is
new TH(T_Cle => Unbounded_String, Cle_init => To_Unbounded_String(""),
T_Donnee => Integer, Donnee_init => 0,
Capacite => Capacite,
Hash => fonction_hachage);
use TH_String_Integer;
procedure Formatage(S: in out Unbounded_String ; N: in out Integer) is
begin
put('"');
put(To_String(S));
put('"');
put(" : ");
put(N, 1);
new_line;
end Formatage;
procedure Afficher is
new Pour_Chaque(Formatage);
my_th: T_TH;
begin
Initialiser(my_th);
Enregistrer(my_th, To_Unbounded_String("un"), 1);
Enregistrer(my_th, To_Unbounded_String("deux"), 2);
Enregistrer(my_th, To_Unbounded_String("trois"), 3);
Enregistrer(my_th, To_Unbounded_String("quatre"), 4);
Enregistrer(my_th, To_Unbounded_String("cinq"), 5);
Enregistrer(my_th, To_Unbounded_String("quatre-vingt-dix-neuf"), 99);
Enregistrer(my_th, To_Unbounded_String("vingt-et-un"), 21);
Afficher(my_th);
put_line("OK");
end TH_Sujet;

BIN
tp10/sujet.pdf Executable file

Binary file not shown.

8
tp_gps/premier_programme.adb Executable file
View file

@ -0,0 +1,8 @@
with Text_IO;
use Text_IO;
-- Programme minimal qui affiche juste un message.
procedure Premier_Programme in
begin
Put_Line ("Bravo ! Vous avez réussi à exécuter le programme.");
end Premier_Programme.

127
tp_gps/specifier_et_tester.adb Executable file
View file

@ -0,0 +1,127 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Specifier_Et_Tester is
-- Calculer le plus grand commun diviseur de deux entiers strictement
-- positifs.
-- Paramètres :
-- A : in Entier
-- B : in Entier
-- Retour : Entier -- le pgcd de A et B
-- Nécessite :
-- A > 0
-- B > 0
-- Assure :
-- Pgcd'Result >= 1
-- A mod Pgcd'Résultat = 0 -- le pgcd divise A
-- B mod Pgcd'Résultat = 0 -- le pgcd divise B
-- -- c'est le plus grand des entiers qui divisent A et B
-- // mais on ne sait pas l'exprimer simplement
-- Exemples : voir Tester_Pgcd
-- Efficacité : faible car on utilise une version naïve de l'algorithme
-- d'Euclide.
function Pgcd (A, B : in Integer) return Integer with
Pre => A > 0 and B > 0,
Post => Pgcd'Result >= 1
and A mod Pgcd'Result = 0 -- Le Pgcd divise A
and B mod Pgcd'Result = 0 -- Le Pgcd divise B
is
L_A, L_B: Integer; -- variables correspondant à A et B
-- A et B étant en in, on ne peut pas les modifier dans la
-- fonction. Or pour appliquer l'algortihme d'Euclide, il faut
-- retrancher le plus petit au plus grand jusqu'à avoir deux
-- nombres égaux. Nous passons donc par des variables locales et
-- utilisons le nom des paramètres formels préfixés par 'L_'.
begin
L_A := A;
L_B := B;
while L_A /= L_B loop
-- soustraire au plus grand le plus petit
if L_A > L_B then
L_A := L_A - L_B;
else
L_B := L_B - L_A;
end if;
end loop;
pragma Assert (L_A = L_B); -- la condition de sortie de boucle.
return L_A;
end Pgcd;
-- Exemple d'utilisation du Pgcd.
-- Est-ce que le corps de cette procédure est correct ? Pourquoi ?
-- Que donne son exécution ?
procedure Utiliser_Pgcd is
Resultat: Integer;
begin
Resultat := Pgcd (0, 10);
Put ("Pgcd (0, 10) = ");
Put (Resultat, 1);
New_Line;
end Utiliser_Pgcd;
-- Permuter deux entiers.
-- Paramètres :
-- A, B : in out Entier -- les deux entiers à permuter
-- Nécessite : Néant
-- Assure :
-- A = B'Avant et B = A'Avant -- les valeurs de A et B sont bien permutées
procedure Permuter (A, B: in out Integer) with
Post => A = B'Old and B = A'Old
is
Copie_A : Integer;
begin
Copie_A := A;
A := B;
B := Copie_A;
end Permuter;
-- Procédure de test de Pgcd.
-- -- Parce que c'est une procédure de test, elle n'a pas de paramètre,
-- -- pas de type de retour, pas de précondition, pas de postcondition.
procedure Tester_Pgcd is
begin
pragma Assert (4 = Pgcd (4, 4)); -- A = B
pragma Assert (2 = Pgcd (10, 16)); -- A < B
pragma Assert (1 = Pgcd (21, 10)); -- A > B
pragma Assert (3 = Pgcd (105, 147)); -- un autre
end Tester_Pgcd;
-- Procédure de test pour mettre en évidence la faible efficacité de Pgcd.
procedure Tester_Performance_Pgcd is
begin
pragma Assert (1 = Pgcd (1, 10 ** 9)); -- lent !
end Tester_Performance_Pgcd;
-- Procédure de test de Permuter.
procedure Tester_Permuter is
N1, N2: Integer;
begin
-- initialiser les données du test
N1 := 5;
N2 := 18;
-- lancer la procédure à tester
Permuter (N1, N2);
-- contrôler que la procédure a eu l'effet escompté
pragma Assert (18 = N1);
pragma Assert (5 = N2);
end Tester_Permuter;
begin
Utiliser_Pgcd;
-- lancer les programmes de test.
Tester_Pgcd;
Tester_Performance_Pgcd;
Tester_Permuter;
Put_Line ("Fini.");
end Specifier_Et_Tester;

18
tp_gps/tp_gps.gpr Executable file
View file

@ -0,0 +1,18 @@
project TP_GPS is
for Main use ("premier_programme.adb", "specifier_et_tester.adb");
package Builder is
for Default_Switches ("ada") use ("-s");
end Builder;
package Compiler is
for Default_Switches ("ada") use ("-gnatwa");
end Compiler;
package Binder is
for Default_Switches ("ada") use ("-E");
end Binder;
end TP_GPS;

3
tp_svn/texte.txt Executable file
View file

@ -0,0 +1,3 @@
Ceci est un texte.
Il n'a pas de signification.
C'est juste un exemple.