OSDN Git Service

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