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