

Public Methods | |
| const cmt_string& | build (const Symbol& symbol, const cmt_string& tag_name = "") |
| const cmt_string& | clean (const Symbol& symbol, const cmt_string& tag_name = "") |
Private Attributes | |
| cmt_string | temp |
|
|
Reimplemented from ValueBuilder. Definition at line 1552 of file cmt_symbol.cxx. 01554 {
01555 int show_it = 0;
01556
01557 static cmt_string previous_temp;
01558 cmt_string new_value;
01559 static const cmt_string empty;
01560
01561 static cmt_string path_separator = CmtSystem::path_separator ();
01562
01563 if (Cmt::get_action () == action_show_set)
01564 {
01565 if (symbol.name == Cmt::get_current_target ())
01566 {
01567 show_it = 1;
01568 }
01569 }
01570
01571 temp = CmtSystem::getenv (symbol.name);
01572
01573 for (int i = 0; i < symbol.value_lists.size (); i++)
01574 {
01575 const SymbolValueList& value_list = symbol.value_lists[i];
01576
01577 if (value_list.discarded) continue;
01578
01579 if ((value_list.use != 0) &&
01580 (value_list.use->discarded)) continue;
01581
01582 const int selected = value_list.select_first ();
01583
01584 if (selected < 0) continue;
01585
01586 SymbolValue& value = value_list.values[selected];
01587
01588 if (show_it)
01589 {
01590 cout << "# Package ";
01591 if (value_list.use != 0)
01592 {
01593 cout << value_list.use->package << " " << value_list.use->version;
01594 }
01595 }
01596
01597 new_value = value.text;
01598
01599 //resolve_value (new_value);
01600 resolve_value_for_macros (new_value);
01601
01602 switch (value_list.command_type)
01603 {
01604 case CommandPath :
01605
01606 if (show_it)
01607 {
01608 cout << " defines path " << symbol.name << " as ";
01609 }
01610
01611 if (!value_list.is_reflexive ||
01612 !symbol.value_is_reflexive (value.text))
01613 {
01614 resolve_value (new_value, symbol.name, temp);
01615 temp = new_value;
01616 }
01617
01618 break;
01619 case CommandPathAppend :
01620
01621 if (show_it)
01622 {
01623 cout << " appends to path " << symbol.name << " : ";
01624 }
01625
01626 if (new_value != "")
01627 {
01628 if (!find_path_entry (temp, new_value))
01629 {
01630 if (temp != "") temp += path_separator;
01631
01632 temp += new_value;
01633 }
01634 }
01635
01636 break;
01637 case CommandPathPrepend :
01638
01639 if (show_it)
01640 {
01641 cout << " prepends to path " << symbol.name << " : ";
01642 }
01643
01644 if (new_value != "")
01645 {
01646 if (!find_path_entry (temp, new_value))
01647 {
01648 previous_temp = temp;
01649 temp = new_value;
01650 if (previous_temp != "") temp += path_separator;
01651 temp += previous_temp;
01652 }
01653 }
01654
01655 break;
01656 case CommandPathRemove :
01657
01658 if (show_it)
01659 {
01660 cout << " removes from path " << symbol.name << " : ";
01661 }
01662
01663 if (new_value != "")
01664 {
01665 static CmtSystem::cmt_string_vector paths;
01666
01667 CmtSystem::split (temp, path_separator, paths);
01668
01669 for (int j = 0; j < paths.size (); ++j)
01670 {
01671 cmt_string& s = paths[j];
01672
01673 if (s.find (new_value) != cmt_string::npos)
01674 {
01675 s = "";
01676 }
01677 }
01678
01679 Cmt::vector_to_string (paths, path_separator, temp);
01680 temp.replace_all ("::", ":");
01681 temp.replace_all (";;", ";");
01682 }
01683
01684 break;
01685 }
01686
01687 if (show_it)
01688 {
01689 cout << "'" << value.text << "'";
01690
01691 Tag* selected_tag = value.tag;
01692
01693 if ((selected_tag == 0) ||
01694 (selected_tag == Tag::get_default ()))
01695 {
01696 cout << " for default tag";
01697 }
01698 else
01699 {
01700 cout << " for tag '" << selected_tag->name << "'";
01701 }
01702
01703 cout << endl;
01704 }
01705 }
01706
01707 return (temp);
01708 }
|
|
|
Reimplemented from ValueBuilder. Definition at line 1711 of file cmt_symbol.cxx. 01713 {
01714 int show_it = 0;
01715
01716 static cmt_string previous_temp;
01717 cmt_string new_value;
01718 static const cmt_string empty;
01719
01720 static cmt_string path_separator = CmtSystem::path_separator ();
01721
01722 temp = CmtSystem::getenv (symbol.name);
01723
01724 //cerr << "#####1 temp=" << temp << endl;
01725
01726 for (int i = 0; i < symbol.value_lists.size (); i++)
01727 {
01728 const SymbolValueList& value_list = symbol.value_lists[i];
01729
01730 if (value_list.discarded) continue;
01731
01732 if ((value_list.use != 0) &&
01733 (value_list.use->discarded)) continue;
01734
01735 const int selected = value_list.select_first ();
01736
01737 if (selected < 0) continue;
01738
01739 SymbolValue& value = value_list.values[selected];
01740
01741 new_value = value.text;
01742
01743 //resolve_value (new_value);
01744
01745 //cerr << "#####1 new_value=" << new_value << endl;
01746
01747 resolve_value_for_macros (new_value);
01748 resolve_value (new_value);
01749
01750 //cerr << "#####2 new_value=" << new_value << endl;
01751
01752 switch (value_list.command_type)
01753 {
01754 case CommandPath :
01755
01756 temp = "";
01757
01758 break;
01759 case CommandPathAppend :
01760 case CommandPathPrepend :
01761 case CommandPathRemove :
01762
01763 if (new_value != "")
01764 {
01765 static CmtSystem::cmt_string_vector paths;
01766
01767 CmtSystem::split (temp, path_separator, paths);
01768
01769 for (int j = 0; j < paths.size (); ++j)
01770 {
01771 cmt_string& s = paths[j];
01772
01773 if (s.find (new_value) != cmt_string::npos)
01774 {
01775 s = "";
01776 }
01777
01778 if (j > 0)
01779 {
01780 cmt_string& s2 = paths[j-1];
01781 if (s2 == s)
01782 {
01783 s2 = "";
01784 }
01785 }
01786 }
01787
01788 Cmt::vector_to_string (paths, path_separator, temp);
01789 temp.replace_all ("::", ":");
01790 temp.replace_all (";;", ";");
01791 }
01792
01793 break;
01794 }
01795 }
01796
01797 //cerr << "#####2 temp=" << temp << endl;
01798
01799 return (temp);
01800 }
|
|
|
Definition at line 39 of file cmt_symbol.cxx. |
1.2.3 written by Dimitri van Heesch,
© 1997-2000