mail[Wesnoth-commits] r44963 - /trunk/src/serialization/preprocessor.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by alinktomine on July 31, 2010 - 09:42:
Author: alink
Date: Sat Jul 31 09:42:14 2010
New Revision: 44963

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44963&view=rev
Log:
Revert r44956 (and r44958 which relied on it),
because it breaks debug info of some error messages

Modified:
    trunk/src/serialization/preprocessor.cpp

Modified: trunk/src/serialization/preprocessor.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/serialization/preprocessor.cpp?rev=44963&r1=44962&r2=44963&view=diff
==============================================================================
--- trunk/src/serialization/preprocessor.cpp (original)
+++ trunk/src/serialization/preprocessor.cpp Sat Jul 31 09:42:14 2010
@@ -47,8 +47,13 @@
 typedef std::map<std::string, int> t_file_number_map;
 static t_file_number_map file_number_map;
 
+static bool encode_filename = true;
+
 // get filename associated to this code
 static std::string get_filename(const std::string& file_code){
+       if(!encode_filename)
+               return file_code;
+
        std::stringstream s;
        s << file_code;
        int n = 0;
@@ -63,6 +68,9 @@
 
 // get code associated to this filename
 static std::string get_file_code(const std::string& filename){
+       if(!encode_filename)
+               return filename;
+
        // current number of encountered filenames
        static int current_file_number = 0;
 
@@ -368,6 +376,9 @@
 preprocessor::~preprocessor()
 {
        assert(target_.current_ == this);
+       if (!old_location_.empty()) {
+               target_.buffer_ << "\376line " << old_linenum_ << ' ' << 
old_location_ << '\n';
+       }
        if (!old_textdomain_.empty() && target_.textdomain_ != 
old_textdomain_) {
                target_.buffer_ << "\376textdomain " << old_textdomain_ << 
'\n';
        }
@@ -540,6 +551,7 @@
        t.location_ = s.str();
        t.linenum_ = linenum;
 
+       t.buffer_ << "\376line " << linenum << ' ' << t.location_ << '\n';
        if (t.textdomain_ != domain) {
                t.buffer_ << "\376textdomain " << domain << '\n';
                t.textdomain_ = domain;
@@ -559,7 +571,8 @@
        tokens_.push_back(token);
        std::ostringstream s;
        if (!skipping_ && slowpath_) {
-               s << "\376textdomain " << target_.textdomain_ << '\n';
+               s << "\376line " << linenum_ << ' ' << target_.location_
+                 << "\n\376textdomain " << target_.textdomain_ << '\n';
        }
        strings_.push_back(s.str());
 }
@@ -649,6 +662,9 @@
                target_.linenum_ = cond_linenum;
                if (diff <= target_.location_.size() + 11) {
                        target_.buffer_ << std::string(diff, '\n');
+               } else {
+                       target_.buffer_ << "\376line " << target_.linenum_
+                               << ' ' << target_.location_ << '\n';
                }
        }
 
@@ -927,7 +943,8 @@
                                        target_.error(error.str(), linenum_);
                                }
                                std::ostringstream v;
-                               v << arg->second << "\376textdomain " << 
target_.textdomain_ << '\n';
+                               v << arg->second << "\376line " << linenum_ 
<< ' ' << target_.location_
+                                 << "\n\376textdomain " << 
target_.textdomain_ << '\n';
                                pop_token();
                                put(v.str());
                        }
@@ -1082,6 +1099,9 @@
 
        LOG_PREPROC<<"processing resource: "<<res_name<<'\n';
 
+       //disable filename encoding to get clear #line in cfg.plain
+       encode_filename = false;
+
        std::string error_log;
        scoped_istream stream = preprocess_file(res_name, defines_map, 
&error_log);
        std::stringstream ss;




Related Messages


Powered by MHonArc, Updated Sat Jul 31 10:20:15 2010