OSDN Git Service

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