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...
Having launched GPS, you should now have access to a main window composed of several areas:
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.
Select the icon Build Main: sdc.adb on the toolbar (third 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.
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?
Select the menu Navigate->Find or Replace...: this will open a search
dialog.
In the Search for: text entry type tokens.ads. Then
select Project view in the Look in: 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.
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.
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.
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. Select Screen_Output. The code will be
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.
It is now time to run the application: select the menu
Build->Run->sdc, which will open a dialog window.
Type input.txt in the text entry: this is the name of a text
file that will be passed as argument to the sdc program.
Now click on OK: a new window titled Run: sdc input.txt
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.
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: a new window is
created: this is the debugger console.
You can also look at the various debug menu item and tool bar buttons which are
now activated.
Use the menu Debug->Data->Call Stack: this opens a new window on the
right of the source editors. If you select the contextual menu in the call
stack, 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.... Notice that input.txt has
been filled automatically for you since the two menus Build->Run... and
Debug->Run... are synchronized. 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 open a new
window: the data window, with a box displaying graphically the contents
of the different fields of T, each clearly separated.
On T data display, 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.
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;
click on Close to close the memory window.
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 OK): the program now
completes as expected. Close the execution window.
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.
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.
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.
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.
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.
Click on the button at the left (Edit variable properties): this
is 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.
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.
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.
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.
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.
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 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.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program 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.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public 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.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.