Académique Documents
Professionnel Documents
Culture Documents
" !
"" # $
!
! "
!
"
"
!
# $ !
"" "
"
%&
%& "
' ( (
) "
!
!
!
!
1. Préface au lecteur sceptique
- . "( " 8 & 9 :. ; 0 &
(< =& . " (! !00 " 9 ! ) /
0 &" $ ( $ 5 >
? '/ " " " ) 0 0 $ .
$ . ' 0 @ ) . " A $(
( 5 / "# 1 '0' " 2
B $ 0 ( C- $ " " ( ( .
' ' > . $ ( D 0 ' )E " C $ .
/ . " " C+/ ," . "( $ /
/, . . ' 5 $ - 5 . "( 0
/ F $ )E / "# " & .
# # " > 00' = $ ') ./ , 5 '"
/ " . 0 '" . / , " 5 0 "
, 00 " ' " 5 ""' 5 ' ) / . / , 0
" / " ./ ," 0 "' > 00' G .
/ , H $ / " " " 0 & / .
/ , " 00 " ' 5 ' ) )) #>$ . / , H 0 " 5
0 " / 6 H = . " F . ( " B" 0.
/ " = " ./ " '/
D ' $ C
7
2. Généralités
L7 $ ' $ 6 ' $ / / , (# )
( " . #' . 4 # . '' " ' 8 0" "
' $( ' &. " $( ' 00'
5 (&'" $ . " $( E
. " "' 00 H 00 " '
)
3. Structure des fichiers de code
= . " 5 &4 0 "# 0 "# ( H #$ /
5 '0 '" 0 " 0 "# " "&& " " $
'0 ' > ) ' . ( /
0 " 1 2$ D #. 0 "# & " " #
/" . " " E ' ' & ' '" 0 " "
'" 0 " / H > " ? ' ( "# " "#
" P? 3. $ > " " $ / ,.
$( / '0' " & - . " /
+ "# , $ ( 6 5 ( "# " 0 "# . " " $ $ $
"
package Nom_Paquetage is
-- code
private
-- code
end Nom_Paquetage;
=/ 5 4 & ( ' ( $ )
-- code
end Nom_Paquetage;
O
*( " / . ' " ' $ " "
" . "Q 656 $ ' '" 5 ( ' 5 '0 & " $
= " '0 & ' ( ' ' ' ' = .
00 < " ) () " '0 &' = .
1 " 2 = .
,$ '" $ / ) . / &
4 ." $ (/ < ) '" / ) H 4
' / . (4 / . H
/ ) '" " $( 0 '0 / "# $ / )
? ,$ " / " " ' 0 " . 0 " '
0 "# $ / ) " $ H H " 0 " 5 00 )
declare
Variable : Integer := 0;
begin
Variable := Variable + 1;
end;
4.2. Conditions
L
( ' "# $ " 0 . $ / < ) ()
H ' ' .34 /903 ;+06:0
4.3. Boucles
M $ , $ / 5 > / ) . ) '
('" ' . $ 00 " < ( " ( " 4 .
' 4 0 $ 4
procedure Test is
type Heure is range 0 .. 23;
type Minute is range 0 .. 59;
H : Heure := 12;
M : Minute := 56;
begin
M := H;
H := 24;
end Test;
< & 4 & " & " / & ' ( ' ' .
$( . (' ' 00 '0> ("" " "> ) "
/ .$ " ' / " /" < & " (
. $ . / "
5.3. Attributs
declare
A : Integer := 99;
begin
Put_Line (Integer’Image (A));
A = Integer’Value (“98”);
end;
declare
Carac : Character := ‘a’;
Code_Ascii : Integer;
begin
Code_Ascii := Character’Pos (Carac);
end;
8 ) ; 8 ( > . / " / /
'' 4 "
. ) ( ) " /
' " D N ) . "(
" 5 > .$ >
" ) ( ) "" ) . $ .
. (""' 5 ) 8
' ) & ) . " A E $ "
' ' *( . ) 0' ( ) ( '" 8
"# 0 ' ) 5 ( " $ (
7
M $ , ( ^_ 5 '" 4 ) = .
$( ( ( )D 0 $ ) ( / ( " " (
" $ ( ) ' " 5 '" / )
declare
Tableau_1 : Tab_Carac (1 .. 100);
Tableau_2 : Tab_Carac (1 .. 10);
begin
Tableau_1 (1 .. 5) := Tableau_2 (1 .. 5);
Tableau_1 (26 .. 30) := Tableau_2 (6 .. 10);
end;
declare
type Type_Tableau is array (Integer range <>) of Integer;
Tableau_1 : Type_Tableau (-2 .. 43) := (others => 0);
Tableau_2 : Type_Tableau := (1, 2, 3, 4, 5, 6, 7, 8, 9);
begin
Tableau_2 := (1, 2, 3, others => 10);
end;
? , $( . 4 ""> " .
'$ ( ) " "
N 0 " ''. "' )E ( " : " .
''0' " 00 & .66
O
6. Procédures et fonctions
6.1. Forme générale
" ) 0 $( . ( 0 "
'" ' / ) ' 4 / ) $ /
" / " ' . ) "# ) 0 " . 0 H " ( ) `'
$ > " $
function "=" (Left : Jour; Right : Integer) bool operator "=" (Jour Left, int Right);
return Boolean;
L
7. Paquetages
7.1. Protection des déclarations
(/ / "# . $ ( ' )
." ( E 0 "# # "&& <4 5 $ . '
& 0 "# '" 0 " )$ . '" 0 " /' . " 8
'" 0 " '" 0 "# . /' ' ' )$
" 0 / " " ) ( 0 "# . ( 0 "# )
package Nom_Paquetage is
-- spécifications publiques
private
-- spécifications privées
end Nom_Paquetage;
-- corps
end Nom_Paquetage;
private
type Type_1 is new Integer range 1 .. 1000;
package Pere.Fils is
-- corps
end Pere.Fils;
. ". > $ 4 $ (
0 "' < " ) H > ' $ '
0 )' $ . & ( ' $ ( / 1 ) 2 B <
" < B
"' . $ ( . ( $
/ ' ( ( "
private private:
int Champ_1;
type Mon_Type is abstract tagged record char Champ_2;
Champ_1 : Integer; }
Champ_2 : Character;
end record;
7
return A;
else
return B;
end if;
end;
*( . " . ) ( $ )E >
'' " '
! " " '" ' 0 " & " = . & ' "'
H E > H E / ) ) " / )
$ " <" . - - "' H 0 @ . > &
/ ) P ) "
O
10. Exceptions
10.1. Exceptions standard
Mon_Exception : exception;
.
'" > &" ) " . ( '"
(E " / 4 1 42 ') ( ) ". ('$ / 1 " "#2 00 )
) " ! / (&" 5 ( " <903. 5 > (
" " - ( $ 4 (&" . 4 & <903 ;/90+:
'$ / " "# J " & '" ' (
begin try
Appel_De_Procedure; {
exception Appel_De_Procedure
when Exception_1 => }
Put_Line (“Erreur 1”); catch (Exception_1)
when Exception_2 => {
Put_Line (“Erreur 2”); cout << “Erreur 1” << endl;
when others => }
Put_Line (“Erreur inconnue”); catch (Exception_2)
end; {
cout << “Erreur 2” << endl;
}
catch (...)
{
cout << “Erreur inconnue” << endl;
}
. ) / &" (&" - /
(&" " . " 0 " . 00 ('" ( " /' (&"
. " +.,:0
Mon_Exception : exception;
-- code
exception
when Recu : Mon_Exception =>
Put_Line (Exception_Name (Recu)); -- Affiche le nom de l’exception.
Put_Line (Exception_Message (Recu)); -- Affiche le message donné avec l’exception.
Put_Line (Exception_Information (Recu)); -- Affichage du nom et du message
end;
L
11. Programmation concurrente et temps réel
11.1. Avertissement
11.2. Tâches
class Thread
{
void run () = 0; // Code à exécuter
void start (); // démarre le thread
}
11.3. Rendez-vous
procedure Main is
task Suite is
entry Go;
end Suite;
task body Suite is
begin
accept Go do
end Go;
Put_Line (“Suite”);
end;
begin
Put_Line (“Debut”);
Suite.Go;
end;
task Compteur is
entry Lire (Val : out Integer);
entry Incrementer;
entry Decrementer;
end task;
procedure Decrementer is
begin
Cpt = Cpt + 1;
end Decrementer;
end Compteur;
Var : Compteur;
Val : Integer;
begin
Var.Incrementer;
Var.Decrementer;
Var.Lire (Val);
end Compteur;
O : Octet;
begin
O.Poids_Forts := 10;
O.Poids_Faibles := 12;
7
' /' 3 / ( 0 "' 3F 3F C - " ( (4 $ &4 .
/4 " " H & .$ / 3F
3F " 0 $ ( D '/ . $ ( 5
E 4 ' /' C
type TA is private;
type TB1 is new TA with private;
type TB2 is new TA with private;
-- [...]
O
13. Références
13.1. Cours et ressources en ligne
13.3. Outils
13.4. Divers