wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src/serialization preprocessor.cpp prep...


From: David White
Subject: [Wesnoth-cvs-commits] wesnoth/src/serialization preprocessor.cpp prep...
Date: Thu, 23 Jun 2005 19:10:54 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     David White <address@hidden>    05/06/23 23:10:54

Modified files:
        src/serialization: preprocessor.cpp preprocessor.hpp 

Log message:
        made preprocess_file() function modify the passed in defines map so the 
caller can see the definitions

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/preprocessor.cpp.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/preprocessor.hpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: wesnoth/src/serialization/preprocessor.cpp
diff -u wesnoth/src/serialization/preprocessor.cpp:1.20 
wesnoth/src/serialization/preprocessor.cpp:1.21
--- wesnoth/src/serialization/preprocessor.cpp:1.20     Sat Jun  4 19:16:06 2005
+++ wesnoth/src/serialization/preprocessor.cpp  Thu Jun 23 23:10:54 2005
@@ -1,4 +1,4 @@
-/* $Id: preprocessor.cpp,v 1.20 2005/06/04 19:16:06 ott Exp $ */
+/* $Id: preprocessor.cpp,v 1.21 2005/06/23 23:10:54 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Copyright (C) 2005 by Guillaume Melquiond <address@hidden>
@@ -67,7 +67,8 @@
        virtual int underflow();
        std::ostringstream buffer_;
        preprocessor *current_;
-       preproc_map *defines_;
+       preproc_map *defines_;
+       preproc_map default_defines_;
        std::string textdomain_;
        std::string location_;
        int linenum_;
@@ -85,11 +86,14 @@
 preprocessor_streambuf::preprocessor_streambuf(preproc_map *def)
        : current_(NULL), defines_(def), textdomain_(PACKAGE),
          depth_(0), quoted_(false)
-{
+{
+       if(defines_ == NULL) {
+               defines_ = &default_defines_;
+       }
 }
 
 preprocessor_streambuf::preprocessor_streambuf(preprocessor_streambuf const &t)
-       : std::streambuf(), current_(NULL), defines_(t.defines_),
+       : current_(NULL), defines_(t.defines_),
          textdomain_(PACKAGE), depth_(t.depth_), quoted_(t.quoted_)
 {
 }
@@ -711,17 +715,14 @@
 {
        preprocessor_streambuf *buf_;
        preprocessor_deleter(preprocessor_streambuf *buf) : 
std::basic_istream<char>(buf), buf_(buf) {}
-       ~preprocessor_deleter() { rdbuf(NULL); delete buf_->defines_; delete 
buf_; }
+       ~preprocessor_deleter() { rdbuf(NULL); delete buf_; }
 };
 
 std::istream *preprocess_file(std::string const &fname,
-                              preproc_map const *defines)
+                              preproc_map *defines)
 {
        log_scope("preprocessing file...");
-       preproc_map *defines_copy = new preproc_map;
-       if (defines)
-               *defines_copy = *defines;
-       preprocessor_streambuf *buf = new preprocessor_streambuf(defines_copy);
+       preprocessor_streambuf *buf = new preprocessor_streambuf(defines);
        new preprocessor_file(*buf, fname);
        return new preprocessor_deleter(buf);
 }
Index: wesnoth/src/serialization/preprocessor.hpp
diff -u wesnoth/src/serialization/preprocessor.hpp:1.7 
wesnoth/src/serialization/preprocessor.hpp:1.8
--- wesnoth/src/serialization/preprocessor.hpp:1.7      Sat May  7 16:11:22 2005
+++ wesnoth/src/serialization/preprocessor.hpp  Thu Jun 23 23:10:54 2005
@@ -1,4 +1,4 @@
-/* $Id: preprocessor.hpp,v 1.7 2005/05/07 16:11:22 silene Exp $ */
+/* $Id: preprocessor.hpp,v 1.8 2005/06/23 23:10:54 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Copyright (C) 2005 by Guillaume Melquiond <address@hidden>
@@ -40,6 +40,6 @@
 //function to use the WML preprocessor on a file, and returns the resulting
 //preprocessed file data. defines is a map of symbols defined.
 std::istream *preprocess_file(std::string const &fname,
-                              preproc_map const *defines = NULL);
+                              preproc_map *defines = NULL);
 
 #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]