GNAT Programming Studio Tutorial

Table of Contents


1 Introduction

This document provides a guide through the major capabilities of the GNAT Programming Studio by working on a code example: sdc, a simple desktop calculator.

It is important to realize that the features that you are about to experiment with are available on multiple platforms, using the same user interface and capabilities, providing a user-friendly environment with a tight integration between the tools.

Start GPS in the directory containing the tutorial files, or if the directory is read-only, copy the tutorial directory and its subdirectories in a local (writable) area, and start GPS from the tutorial directory, so that GPS will load the right context.

By default, the tutorial sources can be found under <prefix>/share/examples/gps/tutorial, where <prefix> is the prefix directory of the GPS installation.

Alternatively, if you have already started GPS in another directory, you can load the project sdc.gpr by using the menu Project->Open...


2 Quick overview of the GPS areas

Having launched GPS, you should now have access to a main window composed of several areas:


3 Editing sources

In the project view, open the common directory by clicking on the [+] sign (a triangle under unix systems) on the left of common. This will open the directory and display a list of source files located in this directory.

Now, double click on sdc.adb: this will open a source editor on this file. The source code is syntax-highlighted: keywords, comments, strings and characters have different colors.

As with many other properties, colors are configurable in GPS:

Select the menu Edit->Preferences. This will open a preferences dialog window.

Select the Editor->Fonts & Colors page by clicking on the cross next to the item Editor and then selecting the Fonts & Colors item.

As you go over the various lines and labels, you will notice that by holding the mouse over a label, a tool tip pops up displaying on-line help about the selected item.

Change the background color of the Keywords by clicking on the last button, at the right of the Keywords line.

Choose a color, e.g a light green. When you're done with the color selection, click on OK in the color selection dialog.

Click on the Apply button and look at the effects in the source editor. If you like the new display, click on OK to confirm the changes, otherwise clicking on Cancel will revert to the previous color.


4 Building applications

Select the icon Build Main: sdc.adb on the toolbar (fourth icon from the right): this will launch a complete build of the sdc application. Note also that you can use a key binding directly instead of this tool bar button (<F4>), or use the corresponding menu item Build->Project->sdc.adb. If you use the menu item, an extra intermediate dialog is displayed showing the actual command line that will be used by GPS. Pressing <Enter> will launch also the build.

The build has generated a number of errors in a new window: the Locations tree, displayed in the bottom area. The errors are also highlighted in the corresponding source editor.

GPS has automatically jumped to the first error message (sdc.adb, 28:6 : (style) bad indentation), at the line (28) and column (6) of the error.

Fix the error by hand by inserting a space.

Now you can fix the next error by moving the cursor to the line 30 (press the <down> arrow twice), and by using <Ctrl-Tab> (press first the <Control> key, and then the <Tab> key on your keyboard): this key combination asks the source editor to automatically re-indent the current line.

Note that on some window managers or desktop environments, <Ctrl-Tab> is already defined. If this is the case, you can change this shortcut from the key shortcuts dialog (menu Edit->Key shortcuts, Menus section, /Edit/Format Selection item).

You can then fix all the remaining errors by selecting the whole block (from line 28 to line 40) and pressing <Ctrl-Tab>. To select a block, you can either click on the left mouse button and select the area while holding the button, or using the keyboard by pressing the <Shift> key and moving the cursor using the <Up> or <Down> keys.

Press the <F4> key to build again. GPS will automatically save the modified files, and start a build. This behavior (automatic saving of files before building) can be configured in the preferences dialog.

If you look at the bottom right of the GPS window, you will notice that a progress bar has appeared, displaying the current number of files compiled, and the number of remaining files. This progress bar disappears when the build is finished.

This should now report a successful build.


5 Source Navigation

Now let's try to understand a little bit about how the program is working by looking at the sdc.adb editor: there's a loop, the main processing is done by the functions Process and Next (at line 30).

Click around line 30, move the mouse over Process and let a tool tip appear (Tokens.Process global procedure declared at tokens.ads:19): this gives information about the kind of entity and the location (file and line) of the declaration of this procedure, the profile of the parameters, and documentation for this function, as extracted from the comments surrounding the procedure declaration.

Do the same for Next (Tokens.Next global function declared at tokens.ads:15).

