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