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