Keeping the mouse over Next, display the contextual menu by clicking on the right mouse button, then click on Goto declaration of Next: we're now in the package Tokens, in file tokens.ads; but where is this file in the project?


6 Search Dialog

Select the menu Navigate->Find or Replace...: this will open a search dialog. In the Find: text entry type tokens.ads. Then select Project view in the Scope area. The search area provides an easy way to search for text or regular expressions in several contexts including the current file, the project view, ...

Now click on Find. The file tokens.ads, in directory struct is highlighted.

Close the search dialog by clicking on the Close button.

Note that in this specific case, a simpler way to locate a file in the project view is to use the contextual menu from the source editor: Locate in Project View: tokens.ads.


7 Project View (entities)

Click on the [+] sign (or triangle) to open tokens.ads entities. When you click on a file in the project view, you get language sensitive information about the file, such as packages, subprograms, tasks, ... for Ada.

Open the subprogram category, click on Process: this will open tokens.ads and move the cursor on the first line corresponding to the procedure Process.

Similarly, click on Next, and move your mouse on Next in the source editor.


8 Back to Source Navigation

Move the mouse over the Next identifier in tokens.ads editor, and then hold the <Control> key: while you're holding the key, move the mouse over entities: these entities now become clickable hyperlinks. Clicking on the first mouse button will go to the declaration of the entity highlighted (or the body if you are already on the declaration), and clicking on the middle mouse button will go to the body directly: move the mouse back to Next and click. Alternatively, you can use the the contextual menu and select Goto body of Next; then scroll through the procedure Next, move the mouse on Instructions.Read at line 46, hold <control> again and click with the middle mouse button (or from the contextual menu, select Goto body of Read).

We've now navigated quite a bit through the application source code, which you can verify by clicking on the left arrow in the tool bar, to go back to the previous locations visited.

Repeat the operation until you're back in sdc.adb. As with the undo/redo capability in the source editor, the goto previous/next location is infinite.


9 Code Completion

Go on the line 38 of sdc.adb. You can see that there is a null instruction for the case of Stack.Overflow. We are going to add some code here, using the code assist capabilities.

Type <enter> to create a new line, and then Scr, and hit <Ctrl+Space>. A completion popup will be displayed, showing all the entities of the project begining with Scr. Double click on Screen_Output: the code is automatically completed in the editor. Then add a dot in your code. The completion popup will be automatically triggered, and will offer you to complete your code with the entities contained in the Screen_Output package. Select Msg, add a space, and then an open parenthesis. Once again, the completion windows will pop up, and show you the possible parameters for msg. If you choose the first entry of the completion list ("params of Msg"), the call will be automatically completed by a list of named parameters. Complete the list by giving e.g. "The stack is full." for S1, "" for S2, and True for End_Line.

Don't forget to add a semicolon at the end of the instruction. Then hit <F4> in order to rebuild the application.


10 Run

It is now time to run the application: select the menu Build->Run->sdc, which will open a dialog window. In the text input field (selected by default), press the right arrow key and then insert input.txt: this is the name of a text file that will be passed as argument to the sdc program.

The text input should now read: %E input.txt and the full command that will be executed is displayed underneath: .../gps/tutorial/obj/sdc input.txt

Now click on Execute: a new window titled Run: sdc is created at the bottom of the main window where the sdc application runs and displays an unexpected internal error: this is a good opportunity to use the integrated debugger.

Close the execution window by clicking on the x icon on the top right corner of this window.


11 Debug

Open the preferences dialog (menu Edit->Preferences) and click on the Debugger item on the left; set the button Break on exceptions to Enabled: this will enable by default a special breakpoint every time an exception is raised. Click on OK to confirm your change.

Now select the menu Debug->Initialize->sdc: GPS automatically switches to the Debug perspective as shown in the menu Window->Perspectives, and new windows have appeared: the debugger data window on top, the call stack window on the right, and the debugger console at the bottom.

You can also look at the various debug menu item and tool bar buttons which are now activated.

On the call stack window (you can use the menu Debug->Data->Call Stack to open it if you do not have it displayed), select the contextual menu: various pieces of information can be displayed or removed in the call stack. From this contextual menu, add the Frame Number info by clicking on it.

