OSDN Git Service

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