subprogram_declaration ::= subprogram_specification;
abstract_subprogram_declaration ::= subprogram_specification is abstract;
subprogram_specification ::= procedure defining_program_unit_name parameter_profile | function defining_designator parameter_and_result_profile
designator ::= [parent_unit_name . ]identifier | operator_symbol
defining_designator ::= defining_program_unit_name | defining_operator_symbol
defining_program_unit_name ::= [parent_unit_name . ]defining_identifier
operator_symbol ::= string_literal
defining_operator_symbol ::= operator_symbol
parameter_profile ::= [formal_part]
parameter_and_result_profile ::= [formal_part] return subtype_mark
formal_part ::= (parameter_specification {; parameter_specification{)
parameter_specification ::= defining_identifier_list : mode subtype_mark [:= default_expression] | defining_identifier_list : access_definition [:= default_expression]
mode ::= [in] | in out | outName Resolution Rules
procedure Traverse_Tree; procedure Increment(X : in out Integer); procedure Right_Indent(Margin : out Line_Size); -- see section Integer Types procedure Switch(From, To : in out Link); -- see section Incomplete Type Declarations
function Random return Probability; -- see section Floating Point Types
function Min_Cell(X : Link) return Cell; -- see section Incomplete Type Declarations function Next_Frame(K : Positive) return Frame; -- see section Access Types function Dot_Product(Left, Right : Vector) return Real; -- see section Array Types
function "*"(Left, Right : Matrix) return Matrix; -- see section Array Types
procedure Print_Header (Pages : in Natural; Header : in Line := (1 .. Line'Last => ' '); -- see section Array Types Center : in Boolean := True);
subprogram_body ::= subprogram_specification is declarative_part begin handled_sequence_of_statements end [designator];
Legality Rules
procedure Push(E : in Element_Type; S : in out Stack) is begin if S.Index = S.Size then raise Stack_Overflow; else S.Index := S.Index + 1; S.Space(S.Index) := E; end if; end Push;
function Dot_Product(Left, Right : Vector) return Real is Sum : Real := 0.0; begin Check(Left'First = Right'First and Left'Last = Right'Last); for J in Left'Range loop Sum := Sum + Left(J)*Right(J); end loop; return Sum; end Dot_Product;
pragma Inline(name {, name{);Legality Rules
procedure_call_statement ::= procedure_name; | procedure_prefix actual_parameter_part;
function_call ::= function_name | function_prefix actual_parameter_part
actual_parameter_part ::= (parameter_association {, parameter_association{)
parameter_association ::= [formal_parameter_selector_name =>] explicit_actual_parameter
explicit_actual_parameter ::= expression | variable_name
Name Resolution Rules
Traverse_Tree; -- see section Subprogram Declarations Print_Header(128, Title, True); -- see section Subprogram Declarations
Switch(From => X, To => Next); -- see section Subprogram Declarations. Print_Header(128, Header => Title, Center => True); -- see section Subprogram Declarations. Print_Header(Header => Title, Center => True, Pages => 128); -- see section Subprogram Declarations.
Dot_Product(U, V) -- see section Subprogram Declarations, and section Subprogram Bodies. Clock -- see section Delay Statements, Duration, and Time. F.all -- presuming F is of an access-to-subprogram type -- see section Access Types.
procedure Activate(Process : in Process_Name; After : in Process_Name := No_Process; Wait : in Duration := 0.0; Prior : in Boolean := False);
procedure Pair(Left, Right : in Person_Name := new Person); -- see section Incomplete Type Declarations.
Activate(X); Activate(X, After => Y); Activate(X, Wait => 60.0, Prior => True); Activate(X, Y, 10.0, False);
Pair; Pair(Left => new Person, Right => new Person);NOTES
procedure Put(X : in Integer); procedure Put(X : in String);
procedure Set(Tint : in Color); procedure Set(Signal : in Light);
Put(28); Put("no possible ambiguity here");
Set(Tint => Red); Set(Signal => Red); Set(Color'(Red));
-- Set(Red) would be ambiguous since Red may -- denote a value either of type Color or of type Light
return_statement ::= return [expression];Name Resolution Rules
return; -- in a procedure body, entry_body, or accept_statement return Key_Value(Last_Index); -- in a function body
function "+" (Left, Right : Matrix) return Matrix; function "+" (Left, Right : Vector) return Vector; -- assuming that A, B, and C are of the type Vector -- the following two statements are equivalent: A := B + C; A := "+"(B, C);
Go to the first, previous, next, last section, table of contents.