Now select the menu Debug->Run... and type input.txt in the text input field. Click on OK: the debugger should stop on an exception (Constraint_Error in the file stack.adb, at line 49).

Go up in the call stack by clicking on the tokens.process line (frame number 6 or 7, depending on your GNAT version).

If you move the mouse over the parameter T at line 64, a tool tip is displayed showing the value of T. You have probably noticed that tool tips, like menus, are contextual: depending on the current session and on the entity selected, different information is displayed.

Select the contextual menu Debug->Display T: this will highlight the data window, with a new box displaying graphically the contents of the different fields of T, each clearly separated.

Move your mouse over the 1:T box, select the contextual menu Display->Show Value + Type: this displays for all fields both their type and value.

Special colors are used in the data display: blue for pointers that can be dereferenced by a double-click (double click on T.val); red for fields that have been modified since last step.

From the T box, right-click to display the contextual menu and select View memory at address of T: a memory view is opened on top of the source editors. Use the up and down arrows on the right to visit memory.

Click in the memory dump, and modify it by typing numbers. Notice the red color for modified values; click on Undo Changes to cancel the modifications; then close the memory window by e.g. clicking on the x icon or pressing <Ctrl-W>.

In the call stack, go back to stack.push frame (num 4 or 5). Move the mouse over Last and let the debugger display its value: 0. From the contextual menu, select Goto declaration of Last: this will jump to the line 16 of stack.adb, where you can see that Last is a Natural. Now click on the Goto Previous Location button in the tool bar: we're now back at line 49 where we can see that for a Push procedure, Last should be incremented, and not decremented.

Fix the line to Last := Last + 1;

Save the file (<Ctrl-S>); End the debug session: menu Debug->Terminate; Rebuild (press <F4> key); Rerun (menu Build->Run->sdc, click on Execute): the program now completes as expected. Close the execution window.


12 Call Graph

Now go back to the file sdc.adb, move the mouse over the procedure sdc at line 8, select the contextual menu Browsers->Sdc calls: this will open a new window titled Call graph browser.

Note that there is also a top level contextual menu (Sdc calls) which provides a tree view of the callers/callees.

In the call graph, click on the right arrow of Process (one of the first items on the top). Also click on the right arrow of Error_Msg.

Select Orthogonal links in the contextual menu of the graph to change the way links are displayed in the graph. You may then play with the zoom (<=> and <-> keys).

If you select Hide links from Error_Msg contextual menu, this will hide all the links that are related to this item: the link between the callers and callees of Error_Msg are no longer displayed. This can be useful when the graph becomes complex, to hide some parts. If you go back to the contextual menu, you can now select Show links to show the links again.

Click on right arrow of Process ((Decl) instructions.ads:12).

The items can also be moved: move e.g Msg item around.

You can also recompute the layout of all the current items by using the browser's contextual menu Refresh layout (move the mouse on the browser's background, with no box underneath, and right click).

Click on left arrow of Msg to display who is calling Msg. Notice that View calls Msg.

Click on left arrow of View: the arrow disappears, and no new items are created, which means that View isn't called by anyone, so we're now going to remove this procedure.


13 Locations View

From View, click on the blue link: stack.ads:32, this will open the file stack.ads at line 32. Then from the source editor (file stack.ads), select the contextual menu References->Find all references to View: this highlights the Locations tree which now contains all the references for View, grouped by files (stack.ads and stack.adb).

The first location is highlighted automatically: this is the spec of the procedure View. Now click in the tree on the + sign (or triangle) at the left of stack.adb: two locations are listed, at line 90 and 97. Click on each of these locations: they correspond to the procedure body.

The Find all references capability is another way to list all the uses of an entity, and it confirms that View isn't called in our project.

Remove View body by e.g selecting it, and pressing the <Delete> key, then save the file (<Ctrl-S>).

Do the same for the spec, save the file.

Close the stack.ads and stack.adb files (menu File->Close, or using the shortcut <Ctrl-W>). Rebuild by pressing the <F4> key.

Let's now see how to create a project corresponding to the sdc project we've used in this tutorial.


14 Projects


Next: , Up: Projects

14.1 Project Wizard

