Skip to main content Accessibility help
×
Hostname: page-component-7bb8b95d7b-l4ctd Total loading time: 0 Render date: 2024-09-28T13:16:16.328Z Has data issue: false hasContentIssue false

26 - The Specialized Annexes

Published online by Cambridge University Press:  05 July 2014

Get access

Summary

This chapter contains a survey of the scope of the six specialized annexes. These annexes are optional and many implementations will not support them in full. Validation of an Ada compiler will state which of the annexes, if any, is supported. A compiler which is not validated for an annex may provide partial support for that annex but if it does the material must conform to the annex.

It is a general principle that the annexes contain no new syntax but only additional packages, attributes, aspects and pragmas. They are thus not intrinsically hard to understand especially if the reader is familiar with the application area concerned. We thus briefly catalogue the principles and main facilities with just a few examples and refer the reader to the ARM for the full details. But note that some of the more interesting tasking features were described in Chapter 22.

The annexes are generally independent but the Real-Time Systems annex requires that the Systems Programming annex be supported.

Systems Programming

This annex covers access to machine code, interrupt handling, some extra requirements on representations and preelaboration, a pragma for discarding names at run time, the pragmas for shared variables and packages for general task identification, per task attributes and the detection of task termination.

Interrupt handling is important. The general idea is that an interrupt handler is provided by a parameterless protected procedure which is called by some mythical external task. The protected procedure can be attached statically to the interrupt by the aspect Attach_Handler or it can be attached dynamically by a procedure of the same name in the package Ada.Interrupts. This package also defines the type Interrupt_Id which is used to identify the interrupts which are declared as constants in the package Ada.Interrupts.Names. Thus

protected Contact_Handler is

use Ada.Interrupts;

procedure Response

with Attach_Handler => Names.Contact_Int;

end;

protected body Contact_Handler is

procedure Response is

… -- the interrupt handling code

end Response;

end Contact_Handler;

The aspect specification statically attaches the procedure Response to the interrupt identified by the constant Contact_Int. Dynamic attachment is performed by using the aspect Interrupt_Handler to indicate that the protected procedure is to be used as a handler and then calling the procedure Attach_Handler thus

protected Contact_Handler is

procedure Response

with Interrupt_Handler;

end;

use Ada.Interrupts;

Attach_Handler(Contact_Handler.Response'Access, Names.Contact_Int);

where the first parameter of Attach_Handler is of the access type

type Parameterless_Handler is access protected procedure;

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2014

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

Available formats
×