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