aboutsummaryrefslogtreecommitdiffstats
path: root/doc/misc
diff options
context:
space:
mode:
authorJuanma Barranquero2008-07-28 11:03:42 +0000
committerJuanma Barranquero2008-07-28 11:03:42 +0000
commitd5875b259c24498d742b526d690abe1e59584b6c (patch)
tree979bf16813bcb526e38971a5519f30d7596da875 /doc/misc
parent42ffd097cf4bba5c5df93bf95f30cf2ea859a695 (diff)
downloademacs-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/ChangeLog4
-rw-r--r--doc/misc/ada-mode.texi316
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 @@
12008-07-28 Stephen Leake <stephen_leake@stephe-leake.org>
2
3 * ada-mode.texi: Update to Ada mode version 4.0.
4
12008-07-27 Michael Albinus <michael.albinus@gmx.de> 52008-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
268listed in the Ada menu. 268listed in the Ada menu.
269 269
270In multi-file projects, there must be one file that is the main 270In multi-file projects, there must be one file that is the main
271program. That is given by the @code{main_unit} project file variable; 271program. That is given by the @code{main} project file variable;
272it defaults to the current file if not yet set, but is also set by the 272it 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
280runs faster than full compile mode, speeding up finding and fixing 280runs faster than full compile mode, speeding up finding and fixing
281compilation errors. 281compilation errors.
282 282
283This sets @code{main_unit} only if it has not been set yet. 283This sets @code{main} only if it has not been set yet.
284 284
285@item Compile file 285@item Compile file
286Compiles the current file, by running @code{comp_cmd} from the current 286Compiles the current file, by running @code{comp_cmd} from the current
287project file. 287project file.
288 288
289This does not set @code{main_unit}. 289This does not set @code{main}.
290 290
291@item Set main and Build 291@item Set main and Build
292Sets @code{main_unit} to the current file, then executes the Build 292Sets @code{main} to the current file, then executes the Build
293command. 293command.
294 294
295@item Show main 295@item Show main
296Display @code{main_unit} in the message buffer. 296Display @code{main} in the message buffer.
297 297
298@item Build 298@item Build
299Compiles all obsolete units of the current @code{main_unit}, and links 299Compiles 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
302This sets @code{main_unit} only if it has not been set yet. 302This sets @code{main} only if it has not been set yet.
303 303
304@item Run 304@item Run
305Executes the main program in a shell, displayed in a separate Emacs 305Executes 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
315It is important when using these commands to understand how 315It 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
318Build runs 'gnatmake' on the main unit. During a typical edit/compile 318Build runs 'gnatmake' on the main unit. During a typical edit/compile
319session, this is the only command you need to invoke, which is why it 319session, 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
328this case, @key{C-c C-m} will normally be the only command needed; it 328this case, @key{C-c C-m} will normally be the only command needed; it
329will build the current file, rather than the last-built main. 329will build the current file, rather than the last-built main.
330 330
331There are three ways to change @code{main_unit}: 331There are three ways to change @code{main}:
332 332
333@enumerate 333@enumerate
334@item 334@item
335Invoke @key{Ada | Set main and Build}, which sets @code{main_unit} to 335Invoke @key{Ada | Set main and Build}, which sets @code{main} to
336the current file. 336the current file.
337 337
338@item 338@item
339Invoke @key{Ada | Project | Edit}, edit @code{main_unit} and 339Invoke @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
343Invoke @key{Ada | Project | Load}, and load a project file that specifies @code{main_unit} 343Invoke @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
372and other things on a per-project basis. 372and other things on a per-project basis.
373 373
374Note that Ada mode project files @samp{*.adp} are different than GNAT 374Note that Ada mode project files @samp{*.adp} are different than GNAT
375compiler project files @samp{*.gpr}. 375compiler project files @samp{*.gpr}. However, Emacs Ada mode can use a
376GNAT project project file to specify the project directories. If no
377other customization is needed, a GNAT project file can be used without
378an 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.
436To change the project file before or after the first one is found, 439To change the project file before or after the first one is found,
437invoke @key{Ada | Project | Load ...}. 440invoke @key{Ada | Project | Load ...}.
438 441
439Or, in lisp, evaluate @code{ada-set-default-project-file "/path/file.adp"}. 442Or, in lisp, evaluate @code{(ada-set-default-project-file "/path/file.adp")}.
440This sets @code{ada-prj-default-project-file}, and reads the project file. 443This sets @code{ada-prj-default-project-file}, and reads the project file.
441 444
445You 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
447file extension; if it is @code{.gpr}, the file is treated as a GNAT
448project file. Any other extension is treated as an Emacs Ada mode
449project 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
466used. 475used.
467 476
477In addition, process environment variables can be referenced using the
478same syntax, or the normal @code{$var} syntax.
479
468Most project variables have defaults that can be changed by setting 480Most project variables have defaults that can be changed by setting
469lisp variables; the table below identifies the lisp variable for each 481lisp variables; the table below identifies the lisp variable for each
470project variable. Lisp variables corresponding to project variables 482project variable. Lisp variables corresponding to project variables
471that are lists are lisp lists. 483that are lists are lisp lists.
472 484
485In general, project variables are evaluated when referenced in
486Emacs Ada mode commands. Relative file paths are expanded to
487absolute relative to @code{$@{build_dir@}}.
488
473Here is the list of variables. In the default values, the current 489Here is the list of variables. In the default values, the current
474directory @code{"."} is the project file directory. 490directory @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
479The 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 ";"}]
482A list of directories to search for source files, both for compile 496Path separator for @code{ADA_PROJECT_PATH}. It defaults to the correct
483commands and source navigation. 497value for a native implementation of GNAT for the current operating
498system. The user must override this when using Windows native GNAT
499with Cygwin Emacs, and perhaps in other cases.
484 500
485@item @code{obj_dir} [default: @code{"."}] 501Lisp variable: @code{ada-prj-ada-project-path-sep}.
486A list of directories to search for library files. Ada mode searches
487this list for the @samp{.ali} files generated by GNAT that contain
488cross-reference information.
489 502
490The compiler commands must place the @samp{.ali} files in one of these 503@item @code{ada_project_path} [default: @code{""}]
491directories; the default commands do that. 504A list of directories to search for GNAT project files.
505
506If set, the @code{ADA_PROJECT_PATH} process environment variable is
507set to this value in the Emacs process when the Emacs Ada mode project
508is selected via menu @samp{Ada | Project | Load}.
509
510For @code{ada_project_path}, relative file paths are expanded to
511absolute when the Emacs Ada project file is read, rather than when the
512project file is selected.
513
514For example if the project file is in the directory
515@file{/home/myproject}, the environment variable @code{GDS_ROOT} is
516set to @code{/home/shared}, and the project file contains:
517@example
518ada_project_path_sep=:
519ada_project_path=$GDS_ROOT/makerules
520ada_project_path=../opentoken
521@end example
522the environment variable @code{ADA_PROJECT_PATH} will be set to
523@code{"/home/shared/makerules:/home/opentoken/"}.
524
525The default value is not the current value of this environment
526variable, because that will typically have been set by another
527project, and will therefore be incorrect for this project.
528
529If you have the environment variable set correctly for all of your
530projects, you do not need to set this project variable.
531
532@item @code{bind_opt} [default: @code{""}]
533Holds user binder options; used in the default build commands.
534
535Lisp variable: @code{ada-prj-default-bind-opt}.
536
537@item @code{build_dir} [default: @code{"."}]
538The 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")}
494List of files containing casing exceptions. See the help on 541List 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
498Lisp variable: @code{ada-case-exception-file}. 545Lisp 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@}"}]
548Command used to syntax check a single file.
549The name of the file is substituted for @code{full_current}.
550
551Lisp 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@}"}]
554Command used to compile a single file.
555The name of the file is substituted for @code{full_current}.
556
557Lisp 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"}]
501Holds user compiler options; used in the default compile commands. The 560Holds user compiler options; used in the default compile commands. The
502default value tells gnatmake to generate library files for 561default value tells gnatmake to generate library files for
@@ -509,76 +568,81 @@ be used; @ref{Use GNAT project file}.
509 568
510Lisp variable: @code{ada-prj-default-comp-opt}. 569Lisp variable: @code{ada-prj-default-comp-opt}.
511 570
512@item @code{bind_opt} [default: @code{""}] 571@item @code{cross_prefix} [default: @code{""}]
513Holds user binder options; used in the default build commands. 572Name of target machine in a cross-compilation environment. Used in
514 573default compile and build commands.
515Lisp variable: @code{ada-prj-default-bind-opt}.
516
517@item @code{link_opt} [default: @code{""}]
518Holds user linker options; used in the default build commands.
519 574
520Lisp variable: @code{ada-prj-default-link-opt}. 575@item @code{debug_cmd} [default: @code{"$@{cross_prefix@}gdb $@{main@}"}]
576Command used to debug the application
521 577
522@item @code{gnatmake_opt} [default: @code{"-g"}] 578Lisp variable: @code{ada-prj-default-debugger}.
523Holds user gnatmake options; used in the default build commands.
524 579
525If a GNAT project file is used (for example @file{project.gpr}), this 580@item @code{debug_post_cmd} [default: @code{""}]
526option should be set to @code{-Pproject.gpr}. 581Command executed after @code{debug_cmd}.
527 582
528Lisp variable: @code{ada-prj-default-gnatmake-opt}. 583@item @code{debug_pre_cmd} [default: @code{"cd $@{build_dir@}"}]
584Command executed before @code{debug_cmd}.
529 585
530@item @code{gnatfind_opt} [default: @code{"-rf"}] 586@item @code{gnatfind_opt} [default: @code{"-rf"}]
531Holds user gnatfind options; used in the default find commands. 587Holds user gnatfind options; used in the default find commands.
532 588
533Lisp variable: @code{ada-prj-gnatfind-switches}. 589Lisp variable: @code{ada-prj-gnatfind-switches}.
534 590
535@item @code{main} [default: current file] 591@item @code{gnatmake_opt} [default: @code{"-g"}]
536Specifies the name of the executable file for the project; used in the 592Holds user gnatmake options; used in the default build commands.
537default build commands.
538 593
539@item @code{main_unit} [default: current Ada unit] 594Lisp variable: @code{ada-prj-default-gnatmake-opt}.
540Specifies the name of the main Ada unit for the project; used in the
541default build commands.
542 595
543@item @code{cross_prefix} [default: @code{""}] 596@item @code{gpr_file} [default: @code{""}]
544Name of target machine in a cross-compilation environment. Used in 597Specify GNAT project file.
545default compile and build commands.
546 598
547@item @code{remote_machine} [default: @code{""}] 599If set, the source and object directories specified in the GNAT
548Name of the machine to log into before issuing the compile and build 600project file are appended to @code{src_dir} and @code{obj_dir}. This
549commands. If this variable is empty, the command will be run on the 601allows specifying Ada source directories with a GNAT project file, and
550local machine. 602other 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@}"}] 604In addition, @code{-P@{gpr_file@}} is added to the project variable
553Command used to compile a single file. 605@code{gnatmake_opt} whenever it is referenced. With the default
554The name of the file is substituted for @code{full_current}. 606project variables, this passes the project file to all gnatmake
607commands.
555 608
556Lisp variable: @code{ada-prj-default-comp-cmd}. 609Lisp 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
559Command used to syntax check a single file.
560The name of the file is substituted for @code{full_current}.
561 612
562Lisp variable: @code{ada-prj-default-check-cmd} 613@item @code{link_opt} [default: @code{""}]
614Holds user linker options; used in the default build commands.
615
616Lisp 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]
619Specifies the name of the executable file for the project; used in the
620default 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@}"}]
565Command used to build the application. 623Command used to build the application.
566 624
567Lisp variable: @code{ada-prj-default-make-cmd}. 625Lisp variable: @code{ada-prj-default-make-cmd}.
568 626
569@item @code{run_cmd} [default: @code{"./$@{main@}"}] 627@item @code{obj_dir} [default: @code{"."}]
570Command used to run the application. 628A list of directories to search for library files. Ada mode searches
629this list for the @samp{.ali} files generated by GNAT that contain
630cross-reference information.
571 631
572@item @code{debug_pre_cmd} [default: @code{"cd $@{build_dir@}"}] 632The compiler commands must place the @samp{.ali} files in one of these
573Command executed before @code{debug_cmd}. 633directories; 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{""}]
576Command used to debug the application 636Name of the machine to log into before issuing the compile and build
637commands. If this variable is empty, the command will be run on the
638local machine.
577 639
578Lisp variable: @code{ada-prj-default-debugger}. 640@item @code{run_cmd} [default: @code{"./$@{main@}"}]
641Command used to run the application.
579 642
580@item @code{debug_post_cmd} [default: @code{""}] 643@item @code{src_dir} [default: @code{"."}]
581Command executed after @code{debug_cmd}. 644A list of directories to search for source files, both for compile
645commands 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
632end Hello_2; 697end Hello_2;
633@end example 698@end example
634 699
700This 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
640end Hello_Pkg; 707end Hello_Pkg;
641@end example 708@end example
642 709
710This 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
686Now invoke @key{Ada | Show main}; this displays @file{Ada mode main_unit: hello}. 755Now invoke @key{Ada | Show main}; this displays @file{Ada mode main: hello}.
687 756
688Now (in buffer @file{hello.adb}), invoke @key{Ada | Build}. You are 757Now (in buffer @file{hello.adb}), invoke @key{Ada | Build}. You are
689prompted to save the file (if you haven't already). Then the 758prompted 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
730project file}. 799project file}.
731 800
732Invoke @key{Ada | Show main}; this displays @file{Ada mode main_unit: hello_2}. 801Invoke @key{Ada | Show main}; this displays @file{Ada mode main: hello_2}.
733 802
734Move to the error with @key{C-x `}, and fix the error by adding @code{body}: 803Move 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
740Now, while still in @file{hello_pkg.adb}, invoke @key{Ada | Build}. 809Now, while still in @file{hello_pkg.adb}, invoke @key{Ada | Build}.
741gnatmake successfully builds @file{hello_2}. This demonstrates that 810gnatmake successfully builds @file{hello_2}. This demonstrates that
742Emacs has remembered the main file, in the project variable 811Emacs 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
745Finally, again while in @file{hello_pkg.adb}, invoke @key{Ada | Run}. 814Finally, again while in @file{hello_pkg.adb}, invoke @key{Ada | Run}.
746The @code{*run*} buffer displays @code{Hello from hello_pkg.adb}. 815The @code{*run*} buffer displays @code{Hello from hello_pkg.adb}.
747 816
748One final point. If you switch back to buffer @file{hello.adb}, and 817One final point. If you switch back to buffer @file{hello.adb}, and
749invoke @key{Ada | Run}, @file{hello_2.exe} will be run. That is 818invoke @key{Ada | Run}, @file{hello_2.exe} will be run. That is
750because @code{main_unit} is still set to @code{hello_2}, as you can 819because @code{main} is still set to @code{hello_2}, as you can
751see when you invoke @key{Ada | Project | Edit}. 820see when you invoke @key{Ada | Project | Edit}.
752 821
753There are three ways to change @code{main_unit}: 822There are three ways to change @code{main}:
754 823
755@enumerate 824@enumerate
756@item 825@item
757Invoke @key{Ada | Set main and Build}, which sets @code{main_unit} to 826Invoke @key{Ada | Set main and Build}, which sets @code{main} to
758the current file. 827the current file.
759 828
760@item 829@item
761Invoke @key{Ada | Project | Edit}, edit @code{main_unit} and 830Invoke @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
765Invoke @key{Ada | Project | Load}, and load a project file that specifies @code{main_unit} 834Invoke @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
834In this example, we show how to deal with files in more than one 903In this example, we show how to deal with files in more than one
835directory. We start with the same code as in @ref{No project files}; create those 904directory. We start with the same code as in @ref{No project files};
836files (with the errors present) 905create those files (with the errors present)
837 906
838Create the directory @file{Example_3}, containing: 907Create the directory @file{Example_3}, containing:
839 908
@@ -912,10 +981,11 @@ compiler error message.
912Fixing the error, linking and running the code proceed as in @ref{No 981Fixing the error, linking and running the code proceed as in @ref{No
913project files}. 982project 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
918In this example, we show how to use a GNAT project file. 987In this example, we show how to use a GNAT project file, with no Ada
988mode project file.
919 989
920Create the directory @file{Example_4}, containing: 990Create the directory @file{Example_4}, containing:
921 991
@@ -945,7 +1015,7 @@ error on line 2.
945In addition, create a directory @file{Example_4/Gnat_Project}, 1015In addition, create a directory @file{Example_4/Gnat_Project},
946containing these files: 1016containing these files:
947 1017
948@file{Other/hello_4.adb}: 1018@file{Gnat_Project/hello_4.adb}:
949 1019
950@example 1020@example
951with Hello_Pkg; 1021with Hello_Pkg;
@@ -959,13 +1029,6 @@ end Hello_4;
959 1029
960There are no errors in this file. 1030There are no errors in this file.
961 1031
962@file{Gnat_Project/hello_4.adp}:
963
964@example
965src_dir=..
966gnatmake_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
977In buffer @file{hello_4.adb}, invoke @key{Ada | Project | Load...}, and 1040In buffer @file{hello_4.adb}, invoke @key{Ada | Project | Load...}, and
978select @file{Example_4/Gnat_Project/hello_4.adp}. 1041select @file{Example_4/Gnat_Project/hello_4.gpr}.
979 1042
980Then, again in @file{hello_4.adb}, invoke @key{Ada | Set main and 1043Then, again in @file{hello_4.adb}, invoke @key{Ada | Set main and
981Build}. You should get a @code{*compilation*} buffer containing 1044Build}. You should get a @code{*compilation*} buffer containing
@@ -997,9 +1060,72 @@ set the compiler options.
997Fixing the error, linking and running the code proceed as in @ref{No 1060Fixing the error, linking and running the code proceed as in @ref{No
998project files}. 1061project files}.
999 1062
1063@node Use multiple GNAT project files, , Use GNAT project file, Compiling Examples
1064@section Use multiple GNAT project files
1065
1066In this example, we show how to use multiple GNAT project files,
1067specifying the GNAT project search path in an Ada mode project file.
1068
1069Create the directory @file{Example_4} as specified in @ref{Use GNAT
1070project file}.
1071
1072Create the directory @file{Example_5}, containing:
1073
1074@file{hello_5.adb}:
1075
1076@example
1077with Hello_Pkg;
1078with Ada.Text_IO; use Ada.Text_IO;
1079procedure Hello_5
1080is begin
1081 Hello_Pkg.Say_Hello;
1082 Put_Line ("From hello_5");
1083end Hello_5;
1084@end example
1085
1086There are no errors in this file.
1087
1088@file{hello_5.adp}:
1089
1090@example
1091ada_project_path=../Example_4/Gnat_Project
1092gpr_file=hello_5.gpr
1093@end example
1094
1095@file{hello_5.gpr}:
1096
1097@example
1098with "hello_4";
1099Project Hello_5 is
1100 for Source_Dirs use (".");
1101 package Compiler is
1102 for Default_Switches ("Ada") use ("-g", "-gnatyt");
1103 end Compiler;
1104end Hello_5;
1105@end example
1106
1107In buffer @file{hello_5.adb}, invoke @key{Ada | Project | Load...}, and
1108select @file{Example_5/hello_5.adp}.
1109
1110Then, again in @file{hello_5.adb}, invoke @key{Ada | Set main and
1111Build}. You should get a @code{*compilation*} buffer containing
1112something like (the directory paths will be different):
1113
1114@example
1115cd c:/Examples/Example_5/
1116gnatmake -o hello_5 hello_5 -Phello_5.gpr -g -cargs -gnatq -gnatQ -bargs -largs
1117gcc -c -g -gnatyt -g -gnatq -gnatQ -I- -gnatA c:\Examples\Example_5\hello_5.adb
1118gcc -c -g -gnatyt -g -gnatq -gnatQ -I- -gnatA c:\Examples\Example_4\hello_pkg.adb
1119hello_pkg.adb:2:08: keyword "body" expected here [see file name]
1120gnatmake: "c:\examples\example_4\hello_pkg.adb" compilation error
1121@end example
1122
1123Now type @key{C-x `}. @file{Example_4/hello_pkg.adb} is shown,
1124demonstrating that @file{hello_5.gpr} and @file{hello_4.gpr} are being
1125used 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
1004There are several easy to use commands to navigate through Ada code. All 1130There are several easy to use commands to navigate through Ada code. All
1005these functions are available through the Ada menu, and you can also 1131these functions are available through the Ada menu, and you can also