OSDN Git Service

2004-10-26 Thomas Quinot <quinot@act-europe.fr>
[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      "binder#" &
630      "body_suffix#" &
631      "builder#" &
632      "compiler#" &
633      "cross_reference#" &
634      "default_switches#" &
635      "exec_dir#" &
636      "executable#" &
637      "executable_suffix#" &
638      "extends#" &
639      "finder#" &
640      "global_configuration_pragmas#" &
641      "gnatls#" &
642      "gnatstub#" &
643      "implementation#" &
644      "implementation_exceptions#" &
645      "implementation_suffix#" &
646      "languages#" &
647      "library_dir#" &
648      "library_auto_init#" &
649      "library_gcc#" &
650      "library_interface#" &
651      "library_kind#" &
652      "library_name#" &
653      "library_options#" &
654      "library_reference_symbol_file#" &
655      "library_src_dir#" &
656      "library_symbol_file#" &
657      "library_symbol_policy#" &
658      "library_version#" &
659      "linker#" &
660      "local_configuration_pragmas#" &
661      "locally_removed_files#" &
662      "metrics#" &
663      "naming#" &
664      "object_dir#" &
665      "pretty_printer#" &
666      "project#" &
667      "separate_suffix#" &
668      "source_dirs#" &
669      "source_files#" &
670      "source_list_file#" &
671      "spec#" &
672      "spec_suffix#" &
673      "specification#" &
674      "specification_exceptions#" &
675      "specification_suffix#" &
676      "switches#" &
677      "unaligned_valid#" &
678       "#";
679
680    ---------------------
681    -- Generated Names --
682    ---------------------
683
684    --  This section lists the various cases of generated names which are
685    --  built from existing names by adding unique leading and/or trailing
686    --  upper case letters. In some cases these names are built recursively,
687    --  in particular names built from types may be built from types which
688    --  themselves have generated names. In this list, xxx represents an
689    --  existing name to which identifying letters are prepended or appended,
690    --  and a trailing n represents a serial number in an external name that
691    --  has some semantic significance (e.g. the n'th index type of an array).
692
693    --    xxxA    access type for formal xxx in entry param record   (Exp_Ch9)
694    --    xxxB    tag table for tagged type xxx                      (Exp_Ch3)
695    --    xxxB    task body procedure for task xxx                   (Exp_Ch9)
696    --    xxxD    dispatch table for tagged type xxx                 (Exp_Ch3)
697    --    xxxD    discriminal for discriminant xxx                   (Sem_Ch3)
698    --    xxxDn   n'th discr check function for rec type xxx         (Exp_Ch3)
699    --    xxxE    elaboration boolean flag for task xxx              (Exp_Ch9)
700    --    xxxE    dispatch table pointer type for tagged type xxx    (Exp_Ch3)
701    --    xxxE    parameters for accept body for entry xxx           (Exp_Ch9)
702    --    xxxFn   n'th primitive of a tagged type (named xxx)        (Exp_Ch3)
703    --    xxxJ    tag table type index for tagged type xxx           (Exp_Ch3)
704    --    xxxM    master Id value for access type xxx                (Exp_Ch3)
705    --    xxxP    tag table pointer type for tagged type xxx         (Exp_Ch3)
706    --    xxxP    parameter record type for entry xxx                (Exp_Ch9)
707    --    xxxPA   access to parameter record type for entry xxx      (Exp_Ch9)
708    --    xxxPn   pointer type for n'th primitive of tagged type xxx (Exp_Ch3)
709    --    xxxR    dispatch table pointer for tagged type xxx         (Exp_Ch3)
710    --    xxxT    tag table type for tagged type xxx                 (Exp_Ch3)
711    --    xxxT    literal table for enumeration type xxx             (Sem_Ch3)
712    --    xxxV    type for task value record for task xxx            (Exp_Ch9)
713    --    xxxX    entry index constant                               (Exp_Ch9)
714    --    xxxY    dispatch table type for tagged type xxx            (Exp_Ch3)
715    --    xxxZ    size variable for task xxx                         (Exp_Ch9)
716
717    --  TSS names
718
719    --    xxxDA   deep adjust routine for type xxx                   (Exp_TSS)
720    --    xxxDF   deep finalize routine for type xxx                 (Exp_TSS)
721    --    xxxDI   deep initialize routine for type xxx               (Exp_TSS)
722    --    xxxEQ   composite equality routine for record type xxx     (Exp_TSS)
723    --    xxxIP   initialization procedure for type xxx              (Exp_TSS)
724    --    xxxRA   RAs type access routine for type xxx               (Exp_TSS)
725    --    xxxRD   RAs type dereference routine for type xxx          (Exp_TSS)
726    --    xxxRP   Rep to Pos conversion for enumeration type xxx     (Exp_TSS)
727    --    xxxSA   array/slice assignment for controlled comp. arrays (Exp_TSS)
728    --    xxxSI   stream input attribute subprogram for type xxx     (Exp_TSS)
729    --    xxxSO   stream output attribute subprogram for type xxx    (Exp_TSS)
730    --    xxxSR   stream read attribute subprogram for type xxx      (Exp_TSS)
731    --    xxxSW   stream write attribute subprogram for type xxx     (Exp_TSS)
732
733    --  Implicit type names
734
735    --    TxxxT   type of literal table for enumeration type xxx     (Sem_Ch3)
736
737    --  (Note: this list is not complete or accurate ???)
738
739    ----------------------
740    -- Get_Attribute_Id --
741    ----------------------
742
743    function Get_Attribute_Id (N : Name_Id) return Attribute_Id is
744    begin
745       return Attribute_Id'Val (N - First_Attribute_Name);
746    end Get_Attribute_Id;
747
748    ------------------
749    -- Get_Check_Id --
750    ------------------
751
752    function Get_Check_Id (N : Name_Id) return Check_Id is
753    begin
754       return Check_Id'Val (N - First_Check_Name);
755    end Get_Check_Id;
756
757    -----------------------
758    -- Get_Convention_Id --
759    -----------------------
760
761    function Get_Convention_Id (N : Name_Id) return Convention_Id is
762    begin
763       case N is
764          when Name_Ada        => return Convention_Ada;
765          when Name_Assembler  => return Convention_Assembler;
766          when Name_C          => return Convention_C;
767          when Name_COBOL      => return Convention_COBOL;
768          when Name_CPP        => return Convention_CPP;
769          when Name_Fortran    => return Convention_Fortran;
770          when Name_Intrinsic  => return Convention_Intrinsic;
771          when Name_Java       => return Convention_Java;
772          when Name_Stdcall    => return Convention_Stdcall;
773          when Name_Stubbed    => return Convention_Stubbed;
774
775          --  If no direct match, then we must have a convention
776          --  identifier pragma that has specified this name.
777
778          when others          =>
779             for J in 1 .. Convention_Identifiers.Last loop
780                if N = Convention_Identifiers.Table (J).Name then
781                   return Convention_Identifiers.Table (J).Convention;
782                end if;
783             end loop;
784
785             raise Program_Error;
786       end case;
787    end Get_Convention_Id;
788
789    ---------------------------
790    -- Get_Locking_Policy_Id --
791    ---------------------------
792
793    function Get_Locking_Policy_Id (N : Name_Id) return Locking_Policy_Id is
794    begin
795       return Locking_Policy_Id'Val (N - First_Locking_Policy_Name);
796    end Get_Locking_Policy_Id;
797
798    -------------------
799    -- Get_Pragma_Id --
800    -------------------
801
802    function Get_Pragma_Id (N : Name_Id) return Pragma_Id is
803    begin
804       if N = Name_AST_Entry then
805          return Pragma_AST_Entry;
806       elsif N = Name_Storage_Size then
807          return Pragma_Storage_Size;
808       elsif N = Name_Storage_Unit then
809          return Pragma_Storage_Unit;
810       elsif N not in First_Pragma_Name .. Last_Pragma_Name then
811          return Unknown_Pragma;
812       else
813          return Pragma_Id'Val (N - First_Pragma_Name);
814       end if;
815    end Get_Pragma_Id;
816
817    ---------------------------
818    -- Get_Queuing_Policy_Id --
819    ---------------------------
820
821    function Get_Queuing_Policy_Id (N : Name_Id) return Queuing_Policy_Id is
822    begin
823       return Queuing_Policy_Id'Val (N - First_Queuing_Policy_Name);
824    end Get_Queuing_Policy_Id;
825
826    ------------------------------------
827    -- Get_Task_Dispatching_Policy_Id --
828    ------------------------------------
829
830    function Get_Task_Dispatching_Policy_Id (N : Name_Id)
831      return Task_Dispatching_Policy_Id is
832    begin
833       return Task_Dispatching_Policy_Id'Val
834         (N - First_Task_Dispatching_Policy_Name);
835    end Get_Task_Dispatching_Policy_Id;
836
837    ----------------
838    -- Initialize --
839    ----------------
840
841    procedure Initialize is
842       P_Index      : Natural;
843       Discard_Name : Name_Id;
844
845    begin
846       P_Index := Preset_Names'First;
847
848       loop
849          Name_Len := 0;
850
851          while Preset_Names (P_Index) /= '#' loop
852             Name_Len := Name_Len + 1;
853             Name_Buffer (Name_Len) := Preset_Names (P_Index);
854             P_Index := P_Index + 1;
855          end loop;
856
857          --  We do the Name_Find call to enter the name into the table, but
858          --  we don't need to do anything with the result, since we already
859          --  initialized all the preset names to have the right value (we
860          --  are depending on the order of the names and Preset_Names).
861
862          Discard_Name := Name_Find;
863          P_Index := P_Index + 1;
864          exit when Preset_Names (P_Index) = '#';
865       end loop;
866
867       --  Make sure that number of names in standard table is correct. If
868       --  this check fails, run utility program XSNAMES to construct a new
869       --  properly matching version of the body.
870
871       pragma Assert (Discard_Name = Last_Predefined_Name);
872
873       --  Initialize the convention identifiers table with the standard
874       --  set of synonyms that we recognize for conventions.
875
876       Convention_Identifiers.Init;
877
878       Convention_Identifiers.Append ((Name_Asm,      Convention_Assembler));
879       Convention_Identifiers.Append ((Name_Assembly, Convention_Assembler));
880
881       Convention_Identifiers.Append ((Name_Default,  Convention_C));
882       Convention_Identifiers.Append ((Name_External, Convention_C));
883
884       Convention_Identifiers.Append ((Name_DLL,      Convention_Stdcall));
885       Convention_Identifiers.Append ((Name_Win32,    Convention_Stdcall));
886    end Initialize;
887
888    -----------------------
889    -- Is_Attribute_Name --
890    -----------------------
891
892    function Is_Attribute_Name (N : Name_Id) return Boolean is
893    begin
894       return N in First_Attribute_Name .. Last_Attribute_Name;
895    end Is_Attribute_Name;
896
897    -------------------
898    -- Is_Check_Name --
899    -------------------
900
901    function Is_Check_Name (N : Name_Id) return Boolean is
902    begin
903       return N in First_Check_Name .. Last_Check_Name;
904    end Is_Check_Name;
905
906    ------------------------
907    -- Is_Convention_Name --
908    ------------------------
909
910    function Is_Convention_Name (N : Name_Id) return Boolean is
911    begin
912       --  Check if this is one of the standard conventions
913
914       if N in First_Convention_Name .. Last_Convention_Name
915         or else N = Name_C
916       then
917          return True;
918
919       --  Otherwise check if it is in convention identifier table
920
921       else
922          for J in 1 .. Convention_Identifiers.Last loop
923             if N = Convention_Identifiers.Table (J).Name then
924                return True;
925             end if;
926          end loop;
927
928          return False;
929       end if;
930    end Is_Convention_Name;
931
932    ------------------------------
933    -- Is_Entity_Attribute_Name --
934    ------------------------------
935
936    function Is_Entity_Attribute_Name (N : Name_Id) return Boolean is
937    begin
938       return N in First_Entity_Attribute_Name .. Last_Entity_Attribute_Name;
939    end Is_Entity_Attribute_Name;
940
941    --------------------------------
942    -- Is_Function_Attribute_Name --
943    --------------------------------
944
945    function Is_Function_Attribute_Name (N : Name_Id) return Boolean is
946    begin
947       return N in
948         First_Renamable_Function_Attribute ..
949           Last_Renamable_Function_Attribute;
950    end Is_Function_Attribute_Name;
951
952    ----------------------------
953    -- Is_Locking_Policy_Name --
954    ----------------------------
955
956    function Is_Locking_Policy_Name (N : Name_Id) return Boolean is
957    begin
958       return N in First_Locking_Policy_Name .. Last_Locking_Policy_Name;
959    end Is_Locking_Policy_Name;
960
961    -----------------------------
962    -- Is_Operator_Symbol_Name --
963    -----------------------------
964
965    function Is_Operator_Symbol_Name (N : Name_Id) return Boolean is
966    begin
967       return N in First_Operator_Name .. Last_Operator_Name;
968    end Is_Operator_Symbol_Name;
969
970    --------------------
971    -- Is_Pragma_Name --
972    --------------------
973
974    function Is_Pragma_Name (N : Name_Id) return Boolean is
975    begin
976       return N in First_Pragma_Name .. Last_Pragma_Name
977         or else N = Name_AST_Entry
978         or else N = Name_Storage_Size
979         or else N = Name_Storage_Unit;
980    end Is_Pragma_Name;
981
982    ---------------------------------
983    -- Is_Procedure_Attribute_Name --
984    ---------------------------------
985
986    function Is_Procedure_Attribute_Name (N : Name_Id) return Boolean is
987    begin
988       return N in First_Procedure_Attribute .. Last_Procedure_Attribute;
989    end Is_Procedure_Attribute_Name;
990
991    ----------------------------
992    -- Is_Queuing_Policy_Name --
993    ----------------------------
994
995    function Is_Queuing_Policy_Name (N : Name_Id) return Boolean is
996    begin
997       return N in First_Queuing_Policy_Name .. Last_Queuing_Policy_Name;
998    end Is_Queuing_Policy_Name;
999
1000    -------------------------------------
1001    -- Is_Task_Dispatching_Policy_Name --
1002    -------------------------------------
1003
1004    function Is_Task_Dispatching_Policy_Name (N : Name_Id) return Boolean is
1005    begin
1006       return N in First_Task_Dispatching_Policy_Name ..
1007                   Last_Task_Dispatching_Policy_Name;
1008    end Is_Task_Dispatching_Policy_Name;
1009
1010    ----------------------------
1011    -- Is_Type_Attribute_Name --
1012    ----------------------------
1013
1014    function Is_Type_Attribute_Name (N : Name_Id) return Boolean is
1015    begin
1016       return N in First_Type_Attribute_Name .. Last_Type_Attribute_Name;
1017    end Is_Type_Attribute_Name;
1018
1019    ----------------------------------
1020    -- Record_Convention_Identifier --
1021    ----------------------------------
1022
1023    procedure Record_Convention_Identifier
1024      (Id         : Name_Id;
1025       Convention : Convention_Id)
1026    is
1027    begin
1028       Convention_Identifiers.Append ((Id, Convention));
1029    end Record_Convention_Identifier;
1030
1031 end Snames;