OSDN Git Service

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