OSDN Git Service

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