]> code.delx.au - gnu-emacs-elpa/blob - packages/ada-mode/ada-mode.info
update to Ada mode version 5.0.1
[gnu-emacs-elpa] / packages / ada-mode / ada-mode.info
1 This is ../ada-mode.info, produced by makeinfo version 4.13 from
2 ../ada-mode.texi.
3
4 Copyright (C) 1999 - 2014 Free Software Foundation, Inc.
5
6 Permission is granted to copy, distribute and/or modify this
7 document under the terms of the GNU Free Documentation License,
8 Version 1.3 or any later version published by the Free Software
9 Foundation; with no Invariant Sections, with the Front-Cover texts
10 being "A GNU Manual", and with the Back-Cover Texts as in (a)
11 below. A copy of the license is included in the section entitled
12 "GNU Free Documentation License".
13
14 (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
15 modify this GNU manual. Buying copies from the FSF supports it in
16 developing GNU and promoting software freedom."
17
18 INFO-DIR-SECTION Emacs editing modes
19 START-INFO-DIR-ENTRY
20 * Ada mode: (ada-mode). Emacs mode for editing and navigating Ada code.
21 END-INFO-DIR-ENTRY
22
23 \1f
24 File: ada-mode.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir)
25
26 Copyright (C) 1999 - 2014 Free Software Foundation, Inc.
27
28 Permission is granted to copy, distribute and/or modify this
29 document under the terms of the GNU Free Documentation License,
30 Version 1.3 or any later version published by the Free Software
31 Foundation; with no Invariant Sections, with the Front-Cover texts
32 being "A GNU Manual", and with the Back-Cover Texts as in (a)
33 below. A copy of the license is included in the section entitled
34 "GNU Free Documentation License".
35
36 (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
37 modify this GNU manual. Buying copies from the FSF supports it in
38 developing GNU and promoting software freedom."
39
40 * Menu:
41
42 * Overview::
43 * Installation:: Installing Ada mode on your system
44 * Customization:: Setting up Ada mode to your taste
45 * Compiling Executing:: Working with your application within Emacs
46 * Project files:: Describing the organization of your project
47 * Moving Through Ada Code:: Moving easily through Ada sources
48 * Identifier completion:: Finishing words automatically
49 * Indentation:: Indenting your code automatically as you type
50 * Statement skeletons::
51 * Aligning code::
52 * Automatic casing:: Adjusting the case of words automatically
53 * Comment Handling:: Reformatting comments easily
54 * Key summary::
55 * Developer overview::
56 * GNU Free Documentation License::
57 * Index::
58
59 \1f
60 File: ada-mode.info, Node: Overview, Next: Installation, Prev: Top, Up: Top
61
62 1 Overview
63 **********
64
65 The Emacs mode for programming in Ada helps the user in reading
66 existing code and facilitates developing new code.
67
68 Cross-reference information output by the compiler is used to provide
69 powerful code navigation (jump to definition, find all uses, etc).
70
71 When you open a file with a file extension of `.ads' or `.adb',
72 Emacs will automatically load and activate Ada mode.
73
74 Ada mode works without any customization, if you are using the GNAT
75 compiler (`https://libre2.adacore.com/') and the GNAT default naming
76 convention.
77
78 You must customize a few things if you are using a different file
79 naming convention or compiler; *Note Non-standard file names::, *Note
80 Other compiler::.
81
82 In addition, you may want to customize the indentation,
83 capitalization, and other things; *Note Other customization::.
84
85 Finally, for large Ada projects, you will want to set up an Emacs Ada
86 mode project file for each project; *Note Project files::. Note that
87 these are different from the GNAT project files used by the GNAT tools.
88
89 *Note Debuggers: (emacs)Debuggers, for general information on
90 debugging.
91
92 \1f
93 File: ada-mode.info, Node: Installation, Next: Customization, Prev: Overview, Up: Top
94
95 2 Installation
96 **************
97
98 Ada mode is distributed in the Gnu ELPA package archive; it can be
99 installed via `M-x list-packages' (*note Packages: (emacs)Packages.).
100 You must first enable packages in your `~/.emacs', _after_ customizing
101 `Info-default-directory-list' (if you do that):
102
103 (package-initialize)
104
105 Ada mode is also available as a separate distribution, from the Emacs
106 Ada mode website
107 `http://stephe-leake.org/emacs/ada-mode/emacs-ada-mode.html'.
108
109 For installing the separate distribution, see the `README' file in
110 the distribution.
111
112 To see what version of Ada mode you have installed, invoke `M-x
113 ada-mode-version'.
114
115 * Menu:
116
117 * gnatinspect::
118
119 \1f
120 File: ada-mode.info, Node: gnatinspect, Prev: Installation, Up: Installation
121
122 2.1 gnatinspect
123 ===============
124
125 Ada mode has experimental support for the new AdaCore cross reference
126 tool `gnatinspect', which supports Ada, C, C++, and any other language
127 for which gcc provices the `-fdump-xref'.
128
129 `gnatinspect' is distributed as part of `gnatcoll'. Ada mode
130 requires the very latest version, in `gnatcoll 1.7w' distributed with
131 GNATPro 7.2 preview.
132
133 To build `gnatinspect', assuming gnat-7.1.2 is installed in
134 `/usr/gnat-7.1.1':
135
136 tar xf ~/Downloads/gnatcoll-1.7w-src.tgz
137 cd gnatcoll-1.7w-src
138 ./configure --prefix=/usr/gnat-7.1.2
139 make Gnatcoll_Build=Debug
140 sudo make Gnatcoll_Build=Debug install
141
142 \1f
143 File: ada-mode.info, Node: Customization, Next: Compiling Executing, Prev: Installation, Up: Top
144
145 3 Customizing Ada mode
146 **********************
147
148 Here we assume you are familiar with setting variables in Emacs, either
149 thru 'customize' or in elisp (in your `.emacs' file). For a basic
150 introduction to customize, elisp, and Emacs in general, see the
151 tutorial (`C-h t').
152
153 * Menu:
154
155 * Non-standard file names::
156 * Other compiler::
157 * Other cross-reference::
158 * Other customization::
159
160 \1f
161 File: ada-mode.info, Node: Non-standard file names, Next: Other compiler, Prev: Customization, Up: Customization
162
163 3.1 Non-standard file names
164 ===========================
165
166 By default, Ada mode is configured to use the GNAT file naming
167 convention, where file names are a simple modification of the Ada
168 names, and the extension for specs and bodies are `.ads' and `.adb',
169 respectively.
170
171 Emacs uses the file extension to enable Ada mode; Ada mode uses the
172 file extentions to allow moving from a package body to the
173 corresponding spec and back.
174
175 Emacs and Ada mode support ways to use alternative file extensions
176 for specs and bodies. Note that you must also tell the compiler about
177 these extensions; doing that is beyond the scope of this manual.
178
179 For instance, if your spec and bodies files are called `UNIT_s.ada'
180 and `UNIT_b.ada', respectively, you can add the following to your
181 `.emacs' file:
182
183 ;; Tell Ada mode about spec and body extensions
184 (ada-add-extensions "_s.ada" "_b.ada")
185
186 ;; Tell Emacs to use Ada mode for those extensions
187 (add-to-list 'auto-mode-alist '("\\.ada\\'" . ada-mode))
188
189 You can define additional extensions:
190
191 (ada-add-extensions ".ads" "_b.ada")
192 (ada-add-extensions ".ads" ".body")
193
194 This means that whenever Ada mode looks for the body for a file
195 whose extension is `.ads', it will take the first available file that
196 ends with either `.adb', `_b.ada' or `.body'.
197
198 Simililarly, if Ada mode is looking for a spec, it will look for
199 `.ads' or `_s.ada'.
200
201 If the filename excluding the extension is not derived from the Ada
202 name following the GNAT convention, you need to provide an alternate
203 function for `ada-file-name-from-ada-name'. Doing that is beyond the
204 scope of this manual; see the current definitions in `ada-mode.el' and
205 `ada-gnat-xref.el' for examples.
206
207 \1f
208 File: ada-mode.info, Node: Other compiler, Next: Other cross-reference, Prev: Non-standard file names, Up: Customization
209
210 3.2 Other compiler
211 ==================
212
213 The project variable `ada_compiler' (default elisp variable
214 `ada-compiler') is used to index several variables that point to the
215 compiler-specific functions for corresponding Ada mode operations.
216
217 To use a compiler other than GNAT, you must write Emacs lisp code
218 that provides the interface to the compiler, and set `ada-compiler' and
219 the indirection variables.
220
221 See `ada-gnat-compile.el' for an example.
222
223 \1f
224 File: ada-mode.info, Node: Other cross-reference, Next: Other customization, Prev: Other compiler, Up: Customization
225
226 3.3 Other cross-reference
227 =========================
228
229 The project variable `ada_xref' (default elisp variable
230 `ada-xref-tool') is used to index several variables that point to the
231 cross-reference-tool-specific functions for corresponding Ada mode
232 operations.
233
234 To use a cross reference tool other than gnatxref, you must write
235 Emacs lisp code that provides the interface to the compiler, and set
236 `ada-xref-tool' and the indirection variables. This has already been
237 done for `gnatinspect'; set `ada-xref-tool' to `'gnat_inspect'.
238
239 See `ada-gnat-xref.el' and `gnat-inspect.el' for examples.
240
241 \1f
242 File: ada-mode.info, Node: Other customization, Prev: Other cross-reference, Up: Customization
243
244 3.4 Other customization
245 =======================
246
247 All user-settable Ada mode variables can be set via the menu `Ada |
248 Customize'. Click on the `Help' button there for help on using
249 customize.
250
251 To modify a specific variable, you can directly call the function
252 `customize-variable'; just type `M-x customize-variable <RET>
253 VARIABLE-NAME <RET>').
254
255 Alternately, you can specify variable settings in the Emacs
256 configuration file, `~/.emacs'. This file is coded in Emacs lisp, and
257 the syntax to set a variable is the following:
258 (setq variable-name value)
259
260 Some general Emacs settings that are useful for Ada files:
261 `delete-trailing-whitespace'
262 Deletes space, tab at end of line and blank lines at end of buffer.
263
264 `untabify'
265 Deletes tab characters that have crept into the file.
266
267 `indent-tabs-mode'
268 Don't insert tab characters when indenting.
269
270 `copyright-update'
271 Updates the copyright date in the file header comment, to the
272 current year.
273
274 `electric-pair-mode'
275 Insert a matching right paren when you type a left paren.
276
277 `hippie-expand'
278 Bind `hippie-expand' to a key; it expands the word before point,
279 using words from current buffer, other buffers, file names, etc;
280 see `hippie-expand-try-functions-list'. You can also add
281 `ada-skel-hippie-try' to that list. Note that `ada-expand', which
282 defaults to `ada-skel-expand', is bound to <C-c C-e> (*note
283 Statement skeletons::).
284
285 `imenu'
286
287 `which-func'
288
289 The above can all be set by the following code in your `~/.emacs'.
290 Note that some are functions are added to `before-save-hook'; they run
291 just before a buffer is written to disk. Also, the order is important;
292 ada-mode does not set up the Ada-specific features of imenu and
293 which-func unless they are loaded first.
294
295 (setq-default indent-tabs-mode nil)
296 (electric-pair-mode 1)
297 (require 'imenu)
298 (require 'which-func)
299 (require 'ada-mode)
300 (add-to-list 'hippie-expand-try-functions-list 'ada-skel-hippie-try)
301 (define-key ada-mode-map "\C-e" 'hippie-expand)
302 (add-hook 'ada-mode-hook
303 (lambda ()
304 (add-hook 'before-save-hook 'delete-trailing-whitespace nil t)
305 (add-hook 'before-save-hook 'copyright-update nil t)
306 (add-hook 'before-save-hook
307 (lambda () (untabify (point-min) (point-max)))
308 nil t)))
309
310 \1f
311 File: ada-mode.info, Node: Compiling Executing, Next: Project files, Prev: Customization, Up: Top
312
313 4 Compiling Executing
314 *********************
315
316 Ada projects can be compiled, linked, and executed using commands on
317 the Ada menu. All of these commands can be customized via a project
318 file (*note Project files::), but the defaults are sufficient for using
319 the GNAT compiler for simple projects (single files, or several files
320 in a single directory).
321
322 For complex projects, you will want to use `make' or some other
323 build tool; in that case, you will need an Emacs Ada mode project file
324 to tell Emacs about the project directory tree and other settings.
325
326 * Menu:
327
328 * Compile commands::
329 * Compiling Examples::
330 * Compiler errors::
331
332 \1f
333 File: ada-mode.info, Node: Compile commands, Next: Compiling Examples, Prev: Compiling Executing, Up: Compiling Executing
334
335 4.1 Compile commands
336 ====================
337
338 Here are the commands for building an Ada project and running the main
339 program.
340
341 In multi-file projects, there must be one file that is the main
342 program. That is given by the `main' project file variable; it defaults
343 to the current file if not yet set, but is also set by the "set main
344 and build" command.
345
346 `Check file'
347 Compiles the current file in syntax check mode, by running
348 `check_cmd' defined in the current project file. This typically
349 runs faster than full compile mode, speeding up finding and fixing
350 compilation errors.
351
352 This sets `main' only if it has not been set yet.
353
354 `Compile file'
355 Compiles the current file, by running `comp_cmd' from the current
356 project file.
357
358 This does not set `main'.
359
360 `Set main and Build'
361 Sets `main' to the current file, then executes the Build command.
362
363 `Show main'
364 Display `main' in the message buffer.
365
366 `Build'
367 Compiles all obsolete units of the current `main', and links
368 `main', by running `make_cmd' from the current project.
369
370 This sets `main' only if it has not been set yet.
371
372 `Run'
373 Executes the main program in a shell, displayed in a separate Emacs
374 buffer. This runs `run_cmd' from the current project. The
375 execution buffer allows for interactive input/output.
376
377 To modify the run command, in particular to provide or change the
378 command line arguments, type `C-u' before invoking the command.
379
380 This command is not available for a cross-compilation toolchain.
381
382 It is important when using these commands to understand how `main'
383 is used and changed.
384
385 Build runs 'gnatmake' on the main unit. During a typical edit/compile
386 session, this is the only command you need to invoke, which is why it
387 is bound to `C-c C-c'. It will compile all files needed by the main
388 unit, and display compilation errors in any of them.
389
390 Note that Build can be invoked from any Ada buffer; typically you
391 will be fixing errors in files other than the main, but you don't have
392 to switch back to the main to invoke the compiler again.
393
394 Novices and students typically work on single-file Ada projects. In
395 this case, `C-c C-m' will normally be the only command needed; it will
396 build the current file, rather than the last-built main.
397
398 There are three ways to change `main':
399
400 1. Invoke `Ada | Set main and Build', which sets `main' to the
401 current file.
402
403 2. Invoke `Ada | Project | Edit', edit `main' and `main', and click
404 `[save]'
405
406 3. Invoke `Ada | Project | Load', and load a project file that
407 specifies `main'
408
409
410 \1f
411 File: ada-mode.info, Node: Compiling Examples, Next: Compiler errors, Prev: Compile commands, Up: Compiling Executing
412
413 4.2 Compiling Examples
414 ======================
415
416 We present several small projects, and walk thru the process of
417 compiling, linking, and running them.
418
419 The first example illustrates more Ada mode features than the others;
420 you should work thru that example before doing the others.
421
422 All of these examples assume you are using GNAT.
423
424 The source for these examples is available on the Emacs Ada mode
425 website mentioned in *Note Installation::.
426
427 * Menu:
428
429 * No project files:: Just menus
430 * Set compiler options:: A basic Ada mode project file
431 * Set source search path:: Source in multiple directories
432 * Use GNAT project file::
433 * Use multiple GNAT project files::
434 * Use a Makefile::
435
436 \1f
437 File: ada-mode.info, Node: No project files, Next: Set compiler options, Prev: Compiling Examples, Up: Compiling Examples
438
439 4.2.1 No project files
440 ----------------------
441
442 This example uses no project files.
443
444 First, create a directory `Example_1', containing:
445
446 `hello.adb':
447
448 with Ada.Text_IO;
449 procedure Hello
450 is begin
451 Put_Line("Hello from hello.adb");
452 end Hello;
453
454 Yes, this is missing "use Ada.Text_IO;" - we want to demonstrate
455 compiler error handling.
456
457 `hello_2.adb' has no errors:
458
459 with Hello_Pkg;
460 procedure Hello_2
461 is begin
462 Hello_Pkg.Say_Hello;
463 end Hello_2;
464
465 `hello_pkg.ads' has no errors:
466
467 package Hello_Pkg is
468 procedure Say_Hello;
469 end Hello_Pkg;
470
471 `hello_pkg.adb':
472
473 with Ada.Text_IO;
474 package Hello_Pkg is
475 procedure Say_Hello
476 is begin
477 Ada.Text_IO.Put_Line ("Hello from hello_pkg.adb");
478 end Say_Hello;
479 end Hello_Pkg;
480
481 Yes, this is missing the keyword `body'; another compiler error
482 example. However, note that the indentation engine parser accepts this
483 code with no errors, making it easier to indent slightly illegal Ada
484 code.
485
486 In buffer `hello.adb', invoke the menu entry `Ada | Build | Check
487 syntax'. You should get a `*compilation*' buffer containing something
488 like (the directory paths will be different):
489
490 -*- mode: compilation; default-directory: "c:/Projects/org.emacs.ada-mode.stephe-1/test/Example_1/" -*-
491 Compilation started at Fri Oct 18 04:23:54
492
493 gnatmake -u -c -gnatc c:/Projects/org.emacs.ada-mode.stephe-1/test/Example_1/hello.adb -cargs
494 gcc -c -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_1/ -gnatc -I- c:/Projects/org.emacs.ada-mode.stephe-1/test/Example_1/hello.adb
495 hello.adb:4:04: "Put_Line" is not visible
496 hello.adb:4:04: non-visible declaration at a-textio.ads:263
497 hello.adb:4:04: non-visible declaration at a-textio.ads:259
498 gnatmake: "c:/Projects/org.emacs.ada-mode.stephe-1/test/Example_1/hello.adb" compilation error
499
500 Compilation exited abnormally with code 4 at Fri Oct 18 04:23:54
501
502 The lines with actual errors (starting with `hello.adb') are
503 highlighted, with the file name in red.
504
505 Now invoke `Ada | Build | Next compilation error'. Or you can click
506 the middle mouse button on the first error line, or use the key binding
507 shown on the menu. The compilation buffer scrolls to put the first
508 error on the top line, and point is put at the place of the error in
509 the `hello.adb' buffer.
510
511 To fix the error, invoke `Ada | Build | Fix compilation error'; this
512 adds "Ada.Text_Io." to the line:
513
514 Ada.Text_Io.Put_Line ("hello from hello.adb");
515
516 Now invoke `Ada | Build | Show main'; this displays `Ada mode main:
517 hello'.
518
519 Now (in buffer `hello.adb'), invoke `Ada | Build | Build'. You are
520 prompted to save the file (if you haven't already). Then the
521 compilation buffer is displayed again, containing:
522
523 -*- mode: compilation; default-directory: "c:/Projects/org.emacs.ada-mode.stephe-1/test/Example_1/" -*-
524 Compilation started at Fri Oct 18 20:39:33
525
526 gnatmake -o hello hello -cargs -bargs -largs
527 gcc -c hello.adb
528 gnatbind -x hello.ali
529 gnatlink hello.ali -o hello.exe
530
531 Compilation finished at Fri Oct 18 20:39:34
532
533 The compilation has succeeded without errors; `hello.exe' now exists
534 in the same directory as `hello.adb'.
535
536 Now invoke `Ada | Build | Run'. The `*compilation*' buffer is
537 displayed, containing
538
539 -*- mode: compilation; default-directory: "c:/Projects/org.emacs.ada-mode.stephe-1/test/Example_1/" -*-
540 Compilation started at Fri Oct 18 20:41:53
541
542 ./hello
543 Hello from hello.adb
544
545 Compilation finished at Fri Oct 18 20:41:53
546
547 That completes the first part of this example.
548
549 Now we will compile a multi-file project. Open the file
550 `hello_2.adb', invoke `Ada | Build | Set main and Build'. This finds an
551 error in `hello_pkg.adb':
552
553 hello_pkg.adb:2:08: keyword "body" expected here [see file name]
554
555 This demonstrates that gnatmake finds the files needed by the main
556 program. However, it cannot find files in a different directory, unless
557 you use an Emacs Ada mode project file or a GNAT project file to
558 specify the other directories; *Note Set source search path::, *note
559 Use GNAT project file::.
560
561 Invoke `Ada | Build | Show main'; this displays `Ada mode main:
562 hello_2'.
563
564 Move to the error with `C-x `', and fix the error by adding `body':
565
566 package body Hello_Pkg is
567
568 Now, while still in `hello_pkg.adb', invoke `Ada | Build | Build'.
569 gnatmake successfully builds `hello_2'. This demonstrates that Emacs
570 has remembered the main file, in the project variable `main', and used
571 it for the Build command.
572
573 Finally, again while in `hello_pkg.adb', invoke `Ada | Build | Run'.
574 The `*compilation*' buffer displays `Hello from hello_pkg.adb'.
575
576 One final point. If you switch back to buffer `hello.adb', and
577 invoke `Ada | Build | Run', `hello_2.exe' will be run. That is because
578 `main' is still set to `hello_2', as you can see when you invoke `Ada |
579 Build | Show main'.
580
581 There are two ways to change `main':
582
583 1. Invoke `Ada | Build | Set main and Build', which sets `main' to
584 the current file.
585
586 2. Invoke `Ada | Build | Set Project ...', and select a project file
587 that specifies `main'.
588
589
590 \1f
591 File: ada-mode.info, Node: Set compiler options, Next: Set source search path, Prev: No project files, Up: Compiling Examples
592
593 4.2.2 Set compiler options
594 --------------------------
595
596 This example illustrates using an Emacs Ada mode project file to set a
597 compiler option.
598
599 If you have files from `Example_1' open in Emacs, you should close
600 them so you don't get confused. Use menu `File | Close (current
601 buffer)'.
602
603 In directory `Example_2', create these files:
604
605 `hello.adb':
606
607 with Ada.Text_IO;
608 procedure Hello
609 is begin
610 Put_Line("Hello from hello.adb");
611 end Hello;
612
613 This is the same as `hello.adb' from `Example_1'. It has two errors;
614 missing "use Ada.Text_IO;", and no space between `Put_Line' and its
615 argument list.
616
617 `hello.adp':
618
619 comp_opt=-gnatyt
620
621 This tells the GNAT compiler to check for token spacing; in
622 particular, there must be a space preceding a parenthesis.
623
624 In buffer `hello.adb', invoke `Ada | Build | Set main and Build'.
625 This finds the project file `hello.adp', uses it to set the compiler
626 options, and builds the project. You should get a `*compilation*'
627 buffer containing something like (the directory paths will be
628 different):
629
630 cd c:/Examples/Example_2/
631 gnatmake -o hello hello -g -cargs -gnatyt -bargs -largs
632 gcc -c -g -gnatyt hello.adb
633 hello.adb:4:04: "Put_Line" is not visible
634 hello.adb:4:04: non-visible declaration at a-textio.ads:264
635 hello.adb:4:04: non-visible declaration at a-textio.ads:260
636 hello.adb:4:12: (style) space required
637 gnatmake: "hello.adb" compilation error
638
639 Compare this to the compiler output in *note No project files::; the
640 gnatmake option `-cargs' has been replaced by `-cargs -gnaty', and an
641 additional error is reported in `hello.adb' on line 4. This shows that
642 `hello.adp' is being used to set the compiler options.
643
644 Fixing the error, linking and running the code proceed as in *note
645 No project files::.
646
647 \1f
648 File: ada-mode.info, Node: Set source search path, Next: Use GNAT project file, Prev: Set compiler options, Up: Compiling Examples
649
650 4.2.3 Set source search path
651 ----------------------------
652
653 In this example, we show how to deal with files in more than one
654 directory, using an Emacs Ada mode project file to set the search path.
655
656 Create the directory `Example_3', containing:
657
658 `hello_pkg.ads':
659
660 package Hello_Pkg is
661 procedure Say_Hello;
662 end Hello_Pkg;
663
664 `hello_pkg.adb':
665
666 with Ada.Text_IO;
667 package Hello_Pkg is
668 procedure Say_Hello
669 is begin
670 Ada.Text_IO.Put_Line ("Hello from hello_pkg.adb");
671 end Say_Hello;
672 end Hello_Pkg;
673
674 These are the same files from example 1; `hello_pkg.adb' has an
675 error on line 2.
676
677 In addition, create a directory `Example_3/Other', containing these
678 files:
679
680 `Other/hello_3.adb':
681
682 with Hello_Pkg;
683 with Ada.Text_IO; use Ada.Text_IO;
684 procedure Hello_3
685 is begin
686 Hello_Pkg.Say_Hello;
687 Put_Line ("From hello_3");
688 end Hello_3;
689
690 There are no errors in this file.
691
692 `Other/other.adp':
693
694 src_dir=..
695
696 Note that there must be no trailing spaces.
697
698 In buffer `hello_3.adb', invoke `Ada | Project files | Find and set
699 project...', and select `Example_3/Other/other.adp'. This tells Emacs
700 Ada mode to stop using the project file from `Example_2', and use the
701 one for `Example_3'. Also note that since this project file is not
702 named `hello_3.adp', it would not be found by default.
703
704 Then, again in `hello_3.adb', invoke `Ada | Set main and Build'. You
705 should get a `*compilation*' buffer containing something like (the
706 directory paths will be different):
707
708 cd c:/Examples/Example_3/Other/
709 gnatmake -o hello_3 hello_3 -g -cargs -I.. -bargs -largs
710 gcc -c -g -I.. hello_3.adb
711 gcc -c -I./ -g -I.. -I- C:\Examples\Example_3\hello_pkg.adb
712 hello_pkg.adb:2:08: keyword "body" expected here [see file name]
713 gnatmake: "C:\Examples\Example_3\hello_pkg.adb" compilation error
714
715 Compare the `-cargs' option to the compiler output in *note Set
716 compiler options::; this shows that `other.adp' is being used to set
717 the compiler options.
718
719 Move to the error with `C-x `'. Ada mode searches the list of
720 directories given by `src_dir' for the file mentioned in the compiler
721 error message.
722
723 Fixing the error, linking and running the code proceed as in *note
724 No project files::.
725
726 \1f
727 File: ada-mode.info, Node: Use GNAT project file, Next: Use multiple GNAT project files, Prev: Set source search path, Up: Compiling Examples
728
729 4.2.4 Use GNAT project file
730 ---------------------------
731
732 In this example, we show how to use a GNAT project file, with no Ada
733 mode project file.
734
735 Create the directory `Example_4', containing:
736
737 `hello_pkg.ads':
738
739 package Hello_Pkg is
740 procedure Say_Hello;
741 end Hello_Pkg;
742
743 `hello_pkg.adb':
744
745 with Ada.Text_IO;
746 package Hello_Pkg is
747 procedure Say_Hello
748 is begin
749 Ada.Text_IO.Put_Line ("Hello from hello_pkg.adb");
750 end Say_Hello;
751 end Hello_Pkg;
752
753 These are the same files from example 1; `hello_pkg.adb' has an
754 error on line 2.
755
756 In addition, create a directory `Example_4/Gnat_Project', containing
757 these files:
758
759 `Gnat_Project/hello_4.adb':
760
761 with Hello_Pkg;
762 with Ada.Text_IO; use Ada.Text_IO;
763 procedure Hello_4
764 is begin
765 Hello_Pkg.Say_Hello;
766 Put_Line ("From hello_4");
767 end Hello_4;
768
769 There are no errors in this file.
770
771 `Gnat_Project/hello_4.gpr':
772
773 project Hello_4 is
774 for Source_Dirs use (".", "..");
775 end Hello_4;
776
777 In buffer `hello_4.adb', invoke `Ada | Project | Load...', and
778 select `Example_4/Gnat_Project/hello_4.gpr'.
779
780 Then, again in `hello_4.adb', invoke `Ada | Set main and Build'. You
781 should get a `*compilation*' buffer containing something like (the
782 directory paths will be different):
783
784 -*- mode: compilation; default-directory: "c:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4/Gnat_Project/" -*-
785 Compilation started at Mon Oct 21 11:28:31
786
787 gnatmake -Pc:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4/Gnat_Project/hello_4.gpr -o hello_4 hello_4 -cargs -I. -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4/Gnat_Project -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4 -Ic:/Apps/GNAT-7.1.2/lib/gcc/i686-pc-mingw32/4.7.3/adainclude -bargs -largs
788 gcc -c -I. -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4/Gnat_Project -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4 -Ic:/Apps/GNAT-7.1.2/lib/gcc/i686-pc-mingw32/4.7.3/adainclude -I- -gnatA C:\Projects\org.emacs.ada-mode.stephe-1\test\Example_4\hello_pkg.adb
789 hello_pkg.adb:2:08: keyword "body" expected here [see file name]
790 gnatmake: "C:\Projects\org.emacs.ada-mode.stephe-1\test\Example_4\hello_pkg.adb" compilation error
791
792 Compilation exited abnormally with code 4 at Mon Oct 21 11:28:31
793
794 Compare the `gcc' options to the compiler output in *note Set
795 compiler options::; this shows that `hello_4.gpr' is being used to set
796 the compiler options.
797
798 Fixing the error, linking and running the code proceed as in *note
799 No project files::.
800
801 \1f
802 File: ada-mode.info, Node: Use multiple GNAT project files, Next: Use a Makefile, Prev: Use GNAT project file, Up: Compiling Examples
803
804 4.2.5 Use multiple GNAT project files
805 -------------------------------------
806
807 In this example, we show how to use multiple GNAT project files,
808 specifying the GNAT project search path in an Ada mode project file.
809
810 Create the directory `Example_4' as specified in *note Use GNAT
811 project file::.
812
813 Create the directory `Example_5', containing:
814
815 `hello_5.adb':
816
817 with Hello_Pkg;
818 with Ada.Text_IO; use Ada.Text_IO;
819 procedure Hello_5
820 is begin
821 Hello_Pkg.Say_Hello;
822 Put_Line ("From hello_5");
823 end Hello_5;
824
825 There are no errors in this file.
826
827 `hello_5.adp':
828
829 ada_project_path=../Example_4/Gnat_Project
830 gpr_file=hello_5.gpr
831
832 `hello_5.gpr':
833
834 with "hello_4";
835 project Hello_5 is
836 for Source_Dirs use (".");
837 package Compiler is
838 for Default_Switches ("Ada") use ("-g", "-gnatyt");
839 end Compiler;
840 end Hello_5;
841
842 In buffer `hello_5.adb', invoke `Ada | Project | Find and select
843 project...', and select `Example_5/hello_5.adp'. This would also be
844 found by default if no previous project file had been selected.
845
846 Then, again in `hello_5.adb', invoke `Ada | Build | Set main and
847 Build'. You should get a `*compilation*' buffer containing something
848 like (the directory paths will be different):
849
850 -*- mode: compilation; default-directory: "c:/Projects/org.emacs.ada-mode.stephe-1/test/Example_5/" -*-
851 Compilation started at Mon Oct 21 11:32:05
852
853 gnatmake -Pc:/Projects/org.emacs.ada-mode.stephe-1/test/Example_5/hello_5.gpr -o hello_5 hello_5 -cargs -I. -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_5 -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4/Gnat_Project -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4 -Ic:/Apps/GNAT-7.1.2/lib/gcc/i686-pc-mingw32/4.7.3/adainclude -bargs -largs
854 gcc -c -I. -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_5 -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4/Gnat_Project -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4 -Ic:/Apps/GNAT-7.1.2/lib/gcc/i686-pc-mingw32/4.7.3/adainclude -I- -gnatA C:\Projects\org.emacs.ada-mode.stephe-1\test\Example_4\hello_pkg.adb
855 hello_pkg.adb:2:08: keyword "body" expected here [see file name]
856 gnatmake: "C:\Projects\org.emacs.ada-mode.stephe-1\test\Example_4\hello_pkg.adb" compilation error
857
858 Compilation exited abnormally with code 4 at Mon Oct 21 11:32:05
859
860 Now type `C-x `'. `Example_4/hello_pkg.adb' is shown, demonstrating
861 that `hello_5.gpr' and `hello_4.gpr' are being used to set the
862 compilation search path.
863
864 \1f
865 File: ada-mode.info, Node: Use a Makefile, Prev: Use multiple GNAT project files, Up: Compiling Examples
866
867 4.2.6 Use a Makefile
868 --------------------
869
870 In this example, we show how to use a Makefile to build an Ada project
871 with GNAT, run the result, and clean the build directories.
872
873 Create the directories `Example_4, Example_5' as specified in *note
874 Use GNAT project file::, *note Use multiple GNAT project files::.
875
876 In `Example_5', add the file:
877
878 `Makefile':
879
880 # build and run hello_5 project
881
882 all : build run
883
884 .PHONY : force
885
886 build : force
887 gprbuild -Phello_5.gpr hello_5
888
889 run :
890 ./hello_5
891
892 clean :
893 gnatclean -r -Phello_5
894
895 export GPR_PROJECT_PATH = ../Example_4/Gnat_Project
896
897 # Local Variables:
898 # eval:(ada-parse-prj-file "hello_5.adp")
899 # eval:(ada-select-prj-file "hello_5.adp")
900 # End:
901
902 Close and re-open `Makefile'; the `Local Variables' section sets the
903 project file to `hello_5.adp' when the `Makefile' is opened. You can
904 also use <C-x C-e> to execute the select line after the `Makefile' is
905 opened, to change the project file back to `hello_5.adp'.
906
907 In `Makefile', invoke `Tools | Compile...', and accept the default
908 make command. This runs the `all' target, which builds `hello_5' and
909 runs it.
910
911 \1f
912 File: ada-mode.info, Node: Compiler errors, Prev: Compiling Examples, Up: Compiling Executing
913
914 4.3 Compiler errors
915 ===================
916
917 The `Check syntax' and `Build' commands, or running `make', place
918 compilation errors in a separate buffer named `*compilation*'.
919
920 Each line in this buffer will become active: you can simply click on
921 it with the middle button of the mouse, or move point to it and press
922 <RET>. Emacs will then display the relevant source file and put point
923 on the line and column where the error was found.
924
925 You can also press the `C-x `' key (`next-error'), and Emacs will
926 jump to the first error. If you press that key again, it will move you
927 to the second error, and so on.
928
929 Some error messages also include references to other files. These
930 references are accessed via `C-c `'.
931
932 \1f
933 File: ada-mode.info, Node: Project files, Next: Moving Through Ada Code, Prev: Compiling Executing, Up: Top
934
935 5 Project files
936 ***************
937
938 An Emacs Ada mode project file specifies what directories hold sources
939 for your project, and allows you to customize the compilation commands
940 and other things on a per-project basis.
941
942 The default file extension for Ada mode project files is `*.adp' or
943 `*.prj'. You can use a different extension by adding it to
944 `ada-prj-file-extensions', and a different syntax by adding a parser
945 function to `ada-prj-parser-alist'.
946
947 Note that Ada mode project files `*.adp' are different than GNAT
948 compiler project files `*.gpr'. However, Emacs Ada mode can use a GNAT
949 project file to specify the project directories. If no other
950 customization is needed, a GNAT project file can be used without an
951 Emacs Ada mode project file.
952
953 If no Emacs Ada mode project file is specified, some Ada mode
954 functions are not available.
955
956 * Menu:
957
958 * Project file overview::
959 * Project file variables::
960
961 \1f
962 File: ada-mode.info, Node: Project file overview, Next: Project file variables, Prev: Project files, Up: Project files
963
964 5.1 Project file overview
965 =========================
966
967 Project files have a simple syntax; they may be edited directly. Each
968 line specifies a project variable name and its value, separated by "="
969 (spaces not allowed):
970 src_dir=/Projects/my_project/src_1
971 src_dir=/Projects/my_project/src_2
972
973 Any line that does not have an "=" is a comment.
974
975 Some variables (like `src_dir') are lists; multiple occurrences are
976 concatenated.
977
978 There must be no space between the variable name and "=", and no
979 trailing spaces.
980
981 The current project file is given by the lisp variable
982 `ada-prj-default-project-file', and shown by the menu command <Ada |
983 Project Files | Show project>.
984
985 To set the project file, use the menu command `Ada | Set Project
986 ...', or the elisp functions `ada-parse-prj-file, ada-select-prj-file'.
987 The latter can be added to a Makefile:
988
989 # Local Variables:
990 # eval: (ada-parse-prj-file "ada-mode.prj")
991 # eval: (ada-select-prj-file ada-mode.prj")
992 # End:
993
994 You specify either a GNAT project file or an Emacs Ada mode project
995 file; if the file extension is `.gpr', the file is treated as a GNAT
996 project file. Extensions given by `ada-prj-file-extensions' (default
997 `.adp, .prj') are treated as an Emacs Ada mode project file.
998
999 After a project file is parsed, you can make it current again with
1000 just `ada-select-prj-file', or by selecting it from the menu.
1001
1002 \1f
1003 File: ada-mode.info, Node: Project file variables, Prev: Project file overview, Up: Project files
1004
1005 5.2 Project file variables
1006 ==========================
1007
1008 To set a project variable that is a list, specify each element of the
1009 list on a separate line in the project file.
1010
1011 Process environment variables can be referenced using the normal
1012 `$var' syntax.
1013
1014 Most project variables have defaults that can be changed by setting
1015 elisp variables; the table below identifies the elisp variable for each
1016 project variable. Elisp variables corresponding to project variables
1017 that are lists are elisp lists.
1018
1019 In general, project variables are evaluated when referenced in Emacs
1020 Ada mode commands. Relative file paths are expanded relative to the
1021 directory containing the project file.
1022
1023 Ada mode defines some project variables; others are defined by the
1024 compiler.
1025
1026 Here is the list of variables valid for all compilers. In the default
1027 values, the current directory `"."' is the directory containing the
1028 project file.
1029
1030 `ada_compiler' [default: `ada-compiler, gnat']
1031 Ada compiler for this project. It must occur in the project file
1032 before any compiler-specific project variable.
1033
1034 `auto_case' [default: `ada-auto-case, t']
1035 Non-nil means automatically change case of preceding word while
1036 typing.
1037
1038 `case_keyword' [default: `ada-case-keyword, downcase-word']
1039 Function to call to adjust the case of an Ada keywords.
1040
1041 `case_strict' [default: `ada-case-strict, t']
1042 If non-nil, force Mixed_Case for identifiers. Otherwise, allow
1043 UPPERCASE for identifiers.
1044
1045 `casing' [default: `ada-case-exception-file, nil']
1046 List of files containing casing exceptions. *Note Automatic
1047 casing::.
1048
1049 `el_file' [default: ]
1050 The value is a file name, which is loaded as an elisp file when the
1051 project file is parsed or selected. This allows setting Ada mode
1052 indentation variables, and any arbitrary elisp code used to
1053 customize the project.
1054
1055 `path_sep' [default: `path-separator']
1056 Separator character used in compiler search paths.
1057
1058 `src_dir' [default: `"."']
1059 A list of directories to search for source files.
1060
1061 `xref_tool' [default: `ada-xref-tool, gnat-xref']
1062 Cross reference tool for this project.
1063
1064
1065 The following variables are valid with the GNAT compiler:
1066
1067 `ada_project_path' [default: `""']
1068 A list of directories to search for GNAT project files.
1069
1070 If set, the `GPR_PROJECT_PATH' process environment variable is set
1071 to this value in the child process that runs GNAT tools. If not
1072 set, `GPR_PROJECT_PATH' in the child process is inherited from the
1073 Emacs process.
1074
1075 If you have the `GPR_PROJECT_PATH' or `ADA_PROJECT_PATH'
1076 environment variable set in the Emacs process correctly for all of
1077 your projects, you do not need to set this project variable.
1078
1079 The project search path can also be set in GNAT aggregate
1080 projects. However, the gnat tools do not make that path available
1081 to Emacs, so you must duplicate it in an Emacs Ada project file.
1082
1083 `gpr_file' [default: `""']
1084 The GNAT project file.
1085
1086 If set, the source and project directories specified in the GNAT
1087 project file are appended to `src_dir' and `ada_project_path'.
1088 This allows specifying Ada source directories with a GNAT project
1089 file, and other source directories with the Emacs project file.
1090
1091 `gpr_project_path' [default: `""']
1092 Same as `ada_project_path'.
1093
1094
1095 \1f
1096 File: ada-mode.info, Node: Moving Through Ada Code, Next: Identifier completion, Prev: Project files, Up: Top
1097
1098 6 Moving Through Ada Code
1099 *************************
1100
1101 There are several commands to navigate through Ada code. All these
1102 functions are available through the Ada menu and keybindings.
1103
1104 Some of these commands rely on cross reference facilities provided by
1105 the compiler; the standard Emacs Ada mode only supports the GNAT
1106 compiler, but others can be added (*note Other cross-reference::).
1107
1108 `C-c C-d'
1109 Move from any use of an identifier to its declaration, for from a
1110 declaration to its body (if there is one).
1111
1112 `C-c M-d'
1113 Move from a child type declaration to the parent type declaration;
1114 display a list of references if there is more than one parent.
1115
1116 `C-c C-n'
1117 Move to the next keyword in the current statement.
1118
1119 For example, if point is on `if', move to `then'.
1120
1121 `C-c C-p'
1122 Move to the previous keyword in the current statement.
1123
1124 For example, if point is on `then', move to `if'.
1125
1126 `C-c C-o'
1127 Switch between corresponding spec and body. There are several
1128 special cases:
1129
1130 * If the region is active, it is assumed to contain an Ada
1131 package name; position point on the corresponding package
1132 declaration.
1133
1134 * If point is in the start line of a top level child package
1135 declaration (but not package body), or a child subprogram
1136 spec or body, position point on the corresponding parent
1137 package declaration.
1138
1139 * If point is in the start line of a top level separate body,
1140 position point on the corresponding separate stub declaration.
1141
1142 * If point is in a subprogram declaration or body, position
1143 point on the corresponding body or declaration in the other
1144 file.
1145
1146 * If point is on a `with' clause, position point on the
1147 corresponding declaration.
1148
1149
1150 `C-c C-r'
1151 Show all references to the identifier surrounding point. Use `C-x
1152 `' (`next-error') to visit each reference (as for compilation
1153 errors).
1154
1155 `C-c C-x'
1156 Show all declarations that override the primitive procedure at
1157 point. Use `C-x `' (`next-error') to visit each reference (as for
1158 compilation errors).
1159
1160 `C-c M-x'
1161 Show the declaration that the declaration at point overrides.
1162
1163 `C-u SPACE'
1164 Jump back to the previous location.
1165
1166 `Ada | Misc | Refresh cross reference cache'
1167 Cross reference information is loaded from the compiler output when
1168 the first cross reference command is issued. If the code is
1169 recompiled after that, the cross reference information is reloaded
1170 by invoking this menu command.
1171
1172
1173 \1f
1174 File: ada-mode.info, Node: Identifier completion, Next: Indentation, Prev: Moving Through Ada Code, Up: Top
1175
1176 7 Identifier completion
1177 ***********************
1178
1179 Emacs provides a general way of completing identifiers: `M-/' (bound to
1180 `dabbrev-expand'). This is an easy way to type faster: you just have to
1181 type the first few letters of an identifier, and then loop through all
1182 the possible completions.
1183
1184 `M-/' works by parsing all open Ada files for possible completions.
1185
1186 For instance, if the words `my_identifier' and `my_subprogram' are
1187 the only words starting with `my' in any of the open Ada files, then
1188 you will have this scenario:
1189
1190 You type: myM-/
1191 Emacs inserts: `my_identifier'
1192 If you press M-/ once again, Emacs replaces `my_identifier' with
1193 `my_subprogram'.
1194 Pressing M-/ once more will bring you back to `my_identifier'.
1195
1196 This is a very fast way to do completion, and the casing of words
1197 will also be respected.
1198
1199 \1f
1200 File: ada-mode.info, Node: Indentation, Next: Statement skeletons, Prev: Identifier completion, Up: Top
1201
1202 8 Indentation
1203 *************
1204
1205 Ada mode comes with a full set of rules for automatic indentation. You
1206 can also configure the indentation, via the following variables:
1207
1208 `ada-indent' (default value: 3)
1209 Number of columns for default indentation.
1210
1211 `ada-indent-broken' (default value: 2)
1212 Number of columns to indent the continuation of a broken line.
1213
1214 `ada-indent-comment-col-0' (default value: nil)
1215 If non-nil, comments currently starting in column 0 are left in
1216 column 0. Otherwise, they are indented with previous comments or
1217 code.
1218
1219 `ada-indent-label' (default value: -3)
1220 Number of columns to indent a label.
1221
1222 `ada-indent-record-rel-type' (default value: 3)
1223 Indentation for `record' relative to `type' or `use'.
1224
1225 `ada-indent-renames' (default value: 2)
1226 Indentation for `renames' relative to the matching subprogram
1227 keyword.
1228
1229 If the subprogram has parameters then if `ada-indent-renames' is
1230 zero or less the indentation is abs `ada-indent-renames' relative
1231 to the open parenthesis; if `ada-indent-renames' is one or more
1232 the indentation is relative to the line containing the keyword.
1233
1234 If the subprogram has no parameters then `ada-indent-broken' the
1235 indentation is relative to the indentation of the line containing
1236 the keyword.
1237
1238 `ada-indent-return' (default value: 0)
1239 Indentation for `return' relative to the matching `function'.
1240
1241 If the function has parameters, then if `ada-indent-return' is
1242 zero or less the indentation is abs `ada-indent-return' relative
1243 to the open parenthesis; if `ada-indent-return' is one or more,
1244 indentation is relative to line containing `function'.
1245
1246 If the function has no parameters, `ada-indent-broken' is used
1247 relative to line containing `function'.
1248
1249 `ada-indent-use' (default value: ada-indent-broken)
1250 Indentation for the lines in a `use' statement.
1251
1252 `ada-indent-when' (default value: 3)
1253 Indentation for `when' relative to `exception', `case', or `or' in
1254 `select'.
1255
1256 `ada-indent-with' (default value: ada-indent-broken)
1257 Indentation for the lines in a `with' context clause.
1258
1259
1260 The indentation variables are buffer local; the global value may be
1261 overridden in an elisp file invoked by an `el_file' Emacs Ada mode
1262 project file statement, or in a file local variable section.
1263
1264 The following keys indent portions of the text:
1265 `RET'
1266 Insert and indent a new line.
1267
1268 `TAB'
1269 Indent the current line, or the current region.
1270
1271 `C-c TAB'
1272 Indent the current statement or declaration.
1273
1274
1275 The indentation algorithm relies on a grammar parser to identify the
1276 syntactic role for keywords and other words in the code. If the code is
1277 accepted by the parser, the indentation is done according to the rules
1278 in the indentation engine.
1279
1280 If the code is not accepted (because it is partially complete during
1281 editing), the indentation engine falls back to the trivial algorithm of
1282 indenting each new line the same as the previous line. Once enough new
1283 text has been entered to make the code acceptable to the parser, the
1284 statement or declaration is properly indented.
1285
1286 For example, if you are entering this code:
1287
1288 if A then
1289 B;
1290 end if;
1291
1292 when you type `RET B', `B' is indented to the same column as `if',
1293 because the parser does not find `end if;'. Then when you type the
1294 final `;' followed by <TAB>, all three lines are indented, putting `B'
1295 where it belongs.
1296
1297 To be more user friendly, the parser accepts a superset of the Ada
1298 grammer. For example, the parser accepts this code for an `if'
1299 statement:
1300
1301 if then
1302 end if;
1303
1304 In general, any sequence of statements, and many expressions, may be
1305 omitted.
1306
1307 One way to easily insert empty statements like this is using *note
1308 Statement skeletons::.
1309
1310 In rare cases, the parser gets confused; it can be reset by invoking
1311 menu <Ada | Misc | Reset parser>. Please report such cases as a bug.
1312
1313 \1f
1314 File: ada-mode.info, Node: Statement skeletons, Next: Aligning code, Prev: Indentation, Up: Top
1315
1316 9 Statement skeletons
1317 *********************
1318
1319 `C-c C-e' expands the previous one or two words into a statment
1320 skeleton. For example, `i f C-c C-e' expands to:
1321
1322 if then
1323 elsif then
1324 else
1325 end if;
1326
1327 All skeleton expansions are accepted by the indentation parser, so
1328 this is a convenient way to insert statements with correct indentation.
1329
1330 For named statements (packages, loops, etc), the name is taken from
1331 the word before point, and the name of the statement from the word
1332 before that. Some expansions prompt for more information, such as
1333 whether a spec or body is desired. For example, `package A_Package C-c
1334 C-e' first prompts for "body" or "spec". If "spec" is selected, the
1335 following code is inserted:
1336
1337 package A_Package is
1338 private
1339 end A_Package;
1340
1341 Named blocks work similarly: `declare A_Block C-c C-e' expands
1342 (without prompting) to:
1343
1344 A_Block:
1345 declare
1346 begin
1347 exception
1348 end A_Block;
1349
1350 Note that the order of the keyword `declare' and the name `A_Block'
1351 are reversed in the expansion; this may take some getting used to.
1352
1353 \1f
1354 File: ada-mode.info, Node: Aligning code, Next: Automatic casing, Prev: Statement skeletons, Up: Top
1355
1356 10 Aligning code
1357 ****************
1358
1359 Aligning code adds space in each line so that similar parts of
1360 successive lines are aligned vertically. For example, a sequence of
1361 declarations:
1362
1363 A : Integer;
1364 Another : Float := 1.0;
1365 More : Integer := 2;
1366
1367 changes to this when aligned:
1368
1369 A : Integer;
1370 Another : Float := 1.0;
1371 More : Integer := 2;
1372
1373 Alignment is invoked by `C-c C-a', which aligns the sequence of
1374 statements surrounding point, or within the selected region.
1375
1376 Parameter lists are also aligned:
1377
1378 procedure Foo
1379 (A : in Integer;
1380 Another : out Float := 1.0;
1381 More : in out Integer := 2);
1382
1383 is aligned to:
1384
1385 procedure Foo
1386 (A : in Integer;
1387 Another : out Float := 1.0;
1388 More : in out Integer := 2);
1389
1390 \1f
1391 File: ada-mode.info, Node: Automatic casing, Next: Comment Handling, Prev: Aligning code, Up: Top
1392
1393 11 Automatic casing
1394 *******************
1395
1396 Casing of identifiers, attributes and keywords is automatically
1397 performed while typing when the variable `ada-auto-case' is non-nil
1398 (the default). Every time you type a word separator, the previous word
1399 is automatically cased.
1400
1401 You can customize the automatic casing with the following variables:
1402
1403 `ada-case-keyword'
1404 Value must be one of:
1405 `downcase-word'
1406 Ada keywords will be lowercase.
1407
1408 `upcase-word'
1409 Ada keywords will be uppercase.
1410
1411 `ada-case-strict'
1412 If non-nil, all identifiers are forced to `Mixed_Case'; first
1413 letter, and letter following "_" are uppercase; rest are lowercase.
1414
1415 If nil, the mixed case characters in identifiers are forced to
1416 upper case, but the other characters are not modified. That allows
1417 typing all uppercase identifiers without defining a casing
1418 exception.
1419
1420 You can define exceptions to these rules, in files specified by the
1421 variable `ada-case-exception-file'. Each line in a case exception file
1422 specifies the casing of one word or word fragment. If an exception is
1423 defined in multiple files, the first occurrence is used.
1424
1425 If the word starts with an asterisk (`*'), it defines the casing of
1426 a word fragemnt (or "substring"); part of a word between two
1427 underscores or word boundary.
1428
1429 For example:
1430
1431 DOD
1432 *IO
1433 GNAT
1434
1435 The word fragment `*IO' applies to any word containing "_io";
1436 `Text_IO', `Hardware_IO', etc.
1437
1438 There are two ways to add new items to this file: you can simply edit
1439 it as you would edit any text file. Or you can position point on the
1440 word you want to add, and select menu `Ada | Casing | Create full
1441 exception' or `Ada | Casing | Create partial exception'. The word will
1442 be added to the current list of exceptions and to the file.
1443
1444 It is sometimes useful to have multiple exception files. For
1445 example, one could be the standard Ada acronyms, the second some
1446 company specific exceptions, and the last one some project specific
1447 exceptions. If you set up the variable `ada-case-exception-file' as a
1448 list of files, each of them will be parsed and used in your emacs
1449 session. When you create a new exception, you are prompted for the file
1450 to save it in.
1451
1452 Other keys and menu entries are defined:
1453
1454 `C-c C-w'
1455 Adjust case of the word at point. With prefix arg, adjust case
1456 even if in comment. Normally, comments are not affected by case
1457 adjust.
1458
1459 `Ada | Casing | Adjust case region'
1460 Adjust case in the active region.
1461
1462 `Ada | Casing | Adjust case buffer'
1463 Adjust case in the active buffer.
1464
1465
1466 \1f
1467 File: ada-mode.info, Node: Comment Handling, Next: Key summary, Prev: Automatic casing, Up: Top
1468
1469 12 Comment Handling
1470 *******************
1471
1472 By default, comment lines get indented like Ada code. There are a few
1473 additional functions to handle comments:
1474
1475 `M-;'
1476 If the region is active, comment or uncomment it.
1477
1478 If the current line is empty, start a comment.
1479
1480 Otherwise, add a comment at the end of the line, in a column given
1481 by `comment-column'.
1482
1483 `M-q'
1484 Fill the current comment paragraph.
1485
1486 \1f
1487 File: ada-mode.info, Node: Key summary, Next: Developer overview, Prev: Comment Handling, Up: Top
1488
1489 13 Key summary
1490 **************
1491
1492 This table summarizes the keys described in this manual. Other keys are
1493 bound by Ada mode; see <C-h b> for a complete list. The Ada menu also
1494 displays keys bound to menu operations.
1495
1496 `M-/'
1497 *Note Identifier completion::. Complete the word before point;
1498 repeat to cycle thru possible completions.
1499
1500 `M-;'
1501 *Note Comment Handling::. If the region is active, comment or
1502 uncomment it.
1503
1504 `M-q'
1505 *Note Comment Handling::. Fill the current comment paragraph.
1506
1507 `RET'
1508 *Note Indentation::. Insert and indent a new line.
1509
1510 `TAB'
1511 *Note Indentation::. Indent the current line, or the current
1512 region.
1513
1514 `C-c TAB'
1515 *Note Indentation::. Indent the current statement or declaration.
1516
1517 `C-c `'
1518 *Note Compiler errors::. Move to the location of the secondary
1519 reference in the current compilation error.
1520
1521 `C-c C-a'
1522 *Note Aligning code::. Align code.
1523
1524 `C-c C-c'
1525 *Note Compile commands::. Build the current main program.
1526
1527 `C-c C-d'
1528 *Note Moving Through Ada Code::. Move from any use of an
1529 identifier to its declaration, for from a declaration to its body.
1530
1531 `C-c M-d'
1532 *Note Moving Through Ada Code::. Move from a child type
1533 declaration to the parent type declaration.
1534
1535 `C-c C-e'
1536 *Note Statement skeletons::. Expand previous one or two words
1537 into a statement or declaration skeleton.
1538
1539 `C-c C-c'
1540 *Note Compile commands::. Build the current file.
1541
1542 `C-c C-n'
1543 *Note Moving Through Ada Code::. Move to the next keyword in the
1544 current statement.
1545
1546 `C-c C-o'
1547 *Note Moving Through Ada Code::. Switch between corresponding
1548 spec and body, or find other spec.
1549
1550 `C-c C-p'
1551 *Note Moving Through Ada Code::. Move to the previous keyword in
1552 the current statement.
1553
1554 `C-c C-r'
1555 *Note Moving Through Ada Code::. Show all references to the
1556 identifier surrounding point.
1557
1558 `C-c C-w'
1559 *Note Automatic casing::. Adjust case of the word at point. With
1560 prefix arg, adjust case even if in comment.
1561
1562 `C-c C-x'
1563 *Note Moving Through Ada Code::. Show all declarations that
1564 override the primitive procedure at point.
1565
1566 `C-c C-y'
1567 *Note Automatic casing::. Create case exception.
1568
1569 `C-c `'
1570 *Note Compiler errors::. Move to the location of the next
1571 secondary compilation error.
1572
1573 `C-x `'
1574 *Note Compiler errors::. Move to the location of the next
1575 compilation error or show result.
1576
1577 `M-q'
1578 *Note Comment Handling::. Fill the current comment paragraph.
1579
1580
1581 \1f
1582 File: ada-mode.info, Node: Developer overview, Next: GNU Free Documentation License, Prev: Key summary, Up: Top
1583
1584 14 Developer overview
1585 *********************
1586
1587 If you'd like to contribute to Ada mode, or just understand the
1588 sources, here's an overview.
1589
1590 * Menu:
1591
1592 * Directory structure::
1593 * Package organization::
1594 * OpenToken::
1595 * ELPA::
1596
1597 \1f
1598 File: ada-mode.info, Node: Directory structure, Next: Package organization, Prev: Developer overview, Up: Developer overview
1599
1600 14.1 Directory structure
1601 ========================
1602
1603 `org.emacs.ada-mode'
1604 Main source.
1605
1606 File extensions:
1607 `*.el'
1608 Elisp files; main code.
1609
1610 `*.elc'
1611 Byte-compiled elisp files, not in the distribution. Generated
1612 by the Makefile target `byte-compile', or by the Emacs
1613 package installer.
1614
1615 Compiling the parse tables (`*-wy.el') speeds up loading them
1616 significantly. Compiling other files speeds up parsing, but
1617 not noticeably.
1618
1619 One reason to byte-compile files is to find errors; the byte
1620 compiler reports undefined variables, wrong argument counts,
1621 etc.
1622
1623 `*-wy.el'
1624 Parse tables, generated from the corresponding grammar `*.wy'
1625 by the OpenToken tool `wisi-generate.exe'. These are in the
1626 tarball distribution and the monotone repository so users and
1627 Elisp developers don't have to install OpenToken.
1628
1629 `*-wy.output'
1630 Diagnostic output from `wisi-generate.exe', useful for tracing
1631 parses while debugging a grammar issue. Not in the tarball
1632 distribution or the monotone repository.
1633
1634 `*.wy'
1635 Grammar files, specifying the language to be parsed. The
1636 syntax for these grammar files is similar to that for bison
1637 and wisent, but not the same; see the OpenToken documentation
1638 for more info.
1639
1640 The wisi parser (in `wisi-parse.el') is a generalized LALR
1641 parser, so it tolerates some conflicts and ambiguities. This
1642 makes the grammars easier to write, and in particular makes
1643 it possible to let the Ada grammar closely match Annex P of
1644 the Ada Language Reference Manual (the syntax summary).
1645
1646 `*.texi'
1647 Texinfo source for the user guides.
1648
1649 `*.html'
1650 Generated user guide in HTML format.
1651
1652 `*.info'
1653 Generated user guide in Emacs info format.
1654
1655
1656 `build'
1657 Makefile for building the user guides, publishing to the web page
1658 or Gnu ELPA. Test drivers.
1659
1660 `build/wisi'
1661 Makefile for building and testing with the wisi-based parser.
1662 Separate from `build', because there used to be a SMIE-based
1663 parser, and there might be another parser someday.
1664
1665 The emacs used to byte-compile and run tests is given by the 'make'
1666 variable EMACS_EXE, which defaults to 'emacs'; it can be
1667 overridden on the make command line or by an environment variable.
1668
1669 `test'
1670 All tests for Ada mode, gpr mode, parser.
1671
1672 Each test is run in a separate invocation of Emacs, so it is
1673 completely independent of all other tests.
1674
1675 The tests are driven by the elisp code in `build/*.el'.
1676
1677 In general, the Ada mode tests open the file, execute test actions,
1678 re-indent, and re-captialize the entire file. The result is diffed
1679 with the original, and must match.
1680
1681 The test actions are defined by comments with the prefix
1682 `--EMACSCMD:'; they are elisp forms that invoke Ada mode
1683 functions. This is used to test navigation features and other
1684 parser effects.
1685
1686 `test/Example_*'
1687 Starting files for examples in user guide.
1688
1689 `test/gpr'
1690 Tests for gpr mode.
1691
1692 `test/subdir'
1693 More tests; allows testing path search features.
1694
1695 `test/wisi'
1696 Tests of the elisp wisi grammar compiler and parser.
1697
1698 \1f
1699 File: ada-mode.info, Node: Package organization, Next: OpenToken, Prev: Directory structure, Up: Developer overview
1700
1701 14.2 Package organization
1702 =========================
1703
1704 * Menu:
1705
1706 * Ada mode::
1707 * gpr mode::
1708 * GNAT core::
1709 * Wisi::
1710
1711 \1f
1712 File: ada-mode.info, Node: Ada mode, Next: gpr mode, Prev: Package organization, Up: Package organization
1713
1714 14.2.1 Ada mode
1715 ---------------
1716
1717 Ada mode consists of all files with `ada-' prefix in the file name.
1718
1719 `ada-mode.el'
1720 The main file, implementing the keymap, menu, and top level
1721 functionality.
1722
1723 It allows for different backend implementations for compiling,
1724 cross-referencing, and indenting. The functions for each of these
1725 backends dispatch thru global variables that are set by Emacs Ada
1726 mode project files. They default to the GNAT compiler, the
1727 gnatxref cross reference tool, and the ada-wisi indentation engine.
1728
1729 `ada-build.el'
1730 Provides functions for compiling Ada files without a Makefile (or
1731 similar tool).
1732
1733 `ada-fix-error.el'
1734 Provides an interface to utilities for automatically fixing errors
1735 reported by the compiler. It dispatches to a compiler-specific
1736 backend.
1737
1738 `ada-gnat-compile.el'
1739 Implements the Ada mode compiler functions for the GNAT compiler.
1740
1741 `ada-gnat-xref.el'
1742 Implements the Ada mode cross reference functions for the GNAT
1743 compiler.
1744
1745 `ada-grammar.*'
1746 The Ada language grammar, and files generated from it by the
1747 OpenToken tool `wisi-generate.exe'.
1748
1749 `ada-indent-user-options.el'
1750 All user-settable options for the Ada indentation engine.
1751
1752 `ada-mode-compat-23.4.el'
1753 Defines functions used by Ada mode that are not in Emacs 23.4.
1754
1755 Emacs Ada mode is written for Emacs 24.3. Emacs version 23.4 is
1756 partially supported. Earlier versions of Emacs are not supported.
1757
1758 `ada-mode.texi'
1759 The Ada mode user guide source and compiled versions.
1760
1761 `ada-skel.el'
1762 Skeletons for expansion of Ada syntax (*note Statement
1763 skeletons::). Extends the Emacs skeleton functions with "tokens",
1764 inspired by the lamented Else package (which was inspired by DEC
1765 LSE).
1766
1767 `ada-wisi-opentoken.el'
1768 Indentation functions useful when editing OpenToken code; an
1769 example of extending the Ada mode indentation engine for special
1770 circumstances.
1771
1772 `ada-wisi.el'
1773 Implements the Ada mode indentation functions for the wisi
1774 indentation engine backend.
1775
1776
1777 \1f
1778 File: ada-mode.info, Node: gpr mode, Next: GNAT core, Prev: Ada mode, Up: Package organization
1779
1780 14.2.2 gpr mode
1781 ---------------
1782
1783 gpr mode consists of all files with `gpr-' prefix in the file name. The
1784 functions in each file are similar to the similarly-named Ada mode
1785 files.
1786
1787 \1f
1788 File: ada-mode.info, Node: GNAT core, Next: Wisi, Prev: gpr mode, Up: Package organization
1789
1790 14.2.3 GNAT core
1791 ----------------
1792
1793 `gnat-core.el'
1794 GNAT is actually a multi-language tool; it builds on top of the
1795 multi-language gcc.
1796
1797 `gnat-core.el' is a start at a language-agnostic interface to the
1798 GNAT tools. It was first factored out from `ada-gnat.el' and
1799 `ada-mode.el' to support the multi-language `gnat-inspect.el',
1800 which is still experimental.
1801
1802 More code currently in `ada-mode.el' could be migrated to
1803 `gnat-core.el', in particular the project file support.
1804
1805 `gnat-inspect.el'
1806 Provides an experimental interface to the experimental
1807 multi-language cross-reference tool `gnatinspect' from AdaCore,
1808 which will supercede `gnatxref'.
1809
1810 Implements the Ada mode cross-reference functions for the
1811 `gnatinspect' backend, and a minor mode providing similar
1812 functions for C++.
1813
1814
1815 \1f
1816 File: ada-mode.info, Node: Wisi, Prev: GNAT core, Up: Package organization
1817
1818 14.2.4 Wisi
1819 -----------
1820
1821 The "wisi" parser. "wisi" used to be an acronym, but now it's just a
1822 name.
1823
1824 `wisi.el'
1825 Implements the lexer, the main parser driver, parser actions that
1826 cache parser information in text properties, utilities for
1827 indenting and navigating using the cached information, and general
1828 setup.
1829
1830 `wisi-compile.el'
1831 Implements the parse table compiler. `wisi-generate.exe' processes
1832 the grammar source `*.wy' into an elisp source representation of a
1833 parse table `*-wy.el'. That is compiled into an internal structure
1834 containing the state transitions and executable actions. The
1835 actions can be any elisp form; the intent is that they be calls to
1836 the action functions provided by `wisi.el'. `wisi-compile.el' uses
1837 some features provided by `semantic'.
1838
1839 `wisi-parse.el'
1840 Implements the generalized LALR parser.
1841
1842 \1f
1843 File: ada-mode.info, Node: OpenToken, Next: ELPA, Prev: Package organization, Up: Developer overview
1844
1845 14.3 OpenToken
1846 ==============
1847
1848 Ada mode uses the OpenToken tool `wisi-generate.exe' to process the
1849 grammar sources into elisp parse tables. See
1850 `http://stephe-leake.org/emacs/ada-mode/emacs-ada-mode.html' for
1851 current information about which version of OpenToken is required, and
1852 how to get it.
1853
1854 The Makefile variable `WISI_OPENTOKEN' gives the path to the build
1855 directory for OpenToken; you probably need to override it with an
1856 external environment variable or on the `make' command line.
1857
1858 \1f
1859 File: ada-mode.info, Node: ELPA, Prev: OpenToken, Up: Developer overview
1860
1861 14.4 ELPA
1862 =========
1863
1864 Ada mode is published via the Gnu ELPA archive. To test a new version
1865 of Ada mode, we use a local Gnu ELPA archive. That requires fetching
1866 Gnu ELPA via git:
1867
1868 cd /Projects
1869 git clone git://git.savannah.gnu.org/emacs/elpa.git
1870
1871 If you have an Emacs Savannah developer account, you can use:
1872
1873 cd /Projects
1874 git clone <login>@git.savannah.gnu.org/emacs/elpa.git
1875
1876 `build/Makefile' contains targets for copying Ada mode source to the
1877 elpa workspace, and for building the elpa archive there.
1878
1879 \1f
1880 File: ada-mode.info, Node: GNU Free Documentation License, Next: Index, Prev: Developer overview, Up: Top
1881
1882 Appendix A GNU Free Documentation License
1883 *****************************************
1884
1885 Version 1.3, 3 November 2008
1886
1887 Copyright (C) 2000, 2001, 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
1888 `http://fsf.org/'
1889
1890 Everyone is permitted to copy and distribute verbatim copies
1891 of this license document, but changing it is not allowed.
1892
1893 0. PREAMBLE
1894
1895 The purpose of this License is to make a manual, textbook, or other
1896 functional and useful document "free" in the sense of freedom: to
1897 assure everyone the effective freedom to copy and redistribute it,
1898 with or without modifying it, either commercially or
1899 noncommercially. Secondarily, this License preserves for the
1900 author and publisher a way to get credit for their work, while not
1901 being considered responsible for modifications made by others.
1902
1903 This License is a kind of "copyleft", which means that derivative
1904 works of the document must themselves be free in the same sense.
1905 It complements the GNU General Public License, which is a copyleft
1906 license designed for free software.
1907
1908 We have designed this License in order to use it for manuals for
1909 free software, because free software needs free documentation: a
1910 free program should come with manuals providing the same freedoms
1911 that the software does. But this License is not limited to
1912 software manuals; it can be used for any textual work, regardless
1913 of subject matter or whether it is published as a printed book.
1914 We recommend this License principally for works whose purpose is
1915 instruction or reference.
1916
1917 1. APPLICABILITY AND DEFINITIONS
1918
1919 This License applies to any manual or other work, in any medium,
1920 that contains a notice placed by the copyright holder saying it
1921 can be distributed under the terms of this License. Such a notice
1922 grants a world-wide, royalty-free license, unlimited in duration,
1923 to use that work under the conditions stated herein. The
1924 "Document", below, refers to any such manual or work. Any member
1925 of the public is a licensee, and is addressed as "you". You
1926 accept the license if you copy, modify or distribute the work in a
1927 way requiring permission under copyright law.
1928
1929 A "Modified Version" of the Document means any work containing the
1930 Document or a portion of it, either copied verbatim, or with
1931 modifications and/or translated into another language.
1932
1933 A "Secondary Section" is a named appendix or a front-matter section
1934 of the Document that deals exclusively with the relationship of the
1935 publishers or authors of the Document to the Document's overall
1936 subject (or to related matters) and contains nothing that could
1937 fall directly within that overall subject. (Thus, if the Document
1938 is in part a textbook of mathematics, a Secondary Section may not
1939 explain any mathematics.) The relationship could be a matter of
1940 historical connection with the subject or with related matters, or
1941 of legal, commercial, philosophical, ethical or political position
1942 regarding them.
1943
1944 The "Invariant Sections" are certain Secondary Sections whose
1945 titles are designated, as being those of Invariant Sections, in
1946 the notice that says that the Document is released under this
1947 License. If a section does not fit the above definition of
1948 Secondary then it is not allowed to be designated as Invariant.
1949 The Document may contain zero Invariant Sections. If the Document
1950 does not identify any Invariant Sections then there are none.
1951
1952 The "Cover Texts" are certain short passages of text that are
1953 listed, as Front-Cover Texts or Back-Cover Texts, in the notice
1954 that says that the Document is released under this License. A
1955 Front-Cover Text may be at most 5 words, and a Back-Cover Text may
1956 be at most 25 words.
1957
1958 A "Transparent" copy of the Document means a machine-readable copy,
1959 represented in a format whose specification is available to the
1960 general public, that is suitable for revising the document
1961 straightforwardly with generic text editors or (for images
1962 composed of pixels) generic paint programs or (for drawings) some
1963 widely available drawing editor, and that is suitable for input to
1964 text formatters or for automatic translation to a variety of
1965 formats suitable for input to text formatters. A copy made in an
1966 otherwise Transparent file format whose markup, or absence of
1967 markup, has been arranged to thwart or discourage subsequent
1968 modification by readers is not Transparent. An image format is
1969 not Transparent if used for any substantial amount of text. A
1970 copy that is not "Transparent" is called "Opaque".
1971
1972 Examples of suitable formats for Transparent copies include plain
1973 ASCII without markup, Texinfo input format, LaTeX input format,
1974 SGML or XML using a publicly available DTD, and
1975 standard-conforming simple HTML, PostScript or PDF designed for
1976 human modification. Examples of transparent image formats include
1977 PNG, XCF and JPG. Opaque formats include proprietary formats that
1978 can be read and edited only by proprietary word processors, SGML or
1979 XML for which the DTD and/or processing tools are not generally
1980 available, and the machine-generated HTML, PostScript or PDF
1981 produced by some word processors for output purposes only.
1982
1983 The "Title Page" means, for a printed book, the title page itself,
1984 plus such following pages as are needed to hold, legibly, the
1985 material this License requires to appear in the title page. For
1986 works in formats which do not have any title page as such, "Title
1987 Page" means the text near the most prominent appearance of the
1988 work's title, preceding the beginning of the body of the text.
1989
1990 The "publisher" means any person or entity that distributes copies
1991 of the Document to the public.
1992
1993 A section "Entitled XYZ" means a named subunit of the Document
1994 whose title either is precisely XYZ or contains XYZ in parentheses
1995 following text that translates XYZ in another language. (Here XYZ
1996 stands for a specific section name mentioned below, such as
1997 "Acknowledgements", "Dedications", "Endorsements", or "History".)
1998 To "Preserve the Title" of such a section when you modify the
1999 Document means that it remains a section "Entitled XYZ" according
2000 to this definition.
2001
2002 The Document may include Warranty Disclaimers next to the notice
2003 which states that this License applies to the Document. These
2004 Warranty Disclaimers are considered to be included by reference in
2005 this License, but only as regards disclaiming warranties: any other
2006 implication that these Warranty Disclaimers may have is void and
2007 has no effect on the meaning of this License.
2008
2009 2. VERBATIM COPYING
2010
2011 You may copy and distribute the Document in any medium, either
2012 commercially or noncommercially, provided that this License, the
2013 copyright notices, and the license notice saying this License
2014 applies to the Document are reproduced in all copies, and that you
2015 add no other conditions whatsoever to those of this License. You
2016 may not use technical measures to obstruct or control the reading
2017 or further copying of the copies you make or distribute. However,
2018 you may accept compensation in exchange for copies. If you
2019 distribute a large enough number of copies you must also follow
2020 the conditions in section 3.
2021
2022 You may also lend copies, under the same conditions stated above,
2023 and you may publicly display copies.
2024
2025 3. COPYING IN QUANTITY
2026
2027 If you publish printed copies (or copies in media that commonly
2028 have printed covers) of the Document, numbering more than 100, and
2029 the Document's license notice requires Cover Texts, you must
2030 enclose the copies in covers that carry, clearly and legibly, all
2031 these Cover Texts: Front-Cover Texts on the front cover, and
2032 Back-Cover Texts on the back cover. Both covers must also clearly
2033 and legibly identify you as the publisher of these copies. The
2034 front cover must present the full title with all words of the
2035 title equally prominent and visible. You may add other material
2036 on the covers in addition. Copying with changes limited to the
2037 covers, as long as they preserve the title of the Document and
2038 satisfy these conditions, can be treated as verbatim copying in
2039 other respects.
2040
2041 If the required texts for either cover are too voluminous to fit
2042 legibly, you should put the first ones listed (as many as fit
2043 reasonably) on the actual cover, and continue the rest onto
2044 adjacent pages.
2045
2046 If you publish or distribute Opaque copies of the Document
2047 numbering more than 100, you must either include a
2048 machine-readable Transparent copy along with each Opaque copy, or
2049 state in or with each Opaque copy a computer-network location from
2050 which the general network-using public has access to download
2051 using public-standard network protocols a complete Transparent
2052 copy of the Document, free of added material. If you use the
2053 latter option, you must take reasonably prudent steps, when you
2054 begin distribution of Opaque copies in quantity, to ensure that
2055 this Transparent copy will remain thus accessible at the stated
2056 location until at least one year after the last time you
2057 distribute an Opaque copy (directly or through your agents or
2058 retailers) of that edition to the public.
2059
2060 It is requested, but not required, that you contact the authors of
2061 the Document well before redistributing any large number of
2062 copies, to give them a chance to provide you with an updated
2063 version of the Document.
2064
2065 4. MODIFICATIONS
2066
2067 You may copy and distribute a Modified Version of the Document
2068 under the conditions of sections 2 and 3 above, provided that you
2069 release the Modified Version under precisely this License, with
2070 the Modified Version filling the role of the Document, thus
2071 licensing distribution and modification of the Modified Version to
2072 whoever possesses a copy of it. In addition, you must do these
2073 things in the Modified Version:
2074
2075 A. Use in the Title Page (and on the covers, if any) a title
2076 distinct from that of the Document, and from those of
2077 previous versions (which should, if there were any, be listed
2078 in the History section of the Document). You may use the
2079 same title as a previous version if the original publisher of
2080 that version gives permission.
2081
2082 B. List on the Title Page, as authors, one or more persons or
2083 entities responsible for authorship of the modifications in
2084 the Modified Version, together with at least five of the
2085 principal authors of the Document (all of its principal
2086 authors, if it has fewer than five), unless they release you
2087 from this requirement.
2088
2089 C. State on the Title page the name of the publisher of the
2090 Modified Version, as the publisher.
2091
2092 D. Preserve all the copyright notices of the Document.
2093
2094 E. Add an appropriate copyright notice for your modifications
2095 adjacent to the other copyright notices.
2096
2097 F. Include, immediately after the copyright notices, a license
2098 notice giving the public permission to use the Modified
2099 Version under the terms of this License, in the form shown in
2100 the Addendum below.
2101
2102 G. Preserve in that license notice the full lists of Invariant
2103 Sections and required Cover Texts given in the Document's
2104 license notice.
2105
2106 H. Include an unaltered copy of this License.
2107
2108 I. Preserve the section Entitled "History", Preserve its Title,
2109 and add to it an item stating at least the title, year, new
2110 authors, and publisher of the Modified Version as given on
2111 the Title Page. If there is no section Entitled "History" in
2112 the Document, create one stating the title, year, authors,
2113 and publisher of the Document as given on its Title Page,
2114 then add an item describing the Modified Version as stated in
2115 the previous sentence.
2116
2117 J. Preserve the network location, if any, given in the Document
2118 for public access to a Transparent copy of the Document, and
2119 likewise the network locations given in the Document for
2120 previous versions it was based on. These may be placed in
2121 the "History" section. You may omit a network location for a
2122 work that was published at least four years before the
2123 Document itself, or if the original publisher of the version
2124 it refers to gives permission.
2125
2126 K. For any section Entitled "Acknowledgements" or "Dedications",
2127 Preserve the Title of the section, and preserve in the
2128 section all the substance and tone of each of the contributor
2129 acknowledgements and/or dedications given therein.
2130
2131 L. Preserve all the Invariant Sections of the Document,
2132 unaltered in their text and in their titles. Section numbers
2133 or the equivalent are not considered part of the section
2134 titles.
2135
2136 M. Delete any section Entitled "Endorsements". Such a section
2137 may not be included in the Modified Version.
2138
2139 N. Do not retitle any existing section to be Entitled
2140 "Endorsements" or to conflict in title with any Invariant
2141 Section.
2142
2143 O. Preserve any Warranty Disclaimers.
2144
2145 If the Modified Version includes new front-matter sections or
2146 appendices that qualify as Secondary Sections and contain no
2147 material copied from the Document, you may at your option
2148 designate some or all of these sections as invariant. To do this,
2149 add their titles to the list of Invariant Sections in the Modified
2150 Version's license notice. These titles must be distinct from any
2151 other section titles.
2152
2153 You may add a section Entitled "Endorsements", provided it contains
2154 nothing but endorsements of your Modified Version by various
2155 parties--for example, statements of peer review or that the text
2156 has been approved by an organization as the authoritative
2157 definition of a standard.
2158
2159 You may add a passage of up to five words as a Front-Cover Text,
2160 and a passage of up to 25 words as a Back-Cover Text, to the end
2161 of the list of Cover Texts in the Modified Version. Only one
2162 passage of Front-Cover Text and one of Back-Cover Text may be
2163 added by (or through arrangements made by) any one entity. If the
2164 Document already includes a cover text for the same cover,
2165 previously added by you or by arrangement made by the same entity
2166 you are acting on behalf of, you may not add another; but you may
2167 replace the old one, on explicit permission from the previous
2168 publisher that added the old one.
2169
2170 The author(s) and publisher(s) of the Document do not by this
2171 License give permission to use their names for publicity for or to
2172 assert or imply endorsement of any Modified Version.
2173
2174 5. COMBINING DOCUMENTS
2175
2176 You may combine the Document with other documents released under
2177 this License, under the terms defined in section 4 above for
2178 modified versions, provided that you include in the combination
2179 all of the Invariant Sections of all of the original documents,
2180 unmodified, and list them all as Invariant Sections of your
2181 combined work in its license notice, and that you preserve all
2182 their Warranty Disclaimers.
2183
2184 The combined work need only contain one copy of this License, and
2185 multiple identical Invariant Sections may be replaced with a single
2186 copy. If there are multiple Invariant Sections with the same name
2187 but different contents, make the title of each such section unique
2188 by adding at the end of it, in parentheses, the name of the
2189 original author or publisher of that section if known, or else a
2190 unique number. Make the same adjustment to the section titles in
2191 the list of Invariant Sections in the license notice of the
2192 combined work.
2193
2194 In the combination, you must combine any sections Entitled
2195 "History" in the various original documents, forming one section
2196 Entitled "History"; likewise combine any sections Entitled
2197 "Acknowledgements", and any sections Entitled "Dedications". You
2198 must delete all sections Entitled "Endorsements."
2199
2200 6. COLLECTIONS OF DOCUMENTS
2201
2202 You may make a collection consisting of the Document and other
2203 documents released under this License, and replace the individual
2204 copies of this License in the various documents with a single copy
2205 that is included in the collection, provided that you follow the
2206 rules of this License for verbatim copying of each of the
2207 documents in all other respects.
2208
2209 You may extract a single document from such a collection, and
2210 distribute it individually under this License, provided you insert
2211 a copy of this License into the extracted document, and follow
2212 this License in all other respects regarding verbatim copying of
2213 that document.
2214
2215 7. AGGREGATION WITH INDEPENDENT WORKS
2216
2217 A compilation of the Document or its derivatives with other
2218 separate and independent documents or works, in or on a volume of
2219 a storage or distribution medium, is called an "aggregate" if the
2220 copyright resulting from the compilation is not used to limit the
2221 legal rights of the compilation's users beyond what the individual
2222 works permit. When the Document is included in an aggregate, this
2223 License does not apply to the other works in the aggregate which
2224 are not themselves derivative works of the Document.
2225
2226 If the Cover Text requirement of section 3 is applicable to these
2227 copies of the Document, then if the Document is less than one half
2228 of the entire aggregate, the Document's Cover Texts may be placed
2229 on covers that bracket the Document within the aggregate, or the
2230 electronic equivalent of covers if the Document is in electronic
2231 form. Otherwise they must appear on printed covers that bracket
2232 the whole aggregate.
2233
2234 8. TRANSLATION
2235
2236 Translation is considered a kind of modification, so you may
2237 distribute translations of the Document under the terms of section
2238 4. Replacing Invariant Sections with translations requires special
2239 permission from their copyright holders, but you may include
2240 translations of some or all Invariant Sections in addition to the
2241 original versions of these Invariant Sections. You may include a
2242 translation of this License, and all the license notices in the
2243 Document, and any Warranty Disclaimers, provided that you also
2244 include the original English version of this License and the
2245 original versions of those notices and disclaimers. In case of a
2246 disagreement between the translation and the original version of
2247 this License or a notice or disclaimer, the original version will
2248 prevail.
2249
2250 If a section in the Document is Entitled "Acknowledgements",
2251 "Dedications", or "History", the requirement (section 4) to
2252 Preserve its Title (section 1) will typically require changing the
2253 actual title.
2254
2255 9. TERMINATION
2256
2257 You may not copy, modify, sublicense, or distribute the Document
2258 except as expressly provided under this License. Any attempt
2259 otherwise to copy, modify, sublicense, or distribute it is void,
2260 and will automatically terminate your rights under this License.
2261
2262 However, if you cease all violation of this License, then your
2263 license from a particular copyright holder is reinstated (a)
2264 provisionally, unless and until the copyright holder explicitly
2265 and finally terminates your license, and (b) permanently, if the
2266 copyright holder fails to notify you of the violation by some
2267 reasonable means prior to 60 days after the cessation.
2268
2269 Moreover, your license from a particular copyright holder is
2270 reinstated permanently if the copyright holder notifies you of the
2271 violation by some reasonable means, this is the first time you have
2272 received notice of violation of this License (for any work) from
2273 that copyright holder, and you cure the violation prior to 30 days
2274 after your receipt of the notice.
2275
2276 Termination of your rights under this section does not terminate
2277 the licenses of parties who have received copies or rights from
2278 you under this License. If your rights have been terminated and
2279 not permanently reinstated, receipt of a copy of some or all of
2280 the same material does not give you any rights to use it.
2281
2282 10. FUTURE REVISIONS OF THIS LICENSE
2283
2284 The Free Software Foundation may publish new, revised versions of
2285 the GNU Free Documentation License from time to time. Such new
2286 versions will be similar in spirit to the present version, but may
2287 differ in detail to address new problems or concerns. See
2288 `http://www.gnu.org/copyleft/'.
2289
2290 Each version of the License is given a distinguishing version
2291 number. If the Document specifies that a particular numbered
2292 version of this License "or any later version" applies to it, you
2293 have the option of following the terms and conditions either of
2294 that specified version or of any later version that has been
2295 published (not as a draft) by the Free Software Foundation. If
2296 the Document does not specify a version number of this License,
2297 you may choose any version ever published (not as a draft) by the
2298 Free Software Foundation. If the Document specifies that a proxy
2299 can decide which future versions of this License can be used, that
2300 proxy's public statement of acceptance of a version permanently
2301 authorizes you to choose that version for the Document.
2302
2303 11. RELICENSING
2304
2305 "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
2306 World Wide Web server that publishes copyrightable works and also
2307 provides prominent facilities for anybody to edit those works. A
2308 public wiki that anybody can edit is an example of such a server.
2309 A "Massive Multiauthor Collaboration" (or "MMC") contained in the
2310 site means any set of copyrightable works thus published on the MMC
2311 site.
2312
2313 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
2314 license published by Creative Commons Corporation, a not-for-profit
2315 corporation with a principal place of business in San Francisco,
2316 California, as well as future copyleft versions of that license
2317 published by that same organization.
2318
2319 "Incorporate" means to publish or republish a Document, in whole or
2320 in part, as part of another Document.
2321
2322 An MMC is "eligible for relicensing" if it is licensed under this
2323 License, and if all works that were first published under this
2324 License somewhere other than this MMC, and subsequently
2325 incorporated in whole or in part into the MMC, (1) had no cover
2326 texts or invariant sections, and (2) were thus incorporated prior
2327 to November 1, 2008.
2328
2329 The operator of an MMC Site may republish an MMC contained in the
2330 site under CC-BY-SA on the same site at any time before August 1,
2331 2009, provided the MMC is eligible for relicensing.
2332
2333
2334 ADDENDUM: How to use this License for your documents
2335 ====================================================
2336
2337 To use this License in a document you have written, include a copy of
2338 the License in the document and put the following copyright and license
2339 notices just after the title page:
2340
2341 Copyright (C) YEAR YOUR NAME.
2342 Permission is granted to copy, distribute and/or modify this document
2343 under the terms of the GNU Free Documentation License, Version 1.3
2344 or any later version published by the Free Software Foundation;
2345 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
2346 Texts. A copy of the license is included in the section entitled ``GNU
2347 Free Documentation License''.
2348
2349 If you have Invariant Sections, Front-Cover Texts and Back-Cover
2350 Texts, replace the "with...Texts." line with this:
2351
2352 with the Invariant Sections being LIST THEIR TITLES, with
2353 the Front-Cover Texts being LIST, and with the Back-Cover Texts
2354 being LIST.
2355
2356 If you have Invariant Sections without Cover Texts, or some other
2357 combination of the three, merge those two alternatives to suit the
2358 situation.
2359
2360 If your document contains nontrivial examples of program code, we
2361 recommend releasing these examples in parallel under your choice of
2362 free software license, such as the GNU General Public License, to
2363 permit their use in free software.
2364
2365 \1f
2366 File: ada-mode.info, Node: Index, Prev: GNU Free Documentation License, Up: Top
2367
2368 Index
2369 *****
2370
2371