Changeset 549 for CMT/HEAD


Ignore:
Timestamp:
Aug 12, 2010, 10:45:31 AM (14 years ago)
Author:
rybkin
Message:

See C.L. 434

Location:
CMT/HEAD
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/ChangeLog

    r548 r549  
     12010-08-12    <rybkin@lal.in2p3.fr> 434
     2
     3        * source/cmt_commands.h: Introduce option -requirements for command
     4        "cmt setup" to generate standalone requirements file from which generate
     5        setup script. In class ArgParser, introduce function option_requirements
     6        * source/cmt_commands.cxx: Implement function option_requirements
     7        * source/cmt_parser.h: Introduce PrintMode Requirements
     8        * source/cmt_parser.cxx: In class Cmt functions print and print_context,
     9        add case for mode Requirements, former also prints all active tags, latter
     10        prints PACKAGEROOT and PACKAGECONFIG as sets. In class Cmt function
     11        do_show_macro, do not set error wrong_symbol_type for macros or sets with
     12        name of form NAMEROOT. In class StandardMacroBuilder function
     13        fill_for_branches, for standalone package case, do not override basic
     14        macros (srcdir, src, inc, doc, bin, BIN, javabin, mgr) if they are defined
     15        in requirements, similar to standard cmt package case
     16        * source/cmt_tag.h: In class Tag functions show_definition, show, add
     17        optional argument prefix
     18        * source/cmt_tag.cxx: Implement added optional argument
     19        * source/cmt_symbol.h: In class SymbolValueList, introduce function print,
     20        in class ValueBuilder, introduce function print, in class Symbol, introduce
     21        function print_macro, and member printed
     22        * source/cmt_symbol.cxx: Implement introduced functions, in class Symbol
     23        function all_print, add case for mode Requirements which also deals with
     24        macros and invokes print_macro
     25       
    1262010-08-04    <rybkin@lal.in2p3.fr> 433
    227
  • CMT/HEAD/source/cmt_commands.cxx

    r547 r549  
    279279  pv.push_back (&ArgParser::option_public); i++;
    280280
     281  parsers.add ("-cmt", i);
     282  parsers.add ("-req", i);
     283  parsers.add ("-requ", i);
     284  parsers.add ("-requi", i);
     285  parsers.add ("-requir", i);
     286  parsers.add ("-require", i);
     287  parsers.add ("-requirem", i);
     288  parsers.add ("-requireme", i);
     289  parsers.add ("-requiremen", i);
     290  parsers.add ("-requirement", i);
     291  parsers.add ("-requirements", i);
     292  pv.push_back (&ArgParser::option_requirements); i++;
     293
    281294  parsers.add ("-s", i);
    282295  parsers.add ("-sh", i);
     
    17551768{
    17561769  mode = Bat;
     1770}
     1771
     1772void ArgParser::option_requirements ()
     1773{
     1774  mode = Requirements;
    17571775}
    17581776
     
    23102328  help_texts.add () =  "set version <version>   : generate a version file in the current package";
    23112329  help_texts.add () =  "set versions            : generate version files into packages";
    2312   help_texts.add () =  "setup [-csh|-sh|-bat]   : generate a setup script";
     2330  help_texts.add () =  "setup [-csh|-sh|-bat|-cmt|-requirements] : generate a setup script (or standalone requirements file from which generate the setup script)";
    23132331  help_texts.add () =  "show <option>           : query actions. (Try cmt help show)";
    23142332  help_texts.add () =  "show  action <name>     :  a formatted action definition";
  • CMT/HEAD/source/cmt_commands.h

    r282 r549  
    6868  void option_sh ();
    6969  void option_bat ();
     70  void option_requirements ();
    7071  void option_use ();
    7172  void option_pack ();
  • CMT/HEAD/source/cmt_parser.cxx

    r547 r549  
    43844384
    43854385//----------------------------------------------------------
     4386static bool is_upperroot (const cmt_string& name)
     4387{
     4388  int r = name.find_last_of ("ROOT");
     4389  if (r == cmt_string::npos ||
     4390      (r + 4) != name.size () ||
     4391      r == 0)
     4392    return false;
     4393  for (int i = 0; i < r; i++)
     4394    if (islower (name[i])) return false;
     4395  return true;
     4396}
     4397
     4398//----------------------------------------------------------
    43864399void Cmt::do_show_macro (const ArgParser& ap)
    43874400{
     
    44334446                }
    44344447
    4435               CmtError::set (CmtError::wrong_symbol_type, t);
     4448              if (!is_upperroot (symbol->name))
     4449                CmtError::set (CmtError::wrong_symbol_type, t);
    44364450            }
    44374451        }
     
    44464460              t += "macro";
    44474461
    4448               CmtError::set (CmtError::wrong_symbol_type, t);
     4462              if (!is_upperroot (symbol->name))
     4463                CmtError::set (CmtError::wrong_symbol_type, t);
    44494464            }
    44504465        }
     
    70597074  }
    70607075
     7076  if (mode == Requirements)
     7077    {
     7078      //do_show_tags (ap, cout);
     7079      Tag::TagPtrVector tags = Tag::tags ();
     7080      for (int index = 0; index < tags.size (); index++)
     7081        {
     7082          const Tag* tag = tags[index];
     7083          if (tag != 0)
     7084            {
     7085              tag->show (true, cout, "apply_tag ");
     7086            }
     7087        }
     7088    }
     7089
    70617090  if (Me.m_debug)
    70627091    {
     
    71637192            case Bat :
    71647193              cout << "set " << use->prefix << "ROOT=" << endl;
    7165               cout << "set " << use->prefix << "CONFIG" << endl;
     7194              cout << "set " << use->prefix << "CONFIG=" << endl;
    71667195              break;
    71677196            }
     
    72617290            {
    72627291              cout << "set " << use.prefix << "CONFIG=" << tag << endl;
     7292            }
     7293        }
     7294       
     7295      break;
     7296    case Requirements :
     7297      if (do_root &&
     7298          use.get_package_name () != "CMT")
     7299        {
     7300          cout << "set " << use.prefix << "ROOT \"" <<
     7301            use.get_full_path () << "\"" << endl;
     7302
     7303          cmt_string name (use.prefix + "ROOT");
     7304          Symbol* symbol = Symbol::find (name);
     7305          if (symbol != 0)
     7306            {
     7307              symbol->printed = true;
     7308            }
     7309          if (symbol == 0 || symbol->type != Symbol::SymbolMacro)
     7310            {
     7311              CmtMessage::warning
     7312                (CmtError::get_error_name (CmtError::symbol_not_found)
     7313                 + ": macro " + name);
     7314            }
     7315        }
     7316
     7317      if (use.get_package_name () == "CMT")
     7318        {
     7319          cout << "set CMTCONFIG \"" << system << "\"" << endl;
     7320        }
     7321      else
     7322        {
     7323          if (do_config)
     7324            {
     7325              cout << "set " << use.prefix << "CONFIG \"" << tag << "\"" << endl;
    72637326            }
    72647327        }
     
    77997862    if (current_style == none_style)
    78007863      {
    7801         buffer = "macro srcdir \".";
    7802         buffer += "\"";
    7803         apply ();
    7804 
    7805         buffer = "macro src \".";
    7806         buffer += fs;
    7807         buffer += "\"";
    7808         apply ();
    7809 
    7810         buffer = "macro inc \".";
    7811         buffer += fs;
    7812         buffer += "\"";
    7813         apply ();
    7814 
    7815         buffer = "macro mgr \".";
    7816         buffer += fs;
    7817         buffer += "\"";
    7818         apply ();
    7819 
    7820         buffer = "macro bin \".";
    7821         buffer += fs;
    7822         buffer += "\"";
    7823         apply ();
    7824 
    7825         buffer = "macro BIN \"";
    7826         buffer += pwd;
    7827         buffer += fs;
    7828         buffer += "\"";
    7829         apply ();
    7830 
    7831         buffer = "macro javabin \".";
    7832         buffer += fs;
    7833         buffer += "\"";
    7834         apply ();
    7835 
    7836         buffer = "macro doc \".";
    7837         buffer += fs;
    7838         buffer += "\"";
    7839         apply ();
     7864        if (!Symbol::is_selected ("srcdir"))
     7865          {
     7866            buffer = "macro srcdir \".";
     7867            buffer += "\"";
     7868            apply ();
     7869          }
     7870
     7871        if (!Symbol::is_selected ("src"))
     7872          {
     7873            buffer = "macro src \".";
     7874            buffer += fs;
     7875            buffer += "\"";
     7876            apply ();
     7877          }
     7878
     7879        if (!Symbol::is_selected ("inc"))
     7880          {
     7881            buffer = "macro inc \".";
     7882            buffer += fs;
     7883            buffer += "\"";
     7884            apply ();
     7885          }
     7886
     7887        if (!Symbol::is_selected ("doc"))
     7888          {
     7889            buffer = "macro doc \".";
     7890            buffer += fs;
     7891            buffer += "\"";
     7892            apply ();
     7893          }
     7894
     7895        if (!Symbol::is_selected ("bin"))
     7896          {
     7897            buffer = "macro bin \".";
     7898            buffer += fs;
     7899            buffer += "\"";
     7900            apply ();
     7901          }
     7902
     7903        if (!Symbol::is_selected ("BIN"))
     7904          {
     7905            /*
     7906            buffer = "macro BIN \"";
     7907            buffer += pwd;
     7908            buffer += fs;
     7909            buffer += "\"";
     7910            apply ();
     7911            */
     7912            cmt_string temp = "$(bin)";
     7913            Symbol::expand (temp);
     7914            int len (temp.size());
     7915            cmt_string atemp;
     7916            if (CmtSystem::absolute_path (temp))
     7917              {
     7918                CmtSystem::compress_path (temp, atemp);
     7919              }
     7920            else
     7921              {
     7922                atemp = pwd + fs + temp;
     7923                CmtSystem::compress_path (atemp);
     7924              }
     7925            buffer = "macro BIN \"";
     7926            buffer += atemp;
     7927            buffer += "\"";
     7928            apply ();
     7929            if (0 != len && fs != temp[len - 1])
     7930              {
     7931                buffer = "macro_append bin \"";
     7932                buffer += fs;
     7933                buffer += "\"";
     7934                apply ();
     7935
     7936                buffer = "macro_append BIN \"";
     7937                buffer += fs;
     7938                buffer += "\"";
     7939                apply ();
     7940              }
     7941          }
     7942
     7943        if (!Symbol::is_selected ("javabin"))
     7944          {
     7945            buffer = "macro javabin \".";
     7946            buffer += fs;
     7947            buffer += "\"";
     7948            apply ();
     7949          }
     7950
     7951        if (!Symbol::is_selected ("mgr"))
     7952          {
     7953            buffer = "macro mgr \".";
     7954            buffer += fs;
     7955            buffer += "\"";
     7956            apply ();
     7957          }
    78407958      }
    78417959    else
     
    78938011            buffer += "\"";
    78948012            apply ();
    7895 
     8013          }
     8014
     8015        if (!Symbol::is_selected ("BIN"))
     8016          {
     8017            /*
    78968018            cmt_string pardir;
    78978019            CmtSystem::dirname (pwd, pardir);
     
    79068028            buffer += "\"";
    79078029            apply ();
    7908           }
    7909         else
    7910           {
     8030            */
    79118031            cmt_string temp = "$(bin)";
    79128032            Symbol::expand (temp);
  • CMT/HEAD/source/cmt_parser.h

    r547 r549  
    1818  Sh,
    1919  Bat,
    20   Make
     20  Make,
     21  Requirements
    2122} PrintMode;
    2223
  • CMT/HEAD/source/cmt_symbol.cxx

    r547 r549  
    828828
    829829  symbol.selected_value = -1;
     830  symbol.printed = false;
    830831
    831832  return (&symbol);
     
    14901491  if (Symbols.size () == 0) return;
    14911492
    1492   for (number = 0; number < Symbol::symbol_number (); number++)
    1493     {
    1494       Symbol& symbol = Symbol::symbol (number);
    1495 
    1496       if ((symbol.type == SymbolSet) ||
    1497           (symbol.type == SymbolAlias) ||
    1498           (symbol.type == SymbolSetupScript) ||
    1499           (symbol.type == SymbolPath))
    1500         {
    1501           if (symbol.print (mode))
    1502             {
    1503               if (mode == Bat)
    1504                 {
    1505                   cout << endl;
    1506                 }
    1507               else
    1508                 {
    1509                   cout << endl;
    1510                 }
    1511             }
    1512         }
     1493  switch (mode)
     1494    {
     1495    case Requirements :
     1496      for (number = 0; number < Symbol::symbol_number (); number++)
     1497        {
     1498          Symbol& symbol = Symbol::symbol (number);
     1499
     1500          if ((symbol.type == SymbolSet) ||
     1501              (symbol.type == SymbolAlias) ||
     1502              (symbol.type == SymbolSetupScript) ||
     1503              (symbol.type == SymbolPath) ||
     1504              (symbol.type == SymbolMacro))
     1505            {
     1506              if (symbol.print_macro (mode))
     1507                {
     1508                  //              cout << endl;
     1509                }
     1510            }
     1511        }
     1512      break;
     1513    default :
     1514      for (number = 0; number < Symbol::symbol_number (); number++)
     1515        {
     1516          Symbol& symbol = Symbol::symbol (number);
     1517         
     1518          if ((symbol.type == SymbolSet) ||
     1519              (symbol.type == SymbolAlias) ||
     1520              (symbol.type == SymbolSetupScript) ||
     1521              (symbol.type == SymbolPath))
     1522            {
     1523              if (symbol.print (mode))
     1524                {
     1525                  if (mode == Bat)
     1526                    {
     1527                      cout << endl;
     1528                    }
     1529                  else
     1530                    {
     1531                      cout << endl;
     1532                    }
     1533                }
     1534            }
     1535        }
     1536      break;
    15131537    }
    15141538}
     
    17991823
    18001824//-------------------------------------------------------------
     1825int Symbol::print_macro (PrintMode mode, ostream& out) const
     1826{
     1827  if (mode != Requirements || printed) return 0;
     1828  return builder->print (*this, out);
     1829}
     1830
     1831//-------------------------------------------------------------
    18011832cmt_string Symbol::clean_macro_value () const
    18021833{
     
    19772008
    19782009  return (temp);
     2010}
     2011
     2012//-------------------------------------------------------------
     2013int ValueBuilder::print (const Symbol& symbol, ostream& out)
     2014{
     2015  int result (0);
     2016
     2017  bool first_definition = true;
     2018 
     2019  for (int i = 0; i < symbol.value_lists.size (); i++)
     2020    {
     2021      const SymbolValueList& value_list = symbol.value_lists[i];
     2022
     2023      if ((value_list.use != 0) &&
     2024          (value_list.use->discarded)) continue;
     2025
     2026      const int selected = value_list.select_first ();
     2027
     2028      if (selected < 0) continue;
     2029
     2030      SymbolValue& value = value_list.values[selected];
     2031
     2032      result += value_list.print (symbol, value, first_definition);
     2033    }
     2034
     2035  return result;
    19792036}
    19802037
     
    29863043
    29873044//-------------------------------------------------------------
     3045//  Quote separators (spaces and tabs) with double quotes,
     3046//  double quotes with single quotes,
     3047//  single quotes with double quotes in text.
     3048//  Note: quotes preceded by backslash (i.e., \" or \') are NOT quoted
     3049//  (considered escaped)
     3050//-------------------------------------------------------------
     3051static cmt_string quote (const cmt_string& text,
     3052                         const cmt_string& separators)
     3053{
     3054  //cerr << "quote: `" << text << "'" << endl;
     3055  cmt_string result;
     3056  if (text.size () == 0) return result;
     3057
     3058  int allocated = 3 * text.size (); // if EACH character of text quoted with " or '
     3059  char* const buffer = (char*) malloc (allocated + 1);
     3060  char* b (buffer);
     3061
     3062  //  char* const beg (buffer);
     3063  const char* p = text.c_str ();
     3064  const char* const text_c (p);
     3065  //  const char* const beg_t (p);
     3066  //  cerr << "quote: p = `" << p << "'" << endl;
     3067
     3068  while (*p)
     3069    //  while (*p != '\0')
     3070    {
     3071      size_t l_nonsep = strcspn (p, separators.c_str ());
     3072      //cerr << "quote: l_nonsep = " << l_nonsep << " *p = '" << *p << "'" << endl;
     3073      while (l_nonsep--)
     3074        {
     3075          if (*p == '\"' &&
     3076              (p > text_c && *(p - 1) != '\\' || p == text_c))
     3077            { // quote " with '
     3078              *b++ = '\'';
     3079              *b++ = *p++;
     3080              *b++ = '\'';
     3081            }
     3082          else if (*p == '\'' &&
     3083                   (p > text_c && *(p - 1) != '\\' || p == text_c))
     3084            { // quote ' with "
     3085              *b++ = '\"';
     3086              *b++ = *p++;
     3087              *b++ = '\"';
     3088            }
     3089          else
     3090            { // simply copy
     3091              *b++ = *p++;
     3092            }
     3093        }
     3094      size_t l_sep = strspn (p, separators.c_str ());
     3095      //cerr << "quote: l_sep = " << l_sep << " *p = '" << *p << "'" << endl;
     3096      if (l_sep)
     3097        { // quote separators with "
     3098          // place quote before all backslashes preceding separators, if any
     3099          char* r = b;
     3100          while (r > buffer && *(r - 1) == '\\')
     3101            r--;
     3102          if (r == b)
     3103            *b++ = '\"';
     3104          else
     3105            *r = '\"', *b++ = '\\';
     3106          while (l_sep--)
     3107            *b++ = *p++;
     3108          *b++ = '\"';
     3109        }
     3110    }
     3111  *b = '\0';
     3112  result = buffer;
     3113  free (buffer);
     3114  return result;
     3115}
     3116
     3117//-------------------------------------------------------------
     3118int SymbolValueList::print (const Symbol& symbol,
     3119                            const SymbolValue& value,
     3120                            bool& first_definition) const
     3121{
     3122  int result (0);
     3123
     3124  if (use->get_package_name () == "CMT") return result;
     3125
     3126  cmt_string discarded_text;
     3127  cmt_string define_text;
     3128  ActionType action = Cmt::get_action ();
     3129
     3130  switch (command_type)
     3131    {
     3132      //case CommandSet :
     3133      case CommandSetAppend :
     3134      case CommandSetPrepend :
     3135      case CommandSetRemove :
     3136      case CommandSetRemoveRegexp :
     3137        //case CommandAlias :
     3138        //case CommandPath :
     3139      case CommandPathAppend :
     3140      case CommandPathPrepend :
     3141      case CommandPathRemove :
     3142      case CommandPathRemoveRegexp :
     3143      case CommandMacroPrepend :
     3144        //case CommandMacro :
     3145      case CommandMacroAppend :
     3146      case CommandMacroRemove :
     3147      case CommandMacroRemoveRegexp :
     3148      case CommandMacroRemoveAll :
     3149      case CommandMacroRemoveAllRegexp :
     3150        //case CommandAction :
     3151        if (value.text == "") return result;
     3152        break;
     3153    }
     3154
     3155  if (discarded) discarded_text = " (discarded by override)";
     3156  else discarded_text = "";
     3157
     3158  if (first_definition) define_text = "defines";
     3159  else define_text = "overrides";
     3160
     3161  cout << "# Package ";
     3162  if (use != 0)
     3163    {
     3164      cout << use->get_package_name () << " " << use->version;
     3165    }
     3166
     3167  switch (command_type)
     3168    {
     3169      case CommandSet :
     3170        cout << " " << define_text << " set " << symbol.name << " as " << endl;
     3171        //        cout << " " << define_text << " set " << symbol.name << " as ";
     3172        cout << "set " << symbol.name;
     3173        first_definition = false;
     3174        result = 1;
     3175        break;
     3176      case CommandSetAppend :
     3177        cout << " appends to set " << symbol.name << " : " << endl;;
     3178        //        cout << " appends to set " << symbol.name << " : ";
     3179        cout << "set_append " << symbol.name;
     3180        result = 1;
     3181        break;
     3182      case CommandSetPrepend :
     3183        cout << " prepends to set " << symbol.name << " : " << endl;
     3184        //        cout << " prepends to set " << symbol.name << " : ";
     3185        cout << "set_prepend " << symbol.name;
     3186        result = 1;
     3187        break;
     3188      case CommandSetRemove :
     3189        cout << " removes from set " << symbol.name << " : " << endl;
     3190        //        cout << " removes from set " << symbol.name << " : ";
     3191        cout << "set_remove " << symbol.name;
     3192        result = 1;
     3193        break;
     3194      case CommandSetRemoveRegexp :
     3195        cout << " removes RE from set " << symbol.name << " : " << endl;
     3196        //        cout << " removes RE from set " << symbol.name << " : ";
     3197        cout << "set_remove_regexp " << symbol.name;
     3198        result = 1;
     3199        break;
     3200      case CommandAlias :
     3201        cout << " " << define_text << " alias " << symbol.name << endl;
     3202        //        cout << " " << define_text << " alias " << symbol.name << " as ";
     3203        cout << "alias " << symbol.name;
     3204        first_definition = false;
     3205        result = 1;
     3206        break;
     3207      case CommandPath :
     3208        cout << " " << define_text << " path " << symbol.name << endl;
     3209        //        cout << " " << define_text << " path " << symbol.name << " as ";
     3210        cout << "path " << symbol.name;
     3211        first_definition = false;
     3212        result = 1;
     3213        break;
     3214      case CommandPathAppend :
     3215        cout << " appends to path " << symbol.name << endl;
     3216        //        cout << " appends to path " << symbol.name << " : ";
     3217        cout << "path_append " << symbol.name;
     3218        result = 1;
     3219        break;
     3220      case CommandPathPrepend :
     3221        cout << " prepends to path " << symbol.name << " : " << endl;
     3222        //        cout << " prepends to path " << symbol.name << " : ";
     3223        cout << "path_prepend " << symbol.name;
     3224        result = 1;
     3225        break;
     3226      case CommandPathRemove :
     3227        cout << " removes from path " << symbol.name << " : " << endl;
     3228        //        cout << " removes from path " << symbol.name << " : ";
     3229        cout << "path_remove " << symbol.name;
     3230        result = 1;
     3231        break;
     3232      case CommandPathRemoveRegexp :
     3233        cout << " removes RE from path " << symbol.name << " : " << endl;
     3234        //        cout << " removes RE from path " << symbol.name << " : ";
     3235        cout << "path_remove_regexp " << symbol.name;
     3236        result = 1;
     3237        break;
     3238      case CommandMacro :
     3239        cout << " " << define_text << " macro " << symbol.name << " as " << endl;
     3240        //        cout << " " << define_text << " macro " << symbol.name << " as ";
     3241        cout << "macro " << symbol.name;
     3242        result = 1;
     3243        break;
     3244      case CommandMacroPrepend :
     3245        cout << " prepends to macro " << symbol.name << " : " << endl;
     3246        //        cout << " prepends to macro " << symbol.name << " : ";
     3247        cout << "macro_prepend " << symbol.name;
     3248        result = 1;
     3249        break;
     3250      case CommandMacroAppend :
     3251        cout << " appends to macro " << symbol.name << " : " << endl;
     3252        //        cout << " appends to macro " << symbol.name << " : ";
     3253        cout << "macro_append " << symbol.name;
     3254        result = 1;
     3255        break;
     3256      case CommandMacroRemove :
     3257        cout << " remove from macro " << symbol.name << " : " << endl;
     3258        //        cout << " remove from macro " << symbol.name << " : ";
     3259        cout << "macro_remove " << symbol.name;
     3260        result = 1;
     3261        break;
     3262      case CommandMacroRemoveRegexp :
     3263        cout << " remove RE from macro " << symbol.name << " : " << endl;
     3264        //        cout << " remove RE from macro " << symbol.name << " : ";
     3265        cout << "macro_remove_regexp " << symbol.name;
     3266        result = 1;
     3267        break;
     3268      case CommandMacroRemoveAll :
     3269        cout << " remove all from macro " << symbol.name << " : " << endl;
     3270        //        cout << " remove all from macro " << symbol.name << " : ";
     3271        cout << "macro_remove_all " << symbol.name;
     3272        result = 1;
     3273        break;
     3274      case CommandMacroRemoveAllRegexp :
     3275        cout << " remove all RE from macro " << symbol.name << " : " << endl;
     3276        //        cout << " remove all RE from macro " << symbol.name << " : ";
     3277        cout << "macro_remove_all_regexp " << symbol.name;
     3278        result = 1;
     3279        break;
     3280      case CommandSetupScript :
     3281        cout << " " << define_text << " setup script " << symbol.name << endl;
     3282        //       cout << " " << define_text << " action " << symbol.name << " as ";
     3283        cout << "setup_script" /* << symbol.name */;
     3284        first_definition = false;
     3285        result = 1;
     3286        break;
     3287        /*
     3288      case CommandAction :
     3289        cout << " " << define_text << " action " << symbol.name << " as ";
     3290        first_definition = false;
     3291        break;
     3292        */
     3293    }
     3294
     3295  cout << " " << quote (value.text, " \t");
     3296  //  cout << "'" << value.text << "'";
     3297         
     3298  /*
     3299  Tag* selected_tag = value.tag;
     3300         
     3301  if ((selected_tag == 0) ||
     3302      (selected_tag == Tag::get_default ()))
     3303    {
     3304      cout << " for default tag";
     3305    }
     3306  else
     3307    {
     3308      cout << " for tag '" << selected_tag->get_name () << "'";
     3309    }
     3310  */
     3311
     3312  cout << endl;
     3313  //  cout << discarded_text << endl;
     3314  return result;
     3315}
     3316
     3317//-------------------------------------------------------------
    29883318bool Symbol::check_tag_used (Tag* tag)
    29893319{
  • CMT/HEAD/source/cmt_symbol.h

    r547 r549  
    3434  int select_last () const;
    3535  void show (const Symbol& symbol, const SymbolValue& value, bool& first_definition) const;
     36  int print (const Symbol& symbol, const SymbolValue& value, bool& first_definition) const;
    3637
    3738  CommandType command_type;
     
    4950  ValueBuilder ();
    5051  const cmt_string build_and_display (const Symbol& symbol);
     52  int print (const Symbol& symbol, ostream& out = cout);
    5153
    5254  virtual const cmt_string build (const Symbol& symbol,
     
    118120  int print (PrintMode mode);
    119121  cmt_string build_macro_value (bool display_it = false) const;
     122  int print_macro (PrintMode mode, ostream& out = cout) const;
    120123  cmt_string clean_macro_value () const;
    121124  cmt_string resolve_macro_value (const cmt_string& tag_name = "");
     
    132135
    133136  int selected_value;        /* according to the last selected tag */
     137  bool printed;
    134138
    135139private:
  • CMT/HEAD/source/cmt_tag.cxx

    r547 r549  
    716716
    717717/*----------------------------------------------------------*/
    718 void Tag::show_definition (bool quiet, ostream& out) const
     718void Tag::show_definition (bool quiet, ostream& out,
     719                           const cmt_string& prefix) const
    719720{
    720721  static const cmt_string priority_text[] = {
     
    730731  if (m_name == "Default") return;
    731732
    732   out << m_name;
     733  out << prefix << m_name;
    733734
    734735  if (!quiet)
     
    810811
    811812/*----------------------------------------------------------*/
    812 void Tag::show (bool quiet, ostream& out) const
    813 {
    814   if (is_primary () && is_selected ()) show_definition (quiet, out);
     813void Tag::show (bool quiet, ostream& out, const cmt_string& prefix) const
     814{
     815  if (is_primary () && is_selected ()) show_definition (quiet, out, prefix);
    815816}
    816817
  • CMT/HEAD/source/cmt_tag.h

    r547 r549  
    5252  void unmark ();
    5353  void mark ();
    54   void show_definition (bool quiet, ostream& out = cout) const;
     54  void show_definition (bool quiet, ostream& out = cout,
     55                        const cmt_string& prefix = "") const;
    5556  //  void show_definition (bool quiet) const;
    56   void show (bool quiet, ostream& out = cout) const;
     57  void show (bool quiet, ostream& out = cout, const cmt_string& prefix = "") const;
    5758  //  void show (bool quiet) const;
    5859  bool is_selected () const;
Note: See TracChangeset for help on using the changeset viewer.