d764320be368a71715adc03b25b0da7a98844cee
[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_size#" &
346 "mechanism#" &
347 "mixedcase#" &
348 "modified_gpl#" &
349 "name#" &
350 "nca#" &
351 "no#" &
352 "on#" &
353 "parameter_types#" &
354 "reference#" &
355 "no_dynamic_interrupts#" &
356 "no_requeue#" &
357 "no_task_attributes#" &
358 "restricted#" &
359 "result_mechanism#" &
360 "result_type#" &
361 "runtime#" &
362 "sb#" &
363 "secondary_stack_size#" &
364 "section#" &
365 "semaphore#" &
366 "spec_file_name#" &
367 "static#" &
368 "stack_size#" &
369 "subunit_file_name#" &
370 "task_stack_size_default#" &
371 "task_type#" &
372 "time_slicing_enabled#" &
373 "top_guard#" &
374 "uba#" &
375 "ubs#" &
376 "ubsb#" &
377 "unit_name#" &
378 "unknown#" &
379 "unrestricted#" &
380 "uppercase#" &
381 "user#" &
382 "vax_float#" &
383 "vms#" &
384 "working_storage#" &
385 "abort_signal#" &
386 "access#" &
387 "address#" &
388 "address_size#" &
389 "aft#" &
390 "alignment#" &
391 "asm_input#" &
392 "asm_output#" &
393 "ast_entry#" &
394 "bit#" &
395 "bit_order#" &
396 "bit_position#" &
397 "body_version#" &
398 "callable#" &
399 "caller#" &
400 "code_address#" &
401 "component_size#" &
402 "compose#" &
403 "constrained#" &
404 "count#" &
405 "default_bit_order#" &
406 "definite#" &
407 "delta#" &
408 "denorm#" &
409 "digits#" &
410 "elaborated#" &
411 "emax#" &
412 "enum_rep#" &
413 "epsilon#" &
414 "exponent#" &
415 "external_tag#" &
416 "first#" &
417 "first_bit#" &
418 "fixed_value#" &
419 "fore#" &
420 "has_discriminants#" &
421 "identity#" &
422 "img#" &
423 "integer_value#" &
424 "large#" &
425 "last#" &
426 "last_bit#" &
427 "leading_part#" &
428 "length#" &
429 "machine_emax#" &
430 "machine_emin#" &
431 "machine_mantissa#" &
432 "machine_overflows#" &
433 "machine_radix#" &
434 "machine_rounds#" &
435 "machine_size#" &
436 "mantissa#" &
437 "max_size_in_storage_elements#" &
438 "maximum_alignment#" &
439 "mechanism_code#" &
440 "model_emin#" &
441 "model_epsilon#" &
442 "model_mantissa#" &
443 "model_small#" &
444 "modulus#" &
445 "null_parameter#" &
446 "object_size#" &
447 "partition_id#" &
448 "passed_by_reference#" &
449 "pool_address#" &
450 "pos#" &
451 "position#" &
452 "range#" &
453 "range_length#" &
454 "round#" &
455 "safe_emax#" &
456 "safe_first#" &
457 "safe_large#" &
458 "safe_last#" &
459 "safe_small#" &
460 "scale#" &
461 "scaling#" &
462 "signed_zeros#" &
463 "size#" &
464 "small#" &
465 "storage_size#" &
466 "storage_unit#" &
467 "tag#" &
468 "target_name#" &
469 "terminated#" &
470 "to_address#" &
471 "type_class#" &
472 "uet_address#" &
473 "unbiased_rounding#" &
474 "unchecked_access#" &
475 "unconstrained_array#" &
476 "universal_literal_string#" &
477 "unrestricted_access#" &
478 "vads_size#" &
479 "val#" &
480 "valid#" &
481 "value_size#" &
482 "version#" &
483 "wchar_t_size#" &
484 "wide_width#" &
485 "width#" &
486 "word_size#" &
487 "adjacent#" &
488 "ceiling#" &
489 "copy_sign#" &
490 "floor#" &
491 "fraction#" &
492 "image#" &
493 "input#" &
494 "machine#" &
495 "max#" &
496 "min#" &
497 "model#" &
498 "pred#" &
499 "remainder#" &
500 "rounding#" &
501 "succ#" &
502 "truncation#" &
503 "value#" &
504 "wide_image#" &
505 "wide_value#" &
506 "output#" &
507 "read#" &
508 "write#" &
509 "elab_body#" &
510 "elab_spec#" &
511 "storage_pool#" &
512 "base#" &
513 "class#" &
514 "ceiling_locking#" &
515 "inheritance_locking#" &
516 "fifo_queuing#" &
517 "priority_queuing#" &
518 "fifo_within_priorities#" &
519 "access_check#" &
520 "accessibility_check#" &
521 "discriminant_check#" &
522 "division_check#" &
523 "elaboration_check#" &
524 "index_check#" &
525 "length_check#" &
526 "overflow_check#" &
527 "range_check#" &
528 "storage_check#" &
529 "tag_check#" &
530 "all_checks#" &
531 "abort#" &
532 "abs#" &
533 "accept#" &
534 "and#" &
535 "all#" &
536 "array#" &
537 "at#" &
538 "begin#" &
539 "body#" &
540 "case#" &
541 "constant#" &
542 "declare#" &
543 "delay#" &
544 "do#" &
545 "else#" &
546 "elsif#" &
547 "end#" &
548 "entry#" &
549 "exception#" &
550 "exit#" &
551 "for#" &
552 "function#" &
553 "generic#" &
554 "goto#" &
555 "if#" &
556 "in#" &
557 "is#" &
558 "limited#" &
559 "loop#" &
560 "mod#" &
561 "new#" &
562 "not#" &
563 "null#" &
564 "of#" &
565 "or#" &
566 "others#" &
567 "out#" &
568 "package#" &
569 "pragma#" &
570 "private#" &
571 "procedure#" &
572 "raise#" &
573 "record#" &
574 "rem#" &
575 "renames#" &
576 "return#" &
577 "reverse#" &
578 "select#" &
579 "separate#" &
580 "subtype#" &
581 "task#" &
582 "terminate#" &
583 "then#" &
584 "type#" &
585 "use#" &
586 "when#" &
587 "while#" &
588 "with#" &
589 "xor#" &
590 "divide#" &
591 "enclosing_entity#" &
592 "exception_information#" &
593 "exception_message#" &
594 "exception_name#" &
595 "file#" &
596 "import_address#" &
597 "import_largest_value#" &
598 "import_value#" &
599 "is_negative#" &
600 "line#" &
601 "rotate_left#" &
602 "rotate_right#" &
603 "shift_left#" &
604 "shift_right#" &
605 "shift_right_arithmetic#" &
606 "source_location#" &
607 "unchecked_conversion#" &
608 "unchecked_deallocation#" &
609 "to_pointer#" &
610 "abstract#" &
611 "aliased#" &
612 "protected#" &
613 "until#" &
614 "requeue#" &
615 "tagged#" &
616 "raise_exception#" &
617 "binder#" &
618 "body_suffix#" &
619 "builder#" &
620 "compiler#" &
621 "cross_reference#" &
622 "default_switches#" &
623 "exec_dir#" &
624 "executable#" &
625 "executable_suffix#" &
626 "extends#" &
627 "finder#" &
628 "global_configuration_pragmas#" &
629 "gnatls#" &
630 "gnatstub#" &
631 "implementation#" &
632 "implementation_exceptions#" &
633 "implementation_suffix#" &
634 "languages#" &
635 "library_dir#" &
636 "library_auto_init#" &
637 "library_gcc#" &
638 "library_interface#" &
639 "library_kind#" &
640 "library_name#" &
641 "library_options#" &
642 "library_reference_symbol_file#" &
643 "library_src_dir#" &
644 "library_symbol_file#" &
645 "library_symbol_policy#" &
646 "library_version#" &
647 "linker#" &
648 "local_configuration_pragmas#" &
649 "locally_removed_files#" &
650 "naming#" &
651 "object_dir#" &
652 "pretty_printer#" &
653 "project#" &
654 "separate_suffix#" &
655 "source_dirs#" &
656 "source_files#" &
657 "source_list_file#" &
658 "spec#" &
659 "spec_suffix#" &
660 "specification#" &
661 "specification_exceptions#" &
662 "specification_suffix#" &
663 "switches#" &
664 "unaligned_valid#" &
665 "#";
666
667 ---------------------
668 -- Generated Names --
669 ---------------------
670
671 -- This section lists the various cases of generated names which are
672 -- built from existing names by adding unique leading and/or trailing
673 -- upper case letters. In some cases these names are built recursively,
674 -- in particular names built from types may be built from types which
675 -- themselves have generated names. In this list, xxx represents an
676 -- existing name to which identifying letters are prepended or appended,
677 -- and a trailing n represents a serial number in an external name that
678 -- has some semantic significance (e.g. the n'th index type of an array).
679
680 -- xxxA access type for formal xxx in entry param record (Exp_Ch9)
681 -- xxxB tag table for tagged type xxx (Exp_Ch3)
682 -- xxxB task body procedure for task xxx (Exp_Ch9)
683 -- xxxD dispatch table for tagged type xxx (Exp_Ch3)
684 -- xxxD discriminal for discriminant xxx (Sem_Ch3)
685 -- xxxDn n'th discr check function for rec type xxx (Exp_Ch3)
686 -- xxxE elaboration boolean flag for task xxx (Exp_Ch9)
687 -- xxxE dispatch table pointer type for tagged type xxx (Exp_Ch3)
688 -- xxxE parameters for accept body for entry xxx (Exp_Ch9)
689 -- xxxFn n'th primitive of a tagged type (named xxx) (Exp_Ch3)
690 -- xxxJ tag table type index for tagged type xxx (Exp_Ch3)
691 -- xxxM master Id value for access type xxx (Exp_Ch3)
692 -- xxxP tag table pointer type for tagged type xxx (Exp_Ch3)
693 -- xxxP parameter record type for entry xxx (Exp_Ch9)
694 -- xxxPA access to parameter record type for entry xxx (Exp_Ch9)
695 -- xxxPn pointer type for n'th primitive of tagged type xxx (Exp_Ch3)
696 -- xxxR dispatch table pointer for tagged type xxx (Exp_Ch3)
697 -- xxxT tag table type for tagged type xxx (Exp_Ch3)
698 -- xxxT literal table for enumeration type xxx (Sem_Ch3)
699 -- xxxV type for task value record for task xxx (Exp_Ch9)
700 -- xxxX entry index constant (Exp_Ch9)
701 -- xxxY dispatch table type for tagged type xxx (Exp_Ch3)
702 -- xxxZ size variable for task xxx (Exp_Ch9)
703
704 -- TSS names
705
706 -- xxxDA deep adjust routine for type xxx (Exp_TSS)
707 -- xxxDF deep finalize routine for type xxx (Exp_TSS)
708 -- xxxDI deep initialize routine for type xxx (Exp_TSS)
709 -- xxxEQ composite equality routine for record type xxx (Exp_TSS)
710 -- xxxIP initialization procedure for type xxx (Exp_TSS)
711 -- xxxRA RAs type access routine for type xxx (Exp_TSS)
712 -- xxxRD RAs type dereference routine for type xxx (Exp_TSS)
713 -- xxxRP Rep to Pos conversion for enumeration type xxx (Exp_TSS)
714 -- xxxSA array/slice assignment for controlled comp. arrays (Exp_TSS)
715 -- xxxSI stream input attribute subprogram for type xxx (Exp_TSS)
716 -- xxxSO stream output attribute subprogram for type xxx (Exp_TSS)
717 -- xxxSR stream read attribute subprogram for type xxx (Exp_TSS)
718 -- xxxSW stream write attribute subprogram for type xxx (Exp_TSS)
719
720 -- Implicit type names
721
722 -- TxxxT type of literal table for enumeration type xxx (Sem_Ch3)
723
724 -- (Note: this list is not complete or accurate ???)
725
726 ----------------------
727 -- Get_Attribute_Id --
728 ----------------------
729
730 function Get_Attribute_Id (N : Name_Id) return Attribute_Id is
731 begin
732 return Attribute_Id'Val (N - First_Attribute_Name);
733 end Get_Attribute_Id;
734
735 ------------------
736 -- Get_Check_Id --
737 ------------------
738
739 function Get_Check_Id (N : Name_Id) return Check_Id is
740 begin
741 return Check_Id'Val (N - First_Check_Name);
742 end Get_Check_Id;
743
744 -----------------------
745 -- Get_Convention_Id --
746 -----------------------
747
748 function Get_Convention_Id (N : Name_Id) return Convention_Id is
749 begin
750 case N is
751 when Name_Ada => return Convention_Ada;
752 when Name_Assembler => return Convention_Assembler;
753 when Name_C => return Convention_C;
754 when Name_COBOL => return Convention_COBOL;
755 when Name_CPP => return Convention_CPP;
756 when Name_Fortran => return Convention_Fortran;
757 when Name_Intrinsic => return Convention_Intrinsic;
758 when Name_Java => return Convention_Java;
759 when Name_Stdcall => return Convention_Stdcall;
760 when Name_Stubbed => return Convention_Stubbed;
761
762 -- If no direct match, then we must have a convention
763 -- identifier pragma that has specified this name.
764
765 when others =>
766 for J in 1 .. Convention_Identifiers.Last loop
767 if N = Convention_Identifiers.Table (J).Name then
768 return Convention_Identifiers.Table (J).Convention;
769 end if;
770 end loop;
771
772 raise Program_Error;
773 end case;
774 end Get_Convention_Id;
775
776 ---------------------------
777 -- Get_Locking_Policy_Id --
778 ---------------------------
779
780 function Get_Locking_Policy_Id (N : Name_Id) return Locking_Policy_Id is
781 begin
782 return Locking_Policy_Id'Val (N - First_Locking_Policy_Name);
783 end Get_Locking_Policy_Id;
784
785 -------------------
786 -- Get_Pragma_Id --
787 -------------------
788
789 function Get_Pragma_Id (N : Name_Id) return Pragma_Id is
790 begin
791 if N = Name_AST_Entry then
792 return Pragma_AST_Entry;
793 elsif N = Name_Storage_Size then
794 return Pragma_Storage_Size;
795 elsif N = Name_Storage_Unit then
796 return Pragma_Storage_Unit;
797 elsif N not in First_Pragma_Name .. Last_Pragma_Name then
798 return Unknown_Pragma;
799 else
800 return Pragma_Id'Val (N - First_Pragma_Name);
801 end if;
802 end Get_Pragma_Id;
803
804 ---------------------------
805 -- Get_Queuing_Policy_Id --
806 ---------------------------
807
808 function Get_Queuing_Policy_Id (N : Name_Id) return Queuing_Policy_Id is
809 begin
810 return Queuing_Policy_Id'Val (N - First_Queuing_Policy_Name);
811 end Get_Queuing_Policy_Id;
812
813 ------------------------------------
814 -- Get_Task_Dispatching_Policy_Id --
815 ------------------------------------
816
817 function Get_Task_Dispatching_Policy_Id (N : Name_Id)
818 return Task_Dispatching_Policy_Id is
819 begin
820 return Task_Dispatching_Policy_Id'Val
821 (N - First_Task_Dispatching_Policy_Name);
822 end Get_Task_Dispatching_Policy_Id;
823
824 ----------------
825 -- Initialize --
826 ----------------
827
828 procedure Initialize is
829 P_Index : Natural;
830 Discard_Name : Name_Id;
831
832 begin
833 P_Index := Preset_Names'First;
834
835 loop
836 Name_Len := 0;
837
838 while Preset_Names (P_Index) /= '#' loop
839 Name_Len := Name_Len + 1;
840 Name_Buffer (Name_Len) := Preset_Names (P_Index);
841 P_Index := P_Index + 1;
842 end loop;
843
844 -- We do the Name_Find call to enter the name into the table, but
845 -- we don't need to do anything with the result, since we already
846 -- initialized all the preset names to have the right value (we
847 -- are depending on the order of the names and Preset_Names).
848
849 Discard_Name := Name_Find;
850 P_Index := P_Index + 1;
851 exit when Preset_Names (P_Index) = '#';
852 end loop;
853
854 -- Make sure that number of names in standard table is correct. If
855 -- this check fails, run utility program XSNAMES to construct a new
856 -- properly matching version of the body.
857
858 pragma Assert (Discard_Name = Last_Predefined_Name);
859
860 -- Initialize the convention identifiers table with the standard
861 -- set of synonyms that we recognize for conventions.
862
863 Convention_Identifiers.Init;
864
865 Convention_Identifiers.Append ((Name_Asm, Convention_Assembler));
866 Convention_Identifiers.Append ((Name_Assembly, Convention_Assembler));
867
868 Convention_Identifiers.Append ((Name_Default, Convention_C));
869 Convention_Identifiers.Append ((Name_External, Convention_C));
870
871 Convention_Identifiers.Append ((Name_DLL, Convention_Stdcall));
872 Convention_Identifiers.Append ((Name_Win32, Convention_Stdcall));
873 end Initialize;
874
875 -----------------------
876 -- Is_Attribute_Name --
877 -----------------------
878
879 function Is_Attribute_Name (N : Name_Id) return Boolean is
880 begin
881 return N in First_Attribute_Name .. Last_Attribute_Name;
882 end Is_Attribute_Name;
883
884 -------------------
885 -- Is_Check_Name --
886 -------------------
887
888 function Is_Check_Name (N : Name_Id) return Boolean is
889 begin
890 return N in First_Check_Name .. Last_Check_Name;
891 end Is_Check_Name;
892
893 ------------------------
894 -- Is_Convention_Name --
895 ------------------------
896
897 function Is_Convention_Name (N : Name_Id) return Boolean is
898 begin
899 -- Check if this is one of the standard conventions
900
901 if N in First_Convention_Name .. Last_Convention_Name
902 or else N = Name_C
903 then
904 return True;
905
906 -- Otherwise check if it is in convention identifier table
907
908 else
909 for J in 1 .. Convention_Identifiers.Last loop
910 if N = Convention_Identifiers.Table (J).Name then
911 return True;
912 end if;
913 end loop;
914
915 return False;
916 end if;
917 end Is_Convention_Name;
918
919 ------------------------------
920 -- Is_Entity_Attribute_Name --
921 ------------------------------
922
923 function Is_Entity_Attribute_Name (N : Name_Id) return Boolean is
924 begin
925 return N in First_Entity_Attribute_Name .. Last_Entity_Attribute_Name;
926 end Is_Entity_Attribute_Name;
927
928 --------------------------------
929 -- Is_Function_Attribute_Name --
930 --------------------------------
931
932 function Is_Function_Attribute_Name (N : Name_Id) return Boolean is
933 begin
934 return N in
935 First_Renamable_Function_Attribute ..
936 Last_Renamable_Function_Attribute;
937 end Is_Function_Attribute_Name;
938
939 ----------------------------
940 -- Is_Locking_Policy_Name --
941 ----------------------------
942
943 function Is_Locking_Policy_Name (N : Name_Id) return Boolean is
944 begin
945 return N in First_Locking_Policy_Name .. Last_Locking_Policy_Name;
946 end Is_Locking_Policy_Name;
947
948 -----------------------------
949 -- Is_Operator_Symbol_Name --
950 -----------------------------
951
952 function Is_Operator_Symbol_Name (N : Name_Id) return Boolean is
953 begin
954 return N in First_Operator_Name .. Last_Operator_Name;
955 end Is_Operator_Symbol_Name;
956
957 --------------------
958 -- Is_Pragma_Name --
959 --------------------
960
961 function Is_Pragma_Name (N : Name_Id) return Boolean is
962 begin
963 return N in First_Pragma_Name .. Last_Pragma_Name
964 or else N = Name_AST_Entry
965 or else N = Name_Storage_Size
966 or else N = Name_Storage_Unit;
967 end Is_Pragma_Name;
968
969 ---------------------------------
970 -- Is_Procedure_Attribute_Name --
971 ---------------------------------
972
973 function Is_Procedure_Attribute_Name (N : Name_Id) return Boolean is
974 begin
975 return N in First_Procedure_Attribute .. Last_Procedure_Attribute;
976 end Is_Procedure_Attribute_Name;
977
978 ----------------------------
979 -- Is_Queuing_Policy_Name --
980 ----------------------------
981
982 function Is_Queuing_Policy_Name (N : Name_Id) return Boolean is
983 begin
984 return N in First_Queuing_Policy_Name .. Last_Queuing_Policy_Name;
985 end Is_Queuing_Policy_Name;
986
987 -------------------------------------
988 -- Is_Task_Dispatching_Policy_Name --
989 -------------------------------------
990
991 function Is_Task_Dispatching_Policy_Name (N : Name_Id) return Boolean is
992 begin
993 return N in First_Task_Dispatching_Policy_Name ..
994 Last_Task_Dispatching_Policy_Name;
995 end Is_Task_Dispatching_Policy_Name;
996
997 ----------------------------
998 -- Is_Type_Attribute_Name --
999 ----------------------------
1000
1001 function Is_Type_Attribute_Name (N : Name_Id) return Boolean is
1002 begin
1003 return N in First_Type_Attribute_Name .. Last_Type_Attribute_Name;
1004 end Is_Type_Attribute_Name;
1005
1006 ----------------------------------
1007 -- Record_Convention_Identifier --
1008 ----------------------------------
1009
1010 procedure Record_Convention_Identifier
1011 (Id : Name_Id;
1012 Convention : Convention_Id)
1013 is
1014 begin
1015 Convention_Identifiers.Append ((Id, Convention));
1016 end Record_Convention_Identifier;
1017
1018 end Snames;