Go to the menu Project->New...: this is a standard wizard, with various steps listed on the left area of the window.

The first page of the wizard allows you to select what kind of project you want to build, depending on the information you have. Select the default choice Single Project, and press Forward.

Type sdc2 in the project name field.

Click on Forward: we are now on the language selection page. It is possible to create a multi-language project by e.g. selecting the C or C++ check box.

Click on Forward: we are now on the VCS page. VCS stands for Version Control System. GPS provides a generic framework for VCS which allows it to support new systems easily. Systems supported by default are CVS, ClearCase, Subversion and GIT. Select Auto, which means that GPS will automatically detect the version control system used, if any.

Click on Forward: this is the source directories selection, used to specify the project's sources. Click on the Add button, and select the struct directory, then click on OK to validate.

Click on Forward: this is the Build and Exec directory selection, used to store object, ali files, ...

Click on the first Browse button, then click on obj, and finally click on OK.

Click on Forward: this is the main units selection, used mainly for building executables and debugging.

Click on Add, open the common directory and select sdc.adb.

Click on Forward: this is the naming scheme editor. GNAT is very flexible and can use any kind of naming scheme for Ada files. In particular, you can easily set the default file extensions (e.g by using one of the predefined schemes) and you can also specify exceptions that use non standard file names.

Click on Forward: we're now in the switch selector. Select Recompile if switches changed.

Click on Ada page.

Select Full errors and Overflow checking. The boxes and the command line (the text entry at the bottom of the page) are fully synchronized, e.g if you click on the command line, and change -gnatf to -gnat, the Full errors check box is unselected; now type a to get -gnata, and notice that Enable assertions is now selected.

We've now created a project similar to the one used in this tutorial.

Click on Cancel to close the wizard.

Clicking on Apply instead would have created the project file and loaded it in GPS.


Next: , Previous: Project Wizard, Up: Projects

14.2 Project properties

In the project view, on the project sdc, use the contextual menu Project->Properties. All the properties set in the project wizard can be found here as well. You can switch between pages by clicking on the tabs located along the left side of the window.

Once you're done exploring the property pages, click on the Cancel button to close the properties window.


Next: , Previous: Project properties, Up: Projects

14.3 Variable editor

Select the window titled "Scenario". If not available, you can open it using the menu Tools->Views->Scenario. This window contains a Build label.

This is a configuration variable. With GPS and the GNAT project facility, you can define as many configuration variables as you want, and modify any project settings (e.g. switches, sources, ...) based on the values of configuration variables. These variables can also take any number of different values.

The Build variable demonstrates a typical Debug/Production configuration where we've set different switches for the two modes.

Right click on the Build label and select Edit properties of Build...: this opens the variable editor, where values can be added or renamed. Close the variable editor by clicking on the Cancel button.

Now, let's take a look at the switches set in the project.


Next: , Previous: Variable editor, Up: Projects

14.4 Switch editor

Select the menu item Project->Edit File Switches: a global switch editor is displayed in the working area, showing the switches associated with each file in the sdc project.

The editor lists the switches associated with each file in the project. Gray entries indicate default (global) switches. Notice that screen_output.adb has specific switches, which are highlighted using a different font.

Switch between Debug and Production mode in the Build combo box: the switches are updated automatically.

Back to our project, let's now examine the dependencies between sources.


Next: , Previous: Switch editor, Up: Projects

14.5 Source dependencies

Select sdc.adb in the Project View and then the contextual menu item Show dependencies for sdc.adb: this will open a new graph showing the dependencies between sources of the project.

Click on the right arrow of tokens.ads to display the files that tokens.ads depends on. Similarly, click on the right arrow of stack.ads.


Previous: Source dependencies, Up: Projects

14.6 Project dependencies

Back in the project view, on the Sdc project, select the contextual menu Project->Dependencies, then on the Add From File, then open the tutorial directory and click on the projects subdirectory. Select the file prj1.gpr. Click on Apply to validate the change.

You can see the new dependency added in the project view, as a tree of projects. In particular, project dependencies are duplicated: if you open the prj1 icon by clicking on the [+] sign (or triangle), and then similarly open the prj2 icon, you will notice that the project prj4 is displayed twice: once as a dependency of prj2, and once as a dependency of prj1.

