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