OSDN Git Service

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