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