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