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