OSDN Git Service

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