OSDN Git Service

2008-05-27 Thomas Quinot <quinot@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / snames.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                               S N A M E S                                --
6 --                                                                          --
7 --                                 B o d y                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-2008, Free Software Foundation, Inc.         --
10 --                                                                          --
11 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
12 -- terms of the  GNU General Public License as published  by the Free Soft- --
13 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
14 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17 -- for  more details.  You should have  received  a copy of the GNU General --
18 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
19 -- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, USA.                                              --
21 --                                                                          --
22 -- As a special exception,  if other files  instantiate  generics from this --
23 -- unit, or you link  this unit with other files  to produce an executable, --
24 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
25 -- covered  by the  GNU  General  Public  License.  This exception does not --
26 -- however invalidate  any other reasons why  the executable file  might be --
27 -- covered by the  GNU Public License.                                      --
28 --                                                                          --
29 -- GNAT was originally developed  by the GNAT team at  New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
31 --                                                                          --
32 ------------------------------------------------------------------------------
33
34 with Opt;   use Opt;
35 with Table;
36 with Types; use Types;
37
38 package body Snames is
39
40    --  Table used to record convention identifiers
41
42    type Convention_Id_Entry is record
43       Name       : Name_Id;
44       Convention : Convention_Id;
45    end record;
46
47    package Convention_Identifiers is new Table.Table (
48      Table_Component_Type => Convention_Id_Entry,
49      Table_Index_Type     => Int,
50      Table_Low_Bound      => 1,
51      Table_Initial        => 50,
52      Table_Increment      => 200,
53      Table_Name           => "Name_Convention_Identifiers");
54
55    --  Table of names to be set by Initialize. Each name is terminated by a
56    --  single #, and the end of the list is marked by a null entry, i.e. by
57    --  two # marks in succession. Note that the table does not include the
58    --  entries for a-z, since these are initialized by Namet itself.
59
60    Preset_Names : constant String :=
61      "_parent#" &
62      "_tag#" &
63      "off#" &
64      "space#" &
65      "time#" &
66      "_abort_signal#" &
67      "_alignment#" &
68      "_assign#" &
69      "_atcb#" &
70      "_chain#" &
71      "_clean#" &
72      "_controller#" &
73      "_entry_bodies#" &
74      "_expunge#" &
75      "_final_list#" &
76      "_idepth#" &
77      "_init#" &
78      "_local_final_list#" &
79      "_master#" &
80      "_object#" &
81      "_postconditions#" &
82      "_priority#" &
83      "_process_atsd#" &
84      "_relative_deadline#" &
85      "_result#" &
86      "_secondary_stack#" &
87      "_service#" &
88      "_size#" &
89      "_stack#" &
90      "_tags#" &
91      "_task#" &
92      "_task_id#" &
93      "_task_info#" &
94      "_task_name#" &
95      "_trace_sp#" &
96      "_disp_asynchronous_select#" &
97      "_disp_conditional_select#" &
98      "_disp_get_prim_op_kind#" &
99      "_disp_get_task_id#" &
100      "_disp_requeue#" &
101      "_disp_timed_select#" &
102      "initialize#" &
103      "adjust#" &
104      "finalize#" &
105      "next#" &
106      "prev#" &
107      "_typecode#" &
108      "_from_any#" &
109      "_to_any#" &
110      "allocate#" &
111      "deallocate#" &
112      "dereference#" &
113      "decimal_io#" &
114      "enumeration_io#" &
115      "fixed_io#" &
116      "float_io#" &
117      "integer_io#" &
118      "modular_io#" &
119      "const#" &
120      "<error>#" &
121      "go#" &
122      "put#" &
123      "put_line#" &
124      "to#" &
125      "exception_traces#" &
126      "finalization#" &
127      "finalization_root#" &
128      "interfaces#" &
129      "most_recent_exception#" &
130      "standard#" &
131      "system#" &
132      "text_io#" &
133      "wide_text_io#" &
134      "wide_wide_text_io#" &
135      "no_dsa#" &
136      "garlic_dsa#" &
137      "polyorb_dsa#" &
138      "addr#" &
139      "async#" &
140      "get_active_partition_id#" &
141      "get_rci_package_receiver#" &
142      "get_rci_package_ref#" &
143      "origin#" &
144      "params#" &
145      "partition#" &
146      "partition_interface#" &
147      "ras#" &
148      "_call#" &
149      "rci_name#" &
150      "receiver#" &
151      "rpc#" &
152      "subp_id#" &
153      "operation#" &
154      "argument#" &
155      "arg_modes#" &
156      "handler#" &
157      "target#" &
158      "req#" &
159      "obj_typecode#" &
160      "stub#" &
161      "Oabs#" &
162      "Oand#" &
163      "Omod#" &
164      "Onot#" &
165      "Oor#" &
166      "Orem#" &
167      "Oxor#" &
168      "Oeq#" &
169      "One#" &
170      "Olt#" &
171      "Ole#" &
172      "Ogt#" &
173      "Oge#" &
174      "Oadd#" &
175      "Osubtract#" &
176      "Oconcat#" &
177      "Omultiply#" &
178      "Odivide#" &
179      "Oexpon#" &
180      "ada_83#" &
181      "ada_95#" &
182      "ada_05#" &
183      "ada_2005#" &
184      "assertion_policy#" &
185      "c_pass_by_copy#" &
186      "check_name#" &
187      "check_policy#" &
188      "compile_time_error#" &
189      "compile_time_warning#" &
190      "compiler_unit#" &
191      "component_alignment#" &
192      "convention_identifier#" &
193      "debug_policy#" &
194      "detect_blocking#" &
195      "discard_names#" &
196      "elaboration_checks#" &
197      "eliminate#" &
198      "extend_system#" &
199      "extensions_allowed#" &
200      "external_name_casing#" &
201      "favor_top_level#" &
202      "float_representation#" &
203      "implicit_packing#" &
204      "initialize_scalars#" &
205      "interrupt_state#" &
206      "license#" &
207      "locking_policy#" &
208      "long_float#" &
209      "no_run_time#" &
210      "no_strict_aliasing#" &
211      "normalize_scalars#" &
212      "optimize_alignment#" &
213      "persistent_bss#" &
214      "polling#" &
215      "priority_specific_dispatching#" &
216      "profile#" &
217      "profile_warnings#" &
218      "propagate_exceptions#" &
219      "queuing_policy#" &
220      "ravenscar#" &
221      "restricted_run_time#" &
222      "restrictions#" &
223      "restriction_warnings#" &
224      "reviewable#" &
225      "source_file_name#" &
226      "source_file_name_project#" &
227      "style_checks#" &
228      "suppress#" &
229      "suppress_exception_locations#" &
230      "task_dispatching_policy#" &
231      "universal_data#" &
232      "unsuppress#" &
233      "use_vads_size#" &
234      "validity_checks#" &
235      "warnings#" &
236      "wide_character_encoding#" &
237      "abort_defer#" &
238      "all_calls_remote#" &
239      "annotate#" &
240      "assert#" &
241      "asynchronous#" &
242      "atomic#" &
243      "atomic_components#" &
244      "attach_handler#" &
245      "check#" &
246      "cil_constructor#" &
247      "comment#" &
248      "common_object#" &
249      "complete_representation#" &
250      "complex_representation#" &
251      "controlled#" &
252      "convention#" &
253      "cpp_class#" &
254      "cpp_constructor#" &
255      "cpp_virtual#" &
256      "cpp_vtable#" &
257      "debug#" &
258      "elaborate#" &
259      "elaborate_all#" &
260      "elaborate_body#" &
261      "export#" &
262      "export_exception#" &
263      "export_function#" &
264      "export_object#" &
265      "export_procedure#" &
266      "export_value#" &
267      "export_valued_procedure#" &
268      "external#" &
269      "finalize_storage_only#" &
270      "ident#" &
271      "implemented_by_entry#" &
272      "import#" &
273      "import_exception#" &
274      "import_function#" &
275      "import_object#" &
276      "import_procedure#" &
277      "import_valued_procedure#" &
278      "inline#" &
279      "inline_always#" &
280      "inline_generic#" &
281      "inspection_point#" &
282      "interface_name#" &
283      "interrupt_handler#" &
284      "interrupt_priority#" &
285      "java_constructor#" &
286      "java_interface#" &
287      "keep_names#" &
288      "link_with#" &
289      "linker_alias#" &
290      "linker_constructor#" &
291      "linker_destructor#" &
292      "linker_options#" &
293      "linker_section#" &
294      "list#" &
295      "machine_attribute#" &
296      "main#" &
297      "main_storage#" &
298      "memory_size#" &
299      "no_body#" &
300      "no_return#" &
301      "obsolescent#" &
302      "optimize#" &
303      "pack#" &
304      "page#" &
305      "passive#" &
306      "postcondition#" &
307      "precondition#" &
308      "preelaborable_initialization#" &
309      "preelaborate#" &
310      "preelaborate_05#" &
311      "psect_object#" &
312      "pure#" &
313      "pure_05#" &
314      "pure_function#" &
315      "relative_deadline#" &
316      "remote_call_interface#" &
317      "remote_types#" &
318      "share_generic#" &
319      "shared#" &
320      "shared_passive#" &
321      "source_reference#" &
322      "static_elaboration_desired#" &
323      "stream_convert#" &
324      "subtitle#" &
325      "suppress_all#" &
326      "suppress_debug_info#" &
327      "suppress_initialization#" &
328      "system_name#" &
329      "task_info#" &
330      "task_name#" &
331      "task_storage#" &
332      "time_slice#" &
333      "title#" &
334      "unchecked_union#" &
335      "unimplemented_unit#" &
336      "universal_aliasing#" &
337      "unmodified#" &
338      "unreferenced#" &
339      "unreferenced_objects#" &
340      "unreserve_all_interrupts#" &
341      "volatile#" &
342      "volatile_components#" &
343      "weak_external#" &
344      "ada#" &
345      "assembler#" &
346      "cil#" &
347      "cobol#" &
348      "cpp#" &
349      "fortran#" &
350      "intrinsic#" &
351      "java#" &
352      "stdcall#" &
353      "stubbed#" &
354      "asm#" &
355      "assembly#" &
356      "default#" &
357      "c_plus_plus#" &
358      "dll#" &
359      "win32#" &
360      "as_is#" &
361      "assertion#" &
362      "attribute_name#" &
363      "body_file_name#" &
364      "boolean_entry_barriers#" &
365      "casing#" &
366      "code#" &
367      "component#" &
368      "component_size_4#" &
369      "copy#" &
370      "d_float#" &
371      "descriptor#" &
372      "dot_replacement#" &
373      "dynamic#" &
374      "entity#" &
375      "entry_count#" &
376      "external_name#" &
377      "first_optional_parameter#" &
378      "form#" &
379      "g_float#" &
380      "gcc#" &
381      "gnat#" &
382      "gpl#" &
383      "ieee_float#" &
384      "ignore#" &
385      "info#" &
386      "internal#" &
387      "link_name#" &
388      "lowercase#" &
389      "max_entry_queue_depth#" &
390      "max_entry_queue_length#" &
391      "max_size#" &
392      "mechanism#" &
393      "message#" &
394      "mixedcase#" &
395      "modified_gpl#" &
396      "name#" &
397      "nca#" &
398      "no#" &
399      "no_dependence#" &
400      "no_dynamic_attachment#" &
401      "no_dynamic_interrupts#" &
402      "no_requeue#" &
403      "no_requeue_statements#" &
404      "no_task_attributes#" &
405      "no_task_attributes_package#" &
406      "on#" &
407      "parameter_types#" &
408      "reference#" &
409      "restricted#" &
410      "result_mechanism#" &
411      "result_type#" &
412      "runtime#" &
413      "sb#" &
414      "secondary_stack_size#" &
415      "section#" &
416      "semaphore#" &
417      "simple_barriers#" &
418      "spec_file_name#" &
419      "state#" &
420      "static#" &
421      "stack_size#" &
422      "subunit_file_name#" &
423      "task_stack_size_default#" &
424      "task_type#" &
425      "time_slicing_enabled#" &
426      "top_guard#" &
427      "uba#" &
428      "ubs#" &
429      "ubsb#" &
430      "unit_name#" &
431      "unknown#" &
432      "unrestricted#" &
433      "uppercase#" &
434      "user#" &
435      "vax_float#" &
436      "vms#" &
437      "vtable_ptr#" &
438      "working_storage#" &
439      "abort_signal#" &
440      "access#" &
441      "address#" &
442      "address_size#" &
443      "aft#" &
444      "alignment#" &
445      "asm_input#" &
446      "asm_output#" &
447      "ast_entry#" &
448      "bit#" &
449      "bit_order#" &
450      "bit_position#" &
451      "body_version#" &
452      "callable#" &
453      "caller#" &
454      "code_address#" &
455      "component_size#" &
456      "compose#" &
457      "constrained#" &
458      "count#" &
459      "default_bit_order#" &
460      "definite#" &
461      "delta#" &
462      "denorm#" &
463      "digits#" &
464      "elaborated#" &
465      "emax#" &
466      "enabled#" &
467      "enum_rep#" &
468      "enum_val#" &
469      "epsilon#" &
470      "exponent#" &
471      "external_tag#" &
472      "fast_math#" &
473      "first#" &
474      "first_bit#" &
475      "fixed_value#" &
476      "fore#" &
477      "has_access_values#" &
478      "has_discriminants#" &
479      "has_tagged_values#" &
480      "identity#" &
481      "img#" &
482      "integer_value#" &
483      "invalid_value#" &
484      "large#" &
485      "last#" &
486      "last_bit#" &
487      "leading_part#" &
488      "length#" &
489      "machine_emax#" &
490      "machine_emin#" &
491      "machine_mantissa#" &
492      "machine_overflows#" &
493      "machine_radix#" &
494      "machine_rounding#" &
495      "machine_rounds#" &
496      "machine_size#" &
497      "mantissa#" &
498      "max_size_in_storage_elements#" &
499      "maximum_alignment#" &
500      "mechanism_code#" &
501      "mod#" &
502      "model_emin#" &
503      "model_epsilon#" &
504      "model_mantissa#" &
505      "model_small#" &
506      "modulus#" &
507      "null_parameter#" &
508      "object_size#" &
509      "old#" &
510      "partition_id#" &
511      "passed_by_reference#" &
512      "pool_address#" &
513      "pos#" &
514      "position#" &
515      "priority#" &
516      "range#" &
517      "range_length#" &
518      "result#" &
519      "round#" &
520      "safe_emax#" &
521      "safe_first#" &
522      "safe_large#" &
523      "safe_last#" &
524      "safe_small#" &
525      "scale#" &
526      "scaling#" &
527      "signed_zeros#" &
528      "size#" &
529      "small#" &
530      "storage_size#" &
531      "storage_unit#" &
532      "stream_size#" &
533      "tag#" &
534      "target_name#" &
535      "terminated#" &
536      "to_address#" &
537      "type_class#" &
538      "uet_address#" &
539      "unbiased_rounding#" &
540      "unchecked_access#" &
541      "unconstrained_array#" &
542      "universal_literal_string#" &
543      "unrestricted_access#" &
544      "vads_size#" &
545      "val#" &
546      "valid#" &
547      "value_size#" &
548      "version#" &
549      "wchar_t_size#" &
550      "wide_wide_width#" &
551      "wide_width#" &
552      "width#" &
553      "word_size#" &
554      "adjacent#" &
555      "ceiling#" &
556      "copy_sign#" &
557      "floor#" &
558      "fraction#" &
559      "image#" &
560      "input#" &
561      "machine#" &
562      "max#" &
563      "min#" &
564      "model#" &
565      "pred#" &
566      "remainder#" &
567      "rounding#" &
568      "succ#" &
569      "truncation#" &
570      "value#" &
571      "wide_image#" &
572      "wide_wide_image#" &
573      "wide_value#" &
574      "wide_wide_value#" &
575      "output#" &
576      "read#" &
577      "write#" &
578      "elab_body#" &
579      "elab_spec#" &
580      "storage_pool#" &
581      "base#" &
582      "class#" &
583      "stub_type#" &
584      "ceiling_locking#" &
585      "inheritance_locking#" &
586      "fifo_queuing#" &
587      "priority_queuing#" &
588      "edf_across_priorities#" &
589      "fifo_within_priorities#" &
590      "non_preemptive_within_priorities#" &
591      "round_robin_within_priorities#" &
592      "access_check#" &
593      "accessibility_check#" &
594      "alignment_check#" &
595      "discriminant_check#" &
596      "division_check#" &
597      "elaboration_check#" &
598      "index_check#" &
599      "length_check#" &
600      "overflow_check#" &
601      "range_check#" &
602      "storage_check#" &
603      "tag_check#" &
604      "validity_check#" &
605      "all_checks#" &
606      "abort#" &
607      "abs#" &
608      "accept#" &
609      "and#" &
610      "all#" &
611      "array#" &
612      "at#" &
613      "begin#" &
614      "body#" &
615      "case#" &
616      "constant#" &
617      "declare#" &
618      "delay#" &
619      "do#" &
620      "else#" &
621      "elsif#" &
622      "end#" &
623      "entry#" &
624      "exception#" &
625      "exit#" &
626      "for#" &
627      "function#" &
628      "generic#" &
629      "goto#" &
630      "if#" &
631      "in#" &
632      "is#" &
633      "limited#" &
634      "loop#" &
635      "new#" &
636      "not#" &
637      "null#" &
638      "of#" &
639      "or#" &
640      "others#" &
641      "out#" &
642      "package#" &
643      "pragma#" &
644      "private#" &
645      "procedure#" &
646      "raise#" &
647      "record#" &
648      "rem#" &
649      "renames#" &
650      "return#" &
651      "reverse#" &
652      "select#" &
653      "separate#" &
654      "subtype#" &
655      "task#" &
656      "terminate#" &
657      "then#" &
658      "type#" &
659      "use#" &
660      "when#" &
661      "while#" &
662      "with#" &
663      "xor#" &
664      "divide#" &
665      "enclosing_entity#" &
666      "exception_information#" &
667      "exception_message#" &
668      "exception_name#" &
669      "file#" &
670      "generic_dispatching_constructor#" &
671      "import_address#" &
672      "import_largest_value#" &
673      "import_value#" &
674      "is_negative#" &
675      "line#" &
676      "rotate_left#" &
677      "rotate_right#" &
678      "shift_left#" &
679      "shift_right#" &
680      "shift_right_arithmetic#" &
681      "source_location#" &
682      "unchecked_conversion#" &
683      "unchecked_deallocation#" &
684      "to_pointer#" &
685      "free#" &
686      "abstract#" &
687      "aliased#" &
688      "protected#" &
689      "until#" &
690      "requeue#" &
691      "tagged#" &
692      "raise_exception#" &
693      "ada_roots#" &
694      "aggregate#" &
695      "archive_builder#" &
696      "archive_builder_append_option#" &
697      "archive_indexer#" &
698      "archive_suffix#" &
699      "binder#" &
700      "binder_prefix#" &
701      "body_suffix#" &
702      "builder#" &
703      "builder_switches#" &
704      "compiler#" &
705      "compiler_kind#" &
706      "config_body_file_name#" &
707      "config_body_file_name_pattern#" &
708      "config_file_switches#" &
709      "config_file_unique#" &
710      "config_spec_file_name#" &
711      "config_spec_file_name_pattern#" &
712      "configuration#" &
713      "cross_reference#" &
714      "default_language#" &
715      "default_switches#" &
716      "dependency_driver#" &
717      "dependency_file_kind#" &
718      "dependency_switches#" &
719      "driver#" &
720      "excluded_source_dirs#" &
721      "excluded_source_files#" &
722      "excluded_source_list_file#" &
723      "exec_dir#" &
724      "executable#" &
725      "executable_suffix#" &
726      "extends#" &
727      "externally_built#" &
728      "finder#" &
729      "global_configuration_pragmas#" &
730      "global_config_file#" &
731      "gnatls#" &
732      "gnatstub#" &
733      "implementation#" &
734      "implementation_exceptions#" &
735      "implementation_suffix#" &
736      "include_switches#" &
737      "include_path#" &
738      "include_path_file#" &
739      "inherit_source_path#" &
740      "language_kind#" &
741      "language_processing#" &
742      "languages#" &
743      "library#" &
744      "library_ali_dir#" &
745      "library_auto_init#" &
746      "library_auto_init_supported#" &
747      "library_builder#" &
748      "library_dir#" &
749      "library_gcc#" &
750      "library_interface#" &
751      "library_kind#" &
752      "library_name#" &
753      "library_major_minor_id_supported#" &
754      "library_options#" &
755      "library_partial_linker#" &
756      "library_reference_symbol_file#" &
757      "library_src_dir#" &
758      "library_support#" &
759      "library_symbol_file#" &
760      "library_symbol_policy#" &
761      "library_version#" &
762      "library_version_switches#" &
763      "linker#" &
764      "linker_executable_option#" &
765      "linker_lib_dir_option#" &
766      "linker_lib_name_option#" &
767      "local_config_file#" &
768      "local_configuration_pragmas#" &
769      "locally_removed_files#" &
770      "map_file_option#" &
771      "mapping_file_switches#" &
772      "mapping_spec_suffix#" &
773      "mapping_body_suffix#" &
774      "metrics#" &
775      "naming#" &
776      "object_generated#" &
777      "objects_linked#" &
778      "objects_path#" &
779      "objects_path_file#" &
780      "object_dir#" &
781      "pic_option#" &
782      "pretty_printer#" &
783      "prefix#" &
784      "project#" &
785      "roots#" &
786      "required_switches#" &
787      "run_path_option#" &
788      "runtime_project#" &
789      "shared_library_minimum_switches#" &
790      "shared_library_prefix#" &
791      "shared_library_suffix#" &
792      "separate_suffix#" &
793      "source_dirs#" &
794      "source_files#" &
795      "source_list_file#" &
796      "spec#" &
797      "spec_suffix#" &
798      "specification#" &
799      "specification_exceptions#" &
800      "specification_suffix#" &
801      "stack#" &
802      "switches#" &
803      "symbolic_link_supported#" &
804      "sync#" &
805      "synchronize#" &
806      "toolchain_description#" &
807      "toolchain_version#" &
808      "runtime_library_dir#" &
809      "unaligned_valid#" &
810      "interface#" &
811      "overriding#" &
812      "synchronized#" &
813      "#";
814
815    ---------------------
816    -- Generated Names --
817    ---------------------
818
819    --  This section lists the various cases of generated names which are
820    --  built from existing names by adding unique leading and/or trailing
821    --  upper case letters. In some cases these names are built recursively,
822    --  in particular names built from types may be built from types which
823    --  themselves have generated names. In this list, xxx represents an
824    --  existing name to which identifying letters are prepended or appended,
825    --  and a trailing n represents a serial number in an external name that
826    --  has some semantic significance (e.g. the n'th index type of an array).
827
828    --    xxxA    access type for formal xxx in entry param record   (Exp_Ch9)
829    --    xxxB    tag table for tagged type xxx                      (Exp_Ch3)
830    --    xxxB    task body procedure for task xxx                   (Exp_Ch9)
831    --    xxxD    dispatch table for tagged type xxx                 (Exp_Ch3)
832    --    xxxD    discriminal for discriminant xxx                   (Sem_Ch3)
833    --    xxxDn   n'th discr check function for rec type xxx         (Exp_Ch3)
834    --    xxxE    elaboration boolean flag for task xxx              (Exp_Ch9)
835    --    xxxE    dispatch table pointer type for tagged type xxx    (Exp_Ch3)
836    --    xxxE    parameters for accept body for entry xxx           (Exp_Ch9)
837    --    xxxFn   n'th primitive of a tagged type (named xxx)        (Exp_Ch3)
838    --    xxxJ    tag table type index for tagged type xxx           (Exp_Ch3)
839    --    xxxM    master Id value for access type xxx                (Exp_Ch3)
840    --    xxxP    tag table pointer type for tagged type xxx         (Exp_Ch3)
841    --    xxxP    parameter record type for entry xxx                (Exp_Ch9)
842    --    xxxPA   access to parameter record type for entry xxx      (Exp_Ch9)
843    --    xxxPn   pointer type for n'th primitive of tagged type xxx (Exp_Ch3)
844    --    xxxR    dispatch table pointer for tagged type xxx         (Exp_Ch3)
845    --    xxxT    tag table type for tagged type xxx                 (Exp_Ch3)
846    --    xxxT    literal table for enumeration type xxx             (Sem_Ch3)
847    --    xxxV    type for task value record for task xxx            (Exp_Ch9)
848    --    xxxX    entry index constant                               (Exp_Ch9)
849    --    xxxY    dispatch table type for tagged type xxx            (Exp_Ch3)
850    --    xxxZ    size variable for task xxx                         (Exp_Ch9)
851
852    --  TSS names
853
854    --    xxxDA   deep adjust routine for type xxx                   (Exp_TSS)
855    --    xxxDF   deep finalize routine for type xxx                 (Exp_TSS)
856    --    xxxDI   deep initialize routine for type xxx               (Exp_TSS)
857    --    xxxEQ   composite equality routine for record type xxx     (Exp_TSS)
858    --    xxxFA   PolyORB/DSA From_Any converter for type xxx        (Exp_TSS)
859    --    xxxIP   initialization procedure for type xxx              (Exp_TSS)
860    --    xxxRA   RAS type access routine for type xxx               (Exp_TSS)
861    --    xxxRD   RAS type dereference routine for type xxx          (Exp_TSS)
862    --    xxxRP   Rep to Pos conversion for enumeration type xxx     (Exp_TSS)
863    --    xxxSA   array/slice assignment for controlled comp. arrays (Exp_TSS)
864    --    xxxSI   stream input attribute subprogram for type xxx     (Exp_TSS)
865    --    xxxSO   stream output attribute subprogram for type xxx    (Exp_TSS)
866    --    xxxSR   stream read attribute subprogram for type xxx      (Exp_TSS)
867    --    xxxSW   stream write attribute subprogram for type xxx     (Exp_TSS)
868    --    xxxTA   PolyORB/DSA To_Any converter for type xxx          (Exp_TSS)
869    --    xxxTC   PolyORB/DSA Typecode for type xxx                  (Exp_TSS)
870
871    --  Implicit type names
872
873    --    TxxxT   type of literal table for enumeration type xxx     (Sem_Ch3)
874
875    --  (Note: this list is not complete or accurate ???)
876
877    ----------------------
878    -- Get_Attribute_Id --
879    ----------------------
880
881    function Get_Attribute_Id (N : Name_Id) return Attribute_Id is
882    begin
883       return Attribute_Id'Val (N - First_Attribute_Name);
884    end Get_Attribute_Id;
885
886    -----------------------
887    -- Get_Convention_Id --
888    -----------------------
889
890    function Get_Convention_Id (N : Name_Id) return Convention_Id is
891    begin
892       case N is
893          when Name_Ada        => return Convention_Ada;
894          when Name_Assembler  => return Convention_Assembler;
895          when Name_C          => return Convention_C;
896          when Name_CIL        => return Convention_CIL;
897          when Name_COBOL      => return Convention_COBOL;
898          when Name_CPP        => return Convention_CPP;
899          when Name_Fortran    => return Convention_Fortran;
900          when Name_Intrinsic  => return Convention_Intrinsic;
901          when Name_Java       => return Convention_Java;
902          when Name_Stdcall    => return Convention_Stdcall;
903          when Name_Stubbed    => return Convention_Stubbed;
904
905          --  If no direct match, then we must have a convention
906          --  identifier pragma that has specified this name.
907
908          when others          =>
909             for J in 1 .. Convention_Identifiers.Last loop
910                if N = Convention_Identifiers.Table (J).Name then
911                   return Convention_Identifiers.Table (J).Convention;
912                end if;
913             end loop;
914
915             raise Program_Error;
916       end case;
917    end Get_Convention_Id;
918
919    -------------------------
920    -- Get_Convention_Name --
921    -------------------------
922
923    function Get_Convention_Name (C : Convention_Id) return Name_Id is
924    begin
925       case C is
926          when Convention_Ada       => return Name_Ada;
927          when Convention_Assembler => return Name_Assembler;
928          when Convention_C         => return Name_C;
929          when Convention_CIL       => return Name_CIL;
930          when Convention_COBOL     => return Name_COBOL;
931          when Convention_CPP       => return Name_CPP;
932          when Convention_Entry     => return Name_Entry;
933          when Convention_Fortran   => return Name_Fortran;
934          when Convention_Intrinsic => return Name_Intrinsic;
935          when Convention_Java      => return Name_Java;
936          when Convention_Protected => return Name_Protected;
937          when Convention_Stdcall   => return Name_Stdcall;
938          when Convention_Stubbed   => return Name_Stubbed;
939       end case;
940    end Get_Convention_Name;
941
942    ---------------------------
943    -- Get_Locking_Policy_Id --
944    ---------------------------
945
946    function Get_Locking_Policy_Id (N : Name_Id) return Locking_Policy_Id is
947    begin
948       return Locking_Policy_Id'Val (N - First_Locking_Policy_Name);
949    end Get_Locking_Policy_Id;
950
951    -------------------
952    -- Get_Pragma_Id --
953    -------------------
954
955    function Get_Pragma_Id (N : Name_Id) return Pragma_Id is
956    begin
957       if N = Name_AST_Entry then
958          return Pragma_AST_Entry;
959       elsif N = Name_Fast_Math then
960          return Pragma_Fast_Math;
961       elsif N = Name_Interface then
962          return Pragma_Interface;
963       elsif N = Name_Priority then
964          return Pragma_Priority;
965       elsif N = Name_Relative_Deadline then
966          return Pragma_Relative_Deadline;
967       elsif N = Name_Storage_Size then
968          return Pragma_Storage_Size;
969       elsif N = Name_Storage_Unit then
970          return Pragma_Storage_Unit;
971       elsif N not in First_Pragma_Name .. Last_Pragma_Name then
972          return Unknown_Pragma;
973       else
974          return Pragma_Id'Val (N - First_Pragma_Name);
975       end if;
976    end Get_Pragma_Id;
977
978    ---------------------------
979    -- Get_Queuing_Policy_Id --
980    ---------------------------
981
982    function Get_Queuing_Policy_Id (N : Name_Id) return Queuing_Policy_Id is
983    begin
984       return Queuing_Policy_Id'Val (N - First_Queuing_Policy_Name);
985    end Get_Queuing_Policy_Id;
986
987    ------------------------------------
988    -- Get_Task_Dispatching_Policy_Id --
989    ------------------------------------
990
991    function Get_Task_Dispatching_Policy_Id
992      (N : Name_Id) return Task_Dispatching_Policy_Id
993    is
994    begin
995       return Task_Dispatching_Policy_Id'Val
996         (N - First_Task_Dispatching_Policy_Name);
997    end Get_Task_Dispatching_Policy_Id;
998
999    ----------------
1000    -- Initialize --
1001    ----------------
1002
1003    procedure Initialize is
1004       P_Index      : Natural;
1005       Discard_Name : Name_Id;
1006
1007    begin
1008       P_Index := Preset_Names'First;
1009       loop
1010          Name_Len := 0;
1011          while Preset_Names (P_Index) /= '#' loop
1012             Name_Len := Name_Len + 1;
1013             Name_Buffer (Name_Len) := Preset_Names (P_Index);
1014             P_Index := P_Index + 1;
1015          end loop;
1016
1017          --  We do the Name_Find call to enter the name into the table, but
1018          --  we don't need to do anything with the result, since we already
1019          --  initialized all the preset names to have the right value (we
1020          --  are depending on the order of the names and Preset_Names).
1021
1022          Discard_Name := Name_Find;
1023          P_Index := P_Index + 1;
1024          exit when Preset_Names (P_Index) = '#';
1025       end loop;
1026
1027       --  Make sure that number of names in standard table is correct. If
1028       --  this check fails, run utility program XSNAMES to construct a new
1029       --  properly matching version of the body.
1030
1031       pragma Assert (Discard_Name = Last_Predefined_Name);
1032
1033       --  Initialize the convention identifiers table with the standard
1034       --  set of synonyms that we recognize for conventions.
1035
1036       Convention_Identifiers.Init;
1037
1038       Convention_Identifiers.Append ((Name_Asm,         Convention_Assembler));
1039       Convention_Identifiers.Append ((Name_Assembly,    Convention_Assembler));
1040
1041       Convention_Identifiers.Append ((Name_Default,     Convention_C));
1042       Convention_Identifiers.Append ((Name_External,    Convention_C));
1043
1044       Convention_Identifiers.Append ((Name_C_Plus_Plus, Convention_CPP));
1045
1046       Convention_Identifiers.Append ((Name_DLL,         Convention_Stdcall));
1047       Convention_Identifiers.Append ((Name_Win32,       Convention_Stdcall));
1048    end Initialize;
1049
1050    -----------------------
1051    -- Is_Attribute_Name --
1052    -----------------------
1053
1054    function Is_Attribute_Name (N : Name_Id) return Boolean is
1055    begin
1056       return N in First_Attribute_Name .. Last_Attribute_Name;
1057    end Is_Attribute_Name;
1058
1059    ----------------------------------
1060    -- Is_Configuration_Pragma_Name --
1061    ----------------------------------
1062
1063    function Is_Configuration_Pragma_Name (N : Name_Id) return Boolean is
1064    begin
1065       return N in First_Pragma_Name .. Last_Configuration_Pragma_Name
1066         or else N = Name_Fast_Math;
1067    end Is_Configuration_Pragma_Name;
1068
1069    ------------------------
1070    -- Is_Convention_Name --
1071    ------------------------
1072
1073    function Is_Convention_Name (N : Name_Id) return Boolean is
1074    begin
1075       --  Check if this is one of the standard conventions
1076
1077       if N in First_Convention_Name .. Last_Convention_Name
1078         or else N = Name_C
1079       then
1080          return True;
1081
1082       --  Otherwise check if it is in convention identifier table
1083
1084       else
1085          for J in 1 .. Convention_Identifiers.Last loop
1086             if N = Convention_Identifiers.Table (J).Name then
1087                return True;
1088             end if;
1089          end loop;
1090
1091          return False;
1092       end if;
1093    end Is_Convention_Name;
1094
1095    ------------------------------
1096    -- Is_Entity_Attribute_Name --
1097    ------------------------------
1098
1099    function Is_Entity_Attribute_Name (N : Name_Id) return Boolean is
1100    begin
1101       return N in First_Entity_Attribute_Name .. Last_Entity_Attribute_Name;
1102    end Is_Entity_Attribute_Name;
1103
1104    --------------------------------
1105    -- Is_Function_Attribute_Name --
1106    --------------------------------
1107
1108    function Is_Function_Attribute_Name (N : Name_Id) return Boolean is
1109    begin
1110       return N in
1111         First_Renamable_Function_Attribute ..
1112           Last_Renamable_Function_Attribute;
1113    end Is_Function_Attribute_Name;
1114
1115    ---------------------
1116    -- Is_Keyword_Name --
1117    ---------------------
1118
1119    function Is_Keyword_Name (N : Name_Id) return Boolean is
1120    begin
1121       return Get_Name_Table_Byte (N) /= 0
1122         and then (Ada_Version >= Ada_95
1123                   or else N not in Ada_95_Reserved_Words)
1124         and then (Ada_Version >= Ada_05
1125                   or else N not in Ada_2005_Reserved_Words);
1126    end Is_Keyword_Name;
1127
1128    ----------------------------
1129    -- Is_Locking_Policy_Name --
1130    ----------------------------
1131
1132    function Is_Locking_Policy_Name (N : Name_Id) return Boolean is
1133    begin
1134       return N in First_Locking_Policy_Name .. Last_Locking_Policy_Name;
1135    end Is_Locking_Policy_Name;
1136
1137    -----------------------------
1138    -- Is_Operator_Symbol_Name --
1139    -----------------------------
1140
1141    function Is_Operator_Symbol_Name (N : Name_Id) return Boolean is
1142    begin
1143       return N in First_Operator_Name .. Last_Operator_Name;
1144    end Is_Operator_Symbol_Name;
1145
1146    --------------------
1147    -- Is_Pragma_Name --
1148    --------------------
1149
1150    function Is_Pragma_Name (N : Name_Id) return Boolean is
1151    begin
1152       return N in First_Pragma_Name .. Last_Pragma_Name
1153         or else N = Name_AST_Entry
1154         or else N = Name_Fast_Math
1155         or else N = Name_Interface
1156         or else N = Name_Relative_Deadline
1157         or else N = Name_Priority
1158         or else N = Name_Storage_Size
1159         or else N = Name_Storage_Unit;
1160    end Is_Pragma_Name;
1161
1162    ---------------------------------
1163    -- Is_Procedure_Attribute_Name --
1164    ---------------------------------
1165
1166    function Is_Procedure_Attribute_Name (N : Name_Id) return Boolean is
1167    begin
1168       return N in First_Procedure_Attribute .. Last_Procedure_Attribute;
1169    end Is_Procedure_Attribute_Name;
1170
1171    ----------------------------
1172    -- Is_Queuing_Policy_Name --
1173    ----------------------------
1174
1175    function Is_Queuing_Policy_Name (N : Name_Id) return Boolean is
1176    begin
1177       return N in First_Queuing_Policy_Name .. Last_Queuing_Policy_Name;
1178    end Is_Queuing_Policy_Name;
1179
1180    -------------------------------------
1181    -- Is_Task_Dispatching_Policy_Name --
1182    -------------------------------------
1183
1184    function Is_Task_Dispatching_Policy_Name (N : Name_Id) return Boolean is
1185    begin
1186       return N in First_Task_Dispatching_Policy_Name ..
1187                   Last_Task_Dispatching_Policy_Name;
1188    end Is_Task_Dispatching_Policy_Name;
1189
1190    ----------------------------
1191    -- Is_Type_Attribute_Name --
1192    ----------------------------
1193
1194    function Is_Type_Attribute_Name (N : Name_Id) return Boolean is
1195    begin
1196       return N in First_Type_Attribute_Name .. Last_Type_Attribute_Name;
1197    end Is_Type_Attribute_Name;
1198
1199    ----------------------------------
1200    -- Record_Convention_Identifier --
1201    ----------------------------------
1202
1203    procedure Record_Convention_Identifier
1204      (Id         : Name_Id;
1205       Convention : Convention_Id)
1206    is
1207    begin
1208       Convention_Identifiers.Append ((Id, Convention));
1209    end Record_Convention_Identifier;
1210
1211 end Snames;