Update of /cvsroot/boost/boost/boost/wave
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4358/boost/wave

Modified Files:
        cpp_context.hpp 
Log Message:
Wave: fixed --force_include behavior as discussed on the list.

Index: cpp_context.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/wave/cpp_context.hpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- cpp_context.hpp     8 Mar 2007 14:04:37 -0000       1.33
+++ cpp_context.hpp     11 Mar 2007 17:23:44 -0000      1.34
@@ -119,11 +119,12 @@
     context(target_iterator_type const &first_, target_iterator_type const 
&last_, 
             char const *fname = "<Unknown>", HooksT const &hooks_ = HooksT())
     :   first(first_), last(last_), filename(fname)
+      , has_been_initialized(false)
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
-        , current_filename(fname)
+      , current_filename(fname)
 #endif 
-        , macros(*this_())
-        , language(language_support(
+      , macros(*this_())
+      , language(language_support(
                       support_cpp 
                     | support_option_convert_trigraphs 
                     | support_option_emit_line_directives 
@@ -135,10 +136,9 @@
 #endif
                     | support_option_insert_whitespace
                    ))
-        , hooks(hooks_)
+      , hooks(hooks_)
     {
         macros.init_predefined_macros(fname);
-        includes.init_initial_path();
     }
     
 // default copy constructor
@@ -153,7 +153,6 @@
             using namespace boost::filesystem;
             path fpath(complete(path(filename)));
             fname = fpath.string();
-            includes.set_current_directory(fname.c_str());
         }
         return iterator_type(*this, first, last, 
position_type(fname.c_str())); 
     }
@@ -166,7 +165,6 @@
             using namespace boost::filesystem;
             path fpath(complete(path(filename)));
             fname = fpath.string();
-            includes.set_current_directory(fname.c_str());
         }
         return iterator_type(*this, first_, last_, 
position_type(fname.c_str())); 
     }
@@ -254,6 +252,21 @@
     friend class boost::wave::impl::pp_iterator_functor<
         boost::wave::context<IteratorT, lexer_type, InputPolicyT, HooksT> >;
 #endif
+
+// make sure the context has been initialized    
+    void init_context()
+    {
+        if (!has_been_initialized) {
+            std::string fname(filename);
+            if (filename != "<Unknown>" && filename != "<stdin>") {
+                using namespace boost::filesystem;
+                path fpath(complete(path(filename)));
+                fname = fpath.string();
+                includes.set_current_directory(fname.c_str());
+            }
+            has_been_initialized = true;  // execute once
+        }
+    }
     
     template <typename IteratorT2>
     bool is_defined_macro(IteratorT2 const &begin, IteratorT2 const &end) 
@@ -420,6 +433,7 @@
     target_iterator_type first;         // underlying input stream
     target_iterator_type last;
     std::string filename;               // associated main filename
+    bool has_been_initialized;          // set cwd once
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
     std::string current_filename;       // real name of current preprocessed 
file
 #endif 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to