1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
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, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- As a special exception, if other files instantiate generics from this --
25 -- unit, or you link this unit with other files to produce an executable, --
26 -- this unit does not by itself cause the resulting executable to be --
27 -- covered by the GNU General Public License. This exception does not --
28 -- however invalidate any other reasons why the executable file might be --
29 -- covered by the GNU Public License. --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
34 ------------------------------------------------------------------------------
36 with Namet; use Namet;
38 package body Snames is
40 -- Table of names to be set by Initialize. Each name is terminated by a
41 -- single #, and the end of the list is marked by a null entry, i.e. by
42 -- two # marks in succession. Note that the table does not include the
43 -- entries for a-z, since these are initialized by Namet itself.
45 Preset_Names : constant String :=
54 "_address_resolver#" &
64 "_local_final_list#" &
109 "finalization_root#" &
117 "get_active_partition_id#" &
118 "get_rci_package_receiver#" &
122 "partition_interface#" &
151 "component_alignment#" &
153 "elaboration_checks#" &
156 "extensions_allowed#" &
157 "external_name_casing#" &
158 "float_representation#" &
159 "initialize_scalars#" &
164 "normalize_scalars#" &
166 "propagate_exceptions#" &
169 "restricted_run_time#" &
172 "source_file_name#" &
175 "task_dispatching_policy#" &
181 "all_calls_remote#" &
186 "atomic_components#" &
190 "complex_representation#" &
202 "export_exception#" &
205 "export_procedure#" &
206 "export_valued_procedure#" &
208 "finalize_storage_only#" &
211 "import_exception#" &
214 "import_procedure#" &
215 "import_valued_procedure#" &
219 "inspection_point#" &
222 "interrupt_handler#" &
223 "interrupt_priority#" &
224 "java_constructor#" &
231 "machine_attribute#" &
245 "remote_call_interface#" &
250 "source_reference#" &
254 "suppress_debug_info#" &
255 "suppress_initialization#" &
263 "unimplemented_unit#" &
264 "unreserve_all_interrupts#" &
266 "volatile_components#" &
285 "component_size_4#" &
294 "first_optional_parameter#" &
315 "result_mechanism#" &
323 "subunit_file_name#" &
324 "task_stack_size_default#" &
326 "time_slicing_enabled#" &
358 "default_bit_order#" &
373 "has_discriminants#" &
384 "machine_mantissa#" &
385 "machine_overflows#" &
390 "max_interrupt_priority#" &
392 "max_size_in_storage_elements#" &
393 "maximum_alignment#" &
403 "passed_by_reference#" &
427 "unbiased_rounding#" &
428 "unchecked_access#" &
429 "universal_literal_string#" &
430 "unrestricted_access#" &
468 "inheritance_locking#" &
470 "priority_queuing#" &
471 "fifo_within_priorities#" &
473 "accessibility_check#" &
474 "discriminant_check#" &
476 "elaboration_check#" &
544 "enclosing_entity#" &
545 "exception_information#" &
546 "exception_message#" &
550 "import_largest_value#" &
558 "shift_right_arithmetic#" &
560 "unchecked_conversion#" &
561 "unchecked_deallocation#" &
573 "default_switches#" &
580 "implementation_exceptions#" &
581 "implementation_suffix#" &
584 "library_elaboration#" &
595 "source_list_file#" &
597 "specification_exceptions#" &
598 "specification_suffix#" &
602 ---------------------
603 -- Generated Names --
604 ---------------------
606 -- This section lists the various cases of generated names which are
607 -- built from existing names by adding unique leading and/or trailing
608 -- upper case letters. In some cases these names are built recursively,
609 -- in particular names built from types may be built from types which
610 -- themselves have generated names. In this list, xxx represents an
611 -- existing name to which identifying letters are prepended or appended,
612 -- and a trailing n represents a serial number in an external name that
613 -- has some semantic significance (e.g. the n'th index type of an array).
615 -- xxxA access type for formal xxx in entry param record (Exp_Ch9)
616 -- xxxB tag table for tagged type xxx (Exp_Ch3)
617 -- xxxB task body procedure for task xxx (Exp_Ch9)
618 -- xxxD dispatch table for tagged type xxx (Exp_Ch3)
619 -- xxxD discriminal for discriminant xxx (Sem_Ch3)
620 -- xxxDn n'th discr check function for rec type xxx (Exp_Ch3)
621 -- xxxE elaboration boolean flag for task xxx (Exp_Ch9)
622 -- xxxE dispatch table pointer type for tagged type xxx (Exp_Ch3)
623 -- xxxE parameters for accept body for entry xxx (Exp_Ch9)
624 -- xxxFn n'th primitive of a tagged type (named xxx) (Exp_Ch3)
625 -- xxxI initialization procedure for type xxx (Exp_Ch3)
626 -- xxxJ tag table type index for tagged type xxx (Exp_Ch3)
627 -- xxxM master Id value for access type xxx (Exp_Ch3)
628 -- xxxP tag table pointer type for tagged type xxx (Exp_Ch3)
629 -- xxxP parameter record type for entry xxx (Exp_Ch9)
630 -- xxxPA access to parameter record type for entry xxx (Exp_Ch9)
631 -- xxxPn pointer type for n'th primitive of tagged type xxx (Exp_Ch3)
632 -- xxxR dispatch table pointer for tagged type xxx (Exp_Ch3)
633 -- xxxT tag table type for tagged type xxx (Exp_Ch3)
634 -- xxxT literal table for enumeration type xxx (Sem_Ch3)
635 -- xxxV type for task value record for task xxx (Exp_Ch9)
636 -- xxxX entry index constant (Exp_Ch9)
637 -- xxxY dispatch table type for tagged type xxx (Exp_Ch3)
638 -- xxxZ size variable for task xxx (Exp_Ch9)
640 -- Implicit type names
642 -- TxxxT type of literal table for enumeration type xxx (Sem_Ch3)
644 -- (list not yet complete ???)
646 ----------------------
647 -- Get_Attribute_Id --
648 ----------------------
650 function Get_Attribute_Id (N : Name_Id) return Attribute_Id is
652 return Attribute_Id'Val (N - First_Attribute_Name);
653 end Get_Attribute_Id;
659 function Get_Check_Id (N : Name_Id) return Check_Id is
661 return Check_Id'Val (N - First_Check_Name);
664 -----------------------
665 -- Get_Convention_Id --
666 -----------------------
668 function Get_Convention_Id (N : Name_Id) return Convention_Id is
671 when Name_Ada => return Convention_Ada;
672 when Name_Asm => return Convention_Assembler;
673 when Name_Assembler => return Convention_Assembler;
674 when Name_C => return Convention_C;
675 when Name_COBOL => return Convention_COBOL;
676 when Name_CPP => return Convention_CPP;
677 when Name_DLL => return Convention_Stdcall;
678 when Name_Fortran => return Convention_Fortran;
679 when Name_Intrinsic => return Convention_Intrinsic;
680 when Name_Java => return Convention_Java;
681 when Name_Stdcall => return Convention_Stdcall;
682 when Name_Stubbed => return Convention_Stubbed;
683 when Name_Win32 => return Convention_Stdcall;
687 end Get_Convention_Id;
689 ---------------------------
690 -- Get_Locking_Policy_Id --
691 ---------------------------
693 function Get_Locking_Policy_Id (N : Name_Id) return Locking_Policy_Id is
695 return Locking_Policy_Id'Val (N - First_Locking_Policy_Name);
696 end Get_Locking_Policy_Id;
702 function Get_Pragma_Id (N : Name_Id) return Pragma_Id is
704 if N = Name_AST_Entry then
705 return Pragma_AST_Entry;
706 elsif N = Name_Storage_Size then
707 return Pragma_Storage_Size;
708 elsif N = Name_Storage_Unit then
709 return Pragma_Storage_Unit;
711 return Pragma_Id'Val (N - First_Pragma_Name);
715 ---------------------------
716 -- Get_Queuing_Policy_Id --
717 ---------------------------
719 function Get_Queuing_Policy_Id (N : Name_Id) return Queuing_Policy_Id is
721 return Queuing_Policy_Id'Val (N - First_Queuing_Policy_Name);
722 end Get_Queuing_Policy_Id;
724 ------------------------------------
725 -- Get_Task_Dispatching_Policy_Id --
726 ------------------------------------
728 function Get_Task_Dispatching_Policy_Id (N : Name_Id)
729 return Task_Dispatching_Policy_Id is
731 return Task_Dispatching_Policy_Id'Val
732 (N - First_Task_Dispatching_Policy_Name);
733 end Get_Task_Dispatching_Policy_Id;
739 procedure Initialize is
741 Discard_Name : Name_Id;
744 P_Index := Preset_Names'First;
749 while Preset_Names (P_Index) /= '#' loop
750 Name_Len := Name_Len + 1;
751 Name_Buffer (Name_Len) := Preset_Names (P_Index);
752 P_Index := P_Index + 1;
755 -- We do the Name_Find call to enter the name into the table, but
756 -- we don't need to do anything with the result, since we already
757 -- initialized all the preset names to have the right value (we
758 -- are depending on the order of the names and Preset_Names).
760 Discard_Name := Name_Find;
761 P_Index := P_Index + 1;
762 exit when Preset_Names (P_Index) = '#';
765 -- Make sure that number of names in standard table is correct. If
766 -- this check fails, run utility program XSNAMES to construct a new
767 -- properly matching version of the body.
769 pragma Assert (Discard_Name = Last_Predefined_Name);
772 -----------------------
773 -- Is_Attribute_Name --
774 -----------------------
776 function Is_Attribute_Name (N : Name_Id) return Boolean is
778 return N in First_Attribute_Name .. Last_Attribute_Name;
779 end Is_Attribute_Name;
785 function Is_Check_Name (N : Name_Id) return Boolean is
787 return N in First_Check_Name .. Last_Check_Name;
790 ------------------------
791 -- Is_Convention_Name --
792 ------------------------
794 function Is_Convention_Name (N : Name_Id) return Boolean is
796 return N in First_Convention_Name .. Last_Convention_Name
798 end Is_Convention_Name;
800 ------------------------------
801 -- Is_Entity_Attribute_Name --
802 ------------------------------
804 function Is_Entity_Attribute_Name (N : Name_Id) return Boolean is
806 return N in First_Entity_Attribute_Name .. Last_Entity_Attribute_Name;
807 end Is_Entity_Attribute_Name;
809 --------------------------------
810 -- Is_Function_Attribute_Name --
811 --------------------------------
813 function Is_Function_Attribute_Name (N : Name_Id) return Boolean is
816 First_Renamable_Function_Attribute ..
817 Last_Renamable_Function_Attribute;
818 end Is_Function_Attribute_Name;
820 ----------------------------
821 -- Is_Locking_Policy_Name --
822 ----------------------------
824 function Is_Locking_Policy_Name (N : Name_Id) return Boolean is
826 return N in First_Locking_Policy_Name .. Last_Locking_Policy_Name;
827 end Is_Locking_Policy_Name;
829 -----------------------------
830 -- Is_Operator_Symbol_Name --
831 -----------------------------
833 function Is_Operator_Symbol_Name (N : Name_Id) return Boolean is
835 return N in First_Operator_Name .. Last_Operator_Name;
836 end Is_Operator_Symbol_Name;
842 function Is_Pragma_Name (N : Name_Id) return Boolean is
844 return N in First_Pragma_Name .. Last_Pragma_Name
845 or else N = Name_AST_Entry
846 or else N = Name_Storage_Size
847 or else N = Name_Storage_Unit;
850 ---------------------------------
851 -- Is_Procedure_Attribute_Name --
852 ---------------------------------
854 function Is_Procedure_Attribute_Name (N : Name_Id) return Boolean is
856 return N in First_Procedure_Attribute .. Last_Procedure_Attribute;
857 end Is_Procedure_Attribute_Name;
859 ----------------------------
860 -- Is_Queuing_Policy_Name --
861 ----------------------------
863 function Is_Queuing_Policy_Name (N : Name_Id) return Boolean is
865 return N in First_Queuing_Policy_Name .. Last_Queuing_Policy_Name;
866 end Is_Queuing_Policy_Name;
868 -------------------------------------
869 -- Is_Task_Dispatching_Policy_Name --
870 -------------------------------------
872 function Is_Task_Dispatching_Policy_Name (N : Name_Id) return Boolean is
874 return N in First_Task_Dispatching_Policy_Name ..
875 Last_Task_Dispatching_Policy_Name;
876 end Is_Task_Dispatching_Policy_Name;
878 ----------------------------
879 -- Is_Type_Attribute_Name --
880 ----------------------------
882 function Is_Type_Attribute_Name (N : Name_Id) return Boolean is
884 return N in First_Type_Attribute_Name .. Last_Type_Attribute_Name;
885 end Is_Type_Attribute_Name;