1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876
|
<HTML>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created on May, 22 2008 by texi2html 1.64-gnat-1 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
-->
<HEAD>
<TITLE>ASIS-for-GNAT User's Guide: ASIS Context</TITLE>
<META NAME="description" CONTENT="ASIS-for-GNAT User's Guide: ASIS Context">
<META NAME="keywords" CONTENT="ASIS-for-GNAT User's Guide: ASIS Context">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.64-gnat-1">
</HEAD>
<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<A NAME="SEC24"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_4.html#SEC23"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC25"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_6.html#SEC38"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_6.html#SEC38"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_15.html#SEC56">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 4. ASIS <CODE>Context</CODE> </H1>
<!--docid::SEC24::-->
<P>
From an ASIS application viewpoint we may view an ASIS <CODE>Context</CODE> as a set of
ASIS <CODE>Compilation_Unit</CODE>s accessible through ASIS queries.
<A NAME="IDX108"></A>
The common ASIS
implementation technique is to base an implementation of an ASIS <CODE>Context</CODE> on
some persistent data structures created by the underlying Ada compiler when
compiling Ada compilation units maintained by this compiler. An ASIS <CODE>Context</CODE>
can only contain compilable (that is, legal) compilation units.
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="asis_ug_5.html#SEC25">4.1 ASIS <CODE>Context</CODE> and Tree Files</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="asis_ug_5.html#SEC26">4.2 Creating Tree Files for Use by ASIS</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="asis_ug_5.html#SEC28">4.3 Different Ways to Define an ASIS <CODE>Context</CODE> in ASIS-for-GNAT</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="asis_ug_5.html#SEC33">4.4 Consistency Problems</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="asis_ug_5.html#SEC36">4.5 Processing Several <CODE>Context</CODE>s at a Time</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="asis_ug_5.html#SEC37">4.6 Using ASIS with a cross-compiler</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<A NAME="ASIS Context and Tree Files"></A>
<HR SIZE="6">
<A NAME="SEC25"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC24"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC26"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC24"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC24"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_6.html#SEC38"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_15.html#SEC56">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 4.1 ASIS <CODE>Context</CODE> and Tree Files </H2>
<!--docid::SEC25::-->
<P>
The ASIS-for-GNAT
<A NAME="IDX109"></A>
implementation is based on <EM>tree output files</EM>,
or, simply, <EM>tree files</EM>. When called with the special option
<SAMP>`-gnatt'</SAMP>,
<A NAME="IDX110"></A>
GNAT creates and outputs a tree file if no error was
detected during the compilation. The tree file is a kind of snapshot of
the compiler internal data structures (basically, of the Abstract Syntax Tree
(AST))
<A NAME="IDX111"></A>
at the end of the successful compilation. ASIS then inputs tree
files and recreates in its internal data structures exactly the same picture
the compiler had at the end of the corresponding successful compilation.
</P><P>
An important consequence of the GNAT source-based compilation model is that the
AST contains full information not only about the unit being compiled, but also
about all the units upon which this unit depends semantically. Therefore,
having read a tree file, ASIS can in general provide information about more
than one unit. By processing a tree file, a tool can provide information about the
unit for which this tree was created and about all the units upon which it
depends semantically. However, to process several units, ASIS sometimes has to
change the tree being processed (in particular, this occurs when an
application switches between units which do not semantically depend on each
other, for example, two package bodies). Therefore, in the course of an ASIS
application, ASIS may read different tree files and it may read the same tree
file more then once.
</P><P>
The name of a tree file is obtained from the name of the source file being
compiled by replacing its suffix with '<TT>`.adt'</TT>'. For example, the tree
file for <TT>`foo.adb'</TT> is named <TT>`foo.adt'</TT>.
<A NAME="IDX112"></A>
</P><P>
<A NAME="Creating Tree Files for Use by ASIS"></A>
<HR SIZE="6">
<A NAME="SEC26"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC25"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC27"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC28"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC24"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC28"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_15.html#SEC56">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 4.2 Creating Tree Files for Use by ASIS </H2>
<!--docid::SEC26::-->
<P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="asis_ug_5.html#SEC27">4.2.1 Creating Trees for Data Decomposition Annex</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
</TABLE></BLOCKQUOTE>
<P>
Neither <CODE>gcc</CODE> nor <CODE>gnatmake</CODE> will create tree files automatically when you
are working with your Ada program. It is your responsibility as a user of an
ASIS application to create a set of tree files that correctly reflect
the set of the Ada components to be processed by the ASIS application, as
well as to maintain the consistency of the trees and the related source files.
</P><P>
To create a tree file for a given source file, you need to compile the corresponding source file
with the <SAMP>`-gnatc'</SAMP> and <SAMP>`-gnatt'</SAMP> options (these may be combined
into the <SAMP>`-gnatct'</SAMP> option. Thus
<A NAME="IDX113"></A>
<A NAME="IDX114"></A>
<A NAME="IDX115"></A>
</P><P>
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=+0><pre>$ gcc -c -gnatc -gnatt foo.adb
</FONT></pre></td></tr></table></P><P>
will produce <TT>`foo.adt'</TT>, provided that <TT>`foo.adb'</TT> contains the source
of a legal Ada compilation unit. The <SAMP>`-gnatt'</SAMP> option generates a tree file,
<A NAME="IDX116"></A>
and
<SAMP>`-gnatc'</SAMP> turns off AST expansion. ASIS needs tree files created without
AST expansion, whereas to create an object file, GNAT needs an expanded AST.
<A NAME="IDX117"></A>
Therefore it is impossible for one compilation command to
to produce both a tree file and an object file for a given source file.
</P><P>
The following points are important to remember when generating and dealing
with tree files:
</P><P>
<UL>
<LI>
ASIS-for-GNAT is distributed for a particular version of
GNAT.
<A NAME="IDX118"></A>
All the trees to be processed by an ASIS application should be
generated by this specific version of the compiler.
<P>
<LI>
A tree file is not created if an error has been detected during the
compilation.
<P>
<LI>
In contrast with object files, a tree file may be generated for any legal Ada
compilation unit, including a library package declaration requiring a body
or a subunit.
<P>
<LI>
A set of tree files processed by an ASIS application may be inconsistent;
for example, two tree files may have been created with different versions
of the source of the same unit. This will lead to inconsistencies in the
corresponding ASIS <CODE>Context</CODE>. See <A HREF="asis_ug_5.html#SEC33">4.4 Consistency Problems</A>, for more details.
<P>
<LI>
Do not move tree, object or source files among directories in the underlying
file system! ASIS might assume an inconsistency between
tree and source files when opening a <CODE>Context</CODE>, or you may get wrong results
when querying the source or object file for a given ASIS
<CODE>Compilation_Unit</CODE>.
<P>
<LI>
When invoking <CODE>gcc</CODE> or <CODE>gnatmake</CODE> to create tree files,
<A NAME="IDX119"></A>
make sure that all file and
directory names containing relative path information start from
<TT>`./'</TT> or <TT>`../'</TT> (<TT>`.\'</TT> and <TT>`..\'</TT> respectively in MS Windows).
That is, to create a
tree file for the source file <TT>`foo.adb'</TT> located in the inner directory
named <TT>`inner'</TT>, you should invoke gcc (assuming an MS Windows platform) as:
<P>
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=+0><pre>$ gcc -c -gnatc -gnatt .\inner\foo.adb
</FONT></pre></td></tr></table></P><P>
but not as
</P><P>
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=+0><pre>$ gcc -c -gnatc -gnatt inner\foo.ads
</FONT></pre></td></tr></table></P><P>
Otherwise ASIS will not perform correctly.
</P><P>
<LI>
When reading in a tree file, ASIS checks that this tree file was created with
the <SAMP>`-gnatc'</SAMP> option, and it does not accept trees created without
this option.
<A NAME="IDX120"></A>
<P>
<LI>
If called to create a tree, GNAT does not destroy an <TT>`ALI'</TT> file if the <TT>`ALI'</TT> file
already exists for the unit being compiled and if this <TT>`ALI'</TT> file is
up-to-date. Moreover, GNAT may place some information from the existing <TT>`ALI'</TT>
file into the tree file. If you would like to have both object
and tree files for your program, first create the object files, and then the tree
files.
<P>
<LI>
There is only one extension for tree files, namely <TT>`.adt'</TT>, whereas the standard
GNAT name convention for the Ada source files uses different extensions
for a spec (<TT>`.ads'</TT>) and for a body (<TT>`.adb'</TT>). This means that if you
first generate a tree for a unit's body:
<P>
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=+0><pre>$ gcc -c -gnatc -gnatt foo.adb
</FONT></pre></td></tr></table></P><P>
and then generate the tree for the corresponding spec:
</P><P>
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=+0><pre>$ gcc -c -gnatc -gnatt foo.ads
</FONT></pre></td></tr></table></P><P>
then the tree file <TT>`foo.adt'</TT>
<A NAME="IDX121"></A>
will be created twice: first for the
body, and then for the spec. The tree for the spec will override
the tree for the body, and the information about the body will be lost
for ASIS. If you first create the tree for a spec, and then for a body,
the second tree will also override the first one, but no information will
be lost for ASIS, because the tree for a body contains full
information about the corresponding spec.
</P><P>
To avoid losing information when creating trees for a set of Ada sources,
try to use <CODE>gnatmake</CODE> whenever possible (see
<A HREF="asis_ug_9.html#SEC50">8.4 Using <CODE>gnatmake</CODE> to Create Tree Files</A> for more details).
Otherwise, first create trees for specs and then for bodies:
</P><P>
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=+0><pre>$ gcc -c -gnatc -gnatt *.ads
$ gcc -c -gnatc -gnatt *.adb
</FONT></pre></td></tr></table></P><P>
<LI>
Reading tree files is a time-consuming operation. Try to minimize the number
of tree files to be processed by your application, and try to avoid unnecessary
tree swappings.
<A NAME="IDX122"></A>
(See <A HREF="asis_ug_9.html#SEC46">8. How to Build Efficient ASIS Applications</A>, for some
tips).
<P>
<LI>
It is possible to create tree files "on the fly", as part of the
processing of the ASIS queries that obtain units from a <CODE>Context</CODE>. In this
case there is no need to create tree files before running an ASIS application
using the corresponding <CODE>Context</CODE> mode. Note that this possibility goes beyond
the ASIS Standard, and there are some limitations imposed on
some ASIS queries, but this functionality may be useful for
ASIS tools that process only one <CODE>Compilation_Unit</CODE> at a time. See the
<CITE>ASIS-for-GNAT Reference Manual</CITE> for more details.
</UL>
<P>
Note that between opening and closing a <CODE>Context</CODE>, an ASIS application should
not change its working directory; otherwise execution of the application is
erroneous.
<A NAME="IDX123"></A>
</P><P>
<A NAME="Creating Trees for Data Decomposition Annex"></A>
<HR SIZE="6">
<A NAME="SEC27"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC26"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC28"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC28"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC26"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC28"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_15.html#SEC56">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.2.1 Creating Trees for Data Decomposition Annex </H3>
<!--docid::SEC27::-->
<P>
Using the ASIS Data Decomposition Annex (DDA) does not require anything special
to be done by an ASIS user, with one exception. The implementation of the ASIS
DDA is based on some special annotations added by the compiler to the trees
used by ASIS. An ASIS user should be aware of the fact that trees created for
subunits do not have this special annotation.
<A NAME="IDX124"></A>
Therefore ASIS DDA queries do
not work correctly on trees created for subunits (and these queries might not
work correctly if a set of tree files making up a <CODE>Context</CODE> contains a tree
created for a subunit).
</P><P>
Thus, when working with the ASIS DDA, you should avoid creating separate trees
for subunits. Actually, this is not a limitation: to create a tree for a
subunit, you should also have the source of the parent body available. If in
this situation you create the tree for the parent body, it will contain
the full information (including DDA-specific annotation) for all the subunits
that are present. From the other side, a tree created for a single subunit has
to contain information about the parent body, so it has about the same size
as the tree for the parent body.
</P><P>
The best way to create trees when using ASIS DDA is to use <CODE>gnatmake</CODE>: it will
never create separate trees for subunits.
</P><P>
<A NAME="Different Ways to Define an ASIS Context in ASIS-for-GNAT"></A>
<HR SIZE="6">
<A NAME="SEC28"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC27"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC29"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC33"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC24"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC33"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_15.html#SEC56">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 4.3 Different Ways to Define an ASIS <CODE>Context</CODE> in ASIS-for-GNAT </H2>
<!--docid::SEC28::-->
<P>
The <CODE>Asis.Ada_Environments.Associate</CODE> query
<A NAME="IDX125"></A>
that defines a <CODE>Context</CODE> has the following spec:
</P><P>
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=+0><pre>procedure Associate
(The_Context : in out Asis.Context;
Name : in Wide_String;
Parameters : in Wide_String := Default_Parameters);
</FONT></pre></td></tr></table></P><P>
In ASIS-for-GNAT, <CODE>Name</CODE> does not have any special meaning, and the
properties of the <CODE>Context</CODE> are set by "options" specified
in the <CODE>Parameters</CODE> string:
</P><P>
<UL>
<LI>
How to define a set of tree files making up the <CODE>Context</CODE> (<SAMP>`-C'</SAMP> options);
<P>
<LI>
How to deal with tree files when opening a <CODE>Context</CODE> and when
processing ASIS queries (<SAMP>`-F'</SAMP> options);
<P>
<LI>
How to process the source files during the consistency check when
opening the <CODE>Context</CODE> (<SAMP>`-S'</SAMP> options):
<P>
<LI>
The search path for tree files making up the <CODE>Context</CODE> (<SAMP>`-T'</SAMP> options);
<P>
<LI>
The search path for source files used for calling GNAT to create a tree
file "on the fly" (<SAMP>`-I'</SAMP> options);
</UL>
<P>
The association parameters may (and in some cases must) also contain the
names of tree files or directories making up search paths for tree and/or
source files. Below is the overview of the <CODE>Context</CODE> association parameters in
ASIS-for-GNAT; for full details refer to the <CITE>ASIS-for-GNAT Reference Manual</CITE>.
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="asis_ug_5.html#SEC29">4.3.1 Defining a set of tree files making up a <CODE>Context</CODE></A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="asis_ug_5.html#SEC30">4.3.2 Dealing with tree files when opening a <CODE>Context</CODE> and processing ASIS queries</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="asis_ug_5.html#SEC31">4.3.3 Processing source files during the consistency check</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="asis_ug_5.html#SEC32">4.3.4 Setting search paths</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<A NAME="Defining a set of tree files making up a Context"></A>
<HR SIZE="6">
<A NAME="SEC29"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC28"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC30"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC33"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC28"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC33"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_15.html#SEC56">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.3.1 Defining a set of tree files making up a <CODE>Context</CODE> </H3>
<!--docid::SEC29::-->
<P>
The following options are available:
</P><P>
<DL COMPACT>
<DT><SAMP>`-C1'</SAMP>
<DD>"One tree" <CODE>Context</CODE>,
<A NAME="IDX126"></A>
defining a <CODE>Context</CODE> comprising a single tree file; this tree
file name should be given explicitly in the <CODE>Parameters</CODE> string.
<P>
<DT><SAMP>`-CN'</SAMP>
<DD>"N-trees" <CODE>Context</CODE>,
<A NAME="IDX127"></A>
defining a <CODE>Context</CODE> comprising a set of tree files; the names
of the tree files making up the <CODE>Context</CODE> should be given explicitly in the
<CODE>Parameters</CODE> string.
<P>
<DT><SAMP>`-CA'</SAMP>
<DD>"All trees" <CODE>Context</CODE>,
<A NAME="IDX128"></A>
defining a <CODE>Context</CODE> comprising all the tree files in the
tree search path given in the same <CODE>Parameters</CODE> string; if this option
is set together with <SAMP>`-FM'</SAMP> option, ASIS can also create new tree files
"on the fly" when processing queries yielding ASIS <CODE>Compilation_Unit</CODE>s.
</DL>
<P>
The default option is <SAMP>`-CA'</SAMP>.
</P><P>
Note that for <SAMP>`-C1'</SAMP>, the <CODE>Parameters</CODE> string should contain the name of exactly
one tree file. Moreover, if during the opening of such a
<CODE>Context</CODE> this tree file could not be successfully read in because of any
reason, the <CODE>Asis_Failed</CODE> exception is raised.
<A NAME="IDX129"></A>
</P><P>
<A NAME="Dealing with tree files when opening a Context and processing ASIS queries"></A>
<HR SIZE="6">
<A NAME="SEC30"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC29"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC31"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC31"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC28"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC33"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_15.html#SEC56">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.3.2 Dealing with tree files when opening a <CODE>Context</CODE> and processing ASIS queries </H3>
<!--docid::SEC30::-->
<P>
The following options are available:
</P><P>
<DL COMPACT>
<DT><SAMP>`-FT'</SAMP>
<DD>Only pre-created trees are used, no tree file can be created by ASIS.
<P>
<DT><SAMP>`-FS'</SAMP>
<DD>All the trees considered as making up a given <CODE>Context</CODE> are created "on
the fly", whether or not the corresponding tree file already exists;
once created, a tree file may then be reused while the <CODE>Context</CODE> remains
open. This option can be set only with <SAMP>`-CA'</SAMP> option.
<P>
<DT><SAMP>`-FM'</SAMP>
<DD>Mixed approach: if a needed tree does not exist, the attempt to create
it "on the fly" is made. This option can only be set with <SAMP>`-CA'</SAMP> option.
</DL>
<P>
The default option is <SAMP>`-FT'</SAMP>.
</P><P>
Note that the <SAMP>`-FS'</SAMP> and <SAMP>`-FM'</SAMP> options
go beyond the scope of the
official ASIS standard. They may be useful for some ASIS applications with
specific requirements for defining and processing an ASIS <CODE>Context</CODE>,
but in each case the ramifications of using such non-standard options
should be carefully considered. See the <CITE>ASIS-for-GNAT Reference Manual</CITE>
for a detailed description of these option.
</P><P>
<A NAME="Processing source files during the consistency check"></A>
<HR SIZE="6">
<A NAME="SEC31"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC30"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC32"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC32"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC28"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC33"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_15.html#SEC56">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.3.3 Processing source files during the consistency check </H3>
<!--docid::SEC31::-->
<P>
When ASIS reads a tree fule as a part of opening a <CODE>Context</CODE>, it
checks, that the tree is consistent with the source files of the
<CODE>Compilation_Unit</CODE>s represented by this tree.
</P><P>
The following options are available to control this check:
</P><P>
<DL COMPACT>
<DT><SAMP>`-SA'</SAMP>
<DD>Source files for all the <CODE>Compilation_Unit</CODE>s belonging to the <CODE>Context</CODE> (except
the predefined <CODE>Standard</CODE> package) have to be available, and all of them
are taken into account for consistency checks when opening the <CODE>Context</CODE>.
<P>
<DT><SAMP>`-SE'</SAMP>
<DD>Only existing source files for all the <CODE>Compilation_Unit</CODE>s belonging to the
<CODE>Context</CODE> are taken into account for consistency checks when opening the <CODE>Context</CODE>.
<P>
<DT><SAMP>`-SN'</SAMP>
<DD>None of the source files from the underlying file system are taken into
account when checking the consistency of the set of tree files making up a
<CODE>Context</CODE> (that is, no check is made).
</DL>
<P>
The default option is <SAMP>`-SA'</SAMP>.
See <A HREF="asis_ug_5.html#SEC33">4.4 Consistency Problems</A>, concerning consistency issues in ASIS-for-GNAT.
</P><P>
<A NAME="Setting search paths"></A>
<HR SIZE="6">
<A NAME="SEC32"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC31"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC33"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC33"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC28"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC33"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_15.html#SEC56">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.3.4 Setting search paths </H3>
<!--docid::SEC32::-->
<P>
Using the <SAMP>`-I'</SAMP>, <SAMP>`-gnatec'</SAMP> and <SAMP>`-gnatA'</SAMP> options for defining
an ASIS <CODE>Context</CODE> is similar to using the same optionsfor <CODE>gcc</CODE>.
The <SAMP>`-T'</SAMP> option is used in the same way,
for tree files. For full details about the <SAMP>`-T'</SAMP> and <SAMP>`-I'</SAMP>
options, refer to the <CITE>ASIS-for-GNAT Reference Manual</CITE>. Note that the <SAMP>`-T'</SAMP>
option is used only to locate existing tree files, and it has no effect for
<SAMP>`-FS'</SAMP> <CODE>Context</CODE>s. On the other hand, the <SAMP>`-I'</SAMP> option is used only to
construct a set of arguments when ASIS calls GNAT to create a tree file "on
the fly"; it has no effect for <SAMP>`-FT'</SAMP> <CODE>Context</CODE>s, and it cannot be used to
tell ASIS where it should look for source files for ASIS <CODE>Compilation_Unit</CODE>s.
</P><P>
<A NAME="Consistency Problems"></A>
<HR SIZE="6">
<A NAME="SEC33"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC32"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC34"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC36"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC24"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC36"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_15.html#SEC56">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 4.4 Consistency Problems </H2>
<!--docid::SEC33::-->
<P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="asis_ug_5.html#SEC34">4.4.1 Inconsistent versions of ASIS and GNAT</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="asis_ug_5.html#SEC35">4.4.2 Consistency of a set of tree and source files</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
</TABLE></BLOCKQUOTE>
<P>
There are two different kinds of consistency problems existing for
ASIS-for-GNAT, and both of them can show up when opening an ASIS <CODE>Context</CODE>.
</P><P>
First, a tree file may have been created by another version of GNAT (see the
README file about the coordination between the GNAT and ASIS-for-GNAT
versions). This means that there is an ASIS-for-GNAT installation problem.
<A NAME="IDX130"></A>
<A NAME="IDX131"></A>
</P><P>
Second, the tree files may be inconsistent with the existing
source files or with each other.
</P><P>
<A NAME="Inconsistent versions of ASIS and GNAT"></A>
<HR SIZE="6">
<A NAME="SEC34"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC33"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC35"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC36"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC33"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC36"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_15.html#SEC56">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.4.1 Inconsistent versions of ASIS and GNAT </H3>
<!--docid::SEC34::-->
<P>
When ASIS-for-GNAT reads a tree file created by the version of the compiler
for which a given version of ASIS-for-GNAT is not supposed to be used, ASIS
treats the situation as an ASIS-for-GNAT installation problem
and raises <CODE>Program_Error</CODE>
<A NAME="IDX132"></A>
with a corresponding exception message. In
this case, <CODE>Program_Error</CODE> is not caught by any ASIS query, and it propagates
outside ASIS.<A NAME="DOCF3" HREF="asis_ug_fot.html#FOOT3">(3)</A>
Note that the real cause may be an old tree file you have forgotten to
remove when reinstalling ASIS-for-GNAT. This is also considered an
installation error.
</P><P>
ASIS uses the tree files created by the GNAT compiler installed on your
machine, and the ASIS implementation includes some compiler components to
define and to get access to the corresponding data structures. Therefore,
the version of the GNAT compiler installed on your machine and the version
of the GNAT compiler whose sources are used as a part of the ASIS
implementation should be close enough to define the same data structures.
We do not require these versions to be exactly the same, and, by default,
when ASIS reads a tree file it only checks for significant differences.
That is, it will accept tree files from previous versions of GNAT as long as
it is possible for such files to be read. In theory, this check is not 100%
safe; that is, a tree created by one version of GNAT might not be correctly
processed by ASIS built with GNAT sources taken from another version.
But in practice this situation is extremely unlikely.
</P><P>
An ASIS application may set a strong GNAT version check by providing the
<SAMP>`-vs'</SAMP> parameter for the ASIS <CODE>Initialize</CODE> procedure, see
<CITE>ASIS-for-GNAT Reference Manual</CITE>
for more details. If the strong version check is set, then only a
tree created by exactly the same version of GNAT whose sources are used
as a part of the ASIS implementation can be successfully read in, and
<CODE>Program_Error</CODE> will be raised otherwise.
</P><P>
Be careful when using a <CODE>when others</CODE> exception handler in your ASIS
application: do not use it just to catch non-ASIS exceptions and to ignore
them without any analysis.
</P><P>
<A NAME="Consistency of a set of tree and source files"></A>
<HR SIZE="6">
<A NAME="SEC35"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC34"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC36"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC36"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC33"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC36"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_15.html#SEC56">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 4.4.2 Consistency of a set of tree and source files </H3>
<!--docid::SEC35::-->
<P>
When processing a set of more then one tree file making up the same <CODE>Context</CODE>,
ASIS may face a consistency problem. A set of tree files is inconsistent if it
contains two trees representing the same compilation unit, and these trees
were created with different versions of the source of this unit. A tree file
is inconsistent with a source of a unit represented by this tree if the source
file currently available for the unit differs from the source used to create
the tree file.
</P><P>
When opening a <CODE>Context</CODE> (via the <CODE>Asis.Ada_Environments.Open</CODE> query),
<A NAME="IDX133"></A>
ASIS does the
following checks for all the tree files making up the <CODE>Context</CODE>:
</P><P>
<UL>
<LI>
If the <SAMP>`-SA'</SAMP> option is set for the <CODE>Context</CODE>, ASIS checks that for every
<CODE>Compilation_Unit</CODE> represented by a tree, the source file is available and it
is the same as the source file used to create the tree (a tree file contains
references to all the source files used to create this tree file).
<P>
<LI>
If the <SAMP>`-SE'</SAMP> option is set for the <CODE>Context</CODE>, then if for a <CODE>Compilation_Unit</CODE>
represented by a tree a source file is available, ASIS checks that this
source is the same as the source used to create the tree. If for a
<CODE>Compilation_Unit</CODE> belonging to a <CODE>Context</CODE> a source file is not available, ASIS
checks that all the tree files containing this unit were created with the
same version of the source of this unit.
<P>
<LI>
If the <SAMP>`-SN'</SAMP> option is set for the <CODE>Context</CODE>, ASIS checks that all the trees
were created from the same versions of the sources involved. It does not check if any of
these sources is available or if this is the same version of the source that has been
used to create the tree files.
</UL>
<P>
If any of these checks fail, the <CODE>Asis_Failed</CODE> exception
<A NAME="IDX134"></A>
is raised as a result of
opening a <CODE>Context</CODE>. If the <CODE>Context</CODE> has been successfully opened,
you are guaranteed
that ASIS will process only consistent sets of tree and source files until the
<CODE>Context</CODE> is closed (provided that this set is not changed by some non-ASIS
actions).
</P><P>
<A NAME="Processing Several Contexts at a Time"></A>
<HR SIZE="6">
<A NAME="SEC36"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC35"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC37"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC37"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC24"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_6.html#SEC38"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_15.html#SEC56">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 4.5 Processing Several <CODE>Context</CODE>s at a Time </H2>
<!--docid::SEC36::-->
<P>
If your application processes more then one open <CODE>Context</CODE> at a time, and if
at least one of the <CODE>Context</CODE>s is defined with an <SAMP>`-FS'</SAMP> or <SAMP>`-FM'</SAMP> option,
be aware that all the tree files created by ASIS "on the fly" are
placed in the current directory. Therefore, to be on the safe side when
processing several opened <CODE>Context</CODE>s at a time, an ASIS application should
have at most one <CODE>Context</CODE> defined with an <SAMP>`-FS'</SAMP> or <SAMP>`-FM'</SAMP> option. If the
application has such a <CODE>Context</CODE>, all the other <CODE>Context</CODE>s should not use
tree files located in the current directory.
</P><P>
<A NAME="Using ASIS with a cross-compiler"></A>
<HR SIZE="6">
<A NAME="SEC37"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC36"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_6.html#SEC38"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC24"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC24"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_6.html#SEC38"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_15.html#SEC56">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 4.6 Using ASIS with a cross-compiler </H2>
<!--docid::SEC37::-->
<P>
If you would like to use ASIS with a cross-compiler, you should use
this cross-compiler to create the tree files to be used for the ASIS
<CODE>Context</CODE> defined with <SAMP>`-FS'</SAMP> option. If you would like to
use trees created on the fly (that is, to use a <CODE>Context</CODE> defined with the
<SAMP>`-FS'</SAMP> or <SAMP>`-FM'</SAMP> option), you have to tell ASIS which compiler should
be called to perform this function. There are two ways to do this.
</P><P>
<UL>
<LI>
You can use the <SAMP>`--GCC'</SAMP> option in the <CODE>Context</CODE> definition to specify
explicitly the name of the command to be called to create the trees on the fly
<A NAME="IDX135"></A>
<P>
<LI>
You may use the prefix of the name of your ASIS tool to indicate the name of the command
to be used to call the compiler. If the name of your tool contains a hyphen character "<CODE>-</CODE>",
for example <CODE>some_specific-foo</CODE>, then ASIS will try to call the command with the
name created as a concatenation of the tool name prefix preceding the rightmost
hyphen, the hyphen character itself, and <CODE>gcc</CODE>. For example, for <CODE>some_specific-foo</CODE>,
ASIS will try to call <CODE>some_specific-gcc</CODE> to create the tree file.
</UL>
<P>
The algorithm for defining the name of the command to be used to create trees on the fly
is as follows. If the <SAMP>`--GCC'</SAMP> option is used in the <CODE>Context</CODE> definition and if the name
that is the parameter of this option denotes some executable existing in the path, this
executable is used. Otherwise ASIS tries to define the name of the executable from
the name of the ASIS application. If the corresponding executable exists on the path,
it is used. Otherwise the standard <CODE>gcc</CODE> installation is used.
</P><P>
<A NAME="ASIS Interpreter asistant"></A>
<HR SIZE="6">
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_5.html#SEC24"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_6.html#SEC38"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_15.html#SEC56">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="asis_ug_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<BR>
<FONT SIZE="-1">
This document was generated
by <I>Mail Server</I> on <I>May, 22 2008</I>
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html/"><I>texi2html</I></A>
</BODY>
</HTML>
|