home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gnat-2.06-src.tgz / tar.out / fsf / gnat / ada / features.ads < prev    next >
Text File  |  1996-09-28  |  9KB  |  209 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT COMPILER COMPONENTS                         --
  4. --                                                                          --
  5. --                             F E A T U R E S                              --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.7 $                              --
  10. --                                                                          --
  11. --           Copyright (c) 1992,1993,1994 NYU, All Rights Reserved          --
  12. --                                                                          --
  13. -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  14. -- terms of the  GNU General Public License as published  by the Free Soft- --
  15. -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
  16. -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  17. -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18. -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  19. -- for  more details.  You should have  received  a copy of the GNU General --
  20. -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
  21. -- to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
  22. --                                                                          --
  23. ------------------------------------------------------------------------------
  24.  
  25. --  This package contains the routines for handling -x9 output and generating
  26. --  the resulting listing of Ada 95 features used in the main source program(s)
  27.  
  28. with Types; use Types;
  29.  
  30. package Features is
  31.  
  32.    --  List of names of features. These names are listed in the output
  33.  
  34.    --  Note: entries marked ??? are not yet dealt with
  35.  
  36.    type Feature_Name is (
  37.       Tagged_Types,
  38.       Class_Wide_Types,
  39.       Abstract_Types,
  40.       Abstract_Subprograms,
  41.       Tagged_Type_Conversion,
  42.       Access_To_Subprogram_Types,
  43.       Access_Parameters,
  44.       General_Access_Types,
  45.       Access_To_Constant_Types,
  46.       Controlled_Types,
  47.       Generic_Formal_Private_Types,
  48.       Aliased_Objects,
  49.       Access_Discriminants,
  50.       Extension_Aggregates,
  51.  
  52.       Protected_Units_And_Operations,
  53.       Exception_Handler_In_Accept,
  54.       Requeue_Statement,
  55.       Delay_Until,
  56.       Asynchronous_Select,
  57.       Task_Discriminants,
  58.  
  59.       Child_Units,
  60.       Private_Child,
  61.       Child_Renaming,                             --  ???
  62.       Generic_Unit_Child,
  63.       Generic_Instantiation_Child,                --  ???
  64.       Library_Unit_Renaming,
  65.       Relaxation_Of_Subunit_Naming,               --  ???
  66.  
  67.       Wide_Characters_And_Strings,
  68.       Modular_Integer_Types,
  69.       Decimal_Fixed_Point,
  70.       Access_To_Protected_Subprogram,             --  ???
  71.       Out_Parameters_Read,                        --  ???
  72.       Subprogram_Bodies_By_Renaming,
  73.       Deferred_Constants_Of_Any_Type,
  74.       Limited_Record_Types,
  75.       Use_Type,
  76.       Generic_Unit_Renaming,                      --  ???
  77.       Exception_Parameter,
  78.       Generic_Matching_For_Access_Types,          --  ???
  79.       Generic_Formal_Derived_Types,
  80.       Generic_Formal_Packages,
  81.       Generic_Formal_Decimal_Types,
  82.       New_Representation_Clauses,
  83.       New_Representation_Pragmas,
  84.       User_Defined_Storage_Pools,
  85.       Appending,                                  --  ???
  86.       Modular_Input_Output,                       --  ???
  87.       Generic_Contract_Rules,
  88.  
  89.       Unknown_Discriminant_Parts,
  90.       Type_Freezing_Rules,                        --  ???
  91.       Overloading_Of_Equality,                    --  ???
  92.       Decimal_Input_Output,                       --  ???
  93.       Exception_Choices,
  94.       Image_Attribute_For_Real,
  95.       Value_Attribute_For_Real,
  96.       Pred_Succ_Attribute_For_Real,
  97.       New_Attributes,
  98.       Unconstrained_Variables,
  99.       Latin_1,
  100.       Inheritance_At_Local_Derivation,
  101.       New_Pragmas,
  102.       Non_Simple_Expressions,
  103.       Later_Declaration_Ordering,
  104.       New_Uses_Of_Others,
  105.       Base_Attribute_In_Subtype_Mark,
  106.  
  107.       Implementation_Dependent_Attributes,
  108.       Implementation_Dependent_Pragmas);
  109.  
  110.    subtype Code_Name is String (1 .. 4);
  111.  
  112.    type Code_Name_Array is array (Feature_Name) of Code_Name;
  113.  
  114.    Code_Names : constant Code_Name_Array := Code_Name_Array'(
  115.       Tagged_Types                         => "A010",
  116.       Class_Wide_Types                     => "A020",
  117.       Abstract_Types                       => "A030",
  118.       Abstract_Subprograms                 => "A040",
  119.       Tagged_Type_Conversion               => "A050",
  120.       Access_To_Subprogram_Types           => "A060",
  121.       Access_Parameters                    => "A070",
  122.       General_Access_Types                 => "A080",
  123.       Access_To_Constant_Types             => "A081",
  124.       Controlled_Types                     => "A090",
  125.       Generic_Formal_Private_Types         => "A100",
  126.       Aliased_Objects                      => "A110",
  127.       Access_Discriminants                 => "A120",
  128.       Extension_Aggregates                 => "A130",
  129.  
  130.       Protected_Units_And_Operations       => "B010",
  131.       Exception_Handler_In_Accept          => "B020",
  132.       Requeue_Statement                    => "B030",
  133.       Delay_Until                          => "B040",
  134.       Asynchronous_Select                  => "B050",
  135.       Task_Discriminants                   => "B060",
  136.  
  137.       Child_Units                          => "C010",
  138.       Private_Child                        => "C020",
  139.       Child_Renaming                       => "C030",
  140.       Generic_Unit_Child                   => "C040",
  141.       Generic_Instantiation_Child          => "C050",
  142.       Library_Unit_Renaming                => "C060",
  143.       Relaxation_Of_Subunit_Naming         => "C070",
  144.  
  145.       Wide_Characters_And_Strings          => "D010",
  146.       Modular_Integer_Types                => "D020",
  147.       Decimal_Fixed_Point                  => "D030",
  148.       Access_To_Protected_Subprogram       => "D040",
  149.       Out_Parameters_Read                  => "D050",
  150.       Subprogram_Bodies_By_Renaming        => "D060",
  151.       Deferred_Constants_Of_Any_Type       => "D070",
  152.       Limited_Record_Types                 => "D080",
  153.       Use_Type                             => "D090",
  154.       Generic_Unit_Renaming                => "D110",
  155.       Exception_Parameter                  => "D120",
  156.       Generic_Matching_For_Access_Types    => "D130",
  157.       Generic_Formal_Derived_Types         => "D140",
  158.       Generic_Formal_Packages              => "D160",
  159.       Generic_Formal_Decimal_Types         => "D161",
  160.       New_Representation_Clauses           => "D170",
  161.       New_Representation_Pragmas           => "D180",
  162.       User_Defined_Storage_Pools           => "D190",
  163.       Appending                            => "D210",
  164.       Modular_Input_Output                 => "D220",
  165.       Generic_Contract_Rules               => "D250",
  166.       Unknown_Discriminant_Parts           => "D260",
  167.       Type_Freezing_Rules                  => "D270",
  168.       Overloading_Of_Equality              => "D280",
  169.       Decimal_Input_Output                 => "D290",
  170.       Exception_Choices                    => "D300",
  171.       Image_Attribute_For_Real             => "D310",
  172.       Value_Attribute_For_Real             => "D311",
  173.       Pred_Succ_Attribute_For_Real         => "D312",
  174.       New_Attributes                       => "D315",
  175.       Unconstrained_Variables              => "D320",
  176.       Latin_1                              => "D350",
  177.       Inheritance_At_Local_Derivation      => "D360",
  178.       New_Pragmas                          => "D370",
  179.       Non_Simple_Expressions               => "D380",
  180.       Later_Declaration_Ordering           => "D390",
  181.       New_Uses_Of_Others                   => "D400",
  182.       Base_Attribute_In_Subtype_Mark       => "D420",
  183.  
  184.       Implementation_Dependent_Attributes  => "E010",
  185.       Implementation_Dependent_Pragmas     => "E020");
  186.  
  187.    Features_On : Boolean := False;
  188.    --  This flag is initialized by Par/Sem to be True if feature usage is to be
  189.    --  collected (i.e. Xref_Flag_9 is set, and a main unit is being processed.
  190.    --  Par and Sem take care of saving/restoring the flag so that recursion
  191.    --  involving compilation of other units does not upset the proper setting.
  192.  
  193.    procedure Initialize;
  194.    --  Initialize output of feature collection, must be called before any calls
  195.    --  are made to Note_Feature or Note_With (sets up the required tables etc.)
  196.  
  197.    procedure Note_Feature (F : Feature_Name; Loc : Source_Ptr);
  198.    --  Note use of feature F at source location Loc. This procedure should only
  199.    --  be called if the Features_On flag is set to True.
  200.  
  201.    procedure Note_With (U : Unit_Name_Type; Loc : Source_Ptr);
  202.    --  Note with of Ada or System child unit at location Loc. This procedure
  203.    --  Should only be called if the Features_On flag is set to True.
  204.  
  205.    procedure Finalize;
  206.    --  Outputs list of features used, if feature collection is enabled.
  207.  
  208. end Features;
  209.