Changeset 427
- Timestamp:
- Sep 1, 2007, 11:54:25 AM (17 years ago)
- Location:
- CMT/HEAD
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/ChangeLog
r424 r427 1 2007-09-01 <rybkin@lal.in2p3.fr> 333 2 3 * source/cmt_deps_builder.h: idem 4 * source/cmt_deps_builder.cxx: idem 5 * source/cmt_generators.h: idem 6 * source/cmt_generators.cxx: Implement a header file filter mechanism to replace 7 header files matching a pattern with a stamp file when calculating files dependencies 8 1 9 2007-07-09 <rybkin@lal.in2p3.fr> 332 2 10 -
CMT/HEAD/mgr/cmt_dependencies.make
r424 r427 2 2 cmt_awk_cxx_dependencies = ../source/cmt_awk.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_regexp.h ../source/cmt_awk.h ../source/cmt_vector.h ../source/cmt_system.h 3 3 cmt_branch_cxx_dependencies = ../source/cmt_branch.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_branch.h ../source/cmt_fragment.h ../source/cmt_group.h ../source/cmt_constituent.h ../source/cmt_language.h ../source/cmt_map.h ../source/cmt_pattern.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_awk.h ../source/cmt_project.h ../source/cmt_cmtpath_pattern.h ../source/cmt_database.h 4 cmt_constituent_cxx_dependencies = ../source/cmt_constituent.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_fragment.h ../source/cmt_group.h ../source/cmt_constituent.h ../source/cmt_language.h ../source/cmt_awk.h ../source/cmt_ deps_builder.h ../source/cmt_generator.h ../source/cmt_branch.h ../source/cmt_map.h ../source/cmt_pattern.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_project.h ../source/cmt_cmtpath_pattern.h ../source/cmt_database.h5 cmt_deps_builder_cxx_dependencies = ../source/cmt_deps_builder.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_parser.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_ deps_builder.h ../source/cmt_map.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_pattern.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_log.h4 cmt_constituent_cxx_dependencies = ../source/cmt_constituent.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_fragment.h ../source/cmt_group.h ../source/cmt_constituent.h ../source/cmt_language.h ../source/cmt_awk.h ../source/cmt_map.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_pattern.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_deps_builder.h ../source/cmt_generator.h ../source/cmt_branch.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_project.h ../source/cmt_cmtpath_pattern.h ../source/cmt_database.h 5 cmt_deps_builder_cxx_dependencies = ../source/cmt_deps_builder.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_parser.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_map.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_pattern.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_deps_builder.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_log.h 6 6 cmt_fragment_cxx_dependencies = ../source/cmt_fragment.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_fragment.h ../source/cmt_map.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_pattern.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_branch.h ../source/cmt_group.h ../source/cmt_constituent.h ../source/cmt_language.h ../source/cmt_awk.h ../source/cmt_project.h ../source/cmt_cmtpath_pattern.h ../source/cmt_database.h 7 cmt_generator_cxx_dependencies = ../source/cmt_generator.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_fragment.h ../source/cmt_group.h ../source/cmt_constituent.h ../source/cmt_language.h ../source/cmt_awk.h ../source/cmt_ deps_builder.h ../source/cmt_generator.h ../source/cmt_map.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_pattern.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_generators.h7 cmt_generator_cxx_dependencies = ../source/cmt_generator.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_fragment.h ../source/cmt_group.h ../source/cmt_constituent.h ../source/cmt_language.h ../source/cmt_awk.h ../source/cmt_map.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_pattern.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_deps_builder.h ../source/cmt_generator.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_generators.h 8 8 cmt_include_cxx_dependencies = ../source/cmt_include.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_include.h ../source/cmt_map.h ../source/cmt_script.h ../source/cmt_pattern.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_log.h 9 9 cmt_parser_cxx_dependencies = ../source/cmt_parser.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_version.h ../source/cmt_branch.h ../source/cmt_fragment.h ../source/cmt_group.h ../source/cmt_constituent.h ../source/cmt_language.h ../source/cmt_map.h ../source/cmt_pattern.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_awk.h ../source/cmt_project.h ../source/cmt_cmtpath_pattern.h ../source/cmt_database.h ../source/cmt_deps_builder.h ../source/cmt_generator.h ../source/cmt_error.h ../source/cmt_cvs.h ../source/cmt_lock.h ../source/cmt_triggers.h ../source/cmt_model.h ../source/cmt_syntax.h ../source/cmt_install_area.h ../source/cmt_sequence.h ../source/cmt_log.h ../source/cmt_commands.h … … 29 29 cmt_cmtpath_pattern_cxx_dependencies = ../source/cmt_cmtpath_pattern.cxx ../source/cmt_vector.h ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_branch.h ../source/cmt_fragment.h ../source/cmt_group.h ../source/cmt_constituent.h ../source/cmt_language.h ../source/cmt_map.h ../source/cmt_pattern.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_awk.h ../source/cmt_project.h ../source/cmt_cmtpath_pattern.h ../source/cmt_database.h ../source/cmt_syntax.h 30 30 cmt_sequence_cxx_dependencies = ../source/cmt_sequence.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_regexp.h ../source/cmt_awk.h ../source/cmt_sequence.h ../source/cmt_vector.h ../source/cmt_system.h 31 cmt_generators_cxx_dependencies = ../source/cmt_generators.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_fragment.h ../source/cmt_group.h ../source/cmt_constituent.h ../source/cmt_language.h ../source/cmt_awk.h ../source/cmt_ deps_builder.h ../source/cmt_generator.h ../source/cmt_generators.h ../source/cmt_map.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_pattern.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_log.h31 cmt_generators_cxx_dependencies = ../source/cmt_generators.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_fragment.h ../source/cmt_group.h ../source/cmt_constituent.h ../source/cmt_language.h ../source/cmt_awk.h ../source/cmt_map.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_pattern.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_deps_builder.h ../source/cmt_generator.h ../source/cmt_generators.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_log.h 32 32 cmt_scope_section_cxx_dependencies = ../source/cmt_scope_section.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_scope_section.h 33 33 cmt_log_cxx_dependencies = ../source/cmt_log.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_log.h ../source/cmt_vector.h ../source/cmt_parser.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h -
CMT/HEAD/source/cmt_deps_builder.cxx
r424 r427 30 30 31 31 //-------------------------------------------------- 32 static int build_deps (const cmt_string& name, 33 const cmt_string& dir_name, 34 int current_path_index, 35 const CmtSystem::cmt_string_vector& include_paths, 36 const CmtSystem::cmt_string_vector& substitutions, 37 CmtSystem::cmt_string_vector& all_deps, 38 CmtSystem::cmt_string_vector& deps); 39 32 static int locate (const cmt_string& name, 33 const cmt_string& dir_name, 34 const CmtSystem::cmt_string_vector& include_paths, 35 const CmtSystem::cmt_string_vector& substitutions, 36 cmt_string& full_name); 37 38 //-------------------------------------------------- 39 static void build_deps_text (char* text, 40 const cmt_string& dir_name, 41 int current_path_index, 42 const CmtSystem::cmt_string_vector& include_paths, 43 const CmtSystem::cmt_string_vector& substitutions, 44 const DepsBuilder::HeaderFilters& header_filters, 45 CmtSystem::cmt_string_vector& all_deps, 46 CmtSystem::cmt_string_vector& deps); 40 47 41 48 //-------------------------------------------------- … … 45 52 const CmtSystem::cmt_string_vector& include_paths, 46 53 const CmtSystem::cmt_string_vector& substitutions, 54 const DepsBuilder::HeaderFilters& header_filters, 47 55 CmtSystem::cmt_string_vector& all_deps, 48 56 CmtSystem::cmt_string_vector& deps) … … 50 58 Log; 51 59 52 bool found = false;53 54 60 for (int i = 0; i < all_deps.size (); i++) 55 61 { … … 58 64 log << "CMT> check old header file name=" << n << " against " << header_file << log_endl; 59 65 60 if (n == header_file) 61 { 62 found = true; 63 break; 64 } 65 } 66 67 if (!found) 68 { 69 log << "CMT> parsing new header file name=" << header_file << log_endl; 70 71 all_deps.push_back (header_file); 66 if (n == header_file) return; 67 } 68 69 all_deps.push_back (header_file); 70 71 cmt_string header_file_path; 72 int path_index = locate (header_file, 73 dir_name, 74 include_paths, 75 substitutions, 76 header_file_path); 77 78 if (path_index < 0) return; 79 80 static int header_filters_size = header_filters.size (); 81 if (header_filters_size > 0) 82 { 83 // check the filter macros from 84 // find all macros named <package>_header_file_filter 85 // for all those macros, get the regexp and check the matches against the header file name 86 // if any match, select the stamp file instead of the header file 87 // the stamp file might be either a conventional name 88 // <package>/cmt/cmt_all_headers.stamp 89 // or given in a macro eg <package>_header_stamp_file_name 90 // 91 for (int i = header_filters_size - 1; i >= 0; i--) 92 { 93 cmt_string stamp_file; 94 if (header_filters[i].use_stamp (header_file_path, stamp_file)) 95 { 96 bool included = false; 97 for (int i = deps.size () - 1; i >= 0; i--) 98 { 99 if (deps[i] == stamp_file) 100 { 101 included = true; 102 break; 103 } 104 } 105 if (!included) deps.push_back (stamp_file); 106 return; 107 } 108 } 109 } 110 111 log << "CMT> parsing new header file name=" << header_file << log_endl; 112 113 /////////////////////////////////////////////////////////////////////////////////////////////////////// 114 cmt_string text; 115 text.read (header_file_path); 116 char* ptr = &text[0]; 117 cmt_string new_dir; 118 CmtSystem::dirname (header_file_path, new_dir); 119 120 if (path_index == 0 || path_index == 1) 121 build_deps_text (ptr, new_dir, 122 current_path_index, 123 include_paths, substitutions, 124 header_filters, 125 all_deps, deps); 126 else 127 build_deps_text (ptr, new_dir, 128 path_index, 129 include_paths, substitutions, 130 header_filters, 131 all_deps, deps); 132 /////////////////////////////////////////////////////////////////////////////////////////////////////// 72 133 73 int path_index = build_deps (header_file, 74 dir_name, 75 current_path_index, 76 include_paths, 77 substitutions, 78 all_deps, 79 deps); 80 81 if (path_index >= 0) 82 { 83 cmt_string full_name; 84 85 if (path_index == 1) 86 { 87 full_name = dir_name; 88 full_name += CmtSystem::file_separator (); 89 90 if (current_path_index >= 2) 91 { 92 full_name.replace (include_paths[current_path_index - 2], 93 substitutions[current_path_index - 2]); 94 } 95 } 96 else if (path_index > 1) 97 { 98 full_name = substitutions[path_index - 2]; 99 full_name += CmtSystem::file_separator (); 100 } 101 102 full_name += header_file; 103 104 deps.push_back (full_name); 105 } 106 } 134 //path_index >= 0 135 136 cmt_string full_name; 137 138 if (path_index == 1) 139 { 140 full_name = dir_name; 141 full_name += CmtSystem::file_separator (); 142 143 if (current_path_index >= 2) 144 { 145 full_name.replace (include_paths[current_path_index - 2], 146 substitutions[current_path_index - 2]); 147 } 148 } 149 else if (path_index > 1) 150 { 151 full_name = substitutions[path_index - 2]; 152 full_name += CmtSystem::file_separator (); 153 } 154 155 full_name += header_file; 156 157 deps.push_back (full_name); 107 158 } 108 159 … … 115 166 const CmtSystem::cmt_string_vector& include_paths, 116 167 const CmtSystem::cmt_string_vector& substitutions, 168 const DepsBuilder::HeaderFilters& header_filters, 117 169 CmtSystem::cmt_string_vector& all_deps, 118 170 CmtSystem::cmt_string_vector& deps) … … 229 281 include_paths, 230 282 substitutions, 283 header_filters, 231 284 all_deps, 232 285 deps); … … 470 523 const CmtSystem::cmt_string_vector& include_paths, 471 524 const CmtSystem::cmt_string_vector& substitutions, 525 const DepsBuilder::HeaderFilters& header_filters, 472 526 CmtSystem::cmt_string_vector& all_deps, 473 527 CmtSystem::cmt_string_vector& deps) … … 481 535 log << "CMT> build_deps_text dir_name=" 482 536 << dir_name << log_endl; 483 484 537 485 538 // erase of continuation character … … 487 540 max_pos = strlen (text); 488 541 char* current = text; 542 489 543 char* last = text + max_pos; 490 544 while (current < last) 491 545 { 492 546 493 char* crnl = strstr (current, "\\\r\n"); 494 char* nl = strstr (current, "\\\n"); 547 // bscrnl -> BackSlash Carriage Return New Line 548 // bsnl -> BackSlash New Line 549 char* bscrnl = strstr (current, "\\\r\n"); 550 char* bsnl = strstr (current, "\\\n"); 495 551 496 if ( ( crnl==0) && (nl ==0)) break;552 if ( (bscrnl==0) && (bsnl ==0)) break; 497 553 498 554 int length = 0; 499 555 500 556 char * ptr = 0; 501 if ( nl==0) //crnl > 0557 if (bsnl==0) //bscrnl > 0 502 558 { 503 559 length = 3; 504 ptr = crnl;560 ptr = bscrnl; 505 561 } 506 else if ( crnl==0) //nl > 0562 else if (bscrnl==0) //bsnl > 0 507 563 { 508 564 length = 2; 509 ptr = nl;565 ptr = bsnl; 510 566 } 511 else if ( crnl <nl)567 else if (bscrnl < bsnl) 512 568 { 513 569 length = 3; 514 ptr = crnl;570 ptr = bscrnl; 515 571 } 516 else // ( crnl >nl)572 else // (bscrnl > bsnl) 517 573 { 518 574 length = 2; 519 ptr = nl;575 ptr = bsnl; 520 576 } 521 577 strcpy (ptr, ptr+length); … … 538 594 char* marker_pos = 0; 539 595 596 // crnl -> Carriage Return New Line 597 // nl -> New Line 540 598 char* crnl = strstr (current, "\r\n"); 541 599 char* nl = strchr (current, '\n'); … … 598 656 include_paths, 599 657 substitutions, 658 header_filters, 600 659 all_deps, 601 660 deps); … … 647 706 const CmtSystem::cmt_string_vector& include_paths, 648 707 const CmtSystem::cmt_string_vector& substitutions, 708 const DepsBuilder::HeaderFilters& header_filters, 649 709 CmtSystem::cmt_string_vector& all_deps, 650 710 CmtSystem::cmt_string_vector& deps) … … 652 712 Log; 653 713 654 int result = -1;655 cmt_string new_dir;656 657 714 log << "CMT> build_deps name=" << name << " dir_name=" 715 << dir_name << log_endl; 716 717 cmt_string full_name; 718 int path_index = locate (name, 719 dir_name, 720 include_paths, 721 substitutions, 722 full_name); 723 724 if (path_index >= 0) 725 { 726 cmt_string text; 727 text.read (full_name); 728 char* ptr = &text[0]; 729 cmt_string new_dir; 730 CmtSystem::dirname (full_name, new_dir); 731 732 if (path_index == 0 || path_index == 1) 733 build_deps_text (ptr, new_dir, 734 current_path_index, 735 include_paths, substitutions, 736 header_filters, 737 all_deps, deps); 738 else 739 build_deps_text (ptr, new_dir, 740 path_index, 741 include_paths, substitutions, 742 header_filters, 743 all_deps, deps); 744 } 745 if (path_index < 0) 746 { 747 log << "CMT> build_deps3" << log_endl; 748 } 749 return path_index; 750 } 751 752 //-------------------------------------------------- 753 static int locate (const cmt_string& name, 754 const cmt_string& dir_name, 755 const CmtSystem::cmt_string_vector& include_paths, 756 const CmtSystem::cmt_string_vector& substitutions, 757 cmt_string& full_name) 758 { 759 Log; 760 761 log << "CMT> locate name=" << name << " dir_name=" 658 762 << dir_name << log_endl; 659 763 … … 663 767 if (CmtSystem::test_file (name)) 664 768 { 665 cmt_string text; 666 667 text.read (name); 668 669 char* ptr = &text[0]; 670 CmtSystem::dirname (name, new_dir); 671 672 build_deps_text (ptr, new_dir, current_path_index, 673 include_paths, substitutions, 674 all_deps, deps); 769 full_name = name; 675 770 return (0); 676 771 } 677 772 678 cmt_string full_name; 679 680 full_name = dir_name; 681 full_name += CmtSystem::file_separator (); 682 full_name += name; 773 cmt_string p; 683 774 684 775 // … … 686 777 // upper level source file 687 778 // 688 if (CmtSystem::test_file (full_name)) 689 { 690 cmt_string text; 691 692 text.read (full_name); 693 694 char* ptr = &text[0]; 695 CmtSystem::dirname (full_name, new_dir); 696 697 build_deps_text (ptr, new_dir, current_path_index, 698 include_paths, substitutions, 699 all_deps, deps); 779 p = dir_name; 780 p += CmtSystem::file_separator (); 781 p += name; 782 if (CmtSystem::test_file (p)) 783 { 784 full_name = p; 700 785 return (1); 701 786 } 702 703 int path_index = -1;704 787 705 788 // … … 707 790 // the include_paths 708 791 // 709 for (path_index = 0; path_index < include_paths.size (); path_index++) 710 { 711 full_name = include_paths[path_index]; 712 full_name += CmtSystem::file_separator (); 713 full_name += name; 714 715 log << "CMT> build_deps2 full_name=" << full_name << log_endl; 716 717 if (CmtSystem::test_file (full_name)) 718 { 719 cmt_string text; 720 721 text.read (full_name); 722 723 char* ptr = &text[0]; 724 CmtSystem::dirname (full_name, new_dir); 725 726 log << "CMT> build_deps3 new_dir=" << new_dir << log_endl; 727 728 build_deps_text (ptr, 729 new_dir, 730 path_index + 2, 731 include_paths, 732 substitutions, 733 all_deps, 734 deps); 735 792 for (int path_index = 0; path_index < include_paths.size (); path_index++) 793 { 794 p = include_paths[path_index]; 795 p += CmtSystem::file_separator (); 796 p += name; 797 798 log << "CMT> locate2 full_name=" << p << log_endl; 799 800 if (CmtSystem::test_file (p)) 801 { 802 full_name = p; 736 803 return (path_index + 2); 737 804 } 738 805 } 739 806 740 log << "CMT> build_deps3" << log_endl;807 log << "CMT> locate3" << log_endl; 741 808 742 809 return (-1); … … 748 815 m_include_paths.clear (); 749 816 m_substitutions.clear (); 817 for (int i = m_header_filters.size () - 1; i >= 0; i--) 818 { 819 m_header_filters[i].clear (); 820 } 821 m_header_filters.clear (); 750 822 } 751 823 … … 753 825 void DepsBuilder::add (const cmt_string& path, const cmt_string& substitution) 754 826 { 827 if (path.size () == 0) 828 { 829 return; 830 } 755 831 if (path[path.size () - 1] == CmtSystem::file_separator ()) 756 832 { … … 849 925 log << "Starting deps builder on " << file_name << log_endl; 850 926 851 852 927 m_deps.clear (); 853 928 m_all_deps.clear (); … … 875 950 m_include_paths, 876 951 m_substitutions, 952 m_header_filters, 877 953 m_all_deps, 878 954 m_deps); … … 964 1040 } 965 1041 1042 //-------------------------------------------------------------------------- 1043 void DepsBuilder::add_header_filter (const Use* use, const cmt_regexp* filter, const cmt_string& stamp) 1044 { 1045 add_header_filter (HeaderFilter (use, filter, stamp)); 1046 } 1047 1048 //-------------------------------------------------------------------------- 1049 void DepsBuilder::add_header_filter (const HeaderFilter& hf) 1050 { 1051 m_header_filters.push_back (hf); 1052 } -
CMT/HEAD/source/cmt_deps_builder.h
r11 r427 10 10 #include "cmt.h" 11 11 #include "cmt_system.h" 12 #include "cmt_use.h" 12 13 13 14 class DepsBuilder … … 15 16 public: 16 17 18 class HeaderFilter 19 { 20 public: 21 22 HeaderFilter () 23 : m_use (0), m_filter (0) { } 24 25 HeaderFilter (const Use* use, const cmt_regexp* filter, const cmt_string& stamp) 26 : m_use (use), m_filter (filter), m_stamp (stamp) { } 27 28 ~HeaderFilter () 29 { } 30 31 inline const Use* use () const 32 { return m_use; } 33 34 inline bool use_stamp (const cmt_string& header, cmt_string& stamp) const 35 { return m_filter->match (header) ? stamp = m_stamp, true : false ; } 36 37 void clear () 38 { 39 m_use = 0; 40 if (m_filter) delete m_filter; 41 m_filter = 0; 42 m_stamp = cmt_string (); 43 } 44 45 private: 46 47 const Use* m_use; 48 const cmt_regexp* m_filter; 49 cmt_string m_stamp; 50 }; 51 52 typedef cmt_vector<HeaderFilter> HeaderFilters; 53 17 54 void clear (); 18 55 void add (const cmt_string& path, const cmt_string& substitution); 19 56 void add_includes (const Use& use); 57 void add_header_filter (const Use* use, const cmt_regexp* filter, const cmt_string& stamp); 58 void add_header_filter (const HeaderFilter& hf); 20 59 CmtSystem::cmt_string_vector& run (const cmt_string& file_name); 60 61 DepsBuilder () 62 { } 21 63 22 64 private: 23 65 66 DepsBuilder (const DepsBuilder&) 67 { } 68 24 69 CmtSystem::cmt_string_vector m_include_paths; 25 70 CmtSystem::cmt_string_vector m_substitutions; 71 HeaderFilters m_header_filters; 26 72 27 73 CmtSystem::cmt_string_vector m_deps; -
CMT/HEAD/source/cmt_generators.cxx
r400 r427 2619 2619 }; 2620 2620 2621 2622 2621 void DependencyGenerator::build (const CmtSystem::cmt_string_vector& arguments) 2623 2622 { 2624 2623 reset (); 2625 2624 prepare_use_context (); 2625 2626 prepare_header_file_filters (); 2626 2627 2627 2628 m_stamps = true; … … 2841 2842 fclose (f); 2842 2843 } 2844 2845 // m_deps_builder.clear (); 2843 2846 } 2844 2847 … … 2998 3001 } 2999 3002 3003 //-------------------------------------------------- 3004 void DependencyGenerator::prepare_header_file_filters () 3005 { 3006 Use::UsePtrVector& uses = Use::get_ordered_uses (); 3007 uses.push_back (&Use::current ()); 3008 for (int i = uses.size () - 1; i >= 0; i--) 3009 { 3010 Use* use = uses[i]; 3011 if (use->discarded) continue; 3012 if (use->m_hidden) continue; 3013 if (!use->located ()) continue; 3014 3015 cmt_string package_name = use->get_package_name (); 3016 if (package_name == "CMT") continue; 3017 3018 Symbol* filter_macro = Symbol::find (package_name + "_header_file_filter"); 3019 if (filter_macro == 0) continue; 3020 3021 Symbol* stamp_macro = Symbol::find (package_name + "_header_file_stamp"); 3022 cmt_string stamp; 3023 if (stamp_macro != 0) 3024 { 3025 stamp = stamp_macro->resolve_macro_value (); 3026 } 3027 else 3028 { 3029 use->get_full_path (stamp); 3030 stamp += CmtSystem::file_separator (); 3031 if (use->style == mgr_style) stamp += "mgr"; 3032 else stamp += "cmt"; 3033 stamp += CmtSystem::file_separator (); 3034 stamp += "cmt_header_file.stamp"; 3035 //stamp += "cmt_all_headers.stamp"; 3036 //<package>/cmt/cmt_all_headers.stamp 3037 } 3038 if (!CmtSystem::test_file (stamp)) continue; 3039 3040 cmt_regexp* filter = new cmt_regexp (filter_macro->resolve_macro_value ()); 3041 assert (filter != 0); 3042 3043 m_deps_builder.add_header_filter (use, filter, stamp); 3044 } 3045 } -
CMT/HEAD/source/cmt_generators.h
r197 r427 213 213 public: 214 214 void build (const CmtSystem::cmt_string_vector& arguments); 215 215 void prepare_header_file_filters (); 216 216 217 private: 217 218 void add_line_to_text (const cmt_string& line, cmt_string& text);
Note: See TracChangeset
for help on using the changeset viewer.