GPS can also display the graph of dependencies between projects: on Sdc project, use the contextual menu Show projects imported by Sdc: this will open a project hierarchy browser.

On the Sdc.gpr project, select the contextual menu Show projects imported by Sdc recursively.

In the browser, you can move the project items, and select them to highlight the dependencies.


15 Epilogue

This terminates our tour of GPS, the GNAT Programming Studio. We hope this tutorial gave you a good overview of the general capabilities available with GPS. A non exhaustive list of the features not mentioned in this document includes:

For more information, please look at the User's Guide (gps.html), and also look at the Tools menu which gives access to most of these capabilities.


Appendix A GNU Free Documentation License

Version 1.1, March 2000


Copyright © 2000 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

0. PREAMBLE

The purpose of this License is to make a manual, textbook, or other written document “free” in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.

This License is a kind of “copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.

We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.

1. APPLICABILITY AND DEFINITIONS

This License applies to any manual or other work that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. The “Document”, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as “you”.

A “Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.

A “Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (For example, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.

The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License.

The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License.

A “Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, whose contents can be viewed and edited directly and straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup has been designed to thwart or discourage subsequent modification by readers is not Transparent. A copy that is not “Transparent” is called “Opaque”.

Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML designed for human modification. Opaque formats include PostScript, PDF, proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML produced by some word processors for output purposes only.

The “Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, “Title Page” means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text.

2. VERBATIM COPYING

You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.

You may also lend copies, under the same conditions stated above, and you may publicly display copies.

3. COPYING IN QUANTITY

If you publish printed copies of the Document numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.

If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.

If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a publicly-accessible computer-network location containing a complete Transparent copy of the Document, free of added material, which the general network-using public has access to download anonymously at no charge using public-standard network protocols. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.

It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.

4. MODIFICATIONS

You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:

  1. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.
  2. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has less than five).
  3. State on the Title page the name of the publisher of the Modified Version, as the publisher.
  4. Preserve all the copyright notices of the Document.
  5. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.
  6. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.
  7. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice.
  8. Include an unaltered copy of this License.
  9. Preserve the section entitled “History”, and its title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section entitled “History” in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.
  10. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the “History” section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.
  11. In any section entitled “Acknowledgements” or “Dedications”, preserve the section's title, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.
  12. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.
  13. Delete any section entitled “Endorsements”. Such a section may not be included in the Modified Version.
  14. Do not retitle any existing section as “Endorsements” or to conflict in title with any Invariant Section.

If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles.

You may add a section entitled “Endorsements”, provided it contains nothing but endorsements of your Modified Version by various parties – for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.

You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.

The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.

5. COMBINING DOCUMENTS

You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice.

The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.

In the combination, you must combine any sections entitled “History” in the various original documents, forming one section entitled “History”; likewise combine any sections entitled “Acknowledgements”, and any sections entitled “Dedications”. You must delete all sections entitled “Endorsements.”

Heading 6. COLLECTIONS OF DOCUMENTS

You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.

You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.

7. AGGREGATION WITH INDEPENDENT WORKS

A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, does not as a whole count as a Modified Version of the Document, provided no compilation copyright is claimed for the compilation. Such a compilation is called an “aggregate”, and this License does not apply to the other self-contained works thus compiled with the Document, on account of their being thus compiled, if they are not themselves derivative works of the Document.

If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one quarter of the entire aggregate, the Document's Cover Texts may be placed on covers that surround only the Document within the aggregate. Otherwise they must appear on covers around the whole aggregate.

8. TRANSLATION

Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License provided that you also include the original English version of this License. In case of a disagreement between the translation and the original English version of this License, the original English version will prevail.

9. TERMINATION

You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

10. FUTURE REVISIONS OF THIS LICENSE

The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/.

Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation.

ADDENDUM: How to use this License for your documents

To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:

Copyright (c) YEAR YOUR NAME.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. A copy of the license is included in the section entitled “GNU Free Documentation License”.

If you have no Invariant Sections, write “with no Invariant Sections” instead of saying which ones are invariant. If you have no Front-Cover Texts, write “no Front-Cover Texts” instead of “Front-Cover Texts being LIST”; likewise for Back-Cover Texts.

If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.