diff options
| author | Juanma Barranquero | 2008-07-28 11:03:42 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2008-07-28 11:03:42 +0000 |
| commit | d5875b259c24498d742b526d690abe1e59584b6c (patch) | |
| tree | 979bf16813bcb526e38971a5519f30d7596da875 /doc/misc | |
| parent | 42ffd097cf4bba5c5df93bf95f30cf2ea859a695 (diff) | |
| download | emacs-d5875b259c24498d742b526d690abe1e59584b6c.tar.gz emacs-d5875b259c24498d742b526d690abe1e59584b6c.zip | |
Fix bug #272, and update Ada mode to version 4.0.
Diffstat (limited to 'doc/misc')
| -rw-r--r-- | doc/misc/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/misc/ada-mode.texi | 316 |
2 files changed, 225 insertions, 95 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 6f2f32cc4fc..3e88476bba3 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2008-07-28 Stephen Leake <stephen_leake@stephe-leake.org> | ||
| 2 | |||
| 3 | * ada-mode.texi: Update to Ada mode version 4.0. | ||
| 4 | |||
| 1 | 2008-07-27 Michael Albinus <michael.albinus@gmx.de> | 5 | 2008-07-27 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 6 | ||
| 3 | Sync with Tramp 2.1.14. | 7 | Sync with Tramp 2.1.14. |
diff --git a/doc/misc/ada-mode.texi b/doc/misc/ada-mode.texi index ed8bfc13c37..382f1fa3376 100644 --- a/doc/misc/ada-mode.texi +++ b/doc/misc/ada-mode.texi | |||
| @@ -30,7 +30,7 @@ developing GNU and promoting software freedom.'' | |||
| 30 | @title{Ada Mode} | 30 | @title{Ada Mode} |
| 31 | @sp 2 | 31 | @sp 2 |
| 32 | @subtitle An Emacs major mode for programming in Ada | 32 | @subtitle An Emacs major mode for programming in Ada |
| 33 | @subtitle Ada Mode Version 3.7 | 33 | @subtitle Ada Mode Version 4.00 |
| 34 | @sp 2 | 34 | @sp 2 |
| 35 | @page | 35 | @page |
| 36 | @vskip 0pt plus 1filll | 36 | @vskip 0pt plus 1filll |
| @@ -57,7 +57,7 @@ developing GNU and promoting software freedom.'' | |||
| 57 | * Automatic Casing:: Adjusting the case of words automatically | 57 | * Automatic Casing:: Adjusting the case of words automatically |
| 58 | * Statement Templates:: Inserting code templates | 58 | * Statement Templates:: Inserting code templates |
| 59 | * Comment Handling:: Reformatting comments easily | 59 | * Comment Handling:: Reformatting comments easily |
| 60 | * GNU Free Documentation License:: The license for this documentation. | 60 | * GNU Free Documentation License:: The license for this documentation. |
| 61 | * Index:: | 61 | * Index:: |
| 62 | @end menu | 62 | @end menu |
| 63 | 63 | ||
| @@ -268,7 +268,7 @@ Here are the commands for building and using an Ada project, as | |||
| 268 | listed in the Ada menu. | 268 | listed in the Ada menu. |
| 269 | 269 | ||
| 270 | In multi-file projects, there must be one file that is the main | 270 | In multi-file projects, there must be one file that is the main |
| 271 | program. That is given by the @code{main_unit} project file variable; | 271 | program. That is given by the @code{main} project file variable; |
| 272 | it defaults to the current file if not yet set, but is also set by the | 272 | it defaults to the current file if not yet set, but is also set by the |
| 273 | ``set main and build'' command. | 273 | ``set main and build'' command. |
| 274 | 274 | ||
| @@ -280,26 +280,26 @@ Compiles the current file in syntax check mode, by running | |||
| 280 | runs faster than full compile mode, speeding up finding and fixing | 280 | runs faster than full compile mode, speeding up finding and fixing |
| 281 | compilation errors. | 281 | compilation errors. |
| 282 | 282 | ||
| 283 | This sets @code{main_unit} only if it has not been set yet. | 283 | This sets @code{main} only if it has not been set yet. |
| 284 | 284 | ||
| 285 | @item Compile file | 285 | @item Compile file |
| 286 | Compiles the current file, by running @code{comp_cmd} from the current | 286 | Compiles the current file, by running @code{comp_cmd} from the current |
| 287 | project file. | 287 | project file. |
| 288 | 288 | ||
| 289 | This does not set @code{main_unit}. | 289 | This does not set @code{main}. |
| 290 | 290 | ||
| 291 | @item Set main and Build | 291 | @item Set main and Build |
| 292 | Sets @code{main_unit} to the current file, then executes the Build | 292 | Sets @code{main} to the current file, then executes the Build |
| 293 | command. | 293 | command. |
| 294 | 294 | ||
| 295 | @item Show main | 295 | @item Show main |
| 296 | Display @code{main_unit} in the message buffer. | 296 | Display @code{main} in the message buffer. |
| 297 | 297 | ||
| 298 | @item Build | 298 | @item Build |
| 299 | Compiles all obsolete units of the current @code{main_unit}, and links | 299 | Compiles all obsolete units of the current @code{main}, and links |
| 300 | @code{main_unit}, by running @code{make_cmd} from the current project. | 300 | @code{main}, by running @code{make_cmd} from the current project. |
| 301 | 301 | ||
| 302 | This sets @code{main_unit} only if it has not been set yet. | 302 | This sets @code{main} only if it has not been set yet. |
| 303 | 303 | ||
| 304 | @item Run | 304 | @item Run |
| 305 | Executes the main program in a shell, displayed in a separate Emacs | 305 | Executes the main program in a shell, displayed in a separate Emacs |
| @@ -313,7 +313,7 @@ This command is not available for a cross-compilation toolchain. | |||
| 313 | 313 | ||
| 314 | @end table | 314 | @end table |
| 315 | It is important when using these commands to understand how | 315 | It is important when using these commands to understand how |
| 316 | @code{main_unit} is used and changed. | 316 | @code{main} is used and changed. |
| 317 | 317 | ||
| 318 | Build runs 'gnatmake' on the main unit. During a typical edit/compile | 318 | Build runs 'gnatmake' on the main unit. During a typical edit/compile |
| 319 | session, this is the only command you need to invoke, which is why it | 319 | session, this is the only command you need to invoke, which is why it |
| @@ -328,19 +328,19 @@ Novices and students typically work on single-file Ada projects. In | |||
| 328 | this case, @key{C-c C-m} will normally be the only command needed; it | 328 | this case, @key{C-c C-m} will normally be the only command needed; it |
| 329 | will build the current file, rather than the last-built main. | 329 | will build the current file, rather than the last-built main. |
| 330 | 330 | ||
| 331 | There are three ways to change @code{main_unit}: | 331 | There are three ways to change @code{main}: |
| 332 | 332 | ||
| 333 | @enumerate | 333 | @enumerate |
| 334 | @item | 334 | @item |
| 335 | Invoke @key{Ada | Set main and Build}, which sets @code{main_unit} to | 335 | Invoke @key{Ada | Set main and Build}, which sets @code{main} to |
| 336 | the current file. | 336 | the current file. |
| 337 | 337 | ||
| 338 | @item | 338 | @item |
| 339 | Invoke @key{Ada | Project | Edit}, edit @code{main_unit} and | 339 | Invoke @key{Ada | Project | Edit}, edit @code{main} and |
| 340 | @code{main}, and click @key{[save]} | 340 | @code{main}, and click @key{[save]} |
| 341 | 341 | ||
| 342 | @item | 342 | @item |
| 343 | Invoke @key{Ada | Project | Load}, and load a project file that specifies @code{main_unit} | 343 | Invoke @key{Ada | Project | Load}, and load a project file that specifies @code{main} |
| 344 | 344 | ||
| 345 | @end enumerate | 345 | @end enumerate |
| 346 | 346 | ||
| @@ -372,7 +372,10 @@ for your project, and allows you to customize the compilation commands | |||
| 372 | and other things on a per-project basis. | 372 | and other things on a per-project basis. |
| 373 | 373 | ||
| 374 | Note that Ada mode project files @samp{*.adp} are different than GNAT | 374 | Note that Ada mode project files @samp{*.adp} are different than GNAT |
| 375 | compiler project files @samp{*.gpr}. | 375 | compiler project files @samp{*.gpr}. However, Emacs Ada mode can use a |
| 376 | GNAT project project file to specify the project directories. If no | ||
| 377 | other customization is needed, a GNAT project file can be used without | ||
| 378 | an Emacs Ada mode project file. | ||
| 376 | 379 | ||
| 377 | @menu | 380 | @menu |
| 378 | * Project File Overview:: | 381 | * Project File Overview:: |
| @@ -436,9 +439,15 @@ when the file does not actually exist. | |||
| 436 | To change the project file before or after the first one is found, | 439 | To change the project file before or after the first one is found, |
| 437 | invoke @key{Ada | Project | Load ...}. | 440 | invoke @key{Ada | Project | Load ...}. |
| 438 | 441 | ||
| 439 | Or, in lisp, evaluate @code{ada-set-default-project-file "/path/file.adp"}. | 442 | Or, in lisp, evaluate @code{(ada-set-default-project-file "/path/file.adp")}. |
| 440 | This sets @code{ada-prj-default-project-file}, and reads the project file. | 443 | This sets @code{ada-prj-default-project-file}, and reads the project file. |
| 441 | 444 | ||
| 445 | You can also specify a GNAT project file to @key{Ada | Project | Load | ||
| 446 | ...} or @code{ada-set-default-project-file}. Emacs Ada mode checks the | ||
| 447 | file extension; if it is @code{.gpr}, the file is treated as a GNAT | ||
| 448 | project file. Any other extension is treated as an Emacs Ada mode | ||
| 449 | project file. | ||
| 450 | |||
| 442 | @node GUI Editor, Project file variables, Project File Overview, Project files | 451 | @node GUI Editor, Project file variables, Project File Overview, Project files |
| 443 | @section GUI Editor | 452 | @section GUI Editor |
| 444 | 453 | ||
| @@ -465,30 +474,68 @@ using a shell-like notation. For instance, if the variable | |||
| 465 | @code{comp_opt} variable will be substituted when @code{comp_cmd} is | 474 | @code{comp_opt} variable will be substituted when @code{comp_cmd} is |
| 466 | used. | 475 | used. |
| 467 | 476 | ||
| 477 | In addition, process environment variables can be referenced using the | ||
| 478 | same syntax, or the normal @code{$var} syntax. | ||
| 479 | |||
| 468 | Most project variables have defaults that can be changed by setting | 480 | Most project variables have defaults that can be changed by setting |
| 469 | lisp variables; the table below identifies the lisp variable for each | 481 | lisp variables; the table below identifies the lisp variable for each |
| 470 | project variable. Lisp variables corresponding to project variables | 482 | project variable. Lisp variables corresponding to project variables |
| 471 | that are lists are lisp lists. | 483 | that are lists are lisp lists. |
| 472 | 484 | ||
| 485 | In general, project variables are evaluated when referenced in | ||
| 486 | Emacs Ada mode commands. Relative file paths are expanded to | ||
| 487 | absolute relative to @code{$@{build_dir@}}. | ||
| 488 | |||
| 473 | Here is the list of variables. In the default values, the current | 489 | Here is the list of variables. In the default values, the current |
| 474 | directory @code{"."} is the project file directory. | 490 | directory @code{"."} is the project file directory. |
| 475 | 491 | ||
| 476 | @c defined in ada-xref-set-default-prj-values; same order here | ||
| 477 | @table @asis | 492 | @table @asis |
| 478 | @item @code{build_dir} [default: @code{"."}] | 493 | @c defined in ada-default-prj-properties; alphabetical order |
| 479 | The compile commands will be issued in this directory. | ||
| 480 | 494 | ||
| 481 | @item @code{src_dir} [default: @code{"."}] | 495 | @item @code{ada_project_path_sep} [default: @code{":" or ";"}] |
| 482 | A list of directories to search for source files, both for compile | 496 | Path separator for @code{ADA_PROJECT_PATH}. It defaults to the correct |
| 483 | commands and source navigation. | 497 | value for a native implementation of GNAT for the current operating |
| 498 | system. The user must override this when using Windows native GNAT | ||
| 499 | with Cygwin Emacs, and perhaps in other cases. | ||
| 484 | 500 | ||
| 485 | @item @code{obj_dir} [default: @code{"."}] | 501 | Lisp variable: @code{ada-prj-ada-project-path-sep}. |
| 486 | A list of directories to search for library files. Ada mode searches | ||
| 487 | this list for the @samp{.ali} files generated by GNAT that contain | ||
| 488 | cross-reference information. | ||
| 489 | 502 | ||
| 490 | The compiler commands must place the @samp{.ali} files in one of these | 503 | @item @code{ada_project_path} [default: @code{""}] |
| 491 | directories; the default commands do that. | 504 | A list of directories to search for GNAT project files. |
| 505 | |||
| 506 | If set, the @code{ADA_PROJECT_PATH} process environment variable is | ||
| 507 | set to this value in the Emacs process when the Emacs Ada mode project | ||
| 508 | is selected via menu @samp{Ada | Project | Load}. | ||
| 509 | |||
| 510 | For @code{ada_project_path}, relative file paths are expanded to | ||
| 511 | absolute when the Emacs Ada project file is read, rather than when the | ||
| 512 | project file is selected. | ||
| 513 | |||
| 514 | For example if the project file is in the directory | ||
| 515 | @file{/home/myproject}, the environment variable @code{GDS_ROOT} is | ||
| 516 | set to @code{/home/shared}, and the project file contains: | ||
| 517 | @example | ||
| 518 | ada_project_path_sep=: | ||
| 519 | ada_project_path=$GDS_ROOT/makerules | ||
| 520 | ada_project_path=../opentoken | ||
| 521 | @end example | ||
| 522 | the environment variable @code{ADA_PROJECT_PATH} will be set to | ||
| 523 | @code{"/home/shared/makerules:/home/opentoken/"}. | ||
| 524 | |||
| 525 | The default value is not the current value of this environment | ||
| 526 | variable, because that will typically have been set by another | ||
| 527 | project, and will therefore be incorrect for this project. | ||
| 528 | |||
| 529 | If you have the environment variable set correctly for all of your | ||
| 530 | projects, you do not need to set this project variable. | ||
| 531 | |||
| 532 | @item @code{bind_opt} [default: @code{""}] | ||
| 533 | Holds user binder options; used in the default build commands. | ||
| 534 | |||
| 535 | Lisp variable: @code{ada-prj-default-bind-opt}. | ||
| 536 | |||
| 537 | @item @code{build_dir} [default: @code{"."}] | ||
| 538 | The compile commands will be issued in this directory. | ||
| 492 | 539 | ||
| 493 | @item @code{casing} [default: @code{("~/.emacs_case_exceptions")} | 540 | @item @code{casing} [default: @code{("~/.emacs_case_exceptions")} |
| 494 | List of files containing casing exceptions. See the help on | 541 | List of files containing casing exceptions. See the help on |
| @@ -497,6 +544,18 @@ List of files containing casing exceptions. See the help on | |||
| 497 | 544 | ||
| 498 | Lisp variable: @code{ada-case-exception-file}. | 545 | Lisp variable: @code{ada-case-exception-file}. |
| 499 | 546 | ||
| 547 | @item @code{check_cmd} [default: @code{"$@{cross_prefix@}gnatmake -u -c -gnatc $@{gnatmake_opt@} $@{full_current@} -cargs $@{comp_opt@}"}] | ||
| 548 | Command used to syntax check a single file. | ||
| 549 | The name of the file is substituted for @code{full_current}. | ||
| 550 | |||
| 551 | Lisp variable: @code{ada-prj-default-check-cmd} | ||
| 552 | |||
| 553 | @item @code{comp_cmd} [default: @code{"$@{cross_prefix@}gnatmake -u -c $@{gnatmake_opt@} $@{full_current@} -cargs $@{comp_opt@}"}] | ||
| 554 | Command used to compile a single file. | ||
| 555 | The name of the file is substituted for @code{full_current}. | ||
| 556 | |||
| 557 | Lisp variable: @code{ada-prj-default-comp-cmd}. | ||
| 558 | |||
| 500 | @item @code{comp_opt} [default: @code{"-gnatq -gnatQ"}] | 559 | @item @code{comp_opt} [default: @code{"-gnatq -gnatQ"}] |
| 501 | Holds user compiler options; used in the default compile commands. The | 560 | Holds user compiler options; used in the default compile commands. The |
| 502 | default value tells gnatmake to generate library files for | 561 | default value tells gnatmake to generate library files for |
| @@ -509,76 +568,81 @@ be used; @ref{Use GNAT project file}. | |||
| 509 | 568 | ||
| 510 | Lisp variable: @code{ada-prj-default-comp-opt}. | 569 | Lisp variable: @code{ada-prj-default-comp-opt}. |
| 511 | 570 | ||
| 512 | @item @code{bind_opt} [default: @code{""}] | 571 | @item @code{cross_prefix} [default: @code{""}] |
| 513 | Holds user binder options; used in the default build commands. | 572 | Name of target machine in a cross-compilation environment. Used in |
| 514 | 573 | default compile and build commands. | |
| 515 | Lisp variable: @code{ada-prj-default-bind-opt}. | ||
| 516 | |||
| 517 | @item @code{link_opt} [default: @code{""}] | ||
| 518 | Holds user linker options; used in the default build commands. | ||
| 519 | 574 | ||
| 520 | Lisp variable: @code{ada-prj-default-link-opt}. | 575 | @item @code{debug_cmd} [default: @code{"$@{cross_prefix@}gdb $@{main@}"}] |
| 576 | Command used to debug the application | ||
| 521 | 577 | ||
| 522 | @item @code{gnatmake_opt} [default: @code{"-g"}] | 578 | Lisp variable: @code{ada-prj-default-debugger}. |
| 523 | Holds user gnatmake options; used in the default build commands. | ||
| 524 | 579 | ||
| 525 | If a GNAT project file is used (for example @file{project.gpr}), this | 580 | @item @code{debug_post_cmd} [default: @code{""}] |
| 526 | option should be set to @code{-Pproject.gpr}. | 581 | Command executed after @code{debug_cmd}. |
| 527 | 582 | ||
| 528 | Lisp variable: @code{ada-prj-default-gnatmake-opt}. | 583 | @item @code{debug_pre_cmd} [default: @code{"cd $@{build_dir@}"}] |
| 584 | Command executed before @code{debug_cmd}. | ||
| 529 | 585 | ||
| 530 | @item @code{gnatfind_opt} [default: @code{"-rf"}] | 586 | @item @code{gnatfind_opt} [default: @code{"-rf"}] |
| 531 | Holds user gnatfind options; used in the default find commands. | 587 | Holds user gnatfind options; used in the default find commands. |
| 532 | 588 | ||
| 533 | Lisp variable: @code{ada-prj-gnatfind-switches}. | 589 | Lisp variable: @code{ada-prj-gnatfind-switches}. |
| 534 | 590 | ||
| 535 | @item @code{main} [default: current file] | 591 | @item @code{gnatmake_opt} [default: @code{"-g"}] |
| 536 | Specifies the name of the executable file for the project; used in the | 592 | Holds user gnatmake options; used in the default build commands. |
| 537 | default build commands. | ||
| 538 | 593 | ||
| 539 | @item @code{main_unit} [default: current Ada unit] | 594 | Lisp variable: @code{ada-prj-default-gnatmake-opt}. |
| 540 | Specifies the name of the main Ada unit for the project; used in the | ||
| 541 | default build commands. | ||
| 542 | 595 | ||
| 543 | @item @code{cross_prefix} [default: @code{""}] | 596 | @item @code{gpr_file} [default: @code{""}] |
| 544 | Name of target machine in a cross-compilation environment. Used in | 597 | Specify GNAT project file. |
| 545 | default compile and build commands. | ||
| 546 | 598 | ||
| 547 | @item @code{remote_machine} [default: @code{""}] | 599 | If set, the source and object directories specified in the GNAT |
| 548 | Name of the machine to log into before issuing the compile and build | 600 | project file are appended to @code{src_dir} and @code{obj_dir}. This |
| 549 | commands. If this variable is empty, the command will be run on the | 601 | allows specifying Ada source directories with a GNAT project file, and |
| 550 | local machine. | 602 | other source directories with the Emacs project file. |
| 551 | 603 | ||
| 552 | @item @code{comp_cmd} [default: @code{"$@{cross_prefix@}gnatmake -u -c $@{gnatmake_opt@} $@{full_current@} -cargs $@{comp_opt@}"}] | 604 | In addition, @code{-P@{gpr_file@}} is added to the project variable |
| 553 | Command used to compile a single file. | 605 | @code{gnatmake_opt} whenever it is referenced. With the default |
| 554 | The name of the file is substituted for @code{full_current}. | 606 | project variables, this passes the project file to all gnatmake |
| 607 | commands. | ||
| 555 | 608 | ||
| 556 | Lisp variable: @code{ada-prj-default-comp-cmd}. | 609 | Lisp variable: @code{ada-prj-default-gpr-file}. |
| 557 | 610 | ||
| 558 | @item @code{check_cmd} [default: @code{"$@{cross_prefix@}gnatmake -u -c -gnatc $@{gnatmake_opt@} $@{full_current@} -cargs $@{comp_opt@}"}] | 611 | @c FIXME: add gnatstub-opts |
| 559 | Command used to syntax check a single file. | ||
| 560 | The name of the file is substituted for @code{full_current}. | ||
| 561 | 612 | ||
| 562 | Lisp variable: @code{ada-prj-default-check-cmd} | 613 | @item @code{link_opt} [default: @code{""}] |
| 614 | Holds user linker options; used in the default build commands. | ||
| 615 | |||
| 616 | Lisp variable: @code{ada-prj-default-link-opt}. | ||
| 563 | 617 | ||
| 564 | @item @code{make_cmd} [default: @code{"$@{cross_prefix@}gnatmake -o $@{main@} $@{main_unit@} $@{gnatmake_opt@} -cargs $@{comp_opt@} -bargs $@{bind_opt@} -largs $@{link_opt@}"}] | 618 | @item @code{main} [default: current file] |
| 619 | Specifies the name of the executable file for the project; used in the | ||
| 620 | default build commands. | ||
| 621 | |||
| 622 | @item @code{make_cmd} [default: @code{"$@{cross_prefix@}gnatmake -o $@{main@} $@{main@} $@{gnatmake_opt@} -cargs $@{comp_opt@} -bargs $@{bind_opt@} -largs $@{link_opt@}"}] | ||
| 565 | Command used to build the application. | 623 | Command used to build the application. |
| 566 | 624 | ||
| 567 | Lisp variable: @code{ada-prj-default-make-cmd}. | 625 | Lisp variable: @code{ada-prj-default-make-cmd}. |
| 568 | 626 | ||
| 569 | @item @code{run_cmd} [default: @code{"./$@{main@}"}] | 627 | @item @code{obj_dir} [default: @code{"."}] |
| 570 | Command used to run the application. | 628 | A list of directories to search for library files. Ada mode searches |
| 629 | this list for the @samp{.ali} files generated by GNAT that contain | ||
| 630 | cross-reference information. | ||
| 571 | 631 | ||
| 572 | @item @code{debug_pre_cmd} [default: @code{"cd $@{build_dir@}"}] | 632 | The compiler commands must place the @samp{.ali} files in one of these |
| 573 | Command executed before @code{debug_cmd}. | 633 | directories; the default commands do that. |
| 574 | 634 | ||
| 575 | @item @code{debug_cmd} [default: @code{"$@{cross_prefix@}gdb $@{main@}"}] | 635 | @item @code{remote_machine} [default: @code{""}] |
| 576 | Command used to debug the application | 636 | Name of the machine to log into before issuing the compile and build |
| 637 | commands. If this variable is empty, the command will be run on the | ||
| 638 | local machine. | ||
| 577 | 639 | ||
| 578 | Lisp variable: @code{ada-prj-default-debugger}. | 640 | @item @code{run_cmd} [default: @code{"./$@{main@}"}] |
| 641 | Command used to run the application. | ||
| 579 | 642 | ||
| 580 | @item @code{debug_post_cmd} [default: @code{""}] | 643 | @item @code{src_dir} [default: @code{"."}] |
| 581 | Command executed after @code{debug_cmd}. | 644 | A list of directories to search for source files, both for compile |
| 645 | commands and source navigation. | ||
| 582 | 646 | ||
| 583 | @end table | 647 | @end table |
| 584 | 648 | ||
| @@ -601,6 +665,7 @@ website mentioned in @xref{Installation}. | |||
| 601 | * Set compiler options:: A basic Ada mode project file | 665 | * Set compiler options:: A basic Ada mode project file |
| 602 | * Set source search path:: Source in multiple directories | 666 | * Set source search path:: Source in multiple directories |
| 603 | * Use GNAT project file:: | 667 | * Use GNAT project file:: |
| 668 | * Use multiple GNAT project files:: | ||
| 604 | @end menu | 669 | @end menu |
| 605 | 670 | ||
| 606 | @node No project files, Set compiler options, Compiling Examples, Compiling Examples | 671 | @node No project files, Set compiler options, Compiling Examples, Compiling Examples |
| @@ -632,6 +697,8 @@ is begin | |||
| 632 | end Hello_2; | 697 | end Hello_2; |
| 633 | @end example | 698 | @end example |
| 634 | 699 | ||
| 700 | This file has no errors. | ||
| 701 | |||
| 635 | @file{hello_pkg.ads}: | 702 | @file{hello_pkg.ads}: |
| 636 | 703 | ||
| 637 | @example | 704 | @example |
| @@ -640,6 +707,8 @@ package Hello_Pkg is | |||
| 640 | end Hello_Pkg; | 707 | end Hello_Pkg; |
| 641 | @end example | 708 | @end example |
| 642 | 709 | ||
| 710 | This file has no errors. | ||
| 711 | |||
| 643 | @file{hello_pkg.adb}: | 712 | @file{hello_pkg.adb}: |
| 644 | 713 | ||
| 645 | @example | 714 | @example |
| @@ -683,7 +752,7 @@ To fix the error, change the line to be | |||
| 683 | Ada.Text_IO.Put_Line ("hello from hello.adb"): | 752 | Ada.Text_IO.Put_Line ("hello from hello.adb"): |
| 684 | @end example | 753 | @end example |
| 685 | 754 | ||
| 686 | Now invoke @key{Ada | Show main}; this displays @file{Ada mode main_unit: hello}. | 755 | Now invoke @key{Ada | Show main}; this displays @file{Ada mode main: hello}. |
| 687 | 756 | ||
| 688 | Now (in buffer @file{hello.adb}), invoke @key{Ada | Build}. You are | 757 | Now (in buffer @file{hello.adb}), invoke @key{Ada | Build}. You are |
| 689 | prompted to save the file (if you haven't already). Then the | 758 | prompted to save the file (if you haven't already). Then the |
| @@ -729,7 +798,7 @@ unless you use an Emacs Ada mode project file to specify the other directories; | |||
| 729 | @xref{Set source search path}, or a GNAT project file; @ref{Use GNAT | 798 | @xref{Set source search path}, or a GNAT project file; @ref{Use GNAT |
| 730 | project file}. | 799 | project file}. |
| 731 | 800 | ||
| 732 | Invoke @key{Ada | Show main}; this displays @file{Ada mode main_unit: hello_2}. | 801 | Invoke @key{Ada | Show main}; this displays @file{Ada mode main: hello_2}. |
| 733 | 802 | ||
| 734 | Move to the error with @key{C-x `}, and fix the error by adding @code{body}: | 803 | Move to the error with @key{C-x `}, and fix the error by adding @code{body}: |
| 735 | 804 | ||
| @@ -740,29 +809,29 @@ package body Hello_Pkg is | |||
| 740 | Now, while still in @file{hello_pkg.adb}, invoke @key{Ada | Build}. | 809 | Now, while still in @file{hello_pkg.adb}, invoke @key{Ada | Build}. |
| 741 | gnatmake successfully builds @file{hello_2}. This demonstrates that | 810 | gnatmake successfully builds @file{hello_2}. This demonstrates that |
| 742 | Emacs has remembered the main file, in the project variable | 811 | Emacs has remembered the main file, in the project variable |
| 743 | @code{main_unit}, and used it for the Build command. | 812 | @code{main}, and used it for the Build command. |
| 744 | 813 | ||
| 745 | Finally, again while in @file{hello_pkg.adb}, invoke @key{Ada | Run}. | 814 | Finally, again while in @file{hello_pkg.adb}, invoke @key{Ada | Run}. |
| 746 | The @code{*run*} buffer displays @code{Hello from hello_pkg.adb}. | 815 | The @code{*run*} buffer displays @code{Hello from hello_pkg.adb}. |
| 747 | 816 | ||
| 748 | One final point. If you switch back to buffer @file{hello.adb}, and | 817 | One final point. If you switch back to buffer @file{hello.adb}, and |
| 749 | invoke @key{Ada | Run}, @file{hello_2.exe} will be run. That is | 818 | invoke @key{Ada | Run}, @file{hello_2.exe} will be run. That is |
| 750 | because @code{main_unit} is still set to @code{hello_2}, as you can | 819 | because @code{main} is still set to @code{hello_2}, as you can |
| 751 | see when you invoke @key{Ada | Project | Edit}. | 820 | see when you invoke @key{Ada | Project | Edit}. |
| 752 | 821 | ||
| 753 | There are three ways to change @code{main_unit}: | 822 | There are three ways to change @code{main}: |
| 754 | 823 | ||
| 755 | @enumerate | 824 | @enumerate |
| 756 | @item | 825 | @item |
| 757 | Invoke @key{Ada | Set main and Build}, which sets @code{main_unit} to | 826 | Invoke @key{Ada | Set main and Build}, which sets @code{main} to |
| 758 | the current file. | 827 | the current file. |
| 759 | 828 | ||
| 760 | @item | 829 | @item |
| 761 | Invoke @key{Ada | Project | Edit}, edit @code{main_unit} and | 830 | Invoke @key{Ada | Project | Edit}, edit @code{main} and |
| 762 | @code{main}, and click @key{[save]} | 831 | @code{main}, and click @key{[save]} |
| 763 | 832 | ||
| 764 | @item | 833 | @item |
| 765 | Invoke @key{Ada | Project | Load}, and load a project file that specifies @code{main_unit} | 834 | Invoke @key{Ada | Project | Load}, and load a project file that specifies @code{main} |
| 766 | 835 | ||
| 767 | @end enumerate | 836 | @end enumerate |
| 768 | 837 | ||
| @@ -832,8 +901,8 @@ project files}. | |||
| 832 | @section Set source search path | 901 | @section Set source search path |
| 833 | 902 | ||
| 834 | In this example, we show how to deal with files in more than one | 903 | In this example, we show how to deal with files in more than one |
| 835 | directory. We start with the same code as in @ref{No project files}; create those | 904 | directory. We start with the same code as in @ref{No project files}; |
| 836 | files (with the errors present) | 905 | create those files (with the errors present) |
| 837 | 906 | ||
| 838 | Create the directory @file{Example_3}, containing: | 907 | Create the directory @file{Example_3}, containing: |
| 839 | 908 | ||
| @@ -912,10 +981,11 @@ compiler error message. | |||
| 912 | Fixing the error, linking and running the code proceed as in @ref{No | 981 | Fixing the error, linking and running the code proceed as in @ref{No |
| 913 | project files}. | 982 | project files}. |
| 914 | 983 | ||
| 915 | @node Use GNAT project file, , Set source search path, Compiling Examples | 984 | @node Use GNAT project file, Use multiple GNAT project files, Set source search path, Compiling Examples |
| 916 | @section Use GNAT project file | 985 | @section Use GNAT project file |
| 917 | 986 | ||
| 918 | In this example, we show how to use a GNAT project file. | 987 | In this example, we show how to use a GNAT project file, with no Ada |
| 988 | mode project file. | ||
| 919 | 989 | ||
| 920 | Create the directory @file{Example_4}, containing: | 990 | Create the directory @file{Example_4}, containing: |
| 921 | 991 | ||
| @@ -945,7 +1015,7 @@ error on line 2. | |||
| 945 | In addition, create a directory @file{Example_4/Gnat_Project}, | 1015 | In addition, create a directory @file{Example_4/Gnat_Project}, |
| 946 | containing these files: | 1016 | containing these files: |
| 947 | 1017 | ||
| 948 | @file{Other/hello_4.adb}: | 1018 | @file{Gnat_Project/hello_4.adb}: |
| 949 | 1019 | ||
| 950 | @example | 1020 | @example |
| 951 | with Hello_Pkg; | 1021 | with Hello_Pkg; |
| @@ -959,13 +1029,6 @@ end Hello_4; | |||
| 959 | 1029 | ||
| 960 | There are no errors in this file. | 1030 | There are no errors in this file. |
| 961 | 1031 | ||
| 962 | @file{Gnat_Project/hello_4.adp}: | ||
| 963 | |||
| 964 | @example | ||
| 965 | src_dir=.. | ||
| 966 | gnatmake_opt=-Phello_4.gpr | ||
| 967 | @end example | ||
| 968 | |||
| 969 | @file{Gnat_Project/hello_4.gpr}: | 1032 | @file{Gnat_Project/hello_4.gpr}: |
| 970 | 1033 | ||
| 971 | @example | 1034 | @example |
| @@ -975,7 +1038,7 @@ end Hello_4; | |||
| 975 | @end example | 1038 | @end example |
| 976 | 1039 | ||
| 977 | In buffer @file{hello_4.adb}, invoke @key{Ada | Project | Load...}, and | 1040 | In buffer @file{hello_4.adb}, invoke @key{Ada | Project | Load...}, and |
| 978 | select @file{Example_4/Gnat_Project/hello_4.adp}. | 1041 | select @file{Example_4/Gnat_Project/hello_4.gpr}. |
| 979 | 1042 | ||
| 980 | Then, again in @file{hello_4.adb}, invoke @key{Ada | Set main and | 1043 | Then, again in @file{hello_4.adb}, invoke @key{Ada | Set main and |
| 981 | Build}. You should get a @code{*compilation*} buffer containing | 1044 | Build}. You should get a @code{*compilation*} buffer containing |
| @@ -997,9 +1060,72 @@ set the compiler options. | |||
| 997 | Fixing the error, linking and running the code proceed as in @ref{No | 1060 | Fixing the error, linking and running the code proceed as in @ref{No |
| 998 | project files}. | 1061 | project files}. |
| 999 | 1062 | ||
| 1063 | @node Use multiple GNAT project files, , Use GNAT project file, Compiling Examples | ||
| 1064 | @section Use multiple GNAT project files | ||
| 1065 | |||
| 1066 | In this example, we show how to use multiple GNAT project files, | ||
| 1067 | specifying the GNAT project search path in an Ada mode project file. | ||
| 1068 | |||
| 1069 | Create the directory @file{Example_4} as specified in @ref{Use GNAT | ||
| 1070 | project file}. | ||
| 1071 | |||
| 1072 | Create the directory @file{Example_5}, containing: | ||
| 1073 | |||
| 1074 | @file{hello_5.adb}: | ||
| 1075 | |||
| 1076 | @example | ||
| 1077 | with Hello_Pkg; | ||
| 1078 | with Ada.Text_IO; use Ada.Text_IO; | ||
| 1079 | procedure Hello_5 | ||
| 1080 | is begin | ||
| 1081 | Hello_Pkg.Say_Hello; | ||
| 1082 | Put_Line ("From hello_5"); | ||
| 1083 | end Hello_5; | ||
| 1084 | @end example | ||
| 1085 | |||
| 1086 | There are no errors in this file. | ||
| 1087 | |||
| 1088 | @file{hello_5.adp}: | ||
| 1089 | |||
| 1090 | @example | ||
| 1091 | ada_project_path=../Example_4/Gnat_Project | ||
| 1092 | gpr_file=hello_5.gpr | ||
| 1093 | @end example | ||
| 1094 | |||
| 1095 | @file{hello_5.gpr}: | ||
| 1096 | |||
| 1097 | @example | ||
| 1098 | with "hello_4"; | ||
| 1099 | Project Hello_5 is | ||
| 1100 | for Source_Dirs use ("."); | ||
| 1101 | package Compiler is | ||
| 1102 | for Default_Switches ("Ada") use ("-g", "-gnatyt"); | ||
| 1103 | end Compiler; | ||
| 1104 | end Hello_5; | ||
| 1105 | @end example | ||
| 1106 | |||
| 1107 | In buffer @file{hello_5.adb}, invoke @key{Ada | Project | Load...}, and | ||
| 1108 | select @file{Example_5/hello_5.adp}. | ||
| 1109 | |||
| 1110 | Then, again in @file{hello_5.adb}, invoke @key{Ada | Set main and | ||
| 1111 | Build}. You should get a @code{*compilation*} buffer containing | ||
| 1112 | something like (the directory paths will be different): | ||
| 1113 | |||
| 1114 | @example | ||
| 1115 | cd c:/Examples/Example_5/ | ||
| 1116 | gnatmake -o hello_5 hello_5 -Phello_5.gpr -g -cargs -gnatq -gnatQ -bargs -largs | ||
| 1117 | gcc -c -g -gnatyt -g -gnatq -gnatQ -I- -gnatA c:\Examples\Example_5\hello_5.adb | ||
| 1118 | gcc -c -g -gnatyt -g -gnatq -gnatQ -I- -gnatA c:\Examples\Example_4\hello_pkg.adb | ||
| 1119 | hello_pkg.adb:2:08: keyword "body" expected here [see file name] | ||
| 1120 | gnatmake: "c:\examples\example_4\hello_pkg.adb" compilation error | ||
| 1121 | @end example | ||
| 1122 | |||
| 1123 | Now type @key{C-x `}. @file{Example_4/hello_pkg.adb} is shown, | ||
| 1124 | demonstrating that @file{hello_5.gpr} and @file{hello_4.gpr} are being | ||
| 1125 | used to set the compilation search path. | ||
| 1126 | |||
| 1000 | @node Moving Through Ada Code, Identifier completion, Compiling Examples, Top | 1127 | @node Moving Through Ada Code, Identifier completion, Compiling Examples, Top |
| 1001 | @chapter Moving Through Ada Code | 1128 | @chapter Moving Through Ada Code |
| 1002 | @c ----------------------------------------------------------------------- | ||
| 1003 | 1129 | ||
| 1004 | There are several easy to use commands to navigate through Ada code. All | 1130 | There are several easy to use commands to navigate through Ada code. All |
| 1005 | these functions are available through the Ada menu, and you can also | 1131 | these functions are available through the Ada menu, and you can also |