1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>AARM95 - Entries and Accept Statements</TITLE>
<META NAME="Author" CONTENT="JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor">
<META NAME="GENERATOR" CONTENT="Arm_Form.Exe, Ada Reference Manual generator">
<STYLE type="text/css">
DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; left: 0.5 em; top: auto}
TT {font-family: "Courier New", monospace}
DT {display: compact}
DIV.Normal {font-family: "Times New Roman", Times, serif; margin-bottom: 0.6em}
DIV.Wide {font-family: "Times New Roman", Times, serif; margin-top: 0.6em; margin-bottom: 0.6em}
DIV.Annotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
DIV.WideAnnotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0.6em; margin-bottom: 0.6em}
DIV.Index {font-family: "Times New Roman", Times, serif}
DIV.SyntaxSummary {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
DIV.Notes {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.6em}
DIV.NotesHeader {font-family: "Times New Roman", Times, serif; margin-left: 2.0em}
DIV.SyntaxIndented {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
DIV.Indented {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-bottom: 0.6em}
DIV.CodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
DIV.SmallIndented {font-family: "Times New Roman", Times, serif; margin-left: 10.0em; margin-bottom: 0.6em}
DIV.SmallCodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-bottom: 0.6em}
DIV.Examples {font-family: "Courier New", monospace; margin-left: 2.0em; margin-bottom: 0.6em}
DIV.SmallExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 7.5em; margin-bottom: 0.6em}
DIV.IndentedExamples {font-family: "Courier New", monospace; margin-left: 8.0em; margin-bottom: 0.6em}
DIV.SmallIndentedExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 15.0em; margin-bottom: 0.6em}
UL.Bulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.SmallBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.NestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.SmallNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.IndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.CodeIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.CodeIndentedNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.SyntaxIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.NotesBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.NotesNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
DL.Hanging {font-family: "Times New Roman", Times, serif; margin-top: 0em; margin-bottom: 0.6em}
DD.Hanging {margin-left: 6.0em}
DL.IndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
DD.IndentedHanging {margin-left: 2.0em}
DL.HangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.HangingInBulleted {margin-left: 4.0em}
DL.SmallHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
DD.SmallHanging {margin-left: 7.5em}
DL.SmallIndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-top: 0em; margin-bottom: 0.6em}
DD.SmallIndentedHanging {margin-left: 2.0em}
DL.SmallHangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.SmallHangingInBulleted {margin-left: 5.0em}
DL.Enumerated {font-family: "Times New Roman", Times, serif; margin-right: 0.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.Enumerated {margin-left: 2.0em}
DL.SmallEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.SmallEnumerated {margin-left: 2.5em}
DL.NestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
DL.SmallNestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
</STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFF0" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<P><A HREF="AA-TOC.html">Contents</A> <A HREF="AA-0-29.html">Index</A> <A HREF="AA-9-5-1.html">Previous</A> <A HREF="AA-9-5-3.html">Next</A></P>
<HR>
<H1> 9.5.2 Entries and Accept Statements</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal"> <FONT FACE="Arial, Helvetica">Entry_declaration</FONT>s,
with the corresponding <FONT FACE="Arial, Helvetica">entry_bodies</FONT>
or <FONT FACE="Arial, Helvetica">accept_statement</FONT>s, are used to
define potentially queued operations on tasks and protected objects.
</DIV>
<H4 ALIGN=CENTER>Syntax</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">entry_declaration<A NAME="I3597"></A>
::= </FONT><BR>
<B>entry</B> <A NAME="I3598"></A><FONT FACE="Arial, Helvetica">defining_identifier</FONT> [(<A NAME="I3599"></A><FONT FACE="Arial, Helvetica">discrete_subtype_definition</FONT>)] <A NAME="I3600"></A><FONT FACE="Arial, Helvetica">parameter_profile</FONT>;</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">accept_statement<A NAME="I3601"></A>
::= </FONT><BR>
<B>accept</B> <I>entry_</I><A NAME="I3602"></A><FONT FACE="Arial, Helvetica">direct_name</FONT> [(<A NAME="I3603"></A><FONT FACE="Arial, Helvetica">entry_index</FONT>)] <A NAME="I3604"></A><FONT FACE="Arial, Helvetica">parameter_profile</FONT> [<B>do</B><BR>
<A NAME="I3605"></A><FONT FACE="Arial, Helvetica">handled_sequence_of_statements</FONT><BR>
<B>end</B> [<I>entry_</I><A NAME="I3606"></A><FONT FACE="Arial, Helvetica">identifier</FONT>]];</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>We cannot use <FONT FACE="Arial, Helvetica">defining_identifier</FONT>
for <FONT FACE="Arial, Helvetica">accept_statement</FONT>s. Although
an <FONT FACE="Arial, Helvetica">accept_statement</FONT> is sort of like
a body, it can appear nested within a <FONT FACE="Arial, Helvetica">block_statement</FONT>,
and therefore be hidden from its own entry by an outer homograph. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">entry_index<A NAME="I3607"></A>
::= </FONT><A NAME="I3608"></A><FONT FACE="Arial, Helvetica">expression</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">entry_body<A NAME="I3609"></A>
::= </FONT><BR>
<B>entry</B> <A NAME="I3610"></A><FONT FACE="Arial, Helvetica">defining_identifier</FONT> <A NAME="I3611"></A><FONT FACE="Arial, Helvetica">entry_body_formal_part</FONT> <A NAME="I3612"></A><FONT FACE="Arial, Helvetica">entry_barrier</FONT> <B>is</B><BR>
<A NAME="I3613"></A><FONT FACE="Arial, Helvetica">declarative_part</FONT><BR>
<B>begin</B><BR>
<A NAME="I3614"></A><FONT FACE="Arial, Helvetica">handled_sequence_of_statements</FONT><BR>
<B>end</B> [<I>entry_</I><A NAME="I3615"></A><FONT FACE="Arial, Helvetica">identifier</FONT>];</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">entry_body_formal_part<A NAME="I3616"></A>
::= </FONT>[(<A NAME="I3617"></A><FONT FACE="Arial, Helvetica">entry_index_specification</FONT>)] <A NAME="I3618"></A><FONT FACE="Arial, Helvetica">parameter_profile</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">entry_barrier<A NAME="I3619"></A>
::= </FONT><B>when</B> <A NAME="I3620"></A><FONT FACE="Arial, Helvetica">condition</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">entry_index_specification<A NAME="I3621"></A>
::= </FONT><B>for</B> <A NAME="I3622"></A><FONT FACE="Arial, Helvetica">defining_identifier</FONT> <B>in</B> <A NAME="I3623"></A><FONT FACE="Arial, Helvetica">discrete_subtype_definition</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<DIV Class="SyntaxIndented">If an <I>entry_</I><FONT FACE="Arial, Helvetica">identifier</FONT>
appears at the end of an <FONT FACE="Arial, Helvetica">accept_statement</FONT>,
it shall repeat the <I>entry_</I><FONT FACE="Arial, Helvetica">direct_name</FONT>.
If an <I>entry_</I><FONT FACE="Arial, Helvetica">identifier</FONT> appears
at the end of an <FONT FACE="Arial, Helvetica">entry_body</FONT>, it
shall repeat the <FONT FACE="Arial, Helvetica">defining_identifier</FONT>.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<DIV Class="SyntaxIndented">[An <FONT FACE="Arial, Helvetica">entry_declaration</FONT>
is allowed only in a protected or task declaration.] </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Proof: </B>This follows from
the BNF. </FONT></DIV>
<H4 ALIGN=CENTER>Name Resolution Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<DIV Class="Normal"> <A NAME="I3624"></A>In an <FONT FACE="Arial, Helvetica">accept_statement</FONT>,
the expected profile for the <I>entry_</I><FONT FACE="Arial, Helvetica">direct_name</FONT>
is that of the <FONT FACE="Arial, Helvetica">entry_declaration</FONT>;
<A NAME="I3625"></A>the expected type for an <FONT FACE="Arial, Helvetica">entry_index</FONT>
is that of the subtype defined by the <FONT FACE="Arial, Helvetica">discrete_subtype_definition</FONT>
of the corresponding <FONT FACE="Arial, Helvetica">entry_declaration</FONT>.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DIV Class="Normal"> Within the <FONT FACE="Arial, Helvetica">handled_sequence_of_statements</FONT>
of an <FONT FACE="Arial, Helvetica">accept_statement</FONT>, if a <FONT FACE="Arial, Helvetica">selected_component</FONT>
has a <FONT FACE="Arial, Helvetica">prefix</FONT> that denotes the corresponding
<FONT FACE="Arial, Helvetica">entry_declaration</FONT>, then the entity
denoted by the <FONT FACE="Arial, Helvetica">prefix</FONT> is the <FONT FACE="Arial, Helvetica">accept_statement</FONT>,
and the <FONT FACE="Arial, Helvetica">selected_component</FONT> is interpreted
as an expanded name (see <A HREF="AA-4-1-3.html">4.1.3</A>)[; the <FONT FACE="Arial, Helvetica">selector_name</FONT>
of the <FONT FACE="Arial, Helvetica">selected_component</FONT> has to
be the <FONT FACE="Arial, Helvetica">identifier</FONT> for some formal
parameter of the <FONT FACE="Arial, Helvetica">accept_statement</FONT>].
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>12.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Proof: </B>The only declarations
that occur immediately within the declarative region of an <FONT FACE="Arial, Helvetica">accept_statement</FONT>
are those for its formal parameters. </FONT></DIV>
<H4 ALIGN=CENTER>Legality Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<DIV Class="Normal"> An <FONT FACE="Arial, Helvetica">entry_declaration</FONT>
in a task declaration shall not contain a specification for an access
parameter (see <A HREF="AA-3-10.html">3.10</A>). </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13.a</FONT></DIV>
<DIV Class="Annotations" Style="margin-bottom: 0.4em"><FONT SIZE=-1><B>Reason:
</B>Access parameters for task entries would require a complex implementation.
For example: </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13.b</FONT></DIV>
<DIV Class="SmallExamples"><TT><B>task</B> T <B>is</B><BR>
<B>entry</B> E(Z : <B>access</B> Integer); --<I> Illegal!</I><BR>
<B>end</B> T;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13.c</FONT></DIV>
<DIV Class="SmallExamples"><TT><B>task body</B> T <B>is</B><BR>
<B>begin</B><BR>
<B>declare</B><BR>
<B>type</B> A <B>is access all</B> Integer;<BR>
X : A;<BR>
Int : <B>aliased</B> Integer;<BR>
<B>task</B> Inner;<BR>
<B>task body</B> Inner <B>is</B><BR>
<B>begin</B><BR>
T.E(Int'Access);<BR>
<B>end</B> Inner;<BR>
<B>begin</B><BR>
<B>accept</B> E(Z : <B>access</B> Integer) <B>do</B><BR>
X := A(Z); -- Accessibility_Check<BR>
<B>end</B> E;<BR>
<B>end</B>;<BR>
<B>end</B> T;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13.d</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Implementing the Accessibility_Check
inside the <FONT FACE="Arial, Helvetica">accept_statement</FONT> for
E is difficult, since one does not know whether the entry caller is calling
from inside the immediately enclosing declare block or from outside it.
This means that the lexical nesting level associated with the designated
object is not sufficient to determine whether the Accessibility_Check
should pass or fail.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13.e</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Note that such problems do not
arise with protected entries, because <FONT FACE="Arial, Helvetica">entry_bodies</FONT>
are always nested immediately within the <FONT FACE="Arial, Helvetica">protected_body</FONT>;
they cannot be further nested as can <FONT FACE="Arial, Helvetica">accept_statement</FONT>s,
nor can they be called from within the <FONT FACE="Arial, Helvetica">protected_body</FONT>
(since no entry calls are permitted inside a <FONT FACE="Arial, Helvetica">protected_body</FONT>).
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<DIV Class="Normal"> For an <FONT FACE="Arial, Helvetica">accept_statement</FONT>,
the innermost enclosing body shall be a <FONT FACE="Arial, Helvetica">task_body</FONT>,
and the <I>entry_</I><FONT FACE="Arial, Helvetica">direct_name</FONT>
shall denote an <FONT FACE="Arial, Helvetica">entry_declaration</FONT>
in the corresponding task declaration; the profile of the <FONT FACE="Arial, Helvetica">accept_statement</FONT>
shall conform fully to that of the corresponding <FONT FACE="Arial, Helvetica">entry_declaration</FONT>.
<A NAME="I3626"></A>An <FONT FACE="Arial, Helvetica">accept_statement</FONT>
shall have a parenthesized <FONT FACE="Arial, Helvetica">entry_index</FONT>
if and only if the corresponding <FONT FACE="Arial, Helvetica">entry_declaration</FONT>
has a <FONT FACE="Arial, Helvetica">discrete_subtype_definition</FONT>.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<DIV Class="Normal"> An <FONT FACE="Arial, Helvetica">accept_statement</FONT>
shall not be within another <FONT FACE="Arial, Helvetica">accept_statement</FONT>
that corresponds to the same <FONT FACE="Arial, Helvetica">entry_declaration</FONT>,
nor within an <FONT FACE="Arial, Helvetica">asynchronous_select</FONT>
inner to the enclosing <FONT FACE="Arial, Helvetica">task_body</FONT>.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B><FONT FACE="Arial, Helvetica">Accept_statement</FONT>s
are required to be immediately within the enclosing <FONT FACE="Arial, Helvetica">task_body</FONT>
(as opposed to being in a nested subprogram) to ensure that a nested
task does not attempt to accept the entry of its enclosing task. We considered
relaxing this restriction, either by making the check a run-time check,
or by allowing a nested task to accept an entry of its enclosing task.
However, neither change seemed to provide sufficient benefit to justify
the additional implementation burden.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Nested <FONT FACE="Arial, Helvetica">accept_statement</FONT>s
for the same entry (or entry family) are prohibited to ensure that there
is no ambiguity in the resolution of an expanded name for a formal parameter
of the entry. This could be relaxed by allowing the inner one to hide
the outer one from all visibility, but again the small added benefit
didn't seem to justify making the change for Ada 95.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><FONT FACE="Arial, Helvetica">Accept_statement</FONT>s
are not permitted within <FONT FACE="Arial, Helvetica">asynchronous_select</FONT>
statements to simplify the semantics and implementation: an <FONT FACE="Arial, Helvetica">accept_statement</FONT>
in an <FONT FACE="Arial, Helvetica">abortable_part</FONT> could result
in Tasking_Error being propagated from an entry call even though the
target task was still callable; implementations that use multiple tasks
implicitly to implement an <FONT FACE="Arial, Helvetica">asynchronous_select</FONT>
might have trouble supporting "up-level" accepts. Furthermore,
if <FONT FACE="Arial, Helvetica">accept_statement</FONT>s were permitted
in the <FONT FACE="Arial, Helvetica">abortable_part</FONT>, a task could
call its own entry and then accept it in the <FONT FACE="Arial, Helvetica">abortable_part</FONT>,
leading to rather unusual and possibly difficult-to-specify semantics.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<DIV Class="Normal"> <A NAME="I3627"></A>An <FONT FACE="Arial, Helvetica">entry_declaration</FONT>
of a protected unit requires a completion[, which shall be an <FONT FACE="Arial, Helvetica">entry_body</FONT>,]
<A NAME="I3628"></A>and every <FONT FACE="Arial, Helvetica">entry_body</FONT>
shall be the completion of an <FONT FACE="Arial, Helvetica">entry_declaration</FONT>
of a protected unit. <A NAME="I3629"></A>The profile of the <FONT FACE="Arial, Helvetica">entry_body</FONT>
shall conform fully to that of the corresponding declaration. <A NAME="I3630"></A></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>16.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>An <FONT FACE="Arial, Helvetica">entry_declaration</FONT>,
unlike a <FONT FACE="Arial, Helvetica">subprogram_declaration</FONT>,
cannot be completed with a <FONT FACE="Arial, Helvetica">renaming_declaration</FONT>.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>16.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>To be honest: </B>The completion
can be a <FONT FACE="Arial, Helvetica">pragma</FONT> Import, if the implementation
supports it. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>16.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>The above applies
only to protected entries, which are the only ones completed with <FONT FACE="Arial, Helvetica">entry_bodies</FONT>.
Task entries have corresponding <FONT FACE="Arial, Helvetica">accept_statements</FONT>
instead of having <FONT FACE="Arial, Helvetica">entry_bodies</FONT>,
and we do not consider an <FONT FACE="Arial, Helvetica">accept_statement</FONT>
to be a ``completion,'' because a task <FONT FACE="Arial, Helvetica">entry_declaration</FONT>
is allowed to have zero, one, or more than one corresponding <FONT FACE="Arial, Helvetica">accept_statement</FONT>s.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<DIV Class="Normal"> An <FONT FACE="Arial, Helvetica">entry_body_formal_part</FONT>
shall have an <FONT FACE="Arial, Helvetica">entry_index_specification</FONT>
if and only if the corresponding <FONT FACE="Arial, Helvetica">entry_declaration</FONT>
has a <FONT FACE="Arial, Helvetica">discrete_subtype_definition</FONT>.
In this case, the <FONT FACE="Arial, Helvetica">discrete_subtype_definition</FONT>s
of the <FONT FACE="Arial, Helvetica">entry_declaration</FONT> and the
<FONT FACE="Arial, Helvetica">entry_index_specification</FONT> shall
fully conform to one another (see <A HREF="AA-6-3-1.html">6.3.1</A>).
<A NAME="I3631"></A></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<DIV Class="Normal"> A name that denotes a formal parameter of an
<FONT FACE="Arial, Helvetica">entry_body</FONT> is not allowed within
the <FONT FACE="Arial, Helvetica">entry_barrier</FONT> of the <FONT FACE="Arial, Helvetica">entry_body</FONT>.</DIV>
<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<DIV Class="Normal"> The parameter modes defined for parameters in
the <FONT FACE="Arial, Helvetica">parameter_profile</FONT> of an <FONT FACE="Arial, Helvetica">entry_declaration</FONT>
are the same as for a <FONT FACE="Arial, Helvetica">subprogram_declaration</FONT>
and have the same meaning (see <A HREF="AA-6-2.html">6.2</A>). </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>19.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>Note that access
parameters are not allowed for task entries (see above). </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<DIV Class="Normal"> <A NAME="I3632"></A><A NAME="I3633"></A><A NAME="I3634"></A>An
<FONT FACE="Arial, Helvetica">entry_declaration</FONT> with a <FONT FACE="Arial, Helvetica">discrete_subtype_definition</FONT>
(see <A HREF="AA-3-6.html">3.6</A>) declares a <I>family</I> of distinct
entries having the same profile, with one such entry for each value of
the <I>entry index subtype</I> defined by the <FONT FACE="Arial, Helvetica">discrete_subtype_definition</FONT>.
[A name for an entry of a family takes the form of an <FONT FACE="Arial, Helvetica">indexed_component</FONT>,
where the <FONT FACE="Arial, Helvetica">prefix</FONT> denotes the <FONT FACE="Arial, Helvetica">entry_declaration</FONT>
for the family, and the index value identifies the entry within the family.]
<A NAME="I3635"></A><A NAME="I3636"></A>The term <I>single entry</I>
is used to refer to any entry other than an entry of an entry family.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<DIV Class="Normal"> In the <FONT FACE="Arial, Helvetica">entry_body</FONT>
for an entry family, the <FONT FACE="Arial, Helvetica">entry_index_specification</FONT>
declares a named constant whose subtype is the entry index subtype defined
by the corresponding <FONT FACE="Arial, Helvetica">entry_declaration</FONT>;
<A NAME="I3637"></A>the value of the <I>named entry index</I> identifies
which entry of the family was called. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>21.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>The <FONT FACE="Arial, Helvetica">discrete_subtype_definition</FONT>
of the <FONT FACE="Arial, Helvetica">entry_index_specification</FONT>
is not elaborated; the subtype of the named constant declared is defined
by the <FONT FACE="Arial, Helvetica">discrete_subtype_definition</FONT>
of the corresponding <FONT FACE="Arial, Helvetica">entry_declaration</FONT>,
which is elaborated, either when the type is declared, or when the object
is created, if its constraint is per-object. </FONT></DIV>
<H4 ALIGN=CENTER>Dynamic Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>22/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0002">8652/0002</A></I>}
<A NAME="I3638"></A><U>The elaboration of an <FONT FACE="Arial, Helvetica">entry_declaration</FONT>
for an entry family consists of the elaboration of the <FONT FACE="Arial, Helvetica">discrete_subtype_definition</FONT>,
as described in <A HREF="AA-3-8.html">3.8</A>.</U><S>For the elaboration
of an <FONT FACE="Arial, Helvetica">entry_declaration</FONT> for an entry
family, if the <FONT FACE="Arial, Helvetica">discrete_subtype_definition</FONT>
contains no per-object expressions (see <A HREF="AA-3-8.html">3.8</A>),
then the <FONT FACE="Arial, Helvetica">discrete_subtype_definition</FONT>
is elaborated. Otherwise, the elaboration of the <FONT FACE="Arial, Helvetica">entry_declaration</FONT>
consists of the evaluation of any expression of the <FONT FACE="Arial, Helvetica">discrete_subtype_definition</FONT>
that is not a per-object expression (or part of one).</S> The elaboration
of an <FONT FACE="Arial, Helvetica">entry_declaration</FONT> for a single
entry has no effect. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>22.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>The elaboration
of the declaration of a protected subprogram has no effect, as specified
in clause <A HREF="AA-6-1.html">6.1</A>. The default initialization of
an object of a task or protected type is covered in <A HREF="AA-3-3-1.html">3.3.1</A>.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<DIV Class="Normal"> [The actions to be performed when an entry is
called are specified by the corresponding <FONT FACE="Arial, Helvetica">accept_statement</FONT>s
(if any) for an entry of a task unit, and by the corresponding <FONT FACE="Arial, Helvetica">entry_body</FONT>
for an entry of a protected unit.]</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<DIV Class="Normal"> <A NAME="I3639"></A>For the execution of an <FONT FACE="Arial, Helvetica">accept_statement</FONT>,
the <FONT FACE="Arial, Helvetica">entry_index</FONT>, if any, is first
evaluated and converted to the entry index subtype; this index value
identifies which entry of the family is to be accepted. <A NAME="I3640"></A><A NAME="I3641"></A><A NAME="I3642"></A>Further
execution of the <FONT FACE="Arial, Helvetica">accept_statement</FONT>
is then blocked until a caller of the corresponding entry is selected
(see <A HREF="AA-9-5-3.html">9.5.3</A>), whereupon the <FONT FACE="Arial, Helvetica">handled_sequence_of_statements</FONT>,
if any, of the <FONT FACE="Arial, Helvetica">accept_statement</FONT>
is executed, with the formal parameters associated with the corresponding
actual parameters of the selected entry call. Upon completion of the
<FONT FACE="Arial, Helvetica">handled_sequence_of_statements</FONT>,
the <FONT FACE="Arial, Helvetica">accept_statement</FONT> completes and
is left. When an exception is propagated from the <FONT FACE="Arial, Helvetica">handled_sequence_of_statements</FONT>
of an <FONT FACE="Arial, Helvetica">accept_statement</FONT>, the same
exception is also raised by the execution of the corresponding <FONT FACE="Arial, Helvetica">entry_call_statement</FONT>.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>This is in
addition to propagating it to the construct containing the <FONT FACE="Arial, Helvetica">accept_statement</FONT>.
In other words, for a rendezvous, the raising splits in two, and continues
concurrently in both tasks.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The caller gets a new occurrence;
this isn't considered propagation.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Note that we say ``propagated
from the <FONT FACE="Arial, Helvetica">handled_sequence_of_statements</FONT>
of an <FONT FACE="Arial, Helvetica">accept_statement</FONT>'', not ``propagated
from an <FONT FACE="Arial, Helvetica">accept_statement</FONT>.'' The
latter would be wrong -- we don't want exceptions propagated by the <FONT FACE="Arial, Helvetica">entry_index</FONT>
to be sent to the caller (there is none yet!). </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>25</FONT></DIV>
<DIV Class="Normal"> <A NAME="I3643"></A>The above interaction between
a calling task and an accepting task is called a <I>rendezvous</I>. [After
a rendezvous, the two tasks continue their execution independently.]</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>26</FONT></DIV>
<DIV Class="Normal"> [An <FONT FACE="Arial, Helvetica">entry_body</FONT>
is executed when the <FONT FACE="Arial, Helvetica">condition</FONT> of
the <FONT FACE="Arial, Helvetica">entry_barrier</FONT> evaluates to True
and a caller of the corresponding single entry, or entry of the corresponding
entry family, has been selected (see <A HREF="AA-9-5-3.html">9.5.3</A>).]
<A NAME="I3644"></A>For the execution of the <FONT FACE="Arial, Helvetica">entry_body</FONT>,
the <FONT FACE="Arial, Helvetica">declarative_part</FONT> of the <FONT FACE="Arial, Helvetica">entry_body</FONT>
is elaborated, and the <FONT FACE="Arial, Helvetica">handled_sequence_of_statements</FONT>
of the body is executed, as for the execution of a <FONT FACE="Arial, Helvetica">subprogram_body</FONT>.
The value of the named entry index, if any, is determined by the value
of the entry index specified in the <I>entry_</I><FONT FACE="Arial, Helvetica">name</FONT>
of the selected entry call (or intermediate <FONT FACE="Arial, Helvetica">requeue_statement</FONT>
-- see <A HREF="AA-9-5-4.html">9.5.4</A>). </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>26.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>To be honest: </B>If the entry
had been renamed as a subprogram, and the call was a <FONT FACE="Arial, Helvetica">procedure_call_statement</FONT>
using the name declared by the renaming, the entry index (if any) comes
from the entry <FONT FACE="Arial, Helvetica">name</FONT> specified in
the <FONT FACE="Arial, Helvetica">subprogram_renaming_declaration</FONT>.
</FONT></DIV>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>27</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>22 A task entry has corresponding
accept_statements (zero or more), whereas a protected entry has a corresponding
entry_body (exactly one).</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>28</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>23 A consequence of the rule
regarding the allowed placements of <FONT FACE="Arial, Helvetica">accept_statement</FONT>s
is that a task can execute <FONT FACE="Arial, Helvetica">accept_statement</FONT>s
only for its own entries.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>29</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>24 A <FONT FACE="Arial, Helvetica">return_statement</FONT>
(see <A HREF="AA-6-5.html">6.5</A>) or a <FONT FACE="Arial, Helvetica">requeue_statement</FONT>
(see <A HREF="AA-9-5-4.html">9.5.4</A>) may be used to complete the execution
of an <FONT FACE="Arial, Helvetica">accept_statement</FONT> or an <FONT FACE="Arial, Helvetica">entry_body</FONT>.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>29.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>An <FONT FACE="Arial, Helvetica">accept_statement</FONT>
need not have a <FONT FACE="Arial, Helvetica">handled_sequence_of_statements</FONT>
even if the corresponding entry has parameters. Equally, it can have
a <FONT FACE="Arial, Helvetica">handled_sequence_of_statements</FONT>
even if the corresponding entry has no parameters. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>29.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>A single
entry overloads a subprogram, an enumeration literal, or another single
entry if they have the same <FONT FACE="Arial, Helvetica">defining_identifier</FONT>.
Overloading is not allowed for entry family names. A single entry or
an entry of an entry family can be renamed as a procedure as explained
in <A HREF="AA-8-5-4.html">8.5.4</A>. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>30</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>25 The <FONT FACE="Arial, Helvetica">condition</FONT>
in the <FONT FACE="Arial, Helvetica">entry_barrier</FONT> may reference
anything visible except the formal parameters of the entry. This includes
the entry index (if any), the components (including discriminants) of
the protected object, the Count attribute of an entry of that protected
object, and data global to the protected unit.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>31</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>The restriction against referencing
the formal parameters within an <FONT FACE="Arial, Helvetica">entry_barrier</FONT>
ensures that all calls of the same entry see the same barrier value.
If it is necessary to look at the parameters of an entry call before
deciding whether to handle it, the <FONT FACE="Arial, Helvetica">entry_barrier</FONT>
can be ``<B>when</B> True'' and the caller can be requeued (on some private
entry) when its parameters indicate that it cannot be handled immediately.
</FONT></DIV>
<H4 ALIGN=CENTER>Examples</H4>
<DIV Class="Paranum"><FONT SIZE=-2>32</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <I>Examples of
entry declarations:</I> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>33</FONT></DIV>
<DIV Class="Examples"><TT><B>entry</B> Read(V : <B>out</B> Item);<BR>
<B>entry</B> Seize;<BR>
<B>entry</B> Request(Level)(D : Item); <I>-- a family of entries</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>34</FONT></DIV>
<DIV Class="Wide" Style="margin-bottom: 0.4em"> <I>Examples of accept
statements:</I> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>35</FONT></DIV>
<DIV Class="Examples"><TT><B>accept</B> Shut_Down;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>36</FONT></DIV>
<DIV Class="Examples"><TT><B>accept</B> Read(V : <B>out</B> Item) <B>do</B><BR>
V := Local_Item;<BR>
<B>end</B> Read;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>37</FONT></DIV>
<DIV Class="Examples"><TT><B>accept</B> Request(Low)(D : Item) <B>do</B><BR>
...<BR>
<B>end</B> Request;</TT></DIV>
<H4 ALIGN=CENTER>Extensions to Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>37.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><A NAME="I3645"></A>The syntax
rule for <FONT FACE="Arial, Helvetica">entry_body</FONT> is new.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>37.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><FONT FACE="Arial, Helvetica">Accept_statement</FONT>s
can now have <FONT FACE="Arial, Helvetica">exception_handler</FONT>s.</FONT></DIV>
<HR>
<P><A HREF="AA-TOC.html">Contents</A> <A HREF="AA-0-29.html">Index</A> <A HREF="AA-9-5-1.html">Previous</A> <A HREF="AA-9-5-3.html">Next</A> <A HREF="AA-TTL.html">Legal</A></P>
</BODY>
</HTML>
|