OSDN Git Service

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