OSDN Git Service

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