Changeset 1459
- Timestamp:
- Jan 9, 2012, 3:49:37 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.release_year
r1323 r1459 1 201 11 2012 -
trunk/lib/Configuration.cc
r1442 r1459 53 53 54 54 55 void Configuration::add_codon(std::string key, std::string start, 55 void Configuration::add_codon(std::string key, std::string start, 56 56 std::string end) 57 57 { … … 62 62 if (i->first == key) 63 63 iter = i; 64 64 65 65 if (iter==string2codons_.end()) 66 66 string2codons_.push_back(std::make_pair(key, VectorPair(1,p))); … … 89 89 { 90 90 std::ostringstream ss; 91 if (const std::vector<std::pair<std::string, std::string> >* 91 if (const std::vector<std::pair<std::string, std::string> >* 92 92 codons = codon(path)) { 93 93 using std::string; 94 94 typedef std::vector<std::pair<string, string> >::const_iterator citerator; 95 for ( citerator codon=codons->begin(); codon!=codons->end(); ++codon) 95 for ( citerator codon=codons->begin(); codon!=codons->end(); ++codon) 96 96 ss << codon->first << codon->second; 97 97 } … … 105 105 return result; 106 106 } 107 108 109 const std::vector<std::pair<std::string, std::string> >* 110 Configuration::codon(std::string file_name) const 107 108 109 const std::vector<std::pair<std::string, std::string> >* 110 Configuration::codon(std::string file_name) const 111 111 { 112 112 if (const std::pair<std::string,std::string>* dict=dictionary(file_name)) … … 132 132 } 133 133 134 const std::pair<std::string,std::string>* 134 const std::pair<std::string,std::string>* 135 135 Configuration::dictionary(std::string lhs) const 136 136 { … … 204 204 } 205 205 if (section == "copyright-alias"){ 206 std::map<std::string,Alias>::iterator iter = 206 std::map<std::string,Alias>::iterator iter = 207 207 copyright_alias_.lower_bound(lhs); 208 208 if (iter!=copyright_alias_.end() && iter->first==lhs){ … … 211 211 throw Config_error(line, mess.str()); 212 212 } 213 213 214 214 // insert alias 215 215 copyright_alias_.insert(iter,std::make_pair(lhs, Alias(rhs,copyright_alias_.size()))); … … 246 246 tab_size_ = strtoul(rhs.c_str(), NULL, 10); 247 247 if (tab_size_==0) { 248 throw Config_error(line, 248 throw Config_error(line, 249 249 "invalid value: tab-size must be a positive integer"); 250 250 } … … 277 277 } 278 278 author_color_[lhs] = rhs; 279 } 279 } 280 280 else if (section == "parsing-codons") { 281 281 if (!parsing_found) { … … 284 284 string2codons_.clear(); 285 285 } 286 286 287 287 if (codon(lhs)) { 288 288 std::stringstream mess; … … 292 292 i!=string2codons_.end(); ++i) { 293 293 if (fnmatch(lhs.c_str(), i->first.c_str())) { 294 mess << " `" << i->first << "'";294 mess << "'" << i->first << "'"; 295 295 break; 296 296 } … … 313 313 else if (start.size()<3) { 314 314 std::stringstream mess; 315 mess << "start-code `" << start << "' is invalid";315 mess << "start-code '" << start << "' is invalid"; 316 316 throw std::runtime_error(mess.str()); 317 317 } … … 322 322 else if (end.size()<3) { 323 323 std::stringstream mess; 324 mess << "end-code `" << end << "' is invalid";324 mess << "end-code '" << end << "' is invalid"; 325 325 throw std::runtime_error(mess.str()); 326 326 } … … 334 334 add_codon(lhs, start, end); 335 335 } 336 } 336 } 337 337 else if (section == "file-name-dictionary") { 338 338 if (!dictionary_found) { … … 341 341 dictionary_.clear(); 342 342 } 343 343 344 344 if (const std::pair<std::string, std::string>* entry=dictionary(lhs)) { 345 345 std::stringstream mess; 346 346 mess << "clashes with previous given file name pattern: " 347 << " `" << entry->first << "'";347 << "'" << entry->first << "'"; 348 348 throw Config_error(line, mess.str()); 349 349 } 350 350 lhs = trim(lhs); 351 351 rhs = trim(rhs); 352 if (!lhs.empty() && !rhs.empty()) 352 if (!lhs.empty() && !rhs.empty()) 353 353 dictionary_.push_back(std::make_pair(lhs, rhs)); 354 354 else if (!lhs.empty() || !rhs.empty()) { 355 355 throw Config_error(line, ""); 356 356 } 357 } 357 } 358 358 else if (section == "svn-props") { 359 359 svn_props_.push_back(std::make_pair(lhs, empty_str_map_)); … … 376 376 } 377 377 catch (std::runtime_error e) { 378 throw Config_error(line, 378 throw Config_error(line, 379 379 "unknown format: " + rhs + "\n" + e.what()); 380 380 } … … 385 385 } 386 386 catch (std::runtime_error e) { 387 throw Config_error(line, 387 throw Config_error(line, 388 388 "unknown format: " + rhs + "\n" + e.what()); 389 389 } … … 400 400 std::ostringstream oss; 401 401 oss << "Valid arguments are:\n" 402 << " - `none'\n"403 << " - `pdf'\n"404 << " - `png'\n"405 << " - `svg'";402 << " - 'none'\n" 403 << " - 'pdf'\n" 404 << " - 'png'\n" 405 << " - 'svg'"; 406 406 throw std::runtime_error(oss.str()); 407 407 } … … 415 415 std::ostringstream oss; 416 416 oss << "Valid arguments are:\n" 417 << " - `none'\n"418 << " - `png'\n"419 << " - `svg'";417 << " - 'none'\n" 418 << " - 'png'\n" 419 << " - 'svg'"; 420 420 throw std::runtime_error(oss.str()); 421 421 } … … 440 440 441 441 442 std::string 442 std::string 443 443 Configuration::translate(const std::string& str, 444 444 const std::pair<std::string, std::string>& dic) const … … 450 450 mess << "invalid config file: " 451 451 << "expression " << dic.first << " is invalid"; 452 throw std::runtime_error(mess.str()); 453 } 454 for (std::string::const_iterator i(dic.second.begin()); 452 throw std::runtime_error(mess.str()); 453 } 454 for (std::string::const_iterator i(dic.second.begin()); 455 455 i!=dic.second.end(); ++i) { 456 456 if (*i == '$') { … … 464 464 if (n) 465 465 mess << "because " << n << " is a too large."; 466 throw std::runtime_error(mess.str()); 466 throw std::runtime_error(mess.str()); 467 467 } 468 468 res += vec[n-1]; … … 494 494 { 495 495 if (str.size()>0 && str[0]=='\n') 496 return std::string("\\n") + str.substr(1); 496 return std::string("\\n") + str.substr(1); 497 497 return str; 498 498 } … … 503 503 if (str.size()<2 || str[0]!=c || str[str.size()-1]!=c){ 504 504 std::stringstream mess; 505 mess << "expected `" << str << "' to be surrounded by `" << c << "'";505 mess << "expected '" << str << "' to be surrounded by '" << c << "'"; 506 506 throw std::runtime_error(mess.str()); 507 507 } … … 587 587 Configuration::svn_properties(const std::string& filename) const 588 588 { 589 // reverse backwards as we prefer to to pick properties defined later 590 std::vector<props>::const_reverse_iterator iter = 589 // reverse backwards as we prefer to to pick properties defined later 590 std::vector<props>::const_reverse_iterator iter = 591 591 find_fn(svn_props_.rbegin(), svn_props_.rend(), filename); 592 592 if (iter==svn_props_.rend()) … … 657 657 os << "no\n"; 658 658 os << "# defining start of copyright statement\n"; 659 os << "copyright-string = " << conf.copyright_string_ << "\n"; 659 os << "copyright-string = " << conf.copyright_string_ << "\n"; 660 660 661 661 os << "\n" … … 674 674 PairSecondCompare<const std::string, Alias, IdCompare> comp(id); 675 675 std::sort(vec.begin(),vec.end(), comp); 676 676 677 677 678 678 for (vector::const_iterator i(vec.begin()); i!=vec.end(); ++i) { … … 704 704 << "[svn-props]\n"; 705 705 os << "# COPYING = svndigest:ignore\n"; 706 std::vector<props>::const_iterator p=conf.svn_props_.begin(); 706 std::vector<props>::const_iterator p=conf.svn_props_.begin(); 707 707 for ( ; p!=conf.svn_props_.end(); ++p) { 708 708 os << p->first << " = "; … … 729 729 os << "\n" 730 730 << "### Section for setting dictionary for file names.\n" 731 << "### Prior looking for file name pattern in section " 731 << "### Prior looking for file name pattern in section " 732 732 << "[parsing-codons],\n" 733 733 << "### the file name may be translated according to the rules \n" 734 734 << "### in this section. In default setting there is, for example,\n" 735 << "### a rule to translate `<FILENAME>.in' to `<FILENAME>'.\n"735 << "### a rule to translate '<FILENAME>.in' to '<FILENAME>'.\n" 736 736 << "### The format of the entries is:\n" 737 737 << "### file-name-pattern = new-name\n" … … 741 741 os << "[file-name-dictionary]\n"; 742 742 for (size_t i=0; i<conf.dictionary_.size(); ++i) 743 os << conf.dictionary_[i].first << " = " 744 << conf.dictionary_[i].second << "\n"; 743 os << conf.dictionary_[i].first << " = " 744 << conf.dictionary_[i].second << "\n"; 745 745 746 746 if (!conf.string2codons_.empty()) { … … 755 755 << "[parsing-codons]\n"; 756 756 for (size_t i=0; i<conf.string2codons_.size(); ++i) { 757 os << conf.string2codons_[i].first << " = "; 757 os << conf.string2codons_[i].first << " = "; 758 758 for (size_t j=0; j<conf.string2codons_[i].second.size(); ++j) { 759 759 if (j) 760 760 os << " ; "; 761 os << "\"" << trans_beg_code(conf.string2codons_[i].second[j].first) 762 << "\":\"" 763 << trans_end_code(conf.string2codons_[i].second[j].second) 764 << "\""; 761 os << "\"" << trans_beg_code(conf.string2codons_[i].second[j].first) 762 << "\":\"" 763 << trans_end_code(conf.string2codons_[i].second[j].second) 764 << "\""; 765 765 } 766 766 os << "\n"; … … 770 770 } 771 771 772 772 773 773 Config_error::Config_error(const std::string& line,const std::string& message) 774 : std::runtime_error(std::string("line: `") + line +774 : std::runtime_error(std::string("line: '") + line + 775 775 std::string("' is invalid.\n") + message) 776 776 {} -
trunk/lib/CopyrightVisitor.cc
r1457 r1459 140 140 if (!detect_copyright(file.path(),old_block, start_line, end_line, prefix)){ 141 141 if (Configuration::instance().missing_copyright_warning()) 142 std::cerr << "svncopyright: warning: no copyright statement found in `"142 std::cerr << "svncopyright: warning: no copyright statement found in '" 143 143 << file.path() << "'\n"; 144 144 return; … … 231 231 // if alias not found for author 232 232 if (i==alias_.end()) { 233 std::cerr << "svncopyright: warning: no copyright alias found for `"233 std::cerr << "svncopyright: warning: no copyright alias found for '" 234 234 << *user << "'\n"; 235 235 // insert alias to avoid multiple warnings. -
trunk/lib/main_utility.cc
r1430 r1459 47 47 assert(is.good()); 48 48 if (verbose) 49 std::cout << "Reading configuration file: `" << file << "'\n";49 std::cout << "Reading configuration file: '" << file << "'\n"; 50 50 try { 51 51 config.load(is); -
trunk/lib/utility.cc
r1439 r1459 214 214 if (code){ 215 215 std::stringstream ss; 216 ss << "mkdir: `" << dir << "': ";216 ss << "mkdir: '" << dir << "': "; 217 217 throw yat::utility::errno_error(ss.str()); 218 218 }
Note: See TracChangeset
for help on using the changeset viewer.